/* If MtrrSetting is not NULL, returns the default MTRR cache type from input MTRR settings buffer. If MtrrSetting is NULL, returns the default MTRR cache type from MSR. */
MTRR_MEMORY_CACHE_TYPE MtrrGetDefaultMemoryTypeWorker(IN CONST MTRR_SETTINGS *MtrrSetting)
/* If MtrrSetting is not NULL, returns the default MTRR cache type from input MTRR settings buffer. If MtrrSetting is NULL, returns the default MTRR cache type from MSR. */
MTRR_MEMORY_CACHE_TYPE MtrrGetDefaultMemoryTypeWorker(IN CONST MTRR_SETTINGS *MtrrSetting)
{
  MSR_IA32_MTRR_DEF_TYPE_REGISTER  DefType;
  if (MtrrSetting == NULL) {
    DefType.Uint64 = AsmReadMsr64 (MSR_IA32_MTRR_DEF_TYPE);
  } else {
    DefType.Uint64 = MtrrSetting->MtrrDefType;
  }
  return (MTRR_MEMORY_CACHE_TYPE)DefType.Bits.Type;
}