From 5352dc72322ef20069415c701f9d33341165f686 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Wed, 27 Jan 2010 05:35:03 +0000 Subject: disable interrupts in rdmsr() and wrmsr() so that their operation does not risk being interrupted. --- sys/arch/loongson/dev/glx.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sys/arch/loongson') diff --git a/sys/arch/loongson/dev/glx.c b/sys/arch/loongson/dev/glx.c index ac56891fbce..215153d0bd4 100644 --- a/sys/arch/loongson/dev/glx.c +++ b/sys/arch/loongson/dev/glx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glx.c,v 1.1 2009/12/25 22:11:08 miod Exp $ */ +/* $OpenBSD: glx.c,v 1.2 2010/01/27 05:35:02 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -112,25 +112,36 @@ uint64_t rdmsr(uint msr) { uint64_t lo, hi; + uint32_t sr; +#ifdef DIAGNOSTIC if (glxbase_tag == 0) panic("rdmsr invoked before glx initialization"); +#endif + sr = disableintr(); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_ADDR, msr); lo = (uint32_t)pci_conf_read(glxbase_pc, glxbase_tag, PCI_MSR_LO32); hi = (uint32_t)pci_conf_read(glxbase_pc, glxbase_tag, PCI_MSR_HI32); + setsr(sr); return (hi << 32) | lo; } void wrmsr(uint msr, uint64_t value) { + uint32_t sr; + +#ifdef DIAGNOSTIC if (glxbase_tag == 0) - panic("rdmsr invoked before glx initialization"); + panic("wrmsr invoked before glx initialization"); +#endif + sr = disableintr(); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_ADDR, msr); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_LO32, (uint32_t)value); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_HI32, value >> 32); + setsr(sr); } int -- cgit v1.2.3