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