]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/Smbus2.h
Code Scrub for header files in MdePkg/Include/Ppi and Uefi directory.
[mirror_edk2.git] / MdePkg / Include / Ppi / Smbus2.h
CommitLineData
5879b875 1/** @file\r
2 This file declares Smbus2 PPI.\r
d7132512
LG
3 This PPI provides the basic I/O interfaces that a PEIM uses to access its \r
4 SMBus controller and the slave devices attached to it.\r
5879b875 5\r
d7132512 6 Copyright (c) 2006 - 2008, Intel Corporation \r
5879b875 7 All rights reserved. This program and the accompanying materials \r
8 are licensed and made available under the terms and conditions of the BSD License \r
9 which accompanies this distribution. The full text of the license may be found at \r
10 http://opensource.org/licenses/bsd-license.php \r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
14\r
5879b875 15 @par Revision Reference:\r
16 This PPI is defined in PI.\r
17 Version 1.00\r
18\r
19**/\r
20\r
d7132512
LG
21#ifndef __PEI_SMBUS2_PPI_H__\r
22#define __PEI_SMBUS2_PPI_H__\r
01aef47b 23#include <PiPei.h>\r
5879b875 24#include <IndustryStandard/SmBus.h>\r
25\r
26#define EFI_PEI_SMBUS2_PPI_GUID \\r
00edb218 27 { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }\r
5879b875 28\r
29\r
30typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;\r
31\r
32//\r
33// EFI_SMBUS_DEVICE_COMMAND\r
34//\r
00edb218 35typedef UINTN EFI_SMBUS_DEVICE_COMMAND;\r
5879b875 36\r
37\r
38/*\r
d7132512
LG
39 Executes an SMBus operation to an SMBus controller. Returns when either \r
40 the command has been executed or an error is encountered in doing the operation.\r
5879b875 41\r
00edb218
A
42 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
43 @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or\r
44 allocated.\r
45 @param Command This command is transmitted by the SMBus host controller to the SMBus slave \r
46 device and the interpretation is SMBus slave device specific. \r
47 It can mean the offset to a list of functions inside \r
48 an SMBus slave device. Not all operations or slave devices support\r
49 this command's registers.\r
5879b875 50\r
00edb218
A
51 @param Operation Signifies which particular SMBus hardware protocol instance that it \r
52 will use to execute the SMBus transactions. \r
53 This SMBus hardware protocol is defined by the System Management Bus (SMBus) \r
54 Specification and is not related to UEFI.\r
5879b875 55\r
00edb218 56 @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.\r
5879b875 57\r
00edb218
A
58 @param Length Signifies the number of bytes that this operation will do. \r
59 The maximum number of bytes can be revision specific and operation specific.\r
60 This parameter will contain the actual number of bytes that are executed\r
61 for this operation. Not all operations require this argument.\r
5879b875 62\r
00edb218
A
63 @param Buffer Contains the value of data to execute to the SMBus slave device. \r
64 Not all operations require this argument. \r
65 The length of this buffer is identified by Length.\r
5879b875 66\r
67\r
68 @retval EFI_SUCCESS The last data that was returned from the access\r
69 matched the poll exit criteria.\r
70 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r
71 @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r
72 Timeout is determined by the SMBus host controller device.\r
73 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
74 due to a lack of resources.\r
75 @retval EFI_DEVICE_ERROR The request was not completed because\r
76 a failure reflected in the Host Status Register bit.\r
77 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
78 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r
d7132512 79 EfiSmbusQuickWrite. Or Length is outside the range of valid values.\r
5879b875 80 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r
81 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r
82\r
83**/\r
84typedef\r
85EFI_STATUS\r
8b13229b 86(EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(\r
00edb218
A
87 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
88 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
89 IN CONST EFI_SMBUS_DEVICE_COMMAND Command,\r
90 IN CONST EFI_SMBUS_OPERATION Operation,\r
91 IN CONST BOOLEAN PecCheck,\r
92 IN OUT UINTN *Length,\r
93 IN OUT VOID *Buffer\r
5879b875 94);\r
95\r
5879b875 96/**\r
97 The ArpDevice() function enumerates the entire bus or enumerates a specific \r
98 device that is identified by SmbusUdid. \r
99\r
d7132512 100 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 101 @param ArpAll A Boolean expression that indicates if the host drivers need\r
102 to enumerate all the devices or enumerate only the device that is identified\r
103 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r
104 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
105 will be at SlaveAddress.\r
106 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r
107 The UDID may not exist for SMBus devices with fixed addresses.\r
108 @param SlaveAddress The new SMBus address for the slave device for\r
109 which the operation is targeted.\r
110\r
111 @retval EFI_SUCCESS The SMBus slave device address was set.\r
112 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
113 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
114 due to a lack of resources.\r
115 @retval EFI_TIMEOUT The SMBus slave device did not respond.\r
116 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r
d7132512 117 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r
5879b875 118\r
119**/\r
120typedef\r
121EFI_STATUS\r
8b13229b 122(EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(\r
00edb218
A
123 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
124 IN CONST BOOLEAN ArpAll,\r
125 IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
126 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
5879b875 127);\r
128\r
129\r
130typedef struct {\r
131 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;\r
132 EFI_SMBUS_UDID SmbusDeviceUdid;\r
133} EFI_SMBUS_DEVICE_MAP;\r
134\r
135/**\r
136 The GetArpMap() function returns the mapping of all the SMBus devices \r
137 that are enumerated by the SMBus host driver. \r
138\r
d7132512 139 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 140 @param Length Size of the buffer that contains the SMBus device map.\r
141 @param SmbusDeviceMap The pointer to the device map as enumerated\r
142 by the SMBus controller driver.\r
143\r
144 @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r
d7132512 145 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r
5879b875 146\r
147**/\r
148typedef\r
149EFI_STATUS\r
8b13229b 150(EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(\r
00edb218
A
151 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
152 IN OUT UINTN *Length,\r
153 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
5879b875 154);\r
155\r
d7132512
LG
156/**\r
157 CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.\r
158\r
159 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
160 @param SlaveAddress The SMBUS hardware address to which the SMBUS\r
161 device is preassigned or allocated.\r
162 @param Data Data of the SMBus host notify command that\r
163 the caller wants to be called.\r
164\r
165 @return Status\r
166**/\r
167typedef\r
168EFI_STATUS\r
169(EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(\r
170 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,\r
171 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
172 IN CONST UINTN Data\r
173);\r
5879b875 174\r
175/**\r
176 The Notify() function registers all the callback functions to allow the \r
177 bus driver to call these functions when the SlaveAddress/Data pair happens.\r
178\r
d7132512 179 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 180 @param SlaveAddress Address that the host controller detects as\r
181 sending a message and calls all the registered functions.\r
182 @param Data Data that the host controller detects as sending a message\r
183 and calls all the registered functions.\r
184 @param NotifyFunction The function to call when the bus driver\r
185 detects the SlaveAddress and Data pair.\r
186\r
d7132512
LG
187 @retval EFI_SUCCESS NotifyFunction has been registered.\r
188 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r
189 implemented by this PEIM.\r
5879b875 190**/\r
191typedef\r
192EFI_STATUS\r
8b13229b 193(EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY)(\r
00edb218
A
194 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
195 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
196 IN CONST UINTN Data,\r
197 IN CONST EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction\r
5879b875 198);\r
199\r
200/**\r
201 @par Ppi Description:\r
202 Provides the basic I/O interfaces that a PEIM uses to access \r
203 its SMBus controller and the slave devices attached to it.\r
204\r
205 @param Execute\r
206 Executes the SMBus operation to an SMBus slave device.\r
207\r
208 @param ArpDevice\r
209 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r
210\r
211 @param GetArpMap\r
212 Allows a PEIM to retrieve the address that was allocated by the SMBus \r
213 host controller during enumeration/ARP.\r
214\r
215 @param Notify\r
216 Allows a driver to register for a callback to the SMBus host \r
217 controller driver when the bus issues a notification to the bus controller PEIM.\r
218\r
219 @param Identifier\r
220 Identifier which uniquely identifies this SMBus controller in a system.\r
221\r
222**/\r
223struct _EFI_PEI_SMBUS2_PPI {\r
00edb218
A
224 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;\r
225 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;\r
226 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;\r
227 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;\r
228 EFI_GUID Identifier;\r
5879b875 229};\r
230\r
231extern EFI_GUID gEfiPeiSmbus2PpiGuid;\r
232\r
233#endif\r