4 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
6 SPDX-License-Identifier: BSD-2-Clause-Patent
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.
20 Supporting Specifiction: OpRegion / Software SCI SPEC 0.70
23 IGD: Internal Graphics Device
24 NVS: ACPI Non Volatile Storage
25 OpRegion: ACPI Operational Region
26 VBT: Video BIOS Table (OEM customizable data)
30 #ifndef _IGD_OPREGION_H_
31 #define _IGD_OPREGION_H_
34 // Statements that include other header files.
36 #include "VlvPlatformInit.h"
37 #include "VlvCommonDefinitions.h"
38 #include <Uefi/UefiInternalFormRepresentation.h>
39 #include <FrameworkDxe.h>
43 // OpRegion (Miscellaneous) #defines.
45 // OpRegion Header #defines.
48 #define HEADER_SIGNATURE "IntelGraphicsMem"
49 #define HEADER_SIZE 0x2000
50 #define HEADER_OPREGION_VER 0x0200
51 #define HEADER_OPREGION_REV 0x00
54 //For VLV Tablet, MailBOX2(SCI)is not supported.
56 #define HEADER_MBOX_SUPPORT (HD_MBOX4 + HD_MBOX3 + HD_MBOX1)
65 //Audio Type support for VLV2 A0
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)
76 // OpRegion Mailbox 1 EQUates.
78 // OpRegion Mailbox 3 EQUates.
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
97 // GMCH PCI register access #defines.
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)
105 // Video BIOS / VBT #defines
107 #define IGD_DID_VLV 0x0F31
108 #define OPTION_ROM_SIGNATURE 0xAA55
109 #define VBIOS_LOCATION_PRIMARY 0xC0000
111 #define VBT_SIGNATURE SIGNATURE_32 ('$', 'V', 'B', 'T')
118 UINT16 Signature
; // 0xAA55
123 } INTEL_VBIOS_OPTION_ROM_HEADER
;
128 UINT32 Signature
; // "PCIR"
129 UINT16 VendorId
; // 0x8086
140 } INTEL_VBIOS_PCIR_STRUCTURE
;
145 UINT8 HeaderSignature
[20];
146 UINT16 HeaderVersion
;
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
;
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
;
173 // Driver Private Function definitions
181 Acquire the string associated with the ProducerGuid and return it.
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
187 @retval EFI_SUCCESS The function completed successfully
188 @retval EFI_NOT_FOUND The requested string was not found
193 IN EFI_GUID
*ProducerGuid
,
200 Graphics OpRegion / Software SCI driver installation function.
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.
214 Extract information pertaining to the HiiHandle
216 @param HiiHandle Hii handle
217 @param ImageLength For input, length of DefaultImage;
218 For output, length of actually required
220 @param DefaultImage Image buffer prepared by caller
221 @param Guid Guid information about the form
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.
229 ExtractDataFromHiiHandle (
230 IN EFI_HII_HANDLE HiiHandle
,
231 IN OUT UINT16
*ImageLength
,
232 OUT UINT8
*DefaultImage
,