1 /** @file 2 Multiplatform initialization. 3 4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 7 This program and the accompanying materials are licensed and made available under 8 9 the terms and conditions of the BSD License that accompanies this distribution. 10 11 The full text of the license may be found at 12 13 http://opensource.org/licenses/bsd-license.php. 14 15 16 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 18 19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 20 21 22 23 24 **/ 25 26 #include <MultiPlatformLib.h> 27 28 /** 29 Platform Type detection. Because the PEI globle variable 30 is in the flash, it could not change directly.So use 31 2 PPIs to distinguish the platform type. MultiPlatformInfoInit(IN CONST EFI_PEI_SERVICES ** PeiServices,IN OUT EFI_PLATFORM_INFO_HOB * PlatformInfoHob)32 33 @param FfsHeader Pointer to Firmware File System file header. 34 @param PeiServices General purpose services available to every PEIM. 35 36 @retval EFI_SUCCESS Memory initialization completed successfully. 37 @retval Others All other error conditions encountered result in an ASSERT. 38 39 **/ 40 EFI_STATUS 41 MultiPlatformInfoInit ( 42 IN CONST EFI_PEI_SERVICES **PeiServices, 43 IN OUT EFI_PLATFORM_INFO_HOB *PlatformInfoHob 44 ) 45 { 46 UINT32 PcieLength; 47 EFI_STATUS Status; 48 49 50 PlatformInfoHob->IohSku = MmPci16(0, MC_BUS, MC_DEV, MC_FUN, PCI_DEVICE_ID_OFFSET); 51 52 PlatformInfoHob->IohRevision = MmPci8(0, MC_BUS, MC_DEV, MC_FUN, PCI_REVISION_ID_OFFSET); 53 54 // 55 // Update ICH Type 56 // 57 // 58 // Device ID 59 // 60 PlatformInfoHob->IchSku = PchLpcPciCfg16(PCI_DEVICE_ID_OFFSET); 61 62 PlatformInfoHob->IchRevision = PchLpcPciCfg8(PCI_REVISION_ID_OFFSET); 63 64 // 65 //64MB 66 // 67 PcieLength = 0x04000000; 68 69 // 70 // Don't support BASE above 4GB currently. 71 // 72 PlatformInfoHob->PciData.PciExpressSize = PcieLength; 73 PlatformInfoHob->PciData.PciExpressBase = PcdGet64 (PcdPciExpressBaseAddress); 74 75 PlatformInfoHob->PciData.PciResourceMem32Base = (UINT32) (PlatformInfoHob->PciData.PciExpressBase - RES_MEM32_MIN_LEN); 76 PlatformInfoHob->PciData.PciResourceMem32Limit = (UINT32) (PlatformInfoHob->PciData.PciExpressBase -1); 77 78 PlatformInfoHob->PciData.PciResourceMem64Base = RES_MEM64_36_BASE; 79 PlatformInfoHob->PciData.PciResourceMem64Limit = RES_MEM64_36_LIMIT; 80 PlatformInfoHob->CpuData.CpuAddressWidth = 36; 81 82 PlatformInfoHob->MemData.MemMir0 = PlatformInfoHob->PciData.PciResourceMem64Base; 83 PlatformInfoHob->MemData.MemMir1 = PlatformInfoHob->PciData.PciResourceMem64Limit + 1; 84 85 PlatformInfoHob->PciData.PciResourceMinSecBus = 1; //can be changed by SystemConfiguration->PciMinSecondaryBus; 86 87 // 88 // Set MemMaxTolm to the lowest address between PCIe Base and PCI32 Base. 89 // 90 if (PlatformInfoHob->PciData.PciExpressBase > PlatformInfoHob->PciData.PciResourceMem32Base ) { 91 PlatformInfoHob->MemData.MemMaxTolm = (UINT32) PlatformInfoHob->PciData.PciResourceMem32Base; 92 } else { 93 PlatformInfoHob->MemData.MemMaxTolm = (UINT32) PlatformInfoHob->PciData.PciExpressBase; 94 } 95 PlatformInfoHob->MemData.MemTolm = PlatformInfoHob->MemData.MemMaxTolm; 96 97 // 98 // Platform PCI MMIO Size in unit of 1MB. 99 // 100 PlatformInfoHob->MemData.MmioSize = 0x1000 - (UINT16)(PlatformInfoHob->MemData.MemMaxTolm >> 20); 101 102 // 103 // Enable ICH IOAPIC 104 // 105 PlatformInfoHob->SysData.SysIoApicEnable = ICH_IOAPIC; 106 107 DEBUG ((EFI_D_ERROR, "PlatformFlavor is %x (%x=tablet,%x=mobile,%x=desktop)\n", PlatformInfoHob->PlatformFlavor,FlavorTablet,FlavorMobile,FlavorDesktop)); 108 109 // 110 // Get Platform Info and fill the Hob. 111 // 112 PlatformInfoHob->RevisonId = PLATFORM_INFO_HOB_REVISION; 113 114 // 115 // Get GPIO table 116 // 117 Status = MultiPlatformGpioTableInit (PeiServices, PlatformInfoHob); 118 119 // 120 // Program GPIO 121 // 122 Status = MultiPlatformGpioProgram (PeiServices, PlatformInfoHob); 123 124 // 125 // Update OemId 126 // 127 Status = InitializeBoardOemId (PeiServices, PlatformInfoHob); 128 Status = InitializeBoardSsidSvid (PeiServices, PlatformInfoHob); 129 130 return EFI_SUCCESS; 131 } 132