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