1 | /* |
---|
2 | * This set of routines starts the application. It includes application, |
---|
3 | * board, and monitor specific initialization and configuration. |
---|
4 | * The generic CPU dependent initialization has been performed |
---|
5 | * before any of these are invoked. |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1989-2013. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * |
---|
10 | * Modified for LEON3 BSP. |
---|
11 | * COPYRIGHT (c) 2004. |
---|
12 | * Gaisler Research. |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.com/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #include <bsp.h> |
---|
20 | #include <leon.h> |
---|
21 | #include <rtems/bspIo.h> |
---|
22 | #include <bsp/bootcard.h> |
---|
23 | |
---|
24 | /* |
---|
25 | * Tells us if data cache snooping is available |
---|
26 | */ |
---|
27 | int CPU_SPARC_HAS_SNOOPING; |
---|
28 | |
---|
29 | /* Index of CPU, in an AMP system CPU-index may be non-zero */ |
---|
30 | uint32_t LEON3_Cpu_Index = 0; |
---|
31 | |
---|
32 | /* |
---|
33 | * set_snooping |
---|
34 | * |
---|
35 | * Read the data cache configuration register to determine if |
---|
36 | * bus snooping is available and enabled. This is needed for some |
---|
37 | * drivers so that they can select the most efficient copy routines. |
---|
38 | * |
---|
39 | */ |
---|
40 | |
---|
41 | static inline int set_snooping(void) |
---|
42 | { |
---|
43 | int tmp; |
---|
44 | __asm__ (" lda [%%g0] 2, %0 " |
---|
45 | : "=r"(tmp) |
---|
46 | : |
---|
47 | ); |
---|
48 | return (tmp >> 23) & 1; |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | * bsp_start |
---|
53 | * |
---|
54 | * This routine does the bulk of the system initialization. |
---|
55 | */ |
---|
56 | void bsp_start( void ) |
---|
57 | { |
---|
58 | CPU_SPARC_HAS_SNOOPING = set_snooping(); |
---|
59 | |
---|
60 | /* Get the LEON3 CPU index, normally 0, but for MP systems we do |
---|
61 | * _not_ assume that this is CPU0. One may run another OS on CPU0 |
---|
62 | * and RTEMS on this CPU, and AMP system with mixed operating |
---|
63 | * systems |
---|
64 | */ |
---|
65 | LEON3_Cpu_Index = _LEON3_Get_current_processor(); |
---|
66 | |
---|
67 | /* Scan AMBA Plug&Play and parse it into a RAM description (ambapp_plb), |
---|
68 | * find GPTIMER for bus frequency, find IRQ Controller and initialize |
---|
69 | * interrupt support |
---|
70 | */ |
---|
71 | amba_initialize(); |
---|
72 | leon3_cpu_counter_initialize(); |
---|
73 | |
---|
74 | /* find debug UART for printk() */ |
---|
75 | bsp_debug_uart_init(); |
---|
76 | } |
---|