Console Variable fix for TestPointCheckLib#918
Console Variable fix for TestPointCheckLib#918shkrc wants to merge 1 commit intotianocore:masterfrom
Conversation
ConInDev, ConOutDev & ErrOutDev variables have list of device paths which have terminal console devices appended at the end. For only the user selected terminal type, the device path will have the necessary protocols installed at any point in time. TestPointCheckLib tries to discover these non existing terminal types and reports as an error. This patch fixes this by checking if the device path is a terminal type, and if so, then ignore the terminal node and only check for the existence of the parent path. Signed-off-by: Shankar C <shankar.c@amd.com>
|
@niruiyu requesting your reviews |
| for (Index = 0; Index < ARRAY_SIZE (mTerminalGuids); Index++) { | ||
| if (CompareGuid (&((VENDOR_DEVICE_PATH *)Node)->Guid, mTerminalGuids[Index])) { | ||
| return TRUE; | ||
| } | ||
| } |
There was a problem hiding this comment.
How about returning TRUE without checking the Guid?
Then the logic would support any future extension of new terminal types.
There was a problem hiding this comment.
Hi @niruiyu , i guess we need to check for the guids, because we are ignoring the child nodes only in the cases where the devices path is of a terminal device, for other cases, we dont need to ignore the child nodes. Hence, I think its better to define the terminal types
niruiyu
left a comment
There was a problem hiding this comment.
Can you check if the following logic works also?
I think it's simpler than the original logic.
BOOLEAN
IsDevicePathExist (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance;
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
EFI_DEVICE_PATH_PROTOCOL *RemainingNode;
EFI_HANDLE Handle;
BOOLEAN Exist;
Exist = FALSE;
RemainingDevicePath = DevicePath;
do {
DevicePathInstance = GetNextDevicePathInstance (&RemainingDevicePath, &Size);
//
// RemainingDevicePath points to the next instance.
// DevicePathInstance points to a copy of the current instance.
//
if (DevicePathInstance == NULL) {
break;
}
Exist = FALSE;
RemainingNode = DevicePathInstance;
Status = gBS->LocateDevicePath (
&gEfiDevicePathProtocolGuid,
&RemainingNode,
&Handle
);
if (!EFI_ERROR (Status) && (IsDevicePathEnd (RemainingNode) || IsTerminalVendorNode (RemainingNode))) {
//
// A handle is found whose device path
// either equals to the DevicePathInstance (when IsDevicePathEnd() is TRUE)
// or equals to the DevicePathInstance - TerminalNode (when IsTerminalVendorNode() is TRUE)
//
Exist = TRUE;
}
FreePool (DevicePathInstance);
} while (Exist && RemainingDevicePath!= NULL);
return Exist;
}|
Hi with the above code suggestion, the issue I see only IsDevicePathNodeExist() does the validation whether the device actually exists. In your suggestion |
ConInDev, ConOutDev & ErrOutDev variables have list of device paths which have terminal console devices appended at the end. For only the user selected terminal type, the device path will have the necessary protocols installed at any point in time. TestPointCheckLib tries to discover these non existing terminal types and reports as an error. This patch fixes this by checking if the device path is a terminal type, and if so, then ignore the terminal node and only check for the existence of the parent path.