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