]>
Commit | Line | Data |
---|---|---|
a5cc178a HW |
1 | /** @file\r |
2 | The SioBusDxe driver is used to create child devices on the ISA bus and\r | |
3 | installs the Super I/O protocols on them.\r | |
4 | \r | |
5 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
6 | \r | |
b26f0cf9 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
a5cc178a HW |
8 | \r |
9 | **/\r | |
10 | \r | |
11 | #ifndef __SIO_SERVICE_H__\r | |
12 | #define __SIO_SERVICE_H__\r | |
13 | \r | |
14 | #pragma pack(1)\r | |
15 | \r | |
16 | typedef struct {\r | |
ac0a286f MK |
17 | EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR Io;\r |
18 | EFI_ACPI_END_TAG_DESCRIPTOR End;\r | |
a5cc178a HW |
19 | } SIO_RESOURCES_IO;\r |
20 | \r | |
21 | #pragma pack()\r | |
22 | \r | |
23 | typedef struct {\r | |
24 | UINT32 Hid;\r | |
25 | UINT32 Uid;\r | |
26 | ACPI_RESOURCE_HEADER_PTR Resources;\r | |
27 | } SIO_DEVICE_INFO;\r | |
28 | \r | |
29 | //\r | |
30 | // SIO device private data structure\r | |
31 | //\r | |
32 | typedef struct {\r | |
33 | UINT32 Signature;\r | |
34 | EFI_HANDLE Handle;\r | |
35 | EFI_PCI_IO_PROTOCOL *PciIo;\r | |
36 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
37 | \r | |
38 | EFI_SIO_PROTOCOL Sio;\r | |
39 | UINT32 DeviceIndex;\r | |
40 | } SIO_DEV;\r | |
ac0a286f MK |
41 | #define SIO_DEV_SIGNATURE SIGNATURE_32 ('S', 'I', 'O', 'D')\r |
42 | #define SIO_DEV_FROM_SIO(a) CR (a, SIO_DEV, Sio, SIO_DEV_SIGNATURE)\r | |
a5cc178a HW |
43 | \r |
44 | //\r | |
45 | // Super I/O Protocol interfaces\r | |
46 | //\r | |
47 | \r | |
48 | /**\r | |
49 | Provides a low level access to the registers for the Super I/O.\r | |
50 | \r | |
51 | @param[in] This Indicates a pointer to the calling context.\r | |
52 | @param[in] Write Specifies the type of the register operation.\r | |
53 | If this parameter is TRUE, Value is interpreted\r | |
54 | as an input parameter and the operation is a\r | |
55 | register write. If this parameter is FALSE,\r | |
56 | Value is interpreted as an output parameter and\r | |
57 | the operation is a register read.\r | |
58 | @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this\r | |
59 | parameter is set to TRUE, the Super I/O driver\r | |
60 | will turn off configuration mode of the Super\r | |
61 | I/O prior to returning from this function. If\r | |
62 | this parameter is set to FALSE, the Super I/O\r | |
63 | driver will leave Super I/O in the\r | |
64 | configuration mode. The Super I/O driver must\r | |
65 | track the current state of the Super I/O and\r | |
66 | enable the configuration mode of Super I/O if\r | |
67 | necessary prior to register access.\r | |
68 | @param[in] Register Register number.\r | |
69 | @param[in,out] Value If Write is TRUE, Value is a pointer to the\r | |
70 | buffer containing the byte of data to be\r | |
71 | written to the Super I/O register. If Write is\r | |
72 | FALSE, Value is a pointer to the destination\r | |
73 | buffer for the byte of data to be read from the\r | |
74 | Super I/O register.\r | |
75 | \r | |
76 | @retval EFI_SUCCESS The operation completed successfully.\r | |
77 | @retval EFI_INVALID_PARAMETER The Value is NULL.\r | |
78 | @retval EFI_INVALID_PARAMETER Invalid Register number.\r | |
79 | \r | |
80 | **/\r | |
81 | EFI_STATUS\r | |
82 | EFIAPI\r | |
83 | SioRegisterAccess (\r | |
ac0a286f MK |
84 | IN CONST EFI_SIO_PROTOCOL *This,\r |
85 | IN BOOLEAN Write,\r | |
86 | IN BOOLEAN ExitCfgMode,\r | |
87 | IN UINT8 Register,\r | |
88 | IN OUT UINT8 *Value\r | |
a5cc178a HW |
89 | );\r |
90 | \r | |
91 | /**\r | |
92 | Provides an interface to get a list of the current resources consumed by the\r | |
93 | device in the ACPI Resource Descriptor format.\r | |
94 | \r | |
95 | GetResources() returns a list of resources currently consumed by the device.\r | |
96 | The ResourceList is a pointer to the buffer containing resource descriptors\r | |
97 | for the device. The descriptors are in the format of Small or Large ACPI\r | |
98 | resource descriptor as defined by ACPI specification (2.0 & 3.0). The buffer\r | |
99 | of resource descriptors is terminated with the 'End tag' resource descriptor.\r | |
100 | \r | |
101 | @param[in] This Indicates a pointer to the calling context.\r | |
102 | @param[out] ResourceList A pointer to an ACPI resource descriptor list\r | |
103 | that defines the current resources used by the\r | |
104 | device.\r | |
105 | \r | |
106 | @retval EFI_SUCCESS The operation completed successfully.\r | |
107 | @retval EFI_INVALID_PARAMETER ResourceList is NULL.\r | |
108 | \r | |
109 | **/\r | |
110 | EFI_STATUS\r | |
111 | EFIAPI\r | |
112 | SioGetResources (\r | |
ac0a286f MK |
113 | IN CONST EFI_SIO_PROTOCOL *This,\r |
114 | OUT ACPI_RESOURCE_HEADER_PTR *ResourceList\r | |
a5cc178a HW |
115 | );\r |
116 | \r | |
117 | /**\r | |
118 | Sets the resources for the device.\r | |
119 | \r | |
120 | @param[in] This Indicates a pointer to the calling context.\r | |
121 | @param[in] ResourceList Pointer to the ACPI resource descriptor list.\r | |
122 | \r | |
123 | @retval EFI_SUCCESS The operation completed successfully.\r | |
124 | @retval EFI_INVALID_PARAMETER ResourceList is invalid.\r | |
125 | @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are in\r | |
126 | use.\r | |
127 | \r | |
128 | **/\r | |
129 | EFI_STATUS\r | |
130 | EFIAPI\r | |
131 | SioSetResources (\r | |
ac0a286f MK |
132 | IN CONST EFI_SIO_PROTOCOL *This,\r |
133 | IN ACPI_RESOURCE_HEADER_PTR ResourceList\r | |
a5cc178a HW |
134 | );\r |
135 | \r | |
136 | /**\r | |
137 | Provides a collection of resource descriptor lists. Each resource descriptor\r | |
138 | list in the collection defines a combination of resources that can\r | |
139 | potentially be used by the device.\r | |
140 | \r | |
141 | @param[in] This Indicates a pointer to the calling context.\r | |
142 | @param[out] ResourceCollection Collection of the resource descriptor\r | |
143 | lists.\r | |
144 | \r | |
145 | @retval EFI_SUCCESS The operation completed successfully.\r | |
146 | @retval EFI_INVALID_PARAMETER ResourceCollection is NULL.\r | |
147 | \r | |
148 | **/\r | |
149 | EFI_STATUS\r | |
150 | EFIAPI\r | |
151 | SioPossibleResources (\r | |
ac0a286f MK |
152 | IN CONST EFI_SIO_PROTOCOL *This,\r |
153 | OUT ACPI_RESOURCE_HEADER_PTR *ResourceCollection\r | |
a5cc178a HW |
154 | );\r |
155 | \r | |
156 | /**\r | |
157 | Provides an interface for a table based programming of the Super I/O\r | |
158 | registers.\r | |
159 | \r | |
160 | The Modify() function provides an interface for table based programming of\r | |
161 | the Super I/O registers. This function can be used to perform programming of\r | |
162 | multiple Super I/O registers with a single function call. For each table\r | |
163 | entry, the Register is read, its content is bitwise ANDed with AndMask, and\r | |
164 | then ORed with OrMask before being written back to the Register. The Super\r | |
165 | I/O driver must track the current state of the Super I/O and enable the\r | |
166 | configuration mode of Super I/O if necessary prior to table processing. Once\r | |
167 | the table is processed, the Super I/O device has to be returned to the\r | |
168 | original state.\r | |
169 | \r | |
170 | @param[in] This Indicates a pointer to the calling context.\r | |
171 | @param[in] Command A pointer to an array of NumberOfCommands\r | |
172 | EFI_SIO_REGISTER_MODIFY structures. Each\r | |
173 | structure specifies a single Super I/O register\r | |
174 | modify operation.\r | |
175 | @param[in] NumberOfCommands Number of elements in the Command array.\r | |
176 | \r | |
177 | @retval EFI_SUCCESS The operation completed successfully.\r | |
178 | @retval EFI_INVALID_PARAMETER Command is NULL.\r | |
179 | \r | |
180 | **/\r | |
181 | EFI_STATUS\r | |
182 | EFIAPI\r | |
183 | SioModify (\r | |
ac0a286f MK |
184 | IN CONST EFI_SIO_PROTOCOL *This,\r |
185 | IN CONST EFI_SIO_REGISTER_MODIFY *Command,\r | |
186 | IN UINTN NumberOfCommands\r | |
a5cc178a HW |
187 | );\r |
188 | \r | |
189 | //\r | |
190 | // Internal functions\r | |
191 | //\r | |
192 | \r | |
193 | /**\r | |
194 | Create all the ISA child devices on the ISA bus controller (PCI to ISA\r | |
195 | bridge).\r | |
196 | \r | |
197 | @param[in] This The EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
198 | @param[in] Controller The handle of ISA bus controller.\r | |
199 | @param[in] PciIo The pointer to the PCI protocol.\r | |
200 | @param[in] ParentDevicePath Device path of the ISA bus controller.\r | |
201 | \r | |
202 | @retval The number of child device that is successfully created.\r | |
203 | \r | |
204 | **/\r | |
205 | UINT32\r | |
206 | SioCreateAllChildDevices (\r | |
207 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
208 | IN EFI_HANDLE Controller,\r | |
209 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r | |
210 | IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath\r | |
211 | );\r | |
212 | \r | |
ac0a286f | 213 | #endif // __SIO_SERVICE_H__\r |