]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c
1. Added PcdNtEmulator and Removed MACRO EFI_NT_EMULATOR
[mirror_edk2.git] / EdkNt32Pkg / Library / EdkGenericBdsLib / DevicePath.c
index de854103cb9fb3a9bab83a46986f003c89b4001f..56b21a3ac3fb2ca501fe7f52bb933711cf5f8c6b 100644 (file)
@@ -1,13 +1,13 @@
 /*++\r
 \r
 /*++\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
+Copyright (c) 2006 - 2007, 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
 Module Name:\r
 \r
 \r
 Module Name:\r
 \r
@@ -20,13 +20,9 @@ Abstract:
 \r
 --*/\r
 \r
 \r
 --*/\r
 \r
-\r
-#ifdef TIANO_EXTENSION_FLAG\r
-EFI_GUID  UnknownDeviceGuid           = UNKNOWN_DEVICE_GUID;\r
-#endif \r
-\r
 EFI_GUID  mEfiWinNtThunkProtocolGuid  = EFI_WIN_NT_THUNK_PROTOCOL_GUID;\r
 EFI_GUID  mEfiWinNtUgaGuid            = EFI_WIN_NT_UGA_GUID;\r
 EFI_GUID  mEfiWinNtThunkProtocolGuid  = EFI_WIN_NT_THUNK_PROTOCOL_GUID;\r
 EFI_GUID  mEfiWinNtUgaGuid            = EFI_WIN_NT_UGA_GUID;\r
+EFI_GUID  mEfiWinNtGopGuid            = EFI_WIN_NT_GOP_GUID;\r
 EFI_GUID  mEfiWinNtSerialPortGuid     = EFI_WIN_NT_SERIAL_PORT_GUID;\r
 EFI_GUID  mEfiMsgPcAnsiGuid           = DEVICE_PATH_MESSAGING_PC_ANSI;\r
 EFI_GUID  mEfiMsgVt100Guid            = DEVICE_PATH_MESSAGING_VT_100;\r
 EFI_GUID  mEfiWinNtSerialPortGuid     = EFI_WIN_NT_SERIAL_PORT_GUID;\r
 EFI_GUID  mEfiMsgPcAnsiGuid           = DEVICE_PATH_MESSAGING_PC_ANSI;\r
 EFI_GUID  mEfiMsgVt100Guid            = DEVICE_PATH_MESSAGING_VT_100;\r
@@ -91,19 +87,19 @@ CatPrint (
 \r
 Routine Description:\r
 \r
 \r
 Routine Description:\r
 \r
-    Concatenates a formatted unicode string to allocated pool.  \r
+    Concatenates a formatted unicode string to allocated pool.\r
     The caller must free the resulting buffer.\r
 \r
 Arguments:\r
 \r
     The caller must free the resulting buffer.\r
 \r
 Arguments:\r
 \r
-    Str         - Tracks the allocated pool, size in use, and \r
+    Str         - Tracks the allocated pool, size in use, and\r
                   amount of pool allocated.\r
 \r
     fmt         - The format string\r
 \r
 Returns:\r
 \r
                   amount of pool allocated.\r
 \r
     fmt         - The format string\r
 \r
 Returns:\r
 \r
-    Allocated buffer with the formatted string printed in it.  \r
+    Allocated buffer with the formatted string printed in it.\r
     The caller must free the allocated buffer.   The buffer\r
     allocation is not packed.\r
 \r
     The caller must free the allocated buffer.   The buffer\r
     allocation is not packed.\r
 \r
@@ -162,7 +158,7 @@ Arguments:
 \r
 Returns:\r
 \r
 \r
 Returns:\r
 \r
-  If the memory for the device path is successfully allocated, then a \r
+  If the memory for the device path is successfully allocated, then a\r
   pointer to the new device path is returned.  Otherwise, NULL is returned.\r
 \r
 --*/\r
   pointer to the new device path is returned.  Otherwise, NULL is returned.\r
 \r
 --*/\r
@@ -313,6 +309,9 @@ Returns:
     } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtUgaGuid)) {\r
       CatPrint (Str, L"%s", L"UGA");\r
       return ;\r
     } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtUgaGuid)) {\r
       CatPrint (Str, L"%s", L"UGA");\r
       return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtGopGuid)) {\r
+      CatPrint (Str, L"%s", L"GOP");\r
+      return ;\r
     } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtSerialPortGuid)) {\r
       CatPrint (Str, L"%s", L"Serial");\r
       return ;\r
     } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtSerialPortGuid)) {\r
       CatPrint (Str, L"%s", L"Serial");\r
       return ;\r
@@ -370,6 +369,139 @@ DevPathAcpi (
   }\r
 }\r
 \r
   }\r
 }\r
 \r
