Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9151 → Rev 9152

/drivers/sensors/amd_nb.c
14,8 → 14,8
#include <linux/spinlock.h>
#include <linux/pci_ids.h>
#include <asm/amd_nb.h>
#include <asm/msr.h>
 
 
#define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450
#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0
#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480
535,8 → 535,8
static void __fix_erratum_688(void *info)
{
#define MSR_AMD64_IC_CFG 0xC0011021
// msr_set_bit(MSR_AMD64_IC_CFG, 3);
// msr_set_bit(MSR_AMD64_IC_CFG, 14);
e_msr_set_bit(MSR_AMD64_IC_CFG, 3);
e_msr_set_bit(MSR_AMD64_IC_CFG, 14);
}
 
/* Apply erratum 688 fix so machines without a BIOS fix work. */
/drivers/sensors/e_msr.c
0,0 → 1,61
#include <ddk.h>
 
#define U64_C(x) x ## ULL
#define BIT_64(n) (U64_C(1) << (n))
 
struct e_msr {
union {
struct {
u32 l;
u32 h;
};
u64 q;
};
};
 
static void _msr_read(u32 msr, struct e_msr *m)
{
__asm__ __volatile__(
"rdmsr"
:"=a"(m->l), "=d"(m->h)
:"c"(msr)
:"memory"
);
}
static void _msr_write(u32 msr, struct e_msr *m)
{
__asm__ __volatile__(
"wrmsr"
::"a"(m->l), "d"(m->h), "c"(msr)
:"memory"
);
}
 
static int __flip_bit(u32 msr, u8 bit, bool set)
{
struct e_msr m, m1;
if (bit > 63)
return EINVAL;
_msr_read(msr, &m);
 
m1 = m;
 
if (set)
m1.q |= BIT_64(bit);
else
m1.q &= ~BIT_64(bit);
 
if (m1.q == m.q)
return 0;
 
_msr_write(msr, &m1);
return 1;
}
 
 
int e_msr_set_bit(u32 msr, u8 bit)
{
return __flip_bit(msr, bit, true);
}
/drivers/sensors/k10temp/Makefile
28,7 → 28,7
--major-subsystem-version 0 --minor-subsystem-version 5 --subsystem native \
--image-base 0 --file-alignment 512 --section-alignment 4096
 
OBJS = k10temp.o ../pci.o ../amd_nb.o ../cpu_detect.o
OBJS = k10temp.o ../pci.o ../amd_nb.o ../cpu_detect.o ../e_msr.o
 
all: $(OBJS) $(NAME).sys
 
/drivers/sensors/k10temp/Tupfile.lua
13,7 → 13,7
LIBS = " -lddk -lcore -lgcc "
 
compile_gcc{
"k10temp.c", "../pci.c", "../amd_nb.c", "../cpu_detect.c"
"k10temp.c", "../pci.c", "../amd_nb.c", "../cpu_detect.c", "../e_msr.c"
}
 
OBJS.extra_inputs = {"../../ddk/libcore.a", "../../ddk/libddk.a"}