![]() |
|
|||
File indexing completed on 2025-05-11 08:24:08
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @ingroup RTEMSBSPsSPARCLEON3 0007 * 0008 * @brief This source file contains the implementation of bsp_start() and 0009 * definitions of BSP-specific objects. 0010 */ 0011 0012 /* 0013 * COPYRIGHT (c) 2011 0014 * Aeroflex Gaisler 0015 * 0016 * COPYRIGHT (c) 1989-2013. 0017 * On-Line Applications Research Corporation (OAR). 0018 * 0019 * Modified for LEON3 BSP. 0020 * COPYRIGHT (c) 2004. 0021 * Gaisler Research. 0022 * 0023 * Redistribution and use in source and binary forms, with or without 0024 * modification, are permitted provided that the following conditions 0025 * are met: 0026 * 1. Redistributions of source code must retain the above copyright 0027 * notice, this list of conditions and the following disclaimer. 0028 * 2. Redistributions in binary form must reproduce the above copyright 0029 * notice, this list of conditions and the following disclaimer in the 0030 * documentation and/or other materials provided with the distribution. 0031 * 0032 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0033 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0034 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0035 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0036 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0037 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0038 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0039 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0040 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0041 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0042 * POSSIBILITY OF SUCH DAMAGE. 0043 */ 0044 0045 #include <bsp.h> 0046 #include <bsp/irq-generic.h> 0047 #include <bsp/leon3.h> 0048 #include <bsp/bootcard.h> 0049 #include <rtems/sysinit.h> 0050 0051 #if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING) 0052 /* Irq used by shared memory driver and for inter-processor interrupts. 0053 * Can be overridden by being defined in the application. 0054 */ 0055 const unsigned char LEON3_mp_irq __attribute__((weak)) = 14; 0056 #endif 0057 0058 /* 0059 * Tells us if data cache snooping is available 0060 */ 0061 int CPU_SPARC_HAS_SNOOPING; 0062 0063 /* Index of CPU, in an AMP system CPU-index may be non-zero */ 0064 uint32_t LEON3_Cpu_Index = 0; 0065 0066 /* 0067 * set_snooping 0068 * 0069 * Read the cache control register to determine if 0070 * bus snooping is available and enabled. This is needed for some 0071 * drivers so that they can select the most efficient copy routines. 0072 * 0073 */ 0074 0075 static inline int set_snooping(void) 0076 { 0077 return (leon3_get_cache_control_register() >> 23) & 1; 0078 } 0079 0080 /* 0081 * bsp_start 0082 * 0083 * This routine does the bulk of the system initialization. 0084 */ 0085 void bsp_start( void ) 0086 { 0087 CPU_SPARC_HAS_SNOOPING = set_snooping(); 0088 0089 #ifndef RTEMS_DRVMGR_STARTUP 0090 bsp_interrupt_initialize(); 0091 #endif 0092 } 0093 0094 static void leon3_cpu_index_init(void) 0095 { 0096 /* Get the LEON3 CPU index, normally 0, but for MP systems we do 0097 * _not_ assume that this is CPU0. One may run another OS on CPU0 0098 * and RTEMS on this CPU, and AMP system with mixed operating 0099 * systems 0100 */ 0101 LEON3_Cpu_Index = _LEON3_Get_current_processor(); 0102 } 0103 0104 RTEMS_SYSINIT_ITEM( 0105 leon3_cpu_index_init, 0106 RTEMS_SYSINIT_BSP_START, 0107 RTEMS_SYSINIT_ORDER_FIRST 0108 ); 0109 0110 /* 0111 * Initialize shared interrupt handling, must be done after IRQ controller has 0112 * been found and initialized. 0113 */ 0114 #ifdef RTEMS_DRVMGR_STARTUP 0115 RTEMS_SYSINIT_ITEM( 0116 bsp_interrupt_initialize, 0117 RTEMS_SYSINIT_DRVMGR_LEVEL_1, 0118 RTEMS_SYSINIT_ORDER_LAST_BUT_5 0119 ); 0120 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |