summaryrefslogtreecommitdiffstats
path: root/src/occ_405/ssx_app_cfg.h
blob: 97e959d774930530cd25f89a6179f1dd14f4b60d (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
220
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/occ_405/ssx_app_cfg.h $                                   */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015                             */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __SSX_APP_CFG_H__
#define __SSX_APP_CFG_H__
//-----------------------------------------------------------------------------
// *! (C) Copyright International Business Machines Corp. 2014
// *! All Rights Reserved -- Property of IBM
// *! *** IBM Confidential ***
//-----------------------------------------------------------------------------

/// \file ssx_app_cfg.h
/// \brief Application specific overrides go here.
///

#include "global_app_cfg.h"

// These versions of SSX_PANIC are being changed so that they exactly
// mirror each other and are exactly structured at 8 instructions only and
// make only one branch to outside code.
#ifndef __ASSEMBLER__
#ifndef SSX_PANIC
#define SSX_PANIC(code)                                             \
do {                                                                \
    barrier();                                                      \
    asm volatile ("stw  %r3, __occ_panic_save_r3@sda21(0)");        \
    asm volatile ("mflr %r3");                                      \
    asm volatile ("stw  %r4, __occ_panic_save_r4@sda21(0)");        \
    asm volatile ("lis  %%r4, %0"::"i" (code >> 16));               \
    asm volatile ("ori  %%r4, %%r4, %0"::"i" (code & 0xffff));      \
    asm volatile ("bl   __ssx_checkpoint_panic_and_save_ffdc");     \
    asm volatile ("trap");                                          \
    asm volatile (".long %0" : : "i" (code));                       \
} while (0)
#endif // SSX_PANIC
#else  /* __ASSEMBLER__ */
#ifndef SSX_PANIC
// This macro cannot be more than 8 instructions long, but it can be less than
// 8.
#define SSX_PANIC(code) _ssx_panic code
    .macro  _ssx_panic, code
    stw     %r3, __occ_panic_save_r3@sda21(0)
    mflr    %r3
    stw     %r4, __occ_panic_save_r4@sda21(0)
    lis     %r4, \code@h
    ori     %r4, %r4, \code@l
    bl      __ssx_checkpoint_panic_and_save_ffdc
    trap
    .long   \code
    .endm
#endif // SSX_PANIC
#endif /* __ASSEMBLER__ */

/// Static configuration data for external interrupts:
///
/// IRQ#, TYPE, POLARITY, ENABLE
///
#define APPCFG_EXT_IRQS_CONFIG \
    OCCHW_IRQ_CHECK_STOP_PPC405         OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_EXTERNAL_TRAP             OCCHW_IRQ_TYPE_LEVEL    OCCHW_IRQ_POLARITY_HI       OCCHW_IRQ_MASKED \
    OCCHW_IRQ_OCC_TIMER0                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_OCC_TIMER1                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_IPI4_HI_PRIORITY          OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_PBAX_OCC_SEND             OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_PBAX_OCC_PUSH0            OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_PBAX_OCC_PUSH1            OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_PBA_BCDE_ATTN             OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_PBA_BCUE_ATTN             OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM0_PULL                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM0_PUSH                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM1_PULL                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM1_PUSH                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM2_PULL                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM2_PUSH                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM3_PULL                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_STRM3_PUSH                OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \
    OCCHW_IRQ_IPI4_LO_PRIORITY          OCCHW_IRQ_TYPE_EDGE     OCCHW_IRQ_POLARITY_RISING   OCCHW_IRQ_MASKED \

/// The Instance ID of the occ processor that this application is intended to run on
/// 0-3 -> GPE, 4 -> 405
#define APPCFG_OCC_INSTANCE_ID 4


#define PROC_DEBUG 1
// Common configuration groups for verification. Bypass time-consuming setup
// or setup done by procedures for simulation environments, and set up special
// I/O configurations for simulation environments.

#ifndef VERIFICATION
#define VERIFICATION 0
#endif

#ifndef OCC_UNIT_VERIFICATION
#define OCC_UNIT_VERIFICATION 0
#endif

#ifndef EPM_VERIFICATION
#define EPM_VERIFICATION 0
#endif

#ifndef VBU_VERIFICATION
#define VBU_VERIFICATION 0
#endif

#ifndef LAB_VALIDATION
#define LAB_VALIDATION 0
#endif

#if VERIFICATION || LAB_VALIDATION

#if !LAB_VALIDATION
#define SSX_STACK_CHECK    0
#endif

#define SIMICS_ENVIRONMENT 0

#else

#define INITIALIZE_PBA_SLAVES 1
#define INITIALIZE_PBA_BARS 1

#endif  /* VERIFICATION */


#if OCC_UNIT_VERIFICATION
#define USE_RTX_IO 1
#endif

#if EPM_VERIFICATION
#define USE_EPM_IO 1
#endif

// VBU and the lab use trace buffer I/O.  The DBCR0 is left untouched so VBU
// can use instruction/data breakpoints.

#if VBU_VERIFICATION || LAB_VALIDATION
#define USE_TRACE_IO 1
#define NO_INIT_DBCR0 1
#endif

// Default initializations for validation that affect SSX and library code

#ifndef SIMICS_ENVIRONMENT
#define SIMICS_ENVIRONMENT 1
#pragma message "Building for Simics!"
#endif

#ifndef USE_SIMICS_IO
#define USE_SIMICS_IO 1
#endif

#ifndef USE_RTX_IO
#define USE_RTX_IO 0
#endif

#ifndef USE_TRACE_IO
#define USE_TRACE_IO 0
#endif

#ifndef USE_EPM_IO
#define USE_EPM_IO 0
#endif

#if SIMICS_ENVIRONMENT
#define PPC405_MMU_SUPPORT 0
#endif

/// The buffer used for 'ssxout' in VBU and lab applications
///
/// The buffer is defined to be quite large in order to accomodate full kernel
/// and application dumps in the event of problems.
#ifndef SSXOUT_TRACE_BUFFER_SIZE
#define SSXOUT_TRACE_BUFFER_SIZE (32 * 1024)
#endif

#ifndef APPCFG_USE_EXT_TIMEBASE_FOR_TRACE
#define APPCFG_USE_EXT_TIMEBASE_FOR_TRACE 1
#endif

#ifndef PPC405_TIMEBASE_HZ
#define PPC405_TIMEBASE_HZ  600000000
#endif

//If we are using the external timebase for traces, assume it is 37500000 Hz.
//Otherwise, it will use the PPC405 timebase.
#if APPCFG_USE_EXT_TIMEBASE_FOR_TRACE
#define SSX_TRACE_TIMEBASE_HZ   37500000
#else
#define SSX_TRACE_TIMEBASE_HZ PPC405_TIMEBASE_HZ
#endif /* APPCFG_USE_EXT_TIMEBASE_FOR_TRACE */

#if SSX_USE_INIT_SECTION
#define INIT_SEC_NM_STR     "initSection"
#define INIT_SECTION __attribute__ ((section (INIT_SEC_NM_STR)))
#else
#define INIT_SECTION
#endif

#endif /*__SSX_APP_CFG_H__*/
OpenPOWER on IntegriCloud