summaryrefslogtreecommitdiff
path: root/Board/IO/F81216/BSP/PeiIoTable.h
blob: 6ff6e8549448a937e124a60c111c250821099f6e (plain)
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
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (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/IO/Fintek/F81216_Sec/F81216 Board/PeiIoTable.h 4     1/19/12 3:07a Elviscai $
//
// $Revision: 4 $
//
// $Date: 1/19/12 3:07a $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/IO/Fintek/F81216_Sec/F81216 Board/PeiIoTable.h $
// 
// 4     1/19/12 3:07a Elviscai
// [TAG]  		EIPNONE
// [Category]  	Bug Fix
// [Severity]  	Important
// [Symptom]  	Base 0x200 generic IO decode fail
// [RootCause]  	1ST IO OemIoDecode will take 0x200 as GamePort
// [Solution]  	Change Com port IoDecodeBase from 0x200 to 0x240.
// 
// 3     7/04/11 3:23a Kasalinyi
// [Category]  	Improvement
// [Description]  	Update to new template
// [Files]  		OemIoDecode.c
// PeiIoTable.h
// DxeIoTable.h
// BSP.cif
// 
// 2     10/28/10 2:34a Mikes
// Change configure key with a token
// 
// 1     3/31/10 5:56a Fantasylai
// Initial release to F81216 just as a second IO

//*************************************************************************
//<AMI_FHDR_START>
//
// Name:    PeiIoTable.H
//
// Description: 
//  SIO init table in PEI phase. Any customers have to review below tables 
//  for themselves platform and make sure each initialization is necessary.
//
// Notes:
//
//<AMI_FHDR_END>
//*************************************************************************
#ifndef _PEIIoTable_H
#define _PEIIoTable_H
#ifdef __cplusplus
extern "C" {
#endif

//-------------------------------------------------------------------------
// Include Files
//-------------------------------------------------------------------------

//-------------------------------------------------------------------------
// Constants, Macros and Type Definitions
//-------------------------------------------------------------------------
typedef struct _IO_DECODE_DATA{
    UINT16          BaseAdd;
    //!!!Attention!!!If type is 0xFF, UID is a IO legth
    UINT8           UID;
    SIO_DEV_TYPE    Type;
} IO_DECODE_DATA;

typedef struct _SIO_DATA{
    UINT16           Addr;
    //AND mask value, 0xFF means register don't need AndMask and 
    //only write OrData8 to regisrer.
    UINT8           DataMask; 
    //OR mask value.  
    UINT8           DataValue;
} SIO_DATA;

// SIO DECODE list creation code must be in this order
typedef EFI_STATUS (IO_RANGE_DECODE)(
    IN  void            *LpcPciIo,
    IN  UINT16          DevBase, 
    IN  UINT8           UID, 
    IN  SIO_DEV_TYPE    Type
); 

//-------------------------------------------------------------------------
//Variable, Prototype, and External Declarations
//-------------------------------------------------------------------------

//<AMI_THDR_START>
//-------------------------------------------------------------------------
//
// Name:        F81216SEC_Decode_Table
//
// Description: 
//  Table filled with SIO IO resource to decode. It is used 
//  for PEI IO Decode function. For example:
//  1. Decode Index/data port
//  2. Decode KBC,FDC IO for recovery
//  3. Decode COM port for debug
//  4. Decode total IO base for runtime, pme, acpi, etc...
//  5. Decode more com ports wirh "generic IO range decode"
//
// Notes:
//  Attention! Cann't open 3F6(it was used by IDE controller.)
//
//-------------------------------------------------------------------------
//<AMI_THDR_END>
IO_DECODE_DATA F81216SEC_Decode_Table[]={
    // -----------------------------
    //|  BaseAdd | UID  | Type | 
    // -----------------------------
    {F81216SEC_CONFIG_INDEX, 2, 0xFF},

    // !!!!Attention!!!!This is necessary
    //OEM_TODO//OEM_TODO//OEM_TODO//OEM_TODO
    {0x240, 0x40, 0xFF}, // 0x200~0x27f , open a IODecode section for UART1,2,3,4
    // Add more OEM IO decode below.
};

//<AMI_THDR_START>
//-------------------------------------------------------------------------
//
// Name:        F81216SEC_PEI_Init_Table
//
// Description: Table filled with SIO logical devices' register value. 
//              Only do the necessary initialization. For example:
//              1. Program clock and multi-pin setting in global registers
//              2. Program KBC,FDC IO for recovery
//              3. Program COM port for debug
//
// Notes:
//
//-------------------------------------------------------------------------
//<AMI_THDR_END>
SIO_DATA F81216SEC_PEI_Init_Table[] = {
    // -----------------------------
    //|  Addr | DataMask  | DataValue | 
    // -----------------------------

    //---------------------------------------------------------------------
    // Enter Configuration Mode.
    //---------------------------------------------------------------------
    //AMI_TODO: 
    {F81216SEC_CONFIG_INDEX, 0xFF, F81216SEC_CONFIG_MODE_ENTER_VALUE},
    {F81216SEC_CONFIG_INDEX, 0xFF, F81216SEC_CONFIG_MODE_ENTER_VALUE},
    //---------------------------------------------------------------------
    // Before init all logical devices, program Global register if needed.
    //---------------------------------------------------------------------
    // Program clock setting in global registers
    // Bit0: 0/1 for CLKIN is 48Mhz/24MHz .
    {F81216SEC_CONFIG_INDEX, 0xFF, 0x25},
    {F81216SEC_CONFIG_DATA,  0xFE, 0x00 | F81216SEC_CLOCK},

    //---------------------------------------------------------------------
    // Initialize the Serial Port for debug useage. Default is COMA
    //---------------------------------------------------------------------
    //if first io have no comport debug,open it
/*
    #if defined(EFI_DEBUG) || (defined(Recovery_SUPPORT) && (SERIAL_RECOVERY_SUPPORT))
    #if (F81216SEC_SERIAL_PORT0_PRESENT)
    // Select device
    {F81216SEC_CONFIG_INDEX, 0xFF, F81216SEC_LDN_SEL_REGISTER},
    {F81216SEC_CONFIG_DATA,  0xFF, F81216SEC_LDN_UART0},
    // Program Base Addr 
    {F81216SEC_CONFIG_INDEX, 0xFF, F81216SEC_BASE1_LO_REGISTER},
    {F81216SEC_CONFIG_DATA,  0xFF ,0x60},
    {F81216SEC_CONFIG_INDEX, 0xFF, F81216SEC_BASE1_HI_REGISTER},
    {F81216SEC_CONFIG_DATA,  0xFF, 0x02},
    // Activate Device
    {F81216SEC_CONFIG_INDEX, 0xFF, F81216SEC_ACTIVATE_REGISTER},
    {F81216SEC_CONFIG_DATA,  0xFF, F81216SEC_ACTIVATE_VALUE},
    #endif // F81216SEC_SERIAL_PORT1_PRESENT
    #endif // #ifdef EFI_DEBUG
*/
    //---------------------------------------------------------------------
    // Disable non-used devices
    //---------------------------------------------------------------------

//--------------------------------------------------------------------------
// After init all logical devices, program Global register if needed.
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// After init all logical devices,  Exit Configuration Mode.
//--------------------------------------------------------------------------
    {F81216SEC_CONFIG_INDEX, 0xFF, 0xAA},

};

/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif //_PEIIoTable_H
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************