Clean up the duplicated definitions in Ppi/Smbus.h of IntelFrameworkPkg.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Ppi / Smbus.h
CommitLineData
79964ac8 1/** @file\r
2 This file declares Smbus PPI.\r
3\r
4 Copyright (c) 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: Smbus.h\r
14\r
15 @par Revision Reference:\r
16 This PPI is defined in Framework of EFI SmBus PPI spec.\r
17 Version 0.9\r
18\r
19**/\r
20\r
21#ifndef _PEI_SMBUS_PPI_H\r
22#define _PEI_SMBUS_PPI_H\r
23\r
b80fbe85 24#include <PiPei.h>\r
3f3181b4 25#include <Ppi/Smbus2.h>\r
79964ac8 26\r
27#define EFI_PEI_SMBUS_PPI_GUID \\r
28 { \\r
29 0xabd42895, 0x78cf, 0x4872, {0x84, 0x44, 0x1b, 0x5c, 0x18, 0xb, 0xfb, 0xda } \\r
30 }\r
31\r
32typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;\r
33\r
34/**\r
35 Executes an SMBus operation to an SMBus controller.\r
36\r
37 @param PeiServices A pointer to the system PEI Services Table.\r
38 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
39 @param SlaveAddress The SMBUS hardware address to which the SMBUS\r
40 device is preassigned or allocated.\r
41 @param Command This command is transmitted by the SMBus host\r
42 controller to the SMBus slave device and the interpretation is\r
43 SMBus slave device specific.\r
44 @param Operation Signifies which particular SMBus hardware protocol\r
45 instance that it will use to execute the SMBus transactions.\r
46 @param PecCheck Defines if Packet Error Code (PEC) checking is required\r
47 for this operation.\r
48 @param Length Signifies the number of bytes that this operation will do.\r
49 @param Buffer Contains the value of data to execute to the SMBus slave device.\r
50\r
51 @retval EFI_SUCCESS The last data that was returned from the access\r
52 matched the poll exit criteria.\r
53 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r
54 @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r
55 Timeout is determined by the SMBus host controller device.\r
56 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
57 due to a lack of resources.\r
58 @retval EFI_DEVICE_ERROR The request was not completed because\r
59 a failure reflected in the Host Status Register bit.\r
60 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
61 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r
62 EfiSmbusQuickWrite. Length is outside the range of valid values.\r
63 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r
64 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r
65\r
66**/\r
67typedef\r
68EFI_STATUS\r
69(EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION) (\r
70 IN EFI_PEI_SERVICES **PeiServices,\r
71 IN EFI_PEI_SMBUS_PPI *This,\r
72 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
73 IN EFI_SMBUS_DEVICE_COMMAND Command,\r
74 IN EFI_SMBUS_OPERATION Operation,\r
75 IN BOOLEAN PecCheck,\r
76 IN OUT UINTN *Length,\r
77 IN OUT VOID *Buffer\r
78 );\r
79\r
79964ac8 80/**\r
81 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.\r
82\r
83 @param PeiServices A pointer to the system PEI Services Table.\r
84 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
85 @param SlaveAddress The SMBUS hardware address to which the SMBUS\r
86 device is preassigned or allocated.\r
87 @param Data Data of the SMBus host notify command that\r
88 the caller wants to be called.\r
89\r
90 @return Status Code\r
91\r
92**/\r
93typedef\r
94EFI_STATUS\r
95(EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION) (\r
96 IN EFI_PEI_SERVICES **PeiServices,\r
97 IN EFI_PEI_SMBUS_PPI *SmbusPpi,\r
98 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
99 IN UINTN Data\r
100 );\r
101\r
102/**\r
103 The ArpDevice() function enumerates the entire bus or enumerates a specific\r
104 device that is identified by SmbusUdid.\r
105\r
106 @param PeiServices A pointer to the system PEI Services Table.\r
107 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
108 @param ArpAll A Boolean expression that indicates if the host drivers need\r
109 to enumerate all the devices or enumerate only the device that is identified\r
110 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r
111 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
112 will be at SlaveAddress.\r
113 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r
114 The UDID may not exist for SMBus devices with fixed addresses.\r
115 @param SlaveAddress The new SMBus address for the slave device for\r
116 which the operation is targeted.\r
117\r
118 @retval EFI_SUCCESS The SMBus slave device address was set.\r
119 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
120 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
121 due to a lack of resources.\r
122 @retval EFI_TIMEOUT The SMBus slave device did not respond.\r
123 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r
124\r
125**/\r
126typedef\r
127EFI_STATUS\r
128(EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE) (\r
129 IN EFI_PEI_SERVICES **PeiServices,\r
130 IN EFI_PEI_SMBUS_PPI *This,\r
131 IN BOOLEAN ArpAll,\r
132 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
133 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
134 );\r
135\r
79964ac8 136/**\r
137 The GetArpMap() function returns the mapping of all the SMBus devices\r
138 that are enumerated by the SMBus host driver.\r
139\r
140 @param PeiServices A pointer to the system PEI Services Table.\r
141 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
142 @param Length Size of the buffer that contains the SMBus device map.\r
143 @param SmbusDeviceMap The pointer to the device map as enumerated\r
144 by the SMBus controller driver.\r
145\r
146 @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r
147\r
148**/\r
149typedef\r
150EFI_STATUS\r
151(EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP) (\r
152 IN EFI_PEI_SERVICES **PeiServices,\r
153 IN EFI_PEI_SMBUS_PPI *This,\r
154 IN OUT UINTN *Length,\r
155 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
156 );\r
157\r
158/**\r
159 The Notify() function registers all the callback functions to allow the\r
160 bus driver to call these functions when the SlaveAddress/Data pair happens.\r
161\r
162 @param PeiServices A pointer to the system PEI Services Table.\r
163 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
164 @param SlaveAddress Address that the host controller detects as\r
165 sending a message and calls all the registered functions.\r
166 @param Data Data that the host controller detects as sending a message\r
167 and calls all the registered functions.\r
168 @param NotifyFunction The function to call when the bus driver\r
169 detects the SlaveAddress and Data pair.\r
170\r
171 @retval EFI_SUCCESS NotifyFunction has been registered.\r
172\r
173**/\r
174typedef\r
175EFI_STATUS\r
176(EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY) (\r
177 IN EFI_PEI_SERVICES **PeiServices,\r
178 IN EFI_PEI_SMBUS_PPI *This,\r
179 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
180 IN UINTN Data,\r
181 IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
182 );\r
183\r
184/**\r
185 @par Ppi Description:\r
186 Provides the basic I/O interfaces that a PEIM uses to access\r
187 its SMBus controller and the slave devices attached to it.\r
188\r
189 @param Execute\r
190 Executes the SMBus operation to an SMBus slave device.\r
191\r
192 @param ArpDevice\r
193 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r
194\r
195 @param GetArpMap\r
196 Allows a PEIM to retrieve the address that was allocated by the SMBus\r
197 host controller during enumeration/ARP.\r
198\r
199 @param Notify\r
200 Allows a driver to register for a callback to the SMBus host\r
201 controller driver when the bus issues a notification to the bus controller PEIM.\r
202\r
203**/\r
204struct _EFI_PEI_SMBUS_PPI {\r
205 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;\r
206 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;\r
207 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;\r
208 EFI_PEI_SMBUS_PPI_NOTIFY Notify;\r
209};\r
210\r
211extern EFI_GUID gEfiPeiSmbusPpiGuid;\r
212\r
213#endif\r