From: miod Date: Thu, 18 Aug 2022 06:31:36 +0000 (+0000) Subject: Move recomputation of hz and stathz from glk to glkclk, lets a kernel with X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=42bd7a9f6a51a36846ca0f6c7a27ba424f6a93a3;p=openbsd Move recomputation of hz and stathz from glk to glkclk, lets a kernel with glkclk disabled keep correct values of those. NFC --- diff --git a/sys/arch/loongson/dev/glx.c b/sys/arch/loongson/dev/glx.c index 86bfb2868d9..e44dc3bd374 100644 --- a/sys/arch/loongson/dev/glx.c +++ b/sys/arch/loongson/dev/glx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glx.c,v 1.11 2020/10/20 15:59:17 cheloha Exp $ */ +/* $OpenBSD: glx.c,v 1.12 2022/08/18 06:31:36 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -120,13 +120,6 @@ glx_init(pci_chipset_tag_t pc, pcitag_t tag, int dev) msr |= 4 << 24; msr |= 3 << 28; wrmsr(PIC_YSEL_HIGH, msr); - - /* - * MFGPT runs on powers of two, adjust the hz value accordingly. - */ - stathz = hz = 128; - tick = 1000000 / hz; - tick_nsec = 1000000000 / hz; } uint64_t diff --git a/sys/arch/loongson/dev/glxclk.c b/sys/arch/loongson/dev/glxclk.c index c2f1c41ff6c..72a08410c84 100644 --- a/sys/arch/loongson/dev/glxclk.c +++ b/sys/arch/loongson/dev/glxclk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glxclk.c,v 1.6 2022/04/06 18:59:26 naddy Exp $ */ +/* $OpenBSD: glxclk.c,v 1.7 2022/08/18 06:31:36 miod Exp $ */ /* * Copyright (c) 2013 Paul Irofti. @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -130,6 +130,13 @@ glxclk_attach(struct device *parent, struct device *self, void *aux) return; } + /* + * MFGPT runs on powers of two, adjust the hz value accordingly. + */ + stathz = hz = 128; + tick = 1000000 / hz; + tick_nsec = 1000000000 / hz; + printf(": clock"); /* Set comparator 2 */