+VOID\r
+DevPathExtendedAcpi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ACPI_EXTENDED_HID_DEVICE_PATH   *ExtendedAcpi;\r
+  //\r
+  // Index for HID, UID and CID strings, 0 for non-exist\r
+  //\r
+  UINT16                          HIDSTRIdx;\r
+  UINT16                          UIDSTRIdx;\r
+  UINT16                          CIDSTRIdx;\r
+  UINT16                          Index;\r
+  UINT16                          Length;\r
+  UINT16                          Anchor;\r
+  CHAR8                           *AsChar8Array;\r
+\r
+  ASSERT (Str != NULL);\r
+  ASSERT (DevPath != NULL);\r
+\r
+  HIDSTRIdx    = 0;\r
+  UIDSTRIdx    = 0;\r
+  CIDSTRIdx    = 0;\r
+  ExtendedAcpi = DevPath;\r
+  Length       = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) ExtendedAcpi);\r
+\r
+  ASSERT (Length >= 19);\r
+  AsChar8Array = (CHAR8 *) ExtendedAcpi;\r
+\r
+  //\r
+  // find HIDSTR\r
+  //\r
+  Anchor = 16;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    HIDSTRIdx = Anchor;\r
+  }\r
+  //\r
+  // find UIDSTR\r
+  //\r
+  Anchor = Index + 1;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    UIDSTRIdx = Anchor;\r
+  }\r
+  //\r
+  // find CIDSTR\r
+  //\r
+  Anchor = Index + 1;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    CIDSTRIdx = Anchor;\r
+  }\r
+\r
+  if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) {\r
+    CatPrint (Str, L"AcpiExp(");\r
+    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);\r
+    }\r
+    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);\r
+    }\r
+    if (UIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\")");\r
+    }\r
+  } else {\r
+    CatPrint (Str, L"AcpiEx(");\r
+    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);\r
+    }\r
+    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);\r
+    }\r
+    CatPrint (Str, L"%x,", ExtendedAcpi->UID);\r
+\r
+    if (HIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\",");\r
+    }\r
+    if (CIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\",");\r
+    }\r
+    if (UIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\")");\r
+    }\r
+  }\r
+\r
+}\r
+\r
+VOID\r
+DevPathAdrAcpi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ACPI_ADR_DEVICE_PATH    *AcpiAdr;\r
+  UINT16                  Index;\r
+  UINT16                  Length;\r
+  UINT16                  AdditionalAdrCount;\r
+\r
+  AcpiAdr            = DevPath;\r
+  Length             = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);\r
+  AdditionalAdrCount = (Length - 8) / 4;\r
+\r
+  CatPrint (Str, L"AcpiAdr(%x", AcpiAdr->ADR);\r
+  for (Index = 0; Index < AdditionalAdrCount; Index++) {\r
+    CatPrint (Str, L",%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r
+  }\r
+  CatPrint (Str, L")");\r
+}\r
+\r
 VOID\r
 DevPathAtapi (\r
   IN OUT POOL_PRINT       *Str,\r
 VOID\r
 DevPathAtapi (\r
   IN OUT POOL_PRINT       *Str,\r
@@ -783,6 +915,12 @@ DEVICE_PATH_STRING_TABLE  DevPathTable[] = {
   ACPI_DEVICE_PATH,\r
   ACPI_DP,\r
   DevPathAcpi,\r
   ACPI_DEVICE_PATH,\r
   ACPI_DP,\r
   DevPathAcpi,\r
+  ACPI_DEVICE_PATH,\r
+  ACPI_EXTENDED_DP,\r
+  DevPathExtendedAcpi,\r
+  ACPI_DEVICE_PATH,\r
+  ACPI_ADR_DP,\r
+  DevPathAdrAcpi,\r
   MESSAGING_DEVICE_PATH,\r
   MSG_ATAPI_DP,\r
   DevPathAtapi,\r
   MESSAGING_DEVICE_PATH,\r
   MSG_ATAPI_DP,\r
   DevPathAtapi,\r
@@ -946,7 +1084,7 @@ LibDuplicateDevicePathInstance (
 \r
 Routine Description:\r
 \r
 \r
 Routine Description:\r
 \r
-  Function creates a device path data structure that identically matches the \r
+  Function creates a device path data structure that identically matches the\r
   device path passed in.\r
 \r
 Arguments:\r
   device path passed in.\r
 \r
 Arguments:\r
@@ -955,7 +1093,7 @@ Arguments:
 \r
 Returns:\r
 \r
 \r
 Returns:\r
 \r
-  The new copy of DevPath is created to identically match the input.  \r
+  The new copy of DevPath is created to identically match the input.\r
   Otherwise, NULL is returned.\r
 \r
 --*/\r
   Otherwise, NULL is returned.\r
 \r
 --*/\r