Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:04

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup raspberrypi
0007  *
0008  * @brief Raspberry pi SMP management functions provided to SuperCore
0009  */
0010 
0011 /*
0012  * Copyright (c) 2016 Pavel Pisa <pisa@cmp.felk.cvut.cz>
0013  *
0014  * Czech Technical University in Prague
0015  * Zikova 1903/4
0016  * 166 36 Praha 6
0017  * Czech Republic
0018  *
0019  * Reuses some ideas from Rohini Kulkarni <krohini1593@gmail.com>
0020  * GSoC 2015 project and Altera Cyclone-V SMP code
0021  * by embedded brains GmbH & Co. KG
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 <rtems/score/cpu.h>
0046 
0047 #include <bsp/raspberrypi.h>
0048 #include <bsp/start.h>
0049 
0050 bool _CPU_SMP_Start_processor( uint32_t cpu_index )
0051 {
0052   BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE + 0x10 * cpu_index) = (uint32_t)_start;
0053   _ARM_Send_event();
0054 
0055   return true;
0056 }
0057 
0058 uint32_t _CPU_SMP_Initialize(void)
0059 {
0060   return 4;
0061 }
0062 
0063 void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
0064 {
0065   /* Do nothing */
0066 }
0067 
0068 void _CPU_SMP_Prepare_start_multitasking( void )
0069 {
0070   /* Do nothing */
0071 }
0072 
0073 void _CPU_SMP_Send_interrupt( uint32_t target_cpu_index )
0074 {
0075   /* Generates IPI */
0076   BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE +
0077       0x10 * target_cpu_index) = 0x1;
0078 }