diff options
Diffstat (limited to 'src/vendorcode/amd/agesa/f15tn/Lib')
-rw-r--r-- | src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c b/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c index a2c424ab87..1e2e349b4c 100644 --- a/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c +++ b/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c @@ -354,17 +354,25 @@ LibAmdBitScanForward ( } return (UINT8) Index; } + UINT8 LibAmdBitScanReverse ( IN UINT32 value ) { - UINT8 Index; - for (Index = 31; Index >= 0; Index--){ - if (value & (1 << Index)) return Index; - } - return 0xFF; + uint8_t bit = 31; + do { + if (value & (1 << 31)) + return bit; + + value <<= 1; + bit--; + + } while (value != 0); + + return 0xFF; /* Error code indicating no bit found */ } + VOID LibAmdMsrRead ( IN UINT32 MsrAddress, |