]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/Smbus2.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Ppi / Smbus2.h
CommitLineData
5879b875 1/** @file\r
2 This file declares Smbus2 PPI.\r
9095d37b 3 This PPI provides the basic I/O interfaces that a PEIM uses to access its\r
d7132512 4 SMBus controller and the slave devices attached to it.\r
5879b875 5\r
9095d37b 6 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
5879b875 8\r
5879b875 9 @par Revision Reference:\r
0047820e 10 This PPI is introduced in PI Version 1.0.\r
5879b875 11\r
12**/\r
13\r
d7132512
LG
14#ifndef __PEI_SMBUS2_PPI_H__\r
15#define __PEI_SMBUS2_PPI_H__\r
11227adb 16\r
5879b875 17#include <IndustryStandard/SmBus.h>\r
18\r
19#define EFI_PEI_SMBUS2_PPI_GUID \\r
00edb218 20 { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }\r
5879b875 21\r
5879b875 22typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;\r
23\r
9319d2c2 24/**\r
9095d37b 25 Executes an SMBus operation to an SMBus controller. Returns when either\r
d7132512 26 the command has been executed or an error is encountered in doing the operation.\r
5879b875 27\r
00edb218
A
28 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
29 @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or\r
30 allocated.\r
9095d37b
LG
31 @param Command This command is transmitted by the SMBus host controller to the SMBus slave\r
32 device and the interpretation is SMBus slave device specific.\r
33 It can mean the offset to a list of functions inside\r
00edb218
A
34 an SMBus slave device. Not all operations or slave devices support\r
35 this command's registers.\r
9095d37b
LG
36 @param Operation Signifies which particular SMBus hardware protocol instance that it\r
37 will use to execute the SMBus transactions.\r
38 This SMBus hardware protocol is defined by the System Management Bus (SMBus)\r
00edb218 39 Specification and is not related to UEFI.\r
00edb218 40 @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.\r
9095d37b 41 @param Length Signifies the number of bytes that this operation will do.\r
00edb218
A
42 The maximum number of bytes can be revision specific and operation specific.\r
43 This parameter will contain the actual number of bytes that are executed\r
44 for this operation. Not all operations require this argument.\r
9095d37b
LG
45 @param Buffer Contains the value of data to execute to the SMBus slave device.\r
46 Not all operations require this argument.\r
00edb218 47 The length of this buffer is identified by Length.\r
5879b875 48\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
d7132512 61 EfiSmbusQuickWrite. Or Length is outside the range of valid values.\r
5879b875 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
8b13229b 68(EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(\r
00edb218 69 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
11227adb 70 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
71 IN EFI_SMBUS_DEVICE_COMMAND Command,\r
72 IN EFI_SMBUS_OPERATION Operation,\r
73 IN BOOLEAN PecCheck,\r
00edb218
A
74 IN OUT UINTN *Length,\r
75 IN OUT VOID *Buffer\r
2f88bd3a 76 );\r
5879b875 77\r
5879b875 78/**\r
9095d37b
LG
79 The ArpDevice() function enumerates the entire bus or enumerates a specific\r
80 device that is identified by SmbusUdid.\r
5879b875 81\r
d7132512 82 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 83 @param ArpAll A Boolean expression that indicates if the host drivers need\r
84 to enumerate all the devices or enumerate only the device that is identified\r
85 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r
86 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
87 will be at SlaveAddress.\r
88 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r
89 The UDID may not exist for SMBus devices with fixed addresses.\r
90 @param SlaveAddress The new SMBus address for the slave device for\r
91 which the operation is targeted.\r
92\r
93 @retval EFI_SUCCESS The SMBus slave device address was set.\r
94 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
95 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
96 due to a lack of resources.\r
97 @retval EFI_TIMEOUT The SMBus slave device did not respond.\r
98 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r
d7132512 99 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r
5879b875 100\r
101**/\r
102typedef\r
103EFI_STATUS\r
8b13229b 104(EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(\r
00edb218 105 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
11227adb 106 IN BOOLEAN ArpAll,\r
d0e2f823 107 IN EFI_SMBUS_UDID *SmbusUdid OPTIONAL,\r
00edb218 108 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
2f88bd3a 109 );\r
5879b875 110\r
5879b875 111/**\r
9095d37b
LG
112 The GetArpMap() function returns the mapping of all the SMBus devices\r
113 that are enumerated by the SMBus host driver.\r
5879b875 114\r
d7132512 115 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 116 @param Length Size of the buffer that contains the SMBus device map.\r
117 @param SmbusDeviceMap The pointer to the device map as enumerated\r
118 by the SMBus controller driver.\r
119\r
120 @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r
d7132512 121 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r
5879b875 122\r
123**/\r
124typedef\r
125EFI_STATUS\r
8b13229b 126(EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(\r
00edb218
A
127 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
128 IN OUT UINTN *Length,\r
129 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
2f88bd3a 130 );\r
5879b875 131\r
d7132512
LG
132/**\r
133 CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.\r
134\r
135 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
136 @param SlaveAddress The SMBUS hardware address to which the SMBUS\r
137 device is preassigned or allocated.\r
138 @param Data Data of the SMBus host notify command that\r
139 the caller wants to be called.\r
140\r
11227adb 141 @retval EFI_SUCCESS NotifyFunction has been registered.\r
142 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r
143 implemented by this PEIM.\r
144\r
d7132512
LG
145**/\r
146typedef\r
147EFI_STATUS\r
148(EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(\r
149 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,\r
11227adb 150 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
151 IN UINTN Data\r
2f88bd3a 152 );\r
5879b875 153\r
154/**\r
9095d37b 155 The Notify() function registers all the callback functions to allow the\r
5879b875 156 bus driver to call these functions when the SlaveAddress/Data pair happens.\r
157\r
d7132512 158 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r
5879b875 159 @param SlaveAddress Address that the host controller detects as\r
160 sending a message and calls all the registered functions.\r
161 @param Data Data that the host controller detects as sending a message\r
162 and calls all the registered functions.\r
163 @param NotifyFunction The function to call when the bus driver\r
164 detects the SlaveAddress and Data pair.\r
165\r
d7132512
LG
166 @retval EFI_SUCCESS NotifyFunction has been registered.\r
167 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r
168 implemented by this PEIM.\r
5879b875 169**/\r
170typedef\r
171EFI_STATUS\r
8b13229b 172(EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY)(\r
11227adb 173 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
174 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
175 IN UINTN Data,\r
176 IN EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction\r
2f88bd3a 177 );\r
5879b875 178\r
11227adb 179///\r
9095d37b 180/// Provides the basic I/O interfaces that a PEIM uses to access\r
11227adb 181/// its SMBus controller and the slave devices attached to it.\r
182///\r
5879b875 183struct _EFI_PEI_SMBUS2_PPI {\r
2f88bd3a
MK
184 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;\r
185 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;\r
186 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;\r
187 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;\r
11227adb 188 ///\r
189 /// Identifier which uniquely identifies this SMBus controller in a system.\r
190 ///\r
2f88bd3a 191 EFI_GUID Identifier;\r
5879b875 192};\r
193\r
2f88bd3a 194extern EFI_GUID gEfiPeiSmbus2PpiGuid;\r
5879b875 195\r
196#endif\r