fix: 🐛 Put BOOT_CORE_ID const in platform config
This commit is contained in:
parent
8c3b7d3d0f
commit
bb38addd83
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
use {
|
use {
|
||||||
super::endless_sleep,
|
super::endless_sleep,
|
||||||
|
crate::platform::cpu::BOOT_CORE_ID,
|
||||||
aarch64_cpu::{asm, registers::*},
|
aarch64_cpu::{asm, registers::*},
|
||||||
core::{
|
core::{
|
||||||
cell::UnsafeCell,
|
cell::UnsafeCell,
|
||||||
|
@ -54,8 +55,6 @@ macro_rules! entry {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[link_section = ".text.main.entry"]
|
#[link_section = ".text.main.entry"]
|
||||||
pub unsafe extern "C" fn _boot_cores() -> ! {
|
pub unsafe extern "C" fn _boot_cores() -> ! {
|
||||||
const CORE_0: u64 = 0;
|
|
||||||
const CORE_MASK: u64 = 0x3;
|
|
||||||
// Can't match values with dots in match, so use intermediate consts.
|
// Can't match values with dots in match, so use intermediate consts.
|
||||||
#[cfg(qemu)]
|
#[cfg(qemu)]
|
||||||
const EL3: u64 = CurrentEL::EL::EL3.value;
|
const EL3: u64 = CurrentEL::EL::EL3.value;
|
||||||
|
@ -72,7 +71,7 @@ pub unsafe extern "C" fn _boot_cores() -> ! {
|
||||||
|
|
||||||
shared_setup_and_enter_pre();
|
shared_setup_and_enter_pre();
|
||||||
|
|
||||||
if CORE_0 == MPIDR_EL1.get() & CORE_MASK {
|
if BOOT_CORE_ID == super::smp::core_id() {
|
||||||
match CurrentEL.get() {
|
match CurrentEL.get() {
|
||||||
#[cfg(qemu)]
|
#[cfg(qemu)]
|
||||||
EL3 => setup_and_enter_el1_from_el3(),
|
EL3 => setup_and_enter_el1_from_el3(),
|
||||||
|
|
|
@ -1 +1,7 @@
|
||||||
pub fn core_id() {}
|
#[inline(always)]
|
||||||
|
pub fn core_id() -> u64 {
|
||||||
|
use aarch64_cpu::registers::{Readable, MPIDR_EL1};
|
||||||
|
|
||||||
|
const CORE_MASK: u64 = 0x3;
|
||||||
|
MPIDR_EL1.get() & CORE_MASK
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
pub const BOOT_CORE_ID: u64 = 0;
|
|
@ -80,8 +80,8 @@ mod gicc;
|
||||||
mod gicd;
|
mod gicd;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bsp::{self, device_driver::common::BoundedUsize},
|
bsp::{self, cpu::BOOT_CORE_ID, device_driver::common::BoundedUsize},
|
||||||
cpu, driver, exception,
|
cpu, drivers, exception,
|
||||||
synchronization::{self, InitStateLock},
|
synchronization::{self, InitStateLock},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ impl driver::interface::DeviceDriver for GICv2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn init(&self) -> Result<(), &'static str> {
|
unsafe fn init(&self) -> Result<(), &'static str> {
|
||||||
if bsp::cpu::BOOT_CORE_ID == cpu::smp::core_id() {
|
if BOOT_CORE_ID == cpu::smp::core_id() {
|
||||||
self.gicd.boot_core_init();
|
self.gicd.boot_core_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
pub mod cpu;
|
||||||
pub mod device_driver;
|
pub mod device_driver;
|
||||||
pub mod display;
|
pub mod display;
|
||||||
pub mod drivers;
|
pub mod drivers;
|
||||||
|
|
Loading…
Reference in New Issue