]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/BaseLib.h
1. Added AsmCpuidEx() to BaseLib
[mirror_edk2.git] / MdePkg / Include / Library / BaseLib.h
index e042ccb712641e0809b66793e3bb04b5ed610717..a63bc1bc3e893828505a1e841292dc413cbe0cde 100644 (file)
@@ -638,6 +638,45 @@ AsciiStrnCat (
   IN      UINTN                     Length\r
   );\r
 \r
+/**\r
+  Converts an 8-bit value to an 8-bit BCD value.\r
+\r
+  Converts the 8-bit value specified by Value to BCD. The BCD value is\r
+  returned.\r
+\r
+  If Value >= 100, then ASSERT().\r
+\r
+  @param  Value The 8-bit value to convert to BCD. Range 0..99.\r
+\r
+  @return The BCD value\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+DecimalToBcd8 (\r
+  IN      UINT8                     Value\r
+  );\r
+\r
+/**\r
+  Converts an 8-bit BCD value to an 8-bit value.\r
+\r
+  Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit\r
+  value is returned.\r
+\r
+  If Value >= 0xA0, then ASSERT().\r
+  If (Value & 0x0F) >= 0x0A, then ASSERT().\r
+\r
+  @param  Value The 8-bit BCD value to convert to an 8-bit value.\r
+\r
+  @return The 8-bit value is returned.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+BcdToDecimal8 (\r
+  IN      UINT8                     Value\r
+  );\r
+\r
 //\r
 // LIST_ENTRY definition\r
 //\r
@@ -2994,6 +3033,49 @@ AsmCpuid (
   OUT     UINT32                    *Edx   OPTIONAL\r
   );\r
 \r
+/**\r
+  Retrieves CPUID information using an extended leaf identifier.\r
+\r
+  Executes the CPUID instruction with EAX set to the value specified by Index\r
+  and ECX set to the value specified by SubIndex. This function always returns\r
+  Index. This function is only available on IA-32 and x64.\r
+\r
+  If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r
+  If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r
+  If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r
+  If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r
+\r
+  @param  Index     The 32-bit value to load into EAX prior to invoking the\r
+                    CPUID instruction.\r
+  @param  SubIndex  The 32-bit value to load into ECX prior to invoking the\r
+                    CPUID instruction.\r
+  @param  Eax       Pointer to the 32-bit EAX value returned by the CPUID\r
+                    instruction. This is an optional parameter that may be\r
+                    NULL.\r
+  @param  Ebx       Pointer to the 32-bit EBX value returned by the CPUID\r
+                    instruction. This is an optional parameter that may be\r
+                    NULL.\r
+  @param  Ecx       Pointer to the 32-bit ECX value returned by the CPUID\r
+                    instruction. This is an optional parameter that may be\r
+                    NULL.\r
+  @param  Edx       Pointer to the 32-bit EDX value returned by the CPUID\r
+                    instruction. This is an optional parameter that may be\r
+                    NULL.\r
+\r
+  @return Index\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmCpuidEx (\r
+  IN      UINT32                    Index,\r
+  IN      UINT32                    SubIndex,\r
+  OUT     UINT32                    *Eax,  OPTIONAL\r
+  OUT     UINT32                    *Ebx,  OPTIONAL\r
+  OUT     UINT32                    *Ecx,  OPTIONAL\r
+  OUT     UINT32                    *Edx   OPTIONAL\r
+  );\r
+\r
 /**\r
   Returns the lower 32-bits of a Machine Specific Register(MSR).\r
 \r