]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SuperIo.h
Add super IO protocol from PI 1.2 specification.
[mirror_edk2.git] / MdePkg / Include / Protocol / SuperIo.h
CommitLineData
bf3a8d8b 1/** @file\r
2 The Super I/O Protocol is installed by the Super I/O driver. The Super I/O driver is a UEFI driver\r
3 model compliant driver. In the Start() routine of the Super I/O driver, a handle with an instance\r
4 of EFI_SIO_PROTOCOL is created for each device within the Super I/O. The device within the\r
5 Super I/O is powered up, enabled, and assigned with the default set of resources. In the Stop()\r
6 routine of the Super I/O driver, the device is disabled and Super I/O protocol is uninstalled.\r
7\r
8 Copyright (c) 2006 - 2008, Intel Corporation \r
9 All rights reserved. This program and the accompanying materials \r
10 are licensed and made available under the terms and conditions of the BSD License \r
11 which accompanies this distribution. The full text of the license may be found at \r
12 http://opensource.org/licenses/bsd-license.php \r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
16\r
17**/\r
18\r
19#ifndef __EFI_SUPER_IO_PROTOCOL_H__\r
20#define __EFI_SUPER_IO_PROTOCOL_H__\r
21\r
22#define EFI_SIO_PROTOCOL_GUID \\r
23 { 0x215fdd18, 0xbd50, 0x4feb, { 0x89, 0xb, 0x58, 0xca, 0xb, 0x47, 0x39, 0xe9 } }\r
24 \r
25typedef union {\r
26 UINT8 Byte;\r
27 struct {\r
28 UINT8 Length : 3;\r
29 UINT8 Name : 4;\r
30 UINT8 Type : 1;\r
31 } Bits;\r
32} ACPI_SMALL_RESOURCE_HEADER;\r
33\r
34typedef struct {\r
35 union {\r
36 UINT8 Byte;\r
37 struct{\r
38 UINT8 Name : 7;\r
39 UINT8 Type : 1;\r
40 }Bits;\r
41 } Header;\r
42 UINT16 Length;\r
43} ACPI_LARGE_RESOURCE_HEADER;\r
44\r
45typedef union {\r
46 ACPI_SMALL_RESOURCE_HEADER *SmallHeader;\r
47 ACPI_LARGE_RESOURCE_HEADER *LargeHeader;\r
48} ACPI_RESOURCE_HEADER_PTR;\r
49\r
50typedef struct {\r
51 UINT8 Register; ///< Register number.\r
52 UINT8 AndMask; ///< Bitwise AND mask.\r
53 UINT8 OrMask; ///< Bitwise OR mask.\r
54} EFI_SIO_REGISTER_MODIFY;\r
55 \r
56typedef struct _EFI_SIO_PROTOCOL EFI_SIO_PROTOCOL;\r
57 \r
58/**\r
59 Provides a low level access to the registers for the Super I/O.\r
60 \r
61 @param[in] This Indicates a pointer to the calling context.\r
62 @param[in] Write Specifies the type of the register operation. If this parameter is TRUE, Value is\r
63 interpreted as an input parameter and the operation is a register write. If this parameter\r
64 is FALSE, Value is interpreted as an output parameter and the operation is a register\r
65 read.\r
66 @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this parameter is set to TRUE, the Super I/O\r
67 driver will turn off configuration mode of the Super I/O prior to returning from this\r
68 function. If this parameter is set to FALSE, the Super I/O driver will leave Super I/O\r
69 in the configuration mode.\r
70 The Super I/O driver must track the current state of the Super I/O and enable the\r
71 configuration mode of Super I/O if necessary prior to register access.\r
72 @param[in] Register Register number.\r
73 @param[in, out] Value If Write is TRUE, Value is a pointer to the buffer containing the byte of data to be\r
74 written to the Super I/O register. If Write is FALSE, Value is a pointer to the\r
75 destination buffer for the byte of data to be read from the Super I/O register. \r
76\r
77 @retval EFI_SUCCESS The operation completed successfully\r
78 @retval EFI_INVALID_PARAMETER The Value is NULL\r
79 @retval EFI_INVALID_PARAMETER Invalid Register number\r
80 \r
81**/ \r
82typedef\r
83EFI_STATUS\r
84(EFIAPI *EFI_SIO_REGISTER_ACCESS)(\r
85 IN CONST EFI_SIO_PROTOCOL *This,\r
86 IN BOOLEAN Write,\r
87 IN BOOLEAN ExitCfgMode,\r
88 IN UINT8 Register,\r
89 IN OUT UINT8 *Value\r
90);\r
91 \r
92/**\r
93 Provides an interface to get a list of the current resources consumed by the device in the ACPI\r
94 Resource Descriptor format.\r
95 \r
96 GetResources() returns a list of resources currently consumed by the device. The\r
97 ResourceList is a pointer to the buffer containing resource descriptors for the device. The\r
98 descriptors are in the format of Small or Large ACPI resource descriptor as defined by ACPI\r
99 specification (2.0 & 3.0). The buffer of resource descriptors is terminated with the 'End tag'\r
100 resource descriptor.\r
101 \r
102 @param[in] This Indicates a pointer to the calling context.\r
103 @param[out] ResourceList A pointer to an ACPI resource descriptor list that defines the current resources used by\r
104 the device. Type ACPI_RESOURCE_HEADER_PTR is defined in the "Related\r
105 Definitions" below.\r
106 \r
107 @retval EFI_SUCCESS The operation completed successfully\r
108 @retval EFI_INVALID_PARAMETER ResourceList is NULL\r
109 \r
110**/ \r
111typedef\r
112EFI_STATUS\r
113(EFIAPI *EFI_SIO_GET_RESOURCES)(\r
114 IN CONST EFI_SIO_PROTOCOL *This,\r
115 OUT ACPI_RESOURCE_HEADER_PTR *ResourceList\r
116);\r
117 \r
118/**\r
119 Sets the resources for the device.\r
120 \r
121 @param[in] This Indicates a pointer to the calling context.\r
122 @param[in] ResourceList Pointer to the ACPI resource descriptor list. Type ACPI_RESOURCE_HEADER_PTR\r
123 is defined in the "Related Definitions" section of\r
124 EFI_SIO_PROTOCOL.GetResources().\r
125\r
126 @retval EFI_SUCCESS The operation completed successfully\r
127 @retval EFI_INVALID_PARAMETER ResourceList is invalid\r
128 @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are in use\r
129 \r
130**/ \r
131typedef\r
132EFI_STATUS\r
133(EFIAPI *EFI_SIO_SET_RESOURCES)(\r
134 IN CONST EFI_SIO_PROTOCOL *This,\r
135 IN ACPI_RESOURCE_HEADER_PTR ResourceList\r
136);\r
137 \r
138/**\r
139 Provides a collection of resource descriptor lists. Each resource descriptor list in the collection\r
140 defines a combination of resources that can potentially be used by the device.\r
141 \r
142 @param[in] This Indicates a pointer to the calling context.\r
143 @param[out] ResourceCollection Collection of the resource descriptor lists.\r
144 \r
145 @retval EFI_SUCCESS The operation completed successfully\r
146 @retval EFI_INVALID_PARAMETER ResourceCollection is NULL\r
147**/ \r
148typedef\r
149EFI_STATUS\r
150(EFIAPI *EFI_SIO_POSSIBLE_RESOURCES)(\r
151 IN CONST EFI_SIO_PROTOCOL *This,\r
152 OUT ACPI_RESOURCE_HEADER_PTR *ResourceCollection\r
153);\r
154 \r
155/**\r
156 Provides an interface for a table based programming of the Super I/O registers.\r
157 \r
158 The Modify() function provides an interface for table based programming of the Super I/O\r
159 registers. This function can be used to perform programming of multiple Super I/O registers with a\r
160 single function call. For each table entry, the Register is read, its content is bitwise ANDed with\r
161 AndMask, and then ORed with OrMask before being written back to the Register. The Super\r
162 I/O driver must track the current state of the Super I/O and enable the configuration mode of Super I/\r
163 O if necessary prior to table processing. Once the table is processed, the Super I/O device has to be\r
164 returned to the original state.\r
165\r
166 @param[in] This Indicates a pointer to the calling context.\r
167 @param[in] Command A pointer to an array of NumberOfCommands EFI_SIO_REGISTER_MODIFY\r
168 structures. Each structure specifies a single Super I/O register modify operation. Type\r
169 EFI_SIO_REGISTER_MODIFY is defined in the "Related Definitions" below.\r
170 @param[in] NumberOfCommands Number of elements in the Command array. \r
171 \r
172 @retval EFI_SUCCESS The operation completed successfully\r
173 @retval EFI_INVALID_PARAMETER Command is NULL\r
174 \r
175**/ \r
176typedef\r
177EFI_STATUS\r
178(EFIAPI *EFI_SIO_MODIFY)(\r
179 IN CONST EFI_SIO_PROTOCOL *This,\r
180 IN CONST EFI_SIO_REGISTER_MODIFY *Command,\r
181 IN UINTN NumberOfCommands\r
182);\r
183 \r
184struct _EFI_SIO_PROTOCOL {\r
185 EFI_SIO_REGISTER_ACCESS RegisterAccess;\r
186 EFI_SIO_GET_RESOURCES GetResources;\r
187 EFI_SIO_SET_RESOURCES SetResources;\r
188 EFI_SIO_POSSIBLE_RESOURCES PossibleResources;\r
189 EFI_SIO_MODIFY Modify;\r
190}; \r
191\r
192extern EFI_GUID gEfiSioProtocolGuid;\r
193\r
194#endif // __EFI_SUPER_IO_PROTOCOL_H__\r