mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-10-01 18:51:33 +02:00
x86: Add msr read/write functions that use a structure
It is convenient to be able to adjust MSRs with a structure that splits the two 32-bit halves into separate fields, as they are often dealt with separately. Add a few functions to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
3f70a6f577
commit
eddbad224b
@ -175,6 +175,25 @@ static inline int wrmsr_safe_regs(u32 regs[8])
|
|||||||
return native_wrmsr_safe_regs(regs);
|
return native_wrmsr_safe_regs(regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct msr_t {
|
||||||
|
uint32_t lo;
|
||||||
|
uint32_t hi;
|
||||||
|
} msr_t;
|
||||||
|
|
||||||
|
static inline struct msr_t msr_read(unsigned msr_num)
|
||||||
|
{
|
||||||
|
struct msr_t msr;
|
||||||
|
|
||||||
|
rdmsr(msr_num, msr.lo, msr.hi);
|
||||||
|
|
||||||
|
return msr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void msr_write(unsigned msr_num, msr_t msr)
|
||||||
|
{
|
||||||
|
wrmsr(msr_num, msr.lo, msr.hi);
|
||||||
|
}
|
||||||
|
|
||||||
#define rdtscl(low) \
|
#define rdtscl(low) \
|
||||||
((low) = (u32)__native_read_tsc())
|
((low) = (u32)__native_read_tsc())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user