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