x86-64: fix ACPI init in Thinkpad E14g2

This commit is contained in:
Mark Poliakov 2023-09-02 18:15:41 +03:00
parent b00670ea77
commit 3b89f444ff
5 changed files with 14 additions and 12 deletions

View File

@ -227,7 +227,7 @@ impl IoApic {
/// Creates an I/O APIC instance from its ACPI definition /// Creates an I/O APIC instance from its ACPI definition
pub fn from_acpi(info: &AcpiApic<AcpiAllocator>) -> Result<Self, Error> { pub fn from_acpi(info: &AcpiApic<AcpiAllocator>) -> Result<Self, Error> {
if info.io_apics.len() != 1 { if info.io_apics.len() != 1 {
todo!(); warnln!("The system has multiple I/O APICs, but the kernel only knows how to use one");
} }
let ioapic = info.io_apics.first().unwrap(); let ioapic = info.io_apics.first().unwrap();

View File

@ -25,8 +25,8 @@ use super::smp::CPU_COUNT;
// use super::ARCHITECTURE; // use super::ARCHITECTURE;
const BOOT_STACK_SIZE: usize = 256 * 1024; const BOOT_STACK_SIZE: usize = 1024 * 1024;
const HEAP_PAGES: usize = 256; const HEAP_PAGES: usize = 512;
#[repr(C, align(0x20))] #[repr(C, align(0x20))]
struct BootStack { struct BootStack {

View File

@ -138,14 +138,6 @@ impl Inner {
// Will give an interrupt interval of 1ms // Will give an interrupt interval of 1ms
let tim0_period = FS_IN_MS / clk_period; let tim0_period = FS_IN_MS / clk_period;
// if tim0_period > 0x100000000
// && !tim0
// .ConfigurationCapability
// .matches_all(TimerConfigurationCapablities::TM_SIZE_CAP::Timer64Bit)
// {
// panic!("Period is too large and timer doesn't support 64-bit");
// }
// Enable the main counter // Enable the main counter
regs.GeneralConfiguration regs.GeneralConfiguration
.modify(GeneralConfiguration::ENABLE_CNF::SET); .modify(GeneralConfiguration::ENABLE_CNF::SET);
@ -196,6 +188,14 @@ impl Device for Hpet {
let tim0 = &inner.regs.Timers[0]; let tim0 = &inner.regs.Timers[0];
if inner.tim0_period > 0x100000000
&& !tim0
.ConfigurationCapability
.matches_all(TimerConfigurationCapablities::TM_SIZE_CAP::Timer64Bit)
{
panic!("Period is too large and timer doesn't support 64-bit");
}
// Temporarily disable the main counter // Temporarily disable the main counter
inner inner
.regs .regs

View File

@ -16,7 +16,7 @@ use crate::{
task::tasklet::TaskFlow, task::tasklet::TaskFlow,
}; };
const CONSOLE_ROW_LEN: usize = 128; const CONSOLE_ROW_LEN: usize = 80;
const MAX_CSI_ARGS: usize = 8; const MAX_CSI_ARGS: usize = 8;
const DEFAULT_FG_COLOR: ColorAttribute = ColorAttribute::White; const DEFAULT_FG_COLOR: ColorAttribute = ColorAttribute::White;

View File

@ -49,6 +49,8 @@ fn panic_handler(pi: &core::panic::PanicInfo) -> ! {
static PANIC_HAPPENED: AtomicBool = AtomicBool::new(false); static PANIC_HAPPENED: AtomicBool = AtomicBool::new(false);
infoln!("{:?}", pi);
if PANIC_HAPPENED if PANIC_HAPPENED
.compare_exchange(false, true, Ordering::Release, Ordering::Acquire) .compare_exchange(false, true, Ordering::Release, Ordering::Acquire)
.is_ok() .is_ok()