[Epic-ID: ODUHIGH-475][Task-ID: ODUHIGH-476]Integration fixes upto PRACH scheduling...
[o-du/l2.git] / src / mt / mt_ss.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /********************************************************************20**
20
21      Name:     MTSS -- implementation specific definitions
22
23      Type:     C include file
24
25      Desc:     Various macro definitions demanded by systems services.
26                The contents of these are for the MTSS implementation.
27
28      File:     mt_ss.h
29
30 *********************************************************************21*/
31
32
33 #ifndef __MTSSH__
34 #define __MTSSH__
35
36
37 /* --- interface to SS --- */
38
39 /* general */
40 #define SS_PROC_ID                      PID_STK(1)
41
42 /* task related */
43 /* mt028.201: addition: multiple procs support related changes */
44 #ifdef SS_MULTIPLE_PROCS
45 #define SS_MAX_PROCS                    100 /* max entries for proc list */
46 #endif /* SS_MULTIPLE_PROCS */
47
48 #define SS_MAX_ENT                      255
49 #define SS_MAX_INST                     8
50
51 /* mt028.201: modification: multiple procs support related changes */
52 #ifndef SS_MULTIPLE_PROCS
53 #define SS_MAX_TTSKS                    100
54
55 #ifndef SS_MULTICORE_SUPPORT
56 #define SS_MAX_STSKS                    7
57 #else
58 /* mt001.301 : Additions */
59 #ifdef  SPLIT_RLC_DL_TASK
60 #ifdef L2_L3_SPLIT
61 #define SS_MAX_STSKS                    4 
62 #else
63 #define SS_MAX_STSKS                    5 
64 #endif
65 #else 
66 #ifndef INTEL_WLS_MEM
67 #define SS_MAX_STSKS                    8
68 #else
69 #define SS_MAX_STSKS                    7 
70 #endif
71 #endif 
72 #endif /* SS_MULTICORE_SUPPORT */
73
74 #else /* SS_MULTIPLE_PROCS */
75 #define SS_MAX_TTSKS                    1000 
76 #define SS_MAX_STSKS                    7
77 #endif /* SS_MULTIPLE_PROCS */
78
79 #ifdef SS_DRVR_SUPPORT
80 #define SS_MAX_DRVRTSKS                 70
81 #endif
82
83 #ifdef SS_RTR_SUPPORT
84    /* mt0012.21 : Addition */
85 #define SS_MAX_RTRTSKS                  255
86 #endif
87
88
89 /* timer related */
90 #define SS_MAX_TMRS                     45
91
92 /* memory related */
93 /* mt022.201 - Modification for shared memory relay and memcal regions */
94 #ifdef SS_MULTICORE_SUPPORT
95 #define SS_MAX_REGS SS_MAX_STSKS
96 #else
97 #define SS_MAX_REGS  7
98 #endif
99
100 #ifdef CMM_MAX_BKT_ENT
101 #define SS_MAX_POOLS_PER_REG            CMM_MAX_BKT_ENT
102 #else
103 #define SS_MAX_POOLS_PER_REG            5
104 #endif
105 /* mt001.301 : Additions */
106 #ifdef SS_WATCHDOG
107 #define ENTDW                           0xcd
108 #define ENTHB                           0xce
109 #define INST0                           0x00
110 #define SS_TMR_HRTBT                    0x00
111 #define EVTSSHRTBTREQ                   0x00
112 #define EVTSSHRTBTRSP                   0x01
113 #define SS_LOOSE_COUPLING               0x00
114 #endif /* SS_WATCHDOG */
115
116 /* locks */
117 #define SS_STSKTBL_LOCK                 SS_LOCK_MUTEX
118 #define SS_STSKENTRY_LOCK               SS_LOCK_MUTEX
119 #define SS_TMRTBL_LOCK                  SS_LOCK_MUTEX
120 #define SS_DMNDQ_LOCK                   SS_LOCK_MUTEX
121 #define SS_DRVRENTRY_LOCK               SS_LOCK_MUTEX
122 #define SS_RTRENTRY_LOCK                SS_LOCK_MUTEX
123
124 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
125 #define MIPS_FILE "/sys/devices/virtual/mmonitor/mmonitor/mips_stat"
126 #define GET_CPU_MAX(x, y) ((x) >= (y) ? (x) : (y))
127 #define MIPS_STRING_LEN    24
128 #endif
129
130
131 /* types needed by common SSI code */
132 #define SsSemaId                        sem_t
133 #define SLockId                         pthread_mutex_t
134
135
136 /* calls needed by common SSI code */
137 #ifndef TENB_RTLIN_CHANGES
138 #define SInitLock(l, t)                 pthread_mutex_init(l, NULL)
139 #endif
140 /*uint32_t gt[128]; */
141 /*#define SLock(l)                        (((gt[0x000000FF
142  * &((uint32_t)pthread_self())]=MacGetTick())&&pthread_mutex_lock(l)&&MLogTask(30340, RESOURCE_LINL2, gt[0x000000FF
143  * &((uint32_t)pthread_self())], MacGetTick()))?0:0)*/
144 #define SLock(l)                        pthread_mutex_lock(l)
145 #define SUnlock(l)                      pthread_mutex_unlock(l)
146 #define SDestroyLock(l)                 pthread_mutex_destroy(l)
147
148 #define ssInitSema(s, c)                sem_init(s, 0, c)
149 #define ssWaitSema(s)                   sem_wait(s)
150 #define ssPostSema(s)                   sem_post(s)
151 #define ssDestroySema(s)                sem_destroy(s)
152
153 #define SS_CHECK_CUR_STSK(t)            (pthread_equal(pthread_self(), \
154                                           (t)->dep.tId))
155  /* mt013.21: Addition */
156 #define SInitSemaphore(s, c)            sem_init(s, 0, c)
157 #define SWaitSemaphore(s)               sem_wait(s)
158 #define SPostSemaphore(s)               sem_post(s)
159 #define SDestroySemaphore(s)            sem_destroy(s)
160
161 #define ssdPstTsk(p, m, t)
162
163 /* added SExit() for exiting process : mt017.21 */
164 /* mt001.301 : Additions */
165 #ifndef SS_LOGGER_SUPPORT
166 #define SExit()                         exit(0)
167 #else
168 #define SExit()  \
169 { \
170 SCleanUp(); \
171 exit(0); \
172 }
173 #endif /* SS_LOGGER_SUPPORT  */
174
175   /* mt007.21 addition */
176 /* calls needed by Message Functions */
177 #define SMemCpy(d,s,c)  memcpy(d,s,c)
178 #define SMemSet(s,c,n)  memset(s,c,n)
179 /* --- internal to MTSS-Solaris --- */
180
181
182 /*mt041.201 Value of MT_TICK_CNT changed*/
183 /*mt004.301- defining the MT_TICK_CNT in Micro seconds (usecs) */
184 /* mt010.301  Removed #ifdef SS_FAP portion and enabled oroginal code */
185 #define MT_TICK_CNT             (((uint32_t)0x0F4240)/SS_TICKS_SEC)
186
187 #define MT_MAX_TICK_CNT_VAL     35
188 #define MT_MIN_TICK_CNT_VAL     1
189
190
191 /* interrupt service flags */
192 #define MT_IS_SET               0
193 #define MT_IS_UNSET             1
194 #define MT_IS_RESET             2
195
196 /******************************************************************
197  mt018.201 - Memory Configuration.
198
199 Memory block sizes and counts for memory manager configuration
200 There is no restriction in the size of each block for the bucket.
201 However, it is recommended that the bucket size should be word aligned.
202 The CMM (Common Memory Manager) also create a look up table which map
203 the size to the bucket index.
204 The number of entry in the lookup table  (CMM_MAX_MAP_ENT, defined in
205 cm_mem.h) = ((maximum bucket size)/(bucket quantum size)) + 1.
206 The CMM_MAX_MAP_ENT should be changed depending on the bucket sizes
207 that are configured below.
208 *******************************************************************/
209
210 /* Bucket 0 configuration */
211 /* mt032.201 changed  MT_BKT_0_DSIZE from 120 to 128 for 64k compilation */
212 #define MT_BKT_0_DSIZE          256
213 /*mt004.301-changed for FAP*/
214 #ifndef SS_FAP
215 #ifdef XEON_SPECIFIC_CHANGES
216 #define MT_BKT_0_NUMBLKS        5248 /* 10500 Modified from 3500 to 10500 */
217 #else
218 #ifdef SS_USE_WLS_MEM
219 #define MT_BKT_0_NUMBLKS        200704 /* 10500 Modified from 3500 to 10500 */
220 #else
221 #define MT_BKT_0_NUMBLKS        10000 /* 10500 Modified from 3500 to 10500 */
222 #endif
223 #endif
224 #else
225 #define MT_BKT_0_NUMBLKS        10000
226 #endif
227
228 /* Bucket 1 configuration */
229 /*mt004.301-changed for FAP*/
230 #ifndef SS_FAP
231 #ifdef XEON_SPECIFIC_CHANGES
232 #define MT_BKT_1_DSIZE          1024  /* Modified from 256 to 4096 */
233 #else
234 #define MT_BKT_1_DSIZE          1280  /* Modified from 256 to 4096 */
235 #endif
236 #ifdef SS_USE_WLS_MEM
237 #define MT_BKT_1_NUMBLKS        310720 /* 1000*/
238 #else
239 #define MT_BKT_1_NUMBLKS        10496 /* 1000*/
240 #endif
241 #else
242 /*mt010.301*/
243 #define MT_BKT_1_DSIZE          256
244 #define MT_BKT_1_NUMBLKS        2000
245 #endif
246
247 /* Bucket 2 configuration */
248 /*mt010.301*/
249 #ifdef SS_FAP
250 #define MT_BKT_2_DSIZE      1376      /* Fill in this value as required */
251 #define MT_BKT_2_NUMBLKS    4000        /* Fill in this value as required */
252 #else
253 #ifdef XEON_SPECIFIC_CHANGES
254 #define MT_BKT_2_DSIZE   1768 /* 1664 2048 */
255 #define MT_BKT_2_NUMBLKS 5248 /* 10496 */
256 #else
257 #define MT_BKT_2_DSIZE   2048 /* 1664 2048 */
258 #define MT_BKT_2_NUMBLKS 2000 /* 10496 */
259 #endif
260 #endif
261
262
263 /* Bucket 3 configuration */
264 /*mt010.301*/
265 #ifdef SS_FAP
266 #define MT_BKT_3_DSIZE     2592      /* Fill in this value as required */
267 #define MT_BKT_3_NUMBLKS   1500     /* Fill in this value as required */
268 #else
269 #ifdef XEON_SPECIFIC_CHANGES
270 #define MT_BKT_3_DSIZE     4224      /* Fill in this value as required */
271 #define MT_BKT_3_NUMBLKS   5248 /*10496 */       /* Fill in this value as required */
272 #else
273 #define MT_BKT_3_DSIZE     12200      /* Fill in this value as required */
274 #define MT_BKT_3_NUMBLKS   1000 /*10496 */       /* Fill in this value as required */
275 #endif
276 #endif
277
278 #define MT_BKT_4_DSIZE   65000
279 #define MT_BKT_4_NUMBLKS 2000
280
281 /* For Non-Sharable regions/static regions */
282 #ifdef XEON_SPECIFIC_CHANGES
283 #define MT_BKT_0_STATIC_NUMBLKS   500000     /* Fill in this value as required */
284 #define MT_BKT_1_STATIC_NUMBLKS   500000     /* Fill in this value as required */
285 #define MT_BKT_2_STATIC_NUMBLKS   200000     /* Fill in this value as required */
286 #define MT_BKT_3_STATIC_NUMBLKS   40960     /* Fill in this value as required */
287 #define MT_BKT_4_STATIC_NUMBLKS   4096     /* Fill in this value as required */
288 #else
289 #define MT_BKT_0_STATIC_NUMBLKS   75000     /* Fill in this value as required */
290 #define MT_BKT_1_STATIC_NUMBLKS   15000     /* Fill in this value as required */
291 #define MT_BKT_2_STATIC_NUMBLKS   500     /* Fill in this value as required */
292 #define MT_BKT_3_STATIC_NUMBLKS   1600     /* Fill in this value as required */
293 #define MT_BKT_4_STATIC_NUMBLKS   1000     /* Fill in this value as required */
294 #endif
295 /*mt010.301*/
296 #ifdef RGL_SPECIFIC_CHANGES
297 #define MT_MAX_BKTS             5
298 #else
299 #define MT_MAX_BKTS             5
300 #endif
301
302 /* mt029.201 corrected typos */
303 /* memory pool data size definitions for pool-to-size mapping table */
304 #define MT_POOL_4_DSIZE        (MT_BKT_4_DSIZE-(sizeof(SsMblk)+sizeof(SsDblk)))
305 #define MT_POOL_3_DSIZE        (MT_BKT_3_DSIZE-(sizeof(SsMblk)+sizeof(SsDblk)))
306 #define MT_POOL_2_DSIZE        (MT_BKT_2_DSIZE-(sizeof(SsMblk)+sizeof(SsDblk)))
307 #define MT_POOL_1_DSIZE        (MT_BKT_1_DSIZE-(sizeof(SsMblk)+sizeof(SsDblk)))
308 #define MT_POOL_0_DSIZE        (MT_BKT_0_DSIZE-(sizeof(SsMblk)+sizeof(SsDblk)))
309
310
311
312 /* mt026.201 - Modification to increase default heap size */
313 /* memory size used for heap by the memory manager (2MB) */
314 /* mt001.301 : Additions */
315 /*mt004.301- changed heap size for FAP */
316 #ifdef SS_FAP
317 #define MT_HEAP_SIZE            5242880U
318 #else
319 #ifdef XEON_SPECIFIC_CHANGES
320 #define MT_HEAP_SIZE            6194304U
321 #else
322 #define MT_HEAP_SIZE            1004800U /*PAL FIX: 4MB to 6MB flexran */
323 #endif
324 #endif
325
326 #ifndef USE_MEMCAL
327 #define STATIC_MEM_CFG
328 #endif
329
330 /* mt022.201 - definition of MT_BKTQNSIZE */
331 /*mt010.301*/
332 #define MT_BKTQNSIZE 128
333
334
335 /* mt021.201 - Addition for setting stack size for threads */
336 /* Configuration for stack size (in bytes) of spawned threads
337  * Size of zero gives default of 1 MB or 2 MB for 32 bit or 64 bit
338  * compilers, respectively */
339 #define MT_TASK_STACK           NULLD   /* stack size for task handler */
340 #define MT_ISTASK_STACK         NULLD   /* stack size for IS task handler */
341 #define MT_TMRTASK_STACK        NULLD   /* stack size for timer handler */
342 #define MT_CONSOLE_STACK        NULLD   /* stack size for console handler */
343
344 /* mt001.301 : Additions Logger support */
345 #ifdef SS_LOGGER_SUPPORT
346 #ifndef SS_MAX_LOGBUF_SIZE
347 #define SS_MAX_LOGBUF_SIZE 8192
348 #endif
349 #ifndef SS_MAX_PATH
350 #define SS_MAX_PATH 1024
351 #endif
352 #endif /* SS_LOGGER_SUPPORT */
353 /* mt005.301: Cavium changes: */
354 #ifdef SS_SEUM_CAVIUM
355 /* Cavium related hashdefines */
356 #define SS_CVMX_GRP_MASK   (1 << osCp.procId)
357
358 #define SS_CVMX_NUM_PKT_BUFFERS   0
359 #define SS_CVMX_NUM_WQE_BUFFERS   100
360 #define SS_CVMX_NUM_PKO_BUFFERS   0
361 #define SS_CVMX_NUM_TIM_BUFFERS   1000
362 #define SS_CVMX_NUM_DFA_BUFFERS   0
363
364 /* fpa pool 0 configuration */
365 #define SS_CVMX_POOL_0_NUMBLKS        3000
366
367 /* fpa pool 1 configuration */
368 #define SS_CVMX_POOL_1_NUMBLKS        100
369
370 /* fpa pool 2 configuration */
371 #define SS_CVMX_POOL_2_NUMBLKS        10        /* Fill in this value as required */
372
373 /* fpa pool 3 configuration */
374 #define SS_CVMX_POOL_3_NUMBLKS        2500      /* Fill in this value as required */
375
376 #define SS_CVMX_TICK_TIME   1000  /* the value is in micorsec */
377 #define SS_CVMX_MAX_TICKS   1000
378 #define SS_CVMX_TICKS       500
379
380 #define SS_CVMX_TMR_TAG     1000
381 #define SS_CVMX_MBUF_TAG    1001
382 #endif /* SS_SEUM_CAVIUM */
383
384 /* mt011.301: Pool definition for both 64 bit and 32 bit Cavium */
385 #ifndef SS_CVMX_WQE_POOL
386 #ifdef BIT_64
387 #define SS_CVMX_WQE_POOL CVMX_FPA_WQE_POOL
388 #else
389 #define SS_CVMX_WQE_POOL SS_CVMX_POOL_0
390 #endif
391 #endif
392
393 #define WLS_MEM_SIZE  0x7ec00000 /* Total size of WLS memory configured */
394
395 #endif  /*  __MTSSH__  */
396
397
398 \f
399 /********************************************************************30**
400
401          End of file
402 **********************************************************************/