]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/SioBusDxe/SioService.h
OvmfPkg/Csm/LegacyBiosDxe: Fix Legacy16GetTableAddress call for E820 data
[mirror_edk2.git] / OvmfPkg / SioBusDxe / SioService.h
CommitLineData
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
16typedef struct {\r
17 EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR Io;\r
18 EFI_ACPI_END_TAG_DESCRIPTOR End;\r
19} SIO_RESOURCES_IO;\r
20\r
21#pragma pack()\r
22\r
23typedef 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
32typedef 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
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
43\r
44\r
45//\r
46// Super I/O Protocol interfaces\r
47//\r
48\r
49/**\r
50 Provides a low level access to the registers for the Super I/O.\r
51\r
52 @param[in] This Indicates a pointer to the calling context.\r
53 @param[in] Write Specifies the type of the register operation.\r
54 If this parameter is TRUE, Value is interpreted\r
55 as an input parameter and the operation is a\r
56 register write. If this parameter is FALSE,\r
57 Value is interpreted as an output parameter and\r
58 the operation is a register read.\r
59 @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this\r
60 parameter is set to TRUE, the Super I/O driver\r
61 will turn off configuration mode of the Super\r
62 I/O prior to returning from this function. If\r
63 this parameter is set to FALSE, the Super I/O\r
64 driver will leave Super I/O in the\r
65 configuration mode. The Super I/O driver must\r
66 track the current state of the Super I/O and\r
67 enable the configuration mode of Super I/O if\r
68 necessary prior to register access.\r
69 @param[in] Register Register number.\r
70 @param[in,out] Value If Write is TRUE, Value is a pointer to the\r
71 buffer containing the byte of data to be\r
72 written to the Super I/O register. If Write is\r
73 FALSE, Value is a pointer to the destination\r
74 buffer for the byte of data to be read from the\r
75 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
82EFI_STATUS\r
83EFIAPI\r
84SioRegisterAccess (\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\r
94 device in the ACPI Resource Descriptor format.\r
95\r
96 GetResources() returns a list of resources currently consumed by the device.\r
97 The ResourceList is a pointer to the buffer containing resource descriptors\r
98 for the device. The descriptors are in the format of Small or Large ACPI\r
99 resource descriptor as defined by ACPI specification (2.0 & 3.0). The buffer\r
100 of resource descriptors is terminated with the 'End tag' 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\r
104 that defines the current resources used by the\r
105 device.\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
111EFI_STATUS\r
112EFIAPI\r
113SioGetResources (\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.\r
123\r
124 @retval EFI_SUCCESS The operation completed successfully.\r
125 @retval EFI_INVALID_PARAMETER ResourceList is invalid.\r
126 @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are in\r
127 use.\r
128\r
129**/\r
130EFI_STATUS\r
131EFIAPI\r
132SioSetResources (\r
133 IN CONST EFI_SIO_PROTOCOL *This,\r
134 IN ACPI_RESOURCE_HEADER_PTR ResourceList\r
135 );\r
136\r
137/**\r
138 Provides a collection of resource descriptor lists. Each resource descriptor\r
139 list in the collection defines a combination of resources that can\r
140 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\r
144 lists.\r
145\r
146 @retval EFI_SUCCESS The operation completed successfully.\r
147 @retval EFI_INVALID_PARAMETER ResourceCollection is NULL.\r
148\r
149**/\r
150EFI_STATUS\r
151EFIAPI\r
152SioPossibleResources (\r
153 IN CONST EFI_SIO_PROTOCOL *This,\r
154 OUT ACPI_RESOURCE_HEADER_PTR *ResourceCollection\r
155 );\r
156\r
157/**\r
158 Provides an interface for a table based programming of the Super I/O\r
159 registers.\r
160\r
161 The Modify() function provides an interface for table based programming of\r
162 the Super I/O registers. This function can be used to perform programming of\r
163 multiple Super I/O registers with a single function call. For each table\r
164 entry, the Register is read, its content is bitwise ANDed with AndMask, and\r
165 then ORed with OrMask before being written back to the Register. The Super\r
166 I/O driver must track the current state of the Super I/O and enable the\r
167 configuration mode of Super I/O if necessary prior to table processing. Once\r
168 the table is processed, the Super I/O device has to be returned to the\r
169 original state.\r
170\r
171 @param[in] This Indicates a pointer to the calling context.\r
172 @param[in] Command A pointer to an array of NumberOfCommands\r
173 EFI_SIO_REGISTER_MODIFY structures. Each\r
174 structure specifies a single Super I/O register\r
175 modify operation.\r
176 @param[in] NumberOfCommands Number of elements in the Command array.\r
177\r
178 @retval EFI_SUCCESS The operation completed successfully.\r
179 @retval EFI_INVALID_PARAMETER Command is NULL.\r
180\r
181**/\r
182EFI_STATUS\r
183EFIAPI\r
184SioModify (\r
185 IN CONST EFI_SIO_PROTOCOL *This,\r
186 IN CONST EFI_SIO_REGISTER_MODIFY *Command,\r
187 IN UINTN NumberOfCommands\r
188 );\r
189\r
190//\r
191// Internal functions\r
192//\r
193\r
194/**\r
195 Create all the ISA child devices on the ISA bus controller (PCI to ISA\r
196 bridge).\r
197\r
198 @param[in] This The EFI_DRIVER_BINDING_PROTOCOL instance.\r
199 @param[in] Controller The handle of ISA bus controller.\r
200 @param[in] PciIo The pointer to the PCI protocol.\r
201 @param[in] ParentDevicePath Device path of the ISA bus controller.\r
202\r
203 @retval The number of child device that is successfully created.\r
204\r
205**/\r
206UINT32\r
207SioCreateAllChildDevices (\r
208 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
209 IN EFI_HANDLE Controller,\r
210 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
211 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath\r
212 );\r
213\r
214#endif // __SIO_SERVICE_H__\r