1 /*++
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 
24 **/
25 
26 #ifndef __I2C_ACPI_H__
27 #define __I2C_ACPI_H__
28 
29 #include <Protocol/DevicePath.h>
30 
31 //
32 // I2C ACPI protocol
33 //
34 typedef struct _EFI_I2C_ACPI_PROTOCOL   EFI_I2C_ACPI_PROTOCOL;
35 
36 //
37 // I2C device description
38 //
39 // This structure provides the platform specific information which
40 // describes an I2C device.
41 //
42 typedef struct {
43   //
44   // Hardware revision - ACPI _HRV value
45   //
46   UINT32 HardwareRevision;
47 
48   //
49   // Device path node for the I2C device.
50   //
51   CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
52 
53   //
54   // I2C bus configuration for the I2C device.
55   //
56   UINT32 I2cBusConfiguration;
57 
58   //
59   // Number of slave addresses for the I2C device.
60   //
61   UINT32 SlaveAddressCount;
62 
63   //
64   // Address of the array of slave addresses for the I2C device.
65   //
66   CONST UINT32 *SlaveAddressArray;
67 }EFI_I2C_DEVICE;
68 
69 
70 /**
71   Enumerate the I2C devices
72 
73   This routine must be called at or below TPL_NOTIFY.
74 
75   This function walks the platform specific data to enumerates the
76   I2C devices on an I2C bus.
77 
78   @param[in]  This              Address of an EFI_I2C_ENUM_PROTOCOL
79                                 structure.
80   @param[in, out] Device        Buffer containing the address of an
81                                 EFI_I2C_DEVICE structure.  Enumeration
82                                 is started by setting the initial
83                                 EFI_I2C_DEVICE structure address to NULL.
84                                 The buffer receives an EFI_I2C_DEVICE
85                                 structure address for the next I2C device.
86 
87   @retval EFI_SUCCESS           The platform data for the next device
88                                 on the I2C bus was returned successfully.
89   @retval EFI_INVALID_PARAMETER NextDevice was NULL
90   @retval EFI_NO_MAPPING        PreviousDevice does not point to a valid
91                                 EFI_I2C_DEVICE structure.
92 
93 **/
94 typedef
95 EFI_STATUS
96 (EFIAPI *EFI_I2C_ACPI_ENUMERATE) (
97   IN CONST EFI_I2C_ACPI_PROTOCOL *This,
98   IN OUT CONST EFI_I2C_DEVICE **Device
99   );
100 
101 //
102 // I2C device description
103 //
104 // This structure provides the platform specific information which
105 // describes an I2C device.
106 //
107 struct _EFI_I2C_ACPI_PROTOCOL {
108   //
109   // Walk the platform's list of I2C devices on the bus.  This
110   // routine returns the next I2C device in the platform's list
111   // for this I2C bus.
112   //
113   EFI_I2C_ACPI_ENUMERATE Enumerate;
114 };
115 
116 //
117 // Variable containing the GUID for the I2C device enumeration protocol
118 //
119 extern EFI_GUID gEfiI2cAcpiProtocolGuid;
120 
121 #endif  //  __I2C_ACPI_H__
122