]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/SuperIo.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / SuperIo.h
... / ...
CommitLineData
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 - 2018, Intel Corporation. All rights reserved.<BR>\r
9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
10\r
11**/\r
12\r
13#ifndef __EFI_SUPER_IO_PROTOCOL_H__\r
14#define __EFI_SUPER_IO_PROTOCOL_H__\r
15#include <IndustryStandard/Acpi.h>\r
16\r
17#define EFI_SIO_PROTOCOL_GUID \\r
18 { 0x215fdd18, 0xbd50, 0x4feb, { 0x89, 0xb, 0x58, 0xca, 0xb, 0x47, 0x39, 0xe9 } }\r
19\r
20typedef union {\r
21 ACPI_SMALL_RESOURCE_HEADER *SmallHeader;\r
22 ACPI_LARGE_RESOURCE_HEADER *LargeHeader;\r
23} ACPI_RESOURCE_HEADER_PTR;\r
24\r
25typedef struct {\r
26 UINT8 Register; ///< Register number.\r
27 UINT8 AndMask; ///< Bitwise AND mask.\r
28 UINT8 OrMask; ///< Bitwise OR mask.\r
29} EFI_SIO_REGISTER_MODIFY;\r
30\r
31typedef struct _EFI_SIO_PROTOCOL EFI_SIO_PROTOCOL;\r
32\r
33/**\r
34 Provides a low level access to the registers for the Super I/O.\r
35\r
36 @param[in] This Indicates a pointer to the calling context.\r
37 @param[in] Write Specifies the type of the register operation. If this parameter is TRUE, Value is\r
38 interpreted as an input parameter and the operation is a register write. If this parameter\r
39 is FALSE, Value is interpreted as an output parameter and the operation is a register\r
40 read.\r
41 @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this parameter is set to TRUE, the Super I/O\r
42 driver will turn off configuration mode of the Super I/O prior to returning from this\r
43 function. If this parameter is set to FALSE, the Super I/O driver will leave Super I/O\r
44 in the configuration mode.\r
45 The Super I/O driver must track the current state of the Super I/O and enable the\r
46 configuration mode of Super I/O if necessary prior to register access.\r
47 @param[in] Register Register number.\r
48 @param[in, out] Value If Write is TRUE, Value is a pointer to the buffer containing the byte of data to be\r
49 written to the Super I/O register. If Write is FALSE, Value is a pointer to the\r
50 destination buffer for the byte of data to be read from the Super I/O register.\r
51\r
52 @retval EFI_SUCCESS The operation completed successfully\r
53 @retval EFI_INVALID_PARAMETER The Value is NULL\r
54 @retval EFI_INVALID_PARAMETER Invalid Register number\r
55\r
56**/\r
57typedef\r
58EFI_STATUS\r
59(EFIAPI *EFI_SIO_REGISTER_ACCESS)(\r
60 IN CONST EFI_SIO_PROTOCOL *This,\r
61 IN BOOLEAN Write,\r
62 IN BOOLEAN ExitCfgMode,\r
63 IN UINT8 Register,\r
64 IN OUT UINT8 *Value\r
65);\r
66\r
67/**\r
68 Provides an interface to get a list of the current resources consumed by the device in the ACPI\r
69 Resource Descriptor format.\r
70\r
71 GetResources() returns a list of resources currently consumed by the device. The\r
72 ResourceList is a pointer to the buffer containing resource descriptors for the device. The\r
73 descriptors are in the format of Small or Large ACPI resource descriptor as defined by ACPI\r
74 specification (2.0 & 3.0). The buffer of resource descriptors is terminated with the 'End tag'\r
75 resource descriptor.\r
76\r
77 @param[in] This Indicates a pointer to the calling context.\r
78 @param[out] ResourceList A pointer to an ACPI resource descriptor list that defines the current resources used by\r
79 the device. Type ACPI_RESOURCE_HEADER_PTR is defined in the "Related\r
80 Definitions" below.\r
81\r
82 @retval EFI_SUCCESS The operation completed successfully\r
83 @retval EFI_INVALID_PARAMETER ResourceList is NULL\r
84\r
85**/\r
86typedef\r
87EFI_STATUS\r
88(EFIAPI *EFI_SIO_GET_RESOURCES)(\r
89 IN CONST EFI_SIO_PROTOCOL *This,\r
90 OUT ACPI_RESOURCE_HEADER_PTR *ResourceList\r
91);\r
92\r
93/**\r
94 Sets the resources for the device.\r
95\r
96 @param[in] This Indicates a pointer to the calling context.\r
97 @param[in] ResourceList Pointer to the ACPI resource descriptor list. Type ACPI_RESOURCE_HEADER_PTR\r
98 is defined in the "Related Definitions" section of\r
99 EFI_SIO_PROTOCOL.GetResources().\r
100\r
101 @retval EFI_SUCCESS The operation completed successfully\r
102 @retval EFI_INVALID_PARAMETER ResourceList is invalid\r
103 @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are in use\r
104\r
105**/\r
106typedef\r
107EFI_STATUS\r
108(EFIAPI *EFI_SIO_SET_RESOURCES)(\r
109 IN CONST EFI_SIO_PROTOCOL *This,\r
110 IN ACPI_RESOURCE_HEADER_PTR ResourceList\r
111);\r
112\r
113/**\r
114 Provides a collection of resource descriptor lists. Each resource descriptor list in the collection\r
115 defines a combination of resources that can potentially be used by the device.\r
116\r
117 @param[in] This Indicates a pointer to the calling context.\r
118 @param[out] ResourceCollection Collection of the resource descriptor lists.\r
119\r
120 @retval EFI_SUCCESS The operation completed successfully\r
121 @retval EFI_INVALID_PARAMETER ResourceCollection is NULL\r
122**/\r
123typedef\r
124EFI_STATUS\r
125(EFIAPI *EFI_SIO_POSSIBLE_RESOURCES)(\r
126 IN CONST EFI_SIO_PROTOCOL *This,\r
127 OUT ACPI_RESOURCE_HEADER_PTR *ResourceCollection\r
128);\r
129\r
130/**\r
131 Provides an interface for a table based programming of the Super I/O registers.\r
132\r
133 The Modify() function provides an interface for table based programming of the Super I/O\r
134 registers. This function can be used to perform programming of multiple Super I/O registers with a\r
135 single function call. For each table entry, the Register is read, its content is bitwise ANDed with\r
136 AndMask, and then ORed with OrMask before being written back to the Register. The Super\r
137 I/O driver must track the current state of the Super I/O and enable the configuration mode of Super I/\r
138 O if necessary prior to table processing. Once the table is processed, the Super I/O device has to be\r
139 returned to the original state.\r
140\r
141 @param[in] This Indicates a pointer to the calling context.\r
142 @param[in] Command A pointer to an array of NumberOfCommands EFI_SIO_REGISTER_MODIFY\r
143 structures. Each structure specifies a single Super I/O register modify operation. Type\r
144 EFI_SIO_REGISTER_MODIFY is defined in the "Related Definitions" below.\r
145 @param[in] NumberOfCommands Number of elements in the Command array.\r
146\r
147 @retval EFI_SUCCESS The operation completed successfully\r
148 @retval EFI_INVALID_PARAMETER Command is NULL\r
149\r
150**/\r
151typedef\r
152EFI_STATUS\r
153(EFIAPI *EFI_SIO_MODIFY)(\r
154 IN CONST EFI_SIO_PROTOCOL *This,\r
155 IN CONST EFI_SIO_REGISTER_MODIFY *Command,\r
156 IN UINTN NumberOfCommands\r
157);\r
158\r
159struct _EFI_SIO_PROTOCOL {\r
160 EFI_SIO_REGISTER_ACCESS RegisterAccess;\r
161 EFI_SIO_GET_RESOURCES GetResources;\r
162 EFI_SIO_SET_RESOURCES SetResources;\r
163 EFI_SIO_POSSIBLE_RESOURCES PossibleResources;\r
164 EFI_SIO_MODIFY Modify;\r
165};\r
166\r
167extern EFI_GUID gEfiSioProtocolGuid;\r
168\r
169#endif // __EFI_SUPER_IO_PROTOCOL_H__\r