summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/include
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-10-24 00:56:34 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-10-24 00:56:34 +0000
commitf49ca6f94b347cf641ddb24f4813ca8aafdf9307 (patch)
tree0f8f275459bdae3f330c9a83d2f3ce39213d7553 /sys/arch/amd64/include
parent946e46b6c2f1c41722f9f8f6fa5c11774fc328e2 (diff)
tsc: AMD Family 17h, 19h: compute frequency from Core::X86::Msr:PStateDef
Compute the TSC frequency on AMD family 17h and 19h CPUs using the PStateDef MSRs. Link 1: https://marc.info/?l=openbsd-tech&m=166394236029484&w=2 Link 2: https://marc.info/?l=openbsd-tech&m=166446065916283&w=2 Test list: https://marc.info/?l=openbsd-tech&m=166646389821326&w=2 Reviewed by kettenis@ using the AMD documents cited in the comments. Maybe reviewed by mlarkin@? I can't remember. He seemed supportive of the idea at least. ok kettenis@
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r--sys/arch/amd64/include/specialreg.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/amd64/include/specialreg.h b/sys/arch/amd64/include/specialreg.h
index e7bc30f27b7..cbde6cf9b02 100644
--- a/sys/arch/amd64/include/specialreg.h
+++ b/sys/arch/amd64/include/specialreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: specialreg.h,v 1.94 2022/08/30 17:09:21 dv Exp $ */
+/* $OpenBSD: specialreg.h,v 1.95 2022/10/24 00:56:33 cheloha Exp $ */
/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */
/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */
@@ -540,6 +540,10 @@
*/
#define MSR_HWCR 0xc0010015
#define HWCR_FFDIS 0x00000040
+#define HWCR_TSCFREQSEL 0x01000000
+
+#define MSR_PSTATEDEF(_n) (0xc0010064 + (_n))
+#define PSTATEDEF_EN 0x8000000000000000ULL
#define MSR_NB_CFG 0xc001001f
#define NB_CFG_DISIOREQLOCK 0x0000000000000004ULL