+ EFI_STATUS Status;\r
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
+ EFI_WIN_NT_IO_PROTOCOL *WinNtIo;\r
+ UART_DEVICE_PATH *UartNode;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;\r
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;\r
+ UINTN EntryCount;\r
+ UINTN Index;\r
+ BOOLEAN RemainingDevicePathContainsFlowControl; \r
+\r
+ //\r
+ // Check RemainingDevicePath validation\r
+ //\r
+ if (RemainingDevicePath != NULL) {\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, go on checking other conditions\r
+ //\r
+ if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+ //\r
+ // If RemainingDevicePath isn't the End of Device Path Node,\r
+ // check its validation\r
+ //\r
+ Status = EFI_UNSUPPORTED;\r
+\r
+ UartNode = (UART_DEVICE_PATH *) RemainingDevicePath;\r
+ if (UartNode->Header.Type != MESSAGING_DEVICE_PATH ||\r
+ UartNode->Header.SubType != MSG_UART_DP ||\r
+ DevicePathNodeLength((EFI_DEVICE_PATH_PROTOCOL *)UartNode) != sizeof(UART_DEVICE_PATH)) {\r
+ goto Error;\r
+ }\r
+ if ( UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) {\r
+ goto Error;\r
+ }\r
+ if (UartNode->Parity < NoParity || UartNode->Parity > SpaceParity) {\r
+ goto Error;\r
+ }\r
+ if (UartNode->DataBits < 5 || UartNode->DataBits > 8) {\r
+ goto Error;\r
+ }\r
+ if (UartNode->StopBits < OneStopBit || UartNode->StopBits > TwoStopBits) {\r
+ goto Error;\r
+ }\r
+ if ((UartNode->DataBits == 5) && (UartNode->StopBits == TwoStopBits)) {\r
+ goto Error;\r
+ }\r
+ if ((UartNode->DataBits >= 6) && (UartNode->DataBits <= 8) && (UartNode->StopBits == OneFiveStopBits)) {\r
+ goto Error;\r
+ }\r
+\r
+ FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (UartNode);\r
+ if (IsUartFlowControlNode (FlowControlNode)) {\r
+ //\r
+ // If the second node is Flow Control Node,\r
+ // return error when it request other than hardware flow control.\r
+ //\r
+ if ((FlowControlNode->FlowControlMap & ~UART_FLOW_CONTROL_HARDWARE) != 0) {\r
+ goto Error;\r
+ }\r
+ }\r
+ }\r
+ }\r