]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add UEFI 2.2 VLAN device path definition to MdePkg
authorxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Nov 2009 10:40:58 +0000 (10:40 +0000)
committerxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Nov 2009 10:40:58 +0000 (10:40 +0000)
2. Update DevicePathDxe to support VLAN device path node
3. Update GenericBdsLib function DevicePathToStr() to support VLAN device path node

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9421 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/GenericBdsLib/DevicePath.c
MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
MdePkg/Include/Protocol/DevicePath.h

index 045cd1d83c114f309a5df45c047836fad7fb7755..855b73b5025fa9a8357af9c326658be3bb7abaef 100644 (file)
@@ -2,7 +2,7 @@
   BDS internal function define the default device path string, it can be\r
   replaced by platform device path.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\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
@@ -984,6 +984,28 @@ DevPathiSCSI (
   CatPrint (Str, L"%s)", (IScsi->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r
 }\r
 \r
+/**\r
+  Convert Device Path to a Unicode string for printing.\r
+\r
+  @param Str             The buffer holding the output string.\r
+                         This buffer contains the length of the\r
+                         string and the maixmum length reserved\r
+                         for the string buffer.\r
+  @param DevPath         The device path.\r
+\r
+**/\r
+VOID\r
+DevPathVlan (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  VLAN_DEVICE_PATH  *Vlan;\r
+\r
+  Vlan = DevPath;\r
+  CatPrint (Str, L"Vlan(%d)", (UINTN) Vlan->VlanId);\r
+}\r
+\r
 /**\r
   Convert Device Path to a Unicode string for printing.\r
 \r
@@ -1390,6 +1412,11 @@ DEVICE_PATH_STRING_TABLE  DevPathTable[] = {
     MSG_ISCSI_DP,\r
     DevPathiSCSI\r
   },\r
+  {\r
+    MESSAGING_DEVICE_PATH,\r
+    MSG_VLAN_DP,\r
+    DevPathVlan\r
+  },\r
   {\r
     MEDIA_DEVICE_PATH,\r
     MEDIA_HARDDRIVE_DP,\r
index 73ec7a7f4a4f5c24caeb4e936a7785391186ddb8..3da549f156e5f9d9331e972899b8399fa29e3bb7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   DevicePathFromText protocol as defined in the UEFI 2.0 specification.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation. <BR>\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
@@ -2349,6 +2349,34 @@ DevPathFromTextiSCSI (
   return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;\r
 }\r
 \r
+/**\r
+  Converts a text device path node to VLAN device path structure.\r
+\r
+  @param TextDeviceNode  The input Text device path node.\r
+\r
+  @return A pointer to the newly-created VLAN device path structure.\r
+\r
+**/\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+DevPathFromTextVlan (\r
+  IN CHAR16 *TextDeviceNode\r
+  )\r
+{\r
+  CHAR16            *VlanStr;\r
+  VLAN_DEVICE_PATH  *Vlan;\r
+\r
+  VlanStr = GetNextParamStr (&TextDeviceNode);\r
+  Vlan    = (VLAN_DEVICE_PATH *) CreateDeviceNode (\r
+                                   MESSAGING_DEVICE_PATH,\r
+                                   MSG_VLAN_DP,\r
+                                   sizeof (VLAN_DEVICE_PATH)\r
+                                   );\r
+\r
+  Vlan->VlanId = (UINT16) Strtoi (VlanStr);\r
+\r
+  return (EFI_DEVICE_PATH_PROTOCOL *) Vlan;\r
+}\r
+\r
 /**\r
   Converts a text device path node to HD device path structure.\r
 \r
@@ -2753,6 +2781,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[]
   {L"UsbWwid", DevPathFromTextUsbWwid},\r
   {L"Unit", DevPathFromTextUnit},\r
   {L"iSCSI", DevPathFromTextiSCSI},\r
+  {L"Vlan", DevPathFromTextVlan},\r
   {L"HD", DevPathFromTextHD},\r
   {L"CDROM", DevPathFromTextCDROM},\r
   {L"VenMEDIA", DevPathFromTextVenMEDIA},\r
index fec342f113bdf36641e676514e46ea6e55637922..43b0e0b8f64cfc40d0b5f592afff3d38a914b817 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   DevicePathToText protocol as defined in the UEFI 2.0 specification.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation. <BR>\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
@@ -1311,6 +1311,33 @@ DevPathToTextiSCSI (
   CatPrint (Str, L"%s)", (ISCSIDevPath->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r
 }\r
 \r
+/**\r
+  Converts a VLAN device path structure to its string representative.\r
+\r
+  @param Str             The string representative of input device.\r
+  @param DevPath         The input device path structure.\r
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.\r
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text\r
+                         representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextVlan (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  VLAN_DEVICE_PATH  *Vlan;\r
+\r
+  Vlan = DevPath;\r
+  CatPrint (Str, L"Vlan(%d)", (UINTN) Vlan->VlanId);\r
+}\r
+\r
 /**\r
   Converts a Hard drive device path structure to its string representative.\r
 \r
@@ -1684,6 +1711,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
   {MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart},\r
   {MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor},\r
   {MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI},\r
+  {MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan},\r
   {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive},\r
   {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM},\r
   {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor},\r
index 728c20b3568e2db552bfa9256f23848bd890d5bb..1968f48b8d5f4159f5bb5513dd6b9bb38969e6d0 100644 (file)
@@ -758,6 +758,18 @@ typedef struct {
 #define ISCSI_LOGIN_OPTION_CHAP_BI                      0x0000\r
 #define ISCSI_LOGIN_OPTION_CHAP_UNI                     0x2000\r
 \r
+///\r
+/// VLAN Device Path SubType\r
+///\r
+#define MSG_VLAN_DP               0x14\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  ///\r
+  /// VLAN identifier (0-4094)\r
+  ///\r
+  UINT16                          VlanId;\r
+} VLAN_DEVICE_PATH;\r
+\r
 //\r
 // Media Device Path\r
 //\r