2 The SioBusDxe driver is used to create child devices on the ISA bus and
3 installs the Super I/O protocols on them.
5 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef __SIO_SERVICE_H__
12 #define __SIO_SERVICE_H__
17 EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR Io
;
18 EFI_ACPI_END_TAG_DESCRIPTOR End
;
26 ACPI_RESOURCE_HEADER_PTR Resources
;
30 // SIO device private data structure
35 EFI_PCI_IO_PROTOCOL
*PciIo
;
36 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
41 #define SIO_DEV_SIGNATURE SIGNATURE_32 ('S', 'I', 'O', 'D')
42 #define SIO_DEV_FROM_SIO(a) CR (a, SIO_DEV, Sio, SIO_DEV_SIGNATURE)
46 // Super I/O Protocol interfaces
50 Provides a low level access to the registers for the Super I/O.
52 @param[in] This Indicates a pointer to the calling context.
53 @param[in] Write Specifies the type of the register operation.
54 If this parameter is TRUE, Value is interpreted
55 as an input parameter and the operation is a
56 register write. If this parameter is FALSE,
57 Value is interpreted as an output parameter and
58 the operation is a register read.
59 @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this
60 parameter is set to TRUE, the Super I/O driver
61 will turn off configuration mode of the Super
62 I/O prior to returning from this function. If
63 this parameter is set to FALSE, the Super I/O
64 driver will leave Super I/O in the
65 configuration mode. The Super I/O driver must
66 track the current state of the Super I/O and
67 enable the configuration mode of Super I/O if
68 necessary prior to register access.
69 @param[in] Register Register number.
70 @param[in,out] Value If Write is TRUE, Value is a pointer to the
71 buffer containing the byte of data to be
72 written to the Super I/O register. If Write is
73 FALSE, Value is a pointer to the destination
74 buffer for the byte of data to be read from the
77 @retval EFI_SUCCESS The operation completed successfully.
78 @retval EFI_INVALID_PARAMETER The Value is NULL.
79 @retval EFI_INVALID_PARAMETER Invalid Register number.
85 IN CONST EFI_SIO_PROTOCOL
*This
,
87 IN BOOLEAN ExitCfgMode
,
93 Provides an interface to get a list of the current resources consumed by the
94 device in the ACPI Resource Descriptor format.
96 GetResources() returns a list of resources currently consumed by the device.
97 The ResourceList is a pointer to the buffer containing resource descriptors
98 for the device. The descriptors are in the format of Small or Large ACPI
99 resource descriptor as defined by ACPI specification (2.0 & 3.0). The buffer
100 of resource descriptors is terminated with the 'End tag' resource descriptor.
102 @param[in] This Indicates a pointer to the calling context.
103 @param[out] ResourceList A pointer to an ACPI resource descriptor list
104 that defines the current resources used by the
107 @retval EFI_SUCCESS The operation completed successfully.
108 @retval EFI_INVALID_PARAMETER ResourceList is NULL.
114 IN CONST EFI_SIO_PROTOCOL
*This
,
115 OUT ACPI_RESOURCE_HEADER_PTR
*ResourceList
119 Sets the resources for the device.
121 @param[in] This Indicates a pointer to the calling context.
122 @param[in] ResourceList Pointer to the ACPI resource descriptor list.
124 @retval EFI_SUCCESS The operation completed successfully.
125 @retval EFI_INVALID_PARAMETER ResourceList is invalid.
126 @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are in
133 IN CONST EFI_SIO_PROTOCOL
*This
,
134 IN ACPI_RESOURCE_HEADER_PTR ResourceList
138 Provides a collection of resource descriptor lists. Each resource descriptor
139 list in the collection defines a combination of resources that can
140 potentially be used by the device.
142 @param[in] This Indicates a pointer to the calling context.
143 @param[out] ResourceCollection Collection of the resource descriptor
146 @retval EFI_SUCCESS The operation completed successfully.
147 @retval EFI_INVALID_PARAMETER ResourceCollection is NULL.
152 SioPossibleResources (
153 IN CONST EFI_SIO_PROTOCOL
*This
,
154 OUT ACPI_RESOURCE_HEADER_PTR
*ResourceCollection
158 Provides an interface for a table based programming of the Super I/O
161 The Modify() function provides an interface for table based programming of
162 the Super I/O registers. This function can be used to perform programming of
163 multiple Super I/O registers with a single function call. For each table
164 entry, the Register is read, its content is bitwise ANDed with AndMask, and
165 then ORed with OrMask before being written back to the Register. The Super
166 I/O driver must track the current state of the Super I/O and enable the
167 configuration mode of Super I/O if necessary prior to table processing. Once
168 the table is processed, the Super I/O device has to be returned to the
171 @param[in] This Indicates a pointer to the calling context.
172 @param[in] Command A pointer to an array of NumberOfCommands
173 EFI_SIO_REGISTER_MODIFY structures. Each
174 structure specifies a single Super I/O register
176 @param[in] NumberOfCommands Number of elements in the Command array.
178 @retval EFI_SUCCESS The operation completed successfully.
179 @retval EFI_INVALID_PARAMETER Command is NULL.
185 IN CONST EFI_SIO_PROTOCOL
*This
,
186 IN CONST EFI_SIO_REGISTER_MODIFY
*Command
,
187 IN UINTN NumberOfCommands
191 // Internal functions
195 Create all the ISA child devices on the ISA bus controller (PCI to ISA
198 @param[in] This The EFI_DRIVER_BINDING_PROTOCOL instance.
199 @param[in] Controller The handle of ISA bus controller.
200 @param[in] PciIo The pointer to the PCI protocol.
201 @param[in] ParentDevicePath Device path of the ISA bus controller.
203 @retval The number of child device that is successfully created.
207 SioCreateAllChildDevices (
208 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
209 IN EFI_HANDLE Controller
,
210 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
211 IN EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
214 #endif // __SIO_SERVICE_H__