1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 1985-2011, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
//**********************************************************************
// $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/SmBus/SmBusCommon.h 1 6/06/12 8:00a Victortu $
//
// $Revision: 1 $
//
// $Date: 6/06/12 8:00a $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/SmBus/SmBusCommon.h $
//
// 1 6/06/12 8:00a Victortu
// Implement EFI_PEI_SMBUS2_PPI Support.
//
// 5 6/27/11 2:26p Artems
// Updated year in file header
//
// 4 6/17/11 5:52p Artems
// EIP 53378: Replaced tabs with spaces, formatted to follow coding
// standard
//
// 3 10/16/09 7:08p Artems
// Updated copyright header
//
// 2 1/28/09 6:52p Artems
// Modified in accordance with coding standard
//
// 1 1/09/09 6:53p Artems
// New implementation of SMBus EIP 16730
//
// 1 3/18/07 5:23p Felixp
//
//**********************************************************************
//<AMI_FHDR_START>
//----------------------------------------------------------------------
//
// Name: SmBusCommon.h
//
// Description: This file contains shared PEI and DXE Smbus functions and
// data structures definitions
//
//----------------------------------------------------------------------
//<AMI_FHDR_END>
#ifndef __SMBUS_COMMON__H__
#define __SMBUS_COMMON__H__
#ifdef __cplusplus
extern "C" {
#endif
#include <Efi.h>
#include <AmiCspLib.h>
#include <SmBus.h>
#define SMBUS_ADDRESS_ARP 0x61 // 1100 001 X SMBus Device Default Address
#define SMBUS_DATA_PREPARE_TO_ARP 0x01
#define SMBUS_DATA_RESET_DEVICE 0x02
#define SMBUS_DATA_GET_UDID_GENERAL 0x03
#define SMBUS_DATA_ASSIGN_ADDRESS 0x04
#define SMBUS_SPEC_RESERVED_ADDRESS 21
#define GET_UDID_BUFFER_SIZE 17
#define SMBUS_LOWEST_AVAILABLE_ADDRESS 0x08
#define SMBUS_HIGHEST_AVAILABLE_ADDRESS 0x77
typedef VOID (* SMBUS_WAIT ) (
IN UINTN Microseconds
);
//<AMI_THDR_START>
//----------------------------------------------------------------------------
// Name: SMBUS_PRIVATE
//
// Description: AMI SMBUS driver private data structure
//
// Fields: Name Type Description
//----------------------------------------------------------------------------
// SmBusBase UINT16 SMBUS device base IO address
// SmBusWait SMBUS_WAIT Pointer to Wait function
// MaxDevices UINT8 Maximum number of supported devices
// BoardReservedAddressCount UINT8 Number of board reserved addesses
// BoardReservedAddressList UINT8* Pointer to board reserved addresses list
// ArpDeviceCount UINT8 Number of current devices
// ArpDeviceList EFI_SMBUS_DEVICE_MAP* Pointer to list of current devices
//
//----------------------------------------------------------------------------
//<AMI_THDR_END>
typedef struct _SMBUS_PRIVATE
{
UINT16 SmBusBase;
SMBUS_WAIT SmBusWait;
UINT8 MaxDevices;
UINT8 BoardReservedAddressCount;
UINT8 *BoardReservedAddressList;
UINT8 ArpDeviceCount;
EFI_SMBUS_DEVICE_MAP *ArpDeviceList;
} SMBUS_PRIVATE;
//*******************************************************
// Shared functions prototypes
//*******************************************************
VOID SmBusRead (
IN UINT16 SmBusBase,
IN UINT16 Offset,
IN UINTN ByteCount,
OUT UINT8 *Buffer
);
VOID SmBusWrite (
IN UINT16 SmBusBase,
IN UINT16 Offset,
IN UINTN ByteCount,
IN UINT8 *Buffer
);
EFI_STATUS Execute (
IN SMBUS_PRIVATE *Context,
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
IN EFI_SMBUS_DEVICE_COMMAND Command,
IN EFI_SMBUS_OPERATION Operation,
IN BOOLEAN PecCheck,
IN OUT UINTN *Length,
IN OUT VOID *Buffer
);
EFI_STATUS CheckNotify (
IN SMBUS_PRIVATE *Context,
OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress,
OUT UINTN *Data
);
EFI_STATUS ArpDevice (
IN SMBUS_PRIVATE *Context,
IN BOOLEAN ArpAll,
IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
);
EFI_STATUS GetArpMap (
IN SMBUS_PRIVATE *Context,
IN OUT UINTN *Length,
IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
);
EFI_STATUS PrepareToArp (
IN SMBUS_PRIVATE *Context
);
EFI_STATUS ArpDeviceDirected (
IN SMBUS_PRIVATE *Context,
IN EFI_SMBUS_UDID *SmbusUdid,
IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
);
EFI_STATUS ArpDeviceFull (
IN SMBUS_PRIVATE *Context
);
EFI_STATUS AssignAddress (
IN SMBUS_PRIVATE *Context,
IN EFI_SMBUS_DEVICE_MAP *DeviceMap
);
EFI_STATUS GetUdidGeneral (
IN SMBUS_PRIVATE *Context,
OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
);
BOOLEAN IsAddressAvailable (
IN SMBUS_PRIVATE *Context,
IN UINT8 Address
);
UINT8 GetAvailableAddress (
IN SMBUS_PRIVATE *Context
);
VOID ConvertMapToBuffer (
IN EFI_SMBUS_DEVICE_MAP *DeviceMap,
OUT UINT8 *Buffer
);
VOID ConvertBufferToMap (
OUT EFI_SMBUS_DEVICE_MAP *DeviceMap,
IN UINT8 *Buffer
);
/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 1985-2011, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
|