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

Kabylake Intel Firmware

Kabylake 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  INTEL CONFIDENTIAL
6  Copyright 2014 - 2016 Intel Corporation.
7 
8  The source code contained or described herein and all documents related to the
9  source code ("Material") are owned by Intel Corporation or its suppliers or
10  licensors. Title to the Material remains with Intel Corporation or its suppliers
11  and licensors. The Material may contain trade secrets and proprietary and
12  confidential information of Intel Corporation and its suppliers and licensors,
13  and is protected by worldwide copyright and trade secret laws and treaty
14  provisions. No part of the Material may be used, copied, reproduced, modified,
15  published, uploaded, posted, transmitted, distributed, or disclosed in any way
16  without Intel's prior express written permission.
17 
18  No license under any patent, copyright, trade secret or other intellectual
19  property right is granted to or conferred upon you by disclosure or delivery
20  of the Materials, either expressly, by implication, inducement, estoppel or
21  otherwise. Any license under such intellectual property rights must be
22  express and approved by Intel in writing.
23 
24  Unless otherwise agreed by Intel in writing, you may not remove or alter
25  this notice or any other notice embedded in Materials by Intel or
26  Intel's suppliers or licensors in any way.
27 
28  This file contains an 'Intel Peripheral Driver' and is uniquely identified as
29  "Intel Reference Module" and is licensed for Intel CPUs and chipsets under
30  the terms of your license agreement with Intel or your vendor. This file may
31  be modified by the user, subject to additional terms of the license agreement.
32 
33 @par Specification Reference:
34 **/
35 #ifndef _GPIO_CONFIG_H_
36 #define _GPIO_CONFIG_H_
37 
38 #pragma pack(push, 1)
39 
40 ///
41 /// For any GpioPad usage in code use GPIO_PAD type
42 ///
43 typedef UINT32 GPIO_PAD;
44 
45 
46 ///
47 /// For any GpioGroup usage in code use GPIO_GROUP type
48 ///
49 typedef UINT32 GPIO_GROUP;
50 
51 /**
52  GPIO configuration structure used for pin programming.
53  Structure contains fields that can be used to configure pad.
54 **/
55 typedef struct {
56  /**
57  Pad Mode
58  Pad can be set as GPIO or one of its native functions.
59  When in native mode setting Direction (except Inversion), OutputState,
60  InterruptConfig, Host Software Pad Ownership and OutputStateLock are unnecessary.
61  Refer to definition of GPIO_PAD_MODE.
62  Refer to EDS for each native mode according to the pad.
63  **/
64  UINT32 PadMode : 5;
65  /**
66  Host Software Pad Ownership
67  Set pad to ACPI mode or GPIO Driver Mode.
68  Refer to definition of GPIO_HOSTSW_OWN.
69  **/
70  UINT32 HostSoftPadOwn : 2;
71  /**
72  GPIO Direction
73  Can choose between In, In with inversion, Out, both In and Out, both In with inversion and out or disabling both.
74  Refer to definition of GPIO_DIRECTION for supported settings.
75  **/
76  UINT32 Direction : 6;
77  /**
78  Output State
79  Set Pad output value.
80  Refer to definition of GPIO_OUTPUT_STATE for supported settings.
81  This setting takes place when output is enabled.
82  **/
83  UINT32 OutputState : 2;
84  /**
85  GPIO Interrupt Configuration
86  Set Pad to cause one of interrupts (IOxAPIC/SCI/SMI/NMI).
87  This setting is applicable only if GPIO is in GpioMode with input enabled.
88  Refer to definition of GPIO_INT_CONFIG for supported settings.
89  **/
90  UINT32 InterruptConfig : 9;
91  /**
92  GPIO Power Configuration.
93  This setting controls Pad Reset Configuration.
94  Refer to definition of GPIO_RESET_CONFIG for supported settings.
95  **/
96  UINT32 PowerConfig : 8;
97  /**
98  GPIO Electrical Configuration
99  This setting controls pads termination and voltage tolerance.
100  Refer to definition of GPIO_ELECTRICAL_CONFIG for supported settings.
101  **/
102  UINT32 ElectricalConfig : 9;
103  /**
104  GPIO Lock Configuration
105  This setting controls pads lock.
106  Refer to definition of GPIO_LOCK_CONFIG for supported settings.
107  **/
108  UINT32 LockConfig : 4;
109  /**
110  Additional GPIO configuration
111  Refer to definition of GPIO_OTHER_CONFIG for supported settings.
112  **/
113  UINT32 OtherSettings : 2;
114  UINT32 RsvdBits : 17; ///< Reserved bits for future extension
115 } GPIO_CONFIG;
116 
117 
118 typedef enum {
119  GpioHardwareDefault = 0x0 ///< Leave setting unmodified
121 
122 /**
123  GPIO Pad Mode
124  Refer to GPIO documentation on native functions available for certain pad.
125  If GPIO is set to one of NativeX modes then following settings are not applicable
126  and can be skipped:
127  - Interrupt related settings
128  - Host Software Ownership
129  - Output/Input enabling/disabling
130  - Output lock
131 **/
132 typedef enum {
133  GpioPadModeGpio = 0x1,
134  GpioPadModeNative1 = 0x3,
135  GpioPadModeNative2 = 0x5,
136  GpioPadModeNative3 = 0x7,
137  GpioPadModeNative4 = 0x9
138 } GPIO_PAD_MODE;
139 
140 /**
141  Host Software Pad Ownership modes
142  This setting affects GPIO interrupt status registers. Depending on chosen ownership
143  some GPIO Interrupt status register get updated and other masked.
144  Please refer to EDS for HOSTSW_OWN register description.
145 **/
146 typedef enum {
147  GpioHostOwnDefault = 0x0, ///< Leave ownership value unmodified
148  /**
149  Set HOST ownership to ACPI.
150  Use this setting if pad is not going to be used by GPIO OS driver.
151  If GPIO is configured to generate SCI/SMI/NMI then this setting must be
152  used for interrupts to work
153  **/
155  /**
156  Set HOST ownership to GPIO Driver mode.
157  Use this setting only if GPIO pad should be controlled by GPIO OS Driver.
158  GPIO OS Driver will be able to control the pad if appropriate entry in
159  ACPI exists (refer to ACPI specification for GpioIo and GpioInt descriptors)
160  **/
163 
164 ///
165 /// GPIO Direction
166 ///
167 typedef enum {
168  GpioDirDefault = 0x0, ///< Leave pad direction setting unmodified
169  GpioDirInOut = (0x1 | (0x1 << 3)), ///< Set pad for both output and input
170  GpioDirInInvOut = (0x1 | (0x3 << 3)), ///< Set pad for both output and input with inversion
171  GpioDirIn = (0x3 | (0x1 << 3)), ///< Set pad for input only
172  GpioDirInInv = (0x3 | (0x3 << 3)), ///< Set pad for input with inversion
173  GpioDirOut = 0x5, ///< Set pad for output only
174  GpioDirNone = 0x7 ///< Disable both output and input
176 
177 /**
178  GPIO Output State
179  This field is relevant only if output is enabled
180 **/
181 typedef enum {
182  GpioOutDefault = 0x0, ///< Leave output value unmodified
183  GpioOutLow = 0x1, ///< Set output to low
184  GpioOutHigh = 0x3 ///< Set output to high
186 
187 /**
188  GPIO interrupt configuration
189  This setting is applicable only if pad is in GPIO mode and has input enabled.
190  GPIO_INT_CONFIG allows to choose which interrupt is generated (IOxAPIC/SCI/SMI/NMI)
191  and how it is triggered (edge or level). Refer to PADCFG_DW0 register description in
192  EDS for details on this settings.
193  Field from GpioIntNmi to GpioIntApic can be OR'ed with GpioIntLevel to GpioIntBothEdge
194  to describe an interrupt e.g. GpioIntApic | GpioIntLevel
195  If GPIO is set to cause an SCI then also GPI_GPE_EN is enabled for this pad.
196  If GPIO is set to cause an NMI then also GPI_NMI_EN is enabled for this pad.
197  Not all GPIO are capable of generating an SMI or NMI interrupt.
198  When routing GPIO to cause an IOxAPIC interrupt care must be taken, as this
199  interrupt cannot be shared and its IRQn number is not configurable.
200  Refer to EDS for GPIO pads IRQ numbers (PADCFG_DW1.IntSel)
201  If GPIO is under GPIO OS driver control and appropriate ACPI GpioInt descriptor
202  exist then use only trigger type setting (from GpioIntLevel to GpioIntBothEdge).
203  This type of GPIO Driver interrupt doesn't have any additional routing setting
204  required to be set by BIOS. Interrupt is handled by GPIO OS Driver.
205 **/
206 
207 typedef enum {
208  GpioIntDefault = 0x0, ///< Leave value of interrupt routing unmodified
209  GpioIntDis = 0x1, ///< Disable IOxAPIC/SCI/SMI/NMI interrupt generation
210  GpioIntNmi = 0x3, ///< Enable NMI interrupt only
211  GpioIntSmi = 0x5, ///< Enable SMI interrupt only
212  GpioIntSci = 0x9, ///< Enable SCI interrupt only
213  GpioIntApic = 0x11, ///< Enable IOxAPIC interrupt only
214  GpioIntLevel = (0x1 << 5), ///< Set interrupt as level triggered
215  GpioIntEdge = (0x3 << 5), ///< Set interrupt as edge triggered (type of edge depends on input inversion)
216  GpioIntLvlEdgDis = (0x5 << 5), ///< Disable interrupt trigger
217  GpioIntBothEdge = (0x7 << 5) ///< Set interrupt as both edge triggered
219 
220 #define B_GPIO_INT_CONFIG_INT_SOURCE_MASK 0x1F ///< Mask for GPIO_INT_CONFIG for interrupt source
221 #define B_GPIO_INT_CONFIG_INT_TYPE_MASK 0xE0 ///< Mask for GPIO_INT_CONFIG for interrupt type
222 
223 /**
224  GPIO Power Configuration
225  GPIO_RESET_CONFIG allows to set GPIO Reset type (PADCFG_DW0.PadRstCfg) which will
226  be used to reset certain GPIO settings.
227  Refer to EDS for settings that are controllable by PadRstCfg.
228 **/
229 typedef enum {
230 
231 
232  GpioResetDefault = 0x00, ///< Leave value of pad reset unmodified
233  ///
234  /// Deprecated settings. Maintained only for compatibility.
235  ///
236  GpioResetPwrGood = 0x09, ///< GPP: RSMRST; GPD: DSW_PWROK; (PadRstCfg = 00b = "Powergood")
237  GpioResetDeep = 0x0B, ///< Deep GPIO Reset (PadRstCfg = 01b = "Deep GPIO Reset")
238  GpioResetNormal = 0x0D, ///< GPIO Reset (PadRstCfg = 10b = "GPIO Reset" )
239  GpioResetResume = 0x0F, ///< GPP: Reserved; GPD: RSMRST; (PadRstCfg = 11b = "Resume Reset" )
240 
241  ///
242  /// New GPIO reset configuration options
243  ///
244  /**
245  Resume Reset (RSMRST)
246  GPP: PadRstCfg = 00b = "Powergood"
247  GPD: PadRstCfg = 11b = "Resume Reset"
248  Pad setting will reset on:
249  - DeepSx transition
250  - G3
251  Pad settings will not reset on:
252  - S3/S4/S5 transition
253  - Warm/Cold/Global reset
254  **/
256  /**
257  Host Deep Reset
258  PadRstCfg = 01b = "Deep GPIO Reset"
259  Pad settings will reset on:
260  - Warm/Cold/Global reset
261  - DeepSx transition
262  - G3
263  Pad settings will not reset on:
264  - S3/S4/S5 transition
265  **/
267  /**
268  Platform Reset (PLTRST)
269  PadRstCfg = 10b = "GPIO Reset"
270  Pad settings will reset on:
271  - S3/S4/S5 transition
272  - Warm/Cold/Global reset
273  - DeepSx transition
274  - G3
275  **/
277  /**
278  Deep Sleep Well Reset (DSW_PWROK)
279  GPP: not applicable
280  GPD: PadRstCfg = 00b = "Powergood"
281  Pad settings will reset on:
282  - G3
283  Pad settings will not reset on:
284  - S3/S4/S5 transition
285  - Warm/Cold/Global reset
286  - DeepSx transition
287  **/
290 
291 /**
292  GPIO Electrical Configuration
293  Set GPIO termination and Pad Tolerance (applicable only for some pads)
294  Field from GpioTermNone to GpioTermNative can be OR'ed with GpioTolerance1v8.
295 **/
296 typedef enum {
297  GpioTermDefault = 0x0, ///< Leave termination setting unmodified
298  GpioTermNone = 0x1, ///< none
299  GpioTermWpd5K = 0x5, ///< 5kOhm weak pull-down
300  GpioTermWpd20K = 0x9, ///< 20kOhm weak pull-down
301  GpioTermWpu1K = 0x13, ///< 1kOhm weak pull-up
302  GpioTermWpu2K = 0x17, ///< 2kOhm weak pull-up
303  GpioTermWpu5K = 0x15, ///< 5kOhm weak pull-up
304  GpioTermWpu20K = 0x19, ///< 20kOhm weak pull-up
305  GpioTermWpu1K2K = 0x1B, ///< 1kOhm & 2kOhm weak pull-up
306  /**
307  Native function controls pads termination
308  This setting is applicable only to some native modes.
309  Please check EDS to determine which native functionality
310  can control pads termination
311  **/
313  GpioNoTolerance1v8 = (0x1 << 5), ///< Disable 1.8V pad tolerance
314  GpioTolerance1v8 = (0x3 << 5) ///< Enable 1.8V pad tolerance
316 
317 #define B_GPIO_ELECTRICAL_CONFIG_TERMINATION_MASK 0x1F ///< Mask for GPIO_ELECTRICAL_CONFIG for termination value
318 #define B_GPIO_ELECTRICAL_CONFIG_1V8_TOLERANCE_MASK 0x60 ///< Mask for GPIO_ELECTRICAL_CONFIG for 1v8 tolerance setting
319 
320 /**
321  GPIO LockConfiguration
322  Set GPIO configuration lock and output state lock.
323  GpioLockPadConfig and GpioLockOutputState can be OR'ed.
324  Lock settings reset is in Powergood domain. Care must be taken when using this setting
325  as fields it locks may be reset by a different signal and can be controllable
326  by what is in GPIO_RESET_CONFIG (PADCFG_DW0.PadRstCfg). GPIO library provides
327  functions which allow to unlock a GPIO pad.
328 **/
329 typedef enum {
330  GpioLockDefault = 0x0, ///< Leave lock setting unmodified
331  GpioPadConfigLock = 0x3, ///< Lock Pad Configuration
332  GpioOutputStateLock = 0x5 ///< Lock GPIO pad output value
334 
335 #define B_GPIO_LOCK_CONFIG_PAD_CONF_LOCK_MASK 0x3 ///< Mask for GPIO_LOCK_CONFIG for Pad Configuration Lock
336 #define B_GPIO_LOCK_CONFIG_OUTPUT_LOCK_MASK 0x5 ///< Mask for GPIO_LOCK_CONFIG for Pad Output Lock
337 
338 /**
339  Other GPIO Configuration
340  GPIO_OTHER_CONFIG is used for less often settings and for future extensions
341  Supported settings:
342  - RX raw override to '1' - allows to override input value to '1'
343  This setting is applicable only if in input mode (both in GPIO and native usage).
344  The override takes place at the internal pad state directly from buffer and before the RXINV.
345 **/
346 typedef enum {
347  GpioRxRaw1Default = 0x0, ///< Use default input override value
348  GpioRxRaw1Dis = 0x1, ///< Don't override input
349  GpioRxRaw1En = 0x3 ///< Override input to '1'
351 
352 #define B_GPIO_OTHER_CONFIG_RXRAW_MASK 0x3 ///< Mask for GPIO_OTHER_CONFIG for RxRaw1 setting
353 
354 #pragma pack(pop)
355 
356 #endif //_GPIO_CONFIG_H_
20kOhm weak pull-down
Definition: GpioConfig.h:300
Leave value of pad reset unmodified.
Definition: GpioConfig.h:232
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:229
Lock GPIO pad output value.
Definition: GpioConfig.h:332
GPIO_OUTPUT_STATE
GPIO Output State This field is relevant only if output is enabled.
Definition: GpioConfig.h:181
GPIO configuration structure used for pin programming.
Definition: GpioConfig.h:55
Enable IOxAPIC interrupt only.
Definition: GpioConfig.h:213
Don't override input.
Definition: GpioConfig.h:348
Enable 1.8V pad tolerance.
Definition: GpioConfig.h:314
GPIO_HARDWARE_DEFAULT
Definition: GpioConfig.h:118
Disable 1.8V pad tolerance.
Definition: GpioConfig.h:313
5kOhm weak pull-down
Definition: GpioConfig.h:299
Set output to low.
Definition: GpioConfig.h:183
Leave termination setting unmodified.
Definition: GpioConfig.h:297
GPIO_DIRECTION
GPIO Direction.
Definition: GpioConfig.h:167
Set pad for both output and input with inversion.
Definition: GpioConfig.h:170
Leave setting unmodified.
Definition: GpioConfig.h:119
Leave lock setting unmodified.
Definition: GpioConfig.h:330
Deep Sleep Well Reset (DSW_PWROK) GPP: not applicable GPD: PadRstCfg = 00b = "Powergood" Pad settings...
Definition: GpioConfig.h:288
Set pad for output only.
Definition: GpioConfig.h:173
Leave value of interrupt routing unmodified.
Definition: GpioConfig.h:208
2kOhm weak pull-up
Definition: GpioConfig.h:302
Set HOST ownership to ACPI.
Definition: GpioConfig.h:154
Native function controls pads termination This setting is applicable only to some native modes...
Definition: GpioConfig.h:312
Deprecated settings.
Definition: GpioConfig.h:236
GPIO_OTHER_CONFIG
Other GPIO Configuration GPIO_OTHER_CONFIG is used for less often settings and for future extensions ...
Definition: GpioConfig.h:346
Deep GPIO Reset (PadRstCfg = 01b = "Deep GPIO Reset")
Definition: GpioConfig.h:237
Leave pad direction setting unmodified.
Definition: GpioConfig.h:168
GPIO_ELECTRICAL_CONFIG
GPIO Electrical Configuration Set GPIO termination and Pad Tolerance (applicable only for some pads) ...
Definition: GpioConfig.h:296
1kOhm weak pull-up
Definition: GpioConfig.h:301
Disable IOxAPIC/SCI/SMI/NMI interrupt generation.
Definition: GpioConfig.h:209
Use default input override value.
Definition: GpioConfig.h:347
New GPIO reset configuration options.
Definition: GpioConfig.h:255
Disable both output and input.
Definition: GpioConfig.h:174
Set pad for both output and input.
Definition: GpioConfig.h:169
GPIO_HOSTSW_OWN
Host Software Pad Ownership modes This setting affects GPIO interrupt status registers.
Definition: GpioConfig.h:146
GPIO_LOCK_CONFIG
GPIO LockConfiguration Set GPIO configuration lock and output state lock.
Definition: GpioConfig.h:329
Set interrupt as edge triggered (type of edge depends on input inversion)
Definition: GpioConfig.h:215
Set output to high.
Definition: GpioConfig.h:184
Set interrupt as level triggered.
Definition: GpioConfig.h:214
20kOhm weak pull-up
Definition: GpioConfig.h:304
Lock Pad Configuration.
Definition: GpioConfig.h:331
Leave output value unmodified.
Definition: GpioConfig.h:182
GPP: Reserved; GPD: RSMRST; (PadRstCfg = 11b = "Resume Reset" )
Definition: GpioConfig.h:239
Set interrupt as both edge triggered.
Definition: GpioConfig.h:217
UINT32 GPIO_PAD
For any GpioPad usage in code use GPIO_PAD type.
Definition: GpioConfig.h:43
GPIO_INT_CONFIG
GPIO interrupt configuration This setting is applicable only if pad is in GPIO mode and has input ena...
Definition: GpioConfig.h:207
Set pad for input with inversion.
Definition: GpioConfig.h:172
Platform Reset (PLTRST) PadRstCfg = 10b = "GPIO Reset" Pad settings will reset on: ...
Definition: GpioConfig.h:276
Set pad for input only.
Definition: GpioConfig.h:171
Override input to '1'.
Definition: GpioConfig.h:349
Enable NMI interrupt only.
Definition: GpioConfig.h:210
Disable interrupt trigger.
Definition: GpioConfig.h:216
Enable SCI interrupt only.
Definition: GpioConfig.h:212
1kOhm & 2kOhm weak pull-up
Definition: GpioConfig.h:305
Set HOST ownership to GPIO Driver mode.
Definition: GpioConfig.h:161
Enable SMI interrupt only.
Definition: GpioConfig.h:211
5kOhm weak pull-up
Definition: GpioConfig.h:303
Host Deep Reset PadRstCfg = 01b = "Deep GPIO Reset" Pad settings will reset on:
Definition: GpioConfig.h:266
GPIO_PAD_MODE
GPIO Pad Mode Refer to GPIO documentation on native functions available for certain pad...
Definition: GpioConfig.h:132
Leave ownership value unmodified.
Definition: GpioConfig.h:147
GPIO Reset (PadRstCfg = 10b = "GPIO Reset" )
Definition: GpioConfig.h:238
UINT32 GPIO_GROUP
For any GpioGroup usage in code use GPIO_GROUP type.
Definition: GpioConfig.h:49
Generated on Thu Jun 28 2018 21:44:49 for Kabylake Intel(R) Firmware Support Package (FSP) Integration Guide by   doxygen 1.8.10