--- /dev/null
+/** @file\r
+ The Super I/O Protocol is installed by the Super I/O driver. The Super I/O driver is a UEFI driver\r
+ model compliant driver. In the Start() routine of the Super I/O driver, a handle with an instance\r
+ of EFI_SIO_PROTOCOL is created for each device within the Super I/O. The device within the\r
+ Super I/O is powered up, enabled, and assigned with the default set of resources. In the Stop()\r
+ routine of the Super I/O driver, the device is disabled and Super I/O protocol is uninstalled.\r
+\r
+ Copyright (c) 2006 - 2008, Intel Corporation \r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#ifndef __EFI_SUPER_IO_PROTOCOL_H__\r
+#define __EFI_SUPER_IO_PROTOCOL_H__\r
+\r
+#define EFI_SIO_PROTOCOL_GUID \\r
+ { 0x215fdd18, 0xbd50, 0x4feb, { 0x89, 0xb, 0x58, 0xca, 0xb, 0x47, 0x39, 0xe9 } }\r
+ \r
+typedef union {\r
+ UINT8 Byte;\r
+ struct {\r
+ UINT8 Length : 3;\r
+ UINT8 Name : 4;\r
+ UINT8 Type : 1;\r
+ } Bits;\r
+} ACPI_SMALL_RESOURCE_HEADER;\r
+\r
+typedef struct {\r
+ union {\r
+ UINT8 Byte;\r
+ struct{\r
+ UINT8 Name : 7;\r
+ UINT8 Type : 1;\r
+ }Bits;\r
+ } Header;\r
+ UINT16 Length;\r
+} ACPI_LARGE_RESOURCE_HEADER;\r
+\r
+typedef union {\r
+ ACPI_SMALL_RESOURCE_HEADER *SmallHeader;\r
+ ACPI_LARGE_RESOURCE_HEADER *LargeHeader;\r
+} ACPI_RESOURCE_HEADER_PTR;\r
+\r
+typedef struct {\r
+ UINT8 Register; ///< Register number.\r
+ UINT8 AndMask; ///< Bitwise AND mask.\r
+ UINT8 OrMask; ///< Bitwise OR mask.\r
+} EFI_SIO_REGISTER_MODIFY;\r
+ \r
+typedef struct _EFI_SIO_PROTOCOL EFI_SIO_PROTOCOL;\r
+ \r
+/**\r
+ Provides a low level access to the registers for the Super I/O.\r
+ \r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[in] Write Specifies the type of the register operation. If this parameter is TRUE, Value is\r
+ interpreted as an input parameter and the operation is a register write. If this parameter\r
+ is FALSE, Value is interpreted as an output parameter and the operation is a register\r
+ read.\r
+ @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this parameter is set to TRUE, the Super I/O\r
+ driver will turn off configuration mode of the Super I/O prior to returning from this\r
+ function. If this parameter is set to FALSE, the Super I/O driver will leave Super I/O\r
+ in the configuration mode.\r
+ The Super I/O driver must track the current state of the Super I/O and enable the\r
+ configuration mode of Super I/O if necessary prior to register access.\r
+ @param[in] Register Register number.\r
+ @param[in, out] Value If Write is TRUE, Value is a pointer to the buffer containing the byte of data to be\r
+ written to the Super I/O register. If Write is FALSE, Value is a pointer to the\r
+ destination buffer for the byte of data to be read from the Super I/O register. \r
+\r
+ @retval EFI_SUCCESS The operation completed successfully\r
+ @retval EFI_INVALID_PARAMETER The Value is NULL\r
+ @retval EFI_INVALID_PARAMETER Invalid Register number\r
+ \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIO_REGISTER_ACCESS)(\r
+ IN CONST EFI_SIO_PROTOCOL *This,\r
+ IN BOOLEAN Write,\r
+ IN BOOLEAN ExitCfgMode,\r
+ IN UINT8 Register,\r
+ IN OUT UINT8 *Value\r
+);\r
+ \r
+/**\r
+ Provides an interface to get a list of the current resources consumed by the device in the ACPI\r
+ Resource Descriptor format.\r
+ \r
+ GetResources() returns a list of resources currently consumed by the device. The\r
+ ResourceList is a pointer to the buffer containing resource descriptors for the device. The\r
+ descriptors are in the format of Small or Large ACPI resource descriptor as defined by ACPI\r
+ specification (2.0 & 3.0). The buffer of resource descriptors is terminated with the 'End tag'\r
+ resource descriptor.\r
+ \r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[out] ResourceList A pointer to an ACPI resource descriptor list that defines the current resources used by\r
+ the device. Type ACPI_RESOURCE_HEADER_PTR is defined in the "Related\r
+ Definitions" below.\r
+ \r
+ @retval EFI_SUCCESS The operation completed successfully\r
+ @retval EFI_INVALID_PARAMETER ResourceList is NULL\r
+ \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIO_GET_RESOURCES)(\r
+ IN CONST EFI_SIO_PROTOCOL *This,\r
+ OUT ACPI_RESOURCE_HEADER_PTR *ResourceList\r
+);\r
+ \r
+/**\r
+ Sets the resources for the device.\r
+ \r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[in] ResourceList Pointer to the ACPI resource descriptor list. Type ACPI_RESOURCE_HEADER_PTR\r
+ is defined in the "Related Definitions" section of\r
+ EFI_SIO_PROTOCOL.GetResources().\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully\r
+ @retval EFI_INVALID_PARAMETER ResourceList is invalid\r
+ @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are in use\r
+ \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIO_SET_RESOURCES)(\r
+ IN CONST EFI_SIO_PROTOCOL *This,\r
+ IN ACPI_RESOURCE_HEADER_PTR ResourceList\r
+);\r
+ \r
+/**\r
+ Provides a collection of resource descriptor lists. Each resource descriptor list in the collection\r
+ defines a combination of resources that can potentially be used by the device.\r
+ \r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[out] ResourceCollection Collection of the resource descriptor lists.\r
+ \r
+ @retval EFI_SUCCESS The operation completed successfully\r
+ @retval EFI_INVALID_PARAMETER ResourceCollection is NULL\r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIO_POSSIBLE_RESOURCES)(\r
+ IN CONST EFI_SIO_PROTOCOL *This,\r
+ OUT ACPI_RESOURCE_HEADER_PTR *ResourceCollection\r
+);\r
+ \r
+/**\r
+ Provides an interface for a table based programming of the Super I/O registers.\r
+ \r
+ The Modify() function provides an interface for table based programming of the Super I/O\r
+ registers. This function can be used to perform programming of multiple Super I/O registers with a\r
+ single function call. For each table entry, the Register is read, its content is bitwise ANDed with\r
+ AndMask, and then ORed with OrMask before being written back to the Register. The Super\r
+ I/O driver must track the current state of the Super I/O and enable the configuration mode of Super I/\r
+ O if necessary prior to table processing. Once the table is processed, the Super I/O device has to be\r
+ returned to the original state.\r
+\r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[in] Command A pointer to an array of NumberOfCommands EFI_SIO_REGISTER_MODIFY\r
+ structures. Each structure specifies a single Super I/O register modify operation. Type\r
+ EFI_SIO_REGISTER_MODIFY is defined in the "Related Definitions" below.\r
+ @param[in] NumberOfCommands Number of elements in the Command array. \r
+ \r
+ @retval EFI_SUCCESS The operation completed successfully\r
+ @retval EFI_INVALID_PARAMETER Command is NULL\r
+ \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIO_MODIFY)(\r
+ IN CONST EFI_SIO_PROTOCOL *This,\r
+ IN CONST EFI_SIO_REGISTER_MODIFY *Command,\r
+ IN UINTN NumberOfCommands\r
+);\r
+ \r
+struct _EFI_SIO_PROTOCOL {\r
+ EFI_SIO_REGISTER_ACCESS RegisterAccess;\r
+ EFI_SIO_GET_RESOURCES GetResources;\r
+ EFI_SIO_SET_RESOURCES SetResources;\r
+ EFI_SIO_POSSIBLE_RESOURCES PossibleResources;\r
+ EFI_SIO_MODIFY Modify;\r
+}; \r
+\r
+extern EFI_GUID gEfiSioProtocolGuid;\r
+\r
+#endif // __EFI_SUPER_IO_PROTOCOL_H__\r