/** @file\r
\r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
//\r
// Print DescString\r
//\r
- String = (CHAR8 *)(UINTN)((BbsTable[Index].DescStringSegment << 4) + BbsTable[Index].DescStringOffset);\r
+ String = (CHAR8 *)(((UINTN)BbsTable[Index].DescStringSegment << 4) + BbsTable[Index].DescStringOffset);\r
if (String != NULL) {\r
DEBUG ((EFI_D_INFO," ("));\r
for (SubIndex = 0; String[SubIndex] != 0; SubIndex++) {\r
)\r
{\r
SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;\r
- \r
- if ((mRuntimeSmbiosEntryPoint == NULL) || \r
- (mReserveSmbiosEntryPoint == 0) || \r
+\r
+ if ((mRuntimeSmbiosEntryPoint == NULL) ||\r
+ (mReserveSmbiosEntryPoint == 0) ||\r
(mStructureTableAddress == 0)) {\r
return;\r
}\r
- \r
+\r
EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) mRuntimeSmbiosEntryPoint;\r
- \r
+\r
//\r
// Copy SMBIOS Entry Point Structure\r
//\r
EntryPointStructure,\r
EntryPointStructure->EntryPointLength\r
);\r
- \r
+\r
//\r
// Copy SMBIOS Structure Table into EfiReservedMemoryType memory\r
//\r
(VOID *)(UINTN) EntryPointStructure->TableAddress,\r
EntryPointStructure->TableLength\r
);\r
- \r
+\r
//\r
// Update TableAddress in Entry Point Structure\r
//\r
EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)(UINTN) mReserveSmbiosEntryPoint;\r
EntryPointStructure->TableAddress = (UINT32)(UINTN) mStructureTableAddress;\r
- \r
+\r
//\r
// Fixup checksums in the Entry Point Structure\r
//\r
EntryPointStructure->IntermediateChecksum = 0;\r
EntryPointStructure->EntryPointStructureChecksum = 0;\r
\r
- EntryPointStructure->IntermediateChecksum = \r
+ EntryPointStructure->IntermediateChecksum =\r
CalculateCheckSum8 (\r
- (UINT8 *) EntryPointStructure + OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString), \r
+ (UINT8 *) EntryPointStructure + OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString),\r
EntryPointStructure->EntryPointLength - OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString)\r
);\r
EntryPointStructure->EntryPointStructureChecksum =\r
\r
EfiToLegacy16BootTable->MajorVersion = EFI_TO_LEGACY_MAJOR_VERSION;\r
EfiToLegacy16BootTable->MinorVersion = EFI_TO_LEGACY_MINOR_VERSION;\r
- \r
+\r
//\r
// If booting to a legacy OS then force HDD drives to the appropriate\r
// boot mode by calling GetIdeHandle.\r
);\r
if (!EFI_ERROR (Status)) {\r
IdeController = HandleBuffer[0];\r
- } \r
+ }\r
}\r
//\r
// Unlock the Legacy BIOS region\r
//\r
// Setup BDA and EBDA standard areas before Legacy Boot\r
//\r
- LegacyBiosCompleteBdaBeforeBoot (Private);\r
+ ACCESS_PAGE0_CODE (\r
+ LegacyBiosCompleteBdaBeforeBoot (Private);\r
+ );\r
LegacyBiosCompleteStandardCmosBeforeBoot (Private);\r
\r
//\r
// Use 182/10 to avoid floating point math.\r
//\r
LocalTime = (LocalTime * 182) / 10;\r
- BdaPtr = (UINT32 *) (UINTN)0x46C;\r
- *BdaPtr = LocalTime;\r
+ ACCESS_PAGE0_CODE (\r
+ BdaPtr = (UINT32 *) (UINTN)0x46C;\r
+ *BdaPtr = LocalTime;\r
+ );\r
\r
//\r
// Shadow PCI ROMs. We must do this near the end since this will kick\r
// Disable DXE Timer while executing in real mode\r
//\r
Private->Timer->SetTimerPeriod (Private->Timer, 0);\r
- \r
+\r
//\r
// Save and disable interrupt of debug timer\r
//\r
// set of TIANO vectors) or takes it over.\r
//\r
//\r
- BaseVectorMaster = (UINT32 *) (sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);\r
- for (Index = 0; Index < 8; Index++) {\r
- Private->ThunkSavedInt[Index] = BaseVectorMaster[Index];\r
- if (Private->ThunkSeg == (UINT16) (BaseVectorMaster[Index] >> 16)) {\r
- BaseVectorMaster[Index] = (UINT32) (Private->BiosUnexpectedInt);\r
+ ACCESS_PAGE0_CODE (\r
+ BaseVectorMaster = (UINT32 *) (sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);\r
+ for (Index = 0; Index < 8; Index++) {\r
+ Private->ThunkSavedInt[Index] = BaseVectorMaster[Index];\r
+ if (Private->ThunkSeg == (UINT16) (BaseVectorMaster[Index] >> 16)) {\r
+ BaseVectorMaster[Index] = (UINT32) (Private->BiosUnexpectedInt);\r
+ }\r
}\r
- }\r
+ );\r
\r
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));\r
Regs.X.AX = Legacy16Boot;\r
0\r
);\r
\r
- BaseVectorMaster = (UINT32 *) (sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);\r
- for (Index = 0; Index < 8; Index++) {\r
- BaseVectorMaster[Index] = Private->ThunkSavedInt[Index];\r
- }\r
+ ACCESS_PAGE0_CODE (\r
+ BaseVectorMaster = (UINT32 *) (sizeof (UINT32) * PROTECTED_MODE_BASE_VECTOR_MASTER);\r
+ for (Index = 0; Index < 8; Index++) {\r
+ BaseVectorMaster[Index] = Private->ThunkSavedInt[Index];\r
+ }\r
+ );\r
}\r
Private->LegacyBootEntered = TRUE;\r
if ((mBootMode == BOOT_LEGACY_OS) || (mBootMode == BOOT_UNCONVENTIONAL_DEVICE)) {\r
}\r
\r
UcdTable = (UD_TABLE *) AllocatePool (\r
- sizeof (UD_TABLE)\r
- );\r
+ sizeof (UD_TABLE)\r
+ );\r
if (NULL == UcdTable) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
case EfiBootServicesCode:\r
case EfiBootServicesData:\r
case EfiConventionalMemory:\r
+ //\r
+ // The memory of EfiRuntimeServicesCode and EfiRuntimeServicesData are\r
+ // usable memory for legacy OS, because legacy OS is not aware of EFI runtime concept.\r
+ // In ACPI specification, EfiRuntimeServiceCode and EfiRuntimeServiceData\r
+ // should be mapped to AddressRangeReserved. This statement is for UEFI OS, not for legacy OS.\r
+ //\r
case EfiRuntimeServicesCode:\r
case EfiRuntimeServicesData:\r
return EfiAcpiAddressRangeMemory;\r
\r
+ case EfiPersistentMemory:\r
+ return EfiAddressRangePersistentMemory;\r
+\r
case EfiACPIReclaimMemory:\r
return EfiAcpiAddressRangeACPI;\r
\r
//\r
// First entry is 0 to (640k - EBDA)\r
//\r
- E820Table[0].BaseAddr = 0;\r
- E820Table[0].Length = (UINT64) ((*(UINT16 *) (UINTN)0x40E) << 4);\r
- E820Table[0].Type = EfiAcpiAddressRangeMemory;\r
+ ACCESS_PAGE0_CODE (\r
+ E820Table[0].BaseAddr = 0;\r
+ E820Table[0].Length = (UINT64) ((*(UINT16 *) (UINTN)0x40E) << 4);\r
+ E820Table[0].Type = EfiAcpiAddressRangeMemory;\r
+ );\r
\r
//\r
// Second entry is (640k - EBDA) to 640k\r
UINT8 LocalLeds;\r
EFI_IA32_REGISTER_SET Regs;\r
\r
- Bda = (BDA_STRUC *) ((UINTN) 0x400);\r
-\r
Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);\r
- LocalLeds = Leds;\r
- Bda->LedStatus = (UINT8) ((Bda->LedStatus &~0x07) | LocalLeds);\r
- LocalLeds = (UINT8) (LocalLeds << 4);\r
- Bda->ShiftStatus = (UINT8) ((Bda->ShiftStatus &~0x70) | LocalLeds);\r
- LocalLeds = (UINT8) (Leds & 0x20);\r
- Bda->KeyboardStatus = (UINT8) ((Bda->KeyboardStatus &~0x20) | LocalLeds);\r
+\r
+ ACCESS_PAGE0_CODE (\r
+ Bda = (BDA_STRUC *) ((UINTN) 0x400);\r
+ LocalLeds = Leds;\r
+ Bda->LedStatus = (UINT8) ((Bda->LedStatus &~0x07) | LocalLeds);\r
+ LocalLeds = (UINT8) (LocalLeds << 4);\r
+ Bda->ShiftStatus = (UINT8) ((Bda->ShiftStatus &~0x70) | LocalLeds);\r
+ LocalLeds = (UINT8) (Leds & 0x20);\r
+ Bda->KeyboardStatus = (UINT8) ((Bda->KeyboardStatus &~0x20) | LocalLeds);\r
+ );\r
+\r
//\r
// Call into Legacy16 code to allow it to do any processing\r
//\r
// to large capacity drives\r
// CMOS 14 = BDA 40:10 plus bit 3(display enabled)\r
//\r
- Bda = (UINT8)(*((UINT8 *)((UINTN)0x410)) | BIT3);\r
+ ACCESS_PAGE0_CODE (\r
+ Bda = (UINT8)(*((UINT8 *)((UINTN)0x410)) | BIT3);\r
+ );\r
\r
//\r
// Force display enabled\r