X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkNt32Pkg%2FLibrary%2FEdkGenericBdsLib%2FDevicePath.c;h=56b21a3ac3fb2ca501fe7f52bb933711cf5f8c6b;hp=de854103cb9fb3a9bab83a46986f003c89b4001f;hb=7af45bf1f0b989e932cd36d6ab729d9878bbc982;hpb=878ddf1fc3540a715f63594ed22b6929e881afb4;ds=sidebyside diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c index de854103cb..56b21a3ac3 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -20,13 +20,9 @@ Abstract: --*/ - -#ifdef TIANO_EXTENSION_FLAG -EFI_GUID UnknownDeviceGuid = UNKNOWN_DEVICE_GUID; -#endif - EFI_GUID mEfiWinNtThunkProtocolGuid = EFI_WIN_NT_THUNK_PROTOCOL_GUID; EFI_GUID mEfiWinNtUgaGuid = EFI_WIN_NT_UGA_GUID; +EFI_GUID mEfiWinNtGopGuid = EFI_WIN_NT_GOP_GUID; EFI_GUID mEfiWinNtSerialPortGuid = EFI_WIN_NT_SERIAL_PORT_GUID; EFI_GUID mEfiMsgPcAnsiGuid = DEVICE_PATH_MESSAGING_PC_ANSI; EFI_GUID mEfiMsgVt100Guid = DEVICE_PATH_MESSAGING_VT_100; @@ -91,19 +87,19 @@ CatPrint ( Routine Description: - Concatenates a formatted unicode string to allocated pool. + Concatenates a formatted unicode string to allocated pool. The caller must free the resulting buffer. Arguments: - Str - Tracks the allocated pool, size in use, and + Str - Tracks the allocated pool, size in use, and amount of pool allocated. fmt - The format string Returns: - Allocated buffer with the formatted string printed in it. + Allocated buffer with the formatted string printed in it. The caller must free the allocated buffer. The buffer allocation is not packed. @@ -162,7 +158,7 @@ Arguments: Returns: - If the memory for the device path is successfully allocated, then a + If the memory for the device path is successfully allocated, then a pointer to the new device path is returned. Otherwise, NULL is returned. --*/ @@ -313,6 +309,9 @@ Returns: } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtUgaGuid)) { CatPrint (Str, L"%s", L"UGA"); return ; + } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtGopGuid)) { + CatPrint (Str, L"%s", L"GOP"); + return ; } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtSerialPortGuid)) { CatPrint (Str, L"%s", L"Serial"); return ; @@ -370,6 +369,139 @@ DevPathAcpi ( } } +VOID +DevPathExtendedAcpi ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath + ) +{ + ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi; + // + // Index for HID, UID and CID strings, 0 for non-exist + // + UINT16 HIDSTRIdx; + UINT16 UIDSTRIdx; + UINT16 CIDSTRIdx; + UINT16 Index; + UINT16 Length; + UINT16 Anchor; + CHAR8 *AsChar8Array; + + ASSERT (Str != NULL); + ASSERT (DevPath != NULL); + + HIDSTRIdx = 0; + UIDSTRIdx = 0; + CIDSTRIdx = 0; + ExtendedAcpi = DevPath; + Length = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) ExtendedAcpi); + + ASSERT (Length >= 19); + AsChar8Array = (CHAR8 *) ExtendedAcpi; + + // + // find HIDSTR + // + Anchor = 16; + for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) { + ; + } + if (Index > Anchor) { + HIDSTRIdx = Anchor; + } + // + // find UIDSTR + // + Anchor = Index + 1; + for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) { + ; + } + if (Index > Anchor) { + UIDSTRIdx = Anchor; + } + // + // find CIDSTR + // + Anchor = Index + 1; + for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) { + ; + } + if (Index > Anchor) { + CIDSTRIdx = Anchor; + } + + if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) { + CatPrint (Str, L"AcpiExp("); + if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { + CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID)); + } else { + CatPrint (Str, L"%08x,", ExtendedAcpi->HID); + } + if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { + CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID)); + } else { + CatPrint (Str, L"%08x,", ExtendedAcpi->CID); + } + if (UIDSTRIdx != 0) { + CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx); + } else { + CatPrint (Str, L"\"\")"); + } + } else { + CatPrint (Str, L"AcpiEx("); + if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { + CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID)); + } else { + CatPrint (Str, L"%08x,", ExtendedAcpi->HID); + } + if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { + CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID)); + } else { + CatPrint (Str, L"%08x,", ExtendedAcpi->CID); + } + CatPrint (Str, L"%x,", ExtendedAcpi->UID); + + if (HIDSTRIdx != 0) { + CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx); + } else { + CatPrint (Str, L"\"\","); + } + if (CIDSTRIdx != 0) { + CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx); + } else { + CatPrint (Str, L"\"\","); + } + if (UIDSTRIdx != 0) { + CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx); + } else { + CatPrint (Str, L"\"\")"); + } + } + +} + +VOID +DevPathAdrAcpi ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath + ) +{ + ACPI_ADR_DEVICE_PATH *AcpiAdr; + UINT16 Index; + UINT16 Length; + UINT16 AdditionalAdrCount; + + AcpiAdr = DevPath; + Length = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr); + AdditionalAdrCount = (Length - 8) / 4; + + CatPrint (Str, L"AcpiAdr(%x", AcpiAdr->ADR); + for (Index = 0; Index < AdditionalAdrCount; Index++) { + CatPrint (Str, L",%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4)); + } + CatPrint (Str, L")"); +} + VOID DevPathAtapi ( IN OUT POOL_PRINT *Str, @@ -783,6 +915,12 @@ DEVICE_PATH_STRING_TABLE DevPathTable[] = { ACPI_DEVICE_PATH, ACPI_DP, DevPathAcpi, + ACPI_DEVICE_PATH, + ACPI_EXTENDED_DP, + DevPathExtendedAcpi, + ACPI_DEVICE_PATH, + ACPI_ADR_DP, + DevPathAdrAcpi, MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathAtapi, @@ -946,7 +1084,7 @@ LibDuplicateDevicePathInstance ( Routine Description: - Function creates a device path data structure that identically matches the + Function creates a device path data structure that identically matches the device path passed in. Arguments: @@ -955,7 +1093,7 @@ Arguments: Returns: - The new copy of DevPath is created to identically match the input. + The new copy of DevPath is created to identically match the input. Otherwise, NULL is returned. --*/