]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SuperIo.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Protocol / SuperIo.h
CommitLineData
bf3a8d8b 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
9095d37b 8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
bf3a8d8b 10\r
11**/\r
12\r
13#ifndef __EFI_SUPER_IO_PROTOCOL_H__\r
14#define __EFI_SUPER_IO_PROTOCOL_H__\r
2186f2a1 15#include <IndustryStandard/Acpi.h>\r
bf3a8d8b 16\r
17#define EFI_SIO_PROTOCOL_GUID \\r
18 { 0x215fdd18, 0xbd50, 0x4feb, { 0x89, 0xb, 0x58, 0xca, 0xb, 0x47, 0x39, 0xe9 } }\r
bf3a8d8b 19\r
20typedef union {\r
2f88bd3a
MK
21 ACPI_SMALL_RESOURCE_HEADER *SmallHeader;\r
22 ACPI_LARGE_RESOURCE_HEADER *LargeHeader;\r
bf3a8d8b 23} ACPI_RESOURCE_HEADER_PTR;\r
24\r
25typedef struct {\r
2f88bd3a
MK
26 UINT8 Register; ///< Register number.\r
27 UINT8 AndMask; ///< Bitwise AND mask.\r
28 UINT8 OrMask; ///< Bitwise OR mask.\r
bf3a8d8b 29} EFI_SIO_REGISTER_MODIFY;\r
9095d37b 30\r
2f88bd3a 31typedef struct _EFI_SIO_PROTOCOL EFI_SIO_PROTOCOL;\r
9095d37b 32\r
bf3a8d8b 33/**\r
34 Provides a low level access to the registers for the Super I/O.\r
9095d37b 35\r
bf3a8d8b 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
9095d37b 50 destination buffer for the byte of data to be read from the Super I/O register.\r
bf3a8d8b 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
9095d37b
LG
55\r
56**/\r
bf3a8d8b 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
2f88bd3a 65 );\r
9095d37b 66\r
bf3a8d8b 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
9095d37b 70\r
bf3a8d8b 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
9095d37b 76\r
bf3a8d8b 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
9095d37b 81\r
bf3a8d8b 82 @retval EFI_SUCCESS The operation completed successfully\r
83 @retval EFI_INVALID_PARAMETER ResourceList is NULL\r
9095d37b
LG
84\r
85**/\r
bf3a8d8b 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
2f88bd3a 91 );\r
9095d37b 92\r
bf3a8d8b 93/**\r
94 Sets the resources for the device.\r
9095d37b 95\r
bf3a8d8b 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
9095d37b
LG
104\r
105**/\r
bf3a8d8b 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
2f88bd3a 111 );\r
9095d37b 112\r
bf3a8d8b 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
9095d37b 116\r
bf3a8d8b 117 @param[in] This Indicates a pointer to the calling context.\r
118 @param[out] ResourceCollection Collection of the resource descriptor lists.\r
9095d37b 119\r
bf3a8d8b 120 @retval EFI_SUCCESS The operation completed successfully\r
121 @retval EFI_INVALID_PARAMETER ResourceCollection is NULL\r
9095d37b 122**/\r
bf3a8d8b 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
2f88bd3a 128 );\r
9095d37b 129\r
bf3a8d8b 130/**\r
131 Provides an interface for a table based programming of the Super I/O registers.\r
9095d37b 132\r
bf3a8d8b 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
9095d37b
LG
145 @param[in] NumberOfCommands Number of elements in the Command array.\r
146\r
bf3a8d8b 147 @retval EFI_SUCCESS The operation completed successfully\r
148 @retval EFI_INVALID_PARAMETER Command is NULL\r
9095d37b
LG
149\r
150**/\r
bf3a8d8b 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
2f88bd3a 157 );\r
9095d37b 158\r
bf3a8d8b 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
2f88bd3a 164 EFI_SIO_MODIFY Modify;\r
9095d37b 165};\r
bf3a8d8b 166\r
2f88bd3a 167extern EFI_GUID gEfiSioProtocolGuid;\r
bf3a8d8b 168\r
169#endif // __EFI_SUPER_IO_PROTOCOL_H__\r