]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Enhance BMM to support changing FlowControl setting in Front Page.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Feb 2011 05:31:39 +0000 (05:31 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Feb 2011 05:31:39 +0000 (05:31 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11317 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bmstring.uni
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Data.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c

index 3d75045a1f5840a16844b88aac9020246fef1a37..00c1cc9cf9739067bae5f2539f5a4b099bef105b 100644 (file)
Binary files a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bmstring.uni and b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bmstring.uni differ
index 6e15e096a68fd33d2635f30f69f68f7c6eda9750..2cddb519df46e1ebd0d1154920da4e1ae7dcdd06 100644 (file)
@@ -742,9 +742,10 @@ ApplyChangeHandler (
     ASSERT (CurrentFakeNVMap->COMParity < (sizeof (ParityList) / sizeof (ParityList[0])));\r
     NewTerminalContext->Parity        = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;\r
     NewTerminalContext->TerminalType  = CurrentFakeNVMap->COMTerminalType;\r
+    NewTerminalContext->FlowControl   = CurrentFakeNVMap->COMFlowControl;\r
 \r
     ChangeTerminalDevicePath (\r
-      NewTerminalContext->DevicePath,\r
+      &(NewTerminalContext->DevicePath),\r
       FALSE\r
       );\r
 \r
index 5b3da67d804526551b05c12ea8951e91d36f6ef9..67eaeec01114bc89f8d319894ec00ea929cb47da 100644 (file)
@@ -196,6 +196,7 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
 #define COM_STOP_BITS_VAR_OFFSET        VAR_OFFSET (COMStopBits)\r
 #define COM_PARITY_VAR_OFFSET           VAR_OFFSET (COMParity)\r
 #define COM_TERMINAL_VAR_OFFSET         VAR_OFFSET (COMTerminalType)\r
+#define COM_FLOWCONTROL_VAR_OFFSET      VAR_OFFSET (COMFlowControl)\r
 #define LEGACY_FD_VAR_OFFSET            VAR_OFFSET (LegacyFD)\r
 #define LEGACY_HD_VAR_OFFSET            VAR_OFFSET (LegacyHD)\r
 #define LEGACY_CD_VAR_OFFSET            VAR_OFFSET (LegacyCD)\r
@@ -233,6 +234,7 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
 #define COM_STOP_BITS_QUESTION_ID       QUESTION_ID (COMStopBits)\r
 #define COM_PARITY_QUESTION_ID          QUESTION_ID (COMParity)\r
 #define COM_TERMINAL_QUESTION_ID        QUESTION_ID (COMTerminalType)\r
+#define COM_FLOWCONTROL_QUESTION_ID     QUESTION_ID (COMFlowControl)\r
 #define LEGACY_FD_QUESTION_ID           QUESTION_ID (LegacyFD)\r
 #define LEGACY_HD_QUESTION_ID           QUESTION_ID (LegacyHD)\r
 #define LEGACY_CD_QUESTION_ID           QUESTION_ID (LegacyCD)\r
@@ -283,6 +285,8 @@ typedef struct {
   UINT8                     ParityIndex;\r
   UINT8                     StopBitsIndex;\r
 \r
+  UINT8                     FlowControl;\r
+\r
   UINT8                     IsConIn;\r
   UINT8                     IsConOut;\r
   UINT8                     IsStdErr;\r
@@ -757,7 +761,7 @@ ChangeVariableDevicePath (
 **/\r
 EFI_STATUS\r
 ChangeTerminalDevicePath (\r
-  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath,\r
   IN BOOLEAN                   ChangeTerminal\r
   );\r
 \r
@@ -1563,7 +1567,8 @@ extern STRING_DEPOSITORY          *DriverOptionHelpStrDepository;
 extern STRING_DEPOSITORY          *TerminalStrDepository;\r
 extern EFI_DEVICE_PATH_PROTOCOL   EndDevicePath[];\r
 extern EFI_GUID                   EfiLegacyDevOrderGuid;\r
-\r
+extern UINT16                     mFlowControlType[2];\r
+extern UINT32                     mFlowControlValue[2];\r
 //\r
 // Shared IFR form update data\r
 //\r
index 9d32c380fbc5023806918e18e78208cbe1050f98..ed42304c2ba82d84bb4c7d738ab66cda6ef141f8 100644 (file)
@@ -14,6 +14,37 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "BootMaint.h"\r
 \r
+UART_FLOW_CONTROL_DEVICE_PATH mFlowControlDevicePath =\r\r
+{ \r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_VENDOR_DP,\r
+  (UINT8)(sizeof(UART_FLOW_CONTROL_DEVICE_PATH)),\r
+  (UINT8)((sizeof(UART_FLOW_CONTROL_DEVICE_PATH)) >> 8),\r
+  DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL,\r
+  UART_FLOW_CONTROL_HARDWARE\r
+};\r
+\r
+/**\r
+  Check the device path node whether it's the Flow Control node or not.\r
+\r
+  @param[in] FlowControl    The device path node to be checked.\r
+  \r
+  @retval TRUE              It's the Flow Control node.\r
+  @retval FALSE             It's not.\r
+\r
+**/\r
+BOOLEAN\r
+IsUartFlowControlNode (\r
+  IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl\r
+  )\r
+{\r
+  return (BOOLEAN) (\r
+           (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&\r
+           (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&\r
+           (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))\r
+           );\r
+}\r
+\r
 /**\r
   Check whether the device path node is ISA Serial Node.\r
 \r
@@ -62,7 +93,7 @@ UpdateComAttributeFromVariable (
 **/\r
 EFI_STATUS\r
 ChangeTerminalDevicePath (\r
-  IN OUT    EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
+  IN OUT    EFI_DEVICE_PATH_PROTOCOL  **DevicePath,\r
   IN        BOOLEAN                   ChangeTerminal\r
   )\r
 {\r
@@ -74,8 +105,9 @@ ChangeTerminalDevicePath (
   UINTN                     Com;\r
   BM_TERMINAL_CONTEXT       *NewTerminalContext;\r
   BM_MENU_ENTRY             *NewMenuEntry;\r
+  UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;\r
 \r
-  Node  = DevicePath;\r
+  Node  = *DevicePath;\r
   Node  = NextDevicePathNode (Node);\r
   Com   = 0;\r
   while (!IsDevicePathEnd (Node)) {\r
@@ -112,6 +144,23 @@ ChangeTerminalDevicePath (
         &NewTerminalContext->StopBits,\r
         sizeof (UINT8)\r
         );\r
+\r
+      FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Node);\r
+      if (IsUartFlowControlNode (FlowControlNode)) {\r
+        FlowControlNode->FlowControlMap = NewTerminalContext->FlowControl;\r
+      } else {\r
+        //\r
+        // Append the Flow control device node when user enable flow control.\r
+        //\r
+        if (NewTerminalContext->FlowControl != 0) {\r
+          mFlowControlDevicePath.FlowControlMap = NewTerminalContext->FlowControl;\r
+          *DevicePath = AppendDevicePathNode (\r
+                                       *DevicePath,\r
+                                       (EFI_DEVICE_PATH_PROTOCOL *) (&mFlowControlDevicePath)\r
+                                       );\r
+        }\r
+      }\r
+\r
       //\r
       // Change the device path in the ComPort\r
       //\r
@@ -372,6 +421,7 @@ LocateSerialIo (
   BM_TERMINAL_CONTEXT       *NewTerminalContext;\r
   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;\r
   VENDOR_DEVICE_PATH        Vendor;\r
+  UINT32                    FlowControl;\r
   //\r
   // Get all handles that have SerialIo protocol installed\r
   //\r
@@ -470,6 +520,13 @@ LocateSerialIo (
         &SerialIo->Mode->StopBits,\r
         sizeof (UINT8)\r
         );\r
+\r
+      NewTerminalContext->FlowControl = 0;\r
+      SerialIo->GetControl(SerialIo, &FlowControl);\r
+      if ((FlowControl & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) != 0) {\r
+        NewTerminalContext->FlowControl = UART_FLOW_CONTROL_HARDWARE;\r
+      }\r
+\r
       InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);\r
       TerminalMenu.MenuNumber++;\r
     }\r
@@ -570,7 +627,10 @@ UpdateComAttributeFromVariable (
   BM_MENU_ENTRY             *NewMenuEntry;\r
   BM_TERMINAL_CONTEXT       *NewTerminalContext;\r
   UINTN                     Index;\r
+  UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;\r
+  BOOLEAN                   HasFlowControlNode;\r
 \r
+  HasFlowControlNode = FALSE;\r
   Node            = DevicePath;\r
   Node            = NextDevicePathNode (Node);\r
   TerminalNumber  = 0;\r
@@ -613,6 +673,17 @@ UpdateComAttributeFromVariable (
           sizeof (UINT8)\r
           );\r
 \r
+        FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Node);\r
+        if (IsUartFlowControlNode (FlowControlNode)) {\r
+          HasFlowControlNode = TRUE;\r
+          NewTerminalContext->FlowControl = (UINT8) ReadUnaligned32 (&FlowControlNode->FlowControlMap);\r
+        } else if (NewTerminalContext->FlowControl != 0) {\r
+          //\r
+          // No Flow Control device path node, assumption no Flow control\r
+          //\r
+          NewTerminalContext->FlowControl = 0;\r
+        }\r
+\r
         SerialNode  = NewTerminalContext->DevicePath;\r
         SerialNode  = NextDevicePathNode (SerialNode);\r
         while (!IsDevicePathEnd (SerialNode)) {\r
@@ -644,6 +715,18 @@ UpdateComAttributeFromVariable (
               sizeof (UINT8)\r
               );\r
 \r
+            FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (SerialNode);\r
+            if (IsUartFlowControlNode (FlowControlNode)) {\r
+              FlowControlNode->FlowControlMap = NewTerminalContext->FlowControl;\r
+            } else {\r
+              if (HasFlowControlNode) {\r
+                mFlowControlDevicePath.FlowControlMap = NewTerminalContext->FlowControl;\r
+                NewTerminalContext->DevicePath = AppendDevicePathNode (\r
+                                             NewTerminalContext->DevicePath,\r
+                                             (EFI_DEVICE_PATH_PROTOCOL *) (&mFlowControlDevicePath)\r
+                                             );\r
+              }\r
+            }\r
             break;\r
           }\r
 \r
index b4d33d035b8f773fe60c71f4b9775a6e7a7da6ff..0a3ffbcc306a9e28e6f3b3ae728d2b4703d20f3c 100644 (file)
@@ -37,6 +37,19 @@ UINT16              TerminalType[] = {
   STRING_TOKEN(STR_COM_TYPE_3),\r
 };\r
 \r
+///\r
+/// Flow Control type string token storage\r
+///\r
+UINT16              mFlowControlType[2] = {\r
+  STRING_TOKEN(STR_NONE_FLOW_CONTROL),\r
+  STRING_TOKEN(STR_HARDWARE_FLOW_CONTROL)\r
+};\r
+\r
+UINT32              mFlowControlValue[2] = {\r
+  0,\r
+  UART_FLOW_CONTROL_HARDWARE\r
+};\r
+\r
 ///\r
 /// File system selection menu\r
 ///\r
index 71c59762d7f9426dd37fdeaceebada4f40521837..d55981ca2007c8da6e2153f8f869e2141857d063 100644 (file)
@@ -165,6 +165,7 @@ typedef struct {
   UINT8   COMStopBits;\r
   UINT8   COMParity;\r
   UINT8   COMTerminalType;\r
+  UINT8   COMFlowControl;\r
 \r
   //\r
   // Legacy Device Order Selection Storage\r
index aaa33600426bc36aa83690ca647c46414b98983a..ece88524cbd0729f4d1a675ff8d8e3cd62d7ef49 100644 (file)
@@ -1076,6 +1076,34 @@ UpdateTerminalPage (
     NULL\r
     );\r
 \r
+  HiiFreeOpCodeHandle (OptionsOpCodeHandle);\r
+  OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();\r
+  ASSERT (OptionsOpCodeHandle != NULL);\r
+\r
+  CallbackData->BmmFakeNvData.COMFlowControl = NewTerminalContext->FlowControl;\r
+  for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {\r
+    HiiCreateOneOfOptionOpCode (\r
+      OptionsOpCodeHandle,\r
+      (EFI_STRING_ID) mFlowControlType[Index],\r
+      0,\r
+      EFI_IFR_TYPE_NUM_SIZE_8,\r
+      mFlowControlValue[Index]\r
+      );\r
+  }\r
+\r
+  HiiCreateOneOfOpCode (\r
+    mStartOpCodeHandle,\r
+    (EFI_QUESTION_ID) COM_FLOWCONTROL_QUESTION_ID,\r
+    VARSTORE_ID_BOOT_MAINT,\r
+    COM_FLOWCONTROL_VAR_OFFSET,\r
+    STRING_TOKEN (STR_COM_FLOW_CONTROL),\r
+    STRING_TOKEN (STR_COM_FLOW_CONTROL),\r
+    0,\r
+    EFI_IFR_NUMERIC_SIZE_1,\r
+    OptionsOpCodeHandle,\r
+    NULL\r
+    );\r
+\r
   HiiFreeOpCodeHandle (OptionsOpCodeHandle);\r
 \r
   UpdatePageEnd (CallbackData);\r
index 579036fff3028a2a11f5880c39f68f65beda0e23..cf5d295c84b0bc75eefcd1b7c2f07e741a3f5b97 100644 (file)
@@ -449,7 +449,7 @@ Var_UpdateConsoleOption (
                             (EFI_DEVICE_PATH_PROTOCOL *) &Vendor\r
                             );\r
       ASSERT (TerminalDevicePath != NULL);\r
-      ChangeTerminalDevicePath (TerminalDevicePath, TRUE);\r
+      ChangeTerminalDevicePath (&TerminalDevicePath, TRUE);\r
       ConDevicePath = AppendDevicePathInstance (\r
                         ConDevicePath,\r
                         TerminalDevicePath\r