]> git.proxmox.com Git - mirror_edk2.git/blame - Include/Ppi/SuperIo.h
MdePkg: Add SIO related protocol/PPI definitions.
[mirror_edk2.git] / Include / Ppi / SuperIo.h
CommitLineData
42c9d9f8
RN
1/** @file\r
2 This PPI provides the super I/O register access functionality.\r
3\r
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13 @par Revision Reference:\r
14 This PPI is from PI Version 1.2.1.\r
15\r
16**/\r
17\r
18#ifndef __EFI_SUPER_IO_PPI_H__\r
19#define __EFI_SUPER_IO_PPI_H__\r
20\r
21#include <Protocol/SuperIo.h>\r
22\r
23#define EFI_SIO_PPI_GUID \\r
24 { \\r
25 0x23a464ad, 0xcb83, 0x48b8, {0x94, 0xab, 0x1a, 0x6f, 0xef, 0xcf, 0xe5, 0x22} \\r
26 }\r
27\r
28typedef struct _EFI_SIO_PPI EFI_SIO_PPI;\r
29typedef struct _EFI_SIO_PPI *PEFI_SIO_PPI;\r
30\r
31typedef UINT16 EFI_SIO_REGISTER;\r
32#define EFI_SIO_REG(ldn,reg) (EFI_SIO_REGISTER) (((ldn) << 8) | reg)\r
33#define EFI_SIO_LDN_GLOBAL 0xFF\r
34\r
35/**\r
36 Read a Super I/O register.\r
37 \r
38 The register is specified as an 8-bit logical device number and an 8-bit\r
39 register value. The logical device numbers for specific SIO devices can be\r
40 determined using the Info member of the PPI structure.\r
41 \r
42 @param This A pointer to this instance of the EFI_SIO_PPI.\r
43 @param ExitCfgMode A boolean specifying whether the driver should turn on\r
44 configuration mode (FALSE) or turn off configuration mode\r
45 (TRUE) after completing the read operation. The driver must\r
46 track the current state of the configuration mode (if any)\r
47 and turn on configuration mode (if necessary) prior to\r
48 register access.\r
49 @param Register A value specifying the logical device number (bits 15:8) \r
50 and the register to read (bits 7:0). The logical device \r
51 number of EFI_SIO_LDN_GLOBAL indicates that global\r
52 registers will be used.\r
53 @param IoData A pointer to the returned register value.\r
54\r
55 @retval EFI_SUCCESS Success.\r
56 @regval EFI_TIMEOUT The register could not be read in the a reasonable\r
57 amount of time. The exact time is device-specific.\r
58 @retval EFI_INVALID_PARAMETERS Register was out of range for this device.\r
59 @retval EFI_INVALID_PARAMETERS IoData was NULL\r
60 @retval EFI_DEVICE_ERROR There was a device fault or the device was not present.\r
61**/\r
62typedef\r
63EFI_STATUS\r
64(EFIAPI *EFI_PEI_SIO_REGISTER_READ)(\r
65 IN CONST EFI_SIO_PPI *This,\r
66 IN BOOLEAN ExitCfgMode,\r
67 IN EFI_SIO_REGISTER Register,\r
68 OUT UINT8 *IoData\r
69 );\r
70\r
71/**\r
72 Write a Super I/O register.\r
73\r
74 The register is specified as an 8-bit logical device number and an 8-bit register\r
75 value. The logical device numbers for specific SIO devices can be determined\r
76 using the Info member of the PPI structure.\r
77\r
78 @param This A pointer to this instance of the EFI_SIO_PPI.\r
79 @param ExitCfgMode A boolean specifying whether the driver should turn on\r
80 configuration mode (FALSE) or turn off configuration mode\r
81 (TRUE) after completing the read operation. The driver must\r
82 track the current state of the configuration mode (if any)\r
83 and turn on configuration mode (if necessary) prior to\r
84 register access.\r
85 @param Register A value specifying the logical device number (bits 15:8) \r
86 and the register to read (bits 7:0). The logical device \r
87 number of EFI_SIO_LDN_GLOBAL indicates that global\r
88 registers will be used.\r
89 @param IoData A pointer to the returned register value.\r
90\r
91 @retval EFI_SUCCESS Success.\r
92 @regval EFI_TIMEOUT The register could not be read in the a reasonable\r
93 amount of time. The exact time is device-specific.\r
94 @retval EFI_INVALID_PARAMETERS Register was out of range for this device.\r
95 @retval EFI_INVALID_PARAMETERS IoData was NULL\r
96 @retval EFI_DEVICE_ERROR There was a device fault or the device was not present.\r
97**/ \r
98typedef\r
99EFI_STATUS\r
100(EFIAPI *EFI_PEI_SIO_REGISTER_WRITE)(\r
101 IN CONST EFI_SIO_PPI *This,\r
102 IN BOOLEAN ExitCfgMode,\r
103 IN EFI_SIO_REGISTER Register,\r
104 IN UINT8 IoData\r
105 );\r
106\r
107/**\r
108 Provides an interface for a table based programming of the Super I/O registers.\r
109\r
110 The Modify() function provides an interface for table based programming of the\r
111 Super I/O registers. This function can be used to perform programming of\r
112 multiple Super I/O registers with a single function call. For each table entry,\r
113 the Register is read, its content is bitwise ANDed with AndMask, and then ORed\r
114 with OrMask before being written back to the Register. The Super I/O driver\r
115 must track the current state of the Super I/O and enable the configuration mode\r
116 of Super I/O if necessary prior to table processing. Once the table is processed,\r
117 the Super I/O device must be returned to the original state.\r
118 \r
119 @param This A pointer to this instance of the EFI_SIO_PPI.\r
120 @param Command A pointer to an array of NumberOfCommands EFI_SIO_REGISTER_MODIFY\r
121 structures. Each structure specifies a single Super I/O register\r
122 modify operation.\r
123 @param NumberOfCommands The number of elements in the Command array.\r
124\r
125 @retval EFI_SUCCESS The operation completed successfully.\r
126 @retval EFI_INVALID_PARAMETERS Command is NULL.\r
127**/ \r
128typedef\r
129EFI_STATUS\r
130(EFIAPI *EFI_PEI_SIO_REGISTER_MODIFY)(\r
131 IN CONST EFI_SIO_PPI *This,\r
132 IN CONST EFI_SIO_REGISTER_MODIFY *Command,\r
133 IN UINTN NumberOfCommands\r
134 );\r
135\r
136///\r
137/// Specifies the end of the information list.\r
138///\r
139#define EFI_ACPI_PNP_HID_END 0\r
140\r
141typedef UINT32 EFI_ACPI_HID;\r
142typedef UINT32 EFI_ACPI_UID;\r
143#pragma pack(1)\r
144typedef struct _EFI_SIO_INFO {\r
145 EFI_ACPI_HID Hid;\r
146 EFI_ACPI_UID Uid;\r
147 UINT8 Ldn;\r
148} EFI_SIO_INFO, *PEFI_SIO_INFO;\r
149#pragma pack()\r
150\r
151///\r
152/// This PPI provides low-level access to Super I/O registers using Read() and\r
153/// Write(). It also uniquely identifies this Super I/O controller using a GUID\r
154/// and provides mappings between ACPI style PNP IDs and the logical device numbers.\r
155/// There is one instance of this PPI per Super I/O device.\r
156///\r
157struct _EFI_SIO_PPI {\r
158 ///\r
159 /// This function reads a register's value from the Super I/O controller.\r
160 ///\r
161 EFI_PEI_SIO_REGISTER_READ Read;\r
162 ///\r
163 /// This function writes a value to a register in the Super I/O controller.\r
164 ///\r
165 EFI_PEI_SIO_REGISTER_WRITE Write;\r
166 ///\r
167 /// This function modifies zero or more registers in the Super I/O controller\r
168 /// using a table.\r
169 ///\r
170 EFI_PEI_SIO_REGISTER_MODIFY Modify;\r
171 ///\r
172 /// This GUID uniquely identifies the Super I/O controller.\r
173 ///\r
174 EFI_GUID SioGuid;\r
175 ///\r
176 /// This pointer is to an array which maps EISA identifiers to logical devices numbers.\r
177 ///\r
178 PEFI_SIO_INFO Info;\r
179};\r
180\r
181extern EFI_GUID gEfiSioPpiGuid;\r
182\r
183#endif \r