+++ /dev/null
-/** @file\r
- Obsolete library interfaces.\r
-\r
- This file contains part of obsolete library interfaces in EDK.\r
- User is recommended to follow the porting Guide in R8Lib.c to elimante them.\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
-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
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
- Value - Hex value to convert to a string in Buffer.\r
- Flags - Flags to use in printing Hex string, see file header for details.\r
- Width - Width of hex value.\r
-\r
-Returns: \r
-\r
- Number of characters printed. \r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // Edk II BasePrintLib function UnicodeValueToString does not support \r
- // to convert Value to Hex String. \r
- // Include the source code to user code or use the full PrintLib funtion \r
- // UnicodeVSPrintAsciiFormat (Buffer, MAXIMUM_VALUE_CHARACTERS, "%x", Value) instead.\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
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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; R8_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
- R8_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 = (UINT8) (Byte | Digit << 4);
- }\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
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
- Other - The first HOB with the matching type.\r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // Edk II HobLib GetNextHob () is an equivelent function with the following exceptions:\r
- // 1. GetNextHob () does not allow NULL value as the argument of HobStart by ASSERT () \r
- // 2. GetNextHob () will return NULL instead of returning HobStart when such kind of\r
- // HOB can be retrieved, so caller does not need to re-check the return HOB type any longer.\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
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
- BootMode - Current boot mode recorded in PHIT hob\r
-\r
-Returns:\r
-\r
- EFI_NOT_FOUND - Invalid hob header\r
- EFI_SUCCESS - Boot mode found\r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\r
- // In fact, since EFI_HANDOFF_HOB must be the first Hob,\r
- // the following code can retrieve boot mode.\r
- //\r
- // EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
- //\r
- // HandOffHob = GetHobList (); \r
- // ASSERT (HandOffHob->Header.HobType == EFI_HOB_TYPE_HANDOFF);\r
- // \r
- // BootMode = HandOffHob->BootMode;\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
- SizeOfMemorySpace - Size of memory size\r
- SizeOfIoSpace - Size of IO size\r
-\r
-Returns:\r
-\r
- EFI_NOT_FOUND - CPU hob not found\r
- EFI_SUCCESS - CPU hob found and information got.\r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\r
- // If Cpu HOB info is indispensable, user is able to ASSERT ()\r
- // first to save error handling code\r
- // For example:\r
- //\r
- // EFI_HOB_CPU *CpuHob;\r
- // \r
- // CpuHob = GetHob (EFI_HOB_TYPE_CPU, HobStart);\r
- // ASSERT (CpuHob != NULL);\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
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\r
- // \r
- EFI_PEI_HOB_POINTERS DxeCoreHob;\r
- \r
- for (DxeCoreHob.Raw = HobStart; \r
- (DxeCoreHob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, DxeCoreHob.Raw)) != NULL;\r
- DxeCoreHob.Raw = GET_NEXT_HOB (DxeCoreHob)) {\r
- if (CompareGuid (&DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.Name, \r
- &gEfiHobMemeryAllocModuleGuid)) {\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
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND;\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
- BaseAddress - Start address of next firmware volume\r
- Length - Length of next firmware volume\r
-\r
-Returns:\r
-\r
- EFI_NOT_FOUND - Next firmware volume not found\r
- EFI_SUCCESS - Next firmware volume found with address information\r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\r
- // Pay attention that caller is REQUIRED to update HobStart with:\r
- // *HobStart = GET_NEXT_HOB (FirmwareVolumeHob)\r
- //\r
- // If FV HOB info is indispensable, user is able to ASSERT ()\r
- // first to save error handling code\r
- // For example:\r
- //\r
- // EFI_HOB_FIRMWARE_VOLUME *FirmwareVolumeHob;\r
- // \r
- // FirmwareVolumeHob = GetHob (EFI_HOB_TYPE_FV, HobStart);\r
- // ASSERT (FirmwareVolumeHob != NULL);\r
- // \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
- EFI_NOT_FOUND - Next Guid hob not found\r
- EFI_SUCCESS - Next Guid hob found and data for this Guid got\r
- EFI_INVALID_PARAMETER - invalid parameter\r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // This library interface is changed substantially with R9 counerpart GetNextGuidHob (). \r
- // 1. R9 GetNextGuidHob has two parameters and returns the matched GUID HOB from the StartHob. \r
- // 2. R9 GetNextGuidHob does not strip the HOB header, so caller is required to apply\r
- // GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its\r
- // size info respectively.\r
- // 3. this function does not skip the starting HOB pointer unconditionally:\r
- // it returns HobStart back if HobStart itself meets the requirement;\r
- // caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\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.Raw == 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
- 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
- IoPortSpaceAddress - IO port space address\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide:\r
- // This library interface is simply obsolete. \r
- // Include the source code to user code.\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
-////#HobLib\r
-EFI_STATUS\r
-R8_PeiBuildHobGuid (\r
- IN EFI_GUID *Guid,\r
- IN UINTN DataLength,\r
- OUT VOID **Hob\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Builds a custom HOB that is tagged with a GUID for identification\r
-\r
-Arguments:\r
-\r
- Guid - The GUID of the custome HOB type\r
- DataLength - The size of the data payload for the GUIDed HOB\r
- Hob - Pointer to pointer to the created Hob\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Hob is successfully built.\r
- Others - Errors occur while creating new Hob\r
-\r
---*/\r
-{\r
- //\r
- // Porting Guide: Apply the new interface of BuildGuidHob in R9 HobLib.\r
- // Pay attention that the return value has been changed to the start address of\r
- // GUID HOB data so that caller can fill the customized data. \r
- // For BuildGuidHob (), the HOB Header and Name field is already stripped..\r
- //\r
- VOID *HobData; \r
-\r
- HobData = BuildGuidHob (Guid, DataLength);\r
- //\r
- // This step is necessary to be compatible with R8 interface!\r
- //\r
- *Hob = (VOID *) ((UINT8 *) HobData - sizeof (EFI_HOB_GUID_TYPE)); \r
-\r
- return EFI_SUCCESS; \r
-}\r
-////~\r