system/riscv64: Use dtb-based time cv for system_time

* Fixes speedy-system_time in qemu

Change-Id: I07ae4d984c09f2f2503bd45acc415c219f3b3f11
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5327
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Alexander von Gluck IV 2022-05-20 16:32:07 -05:00 committed by waddlesplash
parent 6c675bab59
commit f8ef244100
3 changed files with 1 additions and 16 deletions

View File

@ -59,12 +59,11 @@ arch_cpu_init(kernel_args *args)
cpu->cache_id[i] = -1;
}
/*
uint64 conversionFactor
= (1LL << 32) * 1000000LL / args->arch_args.timerFrequency;
__riscv64_setup_system_time(conversionFactor);
*/
return B_OK;
}

View File

@ -15,15 +15,12 @@
status_t
arch_rtc_init(kernel_args *args, struct real_time_data *data)
{
/*
data->arch_data.system_time_conversion_factor
= (1LL << 32) * 1000000LL / args->arch_args.timerFrequency;
dprintf("timerFrequency: %" B_PRIu64 "\n",
args->arch_args.timerFrequency);
dprintf("system_time_conversion_factor: %" B_PRIu64 "\n",
data->arch_data.system_time_conversion_factor);
*/
return B_OK;
}

View File

@ -31,17 +31,6 @@ __riscv64_setup_system_time(uint64 cv)
[[gnu::optimize("omit-frame-pointer")]] bigtime_t
system_time()
{
// TODO: Timer unit conversion needs fixed here
// QEMU and SiFive boards use diferent timer frequencies
return CpuTime();
/*
uint64 time = CpuTime();
uint64 lo = (uint32)time;
uint64 hi = time >> 32;
return ((lo * cv_factor) >> 32) + hi * cv_factor;
*/
/*
__uint128_t time = static_cast<__uint128_t>(CpuTime()) * cv_factor;
return time >> 32;
*/
}