]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.h
UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmiStack" with PatchInstructionX86()
[mirror_edk2.git] / Vlv2TbltDevicePkg / VlvPlatformInitDxe / IgdOpRegion.h
1
2 /*++
3
4 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
5
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14
15
16 Module Name:
17
18 IgdOpRegion.h
19
20 Abstract:
21
22 This is part of the implementation of an Intel Graphics drivers OpRegion /
23 Software SCI interface between system BIOS, ASL code, and Graphics drivers.
24
25 Supporting Specifiction: OpRegion / Software SCI SPEC 0.70
26
27 Acronyms:
28 IGD: Internal Graphics Device
29 NVS: ACPI Non Volatile Storage
30 OpRegion: ACPI Operational Region
31 VBT: Video BIOS Table (OEM customizable data)
32
33 --*/
34
35 #ifndef _IGD_OPREGION_H_
36 #define _IGD_OPREGION_H_
37
38 //
39 // Statements that include other header files.
40 //
41 #include "VlvPlatformInit.h"
42 #include "VlvCommonDefinitions.h"
43 #include <Uefi/UefiInternalFormRepresentation.h>
44 #include <FrameworkDxe.h>
45
46 //
47 //
48 // OpRegion (Miscellaneous) #defines.
49 //
50 // OpRegion Header #defines.
51 //
52
53 #define HEADER_SIGNATURE "IntelGraphicsMem"
54 #define HEADER_SIZE 0x2000
55 #define HEADER_OPREGION_VER 0x0200
56 #define HEADER_OPREGION_REV 0x00
57
58 //
59 //For VLV Tablet, MailBOX2(SCI)is not supported.
60 //
61 #define HEADER_MBOX_SUPPORT (HD_MBOX4 + HD_MBOX3 + HD_MBOX1)
62 #define HD_MBOX1 BIT0
63 #define HD_MBOX2 BIT1
64 #define HD_MBOX3 BIT2
65 #define HD_MBOX4 BIT3
66 #define HD_MBOX5 BIT4
67 #define SVER_SIZE 32
68
69 //
70 //Audio Type support for VLV2 A0
71 //
72 #define AUDIO_TYPE_SUPPORT_MASK 0xFFFFFFF3
73 #define NO_AUDIO_SUPPORT (0<<2)
74 #define HD_AUDIO_SUPPORT (1<<2)
75 #define LPE_AUDIO_SUPPORT (2<<2)
76 #define AUDIO_TYPE_FIELD_MASK 0xFFFFFFEF
77 #define AUDIO_TYPE_FIELD_VALID (1<<4)
78 #define AUDIO_TYPE_FIELD_INVALID (0<<4)
79
80 //
81 // OpRegion Mailbox 1 EQUates.
82 //
83 // OpRegion Mailbox 3 EQUates.
84 //
85 #define ALS_ENABLE BIT0
86 #define BLC_ENABLE BIT1
87 #define BACKLIGHT_BRIGHTNESS 0xFF
88 #define FIELD_VALID_BIT BIT31
89 #define WORD_FIELD_VALID_BIT BIT15
90 #define PFIT_ENABLE BIT2
91 #define PFIT_OPRN_AUTO 0x00000000
92 #define PFIT_OPRN_SCALING 0x00000007
93 #define PFIT_OPRN_OFF 0x00000000
94 #define PFIT_SETUP_AUTO 0
95 #define PFIT_SETUP_SCALING 1
96 #define PFIT_SETUP_OFF 2
97 #define INIT_BRIGHT_LEVEL 0x64
98 #define PFIT_STRETCH 6
99 #define PFIT_CENTER 1
100
101 //
102 // GMCH PCI register access #defines.
103 //
104
105 #define IgdMmPci32(Register) MmPci32 (0, IGD_BUS, IGD_DEV, IGD_FUN_0, Register)
106 #define IgdMmPci16Or(Register, OrData) MmPci16Or (0, IGD_BUS, IGD_DEV, IGD_FUN_0, Register, OrData)
107 #define IgdMmPci16AndThenOr(Register,AndData,OrData) MmPci16AndThenOr (0, IGD_BUS, IGD_DEV, IGD_FUN_0, Register, AndData, OrData)
108
109 //
110 // Video BIOS / VBT #defines
111 //
112 #define IGD_DID_VLV 0x0F31
113 #define OPTION_ROM_SIGNATURE 0xAA55
114 #define VBIOS_LOCATION_PRIMARY 0xC0000
115
116 #define VBT_SIGNATURE SIGNATURE_32 ('$', 'V', 'B', 'T')
117
118 //
119 // Typedef stuctures
120 //
121 #pragma pack (1)
122 typedef struct {
123 UINT16 Signature; // 0xAA55
124 UINT8 Size512;
125 UINT8 Reserved[21];
126 UINT16 PcirOffset;
127 UINT16 VbtOffset;
128 } INTEL_VBIOS_OPTION_ROM_HEADER;
129 #pragma pack ()
130
131 #pragma pack (1)
132 typedef struct {
133 UINT32 Signature; // "PCIR"
134 UINT16 VendorId; // 0x8086
135 UINT16 DeviceId;
136 UINT16 Reserved0;
137 UINT16 Length;
138 UINT8 Revision;
139 UINT8 ClassCode[3];
140 UINT16 ImageLength;
141 UINT16 CodeRevision;
142 UINT8 CodeType;
143 UINT8 Indicator;
144 UINT16 Reserved1;
145 } INTEL_VBIOS_PCIR_STRUCTURE;
146 #pragma pack ()
147
148 #pragma pack (1)
149 typedef struct {
150 UINT8 HeaderSignature[20];
151 UINT16 HeaderVersion;
152 UINT16 HeaderSize;
153 UINT16 HeaderVbtSize;
154 UINT8 HeaderVbtCheckSum;
155 UINT8 HeaderReserved;
156 UINT32 HeaderOffsetVbtDataBlock;
157 UINT32 HeaderOffsetAim1;
158 UINT32 HeaderOffsetAim2;
159 UINT32 HeaderOffsetAim3;
160 UINT32 HeaderOffsetAim4;
161 UINT8 DataHeaderSignature[16];
162 UINT16 DataHeaderVersion;
163 UINT16 DataHeaderSize;
164 UINT16 DataHeaderDataBlockSize;
165 UINT8 CoreBlockId;
166 UINT16 CoreBlockSize;
167 UINT16 CoreBlockBiosSize;
168 UINT8 CoreBlockBiosType;
169 UINT8 CoreBlockReleaseStatus;
170 UINT8 CoreBlockHWSupported;
171 UINT8 CoreBlockIntegratedHW;
172 UINT8 CoreBlockBiosBuild[4];
173 UINT8 CoreBlockBiosSignOn[155];
174 } VBIOS_VBT_STRUCTURE;
175 #pragma pack ()
176
177 //
178 // Driver Private Function definitions
179 //
180 EFI_STATUS
181 GetSVER (
182 OUT UINT8 *SVER
183 );
184
185 /**
186 Acquire the string associated with the ProducerGuid and return it.
187
188 @param ProducerGuid The Guid to search the HII database for
189 @param Token The token value of the string to extract
190 @param String The string that is extracted
191
192 @retval EFI_SUCCESS The function completed successfully
193 @retval EFI_NOT_FOUND The requested string was not found
194
195 **/
196 EFI_STATUS
197 GetStringFromToken (
198 IN EFI_GUID *ProducerGuid,
199 IN STRING_REF Token,
200 OUT CHAR16 **String
201 );
202
203 /**
204
205 Graphics OpRegion / Software SCI driver installation function.
206
207 @param Void
208
209 @retval EFI_SUCCESS The driver installed without error.
210 @retval EFI_ABORTED The driver encountered an error and could not complete
211 installation of the ACPI tables.
212 **/
213 EFI_STATUS
214 IgdOpRegionInit (
215 void
216 );
217
218 /**
219 Extract information pertaining to the HiiHandle
220
221 @param HiiHandle Hii handle
222 @param ImageLength For input, length of DefaultImage;
223 For output, length of actually required
224
225 @param DefaultImage Image buffer prepared by caller
226 @param Guid Guid information about the form
227
228 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
229 @retval EFI_BUFFER_TOO_SMALL DefualtImage has no enough ImageLength
230 @retval EFI_SUCCESS Successfully extract data from Hii database.
231
232 **/
233 EFI_STATUS
234 ExtractDataFromHiiHandle (
235 IN EFI_HII_HANDLE HiiHandle,
236 IN OUT UINT16 *ImageLength,
237 OUT UINT8 *DefaultImage,
238 OUT EFI_GUID *Guid
239 );
240 #endif