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