PRINT_PENDING_STRING (Struct, Type0, BiosReleaseDate);\r
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1));\r
\r
- DisplayBiosCharacteristics (*(UINT64 *) &(Struct->Type0->BiosCharacteristics), Option);\r
+ DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type0->BiosCharacteristics)), Option);\r
\r
if (Struct->Hdr->Length > 0x12) {\r
DisplayBiosCharacteristicsExt1 (Struct->Type0->BIOSCharacteristicsExtensionBytes[0], Option);\r
PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize);\r
PRINT_STRUCT_VALUE_H (Struct, Type7, SupportedSRAMType);\r
PRINT_STRUCT_VALUE_H (Struct, Type7, CurrentSRAMType);\r
- DisplayCacheSRAMType (*(UINT16 *) &(Struct->Type7->CurrentSRAMType), Option);\r
+ DisplayCacheSRAMType (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type7->CurrentSRAMType)), Option);\r
PRINT_STRUCT_VALUE_H (Struct, Type7, CacheSpeed);\r
DisplayCacheErrCorrectingType (Struct->Type7->ErrorCorrectionType, Option);\r
DisplayCacheSystemCacheType (Struct->Type7->SystemCacheType, Option);\r
PRINT_PENDING_STRING (Struct, Type17, DeviceLocator);\r
PRINT_PENDING_STRING (Struct, Type17, BankLocator);\r
DisplayMemoryDeviceType (Struct->Type17->MemoryType, Option);\r
- DisplayMemoryDeviceTypeDetail (*(UINT16 *) &(Struct->Type17->TypeDetail), Option);\r
+ DisplayMemoryDeviceTypeDetail (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type17->TypeDetail)), Option);\r
PRINT_STRUCT_VALUE_H (Struct, Type17, Speed);\r
PRINT_PENDING_STRING (Struct, Type17, Manufacturer);\r
PRINT_PENDING_STRING (Struct, Type17, SerialNumber);\r
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *EfiSimpleFileSystemProtocol;\r
EFI_FILE_PROTOCOL *Handle1;\r
EFI_FILE_PROTOCOL *Handle2;\r
+ CHAR16 *FnafPathName;\r
+ UINTN PathLen;\r
\r
if (FilePath == NULL || FileHandle == NULL || DeviceHandle == NULL) {\r
return (EFI_INVALID_PARAMETER);\r
Handle2 = Handle1;\r
Handle1 = NULL;\r
\r
+ //\r
+ // File Name Alignment Fix (FNAF)\r
+ // Handle2->Open may be incapable of handling a unaligned CHAR16 data.\r
+ // The structure pointed to by FilePath may be not CHAR16 aligned.\r
+ // This code copies the potentially unaligned PathName data from the\r
+ // FilePath structure to the aligned FnafPathName for use in the\r
+ // calls to Handl2->Open.\r
+ //\r
+\r
+ //\r
+ // Determine length of PathName, in bytes.\r
+ //\r
+ PathLen = DevicePathNodeLength (*FilePath) - SIZE_OF_FILEPATH_DEVICE_PATH;\r
+\r
+ //\r
+ // Allocate memory for the aligned copy of the string Extra allocation is to allow for forced alignment\r
+ // Copy bytes from possibly unaligned location to aligned location\r
+ //\r
+ FnafPathName = AllocateCopyPool(PathLen, (UINT8 *)((FILEPATH_DEVICE_PATH*)*FilePath)->PathName);\r
+ if (FnafPathName == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
//\r
// Try to test opening an existing file\r
//\r
Status = Handle2->Open (\r
Handle2,\r
&Handle1,\r
- ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName,\r
+ FnafPathName,\r
OpenMode &~EFI_FILE_MODE_CREATE,\r
0\r
);\r
Status = Handle2->Open (\r
Handle2,\r
&Handle1,\r
- ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName,\r
+ FnafPathName,\r
OpenMode,\r
Attributes\r
);\r
}\r
+\r
+ //\r
+ // Free the alignment buffer\r
+ //\r
+ FreePool(FnafPathName);\r
+\r
//\r
// Close the last node\r
//\r