]>
Commit | Line | Data |
---|---|---|
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 |
22 | \r | |
23 | typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;\r | |
24 | \r | |
9319d2c2 | 25 | /**\r |
9095d37b | 26 | Executes an SMBus operation to an SMBus controller. Returns when either\r |
d7132512 | 27 | the command has been executed or an error is encountered in doing the operation.\r |
5879b875 | 28 | \r |
00edb218 A |
29 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
30 | @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or\r | |
31 | allocated.\r | |
9095d37b LG |
32 | @param Command This command is transmitted by the SMBus host controller to the SMBus slave\r |
33 | device and the interpretation is SMBus slave device specific.\r | |
34 | It can mean the offset to a list of functions inside\r | |
00edb218 A |
35 | an SMBus slave device. Not all operations or slave devices support\r |
36 | this command's registers.\r | |
9095d37b LG |
37 | @param Operation Signifies which particular SMBus hardware protocol instance that it\r |
38 | will use to execute the SMBus transactions.\r | |
39 | This SMBus hardware protocol is defined by the System Management Bus (SMBus)\r | |
00edb218 | 40 | Specification and is not related to UEFI.\r |
00edb218 | 41 | @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.\r |
9095d37b | 42 | @param Length Signifies the number of bytes that this operation will do.\r |
00edb218 A |
43 | The maximum number of bytes can be revision specific and operation specific.\r |
44 | This parameter will contain the actual number of bytes that are executed\r | |
45 | for this operation. Not all operations require this argument.\r | |
9095d37b LG |
46 | @param Buffer Contains the value of data to execute to the SMBus slave device.\r |
47 | Not all operations require this argument.\r | |
00edb218 | 48 | The length of this buffer is identified by Length.\r |
5879b875 | 49 | \r |
50 | \r | |
51 | @retval EFI_SUCCESS The last data that was returned from the access\r | |
52 | matched the poll exit criteria.\r | |
53 | @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r | |
54 | @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r | |
55 | Timeout is determined by the SMBus host controller device.\r | |
56 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
57 | due to a lack of resources.\r | |
58 | @retval EFI_DEVICE_ERROR The request was not completed because\r | |
59 | a failure reflected in the Host Status Register bit.\r | |
60 | @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r | |
61 | Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r | |
d7132512 | 62 | EfiSmbusQuickWrite. Or Length is outside the range of valid values.\r |
5879b875 | 63 | @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r |
64 | @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r | |
65 | \r | |
66 | **/\r | |
67 | typedef\r | |
68 | EFI_STATUS\r | |
8b13229b | 69 | (EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(\r |
00edb218 | 70 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
11227adb | 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 | |
00edb218 A |
75 | IN OUT UINTN *Length,\r |
76 | IN OUT VOID *Buffer\r | |
5879b875 | 77 | );\r |
78 | \r | |
5879b875 | 79 | /**\r |
9095d37b LG |
80 | The ArpDevice() function enumerates the entire bus or enumerates a specific\r |
81 | device that is identified by SmbusUdid.\r | |
5879b875 | 82 | \r |
d7132512 | 83 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 84 | @param ArpAll A Boolean expression that indicates if the host drivers need\r |
85 | to enumerate all the devices or enumerate only the device that is identified\r | |
86 | by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r | |
87 | If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r | |
88 | will be at SlaveAddress.\r | |
89 | @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r | |
90 | The UDID may not exist for SMBus devices with fixed addresses.\r | |
91 | @param SlaveAddress The new SMBus address for the slave device for\r | |
92 | which the operation is targeted.\r | |
93 | \r | |
94 | @retval EFI_SUCCESS The SMBus slave device address was set.\r | |
95 | @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r | |
96 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
97 | due to a lack of resources.\r | |
98 | @retval EFI_TIMEOUT The SMBus slave device did not respond.\r | |
99 | @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r | |
d7132512 | 100 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r |
5879b875 | 101 | \r |
102 | **/\r | |
103 | typedef\r | |
104 | EFI_STATUS\r | |
8b13229b | 105 | (EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(\r |
00edb218 | 106 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
11227adb | 107 | IN BOOLEAN ArpAll,\r |
108 | IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r | |
00edb218 | 109 | IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r |
5879b875 | 110 | );\r |
111 | \r | |
5879b875 | 112 | /**\r |
9095d37b LG |
113 | The GetArpMap() function returns the mapping of all the SMBus devices\r |
114 | that are enumerated by the SMBus host driver.\r | |
5879b875 | 115 | \r |
d7132512 | 116 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 117 | @param Length Size of the buffer that contains the SMBus device map.\r |
118 | @param SmbusDeviceMap The pointer to the device map as enumerated\r | |
119 | by the SMBus controller driver.\r | |
120 | \r | |
121 | @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r | |
d7132512 | 122 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r |
5879b875 | 123 | \r |
124 | **/\r | |
125 | typedef\r | |
126 | EFI_STATUS\r | |
8b13229b | 127 | (EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(\r |
00edb218 A |
128 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
129 | IN OUT UINTN *Length,\r | |
130 | IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r | |
5879b875 | 131 | );\r |
132 | \r | |
d7132512 LG |
133 | /**\r |
134 | CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.\r | |
135 | \r | |
136 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r | |
137 | @param SlaveAddress The SMBUS hardware address to which the SMBUS\r | |
138 | device is preassigned or allocated.\r | |
139 | @param Data Data of the SMBus host notify command that\r | |
140 | the caller wants to be called.\r | |
141 | \r | |
11227adb | 142 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
143 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r | |
144 | implemented by this PEIM.\r | |
145 | \r | |
d7132512 LG |
146 | **/\r |
147 | typedef\r | |
148 | EFI_STATUS\r | |
149 | (EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(\r | |
150 | IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,\r | |
11227adb | 151 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
152 | IN UINTN Data\r | |
d7132512 | 153 | );\r |
5879b875 | 154 | \r |
155 | /**\r | |
9095d37b | 156 | The Notify() function registers all the callback functions to allow the\r |
5879b875 | 157 | bus driver to call these functions when the SlaveAddress/Data pair happens.\r |
158 | \r | |
d7132512 | 159 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 160 | @param SlaveAddress Address that the host controller detects as\r |
161 | sending a message and calls all the registered functions.\r | |
162 | @param Data Data that the host controller detects as sending a message\r | |
163 | and calls all the registered functions.\r | |
164 | @param NotifyFunction The function to call when the bus driver\r | |
165 | detects the SlaveAddress and Data pair.\r | |
166 | \r | |
d7132512 LG |
167 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
168 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r | |
169 | implemented by this PEIM.\r | |
5879b875 | 170 | **/\r |
171 | typedef\r | |
172 | EFI_STATUS\r | |
8b13229b | 173 | (EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY)(\r |
11227adb | 174 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
175 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
176 | IN UINTN Data,\r | |
177 | IN EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction\r | |
5879b875 | 178 | );\r |
179 | \r | |
11227adb | 180 | ///\r |
9095d37b | 181 | /// Provides the basic I/O interfaces that a PEIM uses to access\r |
11227adb | 182 | /// its SMBus controller and the slave devices attached to it.\r |
183 | ///\r | |
5879b875 | 184 | struct _EFI_PEI_SMBUS2_PPI {\r |
00edb218 A |
185 | EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;\r |
186 | EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;\r | |
187 | EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;\r | |
188 | EFI_PEI_SMBUS2_PPI_NOTIFY Notify;\r | |
11227adb | 189 | ///\r |
190 | /// Identifier which uniquely identifies this SMBus controller in a system.\r | |
191 | ///\r | |
00edb218 | 192 | EFI_GUID Identifier;\r |
5879b875 | 193 | };\r |
194 | \r | |
195 | extern EFI_GUID gEfiPeiSmbus2PpiGuid;\r | |
196 | \r | |
197 | #endif\r |