mirror of
https://github.com/Dasharo/edk2.git
synced 2026-06-13 10:16:24 -07:00
ArmPlatformPkg/PL011UartLib : Fix SetControl() SCT conformance
REF: pftf/RPi4#87 The PL011UartLib SetControl() is failing the SCT test for SerialIoBBTestConformance (00605CBC-3965-4B61-A254-2B2B723172EA), which is trying to set bits that are not supported per UEFI spec. Add proper argument check for valid bits, and confirm that test passes. Cc: Leif Lindholm <leif.lindholm@oss.qualcomm.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
This commit is contained in:
committed by
mergify[bot]
parent
cf513a57cc
commit
e092122653
@@ -22,10 +22,22 @@
|
||||
#define FRACTION_PART_MASK ((1 << FRACTION_PART_SIZE_IN_BITS) - 1)
|
||||
|
||||
//
|
||||
// EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE is the only
|
||||
// control bit that is not supported.
|
||||
// Per UEFI spec, only these control bits are allowed to be set.
|
||||
//
|
||||
STATIC CONST UINT32 mInvalidControlBits = EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
|
||||
STATIC CONST UINT32 mAllowedControlBits =
|
||||
EFI_SERIAL_CLEAR_TO_SEND |
|
||||
EFI_SERIAL_DATA_SET_READY |
|
||||
EFI_SERIAL_RING_INDICATE |
|
||||
EFI_SERIAL_CARRIER_DETECT |
|
||||
EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
|
||||
EFI_SERIAL_OUTPUT_BUFFER_EMPTY |
|
||||
EFI_SERIAL_INPUT_BUFFER_EMPTY;
|
||||
|
||||
//
|
||||
// platform-specific bits that are not supported by this device.
|
||||
//
|
||||
STATIC CONST UINT32 mPlatformInvalidControlBits =
|
||||
EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
|
||||
|
||||
/**
|
||||
|
||||
@@ -274,7 +286,11 @@ PL011UartSetControl (
|
||||
{
|
||||
UINT32 Bits;
|
||||
|
||||
if ((Control & mInvalidControlBits) != 0) {
|
||||
if ((Control & ~mAllowedControlBits) != 0) {
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if ((Control & mPlatformInvalidControlBits) != 0) {
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user