2 Multiplatform initialization.
4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <MultiPlatformLib.h>
15 Platform Type detection. Because the PEI globle variable
16 is in the flash, it could not change directly.So use
17 2 PPIs to distinguish the platform type.
19 @param FfsHeader Pointer to Firmware File System file header.
20 @param PeiServices General purpose services available to every PEIM.
22 @retval EFI_SUCCESS Memory initialization completed successfully.
23 @retval Others All other error conditions encountered result in an ASSERT.
27 MultiPlatformInfoInit (
28 IN CONST EFI_PEI_SERVICES
**PeiServices
,
29 IN OUT EFI_PLATFORM_INFO_HOB
*PlatformInfoHob
35 PlatformInfoHob
->IohSku
= MmPci16(0, MC_BUS
, MC_DEV
, MC_FUN
, PCI_DEVICE_ID_OFFSET
);
37 PlatformInfoHob
->IohRevision
= MmPci8(0, MC_BUS
, MC_DEV
, MC_FUN
, PCI_REVISION_ID_OFFSET
);
45 PlatformInfoHob
->IchSku
= PchLpcPciCfg16(PCI_DEVICE_ID_OFFSET
);
47 PlatformInfoHob
->IchRevision
= PchLpcPciCfg8(PCI_REVISION_ID_OFFSET
);
52 PcieLength
= 0x04000000;
55 // Don't support BASE above 4GB currently.
57 PlatformInfoHob
->PciData
.PciExpressSize
= PcieLength
;
58 PlatformInfoHob
->PciData
.PciExpressBase
= PcdGet64 (PcdPciExpressBaseAddress
);
60 PlatformInfoHob
->PciData
.PciResourceMem32Base
= (UINT32
) (PlatformInfoHob
->PciData
.PciExpressBase
- RES_MEM32_MIN_LEN
);
61 PlatformInfoHob
->PciData
.PciResourceMem32Limit
= (UINT32
) (PlatformInfoHob
->PciData
.PciExpressBase
-1);
63 PlatformInfoHob
->PciData
.PciResourceMem64Base
= RES_MEM64_36_BASE
;
64 PlatformInfoHob
->PciData
.PciResourceMem64Limit
= RES_MEM64_36_LIMIT
;
65 PlatformInfoHob
->CpuData
.CpuAddressWidth
= 36;
67 PlatformInfoHob
->MemData
.MemMir0
= PlatformInfoHob
->PciData
.PciResourceMem64Base
;
68 PlatformInfoHob
->MemData
.MemMir1
= PlatformInfoHob
->PciData
.PciResourceMem64Limit
+ 1;
70 PlatformInfoHob
->PciData
.PciResourceMinSecBus
= 1; //can be changed by SystemConfiguration->PciMinSecondaryBus;
73 // Set MemMaxTolm to the lowest address between PCIe Base and PCI32 Base.
75 if (PlatformInfoHob
->PciData
.PciExpressBase
> PlatformInfoHob
->PciData
.PciResourceMem32Base
) {
76 PlatformInfoHob
->MemData
.MemMaxTolm
= (UINT32
) PlatformInfoHob
->PciData
.PciResourceMem32Base
;
78 PlatformInfoHob
->MemData
.MemMaxTolm
= (UINT32
) PlatformInfoHob
->PciData
.PciExpressBase
;
80 PlatformInfoHob
->MemData
.MemTolm
= PlatformInfoHob
->MemData
.MemMaxTolm
;
83 // Platform PCI MMIO Size in unit of 1MB.
85 PlatformInfoHob
->MemData
.MmioSize
= 0x1000 - (UINT16
)(PlatformInfoHob
->MemData
.MemMaxTolm
>> 20);
90 PlatformInfoHob
->SysData
.SysIoApicEnable
= ICH_IOAPIC
;
92 DEBUG ((EFI_D_ERROR
, "PlatformFlavor is %x (%x=tablet,%x=mobile,%x=desktop)\n",
93 PlatformInfoHob
->PlatformFlavor
,
99 // Get Platform Info and fill the Hob.
101 PlatformInfoHob
->RevisonId
= PLATFORM_INFO_HOB_REVISION
;
106 MultiPlatformGpioTableInit (PeiServices
, PlatformInfoHob
);
111 MultiPlatformGpioProgram (PeiServices
, PlatformInfoHob
);
116 InitializeBoardOemId (PeiServices
, PlatformInfoHob
);
117 InitializeBoardSsidSvid (PeiServices
, PlatformInfoHob
);