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