Date   

[PATCH v3 4/4] MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency

Marcin Wojtas <mw@...>
 

Some SdMmc host controllers are run by clocks with different
frequency than it is reflected in Capabilities Register 1.
It is allowed by SDHCI specification ver. 4.2 - if BaseClkFreq
field value of the Capability Register 1 is zero, the clock
frequency must be obtained via another method.

Because the bitfield is only 8 bits wide, a maximum value
that could be obtained from hardware is 255MHz.
In case the actual frequency exceeds 255MHz, the 8-bit BaseClkFreq
member of SD_MMC_HC_SLOT_CAP structure occurs to be not sufficient
to be used for setting the clock speed in SdMmcHcClockSupply
function.

This patch adds new UINT32 array ('BaseClkFreq[]') to
SD_MMC_HC_PRIVATE_DATA structure for specifying
the input clock speed for each slot of the host controller.
All routines that are used for clock configuration are
updated accordingly.

This patch also adds new IN OUT BaseClockFreq field
in the Capability callback of the SdMmcOverride,
protocol which allows to update BaseClkFreq value.

The patch reuses original commit from edk2-platforms:
20f6f144d3a8 ("Marvell/Drivers: XenonDxe: Allow overriding base clock
frequency")

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 6 +++++
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 8 +++----
MdeModulePkg/Include/Protocol/SdMmcOverride.h | 7 ++++--
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 4 ++--
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 4 ++--
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 13 ++++++++++-
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 23 ++++++++++----------
7 files changed, 43 insertions(+), 22 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
index c683600..8c1a589 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
@@ -118,6 +118,12 @@ typedef struct {
UINT64 MaxCurrent[SD_MMC_HC_MAX_SLOT];

UINT32 ControllerVersion;
+
+ //
+ // Some controllers may require to override base clock frequency
+ // value stored in Capabilities Register 1.
+ //
+ UINT32 BaseClkFreq[SD_MMC_HC_MAX_SLOT];
} SD_MMC_HC_PRIVATE_DATA;

#define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T')
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
index 1a11d51..8eefc31 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
@@ -423,7 +423,7 @@ SdMmcHcStopClock (
@param[in] PciIo The PCI IO protocol instance.
@param[in] Slot The slot number of the SD card to send the command to.
@param[in] ClockFreq The max clock frequency to be set. The unit is KHz.
- @param[in] Capability The capability of the slot.
+ @param[in] BaseClkFreq The base clock frequency of host controller in MHz.

@retval EFI_SUCCESS The clock is supplied successfully.
@retval Others The clock isn't supplied successfully.
@@ -434,7 +434,7 @@ SdMmcHcClockSupply (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT8 Slot,
IN UINT64 ClockFreq,
- IN SD_MMC_HC_SLOT_CAP Capability
+ IN UINT32 BaseClkFreq
);

/**
@@ -482,7 +482,7 @@ SdMmcHcSetBusWidth (

@param[in] PciIo The PCI IO protocol instance.
@param[in] Slot The slot number of the SD card to send the command to.
- @param[in] Capability The capability of the slot.
+ @param[in] BaseClkFreq The base clock frequency of host controller in MHz.

@retval EFI_SUCCESS The clock is supplied successfully.
@retval Others The clock isn't supplied successfully.
@@ -492,7 +492,7 @@ EFI_STATUS
SdMmcHcInitClockFreq (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT8 Slot,
- IN SD_MMC_HC_SLOT_CAP Capability
+ IN UINT32 BaseClkFreq
);

/**
diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
index 6160b5b..0aaf258 100644
--- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
+++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
@@ -22,7 +22,7 @@
#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \
{ 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 0x23, 0x23 } }

-#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION 0x1
+#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION 0x2

typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE;

@@ -58,6 +58,8 @@ typedef enum {
@param[in] ControllerHandle The EFI_HANDLE of the controller.
@param[in] Slot The 0 based slot index.
@param[in,out] SdMmcHcSlotCapability The SDHCI capability structure.
+ @param[in,out] BaseClkFreq The base clock frequency value that
+ optionally can be updated.

@retval EFI_SUCCESS The override function completed successfully.
@retval EFI_NOT_FOUND The specified controller or slot does not exist.
@@ -69,7 +71,8 @@ EFI_STATUS
(EFIAPI * EDKII_SD_MMC_CAPABILITY) (
IN EFI_HANDLE ControllerHandle,
IN UINT8 Slot,
- IN OUT VOID *SdMmcHcSlotCapability
+ IN OUT VOID *SdMmcHcSlotCapability,
+ IN OUT UINT32 *BaseClkFreq
);

/**
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
index 6fc6871..0393fd4 100755
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
@@ -705,7 +705,7 @@ EmmcSwitchClockFreq (
//
// Convert the clock freq unit from MHz to KHz.
//
- Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private->Capability[Slot]);
+ Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private->BaseClkFreq[Slot]);

return Status;
}
@@ -1098,7 +1098,7 @@ EmmcSetBusMode (
return Status;
}

- ASSERT (Private->Capability[Slot].BaseClkFreq != 0);
+ ASSERT (Private->BaseClkFreq[Slot] != 0);
//
// Check if the Host Controller support 8bits bus width.
//
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index 5408bbc..a9d0d3a 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -882,7 +882,7 @@ SdCardSetBusMode (
}
}

- Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, *Capability);
+ Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private->BaseClkFreq[Slot]);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1082,7 +1082,7 @@ SdCardIdentification (
goto Error;
}

- SdMmcHcInitClockFreq (PciIo, Slot, Private->Capability[Slot]);
+ SdMmcHcInitClockFreq (PciIo, Slot, Private->BaseClkFreq[Slot]);

gBS->Stall (1000);

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
index bf9869d..a87f8de 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
@@ -625,11 +625,16 @@ SdMmcPciHcDriverBindingStart (
if (EFI_ERROR (Status)) {
continue;
}
+
+ Private->BaseClkFreq[Slot] = Private->Capability[Slot].BaseClkFreq;
+
if (mOverride != NULL && mOverride->Capability != NULL) {
Status = mOverride->Capability (
Controller,
Slot,
- &Private->Capability[Slot]);
+ &Private->Capability[Slot],
+ &Private->BaseClkFreq[Slot]
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "%a: Failed to override capability - %r\n",
__FUNCTION__, Status));
@@ -637,6 +642,12 @@ SdMmcPciHcDriverBindingStart (
}
}
DumpCapabilityReg (Slot, &Private->Capability[Slot]);
+ DEBUG ((
+ DEBUG_INFO,
+ "Slot[%d] Base Clock Frequency: %dMHz\n",
+ Slot,
+ Private->BaseClkFreq[Slot]
+ ));

Support64BitDma &= Private->Capability[Slot].SysBus64;

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index 85aa625..040a959 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -721,7 +721,7 @@ SdMmcHcStopClock (
@param[in] PciIo The PCI IO protocol instance.
@param[in] Slot The slot number of the SD card to send the command to.
@param[in] ClockFreq The max clock frequency to be set. The unit is KHz.
- @param[in] Capability The capability of the slot.
+ @param[in] BaseClkFreq The base clock frequency of host controller in MHz.

@retval EFI_SUCCESS The clock is supplied successfully.
@retval Others The clock isn't supplied successfully.
@@ -732,11 +732,10 @@ SdMmcHcClockSupply (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT8 Slot,
IN UINT64 ClockFreq,
- IN SD_MMC_HC_SLOT_CAP Capability
+ IN UINT32 BaseClkFreq
)
{
EFI_STATUS Status;
- UINT32 BaseClkFreq;
UINT32 SettingFreq;
UINT32 Divisor;
UINT32 Remainder;
@@ -746,9 +745,8 @@ SdMmcHcClockSupply (
//
// Calculate a divisor for SD clock frequency
//
- ASSERT (Capability.BaseClkFreq != 0);
+ ASSERT (BaseClkFreq != 0);

- BaseClkFreq = Capability.BaseClkFreq;
if (ClockFreq == 0) {
return EFI_INVALID_PARAMETER;
}
@@ -940,7 +938,7 @@ SdMmcHcSetBusWidth (

@param[in] PciIo The PCI IO protocol instance.
@param[in] Slot The slot number of the SD card to send the command to.
- @param[in] Capability The capability of the slot.
+ @param[in] BaseClkFreq The base clock frequency of host controller in MHz.

@retval EFI_SUCCESS The clock is supplied successfully.
@retval Others The clock isn't supplied successfully.
@@ -950,16 +948,19 @@ EFI_STATUS
SdMmcHcInitClockFreq (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT8 Slot,
- IN SD_MMC_HC_SLOT_CAP Capability
+ IN UINT32 BaseClkFreq
)
{
EFI_STATUS Status;
UINT32 InitFreq;

//
- // Calculate a divisor for SD clock frequency
+ // According to SDHCI specification ver. 4.2, BaseClkFreq field value of
+ // the Capability Register 1 can be zero, which means a need for obtaining
+ // the clock frequency via another method. Fail in case it is not updated
+ // by SW at this point.
//
- if (Capability.BaseClkFreq == 0) {
+ if (BaseClkFreq == 0) {
//
// Don't support get Base Clock Frequency information via another method
//
@@ -969,7 +970,7 @@ SdMmcHcInitClockFreq (
// Supply 400KHz clock frequency at initialization phase.
//
InitFreq = 400;
- Status = SdMmcHcClockSupply (PciIo, Slot, InitFreq, Capability);
+ Status = SdMmcHcClockSupply (PciIo, Slot, InitFreq, BaseClkFreq);
return Status;
}

@@ -1103,7 +1104,7 @@ SdMmcHcInitHost (
PciIo = Private->PciIo;
Capability = Private->Capability[Slot];

- Status = SdMmcHcInitClockFreq (PciIo, Slot, Capability);
+ Status = SdMmcHcInitClockFreq (PciIo, Slot, Private->BaseClkFreq[Slot]);
if (EFI_ERROR (Status)) {
return Status;
}
--
2.7.4


[PATCH v3 3/4] MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride

Marcin Wojtas <mw@...>
 

From: Tomasz Michalec <tm@semihalf.com>

Some SD Host Controlers need to do additional opperations after clock
frequency switch.

This patch add new callback type to NotifyPhase of the SdMmcOverride
protocol. It is called after EmmcSwitchClockFreq and SdMmcHcClockSupply.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
MdeModulePkg/Include/Protocol/SdMmcOverride.h | 1 +
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 60 ++++++++++++++++++++
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 18 ++++++
3 files changed, 79 insertions(+)

diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
index f948bef..6160b5b 100644
--- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
+++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
@@ -48,6 +48,7 @@ typedef enum {
EdkiiSdMmcInitHostPre,
EdkiiSdMmcInitHostPost,
EdkiiSdMmcUhsSignaling,
+ EdkiiSdMmcSwitchClockFreqPost,
} EDKII_SD_MMC_PHASE_TYPE;

/**
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
index 473df8d..6fc6871 100755
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
@@ -794,6 +794,27 @@ EmmcSwitchToHighSpeed (

HsTiming = 1;
Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcSwitchClockFreqPost,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
+ }

return Status;
}
@@ -904,6 +925,24 @@ EmmcSwitchToHS200 (
return Status;
}

+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcSwitchClockFreqPost,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
+ }
+
Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusWidth);

return Status;
@@ -988,6 +1027,27 @@ EmmcSwitchToHS400 (

HsTiming = 3;
Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcSwitchClockFreqPost,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
+ }

return Status;
}
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index 850ad26..5408bbc 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -887,6 +887,24 @@ SdCardSetBusMode (
return Status;
}

+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcSwitchClockFreqPost,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
+ }
+
if ((AccessMode == 3) || ((AccessMode == 2) && (Capability->TuningSDR50 != 0))) {
Status = SdCardTuningClock (PciIo, PassThru, Slot);
if (EFI_ERROR (Status)) {
--
2.7.4


[PATCH v3 2/4] MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride protocol

Marcin Wojtas <mw@...>
 

From: Tomasz Michalec <tm@semihalf.com>

Some SD Host Controllers use different values in Host Control 2 Register
to select UHS Mode. This patch adds a new UhsSignaling type routine to
the NotifyPhase of the SdMmcOverride protocol.

UHS signaling configuration is moved to a common, default routine
(SdMmcHcUhsSignaling). After it is executed, the protocol producer
can override the values if needed..

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 32 +++++
MdeModulePkg/Include/Protocol/SdMmcOverride.h | 17 +++
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 136 +++++++++++++-------
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 31 ++++-
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 66 ++++++++++
5 files changed, 225 insertions(+), 57 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
index 7e3f588..1a11d51 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
@@ -63,6 +63,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define SD_MMC_HC_CTRL_VER 0xFE

//
+// SD Host Controller bits to HOST_CTRL2 register
+//
+#define SD_MMC_HC_CTRL_UHS_MASK 0x0007
+#define SD_MMC_HC_CTRL_UHS_SDR12 0x0000
+#define SD_MMC_HC_CTRL_UHS_SDR25 0x0001
+#define SD_MMC_HC_CTRL_UHS_SDR50 0x0002
+#define SD_MMC_HC_CTRL_UHS_SDR104 0x0003
+#define SD_MMC_HC_CTRL_UHS_DDR50 0x0004
+#define SD_MMC_HC_CTRL_MMC_LEGACY 0x0000
+#define SD_MMC_HC_CTRL_MMC_HS_SDR 0x0001
+#define SD_MMC_HC_CTRL_MMC_HS_DDR 0x0004
+#define SD_MMC_HC_CTRL_MMC_HS200 0x0003
+#define SD_MMC_HC_CTRL_MMC_HS400 0x0005
+
+//
// The transfer modes supported by SD Host Controller
// Simplified Spec 3.0 Table 1-2
//
@@ -518,4 +533,21 @@ SdMmcHcInitTimeoutCtrl (
IN UINT8 Slot
);

+/**
+ Set SD Host Controller control 2 registry according to selected speed.
+
+ @param[in] PciIo The PCI IO protocol instance.
+ @param[in] Slot The slot number of the SD card to send the command to.
+ @param[in] Timing The timing to select.
+
+ @retval EFI_SUCCESS The timing is set successfully.
+ @retval Others The timing isn't set successfully.
+**/
+EFI_STATUS
+SdMmcHcUhsSignaling (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT8 Slot,
+ IN SD_MMC_BUS_MODE Timing
+ );
+
#endif
diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
index 8a7669e..f948bef 100644
--- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
+++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
@@ -26,11 +26,28 @@

typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE;

+//
+// Bus timing modes
+//
+typedef enum {
+ SdMmcUhsSdr12,
+ SdMmcUhsSdr25,
+ SdMmcUhsSdr50,
+ SdMmcUhsSdr104,
+ SdMmcUhsDdr50,
+ SdMmcMmcLegacy,
+ SdMmcMmcHsSdr,
+ SdMmcMmcHsDdr,
+ SdMmcMmcHs200,
+ SdMmcMmcHs400,
+} SD_MMC_BUS_MODE;
+
typedef enum {
EdkiiSdMmcResetPre,
EdkiiSdMmcResetPost,
EdkiiSdMmcInitHostPre,
EdkiiSdMmcInitHostPost,
+ EdkiiSdMmcUhsSignaling,
} EDKII_SD_MMC_PHASE_TYPE;

/**
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
index c5fd214..473df8d 100755
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
@@ -740,10 +740,13 @@ EmmcSwitchToHighSpeed (
IN UINT8 BusWidth
)
{
- EFI_STATUS Status;
- UINT8 HsTiming;
- UINT8 HostCtrl1;
- UINT8 HostCtrl2;
+ EFI_STATUS Status;
+ UINT8 HsTiming;
+ UINT8 HostCtrl1;
+ SD_MMC_BUS_MODE Timing;
+ SD_MMC_HC_PRIVATE_DATA *Private;
+
+ Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);

Status = EmmcSwitchBusWidth (PciIo, PassThru, Slot, Rca, IsDdr, BusWidth);
if (EFI_ERROR (Status)) {
@@ -758,29 +761,37 @@ EmmcSwitchToHighSpeed (
return Status;
}

- //
- // Clean UHS Mode Select field of Host Control 2 reigster before update
- //
- HostCtrl2 = (UINT8)~0x7;
- Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Set UHS Mode Select field of Host Control 2 reigster to SDR12/25/50
- //
if (IsDdr) {
- HostCtrl2 = BIT2;
+ Timing = SdMmcMmcHsDdr;
} else if (ClockFreq == 52) {
- HostCtrl2 = BIT0;
+ Timing = SdMmcMmcHsSdr;
} else {
- HostCtrl2 = 0;
+ Timing = SdMmcMmcLegacy;
}
- Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
+
+ Status = SdMmcHcUhsSignaling (PciIo, Slot, Timing);
if (EFI_ERROR (Status)) {
return Status;
}

+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcUhsSignaling,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC uhs signaling notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
+ }
+
HsTiming = 1;
Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq);

@@ -814,10 +825,13 @@ EmmcSwitchToHS200 (
IN UINT8 BusWidth
)
{
- EFI_STATUS Status;
- UINT8 HsTiming;
- UINT8 HostCtrl2;
- UINT16 ClockCtrl;
+ EFI_STATUS Status;
+ UINT8 HsTiming;
+ UINT16 ClockCtrl;
+ SD_MMC_BUS_MODE Timing;
+ SD_MMC_HC_PRIVATE_DATA *Private;
+
+ Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);

if ((BusWidth != 4) && (BusWidth != 8)) {
return EFI_INVALID_PARAMETER;
@@ -837,22 +851,32 @@ EmmcSwitchToHS200 (
if (EFI_ERROR (Status)) {
return Status;
}
- //
- // Clean UHS Mode Select field of Host Control 2 reigster before update
- //
- HostCtrl2 = (UINT8)~0x7;
- Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
+
+ Timing = SdMmcMmcHs200;
+
+ Status = SdMmcHcUhsSignaling (PciIo, Slot, Timing);
if (EFI_ERROR (Status)) {
return Status;
}
- //
- // Set UHS Mode Select field of Host Control 2 reigster to SDR104
- //
- HostCtrl2 = BIT0 | BIT1;
- Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
- if (EFI_ERROR (Status)) {
- return Status;
+
+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcUhsSignaling,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC uhs signaling notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
}
+
//
// Wait Internal Clock Stable in the Clock Control register to be 1 before set SD Clock Enable bit
//
@@ -910,9 +934,12 @@ EmmcSwitchToHS400 (
IN UINT32 ClockFreq
)
{
- EFI_STATUS Status;
- UINT8 HsTiming;
- UINT8 HostCtrl2;
+ EFI_STATUS Status;
+ UINT8 HsTiming;
+ SD_MMC_BUS_MODE Timing;
+ SD_MMC_HC_PRIVATE_DATA *Private;
+
+ Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);

Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, ClockFreq, 8);
if (EFI_ERROR (Status)) {
@@ -933,21 +960,30 @@ EmmcSwitchToHS400 (
if (EFI_ERROR (Status)) {
return Status;
}
- //
- // Clean UHS Mode Select field of Host Control 2 reigster before update
- //
- HostCtrl2 = (UINT8)~0x7;
- Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
+
+ Timing = SdMmcMmcHs400;
+
+ Status = SdMmcHcUhsSignaling (PciIo, Slot, Timing);
if (EFI_ERROR (Status)) {
return Status;
}
- //
- // Set UHS Mode Select field of Host Control 2 reigster to HS400
- //
- HostCtrl2 = BIT0 | BIT2;
- Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
- if (EFI_ERROR (Status)) {
- return Status;
+
+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcUhsSignaling,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC uhs signaling notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
}

HsTiming = 3;
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index 6ee9ed7..850ad26 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -784,8 +784,8 @@ SdCardSetBusMode (
UINT8 BusWidth;
UINT8 AccessMode;
UINT8 HostCtrl1;
- UINT8 HostCtrl2;
UINT8 SwitchResp[64];
+ SD_MMC_BUS_MODE Timing;
SD_MMC_HC_PRIVATE_DATA *Private;

Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);
@@ -817,18 +817,23 @@ SdCardSetBusMode (
if (S18A && (Capability->Sdr104 != 0) && ((SwitchResp[13] & BIT3) != 0)) {
ClockFreq = 208;
AccessMode = 3;
+ Timing = SdMmcUhsSdr104;
} else if (S18A && (Capability->Sdr50 != 0) && ((SwitchResp[13] & BIT2) != 0)) {
ClockFreq = 100;
AccessMode = 2;
+ Timing = SdMmcUhsSdr50;
} else if (S18A && (Capability->Ddr50 != 0) && ((SwitchResp[13] & BIT4) != 0)) {
ClockFreq = 50;
AccessMode = 4;
+ Timing = SdMmcUhsDdr50;
} else if ((SwitchResp[13] & BIT1) != 0) {
ClockFreq = 50;
AccessMode = 1;
+ Timing = SdMmcUhsSdr25;
} else {
ClockFreq = 25;
AccessMode = 0;
+ Timing = SdMmcUhsSdr12;
}

Status = SdCardSwitch (PassThru, Slot, AccessMode, 0xF, 0xF, 0xF, TRUE, SwitchResp);
@@ -854,15 +859,27 @@ SdCardSetBusMode (
}
}

- HostCtrl2 = (UINT8)~0x7;
- Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
+ Status = SdMmcHcUhsSignaling (PciIo, Slot, Timing);
if (EFI_ERROR (Status)) {
return Status;
}
- HostCtrl2 = AccessMode;
- Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
- if (EFI_ERROR (Status)) {
- return Status;
+
+ if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
+ Status = mOverride->NotifyPhase (
+ Private->ControllerHandle,
+ Slot,
+ EdkiiSdMmcUhsSignaling,
+ &Timing
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: SD/MMC uhs signaling notifier callback failed - %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ return Status;
+ }
}

Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, *Capability);
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index 923c55b..85aa625 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -1138,6 +1138,72 @@ SdMmcHcInitHost (
}

/**
+ Set SD Host Controler control 2 registry according to selected speed.
+
+ @param[in] PciIo The PCI IO protocol instance.
+ @param[in] Slot The slot number of the SD card to send the command to.
+ @param[in] Timing The timing to select.
+
+ @retval EFI_SUCCESS The timing is set successfully.
+ @retval Others The timing isn't set successfully.
+**/
+EFI_STATUS
+SdMmcHcUhsSignaling (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT8 Slot,
+ IN SD_MMC_BUS_MODE Timing
+ )
+{
+ EFI_STATUS Status;
+ UINT8 HostCtrl2;
+
+ HostCtrl2 = (UINT8)~SD_MMC_HC_CTRL_UHS_MASK;
+ Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ switch (Timing) {
+ case SdMmcUhsSdr12:
+ HostCtrl2 = SD_MMC_HC_CTRL_UHS_SDR12;
+ break;
+ case SdMmcUhsSdr25:
+ HostCtrl2 = SD_MMC_HC_CTRL_UHS_SDR25;
+ break;
+ case SdMmcUhsSdr50:
+ HostCtrl2 = SD_MMC_HC_CTRL_UHS_SDR50;
+ break;
+ case SdMmcUhsSdr104:
+ HostCtrl2 = SD_MMC_HC_CTRL_UHS_SDR104;
+ break;
+ case SdMmcUhsDdr50:
+ HostCtrl2 = SD_MMC_HC_CTRL_UHS_DDR50;
+ break;
+ case SdMmcMmcLegacy:
+ HostCtrl2 = SD_MMC_HC_CTRL_MMC_LEGACY;
+ break;
+ case SdMmcMmcHsSdr:
+ HostCtrl2 = SD_MMC_HC_CTRL_MMC_HS_SDR;
+ break;
+ case SdMmcMmcHsDdr:
+ HostCtrl2 = SD_MMC_HC_CTRL_MMC_HS_DDR;
+ break;
+ case SdMmcMmcHs200:
+ HostCtrl2 = SD_MMC_HC_CTRL_MMC_HS200;
+ break;
+ case SdMmcMmcHs400:
+ HostCtrl2 = SD_MMC_HC_CTRL_MMC_HS400;
+ break;
+ default:
+ HostCtrl2 = 0;
+ break;
+ }
+ Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
+
+ return Status;
+}
+
+/**
Turn on/off LED.

@param[in] PciIo The PCI IO protocol instance.
--
2.7.4


[PATCH v3 1/4] MdeModulePkg/SdMmcPciHcDxe: Add an optional parameter in NotifyPhase

Marcin Wojtas <mw@...>
 

In order to ensure bigger flexibility in the NotifyPhase
routine of the SdMmcOverride protocol, enable using an
optional phase-specific data. This will allow to exchange
more information between the protocol producer driver
and SdMmcPciHcDxe in the newly added callbacks.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdeModulePkg/Include/Protocol/SdMmcOverride.h | 4 +++-
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 12 ++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
index 0766252..8a7669e 100644
--- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
+++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
@@ -63,6 +63,7 @@ EFI_STATUS
@param[in] PhaseType The type of operation and whether the
hook is invoked right before (pre) or
right after (post)
+ @param[in,out] PhaseData The pointer to a phase-specific data.

@retval EFI_SUCCESS The override function completed successfully.
@retval EFI_NOT_FOUND The specified controller or slot does not exist.
@@ -74,7 +75,8 @@ EFI_STATUS
(EFIAPI * EDKII_SD_MMC_NOTIFY_PHASE) (
IN EFI_HANDLE ControllerHandle,
IN UINT8 Slot,
- IN EDKII_SD_MMC_PHASE_TYPE PhaseType
+ IN EDKII_SD_MMC_PHASE_TYPE PhaseType,
+ IN OUT VOID *PhaseData
);

struct _EDKII_SD_MMC_OVERRIDE {
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index bedc968..923c55b 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -444,7 +444,8 @@ SdMmcHcReset (
Status = mOverride->NotifyPhase (
Private->ControllerHandle,
Slot,
- EdkiiSdMmcResetPre);
+ EdkiiSdMmcResetPre,
+ NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN,
"%a: SD/MMC pre reset notifier callback failed - %r\n",
@@ -494,7 +495,8 @@ SdMmcHcReset (
Status = mOverride->NotifyPhase (
Private->ControllerHandle,
Slot,
- EdkiiSdMmcResetPost);
+ EdkiiSdMmcResetPost,
+ NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN,
"%a: SD/MMC post reset notifier callback failed - %r\n",
@@ -1088,7 +1090,8 @@ SdMmcHcInitHost (
Status = mOverride->NotifyPhase (
Private->ControllerHandle,
Slot,
- EdkiiSdMmcInitHostPre);
+ EdkiiSdMmcInitHostPre,
+ NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN,
"%a: SD/MMC pre init notifier callback failed - %r\n",
@@ -1123,7 +1126,8 @@ SdMmcHcInitHost (
Status = mOverride->NotifyPhase (
Private->ControllerHandle,
Slot,
- EdkiiSdMmcInitHostPost);
+ EdkiiSdMmcInitHostPost,
+ NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN,
"%a: SD/MMC post init notifier callback failed - %r\n",
--
2.7.4


[PATCH v3 0/4] SdMmcOverride extension

Marcin Wojtas <mw@...>
 

Hi,

This is the third version of the patchset, which addresses
all remarks that came up during the v2 review, such as
updating the bus mode related enum/macro, headers cleanup,
etc. Details can be found in the changelog below.

Patches are available in the github:
https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/sdmmc-override-upstream-r20181108

Please note that extending SdMmcOverride protocol was impacting
so far the only user of it (Synquacer controller). In paralel
edk2-platforms patchset, a patch can be found:
("Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride")
which immunizes for above and future extensions of the protocol:
https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/xenon-upstream-r20181108

I'm looking forward to the comments and remarks.

Best regards,
Marcin

Changelog:
* 1/4:
- rename new parameter to PhaseData
- add Ard's RB

* 2/4:
- s/Controler/Controller/
- remove all references to MMC_SDR_50 mode
- rename and reorder MMC bus modes
- rename enum: s/SD_MMC_UHS_TIMING/SD_MMC_BUS_MODE/
and move it to protocol header in order to drop including private one
- fix if condition in EmmcSwitchToHighSpeed
- call SdMmcHcUhsSignaling unconditionally before SdMmcOverride
callback, so that protocol producer can optionally modify only quirky
timing mode values.

*4/4
- bump protocol version to 2
- remove redundant assert from SdMmcPciHcDriverBindingStart
(BaseClkFreq is already checked in SdMmcHcInitClockFreq)
- update comment in SdMmcHcInitClockFreq
- restore original DumpCapabilityReg and append

v1 -> v2
* Rebase onto newest master
* 1/4 [new patch] - preparation for extending NotifyPhase
* 2/4 - UhsSignaling as a part of NotifyPhase
* 3/4 - SwitchClockFreqPost as a part of NotifyPhase
* 4/4 - Allow updating BaseClkFreq via Capability instead of the
independent callback.

Marcin Wojtas (2):
MdeModulePkg/SdMmcPciHcDxe: Add an optional parameter in NotifyPhase
MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency

Tomasz Michalec (2):
MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride protocol
MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride

MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 6 +
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 40 +++-
MdeModulePkg/Include/Protocol/SdMmcOverride.h | 29 ++-
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 200 +++++++++++++++-----
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 53 +++++-
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 13 +-
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 101 ++++++++--
7 files changed, 358 insertions(+), 84 deletions(-)

--
2.7.4


Re: [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry count option in command.

Wu, Jiaxin <jiaxin.wu@...>
 

Hi Jaben,

The patch already has been pushed after received your/Siyuan reviewed-by tag.

Thanks,
Jiaxin

-----Original Message-----
From: Carsey, Jaben
Sent: Thursday, November 8, 2018 9:09 AM
To: Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>;
edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>
Subject: RE: [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry
count option in command.

Wu,

I plan to push this patch tomorrow, but I would like to add this to the commit
message. What do you think?

"This fixes the bug where parameter value 0 causes failure."

-Jaben

-----Original Message-----
From: Fu, Siyuan
Sent: Monday, November 05, 2018 10:51 PM
To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org
Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ye, Ting <ting.ye@intel.com>
Subject: RE: [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry
count option in command.
Importance: High

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>



-----Original Message-----
From: Wu, Jiaxin
Sent: Monday, November 5, 2018 2:59 PM
To: edk2-devel@lists.01.org
Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ye, Ting
<ting.ye@intel.com>;
Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry
count
option in command.

[-c <retry count>] is to define the number of times to transmit request
packets and wait for a response. The default value is 6. But it doesn't
specify the behavior of zero value. Here, The patch is to clear that:
Set to zero also means to use the default value.

Cc: Carsey Jaben <jaben.carsey@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 6 +++++-
ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index ac2813efc3..028686e1ff 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -216,11 +216,11 @@ EFI_MTFTP4_CONFIG_DATA
DefaultMtftp4ConfigData = {
{ { 0, 0, 0, 0 } }, // SubnetMask - Not relevant
as UseDefaultSetting=TRUE
0, // LocalPort - Automatically
assigned port number.
{ { 0, 0, 0, 0 } }, // GatewayIp - Not relevant
as UseDefaultSetting=TRUE
{ { 0, 0, 0, 0 } }, // ServerIp - Not known yet
69, // InitialServerPort - Standard TFTP
server port
- 6, // TryCount - Max number of
retransmissions.
+ 6, // TryCount - The number of
times to transmit request packets and wait for a response.
4 // TimeoutValue - Retransmission
timeout in seconds.
};

STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-i", TypeValue},
@@ -419,10 +419,14 @@ RunTftp (
ValueStr = ShellCommandLineGetValue (CheckPackage, L"-c");
if (ValueStr != NULL) {
if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TryCount)) {
goto Error;
}
+
+ if (Mtftp4ConfigData.TryCount == 0) {
+ Mtftp4ConfigData.TryCount = 6;
+ }
}

ValueStr = ShellCommandLineGetValue (CheckPackage, L"-t");
if (ValueStr != NULL) {
if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) {
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
index 654e42ad23..ff64912564 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
@@ -56,11 +56,12 @@
" -i interface - Specifies an adapter name, i.e., eth0.\r\n"
" -l port - Specifies the local port number. Default value is
0\r\n"
" and the port number is automatically assigned.\r\n"
" -r port - Specifies the remote port number. Default value is
69.\r\n"
" -c <retry count> - The number of times to transmit request packets
and\r\n"
-" wait for a response. The default value is 6.\r\n"
+" wait for a response. The default value is 6. Set to
zero\r\n"
+" also means to use the default value.\r\n"
" -t <timeout> - The number of seconds to wait for a response
after\r\n"
" sending a request packet. Default value is 4s.\r\n"
" -s <block size> - Specifies the TFTP blksize option as defined in RFC
2348.\r\n"
" Valid range is between 8 and 65464, default value
is 512.\r\n"
" -w <window size> - Specifies the TFTP windowsize option as defined in
RFC 7440.\r\n"
--
2.17.1.windows.2


Re: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos

Zeng, Star <star.zeng@...>
 

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: Bi, Dandan
Sent: Wednesday, November 7, 2018 10:53 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
Subject: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1306

In function UiDisplayMenu, the NewPos ptr which used to point to the highlight menu entry. It will always point to the menu entry which need to be highlighted or the gMenuOption menu if the highlight menu is not found.
So we can remove the NULL ptr check for NewPos in this function.
And add the ASSERT code to avoid if any false positive reports of NULL pointer dereference issue raised from static analysis.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index 7390f954b6..44f087fe01 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -2880,10 +2880,11 @@ UiDisplayMenu (
// MenuOption is set to NULL in Repaint
// NewPos: Current menu option that need to hilight
//
ControlFlag = CfUpdateHelpString;

+ ASSERT (NewPos != NULL);
UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);

if (SkipHighLight) {
SkipHighLight = FALSE;
MenuOption = SavedMenuOption;
@@ -2908,11 +2909,11 @@ UiDisplayMenu (
Temp2 = SkipValue;
} else {
Temp2 = 0;
}

- if (NewPos != NULL && (MenuOption == NULL || NewPos != &MenuOption->Link)) {
+ if (MenuOption == NULL || NewPos != &MenuOption->Link) {
if (MenuOption != NULL) {
//
// Remove the old highlight menu.
//
Status = DisplayOneMenu (MenuOption,
--
2.18.0.windows.1


Re: [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry count option in command.

Carsey, Jaben
 

Wu,

I plan to push this patch tomorrow, but I would like to add this to the commit message. What do you think?

"This fixes the bug where parameter value 0 causes failure."

-Jaben

-----Original Message-----
From: Fu, Siyuan
Sent: Monday, November 05, 2018 10:51 PM
To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org
Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ye, Ting <ting.ye@intel.com>
Subject: RE: [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry
count option in command.
Importance: High

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>



-----Original Message-----
From: Wu, Jiaxin
Sent: Monday, November 5, 2018 2:59 PM
To: edk2-devel@lists.01.org
Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ye, Ting
<ting.ye@intel.com>;
Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry
count
option in command.

[-c <retry count>] is to define the number of times to transmit request
packets and wait for a response. The default value is 6. But it doesn't
specify the behavior of zero value. Here, The patch is to clear that:
Set to zero also means to use the default value.

Cc: Carsey Jaben <jaben.carsey@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 6 +++++-
ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index ac2813efc3..028686e1ff 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -216,11 +216,11 @@ EFI_MTFTP4_CONFIG_DATA
DefaultMtftp4ConfigData = {
{ { 0, 0, 0, 0 } }, // SubnetMask - Not relevant
as UseDefaultSetting=TRUE
0, // LocalPort - Automatically
assigned port number.
{ { 0, 0, 0, 0 } }, // GatewayIp - Not relevant
as UseDefaultSetting=TRUE
{ { 0, 0, 0, 0 } }, // ServerIp - Not known yet
69, // InitialServerPort - Standard TFTP
server port
- 6, // TryCount - Max number of
retransmissions.
+ 6, // TryCount - The number of
times to transmit request packets and wait for a response.
4 // TimeoutValue - Retransmission
timeout in seconds.
};

STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-i", TypeValue},
@@ -419,10 +419,14 @@ RunTftp (
ValueStr = ShellCommandLineGetValue (CheckPackage, L"-c");
if (ValueStr != NULL) {
if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TryCount)) {
goto Error;
}
+
+ if (Mtftp4ConfigData.TryCount == 0) {
+ Mtftp4ConfigData.TryCount = 6;
+ }
}

ValueStr = ShellCommandLineGetValue (CheckPackage, L"-t");
if (ValueStr != NULL) {
if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) {
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
index 654e42ad23..ff64912564 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
@@ -56,11 +56,12 @@
" -i interface - Specifies an adapter name, i.e., eth0.\r\n"
" -l port - Specifies the local port number. Default value is
0\r\n"
" and the port number is automatically assigned.\r\n"
" -r port - Specifies the remote port number. Default value is
69.\r\n"
" -c <retry count> - The number of times to transmit request packets
and\r\n"
-" wait for a response. The default value is 6.\r\n"
+" wait for a response. The default value is 6. Set to
zero\r\n"
+" also means to use the default value.\r\n"
" -t <timeout> - The number of seconds to wait for a response
after\r\n"
" sending a request packet. Default value is 4s.\r\n"
" -s <block size> - Specifies the TFTP blksize option as defined in RFC
2348.\r\n"
" Valid range is between 8 and 65464, default value
is 512.\r\n"
" -w <window size> - Specifies the TFTP windowsize option as defined in
RFC 7440.\r\n"
--
2.17.1.windows.2


Re: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue

Wu, Hao A
 

-----Original Message-----
From: Ni, Ruiyu
Sent: Wednesday, November 07, 2018 5:37 PM
To: edk2-devel@lists.01.org
Cc: Jim Dailey; Wu, Hao A
Subject: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jim Dailey <jim_dailey@dell.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
---
ShellPkg/Library/UefiShellLib/UefiShellLib.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 580a1ee612..b17266d623 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -72,6 +72,7 @@ FullyQualifyPath(
{
CONST CHAR16 *WorkingPath;
CONST CHAR16 *InputPath;
+ CHAR16 *CharPtr;
CHAR16 *InputFileSystem;
UINTN FileSystemCharCount;
CHAR16 *FullyQualifiedPath;
@@ -131,7 +132,10 @@ FullyQualifyPath(
// truncate the new path after the file system part.
//
StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
- *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;
+ CharPtr = StrStr(FullyQualifiedPath, L":");
+ if (CharPtr != NULL) {
+ *(CharPtr + 1) = CHAR_NULL;
+ }
} else {
//
// Relative path: start with the working directory and append "\".
--
Reviewed-by: Hao Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu

2.16.1.windows.1


Re: [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()

Liming Gao
 

Cc to the package maintainers.

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jeff Brasen
Sent: Wednesday, October 31, 2018 5:31 AM
To: edk2-devel@lists.01.org
Cc: Jeff Brasen <jbrasen@nvidia.com>
Subject: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()

This function is exposed by the MemoryAllocationLib header.
An AllocateZeroPool() function has been added to fix modules depending on
this library and this function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
.../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)

diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
index 0e75e23..f93f9cf 100644
--- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
@@ -16,6 +16,7 @@
#include <PiPei.h>

#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
#include <Library/PrePiLib.h>
#include <Library/DebugLib.h>

@@ -195,6 +196,37 @@ AllocatePool (
}

/**
+ Allocates and zeros a buffer of type EfiBootServicesData.
+
+ Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
+ buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
+ valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
+ request, then NULL is returned.
+
+ @param AllocationSize The number of bytes to allocate and zero.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+AllocateZeroPool (
+ IN UINTN AllocationSize
+ )
+{
+ VOID *Buffer;
+
+ Buffer = AllocatePool (AllocationSize);
+ if (NULL == Buffer) {
+ return NULL;
+ }
+
+ SetMem (Buffer, AllocationSize, 0);
+
+ return Buffer;
+}
+
+/**
Frees a buffer that was previously allocated with one of the pool allocation functions in the
Memory Allocation Library.

--
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos

Liming Gao
 

Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Bi, Dandan
Sent: Wednesday, November 7, 2018 10:53 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Wu, Hao A
<hao.a.wu@intel.com>
Subject: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1306

In function UiDisplayMenu, the NewPos ptr which used to point to the
highlight menu entry. It will always point to the menu entry which
need to be highlighted or the gMenuOption menu if the highlight menu
is not found.
So we can remove the NULL ptr check for NewPos in this function.
And add the ASSERT code to avoid if any false positive reports
of NULL pointer dereference issue raised from static analysis.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index 7390f954b6..44f087fe01 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -2880,10 +2880,11 @@ UiDisplayMenu (
// MenuOption is set to NULL in Repaint
// NewPos: Current menu option that need to hilight
//
ControlFlag = CfUpdateHelpString;

+ ASSERT (NewPos != NULL);
UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);

if (SkipHighLight) {
SkipHighLight = FALSE;
MenuOption = SavedMenuOption;
@@ -2908,11 +2909,11 @@ UiDisplayMenu (
Temp2 = SkipValue;
} else {
Temp2 = 0;
}

- if (NewPos != NULL && (MenuOption == NULL || NewPos != &MenuOption->Link)) {
+ if (MenuOption == NULL || NewPos != &MenuOption->Link) {
if (MenuOption != NULL) {
//
// Remove the old highlight menu.
//
Status = DisplayOneMenu (MenuOption,
--
2.18.0.windows.1


Edk2 uni file encoding

Sean
 

Is there a definitive answer for the file encoding for all UNI files in edk2?
If not I would like to propose one. Incorrect encoding causes tool issues and is something we can easily check for and fix.

Proposal: All UNI files in edk2 should be


1. UTF-8
Or

1. Use a BOM and be UTF-16

https://en.wikipedia.org/wiki/Byte_order_mark

Results from searching edk2:
1 - UTF-16 LE BOM file: EdkCompatibilityPkg\Compatibility\FrameworkHiiOnUefiHiiThunk\Strings.uni
919 - Without BOM and decoded as UTF-8

Thoughts?

Future question: Can we make rule for all other standard file types (c, h, dec, dsc, fdf, inf,)?

Thanks
Sean


Re: [PATCH v2] MdePkg/BaseSynchronizationLib: Fix InternalSync[De|In]crement

Laszlo Ersek
 

Hi Ray,

On 11/07/18 16:54, Ruiyu Ni wrote:
Today's code generates assembly code as below for
InternalSyncIncrement:
__asm__ __volatile__ (
"movl $1, %%eax \n\t"
"lock \n\t"
"xadd %%eax, %1 \n\t"
"inc %%eax \n\t"
: "=a" (Result), // %0
"+m" (*Value) // %1
: // no inputs that aren't also outputs
: "memory",
"cc"
);

0: 55 pushl %ebp
1: 89 e5 movl %esp, %ebp
3: 8b 45 08 movl 8(%ebp), %eax
6: b8 01 00 00 00 movl $1, %eax
b: f0 lock
c: 0f c1 00 xaddl %eax, _InternalSyncIncrement(%eax)
f: 40 incl %eax
10: 5d popl %ebp
11: c3 retl

Line #3 and Line #6 both use EAX as destination register.
Line #c uses EAX and (EAX).

The output operand "=a" tells GCC that EAX is used for output.
But GCC only assumes that EAX will be used in the very last
instruction.

Per GCC document,
"Use the ‘&’ constraint modifier on all output operands that must
not overlap an input. Otherwise, GCC may allocate the output
operand in the same register as an unrelated input operand, on
the assumption that the assembler code consumes its inputs before
producing outputs. This assumption may be false if the assembler
code actually consists of more than one instruction."

"=&a" should be used to tell GCC not use EAX before the assembly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c | 4 ++--
MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
index af39bdeb51..760a020a32 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
@@ -40,7 +40,7 @@ InternalSyncIncrement (
"lock \n\t"
"xadd %%eax, %1 \n\t"
"inc %%eax \n\t"
- : "=a" (Result), // %0
+ : "=&a" (Result), // %0
"+m" (*Value) // %1
: // no inputs that aren't also outputs
: "memory",
@@ -76,7 +76,7 @@ InternalSyncDecrement (
"lock \n\t"
"xadd %%eax, %1 \n\t"
"dec %%eax \n\t"
- : "=a" (Result), // %0
+ : "=&a" (Result), // %0
"+m" (*Value) // %1
: // no inputs that aren't also outputs
: "memory",
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
index edb904c007..767d4626b8 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
@@ -40,7 +40,7 @@ InternalSyncIncrement (
"lock \n\t"
"xadd %%eax, %1 \n\t"
"inc %%eax \n\t"
- : "=a" (Result), // %0
+ : "=&a" (Result), // %0
"+m" (*Value) // %1
: // no inputs that aren't also outputs
: "memory",
@@ -76,7 +76,7 @@ InternalSyncDecrement (
"lock \n\t"
"xadd %%eax, %1 \n\t"
"dec %%eax \n\t"
- : "=a" (Result), // %0
+ : "=&a" (Result), // %0
"+m" (*Value) // %1
: // no inputs that aren't also outputs
: "memory",
(1) Before you push the patch, please reinstate the reference to:

https://bugzilla.tianocore.org/show_bug.cgi?id=1303

in the commit message.

(The BZ reference was part of v1.)


(2) Please also append:

Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: 8a94eb9283fa09a30f5f06f0c12cf0ee4e14fbcf
Fixes: 17634d026f968c404b039a8d8431b6389dd396ea


(3) Can you please replace the ‘ (U+2018) and ’ (U+2019) characters in
the commit message with simple ASCII quotes, such as '&'?

Unless there's a strong reason, I prefer to limit commit messages to
plain ASCII. (This does not apply to names of people, of course.)

Feel free to ignore my request if you disagree.


(4) The patch looks good to me.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>


(5) I've also tested the patch, on top of c60d36b4d1ee, both the IA32
and the X64 changes, by performing my usual Linux guest tests described at

<https://github.com/tianocore/tianocore.github.io/wiki/Testing-SMM-with-QEMU,-KVM-and-libvirt#tests-to-perform-in-the-installed-guest-fedora-26-guest>

with the IA32, IA32X64, and X64 builds of OVMF.

Tested-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo


Re: [edk2-test][RFC PATCH 07/12] uefi-sct/SctPkg: sbbr: Add test cases for SBBR v1.0 boot services

Supreeth Venkatesh
 

On Tue, 2018-11-06 at 17:46 +0000, Leif Lindholm wrote:
On Tue, Nov 06, 2018 at 02:17:41PM +0530, Sakar Arora wrote:
From: John Powell <john.powell@arm.com>

Tests SBBR requirements 3.4.1 and 3.4.4.
It would be better if we add comments on how SBBR requirements 3.4.1
and 3.4.4 relate to the UEFI specification. Since this is being
requested to be added as part of UEFI-SCT, it would need to be related
to UEFI specification.

For all the SBBR patches, please correlate SBBR specification text to
UEFI specification, so that it can be justified as UEFI-SCT test case.


Change-Id: I0dd625851db65d04d2a7572a2d6838951c8f7c67
Signed-off-by: John Powell <john.powell@arm.com>
---
uefi-sct/SctPkg/CommonGenFramework.sh | 3 +
uefi-sct/SctPkg/Config/Data/Category.ini | 11 +-
.../SbbrBootServices/BlackBoxTest/Guid.c | 65 +++
.../SbbrBootServices/BlackBoxTest/Guid.h | 76 +++
.../BlackBoxTest/SbbrBootServicesBBTest.inf | 85 ++++
.../BlackBoxTest/SbbrBootServicesBBTestFunction.c | 549
+++++++++++++++++++++
.../BlackBoxTest/SbbrBootServicesBBTestFunction.h | 85 ++++
.../BlackBoxTest/SbbrBootServicesBBTestMain.c | 149 ++++++
.../BlackBoxTest/SbbrBootServicesBBTestMain.h | 99 ++++
uefi-sct/SctPkg/UEFI/SBBR_SCT.dsc | 7 +
10 files changed, 1127 insertions(+), 2 deletions(-)
create mode 100644 uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBox
Test/Guid.c
create mode 100644 uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBox
Test/Guid.h
create mode 100644 uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBox
Test/SbbrBootServicesBBTest.inf
create mode 100644 uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBox
Test/SbbrBootServicesBBTestFunction.c
create mode 100644 uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBox
Test/SbbrBootServicesBBTestFunction.h
create mode 100644 uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBox
Test/SbbrBootServicesBBTestMain.c
create mode 100644 uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBox
Test/SbbrBootServicesBBTestMain.h

diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-
sct/SctPkg/CommonGenFramework.sh
index aecd21b..ab35c5a 100755
--- a/uefi-sct/SctPkg/CommonGenFramework.sh
+++ b/uefi-sct/SctPkg/CommonGenFramework.sh
@@ -364,6 +364,9 @@ then
# Tests SBBR sections 3.3.1, 3.3.2, 3.3.3, and 3.3.4
cp
$ProcessorType/SysEnvConfigBBTest.efi $Framework/
Test/ > NUL

+ # UEFI Boot Services - SBBR v1.0 3.4
+ cp
$ProcessorType/SbbrBootServicesBBTest.efi $Framework/
Test/ > NUL
+
# Runtime Services Tests - SBBR v1.0 Appendix B
cp
$ProcessorType/VariableServicesBBTest.efi $Framework/
Test/ > NUL
cp
$ProcessorType/TimeServicesBBTest.efi $Framework/
Test/ > NUL
diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini b/uefi-
sct/SctPkg/Config/Data/Category.ini
index 9576971..17ca639 100644
--- a/uefi-sct/SctPkg/Config/Data/Category.ini
+++ b/uefi-sct/SctPkg/Config/Data/Category.ini
@@ -145,8 +145,15 @@ Description =

[Category Data]
Revision = 0x00010000
-CategoryGuid = AFF115FB-387B-4C18-8C41-6AFC7F03BB90
-InterfaceGuid = AFF115FB-387B-4C18-8C41-6AFC7F03BB90
+CategoryGuid = 8dafd7a7-44d0-4cf4-9d28-9f87080fc091
+InterfaceGuid = E9EF7553-F833-4E56-96E8-38AE679523CC
+Name = BootServicesTest\SbbrBootServices
+Description = Tests SBBR boot services requirements.
+
+[Category Data]
+Revision = 0x00010000
+CategoryGuid = AFF115FB-387B-4c18-8C41-6AFC7F03BB90
+InterfaceGuid = AFF115FB-387B-4c18-8C41-6AFC7F03BB90
Name = RuntimeServicesTest
Description =
Diff would be more clear if added test was added after existing test.

/
Leif


Re: [edk2-test][Patch] uefi-sct/SctPkg:The Lun display order issue in iSCSI device path text

Supreeth Venkatesh
 

Thanks.

Reviewed-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>

On Fri, 2018-11-02 at 03:08 -0500, Eric Jin wrote:
The LUN is an 8 byte array that is displayed in hexadecimal
format with byte 0 first (i.e., on the left) and byte 7 last
(i.e, on the right).

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
.../BlackBoxTest/DevicePathFromTextBBTestCoverage.c | 13
+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest
/DevicePathFromTextBBTestCoverage.c b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest
/DevicePathFromTextBBTestCoverage.c
index fc099d8..96cd84f 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest
/DevicePathFromTextBBTestCoverage.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest
/DevicePathFromTextBBTestCoverage.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2017 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2017, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -1445,6 +1445,7 @@ CreateiScsiDeviceNode (
UINT64 LunNum;
ISCSI_DEVICE_PATH_WITH_NAME *iSCSI;

+ LunNum = 0;
NameStr = SctSplitStr (&TextDeviceNode, L',');
PortalGroupStr = SctSplitStr (&TextDeviceNode, L',');
LunStr = SctSplitStr (&TextDeviceNode, L',');
@@ -1459,7 +1460,7 @@ CreateiScsiDeviceNode (
);
SctUnicodeToAscii (iSCSI->iSCSITargetName, NameStr, SctStrLen
(NameStr));
iSCSI->TargetPortalGroupTag = (UINT16) SctStrToUInt
(PortalGroupStr);
- SctStrToUInt64 (LunStr, &LunNum);
+ StrToUInt8Array(LunStr, &LunNum);
iSCSI->Lun = LunNum;

Options = 0x0000;
@@ -2846,12 +2847,12 @@
DevicePathFromTextConvertTextToDeviceNodeCoverageTest (
(UINTN)__LINE__
);
//
- // TDS 3.10.1.2.26
+ // TDS 3.10.1.2.26 In Lun 0x0000005678000000, byte 3 is 0x56 and
byte4 is 0x78
//
- SctStrCpy (text,
L"MyTargetName,0x12AB,5678,CRC32C,None,CHAP_BI,TCP");
+ SctStrCpy (text,
L"MyTargetName,0x12AB,0x0000005678000000,CRC32C,None,CHAP_BI,TCP");
pDevicePath = CreateiScsiDeviceNode(text);

- SctStrCpy (text,
L"iSCSI(MyTargetName,0x12AB,5678,CRC32C,None,CHAP_BI,TCP)");
+ SctStrCpy (text,
L"iSCSI(MyTargetName,0x12AB,0x0000005678000000,CRC32C,None,CHAP_BI,TC
P)");
pReDevicePath = DevicePathFromText->ConvertTextToDeviceNode
(text);
if (SctCompareMem (pDevicePath, pReDevicePath,
SctDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) pReDevicePath))
== 0) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
@@ -2866,7 +2867,7 @@
DevicePathFromTextConvertTextToDeviceNodeCoverageTest (
AssertionType,
gDevicePathFromTextBBTestFunctionAssertionGuid114,
L"EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL -
ConvertDeviceNodeToText must correctly recover the converting
ConvertTextToDeviceNode has acted on the device node string",
- L"%a:%d, Convert
iSCSI(MyTargetName,0x12AB,5678,CRC32C,None,CHAP_BI,TCP)",
+ L"%a:%d, Convert
iSCSI(MyTargetName,0x12AB,0x0000005678000000,CRC32C,None,CHAP_BI,TCP)
",
__FILE__,
(UINTN)__LINE__
);


Re: [edk2-test][PATCH] uefi-sct/SctPkg:Add the checkpoint of Toggle state of ReadKeyStrokeEx

Supreeth Venkatesh
 

On Wed, 2018-11-07 at 06:45 +0000, Jin, Eric wrote:
Hi Supreeth,

Thank for comment. The magic num 7 will be removed in the v2 patch.
Thanks.

Best Regards
Eric

-----Original Message-----
From: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Sent: Monday, October 15, 2018 10:18 AM
To: Jin, Eric <eric.jin@intel.com>; edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: Re: [PATCH] uefi-sct/SctPkg:Add the checkpoint of Toggle
state of ReadKeyStrokeEx



On 10/13/2018 05:21 PM, Eric Jin wrote:
UEFI Spec clarify the Toggle state

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
.../SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +-
.../SimpleTextInputEx/BlackBoxTest/Guid.h | 12 +-
.../SimpleTextInputExBBTestFunction.c | 210
+++++++++++++++++
.../SimpleTextInputExBBTestMain.c | 13 +-
.../SimpleTextInputExBBTestMain.h | 22 +-
.../SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +-
.../SimpleTextInputEx/BlackBoxTest/Guid.h | 12 +-
.../SimpleTextInputExBBTestFunction.c | 212
+++++++++++++++++-
.../SimpleTextInputExBBTestMain.c | 11 +-
.../SimpleTextInputExBBTestMain.h | 20 +-
10 files changed, 513 insertions(+), 13 deletions(-)

diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.c
b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.c
index 9cb19f48..ff2d50fa 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/Guid.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2012 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2012, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -63,3 +63,8 @@ EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid007 =
EFI_TEST_SIMPLETEXTI
EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;

EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.h
b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.h
index 6c90fca3..2a6be48b 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/Guid.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -119,3 +119,13 @@ extern EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008;
{ 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa,
0xda,
0xeb, 0x84 } }

extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \
+{ 0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c,
0x22,
+0xa8, 0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \
+{ 0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18,
0xf1,
+0x40, 0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestFunction.c
b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestFunction.c
index 153ade03..48f91002 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestFunction.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
}


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *DevicePathStr;
+
+ //
+ // init
+ //
+ SimpleTextInputEx =
+ (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface // Status =
+ gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get Device Path of current Simple_Text_Input_Ex_Protocol //
And
+ out put device path or device name // Status =
+ LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
+ &DevicePath, StandardLib); if (Status == EFI_SUCCESS) {
+ DevicePathStr = SctDevicePathToStr (DevicePath);
+ if (DevicePathStr != NULL) {
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: %s",
+ DevicePathStr
+ );
+ Status = gtBS->FreePool (DevicePathStr);
+ if (EFI_ERROR(Status))
+ return Status;
+ DevicePathStr=NULL;
+ }
+ } else {
+ //
+ // Console Splitter/StdErr
+ //
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+ );
+ }
+
+ //
+ //
+ //
+ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,
+ SimpleTextInputEx );
+
+ return EFI_SUCCESS;
+}
+
+
+
//
//Check Points
//
@@ -1061,3 +1133,141 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (

return EFI_SUCCESS;
}
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_KEY_DATA Key;
+ UINT8 Index;
+
+ EFI_KEY_TOGGLE_STATE State = EFI_TOGGLE_STATE_VALID |
+ EFI_KEY_STATE_EXPOSED;
+
+ EFI_KEY_TOGGLE_STATE ValidState[7] = {
Magic Number 7
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE
| EFI_CAPS_LOCK_ACTIVE,
+ };
+
+ //
+ //Reset the console
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+ if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
+ return Status;
+ }
+
+ if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0)
{
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
+ support // Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ &State
+ );
+
+ if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_WARNING,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+ L"%a:%d, Status = %r\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return Status;
+ }
+
+ for (Index=0; Index<7; Index++) {
Magic Number 7
+
+ //
+ // Set the valid KeyToggleState
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ ValidState + Index
+ );
+
+ if (Status != EFI_SUCCESS) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_FAILED,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState
- SetState() doesn't return EFI_SUCCESS with the valid
KeyToggleState",
+ L"%a:%d, Status = %r, KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ ValidState[Index]
+ );
+ continue;
+ }
+
+ //
+ // Get the KeyToggleState
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+
+ if (Status != EFI_NOT_READY) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid
010,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeySt
rokeEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there
is no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ ValidState[Index]
+ );
+
+ } else {
+ if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+ (Key.KeyState.KeyShiftState == 0 ||
Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+ Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid
011,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeySt
rokeEx - ReadKeyStrokeEx() should get the ValidState with
EFI_NOT_READY and other field is zero",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x, expect State = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ Key.KeyState.KeyToggleState,
+ ValidState[Index]
+ );
+
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.c
b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.c
index fdbc90fe..5b71b6a9 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/SimpleTextInputExBBTestMain.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2017 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2017, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -105,6 +105,15 @@ EFI_BB_TEST_ENTRY_FIELD
gBBTestEntryField[] = {
BBTestUnregisterKeyNotifyFunctionManualTest
},
#endif
+ {
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+ L"ReadKeyStrokeExFunctionAuto",
+ L"Function Auto test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestReadKeyStrokeExFunctionAutoTest
+ },
{
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
L"ReadKeyStrokeExConformance",
@@ -151,7 +160,6 @@ BOOLEAN BeenExecuted;
//

EFI_STATUS
-EFIAPI
InitializeSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -179,7 +187,6 @@ InitializeSimpleTextInputExBBTest (


EFI_STATUS
-EFIAPI
UnloadSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle
)
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.h
b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.h
index cb2160b3..86766068 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/SimpleTextInputExBBTestMain.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2017 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2017, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -57,6 +57,8 @@ Abstract:
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \
{ 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc,
0xe2,
0xad, 0xc7 } }

+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ {
+0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
+0x89, 0xbd } }
//
// Entry GUIDs for Conf Test
//
@@ -86,7 +88,6 @@ typedef enum {
//
//
EFI_STATUS
-EFIAPI
InitializeSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -94,7 +95,6 @@ InitializeSimpleTextInputExBBTest (


EFI_STATUS
-EFIAPI
UnloadSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle
);
@@ -155,6 +155,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
);
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );


EFI_STATUS
@@ -238,6 +247,13 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
);


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ );
+
+
EFI_STATUS
BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.c
b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.c
index b79772c9..6876814c 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/Guid.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2015 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2015, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -63,3 +63,8 @@ EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid007 =
EFI_TEST_SIMPLETEXTI
EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;

EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.h
b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.h
index 6c90fca3..2a6be48b 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/Guid.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/Guid.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -119,3 +119,13 @@ extern EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008;
{ 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa,
0xda,
0xeb, 0x84 } }

extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \
+{ 0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c,
0x22,
+0xa8, 0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \
+{ 0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18,
0xf1,
+0x40, 0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestFunction.c
b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestFunction.c
index ce5a80ac..04949de8 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestFunction.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
}


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *DevicePathStr;
+
+ //
+ // init
+ //
+ SimpleTextInputEx =
+ (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface // Status =
+ gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get Device Path of current Simple_Text_Input_Ex_Protocol //
And
+ out put device path or device name // Status =
+ LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
+ &DevicePath, StandardLib); if (Status == EFI_SUCCESS) {
+ DevicePathStr = SctDevicePathToStr (DevicePath);
+ if (DevicePathStr != NULL) {
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: %s",
+ DevicePathStr
+ );
+ Status = gtBS->FreePool (DevicePathStr);
+ if (EFI_ERROR(Status))
+ return Status;
+ DevicePathStr=NULL;
+ }
+ } else {
+ //
+ // Console Splitter/StdErr
+ //
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+ );
+ }
+
+ //
+ //
+ //
+ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,
+ SimpleTextInputEx );
+
+ return EFI_SUCCESS;
+}
+
+
+
//
//Check Points
//
@@ -1060,4 +1132,142 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
);

return EFI_SUCCESS;
-}
\ No newline at end of file
+}
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_KEY_DATA Key;
+ UINT8 Index;
+
+ EFI_KEY_TOGGLE_STATE State = EFI_TOGGLE_STATE_VALID |
+ EFI_KEY_STATE_EXPOSED;
+
+ EFI_KEY_TOGGLE_STATE ValidState[7] = {
Magic Number 7
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE
| EFI_CAPS_LOCK_ACTIVE,
+ };
+
+ //
+ //Reset the console
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+ if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
+ return Status;
+ }
+
+ if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0)
{
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
+ support // Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ &State
+ );
+
+ if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_WARNING,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+ L"%a:%d, Status = %r\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return Status;
+ }
+
+ for (Index=0; Index<7; Index++) {
Magic Number 7
+
+ //
+ // Set the valid KeyToggleState
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ ValidState + Index
+ );
+
+ if (Status != EFI_SUCCESS) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_FAILED,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState
- SetState() doesn't return EFI_SUCCESS with the valid
KeyToggleState",
+ L"%a:%d, Status = %r, KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ ValidState[Index]
+ );
+ continue;
+ }
+
+ //
+ // Get the KeyToggleState
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+
+ if (Status != EFI_NOT_READY) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid
010,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeySt
rokeEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there
is no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ ValidState[Index]
+ );
+
+ } else {
+ if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+ (Key.KeyState.KeyShiftState == 0 ||
Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+ Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid
011,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeySt
rokeEx - ReadKeyStrokeEx() should get the ValidState with
EFI_NOT_READY and other field is zero",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x, expect State = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ Key.KeyState.KeyToggleState,
+ ValidState[Index]
+ );
+
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.c
b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.c
index 43dbbdae..c0a4f5aa 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/SimpleTextInputExBBTestMain.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2016 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2016, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -105,6 +105,15 @@ EFI_BB_TEST_ENTRY_FIELD
gBBTestEntryField[] = {
BBTestUnregisterKeyNotifyFunctionManualTest
},
#endif
+ {
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+ L"ReadKeyStrokeExFunctionAuto",
+ L"Function Auto test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestReadKeyStrokeExFunctionAutoTest
+ },
{
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
L"ReadKeyStrokeExConformance",
diff --git
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.h
b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.h
index 0b3312e9..bb0d8c9a 100644
---
a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBo
xTest/SimpleTextInputExBBTestMain.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Bla
+++ ckBoxTest/SimpleTextInputExBBTestMain.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2014 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2014, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions
of
the BSD License @@ -61,6 +61,8 @@ Abstract:
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \
{ 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc,
0xe2,
0xad, 0xc7 } }

+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ {
+0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
+0x89, 0xbd } }
//
// Entry GUIDs for Conf Test
//
@@ -157,6 +159,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
);
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );


EFI_STATUS
@@ -240,6 +251,13 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
);


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ );
+
+
EFI_STATUS
BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,


Re: [edk2-test][Patch v2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state

Supreeth Venkatesh
 

Some of the same comments of PATCH v1 apply to v2.
Please see comments for v1 and resend a patch v3 as a series.

Thanks,
Supreeth

On Wed, 2018-11-07 at 07:19 +0000, Jin, Eric wrote:
It is the patch v2 below.

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
Of Eric Jin
Sent: Wednesday, November 7, 2018 2:48 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [edk2-test][Patch] uefi-sct/SctPkg:Add checkpoint of
ReadKeyStrokeEx Toggle state

UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol
are required to return KeyData.Key and KeyData.KeyState values.
These drivers must always return the most current state of
KeyData.KeyState.KeyShiftState and KeyData.KeyState.KeyToggleState.

The change in spec is "EFI_NOT_READY - There was no keystroke data
available. Current KeyData.KeyState values are exposed."

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +-
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h | 12
+- .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 211
++++++++++++++++++++
.../BlackBoxTest/SimpleTextInputExBBTestMain.c | 13 +-
.../BlackBoxTest/SimpleTextInputExBBTestMain.h | 22 ++-
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +-
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h | 12
+- .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 213
++++++++++++++++++++-
.../BlackBoxTest/SimpleTextInputExBBTestMain.c | 11 +-
.../BlackBoxTest/SimpleTextInputExBBTestMain.h | 20 +-
10 files changed, 515 insertions(+), 13 deletions(-)

diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
index 9cb19f4..ff2d50f 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2012 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2012, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -63,3 +63,8 @@ EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid007 =
EFI_TEST_SIMPLETEXTI EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;

EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
index 6c90fca..2a6be48 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -119,3 +119,13 @@ extern EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008;
{ 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda,
0xeb, 0x84 } }

extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID
\ {
+0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22,
0xa8,
+0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID
\ {
+0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1,
0x40,
+0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
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 153ade0..4850627 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestFunction.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest ( }


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *DevicePathStr;
+
+ //
+ // init
+ //
+ SimpleTextInputEx =
+ (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface // Status =
+ gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get Device Path of current Simple_Text_Input_Ex_Protocol //
And
+ out put device path or device name // Status =
+ LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
&DevicePath,
+ StandardLib); if (Status == EFI_SUCCESS) {
+ DevicePathStr = SctDevicePathToStr (DevicePath);
+ if (DevicePathStr != NULL) {
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: %s",
+ DevicePathStr
+ );
+ Status = gtBS->FreePool (DevicePathStr);
+ if (EFI_ERROR(Status))
+ return Status;
+ DevicePathStr=NULL;
+ }
+ } else {
+ //
+ // Console Splitter/StdErr
+ //
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+ );
+ }
+
+ //
+ //
+ //
+ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,
+ SimpleTextInputEx );
+
+ return EFI_SUCCESS;
+}
+
+
+
//
//Check Points
//
@@ -1061,3 +1133,142 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (

return EFI_SUCCESS;
}
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_KEY_DATA Key;
+ UINT8 Index;
+
+ EFI_KEY_TOGGLE_STATE State = EFI_TOGGLE_STATE_VALID |
+ EFI_KEY_STATE_EXPOSED;
+
+ EFI_KEY_TOGGLE_STATE ValidState[] = {
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ 0
+ };
+
+ //
+ //Reset the console
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+ if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
+ return Status;
+ }
+
+ if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
support
+ // Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ &State
+ );
+
+ if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_WARNING,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+ L"%a:%d, Status = %r\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return Status;
+ }
+
+ for (Index=0; ValidState[Index]; Index++) {
+
+ //
+ // Set the valid KeyToggleState
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ ValidState + Index
+ );
+
+ if (Status != EFI_SUCCESS) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_FAILED,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
+ L"%a:%d, Status = %r, KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ ValidState[Index]
+ );
+ continue;
+ }
+
+ //
+ // Get the KeyToggleState
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+
+ if (Status != EFI_NOT_READY) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
0,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is
no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ ValidState[Index]
+ );
+
+ } else {
+ if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+ (Key.KeyState.KeyShiftState == 0 ||
Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+ Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
1,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY
and other field is zero",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x, expect State = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ Key.KeyState.KeyToggleState,
+ ValidState[Index]
+ );
+
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
index fdbc90f..5b71b6a 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2017 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2017, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD
gBBTestEntryField[] = {
},
#endif
{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+ L"ReadKeyStrokeExFunctionAuto",
+ L"Function Auto test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestReadKeyStrokeExFunctionAutoTest
+ },
+ {
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
L"ReadKeyStrokeExConformance",
L"Conformance test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
@@ -151,7 +160,6 @@ BOOLEAN BeenExecuted;
//

EFI_STATUS
-EFIAPI
InitializeSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -179,7 +187,6 @@ InitializeSimpleTextInputExBBTest (


EFI_STATUS
-EFIAPI
UnloadSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle
)
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
index cb2160b..8676606 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2017 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2017, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -57,6 +57,8 @@ Abstract:
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \ {
0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2,
0xad, 0xc7 } }

+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ {
+0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
0x89,
+0xbd } }
//
// Entry GUIDs for Conf Test
//
@@ -86,7 +88,6 @@ typedef enum {
//
//
EFI_STATUS
-EFIAPI
InitializeSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -94,7 +95,6 @@ InitializeSimpleTextInputExBBTest (


EFI_STATUS
-EFIAPI
UnloadSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle
);
@@ -155,6 +155,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
);
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );


EFI_STATUS
@@ -239,6 +248,13 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (


EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ );
+
+
+EFI_STATUS
BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
index b79772c..6876814 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2015 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2015, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -63,3 +63,8 @@ EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid007 =
EFI_TEST_SIMPLETEXTI EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;

EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
index 6c90fca..2a6be48 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -119,3 +119,13 @@ extern EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008;
{ 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda,
0xeb, 0x84 } }

extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID
\ {
+0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22,
0xa8,
+0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID
\ {
+0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1,
0x40,
+0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
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 ce5a80a..0b953ca 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestFunction.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest ( }


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *DevicePathStr;
+
+ //
+ // init
+ //
+ SimpleTextInputEx =
+ (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface // Status =
+ gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get Device Path of current Simple_Text_Input_Ex_Protocol //
And
+ out put device path or device name // Status =
+ LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
&DevicePath,
+ StandardLib); if (Status == EFI_SUCCESS) {
+ DevicePathStr = SctDevicePathToStr (DevicePath);
+ if (DevicePathStr != NULL) {
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: %s",
+ DevicePathStr
+ );
+ Status = gtBS->FreePool (DevicePathStr);
+ if (EFI_ERROR(Status))
+ return Status;
+ DevicePathStr=NULL;
+ }
+ } else {
+ //
+ // Console Splitter/StdErr
+ //
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+ );
+ }
+
+ //
+ //
+ //
+ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,
+ SimpleTextInputEx );
+
+ return EFI_SUCCESS;
+}
+
+
+
//
//Check Points
//
@@ -1060,4 +1132,143 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
);

return EFI_SUCCESS;
-}
\ No newline at end of file
+}
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_KEY_DATA Key;
+ UINT8 Index;
+
+ EFI_KEY_TOGGLE_STATE State = EFI_TOGGLE_STATE_VALID |
+ EFI_KEY_STATE_EXPOSED;
+
+ EFI_KEY_TOGGLE_STATE ValidState[] = {
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ 0
+ };
+
+ //
+ //Reset the console
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+ if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
+ return Status;
+ }
+
+ if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
support
+ // Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ &State
+ );
+
+ if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_WARNING,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+ L"%a:%d, Status = %r\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return Status;
+ }
+
+ for (Index=0; ValidState[Index]; Index++) {
+
+ //
+ // Set the valid KeyToggleState
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ ValidState + Index
+ );
+
+ if (Status != EFI_SUCCESS) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_FAILED,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
+ L"%a:%d, Status = %r, KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ ValidState[Index]
+ );
+ continue;
+ }
+
+ //
+ // Get the KeyToggleState
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+
+ if (Status != EFI_NOT_READY) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
0,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is
no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ ValidState[Index]
+ );
+
+ } else {
+ if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+ (Key.KeyState.KeyShiftState == 0 ||
Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+ Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
1,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY
and other field is zero",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x, expect State = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ Key.KeyState.KeyToggleState,
+ ValidState[Index]
+ );
+
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
index 43dbbda..c0a4f5a 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2016 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2016, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD
gBBTestEntryField[] = {
},
#endif
{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+ L"ReadKeyStrokeExFunctionAuto",
+ L"Function Auto test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestReadKeyStrokeExFunctionAutoTest
+ },
+ {
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
L"ReadKeyStrokeExConformance",
L"Conformance test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().", diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
index 0b3312e..bb0d8c9 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2014 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2014, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
+ reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License @@ -61,6 +61,8 @@ Abstract:
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \ {
0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2,
0xad, 0xc7 } }

+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ {
+0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
0x89,
+0xbd } }
//
// Entry GUIDs for Conf Test
//
@@ -157,6 +159,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
);
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );


EFI_STATUS
@@ -241,6 +252,13 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (


EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ );
+
+
+EFI_STATUS
BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
--
2.9.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2-test][Patch] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state

Supreeth Venkatesh
 

Eric,

Could you please split these as PATCH (perhaps 3 or more) series as
there are more than 10 files changed in a single patch?.

Please see comments inline.

On Wed, 2018-11-07 at 14:47 +0800, Eric Jin wrote:
UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol
are required to return KeyData.Key and KeyData.KeyState values.
These drivers must always return the most current state of
KeyData.KeyState.KeyShiftState and KeyData.KeyState.KeyToggleState.

The change in spec is "EFI_NOT_READY - There was no keystroke
data available. Current KeyData.KeyState values are exposed."

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +-
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h | 12 +-
.../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 211
++++++++++++++++++++
.../BlackBoxTest/SimpleTextInputExBBTestMain.c | 13 +-
.../BlackBoxTest/SimpleTextInputExBBTestMain.h | 22 ++-
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +-
.../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h | 12 +-
.../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 213
++++++++++++++++++++-
.../BlackBoxTest/SimpleTextInputExBBTestMain.c | 11 +-
.../BlackBoxTest/SimpleTextInputExBBTestMain.h | 20 +-
10 files changed, 515 insertions(+), 13 deletions(-)

diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
index 9cb19f4..ff2d50f 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2012 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2012, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -63,3 +63,8 @@ EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid007 =
EFI_TEST_SIMPLETEXTI
EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;

EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
index 6c90fca..2a6be48 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -119,3 +119,13 @@ extern EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008;
{ 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda,
0xeb, 0x84 } }

extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID
\
+{ 0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22,
0xa8, 0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID
\
+{ 0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1,
0x40, 0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
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 153ade0..4850627 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
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
}


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *DevicePathStr;
+
+ //
+ // init
+ //
+ SimpleTextInputEx =
(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get Device Path of current Simple_Text_Input_Ex_Protocol
+ // And out put device path or device name
+ //
+ Status = LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
&DevicePath, StandardLib);
+ if (Status == EFI_SUCCESS) {
+ DevicePathStr = SctDevicePathToStr (DevicePath);
+ if (DevicePathStr != NULL) {
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: %s",
+ DevicePathStr
+ );
+ Status = gtBS->FreePool (DevicePathStr);
+ if (EFI_ERROR(Status))
+ return Status;
+ DevicePathStr=NULL;
+ }
+ } else {
+ //
+ // Console Splitter/StdErr
+ //
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+ );
+ }
+
+ //
+ //
+ //
+ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,
SimpleTextInputEx );
Alignment with StandardLib. Use the alignment format as above in
StandardLib->RecordMessage.
+
+ return EFI_SUCCESS;
+}
+
+
+
//
//Check Points
//
@@ -1061,3 +1133,142 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (

return EFI_SUCCESS;
}
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_KEY_DATA Key;
+ UINT8 Index;
+
+ EFI_KEY_TOGGLE_STATE State = EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED;
Alignment.
+
+ EFI_KEY_TOGGLE_STATE ValidState[] = {
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
Alignment weird.
+ 0
+ };
+
+ //
+ //Reset the console
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+ if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
+ return Status;
+ }
+
+ if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
support
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ &State
+ );
+
+ if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
Extra parenthesis to make the priority clearer.
((Status == EFI_UNSUPPORTED) || (Status == EFI_DEVICE_ERROR))
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_WARNING,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+ L"%a:%d, Status = %r\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return Status;
+ }
+
+ for (Index=0; ValidState[Index]; Index++) {
+
+ //
+ // Set the valid KeyToggleState
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ ValidState + Index
+ );
+
+ if (Status != EFI_SUCCESS) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_FAILED,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
+ L"%a:%d, Status = %r, KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ ValidState[Index]
+ );
+ continue;
+ }
+
+ //
+ // Get the KeyToggleState
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+
+ if (Status != EFI_NOT_READY) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
0,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is
no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ ValidState[Index]
+ );
+
+ } else {
+ if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+ (Key.KeyState.KeyShiftState == 0 ||
Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+ Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
Complicated conditional. Can it be broken down?
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
Nit: braces after if and else even if there is is a single statement
after them to make code legible.
+
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
1,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY
and other field is zero",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x, expect State = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ Key.KeyState.KeyToggleState,
+ ValidState[Index]
+ );
+
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
index fdbc90f..5b71b6a 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2017 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2017, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
},
#endif
{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+ L"ReadKeyStrokeExFunctionAuto",
+ L"Function Auto test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestReadKeyStrokeExFunctionAutoTest
+ },
+ {
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
L"ReadKeyStrokeExConformance",
L"Conformance test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
@@ -151,7 +160,6 @@ BOOLEAN BeenExecuted;
//

EFI_STATUS
-EFIAPI
This change should be in another patch.
InitializeSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -179,7 +187,6 @@ InitializeSimpleTextInputExBBTest (


EFI_STATUS
-EFIAPI
This change should be in another patch.
UnloadSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle
)
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
index cb2160b..8676606 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2017 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2017, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -57,6 +57,8 @@ Abstract:
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \
{ 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2,
0xad, 0xc7 } }

+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \
+{ 0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
0x89, 0xbd } }
//
// Entry GUIDs for Conf Test
//
@@ -86,7 +88,6 @@ typedef enum {
//
//
EFI_STATUS
-EFIAPI
This change in another patch.

InitializeSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -94,7 +95,6 @@ InitializeSimpleTextInputExBBTest (


EFI_STATUS
-EFIAPI
This change should be in another patch.

UnloadSimpleTextInputExBBTest (
IN EFI_HANDLE ImageHandle
);
@@ -155,6 +155,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
);
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );


EFI_STATUS
@@ -239,6 +248,13 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (


EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ );
+
+
+EFI_STATUS
BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
index b79772c..6876814 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2015 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2015, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -63,3 +63,8 @@ EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid007 =
EFI_TEST_SIMPLETEXTI
EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;

EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
index 6c90fca..2a6be48 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
Guid.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -119,3 +119,13 @@ extern EFI_GUID
gSimpleTextInputExBBTestFunctionAssertionGuid008;
{ 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda,
0xeb, 0x84 } }

extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID
\
+{ 0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22,
0xa8, 0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID
\
+{ 0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1,
0x40, 0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
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 ce5a80a..0b953ca 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
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
}


+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *DevicePathStr;
+
+ //
+ // init
+ //
+ SimpleTextInputEx =
(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get Device Path of current Simple_Text_Input_Ex_Protocol
+ // And out put device path or device name
+ //
+ Status = LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
&DevicePath, StandardLib);
+ if (Status == EFI_SUCCESS) {
+ DevicePathStr = SctDevicePathToStr (DevicePath);
+ if (DevicePathStr != NULL) {
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: %s",
+ DevicePathStr
+ );
+ Status = gtBS->FreePool (DevicePathStr);
+ if (EFI_ERROR(Status))
+ return Status;
+ DevicePathStr=NULL;
+ }
+ } else {
+ //
+ // Console Splitter/StdErr
+ //
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+ );
+ }
+
+ //
+ //
+ //
+ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,
SimpleTextInputEx );
+
+ return EFI_SUCCESS;
+}
+
+
+
//
//Check Points
//
@@ -1060,4 +1132,143 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
);

return EFI_SUCCESS;
-}
\ No newline at end of file
+}
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_KEY_DATA Key;
+ UINT8 Index;
+
+ EFI_KEY_TOGGLE_STATE State = EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED;
Indentation to align with EFI_TOGGLE_STATE_VALID.

+
+ EFI_KEY_TOGGLE_STATE ValidState[] = {
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+ EFI_TOGGLE_STATE_VALID |
EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE |
EFI_CAPS_LOCK_ACTIVE,
+ 0
Indentation is weird in the above definition. please align.

+ };
+
+ //
+ //Reset the console
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+ if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
Extra Parenthesis to make the priority of evaluation clearer.

+ return Status;
+ }
+
+ if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
support
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ &State
+ );
+
+ if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
Parenthesis around both the conditions.
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_WARNING,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+ L"%a:%d, Status = %r\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return Status;
+ }
+
+ for (Index=0; ValidState[Index]; Index++) {
+
+ //
+ // Set the valid KeyToggleState
+ //
+ Status = SimpleTextInputEx->SetState (
+ SimpleTextInputEx,
+ ValidState + Index
+ );
+
+ if (Status != EFI_SUCCESS) {
+ StandardLib->RecordAssertion (
+ StandardLib,
+ EFI_TEST_ASSERTION_FAILED,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
+ L"%a:%d, Status = %r, KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ ValidState[Index]
+ );
+ continue;
+ }
+
+ //
+ // Get the KeyToggleState
+ //
+ Status = SimpleTextInputEx->ReadKeyStrokeEx (
+ SimpleTextInputEx,
+ &Key
+ );
+
+ if (Status != EFI_NOT_READY) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
0,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is
no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ ValidState[Index]
+ );
+
+ } else {
+ if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+ (Key.KeyState.KeyShiftState == 0 ||
Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+ Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestFunctionAssertionGuid01
1,
+ L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
keEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY
and other field is zero",
+ L"%a:%d, Status = %r, Index = %d,
KeyToggleState = %x, expect State = %x\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status,
+ Index,
+ Key.KeyState.KeyToggleState,
+ ValidState[Index]
+ );
+
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
index 43dbbda..c0a4f5a 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.c
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2016 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2016, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
},
#endif
{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+ L"ReadKeyStrokeExFunctionAuto",
+ L"Function Auto test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestReadKeyStrokeExFunctionAutoTest
+ },
+ {
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
L"ReadKeyStrokeExConformance",
L"Conformance test for Simple Text Input Ex Protocol
ReadKeyStrokeEx().",
diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
index 0b3312e..bb0d8c9 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
SimpleTextInputExBBTestMain.h
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2014 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2014, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of
the BSD License
@@ -61,6 +61,8 @@ Abstract:
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \
{ 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2,
0xad, 0xc7 } }

+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \
+{ 0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
0x89, 0xbd } }
//
// Entry GUIDs for Conf Test
//
@@ -157,6 +159,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
);
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );


EFI_STATUS
@@ -241,6 +252,13 @@
BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (


EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx
+ );
+
+
+EFI_STATUS
BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx


Re: [PATCH] MdePkg/BaseIoLibIntrinsicArmVirt ARM: avoid double word loads and stores

Laszlo Ersek
 

On 11/07/18 17:47, Philippe Mathieu-Daudé wrote:
On 7/11/18 14:38, Ard Biesheuvel wrote:
On 7 November 2018 at 14:13, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
BaseIoLibIntrinsicArmVirt was created to prevent LTO from merging
accesses to MMIO regions, resulting in instructions with multiple
output registers that KVM on ARM cannot emulate (since the exception
syndrome information that KVM relies on can only describe a single
output register)

However, using double word loads on ARM amounts to the same thing,
and so code that relies on doing 64-bit MMIO to regions that are
emulated under KVM (such as the GICv3 TYPER register) will still
suffer from the original issue.

So replace ldrd and strd with equivalent two instruction sequences.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Please consider this patch with the hunk below appended

---
  MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S
b/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S
index 3ad22bd5706d..0d802d6928d6 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S
+++ b/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S
@@ -125,7 +125,8 @@ ASM_PFX(MmioWrite32Internal):
  //  @return The value read.
  //
  ASM_PFX(MmioRead64Internal):
-  ldrd    r0, r1, [r0]
+  ldr     r1, [r0, #4]
+  ldr     r0, [r0]
Ard remembered me UEFI is little-endian only :)
Thus this code is safe.

With the hunk appended:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
So, this is for 32-bit ARM only, IIUC. (Supported also by the pathnames
of the files being modified.)

The commit message makes sense, and the patch looks plausible. (I didn't
go to the ARM ARM to verify the syntax, and I admit I don't know the
syntax without looking it up.)

Acked-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo



    dmb
    bx      lr

@@ -141,5 +142,6 @@ ASM_PFX(MmioRead64Internal):
  //
  ASM_PFX(MmioWrite64Internal):
    dmb     st
-  strd    r2, r3, [r0]
+  str     r2, [r0]
+  str     r3, [r0, #4]
    bx      lr
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm
b/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm
index e1a3d68a430c..deba8c1f0c59 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm
+++ b/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm
@@ -127,7 +127,8 @@ MmioWrite32Internal
  ;  @return The value read.
  ;
  MmioRead64Internal
-  ldrd    r0, r1, [r0]
+  ldr     r1, [r0, #4]
+  ldr     r0, [r0]
    dmb
    bx      lr

@@ -143,7 +144,8 @@ MmioRead64Internal
  ;
  MmioWrite64Internal
    dmb     st
-  strd    r2, r3, [r0]
+  str     r2, [r0]
+  str     r3, [r0, #4]
    bx      lr

    END
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: Soft Feature Freeze has started since Nov.1 for dk2-stable201811

Laszlo Ersek
 

On 11/07/18 16:38, Leif Lindholm wrote:
Hi Laszlo,

Can I inject an alternative interpretation? (feel free to shoot it down)

On Wed, Nov 07, 2018 at 04:14:01PM +0100, Laszlo Ersek wrote:
Hi,

On 11/07/18 02:12, Gao, Liming wrote:
Hi, all
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning
lists edk2-stable201811 tag planning. Now, we enter into Soft Feature
Freeze phase. In this phase, the feature under review will not be
allowed to be pushed. The patch review can continue without break.
Here is edk2-stable201811 tag planning.
2018-08-15 Beginning of development
2018-11-01 Soft Feature Freeze
2018-11-08 Hard Feature Freeze
2018-11-15 Release
I don't think an announcement should be made like this, one week after
the fact. (If I missed the exact dates on yesterday's stewards' call,
then I apologize.)

If we are making the announcement about the Soft Feature Freeze on
2018-Nov-07, then the Soft Feature Freeze should start no earlier than
2018-Nov-08 or so. Certainly not retro-actively.

Perhaps we should push the schedule by one week.
Do we need to send an announcement for the soft feature freeze?

I would be quite happy with that one being set in stone(ish) from the
planning page, and the hard freeze date being the one that needs to be
announced.

I understand that will prevent the stable tag from being dropped
*exactly* three months after start of development (2018-Aug-15). I think
that should be fine. Nobody forces us to work in cycles of *exactly*
three months. (Even if we slipped over to December, that shouldn't be a
huge problem; we'd just call the tag "edk2-stable201812".) The workflow
itself is work-in-progress.
Of course, I'm heavily biased since I'm hoping to make a Linaro
release this month based on the stable tag...

I realize that
<https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning>
has had the dates available all this time. But, the reason we make the
announcements in the first place is precisely that people don't keep
staring at that page.

(

For example, I reviewed and pushed 4 patches yesterday (on 2018-Nov-06):

1 e038bde2679b Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF file"
2 98856a724c2a Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
3 438ada5aa5a1 Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O."
4 328409ce8de7 Revert "OvmfPkg: VMWare SVGA display device register definitions"

which are the first four patches (out of five) from the following
series:

[edk2] [PATCH v2 0/5] OvmfPkg: simply use the Bochs interface for vmsvga

These reverts are arguably not bugfixes; they are preparation for
re-implementing a feature from scratch (the last patch in that series).
Thus, had I known we were already in the Soft Feature Freeze, I wouldn't
have pushed them, because the review was not complete before the soft
freeze start.

But I had just returned from a week (or more) of PTO, there was no
announcement on the list yet, and I didn't remember the wiki page.

(In the technical sense, the reverts are not disruptive, luckily; they
remove code that is dead anyway.)

)

This is my opinion at least -- I'm ready to be overruled, but I wanted
to voice it.
I don't disagree with anything you say, but my feeling is that we're
still learning to work with the new process, and we have seen other
mistakes during this cycle.

So, I'm happy to consider this post the announcement of the
hard-freeze with the soft-freeze date being included for context.

I agree that for the next cycle, separate announcements of soft-freeze
and hard-freeze would be preferable.

I too am OK with being overruled :)
OK, let's stick with the current dates as they are.

I do think we should send separate announcements about soft & hard
freezes. The soft freeze is the first time in a cycle when maintainers
have to stop and think about non-technical reasons before they push. I'd
really like to be poked about that.

Thanks
Laszlo