CoffeeLake Intel(R) Firmware Support Package (FSP) Integration Guide: GpioConfig.h Source File

CoffeeLake Intel Firmware

CoffeeLake Intel(R) Firmware Support Package (FSP) Integration Guide
GpioConfig.h
Go to the documentation of this file.
1 /** @file
2  Header file for GpioConfig structure used by GPIO library.
3 
4 @copyright
5  Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
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 @par Specification Reference:
15 **/
16 #ifndef _GPIO_CONFIG_H_
17 #define _GPIO_CONFIG_H_
18 
19 #pragma pack(push, 1)
20 
21 ///
22 /// For any GpioPad usage in code use GPIO_PAD type
23 ///
24 typedef UINT32 GPIO_PAD;
25 
26 
27 ///
28 /// For any GpioGroup usage in code use GPIO_GROUP type
29 ///
30 typedef UINT32 GPIO_GROUP;
31 
32 /**
33  GPIO configuration structure used for pin programming.
34  Structure contains fields that can be used to configure pad.
35 **/
36 typedef struct {
37  /**
38  Pad Mode
39  Pad can be set as GPIO or one of its native functions.
40  When in native mode setting Direction (except Inversion), OutputState,
41  InterruptConfig, Host Software Pad Ownership and OutputStateLock are unnecessary.
42  Refer to definition of GPIO_PAD_MODE.
43  Refer to EDS for each native mode according to the pad.
44  **/
45  UINT32 PadMode : 5;
46  /**
47  Host Software Pad Ownership
48  Set pad to ACPI mode or GPIO Driver Mode.
49  Refer to definition of GPIO_HOSTSW_OWN.
50  **/
51  UINT32 HostSoftPadOwn : 2;
52  /**
53  GPIO Direction
54  Can choose between In, In with inversion, Out, both In and Out, both In with inversion and out or disabling both.
55  Refer to definition of GPIO_DIRECTION for supported settings.
56  **/
57  UINT32 Direction : 6;
58  /**
59  Output State
60  Set Pad output value.
61  Refer to definition of GPIO_OUTPUT_STATE for supported settings.
62  This setting takes place when output is enabled.
63  **/
64  UINT32 OutputState : 2;
65  /**
66  GPIO Interrupt Configuration
67  Set Pad to cause one of interrupts (IOxAPIC/SCI/SMI/NMI).
68  This setting is applicable only if GPIO is in GpioMode with input enabled.
69  Refer to definition of GPIO_INT_CONFIG for supported settings.
70  **/
71  UINT32 InterruptConfig : 9;
72  /**
73  GPIO Power Configuration.
74  This setting controls Pad Reset Configuration.
75  Refer to definition of GPIO_RESET_CONFIG for supported settings.
76  **/
77  UINT32 PowerConfig : 8;
78  /**
79  GPIO Electrical Configuration
80  This setting controls pads termination.
81  Refer to definition of GPIO_ELECTRICAL_CONFIG for supported settings.
82  **/
83  UINT32 ElectricalConfig : 9;
84  /**
85  GPIO Lock Configuration
86  This setting controls pads lock.
87  Refer to definition of GPIO_LOCK_CONFIG for supported settings.
88  **/
89  UINT32 LockConfig : 4;
90  /**
91  Additional GPIO configuration
92  Refer to definition of GPIO_OTHER_CONFIG for supported settings.
93  **/
94  UINT32 OtherSettings : 9;
95  UINT32 RsvdBits : 10; ///< Reserved bits for future extension
96 } GPIO_CONFIG;
97 
98 
99 typedef enum {
100  GpioHardwareDefault = 0x0 ///< Leave setting unmodified
102 
103 /**
104  GPIO Pad Mode
105  Refer to GPIO documentation on native functions available for certain pad.
106  If GPIO is set to one of NativeX modes then following settings are not applicable
107  and can be skipped:
108  - Interrupt related settings
109  - Host Software Ownership
110  - Output/Input enabling/disabling
111  - Output lock
112 **/
113 typedef enum {
114  GpioPadModeGpio = 0x1,
115  GpioPadModeNative1 = 0x3,
116  GpioPadModeNative2 = 0x5,
117  GpioPadModeNative3 = 0x7,
118  GpioPadModeNative4 = 0x9,
119  GpioPadModeNative5 = 0xB
120 } GPIO_PAD_MODE;
121 
122 /**
123  Host Software Pad Ownership modes
124  This setting affects GPIO interrupt status registers. Depending on chosen ownership
125  some GPIO Interrupt status register get updated and other masked.
126  Please refer to EDS for HOSTSW_OWN register description.
127 **/
128 typedef enum {
129  GpioHostOwnDefault = 0x0, ///< Leave ownership value unmodified
130  /**
131  Set HOST ownership to ACPI.
132  Use this setting if pad is not going to be used by GPIO OS driver.
133  If GPIO is configured to generate SCI/SMI/NMI then this setting must be
134  used for interrupts to work
135  **/
137  /**
138  Set HOST ownership to GPIO Driver mode.
139  Use this setting only if GPIO pad should be controlled by GPIO OS Driver.
140  GPIO OS Driver will be able to control the pad if appropriate entry in
141  ACPI exists (refer to ACPI specification for GpioIo and GpioInt descriptors)
142  **/
145 
146 ///
147 /// GPIO Direction
148 ///
149 typedef enum {
150  GpioDirDefault = 0x0, ///< Leave pad direction setting unmodified
151  GpioDirInOut = (0x1 | (0x1 << 3)), ///< Set pad for both output and input
152  GpioDirInInvOut = (0x1 | (0x3 << 3)), ///< Set pad for both output and input with inversion
153  GpioDirIn = (0x3 | (0x1 << 3)), ///< Set pad for input only
154  GpioDirInInv = (0x3 | (0x3 << 3)), ///< Set pad for input with inversion
155  GpioDirOut = 0x5, ///< Set pad for output only
156  GpioDirNone = 0x7 ///< Disable both output and input
158 
159 /**
160  GPIO Output State
161  This field is relevant only if output is enabled
162 **/
163 typedef enum {
164  GpioOutDefault = 0x0, ///< Leave output value unmodified
165  GpioOutLow = 0x1, ///< Set output to low
166  GpioOutHigh = 0x3 ///< Set output to high
168 
169 /**
170  GPIO interrupt configuration
171  This setting is applicable only if pad is in GPIO mode and has input enabled.
172  GPIO_INT_CONFIG allows to choose which interrupt is generated (IOxAPIC/SCI/SMI/NMI)
173  and how it is triggered (edge or level). Refer to PADCFG_DW0 register description in
174  EDS for details on this settings.
175  Field from GpioIntNmi to GpioIntApic can be OR'ed with GpioIntLevel to GpioIntBothEdge
176  to describe an interrupt e.g. GpioIntApic | GpioIntLevel
177  If GPIO is set to cause an SCI then also GPI_GPE_EN is enabled for this pad.
178  If GPIO is set to cause an NMI then also GPI_NMI_EN is enabled for this pad.
179  Not all GPIO are capable of generating an SMI or NMI interrupt.
180  When routing GPIO to cause an IOxAPIC interrupt care must be taken, as this
181  interrupt cannot be shared and its IRQn number is not configurable.
182  Refer to EDS for GPIO pads IRQ numbers (PADCFG_DW1.IntSel)
183  If GPIO is under GPIO OS driver control and appropriate ACPI GpioInt descriptor
184  exist then use only trigger type setting (from GpioIntLevel to GpioIntBothEdge).
185  This type of GPIO Driver interrupt doesn't have any additional routing setting
186  required to be set by BIOS. Interrupt is handled by GPIO OS Driver.
187 **/
188 
189 typedef enum {
190  GpioIntDefault = 0x0, ///< Leave value of interrupt routing unmodified
191  GpioIntDis = 0x1, ///< Disable IOxAPIC/SCI/SMI/NMI interrupt generation
192  GpioIntNmi = 0x3, ///< Enable NMI interrupt only
193  GpioIntSmi = 0x5, ///< Enable SMI interrupt only
194  GpioIntSci = 0x9, ///< Enable SCI interrupt only
195  GpioIntApic = 0x11, ///< Enable IOxAPIC interrupt only
196  GpioIntLevel = (0x1 << 5), ///< Set interrupt as level triggered
197  GpioIntEdge = (0x3 << 5), ///< Set interrupt as edge triggered (type of edge depends on input inversion)
198  GpioIntLvlEdgDis = (0x5 << 5), ///< Disable interrupt trigger
199  GpioIntBothEdge = (0x7 << 5) ///< Set interrupt as both edge triggered
201 
202 #define B_GPIO_INT_CONFIG_INT_SOURCE_MASK 0x1F ///< Mask for GPIO_INT_CONFIG for interrupt source
203 #define B_GPIO_INT_CONFIG_INT_TYPE_MASK 0xE0 ///< Mask for GPIO_INT_CONFIG for interrupt type
204 
205 /**
206  GPIO Power Configuration
207  GPIO_RESET_CONFIG allows to set GPIO Reset type (PADCFG_DW0.PadRstCfg) which will
208  be used to reset certain GPIO settings.
209  Refer to EDS for settings that are controllable by PadRstCfg.
210 **/
211 typedef enum {
212  GpioResetDefault = 0x00, ///< Leave value of pad reset unmodified
213  /**
214  Resume Reset (RSMRST)
215  GPP: PadRstCfg = 00b = "Powergood"
216  GPD: PadRstCfg = 11b = "Resume Reset"
217  Pad setting will reset on:
218  - DeepSx transition
219  - G3
220  Pad settings will not reset on:
221  - S3/S4/S5 transition
222  - Warm/Cold/Global reset
223  **/
225  /**
226  Host Deep Reset
227  PadRstCfg = 01b = "Deep GPIO Reset"
228  Pad settings will reset on:
229  - Warm/Cold/Global reset
230  - DeepSx transition
231  - G3
232  Pad settings will not reset on:
233  - S3/S4/S5 transition
234  **/
236  /**
237  Platform Reset (PLTRST)
238  PadRstCfg = 10b = "GPIO Reset"
239  Pad settings will reset on:
240  - S3/S4/S5 transition
241  - Warm/Cold/Global reset
242  - DeepSx transition
243  - G3
244  **/
246  /**
247  Deep Sleep Well Reset (DSW_PWROK)
248  GPP: not applicable
249  GPD: PadRstCfg = 00b = "Powergood"
250  Pad settings will reset on:
251  - G3
252  Pad settings will not reset on:
253  - S3/S4/S5 transition
254  - Warm/Cold/Global reset
255  - DeepSx transition
256  **/
259 
260 /**
261  GPIO Electrical Configuration
262  Configuration options for GPIO termination setting
263 **/
264 typedef enum {
265  GpioTermDefault = 0x0, ///< Leave termination setting unmodified
266  GpioTermNone = 0x1, ///< none
267  GpioTermWpd5K = 0x5, ///< 5kOhm weak pull-down
268  GpioTermWpd20K = 0x9, ///< 20kOhm weak pull-down
269  GpioTermWpu1K = 0x13, ///< 1kOhm weak pull-up
270  GpioTermWpu2K = 0x17, ///< 2kOhm weak pull-up
271  GpioTermWpu5K = 0x15, ///< 5kOhm weak pull-up
272  GpioTermWpu20K = 0x19, ///< 20kOhm weak pull-up
273  GpioTermWpu1K2K = 0x1B, ///< 1kOhm & 2kOhm weak pull-up
274  /**
275  Native function controls pads termination
276  This setting is applicable only to some native modes.
277  Please check EDS to determine which native functionality
278  can control pads termination
279  **/
282 
283 #define B_GPIO_ELECTRICAL_CONFIG_TERMINATION_MASK 0x1F ///< Mask for GPIO_ELECTRICAL_CONFIG for termination value
284 
285 /**
286  GPIO LockConfiguration
287  Set GPIO configuration lock and output state lock.
288  GpioPadConfigUnlock/Lock and GpioOutputStateUnlock can be OR'ed.
289  By default GPIO pads will be locked unless GPIO lib is explicitly
290  informed that certain pad is to be left unlocked.
291  Lock settings reset is in Powergood domain. Care must be taken when using this setting
292  as fields it locks may be reset by a different signal and can be controlled
293  by what is in GPIO_RESET_CONFIG (PADCFG_DW0.PadRstCfg). GPIO library provides
294  functions which allow to unlock a GPIO pad. If possible each GPIO lib function will try to unlock
295  an already locked pad upon request for reconfiguration
296 **/
297 typedef enum {
298  /**
299  Perform default action
300  - if pad is an GPO, lock configuration but leave output unlocked
301  - if pad is an GPI, lock everything
302  - if pad is in native, lock everything
303 **/
305  GpioPadConfigUnlock = 0x3, ///< Leave Pad configuration unlocked
306  GpioPadConfigLock = 0x1, ///< Lock Pad configuration
307  GpioOutputStateUnlock = 0xC, ///< Leave Pad output control unlocked
308  GpioPadUnlock = 0xF, ///< Leave both Pad configuration and output control unlocked
309  GpioPadLock = 0x5 ///< Lock both Pad configuration and output control
311 
312 #define B_GPIO_LOCK_CONFIG_PAD_CONF_LOCK_MASK 0x3 ///< Mask for GPIO_LOCK_CONFIG for Pad Configuration Lock
313 #define B_GPIO_LOCK_CONFIG_OUTPUT_LOCK_MASK 0xC ///< Mask for GPIO_LOCK_CONFIG for Pad Output Lock
314 
315 /**
316  Other GPIO Configuration
317  GPIO_OTHER_CONFIG is used for less often settings and for future extensions
318  Supported settings:
319  - RX raw override to '1' - allows to override input value to '1'
320  This setting is applicable only if in input mode (both in GPIO and native usage).
321  The override takes place at the internal pad state directly from buffer and before the RXINV.
322 **/
323 typedef enum {
324  GpioRxRaw1Default = 0x0, ///< Use default input override value
325  GpioRxRaw1Dis = 0x1, ///< Don't override input
326  GpioRxRaw1En = 0x3 ///< Override input to '1'
328 
329 #define B_GPIO_OTHER_CONFIG_RXRAW_MASK 0x3 ///< Mask for GPIO_OTHER_CONFIG for RxRaw1 setting
330 
331 #pragma pack(pop)
332 
333 #endif //_GPIO_CONFIG_H_
Leave Pad configuration unlocked.
Definition: GpioConfig.h:305
20kOhm weak pull-down
Definition: GpioConfig.h:268
Leave value of pad reset unmodified.
Definition: GpioConfig.h:212
GPIO_RESET_CONFIG
GPIO Power Configuration GPIO_RESET_CONFIG allows to set GPIO Reset type (PADCFG_DW0.PadRstCfg) which will be used to reset certain GPIO settings.
Definition: GpioConfig.h:211
GPIO_OUTPUT_STATE
GPIO Output State This field is relevant only if output is enabled.
Definition: GpioConfig.h:163
GPIO configuration structure used for pin programming.
Definition: GpioConfig.h:36
Enable IOxAPIC interrupt only.
Definition: GpioConfig.h:195
Don't override input.
Definition: GpioConfig.h:325
GPIO_HARDWARE_DEFAULT
Definition: GpioConfig.h:99
5kOhm weak pull-down
Definition: GpioConfig.h:267
Set output to low.
Definition: GpioConfig.h:165
Leave termination setting unmodified.
Definition: GpioConfig.h:265
GPIO_DIRECTION
GPIO Direction.
Definition: GpioConfig.h:149
Set pad for both output and input with inversion.
Definition: GpioConfig.h:152
Leave setting unmodified.
Definition: GpioConfig.h:100
Perform default action.
Definition: GpioConfig.h:304
Deep Sleep Well Reset (DSW_PWROK) GPP: not applicable GPD: PadRstCfg = 00b = "Powergood" Pad settings...
Definition: GpioConfig.h:257
Set pad for output only.
Definition: GpioConfig.h:155
Leave value of interrupt routing unmodified.
Definition: GpioConfig.h:190
2kOhm weak pull-up
Definition: GpioConfig.h:270
Set HOST ownership to ACPI.
Definition: GpioConfig.h:136
Native function controls pads termination This setting is applicable only to some native modes...
Definition: GpioConfig.h:280
GPIO_OTHER_CONFIG
Other GPIO Configuration GPIO_OTHER_CONFIG is used for less often settings and for future extensions ...
Definition: GpioConfig.h:323
Leave pad direction setting unmodified.
Definition: GpioConfig.h:150
GPIO_ELECTRICAL_CONFIG
GPIO Electrical Configuration Configuration options for GPIO termination setting. ...
Definition: GpioConfig.h:264
1kOhm weak pull-up
Definition: GpioConfig.h:269
Disable IOxAPIC/SCI/SMI/NMI interrupt generation.
Definition: GpioConfig.h:191
Use default input override value.
Definition: GpioConfig.h:324
Resume Reset (RSMRST) GPP: PadRstCfg = 00b = "Powergood" GPD: PadRstCfg = 11b = "Resume Reset" Pad se...
Definition: GpioConfig.h:224
Leave Pad output control unlocked.
Definition: GpioConfig.h:307
Leave both Pad configuration and output control unlocked.
Definition: GpioConfig.h:308
Disable both output and input.
Definition: GpioConfig.h:156
Set pad for both output and input.
Definition: GpioConfig.h:151
GPIO_HOSTSW_OWN
Host Software Pad Ownership modes This setting affects GPIO interrupt status registers.
Definition: GpioConfig.h:128
GPIO_LOCK_CONFIG
GPIO LockConfiguration Set GPIO configuration lock and output state lock.
Definition: GpioConfig.h:297
Set interrupt as edge triggered (type of edge depends on input inversion)
Definition: GpioConfig.h:197
Set output to high.
Definition: GpioConfig.h:166
Set interrupt as level triggered.
Definition: GpioConfig.h:196
20kOhm weak pull-up
Definition: GpioConfig.h:272
Lock Pad configuration.
Definition: GpioConfig.h:306
Leave output value unmodified.
Definition: GpioConfig.h:164
Set interrupt as both edge triggered.
Definition: GpioConfig.h:199
UINT32 GPIO_PAD
For any GpioPad usage in code use GPIO_PAD type.
Definition: GpioConfig.h:24
GPIO_INT_CONFIG
GPIO interrupt configuration This setting is applicable only if pad is in GPIO mode and has input ena...
Definition: GpioConfig.h:189
Lock both Pad configuration and output control.
Definition: GpioConfig.h:309
Set pad for input with inversion.
Definition: GpioConfig.h:154
Platform Reset (PLTRST) PadRstCfg = 10b = "GPIO Reset" Pad settings will reset on: ...
Definition: GpioConfig.h:245
Set pad for input only.
Definition: GpioConfig.h:153
Override input to '1'.
Definition: GpioConfig.h:326
Enable NMI interrupt only.
Definition: GpioConfig.h:192
Disable interrupt trigger.
Definition: GpioConfig.h:198
Enable SCI interrupt only.
Definition: GpioConfig.h:194
1kOhm & 2kOhm weak pull-up
Definition: GpioConfig.h:273
Set HOST ownership to GPIO Driver mode.
Definition: GpioConfig.h:143
Enable SMI interrupt only.
Definition: GpioConfig.h:193
5kOhm weak pull-up
Definition: GpioConfig.h:271
Host Deep Reset PadRstCfg = 01b = "Deep GPIO Reset" Pad settings will reset on:
Definition: GpioConfig.h:235
GPIO_PAD_MODE
GPIO Pad Mode Refer to GPIO documentation on native functions available for certain pad...
Definition: GpioConfig.h:113
Leave ownership value unmodified.
Definition: GpioConfig.h:129
UINT32 GPIO_GROUP
For any GpioGroup usage in code use GPIO_GROUP type.
Definition: GpioConfig.h:30
Generated on Wed Aug 22 2018 17:48:55 for CoffeeLake Intel(R) Firmware Support Package (FSP) Integration Guide by   doxygen 1.8.10