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