From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=eric.jin@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 175D221167446 for ; Thu, 11 Oct 2018 21:57:21 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 21:57:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,371,1534834800"; d="scan'208";a="271744255" Received: from shwdeopenpsi175.ccr.corp.intel.com ([10.239.9.140]) by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2018 21:57:20 -0700 From: Eric Jin To: edk2-devel@lists.01.org Cc: Supreeth Venkatesh , Jiaxin Wu Date: Fri, 12 Oct 2018 12:57:14 +0800 Message-Id: <20181012045714.12968-1-eric.jin@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 Subject: [edk2-test][Patch] uefi-sct\SctPkg: Add TPL Check in SimpleTextIn/SimpleTextInEx X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2018 04:57:22 -0000 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Jin Cc: Supreeth Venkatesh Cc: Jiaxin Wu --- .../BlackBoxTest/SimpleTextInBBTestFunction.c | 186 ++++++++++++-------- .../SimpleTextInputExBBTestConformance.c | 190 ++++++++++++++++++-- .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 66 +++++-- .../BlackBoxTest/SimpleTextInBBTestFunction.c | 186 ++++++++++++-------- .../SimpleTextInputExBBTestConformance.c | 192 +++++++++++++++++++-- .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 70 ++++++-- 6 files changed, 681 insertions(+), 209 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c index 284d2c7..f062101 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -59,6 +59,7 @@ BBTestResetFunctionAutoTest ( UINTN Index; EFI_INPUT_KEY Key; + EFI_TPL OldTpl; // // Get the Standard Library Interface @@ -136,83 +137,122 @@ BBTestResetFunctionAutoTest ( // // Call SimpleTextIn.Reset() with ExtendedVerification as FALSE // - Status = SimpleIn->Reset (SimpleIn, FALSE); - if (EFI_ERROR(Status)) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->Reset (SimpleIn, FALSE); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->Reset (SimpleIn, FALSE); + } + if (EFI_ERROR(Status)) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid001, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE", + L"%a:%d: Status = %r", + __FILE__, + (UINTN)__LINE__, + Status + ); } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid001, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE", - L"%a:%d: Status = %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - // - //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY - // - Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); - - if (Status != EFI_NOT_READY) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid012, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE, ReadKeyStroke() verification with no key input", - L"%a:%d: Status = %r, Expected = %r", - __FILE__, - (UINTN)__LINE__, - Status, - EFI_NOT_READY - ); + // + //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + } + if (Status != EFI_NOT_READY) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid012, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE, ReadKeyStroke() verification with no key input", + L"%a:%d: Status = %r, Expected = %r", + __FILE__, + (UINTN)__LINE__, + Status, + EFI_NOT_READY + ); + } // // Call SimpleTextIn.Reset() with ExtendedVerification as TRUE // - Status = SimpleIn->Reset (SimpleIn, TRUE); - if (EFI_ERROR(Status)) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->Reset (SimpleIn, TRUE); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->Reset (SimpleIn, TRUE); + } + if (EFI_ERROR(Status)) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid002, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE", + L"%a:%d: Status = %r", + __FILE__, + (UINTN)__LINE__, + Status + ); } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid002, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE", - L"%a:%d: Status = %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - // - //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY - // - Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); - - if (Status!=EFI_NOT_READY) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid013, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE, ReadKeyStroke() verification with no key input", - L"%a:%d: Status = %r, Expected = %r", - __FILE__, - (UINTN)__LINE__, - Status, - EFI_NOT_READY - ); + + // + //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + } + if (Status != EFI_NOT_READY) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid013, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE, ReadKeyStroke() verification with no key input", + L"%a:%d: Status = %r, Expected = %r", + __FILE__, + (UINTN)__LINE__, + Status, + EFI_NOT_READY + ); + } } return EFI_SUCCESS; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c index 04cbc6a..d997b65 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -338,6 +338,7 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint1 ( { EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; + EFI_TPL OldTpl; // //Call Reset to reset to console @@ -350,11 +351,25 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint1 ( // //Call ReadKeyStrokeEx with KeyData being NULL // - Status = SimpleTextInputEx->ReadKeyStrokeEx ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleTextInputEx->ReadKeyStrokeEx ( SimpleTextInputEx, NULL ); - + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx, + NULL + ); + } + } + if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; } else { @@ -384,6 +399,7 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint2 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; + EFI_TPL OldTpl; // //Call Reset to reset to console @@ -396,10 +412,24 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint2 ( // //Call ReadKeyStrokeEx with console just been reseted // - Status = SimpleTextInputEx->ReadKeyStrokeEx ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx, + &Key + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->ReadKeyStrokeEx ( SimpleTextInputEx, &Key ); + } + } if ( EFI_NOT_READY != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -429,14 +459,30 @@ BBTestSetStateConformanceTestCheckpoint1 ( { EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; + EFI_TPL OldTpl; // //Call SetState with KeyToggleState being NULL // - Status = SimpleTextInputEx-> SetState ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->SetState ( SimpleTextInputEx, NULL ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->SetState ( + SimpleTextInputEx, + NULL + ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -467,6 +513,7 @@ BBTestSetStateConformanceTestCheckpoint2 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; UINTN Index; + EFI_TPL OldTpl; EFI_KEY_TOGGLE_STATE UnsupportedState[] = { EFI_SCROLL_LOCK_ACTIVE, @@ -491,10 +538,25 @@ BBTestSetStateConformanceTestCheckpoint2 ( //Call SetState with KeyToggleState being a unsupported bit set // for ( Index=0; UnsupportedState[Index]; Index++ ) { - Status = SimpleTextInputEx->SetState ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->SetState ( + SimpleTextInputEx, + UnsupportedState+Index + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->SetState ( SimpleTextInputEx, UnsupportedState+Index ); + } + } if ( EFI_UNSUPPORTED != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -526,18 +588,35 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint1 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; VOID *NotifyHandle; - + EFI_TPL OldTpl; // //Call RegisterKeyNotify with KeyData being NULL // - Status = SimpleTextInputEx-> RegisterKeyNotify ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->RegisterKeyNotify ( SimpleTextInputEx, NULL, TestRegisterNotifyFunction, &NotifyHandle ); - + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->RegisterKeyNotify ( + SimpleTextInputEx, + NULL, + TestRegisterNotifyFunction, + &NotifyHandle + ); + } + } + if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; } else { @@ -568,6 +647,7 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint2 ( EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; VOID *NotifyHandle; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -575,12 +655,29 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint2 ( // //Call RegisterKeyNotify with KeyNotificationFunction being NULL // - Status = SimpleTextInputEx-> RegisterKeyNotify ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> RegisterKeyNotify ( + SimpleTextInputEx, + &Key, + NULL, + &NotifyHandle + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> RegisterKeyNotify ( SimpleTextInputEx, &Key, NULL, &NotifyHandle ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -611,6 +708,7 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint3 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -618,12 +716,28 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint3 ( // //Call RegisterKeyNotify with NotifyHandle being NULL // - Status = SimpleTextInputEx-> RegisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> RegisterKeyNotify ( SimpleTextInputEx, &Key, TestRegisterNotifyFunction, NULL ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> RegisterKeyNotify ( + SimpleTextInputEx, + &Key, + TestRegisterNotifyFunction, + NULL + ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -653,14 +767,29 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint1 ( { EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; + EFI_TPL OldTpl; // //Call UnregisterKeyNotify with NotifyHandle being NULL // - Status = SimpleTextInputEx-> UnregisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> UnregisterKeyNotify ( + SimpleTextInputEx, + NULL + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> UnregisterKeyNotify ( SimpleTextInputEx, NULL ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -692,6 +821,7 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint2 ( EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; VOID *NotifyHandle; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -723,11 +853,25 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint2 ( // //Call UnregisterKeyNotify with the invalid NotifyHandle // - Status = SimpleTextInputEx-> UnregisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->UnregisterKeyNotify ( SimpleTextInputEx, NotifyHandle ); - + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->UnregisterKeyNotify ( + SimpleTextInputEx, + NotifyHandle + ); + } + } + // // Invalid Parameter or Not Found // @@ -762,6 +906,7 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint3 ( EFI_KEY_DATA Key; VOID *NotifyHandle; VOID *InvalidNotifyHandle; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -798,10 +943,25 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint3 ( // //Call UnregisterKeyNotify with NotifyHandle with a illegal format // - Status = SimpleTextInputEx-> UnregisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> UnregisterKeyNotify ( SimpleTextInputEx, InvalidNotifyHandle ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> UnregisterKeyNotify ( + SimpleTextInputEx, + InvalidNotifyHandle + ); + } + } + if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c index e2b2f45..153ade0 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -471,6 +471,8 @@ BBTestResetFunctionAutoTestCheckpoint1 ( UINTN Index; UINTN ExtendedIndex; EFI_KEY_DATA Key; + EFI_TPL OldTpl; + BOOLEAN ExtendedVerification[] = { TRUE, FALSE @@ -478,33 +480,67 @@ BBTestResetFunctionAutoTestCheckpoint1 ( ResetStatus = EFI_SUCCESS; ReadKeyStatus = EFI_NOT_READY; + // // Call Reset with ExtendedVerification being TRUE or FALSE // for ( ExtendedIndex=0; ExtendedIndex<2; ExtendedIndex++ ) { AssertionType = EFI_TEST_ASSERTION_PASSED; for ( Index=0; IndexReset ( + // + //Call Reset to reset to console + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + ResetStatus = SimpleTextInputEx->Reset ( SimpleTextInputEx, ExtendedVerification[ExtendedIndex] ); - if ( EFI_SUCCESS != ResetStatus ) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - break; + gtBS->RestoreTPL (OldTpl); + } else { + ResetStatus = SimpleTextInputEx->Reset ( + SimpleTextInputEx, + ExtendedVerification[ExtendedIndex] + ); + } + + + if ( EFI_SUCCESS != ResetStatus ) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + break; + } } - // - //Call ReadKeyStrokeEx to check if the console has been reset - // - ReadKeyStatus = SimpleTextInputEx->ReadKeyStrokeEx ( + + // + //Call ReadKeyStrokeEx to check if the console has been reset + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + ReadKeyStatus = SimpleTextInputEx->ReadKeyStrokeEx ( SimpleTextInputEx, &Key ); - if ( EFI_NOT_READY != ReadKeyStatus ) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - break; + gtBS->RestoreTPL (OldTpl); + } else { + ReadKeyStatus = SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx, + &Key + ); + } + + + if ( EFI_NOT_READY != ReadKeyStatus ) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + break; + } } } diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c index 284d2c7..ee1173d 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -59,6 +59,7 @@ BBTestResetFunctionAutoTest ( UINTN Index; EFI_INPUT_KEY Key; + EFI_TPL OldTpl; // // Get the Standard Library Interface @@ -136,83 +137,122 @@ BBTestResetFunctionAutoTest ( // // Call SimpleTextIn.Reset() with ExtendedVerification as FALSE // - Status = SimpleIn->Reset (SimpleIn, FALSE); - if (EFI_ERROR(Status)) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->Reset (SimpleIn, FALSE); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->Reset (SimpleIn, FALSE); + } + if (EFI_ERROR(Status)) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid001, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE", + L"%a:%d: Status = %r", + __FILE__, + (UINTN)__LINE__, + Status + ); } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid001, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE", - L"%a:%d: Status = %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - // - //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY - // - Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); - - if (Status != EFI_NOT_READY) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid012, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE, ReadKeyStroke() verification with no key input", - L"%a:%d: Status = %r, Expected = %r", - __FILE__, - (UINTN)__LINE__, - Status, - EFI_NOT_READY - ); + // + //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + } + if (Status != EFI_NOT_READY) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid012, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as FALSE, ReadKeyStroke() verification with no key input", + L"%a:%d: Status = %r, Expected = %r", + __FILE__, + (UINTN)__LINE__, + Status, + EFI_NOT_READY + ); + } // // Call SimpleTextIn.Reset() with ExtendedVerification as TRUE // - Status = SimpleIn->Reset (SimpleIn, TRUE); - if (EFI_ERROR(Status)) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->Reset (SimpleIn, TRUE); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->Reset (SimpleIn, TRUE); + } + if (EFI_ERROR(Status)) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid002, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE", + L"%a:%d: Status = %r", + __FILE__, + (UINTN)__LINE__, + Status + ); } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid002, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE", - L"%a:%d: Status = %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - // - //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY - // - Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); - - if (Status!=EFI_NOT_READY) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { - AssertionType = EFI_TEST_ASSERTION_PASSED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleTextInInterfaceTestAssertionGuid013, - L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE, ReadKeyStroke() verification with no key input", - L"%a:%d: Status = %r, Expected = %r", - __FILE__, - (UINTN)__LINE__, - Status, - EFI_NOT_READY - ); + + // + //Auto test, after reset(), no key input, ReadKeyStroke() should return EFI_NOT_READY + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleIn->ReadKeyStroke (SimpleIn, &Key); + } + if (Status != EFI_NOT_READY) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleTextInInterfaceTestAssertionGuid013, + L"EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset - Reset() with ExtendedVerification as TRUE, ReadKeyStroke() verification with no key input", + L"%a:%d: Status = %r, Expected = %r", + __FILE__, + (UINTN)__LINE__, + Status, + EFI_NOT_READY + ); + } } return EFI_SUCCESS; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c index 4f2a5e7..3e230f9 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -153,7 +153,7 @@ BBTestSetStateConformanceTest ( return Status; } BBTestSetStateConformanceTestCheckpoint2 ( StandardLib, SimpleTextInputEx ); - + Status = gtBS->FreePool (DevicePathStr); if (EFI_ERROR(Status)) return Status; @@ -338,6 +338,7 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint1 ( { EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; + EFI_TPL OldTpl; // //Call Reset to reset to console @@ -350,11 +351,25 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint1 ( // //Call ReadKeyStrokeEx with KeyData being NULL // - Status = SimpleTextInputEx->ReadKeyStrokeEx ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleTextInputEx->ReadKeyStrokeEx ( SimpleTextInputEx, NULL ); - + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx, + NULL + ); + } + } + if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; } else { @@ -384,6 +399,7 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint2 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; + EFI_TPL OldTpl; // //Call Reset to reset to console @@ -396,10 +412,24 @@ BBTestReadKeyStrokeExConformanceTestCheckpoint2 ( // //Call ReadKeyStrokeEx with console just been reseted // - Status = SimpleTextInputEx->ReadKeyStrokeEx ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + Status = SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx, + &Key + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->ReadKeyStrokeEx ( SimpleTextInputEx, &Key ); + } + } if ( EFI_NOT_READY != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -429,14 +459,30 @@ BBTestSetStateConformanceTestCheckpoint1 ( { EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; + EFI_TPL OldTpl; // //Call SetState with KeyToggleState being NULL // - Status = SimpleTextInputEx-> SetState ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->SetState ( + SimpleTextInputEx, + NULL + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->SetState ( SimpleTextInputEx, NULL ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -467,6 +513,7 @@ BBTestSetStateConformanceTestCheckpoint2 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; UINTN Index; + EFI_TPL OldTpl; EFI_KEY_TOGGLE_STATE UnsupportedState[] = { EFI_SCROLL_LOCK_ACTIVE, @@ -491,10 +538,25 @@ BBTestSetStateConformanceTestCheckpoint2 ( //Call SetState with KeyToggleState being a unsupported bit set // for ( Index=0; UnsupportedState[Index]; Index++ ) { - Status = SimpleTextInputEx->SetState ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->SetState ( + SimpleTextInputEx, + UnsupportedState+Index + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->SetState ( SimpleTextInputEx, UnsupportedState+Index ); + } + } if ( EFI_UNSUPPORTED != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -526,18 +588,35 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint1 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; VOID *NotifyHandle; - + EFI_TPL OldTpl; // //Call RegisterKeyNotify with KeyData being NULL // - Status = SimpleTextInputEx-> RegisterKeyNotify ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->RegisterKeyNotify ( SimpleTextInputEx, NULL, TestRegisterNotifyFunction, &NotifyHandle ); - + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->RegisterKeyNotify ( + SimpleTextInputEx, + NULL, + TestRegisterNotifyFunction, + &NotifyHandle + ); + } + } + if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; } else { @@ -568,6 +647,7 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint2 ( EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; VOID *NotifyHandle; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -575,12 +655,29 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint2 ( // //Call RegisterKeyNotify with KeyNotificationFunction being NULL // - Status = SimpleTextInputEx-> RegisterKeyNotify ( + + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> RegisterKeyNotify ( + SimpleTextInputEx, + &Key, + NULL, + &NotifyHandle + ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> RegisterKeyNotify ( SimpleTextInputEx, &Key, NULL, &NotifyHandle ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -611,6 +708,7 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint3 ( EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -618,12 +716,28 @@ BBTestRegisterKeyNotifyConformanceTestCheckpoint3 ( // //Call RegisterKeyNotify with NotifyHandle being NULL // - Status = SimpleTextInputEx-> RegisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> RegisterKeyNotify ( SimpleTextInputEx, &Key, TestRegisterNotifyFunction, NULL ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> RegisterKeyNotify ( + SimpleTextInputEx, + &Key, + TestRegisterNotifyFunction, + NULL + ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -653,14 +767,29 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint1 ( { EFI_STATUS Status; EFI_TEST_ASSERTION AssertionType; + EFI_TPL OldTpl; // //Call UnregisterKeyNotify with NotifyHandle being NULL // - Status = SimpleTextInputEx-> UnregisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> UnregisterKeyNotify ( SimpleTextInputEx, NULL ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> UnregisterKeyNotify ( + SimpleTextInputEx, + NULL + ); + } + } if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -692,6 +821,7 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint2 ( EFI_TEST_ASSERTION AssertionType; EFI_KEY_DATA Key; VOID *NotifyHandle; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -723,11 +853,25 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint2 ( // //Call UnregisterKeyNotify with the invalid NotifyHandle // - Status = SimpleTextInputEx-> UnregisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx->UnregisterKeyNotify ( SimpleTextInputEx, NotifyHandle ); - + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx->UnregisterKeyNotify ( + SimpleTextInputEx, + NotifyHandle + ); + } + } + // // Invalid Parameter or Not Found // @@ -762,6 +906,7 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint3 ( EFI_KEY_DATA Key; VOID *NotifyHandle; VOID *InvalidNotifyHandle; + EFI_TPL OldTpl; Key.Key.UnicodeChar = 'R'; Key.Key.ScanCode = 0X00; @@ -798,10 +943,25 @@ BBTestUnregisterKeyNotifyConformanceTestCheckpoint3 ( // //Call UnregisterKeyNotify with NotifyHandle with a illegal format // - Status = SimpleTextInputEx-> UnregisterKeyNotify ( + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_CALLBACK) { + if (OldTpl < TPL_CALLBACK) { + OldTpl = gtBS->RaiseTPL (TPL_CALLBACK); + Status = SimpleTextInputEx-> UnregisterKeyNotify ( SimpleTextInputEx, InvalidNotifyHandle ); + gtBS->RestoreTPL (OldTpl); + } else { + Status = SimpleTextInputEx-> UnregisterKeyNotify ( + SimpleTextInputEx, + InvalidNotifyHandle + ); + } + } + if ( EFI_INVALID_PARAMETER != Status) { AssertionType = EFI_TEST_ASSERTION_FAILED; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c index 7c424ef..ce5a80a 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -292,7 +292,7 @@ BBTestSetStateFunctionManualTest ( Status = gtBS->FreePool (DevicePathStr); return Status; } - BBTestSetStateFunctionManualTestCheckpoint1 ( StandardLib, SimpleTextInputEx ); + BBTestSetStateFunctionManualTestCheckpoint1 ( StandardLib, SimpleTextInputEx ); Status = gtBS->FreePool (DevicePathStr); if (EFI_ERROR(Status)) return Status; @@ -307,7 +307,7 @@ BBTestSetStateFunctionManualTest ( L"\r\nCurrent Device: ConsoleSplitter/TxtIn" ); BBTestSetStateFunctionManualTestCheckpoint1 ( StandardLib, SimpleTextInputEx ); - + } return EFI_SUCCESS; @@ -471,6 +471,8 @@ BBTestResetFunctionAutoTestCheckpoint1 ( UINTN Index; UINTN ExtendedIndex; EFI_KEY_DATA Key; + EFI_TPL OldTpl; + BOOLEAN ExtendedVerification[] = { TRUE, FALSE @@ -478,33 +480,67 @@ BBTestResetFunctionAutoTestCheckpoint1 ( ResetStatus = EFI_SUCCESS; ReadKeyStatus = EFI_NOT_READY; + // // Call Reset with ExtendedVerification being TRUE or FALSE // for ( ExtendedIndex=0; ExtendedIndex<2; ExtendedIndex++ ) { AssertionType = EFI_TEST_ASSERTION_PASSED; for ( Index=0; IndexReset ( + // + //Call Reset to reset to console + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + ResetStatus = SimpleTextInputEx->Reset ( SimpleTextInputEx, ExtendedVerification[ExtendedIndex] ); - if ( EFI_SUCCESS != ResetStatus ) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - break; + gtBS->RestoreTPL (OldTpl); + } else { + ResetStatus = SimpleTextInputEx->Reset ( + SimpleTextInputEx, + ExtendedVerification[ExtendedIndex] + ); + } + + + if ( EFI_SUCCESS != ResetStatus ) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + break; + } } - // - //Call ReadKeyStrokeEx to check if the console has been reset - // - ReadKeyStatus = SimpleTextInputEx->ReadKeyStrokeEx ( + + // + //Call ReadKeyStrokeEx to check if the console has been reset + // + OldTpl = gtBS->RaiseTPL (TPL_HIGH_LEVEL); + gtBS->RestoreTPL (OldTpl); + + if (OldTpl <= TPL_APPLICATION) { + if (OldTpl < TPL_APPLICATION) { + OldTpl = gtBS->RaiseTPL (TPL_APPLICATION); + ReadKeyStatus = SimpleTextInputEx->ReadKeyStrokeEx ( SimpleTextInputEx, &Key ); - if ( EFI_NOT_READY != ReadKeyStatus ) { - AssertionType = EFI_TEST_ASSERTION_FAILED; - break; + gtBS->RestoreTPL (OldTpl); + } else { + ReadKeyStatus = SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx, + &Key + ); + } + + + if ( EFI_NOT_READY != ReadKeyStatus ) { + AssertionType = EFI_TEST_ASSERTION_FAILED; + break; + } } } -- 2.9.0.windows.1