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

Last change on this file since 1c060681 was 1c060681, checked in by pranav <dangipranav@…>, on 08/09/21 at 11:13:22

bsps/raspberrypi: Add SEV Instruction for RPi SMP firmware changes.

The Pi firmware added a wfe(wait for event), the cores 1-3 wait
for the start address being written to the mailbox register, followed
by a SEV poke to the mailbox that acts as a wfe wake-up event.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup raspberrypi
5 *
6 * @brief Raspberry pi SMP management functions provided to SuperCore
7 */
8
9/*
10 * Copyright (c) 2016 Pavel Pisa <pisa@cmp.felk.cvut.cz>
11 *
12 * Czech Technical University in Prague
13 * Zikova 1903/4
14 * 166 36 Praha 6
15 * Czech Republic
16 *
17 * Reuses some ideas from Rohini Kulkarni <krohini1593@gmail.com>
18 * GSoC 2015 project and Altera Cyclone-V SMP code
19 * by embedded brains GmbH
20 *
21 * The license and distribution terms for this file may be
22 * found in the file LICENSE in this distribution or at
23 * http://www.rtems.org/license/LICENSE.
24 */
25
26#include <rtems/score/smpimpl.h>
27
28#include <bsp/start.h>
29#include <bsp/raspberrypi.h>
30#include <bsp.h>
31#include <bsp/arm-cp15-start.h>
32#include <libcpu/arm-cp15.h>
33#include <rtems.h>
34#include <bsp/irq-generic.h>
35#include <assert.h>
36
37bool _CPU_SMP_Start_processor( uint32_t cpu_index )
38{
39  bool started;
40  uint32_t cpu_index_self = _SMP_Get_current_processor();
41
42  if (cpu_index != cpu_index_self) {
43
44    BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE + 0x10 * cpu_index) = (uint32_t)_start;
45    _ARM_Send_event();
46
47    /*
48     * Wait for secondary processor to complete its basic initialization so
49     * that we can enable the unified L2 cache.
50     */
51    started = _Per_CPU_State_wait_for_non_initial_state(cpu_index, 0);
52  } else {
53    started = false;
54  }
55
56  return started;
57}
58
59uint32_t _CPU_SMP_Initialize(void)
60{
61  return 4;
62}
63
64void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
65{
66  /* Do nothing */
67}
68
69void _CPU_SMP_Prepare_start_multitasking( void )
70{
71  /* Do nothing */
72}
73
74void _CPU_SMP_Send_interrupt( uint32_t target_cpu_index )
75{
76  /* Generates IPI */
77  BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE +
78      0x10 * target_cpu_index) = 0x1;
79}
Note: See TracBrowser for help on using the repository browser.