source: rtems/bsps/arm/raspberrypi/start/bspsmp.c @ f6e9e89

Last change on this file since f6e9e89 was f6e9e89, checked in by Joel Sherrill <joel@…>, on 06/27/22 at 13:48:48

bsps/arm/raspberrypi: Change license to BSD-2

Updates #3053.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup raspberrypi
7 *
8 * @brief Raspberry pi SMP management functions provided to SuperCore
9 */
10
11/*
12 * Copyright (c) 2016 Pavel Pisa <pisa@cmp.felk.cvut.cz>
13 *
14 * Czech Technical University in Prague
15 * Zikova 1903/4
16 * 166 36 Praha 6
17 * Czech Republic
18 *
19 * Reuses some ideas from Rohini Kulkarni <krohini1593@gmail.com>
20 * GSoC 2015 project and Altera Cyclone-V SMP code
21 * by embedded brains GmbH
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the above copyright
27 *    notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 *    notice, this list of conditions and the following disclaimer in the
30 *    documentation and/or other materials provided with the distribution.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
36 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGE.
43 */
44
45#include <rtems/score/smpimpl.h>
46
47#include <bsp/start.h>
48#include <bsp/raspberrypi.h>
49#include <bsp.h>
50#include <bsp/arm-cp15-start.h>
51#include <libcpu/arm-cp15.h>
52#include <rtems.h>
53#include <bsp/irq-generic.h>
54#include <assert.h>
55
56bool _CPU_SMP_Start_processor( uint32_t cpu_index )
57{
58  bool started;
59  uint32_t cpu_index_self = _SMP_Get_current_processor();
60
61  if (cpu_index != cpu_index_self) {
62
63    BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE + 0x10 * cpu_index) = (uint32_t)_start;
64    _ARM_Send_event();
65
66    /*
67     * Wait for secondary processor to complete its basic initialization so
68     * that we can enable the unified L2 cache.
69     */
70    started = _Per_CPU_State_wait_for_non_initial_state(cpu_index, 0);
71  } else {
72    started = false;
73  }
74
75  return started;
76}
77
78uint32_t _CPU_SMP_Initialize(void)
79{
80  return 4;
81}
82
83void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
84{
85  /* Do nothing */
86}
87
88void _CPU_SMP_Prepare_start_multitasking( void )
89{
90  /* Do nothing */
91}
92
93void _CPU_SMP_Send_interrupt( uint32_t target_cpu_index )
94{
95  /* Generates IPI */
96  BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE +
97      0x10 * target_cpu_index) = 0x1;
98}
Note: See TracBrowser for help on using the repository browser.