TianoCore EDK2 master
Loading...
Searching...
No Matches
X86Msr.c
Go to the documentation of this file.
1
9#include "BaseLibInternals.h"
10
25UINT32
26EFIAPI
28 IN UINT32 Index
29 )
30{
31 return (UINT32)AsmReadMsr64 (Index);
32}
33
51UINT32
52EFIAPI
54 IN UINT32 Index,
55 IN UINT32 Value
56 )
57{
58 return (UINT32)AsmWriteMsr64 (Index, Value);
59}
60
80UINT32
81EFIAPI
83 IN UINT32 Index,
84 IN UINT32 OrData
85 )
86{
87 return (UINT32)AsmMsrOr64 (Index, OrData);
88}
89
109UINT32
110EFIAPI
112 IN UINT32 Index,
113 IN UINT32 AndData
114 )
115{
116 return (UINT32)AsmMsrAnd64 (Index, AndData);
117}
118
141UINT32
142EFIAPI
144 IN UINT32 Index,
145 IN UINT32 AndData,
146 IN UINT32 OrData
147 )
148{
149 return (UINT32)AsmMsrAndThenOr64 (Index, AndData, OrData);
150}
151
174UINT32
175EFIAPI
177 IN UINT32 Index,
178 IN UINTN StartBit,
179 IN UINTN EndBit
180 )
181{
182 return BitFieldRead32 (AsmReadMsr32 (Index), StartBit, EndBit);
183}
184
210UINT32
211EFIAPI
213 IN UINT32 Index,
214 IN UINTN StartBit,
215 IN UINTN EndBit,
216 IN UINT32 Value
217 )
218{
219 ASSERT (EndBit < sizeof (Value) * 8);
220 ASSERT (StartBit <= EndBit);
221 return (UINT32)AsmMsrBitFieldWrite64 (Index, StartBit, EndBit, Value);
222}
223
251UINT32
252EFIAPI
254 IN UINT32 Index,
255 IN UINTN StartBit,
256 IN UINTN EndBit,
257 IN UINT32 OrData
258 )
259{
260 ASSERT (EndBit < sizeof (OrData) * 8);
261 ASSERT (StartBit <= EndBit);
262 return (UINT32)AsmMsrBitFieldOr64 (Index, StartBit, EndBit, OrData);
263}
264
292UINT32
293EFIAPI
295 IN UINT32 Index,
296 IN UINTN StartBit,
297 IN UINTN EndBit,
298 IN UINT32 AndData
299 )
300{
301 ASSERT (EndBit < sizeof (AndData) * 8);
302 ASSERT (StartBit <= EndBit);
303 return (UINT32)AsmMsrBitFieldAnd64 (Index, StartBit, EndBit, AndData);
304}
305
337UINT32
338EFIAPI
340 IN UINT32 Index,
341 IN UINTN StartBit,
342 IN UINTN EndBit,
343 IN UINT32 AndData,
344 IN UINT32 OrData
345 )
346{
347 ASSERT (EndBit < sizeof (AndData) * 8);
348 ASSERT (StartBit <= EndBit);
349 return (UINT32)AsmMsrBitFieldAndThenOr64 (
350 Index,
351 StartBit,
352 EndBit,
353 AndData,
354 OrData
355 );
356}
357
376UINT64
377EFIAPI
379 IN UINT32 Index,
380 IN UINT64 OrData
381 )
382{
383 return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) | OrData);
384}
385
404UINT64
405EFIAPI
407 IN UINT32 Index,
408 IN UINT64 AndData
409 )
410{
411 return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) & AndData);
412}
413
435UINT64
436EFIAPI
438 IN UINT32 Index,
439 IN UINT64 AndData,
440 IN UINT64 OrData
441 )
442{
443 return AsmWriteMsr64 (Index, (AsmReadMsr64 (Index) & AndData) | OrData);
444}
445
468UINT64
469EFIAPI
471 IN UINT32 Index,
472 IN UINTN StartBit,
473 IN UINTN EndBit
474 )
475{
476 return BitFieldRead64 (AsmReadMsr64 (Index), StartBit, EndBit);
477}
478
503UINT64
504EFIAPI
506 IN UINT32 Index,
507 IN UINTN StartBit,
508 IN UINTN EndBit,
509 IN UINT64 Value
510 )
511{
512 return AsmWriteMsr64 (
513 Index,
514 BitFieldWrite64 (AsmReadMsr64 (Index), StartBit, EndBit, Value)
515 );
516}
517
545UINT64
546EFIAPI
548 IN UINT32 Index,
549 IN UINTN StartBit,
550 IN UINTN EndBit,
551 IN UINT64 OrData
552 )
553{
554 return AsmWriteMsr64 (
555 Index,
556 BitFieldOr64 (AsmReadMsr64 (Index), StartBit, EndBit, OrData)
557 );
558}
559
587UINT64
588EFIAPI
590 IN UINT32 Index,
591 IN UINTN StartBit,
592 IN UINTN EndBit,
593 IN UINT64 AndData
594 )
595{
596 return AsmWriteMsr64 (
597 Index,
598 BitFieldAnd64 (AsmReadMsr64 (Index), StartBit, EndBit, AndData)
599 );
600}
601
632UINT64
633EFIAPI
635 IN UINT32 Index,
636 IN UINTN StartBit,
637 IN UINTN EndBit,
638 IN UINT64 AndData,
639 IN UINT64 OrData
640 )
641{
642 return AsmWriteMsr64 (
643 Index,
645 AsmReadMsr64 (Index),
646 StartBit,
647 EndBit,
648 AndData,
649 OrData
650 )
651 );
652}
UINT64 UINTN
UINT64 EFIAPI BitFieldOr64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 OrData)
Definition: BitField.c:793
UINT64 EFIAPI BitFieldAndThenOr64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData, IN UINT64 OrData)
Definition: BitField.c:900
UINT64 EFIAPI BitFieldWrite64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
Definition: BitField.c:755
UINT64 EFIAPI BitFieldRead64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit)
Definition: BitField.c:719
UINT64 EFIAPI BitFieldAnd64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData)
Definition: BitField.c:845
UINT32 EFIAPI BitFieldRead32(IN UINT32 Operand, IN UINTN StartBit, IN UINTN EndBit)
Definition: BitField.c:527
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
Definition: GccInlinePriv.c:60
UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
#define IN
Definition: Base.h:279
UINT32 EFIAPI AsmWriteMsr32(IN UINT32 Index, IN UINT32 Value)
Definition: X86Msr.c:53
UINT64 EFIAPI AsmMsrAnd64(IN UINT32 Index, IN UINT64 AndData)
Definition: X86Msr.c:406
UINT64 EFIAPI AsmMsrBitFieldOr64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 OrData)
Definition: X86Msr.c:547
UINT32 EFIAPI AsmMsrBitFieldAndThenOr32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData, IN UINT32 OrData)
Definition: X86Msr.c:339
UINT64 EFIAPI AsmMsrOr64(IN UINT32 Index, IN UINT64 OrData)
Definition: X86Msr.c:378
UINT32 EFIAPI AsmMsrAnd32(IN UINT32 Index, IN UINT32 AndData)
Definition: X86Msr.c:111
UINT32 EFIAPI AsmMsrAndThenOr32(IN UINT32 Index, IN UINT32 AndData, IN UINT32 OrData)
Definition: X86Msr.c:143
UINT64 EFIAPI AsmMsrBitFieldWrite64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
Definition: X86Msr.c:505
UINT64 EFIAPI AsmMsrBitFieldAnd64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData)
Definition: X86Msr.c:589
UINT32 EFIAPI AsmMsrBitFieldOr32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData)
Definition: X86Msr.c:253
UINT32 EFIAPI AsmMsrOr32(IN UINT32 Index, IN UINT32 OrData)
Definition: X86Msr.c:82
UINT32 EFIAPI AsmReadMsr32(IN UINT32 Index)
Definition: X86Msr.c:27
UINT64 EFIAPI AsmMsrBitFieldRead64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit)
Definition: X86Msr.c:470
UINT64 EFIAPI AsmMsrBitFieldAndThenOr64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData, IN UINT64 OrData)
Definition: X86Msr.c:634
UINT64 EFIAPI AsmMsrAndThenOr64(IN UINT32 Index, IN UINT64 AndData, IN UINT64 OrData)
Definition: X86Msr.c:437
UINT32 EFIAPI AsmMsrBitFieldRead32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit)
Definition: X86Msr.c:176
UINT32 EFIAPI AsmMsrBitFieldWrite32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
Definition: X86Msr.c:212
UINT32 EFIAPI AsmMsrBitFieldAnd32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
Definition: X86Msr.c:294