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