581fc661ea1a5c1c2d6397c9d00cb23d234d4c06
[coreboot.git] / src / southbridge / amd / cimx_wrapper / sb800 / cfg.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20
21 #ifndef _SB800_CFG_H_
22 #define _SB800_CFG_H_
23
24 #include <stdint.h>
25
26
27 /**
28  * @def BIOS_SIZE_1M
29  * @def BIOS_SIZE_2M
30  * @def BIOS_SIZE_4M
31  * @def BIOS_SIZE_8M
32  */
33 #define BIOS_SIZE_1M                    0
34 #define BIOS_SIZE_2M                    1
35 #define BIOS_SIZE_4M                    3
36 #define BIOS_SIZE_8M                    7
37
38 /* In SB800, default ROM size is 1M Bytes, if your platform ROM
39  * bigger than 1M you have to set the ROM size outside CIMx module and
40  * before AGESA module get call.
41  */
42 #ifndef BIOS_SIZE
43 #if CONFIG_COREBOOT_ROMSIZE_KB_1024 == 1
44   #define BIOS_SIZE BIOS_SIZE_1M
45 #elif CONFIG_COREBOOT_ROMSIZE_KB_2048 == 1
46   #define BIOS_SIZE BIOS_SIZE_2M
47 #elif CONFIG_COREBOOT_ROMSIZE_KB_4096 == 1
48   #define BIOS_SIZE BIOS_SIZE_4M
49 #elif CONFIG_COREBOOT_ROMSIZE_KB_8192 == 1
50   #define BIOS_SIZE BIOS_SIZE_8M
51 #endif
52 #endif
53
54 /**
55  * @def SPREAD_SPECTRUM
56  * @brief
57  *  0 - Disable Spread Spectrum function
58  *  1 - Enable  Spread Spectrum function
59  */
60 #define SPREAD_SPECTRUM                 0
61
62 /**
63  * @def SB_HPET_TIMER
64  * @breif
65  *  0 - Disable hpet
66  *  1 - Enable  hpet
67  */
68 #define HPET_TIMER                      1
69
70 /**
71  * @def USB_CONFIG
72  * @brief bit[0-6] used to control USB
73  *   0 - Disable
74  *   1 - Enable
75  *  Usb Ohci1 Contoller (Bus 0 Dev 18 Func0) is define at BIT0
76  *  Usb Ehci1 Contoller (Bus 0 Dev 18 Func2) is define at BIT1
77  *  Usb Ohci2 Contoller (Bus 0 Dev 19 Func0) is define at BIT2
78  *  Usb Ehci2 Contoller (Bus 0 Dev 19 Func2) is define at BIT3
79  *  Usb Ohci3 Contoller (Bus 0 Dev 22 Func0) is define at BIT4
80  *  Usb Ehci3 Contoller (Bus 0 Dev 22 Func2) is define at BIT5
81  *  Usb Ohci4 Contoller (Bus 0 Dev 20 Func5) is define at BIT6
82  */
83 #define USB_CINFIG              0x7F
84
85 /**
86  * @def PCI_CLOCK_CTRL
87  * @breif bit[0-4] used for PCI Slots Clock Control,
88  *   0 - disable
89  *   1 - enable
90  *  PCI SLOT 0 define at BIT0
91  *  PCI SLOT 1 define at BIT1
92  *  PCI SLOT 2 define at BIT2
93  *  PCI SLOT 3 define at BIT3
94  *  PCI SLOT 4 define at BIT4
95  */
96 #define PCI_CLOCK_CTRL                  0x1F
97
98 /**
99  * @def SATA_CONTROLLER
100  * @breif INCHIP Sata Controller
101  */
102 #ifndef SATA_CONTROLLER
103   #define SATA_CONTROLLER               CIMX_OPTION_ENABLED
104 #endif
105
106 /**
107  * @def SATA_MODE
108  * @breif INCHIP Sata Controller Mode
109  *   NOTE: DO NOT ALLOW SATA & IDE use same mode
110  */
111 #ifndef SATA_MODE
112   #define SATA_MODE                     AHCI_MODE
113 #endif
114
115 /**
116  * @breif INCHIP Sata IDE Controller Mode
117  */
118 #define IDE_LEGACY_MODE                 0
119 #define IDE_NATIVE_MODE                 1
120
121 /**
122  * @def SATA_IDE_MODE
123  * @breif INCHIP Sata IDE Controller Mode
124  *   NOTE: DO NOT ALLOW SATA & IDE use same mode
125  */
126 #ifndef SATA_IDE_MODE
127   #define SATA_IDE_MODE                 IDE_LEGACY_MODE
128 #endif
129
130 /**
131  * @def EXTERNAL_CLOCK
132  * @brief 00/10: Reference clock from crystal oscillator via
133  *  PAD_XTALI and PAD_XTALO
134  *
135  * @def INTERNAL_CLOCK
136  * @brief 01/11: Reference clock from internal clock through
137  *  CP_PLL_REFCLK_P and CP_PLL_REFCLK_N via RDL
138  */
139 #define EXTERNAL_CLOCK          0x00
140 #define INTERNAL_CLOCK          0x01
141
142 /* NOTE: inagua have to using internal clock,
143  * otherwise can not detect sata drive
144  */
145 #define SATA_CLOCK_SOURCE       INTERNAL_CLOCK
146
147 /**
148  * @def SATA_PORT_MULT_CAP_RESERVED
149  * @brief 1 ON, 0 0FF
150  */
151 #define SATA_PORT_MULT_CAP_RESERVED     1
152
153
154 /**
155  * @def   AZALIA_AUTO
156  * @brief Detect Azalia controller automatically.
157  *
158  * @def   AZALIA_DISABLE
159  * @brief Disable Azalia controller.
160
161  * @def   AZALIA_ENABLE
162  * @brief Enable Azalia controller.
163  */
164 #define AZALIA_AUTO                     0
165 #define AZALIA_DISABLE                  1
166 #define AZALIA_ENABLE                   2
167
168 /**
169  * @breif INCHIP HDA controller
170  */
171 #ifndef AZALIA_CONTROLLER
172   #define AZALIA_CONTROLLER             AZALIA_AUTO
173 #endif
174
175 /**
176  * @def AZALIA_PIN_CONFIG
177  * @brief
178  *  0 - disable
179  *  1 - enable
180  */
181 #ifndef AZALIA_PIN_CONFIG
182   #define AZALIA_PIN_CONFIG             1
183 #endif
184
185 /**
186  * @def AZALIA_SDIN_PIN
187  * @brief
188  *  SDIN0 is define at BIT0 & BIT1
189  *   00 - GPIO PIN
190  *   01 - Reserved
191  *   10 - As a Azalia SDIN pin
192  *  SDIN1 is define at BIT2 & BIT3
193  *  SDIN2 is define at BIT4 & BIT5
194  *  SDIN3 is define at BIT6 & BIT7
195  */
196 #ifndef AZALIA_SDIN_PIN
197   //#define AZALIA_SDIN_PIN             0xAA
198   #define AZALIA_SDIN_PIN               0x2A
199 #endif
200
201 /**
202  * @def GPP_CONTROLLER
203  */
204 #ifndef GPP_CONTROLLER
205   #define GPP_CONTROLLER                CIMX_OPTION_ENABLED
206 #endif
207
208 /**
209  * @def GPP_CFGMODE
210  * @brief GPP Link Configuration
211  * four possible configuration:
212  *  GPP_CFGMODE_X4000
213  *  GPP_CFGMODE_X2200
214  *  GPP_CFGMODE_X2110
215  *  GPP_CFGMODE_X1111
216  */
217 #ifndef GPP_CFGMODE
218   #define GPP_CFGMODE                   GPP_CFGMODE_X1111
219 #endif
220
221
222 /**
223  * @brief South Bridge CIMx configuration
224  *
225  */
226 void sb800_cimx_config(AMDSBCFG *sb_cfg);
227
228 /**
229  * @brief Entry point of Southbridge CIMx callout
230  *
231  * prototype UINT32 (*SBCIM_HOOK_ENTRY)(UINT32 Param1, UINT32 Param2, void* pConfig)
232  *
233  * @param[in] func    Southbridge CIMx Function ID.
234  * @param[in] data    Southbridge Input Data.
235  * @param[in] sb_cfg  Southbridge configuration structure pointer.
236  *
237  */
238 u32 sb800_callout_entry(u32 func, u32 data, void* sb_cfg);
239
240 #endif