diff --git a/repos/base-hw/include/spec/x86_64/port_io.h b/repos/base-hw/include/spec/x86_64/port_io.h index f756e564f3..5075448a14 100644 --- a/repos/base-hw/include/spec/x86_64/port_io.h +++ b/repos/base-hw/include/spec/x86_64/port_io.h @@ -17,6 +17,7 @@ #include namespace Hw { + using Genode::uint8_t; using Genode::uint16_t; diff --git a/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc b/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc index 740ef3c067..77aeec6e5b 100644 --- a/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc @@ -92,33 +92,32 @@ static uint32_t calibrate_tsc_frequency(addr_t fadt_addr) } -static void calibrate_lapic_frequency(addr_t fadt_addr, uint32_t &ticks_per_ms, uint32_t &div) +static Hw::Local_apic::Calibration calibrate_lapic_frequency(addr_t fadt_addr) { - uint32_t const default_ticks_per_ms = TIMER_MIN_TICKS_PER_MS; - uint32_t const sleep_ms = 10; + uint32_t const default_freq = TIMER_MIN_TICKS_PER_MS; if (!fadt_addr) { - warning("FADT not found, setting minimum Local APIC frequency of ", default_ticks_per_ms, "kHz"); - ticks_per_ms = default_ticks_per_ms; + warning("FADT not found, setting minimum Local APIC frequency of ", default_freq, "kHz"); + return { default_freq, 1 }; } + uint32_t const sleep_ms = 10; + Hw::Acpi_fadt fadt(reinterpret_cast(fadt_addr)); - Hw::Local_apic lapic(Hw::Cpu_memory_map::lapic_phys_base()); - ticks_per_ms = 0; + auto const result = + lapic.calibrate_divider([&] { + return fadt.calibrate_freq_khz(sleep_ms, [&] { + return lapic.read(); }, true); }); - lapic.calibrate_divider(ticks_per_ms, div, [&]() { - return fadt.calibrate_freq_khz(sleep_ms, [&]() { - return lapic.read();; - }, true); - }); - - if (!ticks_per_ms) { - warning("FADT not found, setting minimum Local APIC frequency of ", default_ticks_per_ms, "kHz"); - ticks_per_ms = default_ticks_per_ms; + if (!result.freq_khz) { + warning("FADT not found, setting minimum Local APIC frequency of ", default_freq, "kHz"); + return { default_freq, 1 }; } + + return result; } @@ -132,8 +131,6 @@ static void disable_pit() PIT_MODE = 0x43, }; - struct Calibration_failed : Genode::Exception { }; - /** * Disable PIT timer channel. This is necessary since BIOS sets up * channel 0 to fire periodically. @@ -328,8 +325,10 @@ Bootstrap::Platform::Board::Board() cpus = !cpus ? 1 : max_cpus; } - calibrate_lapic_frequency(info.acpi_fadt, info.lapic_ticks_per_ms, info.lapic_div); - info.tsc_freq_khz = calibrate_tsc_frequency(info.acpi_fadt); + auto r = calibrate_lapic_frequency(info.acpi_fadt); + info.lapic_freq_khz = r.freq_khz; + info.lapic_div = r.div; + info.tsc_freq_khz = calibrate_tsc_frequency(info.acpi_fadt); disable_pit(); diff --git a/repos/base-hw/src/core/spec/x86_64/timer.cc b/repos/base-hw/src/core/spec/x86_64/timer.cc index b9093fbfbc..100a6535a9 100644 --- a/repos/base-hw/src/core/spec/x86_64/timer.cc +++ b/repos/base-hw/src/core/spec/x86_64/timer.cc @@ -45,7 +45,7 @@ void Board::Timer::init() } Platform::apply_with_boot_info([&](auto const &boot_info) { - ticks_per_ms = boot_info.plat_info.lapic_ticks_per_ms; + ticks_per_ms = boot_info.plat_info.lapic_freq_khz; divider = boot_info.plat_info.lapic_div; }); } diff --git a/repos/base-hw/src/include/hw/spec/x86_64/apic.h b/repos/base-hw/src/include/hw/spec/x86_64/apic.h index 450104e204..8fb8f5c05d 100644 --- a/repos/base-hw/src/include/hw/spec/x86_64/apic.h +++ b/repos/base-hw/src/include/hw/spec/x86_64/apic.h @@ -84,27 +84,32 @@ struct Hw::Local_apic : Genode::Mmio }; }; - void calibrate_divider(uint32_t &ticks_per_ms, uint32_t ÷r, auto calibration_fn) + struct Calibration { uint32_t freq_khz; uint32_t div; }; + + Calibration calibrate_divider(auto calibration_fn) { + Calibration result { }; + /* calibrate LAPIC frequency to fullfill our requirements */ for (Divide_configuration::access_t div = Divide_configuration::Divide_value::MAX; - div && ticks_per_ms < TIMER_MIN_TICKS_PER_MS; div--) - { + div && result.freq_khz < TIMER_MIN_TICKS_PER_MS; div--) { + if (!div) { raw("Failed to calibrate Local APIC frequency"); - ticks_per_ms = 0; - break; + return { 0, 1 }; } write((uint8_t)div); write(~0U); /* Calculate timer frequency */ - ticks_per_ms = calibration_fn(); - divider = div; + result.freq_khz = calibration_fn(); + result.div = div; write(0); } + + return result; } Local_apic(addr_t const addr) : Mmio({(char*)addr, Mmio::SIZE}) {} diff --git a/repos/base-hw/src/include/hw/spec/x86_64/pc_board.h b/repos/base-hw/src/include/hw/spec/x86_64/pc_board.h index 356dbb7366..eb39a11c3f 100644 --- a/repos/base-hw/src/include/hw/spec/x86_64/pc_board.h +++ b/repos/base-hw/src/include/hw/spec/x86_64/pc_board.h @@ -45,8 +45,8 @@ struct Hw::Pc_board::Boot_info Genode::addr_t efi_system_table { 0 }; Genode::addr_t acpi_fadt { 0 }; Genode::uint32_t tsc_freq_khz { 0 }; - Genode::uint32_t lapic_ticks_per_ms { 0 }; - Genode::uint32_t lapic_div { 0 }; + Genode::uint32_t lapic_freq_khz { 0 }; + Genode::uint32_t lapic_div { 0 }; Boot_info() {} Boot_info(Acpi_rsdp const &acpi_rsdp, diff --git a/repos/dde_bsd/recipes/pkg/bsd_audio/hash b/repos/dde_bsd/recipes/pkg/bsd_audio/hash index eff2af41b1..60b199da6d 100644 --- a/repos/dde_bsd/recipes/pkg/bsd_audio/hash +++ b/repos/dde_bsd/recipes/pkg/bsd_audio/hash @@ -1 +1 @@ -2025-01-16 2cdd7e0cf9eab4981f58b89b33b9a106c3c2bd33 +2024-12-10 19af2857787095f29ff1156ca12921a84b8c2c88 diff --git a/repos/dde_bsd/recipes/src/bsd_audio/hash b/repos/dde_bsd/recipes/src/bsd_audio/hash index c14fa31213..14cbe64c8c 100644 --- a/repos/dde_bsd/recipes/src/bsd_audio/hash +++ b/repos/dde_bsd/recipes/src/bsd_audio/hash @@ -1 +1 @@ -2025-01-16 9f4e7fa4380d2eb941adb197daf5952916a71463 +2024-12-10 0cb59fb39e1ef2c557804fe74904f262e7cc990d diff --git a/repos/gems/recipes/pkg/dbg_download/hash b/repos/gems/recipes/pkg/dbg_download/hash index 8d2ae273ee..cc69c0ee3c 100644 --- a/repos/gems/recipes/pkg/dbg_download/hash +++ b/repos/gems/recipes/pkg/dbg_download/hash @@ -1 +1 @@ -2025-01-16 95ced46da790f7a009eb0522f132fe2335bce645 +2024-12-10 6cfb903adb9b3a37335b8a153735ea5f2add9479 diff --git a/repos/gems/recipes/pkg/motif_decorator/hash b/repos/gems/recipes/pkg/motif_decorator/hash index 69a55f6aec..8891bda06f 100644 --- a/repos/gems/recipes/pkg/motif_decorator/hash +++ b/repos/gems/recipes/pkg/motif_decorator/hash @@ -1 +1 @@ -2025-01-16 befac925d2cc4461c3fd3fe63877f05e338e80ce +2024-12-10 f6e7dcb77f24f2f69afe225449744ca3f78e94ac diff --git a/repos/gems/recipes/src/dbg_download/hash b/repos/gems/recipes/src/dbg_download/hash index c4bd0ba9e4..02e6264adb 100644 --- a/repos/gems/recipes/src/dbg_download/hash +++ b/repos/gems/recipes/src/dbg_download/hash @@ -1 +1 @@ -2025-01-16 a67c57084fc6a10686dc283c7479ef3c05065b5f +2024-12-10 11b1ec97e8ebc727801208d4d1c5c1066e7037ed diff --git a/repos/libports/recipes/pkg/acpica/hash b/repos/libports/recipes/pkg/acpica/hash index 05f9aec3a2..ab728d69a1 100644 --- a/repos/libports/recipes/pkg/acpica/hash +++ b/repos/libports/recipes/pkg/acpica/hash @@ -1 +1 @@ -2025-01-16 67e33ff7cf31a432bd8d93a0394ebc55199e888d +2024-12-10 121ec4ccd1bb65240ce5000ca49a48bf58bb74d8 diff --git a/repos/libports/recipes/pkg/mesa_gpu-intel/hash b/repos/libports/recipes/pkg/mesa_gpu-intel/hash index 8f546891e5..48528234ae 100644 --- a/repos/libports/recipes/pkg/mesa_gpu-intel/hash +++ b/repos/libports/recipes/pkg/mesa_gpu-intel/hash @@ -1 +1 @@ -2025-01-16 049b93c7a4e9bfd6b8637aab8f37f774bcf9a5dc +2024-12-10 fe0faac47649d3c25dfc42bb764f18802862def9 diff --git a/repos/libports/recipes/src/acpica/hash b/repos/libports/recipes/src/acpica/hash index 52f4e59620..32c81104da 100644 --- a/repos/libports/recipes/src/acpica/hash +++ b/repos/libports/recipes/src/acpica/hash @@ -1 +1 @@ -2025-01-16 3e48430b91da4cb566a1b6f7c3fec02a915a782d +2024-12-10 7fdaf553f171d5af35643f456d09af93f4167e69 diff --git a/repos/os/recipes/pkg/recall_fs/hash b/repos/os/recipes/pkg/recall_fs/hash index 80d50be210..9046b0fb6c 100644 --- a/repos/os/recipes/pkg/recall_fs/hash +++ b/repos/os/recipes/pkg/recall_fs/hash @@ -1 +1 @@ -2025-01-16 473ed002fe1d43c491db3c9730774d09e16f8b2a +2024-12-10 126809511e7c96a49bcc4109ccea98102afc9495 diff --git a/repos/os/recipes/pkg/record_play_mixer/hash b/repos/os/recipes/pkg/record_play_mixer/hash index a9a30adc4e..df66f4e79e 100644 --- a/repos/os/recipes/pkg/record_play_mixer/hash +++ b/repos/os/recipes/pkg/record_play_mixer/hash @@ -1 +1 @@ -2025-01-16 f21f3cbf85a383a0d03729c0aa0853815c8d67a1 +2024-12-10 855cac282025e574e9a9619bfc063dbd0fa3700d diff --git a/repos/os/recipes/src/record_play_mixer/hash b/repos/os/recipes/src/record_play_mixer/hash index 305e58735c..93367c0805 100644 --- a/repos/os/recipes/src/record_play_mixer/hash +++ b/repos/os/recipes/src/record_play_mixer/hash @@ -1 +1 @@ -2025-01-16 376e356fec3b8b0dd163d2f6408f8c9796618b7d +2024-12-10 f87120b971a2fe5732884f78ecd127c86eb6ce28