lkml.org 
[lkml]   [2009]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 14/21] amd64_edac: add msr accessors operating on all cpus
Date
From: Doug Thompson <dougthompson@xmission.com>

Signed-off-by: Doug Thompson <dougthompson@xmission.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
drivers/edac/amd64_edac.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index ac4e265..49c0ce0 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -3121,4 +3121,46 @@ static struct pci_dev *pci_get_related_function(unsigned int vendor,
return dev;
}

+/* stolen from msr.c - the calls in msr.c could be exported */
+struct msr_command {
+ int cpu;
+ int err;
+ u32 reg;
+ u32 data[2];
+};
+
+static void smp_wrmsr(void *cmd_block)
+{
+ struct msr_command *cmd = cmd_block;
+ wrmsr(cmd->reg, cmd->data[0], cmd->data[1]);
+}
+
+static void smp_rdmsr(void *cmd_block)
+{
+ struct msr_command *cmd = cmd_block;
+ rdmsr(cmd->reg, cmd->data[0], cmd->data[1]);
+}
+
+static void do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
+{
+ struct msr_command cmd;
+
+ cmd.cpu = raw_smp_processor_id();
+ cmd.reg = reg;
+ cmd.data[0] = eax;
+ cmd.data[1] = edx;
+ on_each_cpu(smp_wrmsr, &cmd, 1);
+}
+
+static void do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
+{
+ struct msr_command cmd;
+
+ cmd.cpu = raw_smp_processor_id();
+ cmd.reg = reg;
+ on_each_cpu(smp_rdmsr, &cmd, 1);
+ *eax = cmd.data[0];
+ *edx = cmd.data[1];
+}
+

--
1.6.2.4



\
 
 \ /
  Last update: 2009-04-28 17:17    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site