mirror of https://github.com/acidanthera/audk.git
Enhance BMM to support changing FlowControl setting in Front Page.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11317 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
ad0ecbcf79
commit
8e491a81e0
Binary file not shown.
|
@ -742,9 +742,10 @@ ApplyChangeHandler (
|
||||||
ASSERT (CurrentFakeNVMap->COMParity < (sizeof (ParityList) / sizeof (ParityList[0])));
|
ASSERT (CurrentFakeNVMap->COMParity < (sizeof (ParityList) / sizeof (ParityList[0])));
|
||||||
NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;
|
NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;
|
||||||
NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType;
|
NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType;
|
||||||
|
NewTerminalContext->FlowControl = CurrentFakeNVMap->COMFlowControl;
|
||||||
|
|
||||||
ChangeTerminalDevicePath (
|
ChangeTerminalDevicePath (
|
||||||
NewTerminalContext->DevicePath,
|
&(NewTerminalContext->DevicePath),
|
||||||
FALSE
|
FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,7 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
|
||||||
#define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
|
#define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
|
||||||
#define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
|
#define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
|
||||||
#define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
|
#define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
|
||||||
|
#define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)
|
||||||
#define LEGACY_FD_VAR_OFFSET VAR_OFFSET (LegacyFD)
|
#define LEGACY_FD_VAR_OFFSET VAR_OFFSET (LegacyFD)
|
||||||
#define LEGACY_HD_VAR_OFFSET VAR_OFFSET (LegacyHD)
|
#define LEGACY_HD_VAR_OFFSET VAR_OFFSET (LegacyHD)
|
||||||
#define LEGACY_CD_VAR_OFFSET VAR_OFFSET (LegacyCD)
|
#define LEGACY_CD_VAR_OFFSET VAR_OFFSET (LegacyCD)
|
||||||
|
@ -233,6 +234,7 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
|
||||||
#define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
|
#define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
|
||||||
#define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
|
#define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
|
||||||
#define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
|
#define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
|
||||||
|
#define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)
|
||||||
#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
|
#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
|
||||||
#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
|
#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
|
||||||
#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
|
#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
|
||||||
|
@ -283,6 +285,8 @@ typedef struct {
|
||||||
UINT8 ParityIndex;
|
UINT8 ParityIndex;
|
||||||
UINT8 StopBitsIndex;
|
UINT8 StopBitsIndex;
|
||||||
|
|
||||||
|
UINT8 FlowControl;
|
||||||
|
|
||||||
UINT8 IsConIn;
|
UINT8 IsConIn;
|
||||||
UINT8 IsConOut;
|
UINT8 IsConOut;
|
||||||
UINT8 IsStdErr;
|
UINT8 IsStdErr;
|
||||||
|
@ -757,7 +761,7 @@ ChangeVariableDevicePath (
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ChangeTerminalDevicePath (
|
ChangeTerminalDevicePath (
|
||||||
IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
IN BOOLEAN ChangeTerminal
|
IN BOOLEAN ChangeTerminal
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1563,7 +1567,8 @@ extern STRING_DEPOSITORY *DriverOptionHelpStrDepository;
|
||||||
extern STRING_DEPOSITORY *TerminalStrDepository;
|
extern STRING_DEPOSITORY *TerminalStrDepository;
|
||||||
extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
|
extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
|
||||||
extern EFI_GUID EfiLegacyDevOrderGuid;
|
extern EFI_GUID EfiLegacyDevOrderGuid;
|
||||||
|
extern UINT16 mFlowControlType[2];
|
||||||
|
extern UINT32 mFlowControlValue[2];
|
||||||
//
|
//
|
||||||
// Shared IFR form update data
|
// Shared IFR form update data
|
||||||
//
|
//
|
||||||
|
|
|
@ -14,6 +14,37 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
#include "BootMaint.h"
|
#include "BootMaint.h"
|
||||||
|
|
||||||
|
UART_FLOW_CONTROL_DEVICE_PATH mFlowControlDevicePath =
|
||||||
|
{
|
||||||
|
MESSAGING_DEVICE_PATH,
|
||||||
|
MSG_VENDOR_DP,
|
||||||
|
(UINT8)(sizeof(UART_FLOW_CONTROL_DEVICE_PATH)),
|
||||||
|
(UINT8)((sizeof(UART_FLOW_CONTROL_DEVICE_PATH)) >> 8),
|
||||||
|
DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL,
|
||||||
|
UART_FLOW_CONTROL_HARDWARE
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check the device path node whether it's the Flow Control node or not.
|
||||||
|
|
||||||
|
@param[in] FlowControl The device path node to be checked.
|
||||||
|
|
||||||
|
@retval TRUE It's the Flow Control node.
|
||||||
|
@retval FALSE It's not.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsUartFlowControlNode (
|
||||||
|
IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (BOOLEAN) (
|
||||||
|
(DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&
|
||||||
|
(DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&
|
||||||
|
(CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether the device path node is ISA Serial Node.
|
Check whether the device path node is ISA Serial Node.
|
||||||
|
|
||||||
|
@ -62,7 +93,7 @@ UpdateComAttributeFromVariable (
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ChangeTerminalDevicePath (
|
ChangeTerminalDevicePath (
|
||||||
IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
IN BOOLEAN ChangeTerminal
|
IN BOOLEAN ChangeTerminal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -74,8 +105,9 @@ ChangeTerminalDevicePath (
|
||||||
UINTN Com;
|
UINTN Com;
|
||||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||||
BM_MENU_ENTRY *NewMenuEntry;
|
BM_MENU_ENTRY *NewMenuEntry;
|
||||||
|
UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
|
||||||
|
|
||||||
Node = DevicePath;
|
Node = *DevicePath;
|
||||||
Node = NextDevicePathNode (Node);
|
Node = NextDevicePathNode (Node);
|
||||||
Com = 0;
|
Com = 0;
|
||||||
while (!IsDevicePathEnd (Node)) {
|
while (!IsDevicePathEnd (Node)) {
|
||||||
|
@ -112,6 +144,23 @@ ChangeTerminalDevicePath (
|
||||||
&NewTerminalContext->StopBits,
|
&NewTerminalContext->StopBits,
|
||||||
sizeof (UINT8)
|
sizeof (UINT8)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Node);
|
||||||
|
if (IsUartFlowControlNode (FlowControlNode)) {
|
||||||
|
FlowControlNode->FlowControlMap = NewTerminalContext->FlowControl;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Append the Flow control device node when user enable flow control.
|
||||||
|
//
|
||||||
|
if (NewTerminalContext->FlowControl != 0) {
|
||||||
|
mFlowControlDevicePath.FlowControlMap = NewTerminalContext->FlowControl;
|
||||||
|
*DevicePath = AppendDevicePathNode (
|
||||||
|
*DevicePath,
|
||||||
|
(EFI_DEVICE_PATH_PROTOCOL *) (&mFlowControlDevicePath)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Change the device path in the ComPort
|
// Change the device path in the ComPort
|
||||||
//
|
//
|
||||||
|
@ -372,6 +421,7 @@ LocateSerialIo (
|
||||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||||
VENDOR_DEVICE_PATH Vendor;
|
VENDOR_DEVICE_PATH Vendor;
|
||||||
|
UINT32 FlowControl;
|
||||||
//
|
//
|
||||||
// Get all handles that have SerialIo protocol installed
|
// Get all handles that have SerialIo protocol installed
|
||||||
//
|
//
|
||||||
|
@ -470,6 +520,13 @@ LocateSerialIo (
|
||||||
&SerialIo->Mode->StopBits,
|
&SerialIo->Mode->StopBits,
|
||||||
sizeof (UINT8)
|
sizeof (UINT8)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NewTerminalContext->FlowControl = 0;
|
||||||
|
SerialIo->GetControl(SerialIo, &FlowControl);
|
||||||
|
if ((FlowControl & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) != 0) {
|
||||||
|
NewTerminalContext->FlowControl = UART_FLOW_CONTROL_HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);
|
InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);
|
||||||
TerminalMenu.MenuNumber++;
|
TerminalMenu.MenuNumber++;
|
||||||
}
|
}
|
||||||
|
@ -570,7 +627,10 @@ UpdateComAttributeFromVariable (
|
||||||
BM_MENU_ENTRY *NewMenuEntry;
|
BM_MENU_ENTRY *NewMenuEntry;
|
||||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
|
||||||
|
BOOLEAN HasFlowControlNode;
|
||||||
|
|
||||||
|
HasFlowControlNode = FALSE;
|
||||||
Node = DevicePath;
|
Node = DevicePath;
|
||||||
Node = NextDevicePathNode (Node);
|
Node = NextDevicePathNode (Node);
|
||||||
TerminalNumber = 0;
|
TerminalNumber = 0;
|
||||||
|
@ -613,6 +673,17 @@ UpdateComAttributeFromVariable (
|
||||||
sizeof (UINT8)
|
sizeof (UINT8)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Node);
|
||||||
|
if (IsUartFlowControlNode (FlowControlNode)) {
|
||||||
|
HasFlowControlNode = TRUE;
|
||||||
|
NewTerminalContext->FlowControl = (UINT8) ReadUnaligned32 (&FlowControlNode->FlowControlMap);
|
||||||
|
} else if (NewTerminalContext->FlowControl != 0) {
|
||||||
|
//
|
||||||
|
// No Flow Control device path node, assumption no Flow control
|
||||||
|
//
|
||||||
|
NewTerminalContext->FlowControl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
SerialNode = NewTerminalContext->DevicePath;
|
SerialNode = NewTerminalContext->DevicePath;
|
||||||
SerialNode = NextDevicePathNode (SerialNode);
|
SerialNode = NextDevicePathNode (SerialNode);
|
||||||
while (!IsDevicePathEnd (SerialNode)) {
|
while (!IsDevicePathEnd (SerialNode)) {
|
||||||
|
@ -644,6 +715,18 @@ UpdateComAttributeFromVariable (
|
||||||
sizeof (UINT8)
|
sizeof (UINT8)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (SerialNode);
|
||||||
|
if (IsUartFlowControlNode (FlowControlNode)) {
|
||||||
|
FlowControlNode->FlowControlMap = NewTerminalContext->FlowControl;
|
||||||
|
} else {
|
||||||
|
if (HasFlowControlNode) {
|
||||||
|
mFlowControlDevicePath.FlowControlMap = NewTerminalContext->FlowControl;
|
||||||
|
NewTerminalContext->DevicePath = AppendDevicePathNode (
|
||||||
|
NewTerminalContext->DevicePath,
|
||||||
|
(EFI_DEVICE_PATH_PROTOCOL *) (&mFlowControlDevicePath)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,19 @@ UINT16 TerminalType[] = {
|
||||||
STRING_TOKEN(STR_COM_TYPE_3),
|
STRING_TOKEN(STR_COM_TYPE_3),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Flow Control type string token storage
|
||||||
|
///
|
||||||
|
UINT16 mFlowControlType[2] = {
|
||||||
|
STRING_TOKEN(STR_NONE_FLOW_CONTROL),
|
||||||
|
STRING_TOKEN(STR_HARDWARE_FLOW_CONTROL)
|
||||||
|
};
|
||||||
|
|
||||||
|
UINT32 mFlowControlValue[2] = {
|
||||||
|
0,
|
||||||
|
UART_FLOW_CONTROL_HARDWARE
|
||||||
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
/// File system selection menu
|
/// File system selection menu
|
||||||
///
|
///
|
||||||
|
|
|
@ -165,6 +165,7 @@ typedef struct {
|
||||||
UINT8 COMStopBits;
|
UINT8 COMStopBits;
|
||||||
UINT8 COMParity;
|
UINT8 COMParity;
|
||||||
UINT8 COMTerminalType;
|
UINT8 COMTerminalType;
|
||||||
|
UINT8 COMFlowControl;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Legacy Device Order Selection Storage
|
// Legacy Device Order Selection Storage
|
||||||
|
|
|
@ -1076,6 +1076,34 @@ UpdateTerminalPage (
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
HiiFreeOpCodeHandle (OptionsOpCodeHandle);
|
||||||
|
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
||||||
|
ASSERT (OptionsOpCodeHandle != NULL);
|
||||||
|
|
||||||
|
CallbackData->BmmFakeNvData.COMFlowControl = NewTerminalContext->FlowControl;
|
||||||
|
for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {
|
||||||
|
HiiCreateOneOfOptionOpCode (
|
||||||
|
OptionsOpCodeHandle,
|
||||||
|
(EFI_STRING_ID) mFlowControlType[Index],
|
||||||
|
0,
|
||||||
|
EFI_IFR_TYPE_NUM_SIZE_8,
|
||||||
|
mFlowControlValue[Index]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
HiiCreateOneOfOpCode (
|
||||||
|
mStartOpCodeHandle,
|
||||||
|
(EFI_QUESTION_ID) COM_FLOWCONTROL_QUESTION_ID,
|
||||||
|
VARSTORE_ID_BOOT_MAINT,
|
||||||
|
COM_FLOWCONTROL_VAR_OFFSET,
|
||||||
|
STRING_TOKEN (STR_COM_FLOW_CONTROL),
|
||||||
|
STRING_TOKEN (STR_COM_FLOW_CONTROL),
|
||||||
|
0,
|
||||||
|
EFI_IFR_NUMERIC_SIZE_1,
|
||||||
|
OptionsOpCodeHandle,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
HiiFreeOpCodeHandle (OptionsOpCodeHandle);
|
HiiFreeOpCodeHandle (OptionsOpCodeHandle);
|
||||||
|
|
||||||
UpdatePageEnd (CallbackData);
|
UpdatePageEnd (CallbackData);
|
||||||
|
|
|
@ -449,7 +449,7 @@ Var_UpdateConsoleOption (
|
||||||
(EFI_DEVICE_PATH_PROTOCOL *) &Vendor
|
(EFI_DEVICE_PATH_PROTOCOL *) &Vendor
|
||||||
);
|
);
|
||||||
ASSERT (TerminalDevicePath != NULL);
|
ASSERT (TerminalDevicePath != NULL);
|
||||||
ChangeTerminalDevicePath (TerminalDevicePath, TRUE);
|
ChangeTerminalDevicePath (&TerminalDevicePath, TRUE);
|
||||||
ConDevicePath = AppendDevicePathInstance (
|
ConDevicePath = AppendDevicePathInstance (
|
||||||
ConDevicePath,
|
ConDevicePath,
|
||||||
TerminalDevicePath
|
TerminalDevicePath
|
||||||
|
|
Loading…
Reference in New Issue