]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/Smbus2.h
Add the detailed descriptions for the structure data member in these protocol.
[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
0047820e 16 This PPI is introduced in PI Version 1.0.\r
5879b875 17\r
18**/\r
19\r
d7132512
LG
20#ifndef __PEI_SMBUS2_PPI_H__\r
21#define __PEI_SMBUS2_PPI_H__\r
11227adb 22\r
5879b875 23#include <IndustryStandard/SmBus.h>\r
24\r
25#define EFI_PEI_SMBUS2_PPI_GUID \\r
00edb218 26 { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }\r
5879b875 27\r
28\r
29typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;\r
30\r
9319d2c2 31/**\r
d7132512
LG
32 Executes an SMBus operation to an SMBus controller. Returns when either \r
33 the command has been executed or an error is encountered in doing the operation.\r
5879b875 34\r
00edb218
A
35 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
36 @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or\r
37 allocated.\r
38 @param Command This command is transmitted by the SMBus host controller to the SMBus slave \r
39 device and the interpretation is SMBus slave device specific. \r
40 It can mean the offset to a list of functions inside \r
41 an SMBus slave device. Not all operations or slave devices support\r
42 this command's registers.\r
00edb218
A
43 @param Operation Signifies which particular SMBus hardware protocol instance that it \r
44 will use to execute the SMBus transactions. \r
45 This SMBus hardware protocol is defined by the System Management Bus (SMBus) \r
46 Specification and is not related to UEFI.\r
00edb218 47 @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.\r
00edb218
A
48 @param Length Signifies the number of bytes that this operation will do. \r
49 The maximum number of bytes can be revision specific and operation specific.\r
50 This parameter will contain the actual number of bytes that are executed\r
51 for this operation. Not all operations require this argument.\r
00edb218
A
52 @param Buffer Contains the value of data to execute to the SMBus slave device. \r
53 Not all operations require this argument. \r
54 The length of this buffer is identified by Length.\r
5879b875 55\r
56\r
57 @retval EFI_SUCCESS The last data that was returned from the access\r
58 matched the poll exit criteria.\r
59 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r
60 @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r
61 Timeout is determined by the SMBus host controller device.\r
62 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
63 due to a lack of resources.\r
64 @retval EFI_DEVICE_ERROR The request was not completed because\r
65 a failure reflected in the Host Status Register bit.\r
66 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
67 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r
d7132512 68 EfiSmbusQuickWrite. Or Length is outside the range of valid values.\r
5879b875 69 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r
70 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r
71\r
72**/\r
73typedef\r
74EFI_STATUS\r
8b13229b 75(EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(\r
00edb218 76 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
11227adb 77 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
78 IN EFI_SMBUS_DEVICE_COMMAND Command,\r
79 IN EFI_SMBUS_OPERATION Operation,\r
80 IN BOOLEAN PecCheck,\r
00edb218
A
81 IN OUT UINTN *Length,\r
82 IN OUT VOID *Buffer\r
5879b875 83);\r
84\r
5879b875 85/**\r
86 The ArpDevice() function enumerates the entire bus or enumerates a specific \r
87 device that is identified by SmbusUdid. \r
88\r
d7132512 89 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 90 @param ArpAll A Boolean expression that indicates if the host drivers need\r
91 to enumerate all the devices or enumerate only the device that is identified\r
92 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r
93 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
94 will be at SlaveAddress.\r
95 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r
96 The UDID may not exist for SMBus devices with fixed addresses.\r
97 @param SlaveAddress The new SMBus address for the slave device for\r
98 which the operation is targeted.\r
99\r
100 @retval EFI_SUCCESS The SMBus slave device address was set.\r
101 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
102 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
103 due to a lack of resources.\r
104 @retval EFI_TIMEOUT The SMBus slave device did not respond.\r
105 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r
d7132512 106 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r
5879b875 107\r
108**/\r
109typedef\r
110EFI_STATUS\r
8b13229b 111(EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(\r
00edb218 112 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
11227adb 113 IN BOOLEAN ArpAll,\r
114 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
00edb218 115 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
5879b875 116);\r
117\r
118\r
119typedef struct {\r
11227adb 120 ///\r
121 /// The SMBUS hardware address to which the SMBUS device is preassigned or\r
122 /// allocated. Type EFI_SMBUS_DEVICE_ADDRESS is defined in EFI_PEI_SMBUS2_PPI.Execute().\r
123 ///\r
5879b875 124 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;\r
11227adb 125 ///\r
126 /// The SMBUS Unique Device Identifier (UDID) as defined in EFI_SMBUS_UDID.\r
127 /// Type EFI_SMBUS_UDID is defined in EFI_PEI_SMBUS2_PPI.ArpDevice().\r
128 ///\r
5879b875 129 EFI_SMBUS_UDID SmbusDeviceUdid;\r
130} EFI_SMBUS_DEVICE_MAP;\r
131\r
132/**\r
133 The GetArpMap() function returns the mapping of all the SMBus devices \r
134 that are enumerated by the SMBus host driver. \r
135\r
d7132512 136 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 137 @param Length Size of the buffer that contains the SMBus device map.\r
138 @param SmbusDeviceMap The pointer to the device map as enumerated\r
139 by the SMBus controller driver.\r
140\r
141 @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r
d7132512 142 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r
5879b875 143\r
144**/\r
145typedef\r
146EFI_STATUS\r
8b13229b 147(EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(\r
00edb218
A
148 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
149 IN OUT UINTN *Length,\r
150 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
5879b875 151);\r
152\r
d7132512
LG
153/**\r
154 CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.\r
155\r
156 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
157 @param SlaveAddress The SMBUS hardware address to which the SMBUS\r
158 device is preassigned or allocated.\r
159 @param Data Data of the SMBus host notify command that\r
160 the caller wants to be called.\r
161\r
11227adb 162 @retval EFI_SUCCESS NotifyFunction has been registered.\r
163 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r
164 implemented by this PEIM.\r
165\r
d7132512
LG
166**/\r
167typedef\r
168EFI_STATUS\r
169(EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(\r
170 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,\r
11227adb 171 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
172 IN UINTN Data\r
d7132512 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
11227adb 194 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
195 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
196 IN UINTN Data,\r
197 IN EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction\r
5879b875 198);\r
199\r
11227adb 200///\r
201/// Provides the basic I/O interfaces that a PEIM uses to access \r
202/// its SMBus controller and the slave devices attached to it.\r
203///\r
5879b875 204struct _EFI_PEI_SMBUS2_PPI {\r
00edb218
A
205 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;\r
206 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;\r
207 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;\r
208 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;\r
11227adb 209 ///\r
210 /// Identifier which uniquely identifies this SMBus controller in a system.\r
211 ///\r
00edb218 212 EFI_GUID Identifier;\r
5879b875 213};\r
214\r
215extern EFI_GUID gEfiPeiSmbus2PpiGuid;\r
216\r
217#endif\r