824057ad058e116a05c3631ae3e4bfd3f7eca694
[coreboot.git] / src / northbridge / amd / cimx / rd890 / NbPlatform.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2012 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 #ifndef _NB_PLATFORM_H_
21 #define _NB_PLATFORM_H_
22
23 #define SERIAL_OUT_SUPPORT //enable serial output
24 #define CIMX_DEBUG
25
26 #ifdef  CIMX_DEBUG
27 #define CIMX_TRACE_SUPPORT
28 #define CIMX_ASSERT_SUPPORT
29 #endif
30
31 #ifdef  CIMX_TRACE_SUPPORT
32         #define CIMX_INIT_TRACE(Arguments)
33         #if CONFIG_REDIRECT_NBCIMX_TRACE_TO_SERIAL
34                 #define TRACE_DATA(Ptr, Level) BIOS_DEBUG //always enable
35                 #define CIMX_TRACE(Argument) do {do_printk Argument;} while (0)
36         #else
37                 #define TRACE_DATA(Ptr, Level)
38                 #define CIMX_TRACE(Argument)
39         #endif
40 #else
41         #define CIMX_TRACE(Argument)
42         #define CIMX_INIT_TRACE(Arguments)
43 #endif
44
45 #ifdef CIMX_ASSERT_SUPPORT
46         #ifdef ASSERT
47                 #undef ASSERT
48                 #define ASSERT CIMX_ASSERT
49         #endif
50         #ifdef CIMX_TRACE_SUPPORT
51                 #define CIMX_ASSERT(x)  if(!(x)) {\
52                         LibAmdTraceDebug (CIMX_TRACE_ALL, (CHAR8 *)"ASSERT !!! "__FILE__" - line %d\n", __LINE__); \
53                         /*__asm {jmp $}; */\
54                 }
55         //#define IDS_HDT_CONSOLE(s, args...) do_printk(BIOS_DEBUG, s, ##args)
56         #else
57                 #define CIMX_ASSERT(x) if(!(x)) {\
58                         /*__asm {jmp $}; */\
59                 }
60         #endif
61 #else
62         #define CIMX_ASSERT(x)
63 #endif
64
65 /*----------------------------------------------------------------------------------------
66  *                          E X P O R T E D    F U N C T I O N S
67  *----------------------------------------------------------------------------------------
68  */
69
70 //#define STALL(Ptr, TimeUs, Flag) LibAmdSbStall(TimeUs)
71 #define STALL(Ptr, TimeUs, Flag) LibAmdSbStall(TimeUs, Ptr)
72
73 #ifdef  B2_IMAGE
74 #define REPORT_EVENT(Class, Info, Param1, Param2, Param3, Param4, CfgPtr) LibNbEventLog(Class, Info, Param1, Param2, Param3, Param4, CfgPtr)
75 #else
76 #define REPORT_EVENT(Class, Info, Param1, Param2, Param3, Param4, CfgPtr)
77 #endif
78
79
80
81 // CIMX configuration parameters
82 //#define CIMX_B2_IMAGE_BASE_ADDRESS      0xFFF40000
83 /**
84  * PCIEX_BASE_ADDRESS - Define PCIE base address
85  *
86  * @param[Option]     MOVE_PCIEBAR_TO_F0000000 Set PCIe base address to 0xF7000000
87  */
88 #ifdef  MOVE_PCIEBAR_TO_F0000000
89 #define PCIEX_BASE_ADDRESS           0xF7000000
90 #else
91 #define PCIEX_BASE_ADDRESS           CONFIG_MMCONF_BASE_ADDRESS
92 #endif
93
94
95
96 #define CIMX_S3_SAVE 1
97 #include "cbtypes.h"
98 #include <console/console.h>
99
100 #include "amd.h" //cimx typedef
101 #include <amdlib.h>
102 #include "amdAcpiLib.h"
103 #include "amdAcpiMadt.h"
104 #include "amdAcpiIvrs.h"
105 #include "amdSbLib.h"
106 #include "nbPcie.h"
107
108 //must put before the nbType.h
109 #include "platform_cfg.h" /*platform dependented configuration */
110 #include "nbType.h"
111
112 #include "nbLib.h"
113 #include "nbDef.h"
114 #include "nbInit.h"
115 #include "nbHtInit.h"
116 #include "nbIommu.h"
117 #include "nbEventLog.h"
118 #include "nbRegisters.h"
119 #include "nbPcieAspm.h"
120 #include "nbPcieLinkWidth.h"
121 #include "nbPcieHotplug.h"
122 #include "nbPciePortRemap.h"
123 #include "nbPcieWorkarounds.h"
124 #include "nbPcieCplBuffers.h"
125 #include "nbPciePllControl.h"
126 #include "nbMiscInit.h"
127 #include "nbIoApic.h"
128 #include "nbPcieSb.h"
129 #include "nbRecovery.h"
130 #include "nbMaskedMemoryInit.h"
131
132
133 #define FIX_PTR_ADDR(x, y) x
134
135 #define TRACE_ALWAYS  0xffffffff
136
137 #define AmdNbDispatcher NULL
138
139 #define CIMX_TRACE_ALL    0xFFFFFFFF
140 #define CIMX_NBPOR_TRACE  0xFFFFFFFF
141 #define CIMX_NBHT_TRACE   0xFFFFFFFF
142 #define CIMX_NBPCIE_TRACE 0xFFFFFFFF
143 #define CIMX_NB_TRACE     0xFFFFFFFF
144 #define CIMX_NBPCIE_MISC  0xFFFFFFFF
145
146 #endif
147