--- /dev/null
+/** @file\r
+ Obsolete library.\r
+\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+////\r
+EFI_STATUS\r
+R8_EfiLibInstallDriverBinding (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
+ IN EFI_HANDLE DriverBindingHandle\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Intialize a driver by installing the Driver Binding Protocol onto the \r
+ driver's DriverBindingHandle. This is typically the same as the driver's\r
+ ImageHandle, but it can be different if the driver produces multiple\r
+ DriverBinding Protocols. This function also initializes the EFI Driver\r
+ Library that initializes the global variables gST, gBS, gRT.\r
+\r
+Arguments:\r
+\r
+ ImageHandle - The image handle of the driver\r
+\r
+ SystemTable - The EFI System Table that was passed to the driver's entry point\r
+\r
+ DriverBinding - A Driver Binding Protocol instance that this driver is producing\r
+\r
+ DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r
+ parameter is NULL, then a new handle is created.\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS is DriverBinding is installed onto DriverBindingHandle\r
+\r
+ Otherwise, then return status from gBS->InstallProtocolInterface()\r
+\r
+--*/\r
+{\r
+ //EfiInitializeDriverLib (ImageHandle, SystemTable);\r
+\r
+ DriverBinding->ImageHandle = ImageHandle;\r
+\r
+ DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
+\r
+ return gBS->InstallProtocolInterface (\r
+ &DriverBinding->DriverBindingHandle,\r
+ &gEfiDriverBindingProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ DriverBinding\r
+ );\r
+}\r
+////~\r
+\r
+////\r
+EFI_STATUS\r
+R8_EfiLibInstallAllDriverProtocols (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE * SystemTable,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * DriverBinding,\r
+ IN EFI_HANDLE DriverBindingHandle,\r
+ IN EFI_COMPONENT_NAME_PROTOCOL * ComponentName, OPTIONAL\r
+ IN EFI_DRIVER_CONFIGURATION_PROTOCOL * DriverConfiguration, OPTIONAL\r
+ IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL * DriverDiagnostics OPTIONAL\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Intialize a driver by installing the Driver Binding Protocol onto the \r
+ driver's DriverBindingHandle. This is typically the same as the driver's\r
+ ImageHandle, but it can be different if the driver produces multiple\r
+ DriverBinding Protocols. This function also initializes the EFI Driver\r
+ Library that initializes the global variables gST, gBS, gRT.\r
+\r
+Arguments:\r
+\r
+ ImageHandle - The image handle of the driver\r
+\r
+ SystemTable - The EFI System Table that was passed to the driver's entry point\r
+\r
+ DriverBinding - A Driver Binding Protocol instance that this driver is producing\r
+\r
+ DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r
+ parameter is NULL, then a new handle is created.\r
+\r
+ ComponentName - A Component Name Protocol instance that this driver is producing\r
+\r
+ DriverConfiguration - A Driver Configuration Protocol instance that this driver is producing\r
+ \r
+ DriverDiagnostics - A Driver Diagnostics Protocol instance that this driver is producing\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle\r
+\r
+ Otherwise, then return status from gBS->InstallProtocolInterface()\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = R8_EfiLibInstallDriverBinding (ImageHandle, SystemTable, DriverBinding, DriverBindingHandle);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (ComponentName != NULL) {\r
+ Status = gBS->InstallProtocolInterface (\r
+ &DriverBinding->DriverBindingHandle,\r
+ &gEfiComponentNameProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ ComponentName\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ }\r
+\r
+ if (DriverConfiguration != NULL) {\r
+ Status = gBS->InstallProtocolInterface (\r
+ &DriverBinding->DriverBindingHandle,\r
+ &gEfiDriverConfigurationProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ DriverConfiguration\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ }\r
+\r
+ if (DriverDiagnostics != NULL) {\r
+ Status = gBS->InstallProtocolInterface (\r
+ &DriverBinding->DriverBindingHandle,\r
+ &gEfiDriverDiagnosticsProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ DriverDiagnostics\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////\r
+BOOLEAN\r
+R8_EfiLibCompareLanguage (\r
+ IN CHAR8 *Language1,\r
+ IN CHAR8 *Language2\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Compare whether two names of languages are identical.\r
+\r
+Arguments:\r
+\r
+ Language1 - Name of language 1\r
+ Language2 - Name of language 2\r
+\r
+Returns:\r
+\r
+ TRUE - same\r
+ FALSE - not same\r
+\r
+--*/\r
+{\r
+ UINTN Index;\r
+\r
+ for (Index = 0; Index < 3; Index++) {\r
+ if (Language1[Index] != Language2[Index]) {\r
+ return FALSE;\r
+ }\r
+ }\r
+\r
+ return TRUE;\r
+}\r
+////~\r
+\r
+////#BaseLib\r
+EFI_STATUS\r
+R8_BufToHexString (\r
+ IN OUT CHAR16 *Str,\r
+ IN OUT UINTN *HexStringBufferLength,\r
+ IN UINT8 *Buf,\r
+ IN UINTN Len\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Converts binary buffer to Unicode string.\r
+ At a minimum, any blob of data could be represented as a hex string.\r
+\r
+ Arguments:\r
+ Str - Pointer to the string.\r
+ HexStringBufferLength - Length in bytes of buffer to hold the hex string. Includes tailing '\0' character.\r
+ If routine return with EFI_SUCCESS, containing length of hex string buffer.\r
+ If routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string buffer desired.\r
+ Buf - Buffer to be converted from.\r
+ Len - Length in bytes of the buffer to be converted.\r
+\r
+ Returns:\r
+ EFI_SUCCESS: Routine success.\r
+ EFI_BUFFER_TOO_SMALL: The hex string buffer is too small.\r
+\r
+--*/\r
+{\r
+ UINTN Idx;\r
+ UINT8 Byte;\r
+ UINTN StrLen;\r
+\r
+ //\r
+ // Make sure string is either passed or allocate enough.\r
+ // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.\r
+ // Plus the Unicode termination character.\r
+ //\r
+ StrLen = Len * 2;\r
+ if (StrLen > ((*HexStringBufferLength) - 1)) {\r
+ *HexStringBufferLength = StrLen + 1;\r
+ return EFI_BUFFER_TOO_SMALL;\r
+ }\r
+\r
+ *HexStringBufferLength = StrLen + 1;\r
+ //\r
+ // Ends the string.\r
+ //\r
+ Str[StrLen] = L'\0'; \r
+\r
+ for (Idx = 0; Idx < Len; Idx++) {\r
+\r
+ Byte = Buf[Idx];\r
+ Str[StrLen - 1 - Idx * 2] = NibbleToHexChar (Byte);\r
+ Str[StrLen - 2 - Idx * 2] = NibbleToHexChar ((UINT8)(Byte >> 4));\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////\r
+VOID\r
+R8_EfiStrTrim (\r
+ IN OUT CHAR16 *str,\r
+ IN CHAR16 CharC\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ \r
+ Removes (trims) specified leading and trailing characters from a string.\r
+ \r
+Arguments: \r
+ \r
+ str - Pointer to the null-terminated string to be trimmed. On return, \r
+ str will hold the trimmed string. \r
+ CharC - Character will be trimmed from str.\r
+ \r
+Returns:\r
+\r
+--*/\r
+{\r
+ CHAR16 *p1;\r
+ CHAR16 *p2;\r
+ \r
+ if (*str == 0) {\r
+ return;\r
+ }\r
+ \r
+ //\r
+ // Trim off the leading and trailing characters c\r
+ //\r
+ for (p1 = str; *p1 && *p1 == CharC; p1++) {\r
+ ;\r
+ }\r
+ \r
+ p2 = str;\r
+ if (p2 == p1) {\r
+ while (*p1) {\r
+ p2++;\r
+ p1++;\r
+ }\r
+ } else {\r
+ while (*p1) { \r
+ *p2 = *p1; \r
+ p1++;\r
+ p2++;\r
+ }\r
+ *p2 = 0;\r
+ }\r
+ \r
+ \r
+ for (p1 = str + StrLen(str) - 1; p1 >= str && *p1 == CharC; p1--) {\r
+ ;\r
+ }\r
+ if (p1 != str + StrLen(str) - 1) { \r
+ *(p1 + 1) = 0;\r
+ }\r
+}\r
+////~\r
+\r
+////#PrintLib\r
+UINTN\r
+R8_EfiValueToHexStr (\r
+ IN OUT CHAR16 *Buffer, \r
+ IN UINT64 Value, \r
+ IN UINTN Flags, \r
+ IN UINTN Width\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ VSPrint worker function that prints a Value as a hex number in Buffer\r
+\r
+Arguments:\r
+\r
+ Buffer - Location to place ascii hex string of Value.\r
+\r
+ Value - Hex value to convert to a string in Buffer.\r
+\r
+ Flags - Flags to use in printing Hex string, see file header for details.\r
+\r
+ Width - Width of hex value.\r
+\r
+Returns: \r
+\r
+ Number of characters printed. \r
+\r
+--*/\r
+{\r
+ CHAR16 TempBuffer[MAXIMUM_VALUE_CHARACTERS];\r
+ CHAR16 *TempStr;\r
+ CHAR16 Prefix;\r
+ CHAR16 *BufferPtr;\r
+ UINTN Count;\r
+ UINTN Index;\r
+\r
+ TempStr = TempBuffer;\r
+ BufferPtr = Buffer;\r
+\r
+ //\r
+ // Count starts at one since we will null terminate. Each iteration of the\r
+ // loop picks off one nibble. Oh yea TempStr ends up backwards\r
+ //\r
+ Count = 0;\r
+ \r
+ if (Width > MAXIMUM_VALUE_CHARACTERS - 1) {\r
+ Width = MAXIMUM_VALUE_CHARACTERS - 1;\r
+ }\r
+\r
+ do {\r
+ //\r
+ // If Width == 0, it means no limit.\r
+ //\r
+ if ((Width != 0) && (Count >= Width)) {\r
+ break;\r
+ }\r
+\r
+ Index = ((UINTN)Value & 0xf);\r
+ *(TempStr++) = mHexStr[Index];\r
+ Value = RShiftU64 (Value, 4);\r
+ Count++;\r
+ } while (Value != 0);\r
+\r
+ if (Flags & PREFIX_ZERO) {\r
+ Prefix = '0';\r
+ } else { \r
+ Prefix = ' ';\r
+ }\r
+\r
+ Index = Count;\r
+ if (!(Flags & LEFT_JUSTIFY)) {\r
+ for (; Index < Width; Index++) {\r
+ *(TempStr++) = Prefix;\r
+ }\r
+ }\r
+\r
+ //\r
+ // Reverse temp string into Buffer.\r
+ //\r
+ while (TempStr != TempBuffer) {\r
+ *(BufferPtr++) = *(--TempStr);\r
+ } \r
+ \r
+ *BufferPtr = 0;\r
+ return Index;\r
+}\r
+////~\r
+\r
+\r
+\r
+////\r
+EFI_STATUS\r
+R8_HexStringToBuf (\r
+ IN OUT UINT8 *Buf, \r
+ IN OUT UINTN *Len,\r
+ IN CHAR16 *Str,\r
+ OUT UINTN *ConvertedStrLen OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Converts Unicode string to binary buffer.\r
+ The conversion may be partial.\r
+ The first character in the string that is not hex digit stops the conversion.\r
+ At a minimum, any blob of data could be represented as a hex string.\r
+\r
+ Arguments:\r
+ Buf - Pointer to buffer that receives the data.\r
+ Len - Length in bytes of the buffer to hold converted data.\r
+ If routine return with EFI_SUCCESS, containing length of converted data.\r
+ If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.\r
+ Str - String to be converted from.\r
+ ConvertedStrLen - Length of the Hex String consumed.\r
+\r
+ Returns:\r
+ EFI_SUCCESS: Routine Success.\r
+ EFI_BUFFER_TOO_SMALL: The buffer is too small to hold converted data.\r
+ EFI_\r
+\r
+--*/\r
+{\r
+ UINTN HexCnt;\r
+ UINTN Idx;\r
+ UINTN BufferLength;\r
+ UINT8 Digit;\r
+ UINT8 Byte;\r
+\r
+ //\r
+ // Find out how many hex characters the string has.\r
+ //\r
+ for (Idx = 0, HexCnt = 0; IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);\r
+\r
+ if (HexCnt == 0) {\r
+ *Len = 0;\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // Two Unicode characters make up 1 buffer byte. Round up.\r
+ //\r
+ BufferLength = (HexCnt + 1) / 2; \r
+\r
+ //\r
+ // Test if buffer is passed enough.\r
+ //\r
+ if (BufferLength > (*Len)) {\r
+ *Len = BufferLength;\r
+ return EFI_BUFFER_TOO_SMALL;\r
+ }\r
+\r
+ *Len = BufferLength;\r
+\r
+ for (Idx = 0; Idx < HexCnt; Idx++) {\r
+\r
+ IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);\r
+\r
+ //\r
+ // For odd charaters, write the lower nibble for each buffer byte,\r
+ // and for even characters, the upper nibble.\r
+ //\r
+ if ((Idx & 1) == 0) {\r
+ Byte = Digit;\r
+ } else {\r
+ Byte = Buf[Idx / 2];\r
+ Byte &= 0x0F;\r
+ Byte |= Digit << 4;\r
+ }\r
+\r
+ Buf[Idx / 2] = Byte;\r
+ }\r
+\r
+ if (ConvertedStrLen != NULL) {\r
+ *ConvertedStrLen = HexCnt;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////\r
+BOOLEAN\r
+R8_IsHexDigit (\r
+ OUT UINT8 *Digit,\r
+ IN CHAR16 Char\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Determines if a Unicode character is a hexadecimal digit.\r
+ The test is case insensitive.\r
+\r
+ Arguments:\r
+ Digit - Pointer to byte that receives the value of the hex character.\r
+ Char - Unicode character to test.\r
+\r
+ Returns:\r
+ TRUE - If the character is a hexadecimal digit.\r
+ FALSE - Otherwise.\r
+\r
+--*/\r
+{\r
+ if ((Char >= L'0') && (Char <= L'9')) {\r
+ *Digit = (UINT8) (Char - L'0');\r
+ return TRUE;\r
+ }\r
+\r
+ if ((Char >= L'A') && (Char <= L'F')) {\r
+ *Digit = (UINT8) (Char - L'A' + 0x0A);\r
+ return TRUE;\r
+ }\r
+\r
+ if ((Char >= L'a') && (Char <= L'f')) {\r
+ *Digit = (UINT8) (Char - L'a' + 0x0A);\r
+ return TRUE;\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+////~\r
+\r
+////\r
+CHAR16\r
+R8_NibbleToHexChar (\r
+ IN UINT8 Nibble\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Converts the low nibble of a byte to hex unicode character.\r
+\r
+ Arguments:\r
+ Nibble - lower nibble of a byte.\r
+\r
+ Returns:\r
+ Hex unicode character.\r
+\r
+--*/\r
+{\r
+ Nibble &= 0x0F;\r
+ if (Nibble <= 0x9) {\r
+ return (CHAR16)(Nibble + L'0');\r
+ }\r
+\r
+ return (CHAR16)(Nibble - 0xA + L'A');\r
+}\r
+////~\r
+\r
+////#HobLib\r
+VOID *\r
+R8_GetHob (\r
+ IN UINT16 Type,\r
+ IN VOID *HobStart\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function returns the first instance of a HOB type in a HOB list.\r
+ \r
+Arguments:\r
+\r
+ Type The HOB type to return.\r
+ HobStart The first HOB in the HOB list.\r
+ \r
+Returns:\r
+\r
+ HobStart There were no HOBs found with the requested type.\r
+ else Returns the first HOB with the matching type.\r
+\r
+--*/\r
+{\r
+ VOID *Hob;\r
+ //\r
+ // Return input if not found\r
+ //\r
+ if (HobStart == NULL) {\r
+ return HobStart;\r
+ }\r
+ Hob = GetNextHob (Type, HobStart);\r
+ if (Hob == NULL) {\r
+ return HobStart;\r
+ }\r
+ \r
+ return Hob;\r
+}\r
+////~\r
+\r
+////\r
+UINTN\r
+R8_GetHobListSize (\r
+ IN VOID *HobStart\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get size of hob list.\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of hob list\r
+\r
+Returns:\r
+\r
+ Size of hob list.\r
+\r
+--*/\r
+{\r
+ EFI_PEI_HOB_POINTERS Hob;\r
+ UINTN Size;\r
+\r
+ Hob.Raw = HobStart;\r
+ Size = 0;\r
+\r
+ while (Hob.Header->HobType != EFI_HOB_TYPE_END_OF_HOB_LIST) {\r
+ Size += Hob.Header->HobLength;\r
+ Hob.Raw += Hob.Header->HobLength;\r
+ }\r
+\r
+ Size += Hob.Header->HobLength;\r
+\r
+ return Size;\r
+}\r
+////~\r
+\r
+////\r
+UINT32\r
+R8_GetHobVersion (\r
+ IN VOID *HobStart\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get hob version.\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of hob list\r
+\r
+Returns:\r
+\r
+ Hob version.\r
+\r
+--*/\r
+{\r
+ EFI_PEI_HOB_POINTERS Hob;\r
+\r
+ Hob.Raw = HobStart;\r
+ return Hob.HandoffInformationTable->Version;\r
+}\r
+////~\r
+\r
+////\r
+EFI_STATUS\r
+R8_GetHobBootMode (\r
+ IN VOID *HobStart,\r
+ OUT EFI_BOOT_MODE *BootMode\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get current boot mode.\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of hob list\r
+ \r
+ BootMode - Current boot mode recorded in PHIT hob\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - Invalid hob header\r
+ \r
+ EFI_SUCCESS - Boot mode found\r
+\r
+--*/\r
+{\r
+ EFI_PEI_HOB_POINTERS Hob;\r
+\r
+ Hob.Raw = HobStart;\r
+ if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ *BootMode = Hob.HandoffInformationTable->BootMode;\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+\r
+////#HobLib\r
+EFI_STATUS\r
+R8_GetCpuHobInfo (\r
+ IN VOID *HobStart,\r
+ OUT UINT8 *SizeOfMemorySpace,\r
+ OUT UINT8 *SizeOfIoSpace\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get information recorded in CPU hob (Memory space size, Io space size)\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of hob list\r
+ \r
+ SizeOfMemorySpace - Size of memory size\r
+ \r
+ SizeOfIoSpace - Size of IO size\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - CPU hob not found\r
+ \r
+ EFI_SUCCESS - CPU hob found and information got.\r
+\r
+--*/\r
+{\r
+ EFI_HOB_CPU *CpuHob;\r
+\r
+ CpuHob = GetHob (EFI_HOB_TYPE_CPU, HobStart);\r
+ if (CpuHob == NULL) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ *SizeOfMemorySpace = CpuHob->SizeOfMemorySpace;\r
+ *SizeOfIoSpace = CpuHob->SizeOfIoSpace;\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////#HobLib\r
+EFI_STATUS\r
+R8_GetDxeCoreHobInfo (\r
+ IN VOID *HobStart,\r
+ OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
+ OUT UINT64 *Length,\r
+ OUT VOID **EntryPoint,\r
+ OUT EFI_GUID **FileName\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get memory allocation hob created for DXE core and extract its information\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of the hob list\r
+ BaseAddress - Start address of memory allocated for DXE core\r
+ Length - Length of memory allocated for DXE core\r
+ EntryPoint - DXE core file name\r
+ FileName - File Name\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - DxeCoreHob not found \r
+ EFI_SUCCESS - DxeCoreHob found and information got\r
+\r
+--*/\r
+{\r
+ EFI_PEI_HOB_POINTERS DxeCoreHob;\r
+ \r
+ DxeCoreHob.Raw = HobStart;\r
+ DxeCoreHob.Raw = GetHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, DxeCoreHob.Raw);\r
+ while (DxeCoreHob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION && \r
+ !EfiCompareGuid (&DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.Name, \r
+ &gEfiHobMemeryAllocModuleGuid)) {\r
+\r
+ DxeCoreHob.Raw = GET_NEXT_HOB (DxeCoreHob);\r
+ DxeCoreHob.Raw = GetHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, DxeCoreHob.Raw);\r
+\r
+ }\r
+\r
+ if (DxeCoreHob.Header->HobType != EFI_HOB_TYPE_MEMORY_ALLOCATION) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ *BaseAddress = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryBaseAddress;\r
+ *Length = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryLength;\r
+ *EntryPoint = (VOID *) (UINTN) DxeCoreHob.MemoryAllocationModule->EntryPoint;\r
+ *FileName = &DxeCoreHob.MemoryAllocationModule->ModuleName;\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////#HobLib\r
+EFI_STATUS\r
+R8_GetNextFirmwareVolumeHob (\r
+ IN OUT VOID **HobStart,\r
+ OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
+ OUT UINT64 *Length\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get next firmware volume hob from HobStart\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of hob list\r
+ \r
+ BaseAddress - Start address of next firmware volume\r
+ \r
+ Length - Length of next firmware volume\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - Next firmware volume not found\r
+ \r
+ EFI_SUCCESS - Next firmware volume found with address information\r
+\r
+--*/\r
+{\r
+ EFI_PEI_HOB_POINTERS FirmwareVolumeHob;\r
+\r
+ FirmwareVolumeHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, *HobStart);\r
+ if (FirmwareVolumeHob.Raw != NULL) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ *BaseAddress = FirmwareVolumeHob.FirmwareVolume->BaseAddress;\r
+ *Length = FirmwareVolumeHob.FirmwareVolume->Length;\r
+\r
+ *HobStart = GET_NEXT_HOB (FirmwareVolumeHob);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////#HobLib\r
+EFI_STATUS\r
+R8_GetNextGuidHob (\r
+ IN OUT VOID **HobStart,\r
+ IN EFI_GUID * Guid,\r
+ OUT VOID **Buffer,\r
+ OUT UINTN *BufferSize OPTIONAL\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Get the next guid hob.\r
+ \r
+Arguments:\r
+ HobStart A pointer to the start hob.\r
+ Guid A pointer to a guid.\r
+ Buffer A pointer to the buffer.\r
+ BufferSize Buffer size.\r
+ \r
+Returns:\r
+ Status code.\r
+\r
+ EFI_NOT_FOUND - Next Guid hob not found\r
+ \r
+ EFI_SUCCESS - Next Guid hob found and data for this Guid got\r
+ \r
+ EFI_INVALID_PARAMETER - invalid parameter\r
+\r
+--*/\r
+{\r
+ EFI_PEI_HOB_POINTERS GuidHob;\r
+\r
+ if (Buffer == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ GuidHob.Raw = GetNextGuidHob (Guid, *HobStart);\r
+ if (GuidHob == NULL) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+ \r
+ *Buffer = GET_GUID_HOB_DATA (GuidHob.Guid);\r
+ if (BufferSize != NULL) {\r
+ *BufferSize = GET_GUID_HOB_DATA_SIZE (GuidHob.Guid);\r
+ }\r
+\r
+ *HobStart = GET_NEXT_HOB (GuidHob);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////#HobLib\r
+EFI_STATUS\r
+R8_GetPalEntryHobInfo (\r
+ IN VOID *HobStart,\r
+ OUT EFI_PHYSICAL_ADDRESS *PalEntry\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get PAL entry from PalEntryHob\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of hob list\r
+ \r
+ PalEntry - Pointer to PAL entry\r
+\r
+Returns:\r
+\r
+ Status code.\r
+\r
+--*/\r
+{\r
+ EFI_HOB_GUID_TYPE *GuidHob;\r
+\r
+ GuidHob = GetNextGuidHob (&gPalEntryHob, HobStart);\r
+\r
+ if (GuidHob == NULL) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ *PalEntry = *((EFI_PHYSICAL_ADDRESS *) GET_GUID_HOB_DATA (GuidHob));\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r
+////#HobLib\r
+EFI_STATUS\r
+R8_GetIoPortSpaceAddressHobInfo (\r
+ IN VOID *HobStart,\r
+ OUT EFI_PHYSICAL_ADDRESS *IoPortSpaceAddress\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get IO port space address from IoBaseHob.\r
+\r
+Arguments:\r
+\r
+ HobStart - Start pointer of hob list\r
+ \r
+ IoPortSpaceAddress - IO port space address\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ EFI_HOB_GUID_TYPE *GuidHob;\r
+\r
+ GuidHob = GetNextGuidHob (&gEfiIoBaseHobGuid, HobStart);\r
+\r
+ if (GuidHob == NULL) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ *IoPortSpaceAddress = *((EFI_PHYSICAL_ADDRESS *) GET_GUID_HOB_DATA (GuidHob));\r
+ return EFI_SUCCESS;\r
+}\r
+////~\r
+\r