4 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
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.
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.
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.
25 Supporting Specifiction: OpRegion / Software SCI SPEC 0.70
28 IGD: Internal Graphics Device
29 NVS: ACPI Non Volatile Storage
30 OpRegion: ACPI Operational Region
31 VBT: Video BIOS Table (OEM customizable data)
35 #ifndef _IGD_OPREGION_H_
36 #define _IGD_OPREGION_H_
39 // Statements that include other header files.
41 #include "VlvPlatformInit.h"
42 #include "VlvCommonDefinitions.h"
43 #include <Uefi/UefiInternalFormRepresentation.h>
44 #include <FrameworkDxe.h>
48 // OpRegion (Miscellaneous) #defines.
50 // OpRegion Header #defines.
53 #define HEADER_SIGNATURE "IntelGraphicsMem"
54 #define HEADER_SIZE 0x2000
55 #define HEADER_OPREGION_VER 0x0200
56 #define HEADER_OPREGION_REV 0x00
59 //For VLV Tablet, MailBOX2(SCI)is not supported.
61 #define HEADER_MBOX_SUPPORT (HD_MBOX4 + HD_MBOX3 + HD_MBOX1)
70 //Audio Type support for VLV2 A0
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)
81 // OpRegion Mailbox 1 EQUates.
83 // OpRegion Mailbox 3 EQUates.
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
102 // GMCH PCI register access #defines.
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)
110 // Video BIOS / VBT #defines
112 #define IGD_DID_VLV 0x0F31
113 #define OPTION_ROM_SIGNATURE 0xAA55
114 #define VBIOS_LOCATION_PRIMARY 0xC0000
116 #define VBT_SIGNATURE SIGNATURE_32 ('$', 'V', 'B', 'T')
123 UINT16 Signature
; // 0xAA55
128 } INTEL_VBIOS_OPTION_ROM_HEADER
;
133 UINT32 Signature
; // "PCIR"
134 UINT16 VendorId
; // 0x8086
145 } INTEL_VBIOS_PCIR_STRUCTURE
;
150 UINT8 HeaderSignature
[20];
151 UINT16 HeaderVersion
;
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
;
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
;
178 // Driver Private Function definitions
186 Acquire the string associated with the ProducerGuid and return it.
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
192 @retval EFI_SUCCESS The function completed successfully
193 @retval EFI_NOT_FOUND The requested string was not found
198 IN EFI_GUID
*ProducerGuid
,
205 Graphics OpRegion / Software SCI driver installation function.
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.
219 Extract information pertaining to the HiiHandle
221 @param HiiHandle Hii handle
222 @param ImageLength For input, length of DefaultImage;
223 For output, length of actually required
225 @param DefaultImage Image buffer prepared by caller
226 @param Guid Guid information about the form
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.
234 ExtractDataFromHiiHandle (
235 IN EFI_HII_HANDLE HiiHandle
,
236 IN OUT UINT16
*ImageLength
,
237 OUT UINT8
*DefaultImage
,