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