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