]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/I2cBusConfigurationManagement.h
MdePkg FirmwareManagement.h: Fix typo EFI_SECURITY_VIOLATIO
[mirror_edk2.git] / MdePkg / Include / Protocol / I2cBusConfigurationManagement.h
CommitLineData
4006b0b5
EL
1/** @file\r
2 I2C Bus Configuration Management Protocol as defined in the PI 1.3 specification.\r
3\r
4 The EFI I2C bus configuration management protocol provides platform specific \r
5 services that allow the I2C host protocol to reconfigure the switches and multiplexers \r
6 and set the clock frequency for the I2C bus. This protocol also enables the I2C host protocol \r
7 to reset an I2C device which may be locking up the I2C bus by holding the clock or data line low.\r
8\r
9 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
10 This program and the accompanying materials \r
11 are licensed and made available under the terms and conditions of the BSD License \r
12 which accompanies this distribution. The full text of the license may be found at \r
13 http://opensource.org/licenses/bsd-license.php \r
14\r
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
17\r
18 @par Revision Reference:\r
19 This protocol is from PI Version 1.3.\r
20\r
21**/\r
22\r
23#ifndef __I2C_BUS_CONFIGURATION_MANAGEMENT_H__\r
24#define __I2C_BUS_CONFIGURATION_MANAGEMENT_H__\r
25\r
26#define EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL_GUID \\r
27 { 0x55b71fb5, 0x17c6, 0x410e, { 0xb5, 0xbd, 0x5f, 0xa2, 0xe3, 0xd4, 0x46, 0x6b }}\r
28\r
29///\r
30/// I2C bus configuration management protocol\r
31///\r
32/// The EFI I2C bus configuration management protocol provides platform\r
33/// specific services that allow the I2C host protocol to reconfigure the\r
34/// switches and multiplexers and set the clock frequency for the I2C bus.\r
35/// This protocol also enables the I2C host protocol to reset an I2C device\r
36/// which may be locking up the I2C bus by holding the clock or data line\r
37/// low.\r
38///\r
39/// The I2C protocol stack uses the concept of an I2C bus configuration as\r
40/// a way to describe a particular state of the switches and multiplexers\r
41/// in the I2C bus.\r
42///\r
43/// A simple I2C bus does not have any multiplexers or switches is described\r
44/// to the I2C protocol stack with a single I2C bus configuration which\r
45/// specifies the I2C bus frequency.\r
46///\r
47/// An I2C bus with switches and multiplexers use an I2C bus configuration\r
48/// to describe each of the unique settings for the switches and multiplexers\r
49/// and the I2C bus frequency. However the I2C bus configuration management\r
50/// protocol only needs to define the I2C bus configurations that the software\r
51/// uses, which may be a subset of the total.\r
52///\r
53/// The I2C bus configuration description includes a list of I2C devices\r
54/// which may be accessed when this I2C bus configuration is enabled. I2C\r
55/// devices before a switch or multiplexer must be included in one I2C bus\r
56/// configuration while I2C devices after a switch or multiplexer are on\r
57/// another I2C bus configuration.\r
58///\r
59/// The I2C bus configuration management protocol is an optional protocol.\r
60/// When the I2C bus configuration protocol is not defined the I2C host\r
61/// protocol does not start and the I2C master protocol may be used for\r
62/// other purposes such as SMBus traffic. When the I2C bus configuration\r
63/// protocol is available, the I2C host protocol uses the I2C bus\r
64/// configuration protocol to call into the platform specific code to set\r
65/// the switches and multiplexers and set the maximum I2C bus frequency.\r
66///\r
67/// The platform designers determine the maximum I2C bus frequency by\r
68/// selecting a frequency which supports all of the I2C devices on the\r
69/// I2C bus for the setting of switches and multiplexers. The platform\r
70/// designers must validate this against the I2C device data sheets and\r
71/// any limits of the I2C controller or bus length.\r
72///\r
73/// During I2C device enumeration, the I2C bus driver retrieves the I2C\r
74/// bus configuration that must be used to perform I2C transactions to\r
75/// each I2C device. This I2C bus configuration value is passed into\r
76/// the I2C host protocol to identify the I2C bus configuration required\r
77/// to access a specific I2C device. The I2C host protocol calls\r
78/// EnableBusConfiguration() to set the switches and multiplexers in the\r
79/// I2C bus and the I2C clock frequency. The I2C host protocol may\r
80/// optimize calls to EnableBusConfiguration() by only making the call\r
81/// when the I2C bus configuration value changes between I2C requests.\r
82///\r
83/// When I2C transactions are required on the same I2C bus to change the\r
84/// state of multiplexers or switches, the I2C master protocol must be\r
85/// used to perform the necessary I2C transactions.\r
86///\r
87/// It is up to the platform specific code to choose the proper I2C bus\r
88/// configuration when ExitBootServices() is called. Some operating systems\r
89/// are not able to manage the I2C bus configurations and must use the I2C\r
90/// bus configuration that is established by the platform firmware before\r
91/// ExitBootServices() returns.\r
92///\r
93typedef struct _EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL;\r
94\r
95\r
96/**\r
97 Enable access to an I2C bus configuration.\r
98\r
99 This routine must be called at or below TPL_NOTIFY. For synchronous\r
100 requests this routine must be called at or below TPL_CALLBACK.\r
101\r
102 Reconfigure the switches and multiplexers in the I2C bus to enable\r
103 access to a specific I2C bus configuration. Also select the maximum\r
104 clock frequency for this I2C bus configuration.\r
105\r
106 This routine uses the I2C Master protocol to perform I2C transactions\r
107 on the local bus. This eliminates any recursion in the I2C stack for\r
108 configuration transactions on the same I2C bus. This works because the\r
109 local I2C bus is idle while the I2C bus configuration is being enabled.\r
110\r
111 If I2C transactions must be performed on other I2C busses, then the\r
112 EFI_I2C_HOST_PROTOCOL, the EFI_I2C_IO_PROTCOL, or a third party I2C\r
113 driver interface for a specific device must be used. This requirement\r
114 is because the I2C host protocol controls the flow of requests to the\r
115 I2C controller. Use the EFI_I2C_HOST_PROTOCOL when the I2C device is\r
116 not enumerated by the EFI_I2C_ENUMERATE_PROTOCOL. Use a protocol\r
117 produced by a third party driver when it is available or the\r
118 EFI_I2C_IO_PROTOCOL when the third party driver is not available but\r
119 the device is enumerated with the EFI_I2C_ENUMERATE_PROTOCOL.\r
120\r
121 When Event is NULL, EnableI2cBusConfiguration operates synchronously\r
122 and returns the I2C completion status as its return value.\r
123\r
124 @param[in] This Pointer to an EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL\r
125 structure.\r
126 @param[in] I2cBusConfiguration Index of an I2C bus configuration. All\r
127 values in the range of zero to N-1 are\r
128 valid where N is the total number of I2C\r
129 bus configurations for an I2C bus.\r
130 @param[in] Event Event to signal when the transaction is complete\r
131 @param[out] I2cStatus Buffer to receive the transaction status.\r
132\r
133 @return When Event is NULL, EnableI2cBusConfiguration operates synchrouously\r
134 and returns the I2C completion status as its return value. In this case it is\r
135 recommended to use NULL for I2cStatus. The values returned from\r
136 EnableI2cBusConfiguration are:\r
137\r
138 @retval EFI_SUCCESS The asynchronous bus configuration request\r
139 was successfully started when Event is not\r
140 NULL.\r
141 @retval EFI_SUCCESS The bus configuration request completed\r
142 successfully when Event is NULL.\r
143 @retval EFI_DEVICE_ERROR The bus configuration failed.\r
144 @retval EFI_NO_MAPPING Invalid I2cBusConfiguration value\r
145\r
146**/\r
147typedef\r
148EFI_STATUS\r
149(EFIAPI *EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL_ENABLE_I2C_BUS_CONFIGURATION) (\r
150 IN CONST EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL *This,\r
151 IN UINTN I2cBusConfiguration,\r
152 IN EFI_EVENT Event OPTIONAL,\r
153 IN EFI_STATUS *I2cStatus OPTIONAL\r
154 );\r
155\r
156///\r
157/// I2C bus configuration management protocol\r
158///\r
159struct _EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL {\r
160 ///\r
161 /// Enable an I2C bus configuration for use.\r
162 ///\r
163 EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL_ENABLE_I2C_BUS_CONFIGURATION EnableI2cBusConfiguration;\r
164};\r
165\r
166///\r
167/// Reference to variable defined in the .DEC file\r
168///\r
169extern EFI_GUID gEfiI2cBusConfigurationManagementProtocolGuid;\r
170\r
171#endif // __I2C_BUS_CONFIGURATION_MANAGEMENT_H__\r