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 Module Name:
16 
17   IgdOpRegion.h
18 
19 Abstract:
20 
21   This file is part of the IGD OpRegion Implementation.  The IGD OpRegion is
22   an interface between system BIOS, ASL code, and Graphics drivers.
23 
24   Supporting Specifiction: IGD OpRegion/Software SCI SPEC
25 
26   Note:  Data structures defined in this protocol are packed not naturally
27     aligned.
28 
29   GUID forms:
30     {CDC5DDDF-E79D-41ec-A9B0-6565490DB9D3}
31     (0xcdc5dddf, 0xe79d, 0x41ec, 0xa9, 0xb0, 0x65, 0x65, 0x49, 0xd, 0xb9, 0xd3);
32 
33   Acronyms:
34     NVS:        ACPI Non Volatile Storage
35     OpRegion:   ACPI Operational Region
36     VBT:        Video BIOS Table (OEM customizable data)
37 
38 --*/
39 
40 #ifndef _IGD_OPREGION_PROTOCOL_H_
41 #define _IGD_OPREGION_PROTOCOL_H_
42 
43 //
44 // OpRegion / Software SCI protocol GUID
45 //
46 #define IGD_OPREGION_PROTOCOL_GUID \
47   { \
48     0xcdc5dddf, 0xe79d, 0x41ec, 0xa9, 0xb0, 0x65, 0x65, 0x49, 0xd, 0xb9, 0xd3 \
49   }
50 
51 //
52 // Extern the GUID for protocol users.
53 //
54 extern EFI_GUID gIgdOpRegionProtocolGuid;
55 
56 //
57 // Forward reference for pure ANSI compatability
58 //
59 typedef struct _IGD_OPREGION_PROTOCOL IGD_OPREGION_PROTOCOL;
60 
61 //
62 // Protocol data definitions
63 //
64 
65 //
66 // OpRegion structures:
67 // Sub-structures define the different parts of the OpRegion followed by the
68 // main structure representing the entire OpRegion.
69 //
70 // Note: These structures are packed to 1 byte offsets because the exact
71 // data location is requred by the supporting design specification due to
72 // the fact that the data is used by ASL and Graphics driver code compiled
73 // separatly.
74 //
75 
76 //
77 // OpRegion header (mailbox 0) structure and #defines.
78 //
79 #pragma pack (1)
80 typedef struct {
81   CHAR8   SIGN[0x10]; // 0      OpRegion signature
82   UINT32  SIZE;       // 0x10   OpRegion size
83   UINT32  OVER;       // 0x14   OpRegion structure version
84   UINT8   SVER[0x20]; // 0x18   System BIOS build version
85   UINT8   VVER[0x10]; // 0x38   Video BIOS build version
86   UINT8   GVER[0x10]; // 0x48   Graphic driver build version
87   UINT32  MBOX;       // 0x58   Mailboxes supported
88   UINT32  DMOD;       // 0x5C   Driver Model
89   UINT32  PCON;       // 0x60   Platform Configuration Info
90   CHAR8   GOPV[0x20]; // 0X64   GOP build version
91   UINT8   RSV[0x7C];  //        Reserved
92 } OPREGION_HEADER;
93 #pragma pack ()
94 
95 //
96 // OpRegion mailbox 1 (public ACPI Methods).
97 //
98 #pragma pack (1)
99 typedef struct {
100   UINT32  DRDY;     // 0    Driver readiness
101   UINT32  CSTS;     // 4    Status
102   UINT32  CEVT;     // 8    Current event
103   UINT8   RM11[0x14]; // 12   Reserved
104   UINT32  DIDL;       // 32   Supported display devices list
105   UINT32  DDL2;       //  8 Devices.
106   UINT32  DDL3;
107   UINT32  DDL4;
108   UINT32  DDL5;
109   UINT32  DDL6;
110   UINT32  DDL7;
111   UINT32  DDL8;
112   UINT32  CPDL;       // 64   Currently present display devices list
113   UINT32  CPL2;       //  8 Devices.
114   UINT32  CPL3;
115   UINT32  CPL4;
116   UINT32  CPL5;
117   UINT32  CPL6;
118   UINT32  CPL7;
119   UINT32  CPL8;
120   UINT32  CADL;       // 96   Currently active display devices list
121   UINT32  CAL2;       //  8 Devices.
122   UINT32  CAL3;
123   UINT32  CAL4;
124   UINT32  CAL5;
125   UINT32  CAL6;
126   UINT32  CAL7;
127   UINT32  CAL8;
128   UINT32  NADL;       // 128  Next active device list
129   UINT32  NDL2;       //   8 Devices.
130   UINT32  NDL3;
131   UINT32  NDL4;
132   UINT32  NDL5;
133   UINT32  NDL6;
134   UINT32  NDL7;
135   UINT32  NDL8;
136   UINT32  ASLP;     // 160  ASL sleep timeout
137   UINT32  TIDX;     // 164  Toggle table index
138   UINT32  CHPD;     // 168  Current hot plug enable indicator
139   UINT32  CLID;     // 172  Current lid state indicator
140   UINT32  CDCK;     // 176  Current docking state indicator
141   UINT32  SXSW;     // 180  Display Switch notification on Sx State resume
142   UINT32  EVTS;     // 184  Events supported by ASL
143   UINT32  CNOT;     // 188  Current OS Notification
144   UINT32  NRDY;     // 192  Reasons for DRDY = 0
145   UINT8   RM12[0x3C]; // 196  Reserved
146 } OPREGION_MBOX1;
147 #pragma pack ()
148 
149 //
150 // OpRegion mailbox 2 (Software SCI Interface).
151 //
152 #pragma pack (1)
153 typedef struct {
154   UINT32  SCIC;       // 0    Software SCI function number parameters
155   UINT32  PARM;       // 4    Software SCI additional parameters
156   UINT32  DSLP;       // 8    Driver sleep timeout
157   UINT8   RM21[0xF4]; // 12   Reserved
158 } OPREGION_MBOX2;
159 #pragma pack ()
160 
161 //
162 // OpRegion mailbox 3 (Power Conservation).
163 //
164 #pragma pack (1)
165 typedef struct {
166   UINT32  ARDY;       // 0    Driver readiness
167   UINT32  ASLC;       // 4    ASLE interrupt command / status
168   UINT32  TCHE;       // 8    Technology enabled indicator
169   UINT32  ALSI;       // 12   Current ALS illuminance reading
170   UINT32  BCLP;       // 16   Backlight britness to set
171   UINT32  PFIT;       // 20   Panel fitting Current State or Request
172   UINT32  CBLV;       // 24   Brightness Current State
173   UINT16  BCLM[0x14]; // 28   Backlight Brightness Level Duty Cycle Mapping Table
174   UINT32  CPFM;       // 68   Panel Fitting Current Mode
175   UINT32  EPFM;       // 72   Enabled Panel Fitting Mode
176   UINT8   PLUT[0x4A]; // 76   Panel Look Up Table
177   UINT32  PFMB;       // 150  PWM Frequency and Minimum Brightness
178   UINT32  CCDV;       // 154  Color Correction Default Values
179   UINT32  PCFT;       // 158  Power Conservation Features
180   UINT8   RM31[0x5E]; // 162  Reserved
181 } OPREGION_MBOX3;
182 #pragma pack ()
183 
184 //
185 // OpRegion mailbox 4 (VBT).
186 //
187 #pragma pack (1)
188 typedef struct {
189   UINT8 GVD1[0x1800]; // 6K Reserved
190 } OPREGION_VBT;
191 #pragma pack ()
192 
193 #pragma pack (1)
194 typedef struct {
195   UINT8 EDIDOVRD[0x400]; // 6K Edid overriding data
196 } OPREGION_MBOX5;
197 #pragma pack ()
198 //
199 // Entire OpRegion
200 //
201 #pragma pack (1)
202 typedef struct {
203   OPREGION_HEADER  Header; // OpRegion header
204   OPREGION_MBOX1   MBox1;  // Mailbox 1: Public ACPI Methods
205   OPREGION_MBOX2   MBox2;  // Mailbox 2: Software SCI Inteface
206   OPREGION_MBOX3   MBox3;  // Mailbox 3: Power Conservation
207   OPREGION_VBT        VBT;    // VBT: Video BIOS Table (OEM customizable data)
208   OPREGION_MBOX5   MBox5;
209 } IGD_OPREGION_STRUC;
210 #pragma pack ()
211 
212 //
213 // Protocol data structure definition
214 //
215 struct _IGD_OPREGION_PROTOCOL {
216   IGD_OPREGION_STRUC    *OpRegion;
217 };
218 
219 #endif
220