]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - Vlv2TbltDevicePkg/PlatformDxe/ExI.c
BaseTools: StrGather simplify string/int conversion functions
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformDxe / ExI.c
... / ...
CommitLineData
1/** @file\r
2\r
3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
4 \r\r
5 This program and the accompanying materials are licensed and made available under\r\r
6 the terms and conditions of the BSD License that accompanies this distribution. \r\r
7 The full text of the license may be found at \r\r
8 http://opensource.org/licenses/bsd-license.php. \r\r
9 \r\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r\r
12 \r\r
13\r
14Module Name:\r
15\r
16\r
17 ExI.c\r
18\r
19Abstract:\r
20\r
21 ExI configuration based on setup option\r
22\r
23\r
24--*/\r
25\r
26\r
27#include "PlatformDxe.h"\r
28\r
29#define PchLpcPciCfg32(Register) MmioRead32 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_LPC, 0, Register))\r
30\r
31//\r
32// Procedure: GetPmcBase\r
33//\r
34// Description: This function read content of B:D:F 0:31:0, offset 44h (for\r
35// PmcBase)\r
36//\r
37// Input: None\r
38//\r
39// Output: 32 bit PmcBase\r
40//\r
41UINT32\r
42GetPmcBase (\r
43 VOID\r
44 )\r
45{\r
46 return (PchLpcPciCfg32 (R_PCH_LPC_PMC_BASE) & B_PCH_LPC_PMC_BASE_BAR);\r
47}\r
48\r
49/**\r
50 Configure ExI.\r
51\r
52 @param ImageHandle Pointer to the loaded image protocol for this driver\r
53 @param SystemTable Pointer to the EFI System Table\r
54\r
55 @retval EFI_SUCCESS The driver initializes correctly.\r
56**/\r
57VOID\r
58InitExI (\r
59 )\r
60{\r
61 EFI_STATUS Status;\r
62\r
63 SYSTEM_CONFIGURATION SystemConfiguration;\r
64 UINTN VarSize;\r
65\r
66 VarSize = sizeof(SYSTEM_CONFIGURATION);\r
67\r
68 Status = gRT->GetVariable(\r
69 L"Setup",\r
70 &gEfiNormalSetupGuid,\r
71 NULL,\r
72 &VarSize,\r
73 &SystemConfiguration\r
74 );\r
75\r
76 if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {\r
77 //The setup variable is corrupted\r
78 VarSize = sizeof(SYSTEM_CONFIGURATION);\r
79 Status = gRT->GetVariable(\r
80 L"SetupRecovery",\r
81 &gEfiNormalSetupGuid,\r
82 NULL,\r
83 &VarSize,\r
84 &SystemConfiguration\r
85 );\r
86 ASSERT_EFI_ERROR (Status);\r
87 } \r
88\r
89 if (SystemConfiguration.ExISupport == 1) {\r
90 MmioOr32 ((UINTN) (GetPmcBase() + R_PCH_PMC_MTPMC1), (UINT32) BIT0+BIT1+BIT2);\r
91 } else if (SystemConfiguration.ExISupport == 0) {\r
92 MmioAnd32 ((UINTN) (GetPmcBase() + R_PCH_PMC_MTPMC1), ~((UINT32) BIT0+BIT1+BIT2)); //clear bit 0,1,2\r
93 }\r
94}\r