summaryrefslogtreecommitdiffstats
path: root/memtestEDK
diff options
context:
space:
mode:
authorRegina König2020-08-03 17:24:34 +0200
committerRegina König2020-08-03 17:24:34 +0200
commit2bee08a2e2166b45bdddd5b0132bf2de75195c0a (patch)
tree2340e7eeb0920cf3c8e094019d9d569d5131e1ed /memtestEDK
parentapplication to test EFI_GRAPHICS_OUTPUT_PROTOCOL (diff)
downloadmemtest86-2bee08a2e2166b45bdddd5b0132bf2de75195c0a.tar.gz
memtest86-2bee08a2e2166b45bdddd5b0132bf2de75195c0a.tar.xz
memtest86-2bee08a2e2166b45bdddd5b0132bf2de75195c0a.zip
Test application to work with TextOutput
Diffstat (limited to 'memtestEDK')
-rw-r--r--memtestEDK/MdeModulePkg.dsc3
-rw-r--r--memtestEDK/Memtest/GraphicsOutput/GraphicsOutputProtocol.c104
-rw-r--r--memtestEDK/Memtest/GraphicsOutput/TextOutput.c21
-rw-r--r--memtestEDK/Memtest/GraphicsOutput/TextOutput.inf32
-rwxr-xr-xmemtestEDK/Memtest/run.sh2
5 files changed, 159 insertions, 3 deletions
diff --git a/memtestEDK/MdeModulePkg.dsc b/memtestEDK/MdeModulePkg.dsc
index 4f2e097..0ea8285 100644
--- a/memtestEDK/MdeModulePkg.dsc
+++ b/memtestEDK/MdeModulePkg.dsc
@@ -211,7 +211,8 @@
Memtest/SingleComponents/TestConfig.inf
Memtest/SingleComponents/TestSmp.inf
Memtest/GetRootSystemDescriptionPointer/GetRootSystemDescriptionPointer.inf
- Memtest/GraphicsOutput/GraphicsOutputProtocol.inf
+ # Memtest/GraphicsOutput/GraphicsOutputProtocol.inf
+ Memtest/GraphicsOutput/TextOutput.inf
# MdeModulePkg/Application/HelloWorld/HelloWorld.inf
# MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.inf
diff --git a/memtestEDK/Memtest/GraphicsOutput/GraphicsOutputProtocol.c b/memtestEDK/Memtest/GraphicsOutput/GraphicsOutputProtocol.c
index e2e661b..2198553 100644
--- a/memtestEDK/Memtest/GraphicsOutput/GraphicsOutputProtocol.c
+++ b/memtestEDK/Memtest/GraphicsOutput/GraphicsOutputProtocol.c
@@ -7,6 +7,7 @@
+
static int
memcmp(const void *s1, const void *s2, UINTN n)
{
@@ -146,6 +147,105 @@ CheckGOP(BOOLEAN Verbose, IN EFI_SYSTEM_TABLE *gST, IN EFI_BOOT_SERVICES *gBS)
}
EFI_STATUS
+PrintCCP(EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ EFI_CONSOLE_CONTROL_SCREEN_MODE Mode;
+ BOOLEAN GopUgaExists;
+ BOOLEAN StdInLocked;
+
+ Status = ConsoleControl->GetMode(ConsoleControl, &Mode, &GopUgaExists, &StdInLocked);
+ if (EFI_ERROR (Status)) {
+ Print(L"ERROR: ConsoleControl GetMode failed [%d]\n", Status );
+ return Status;
+ }
+
+ Print(L"Screen mode: ");
+ switch (Mode) {
+ case EfiConsoleControlScreenText:
+ Print(L"Text");
+ break;
+ case EfiConsoleControlScreenGraphics:
+ Print(L"Graphics");
+ break;
+ case EfiConsoleControlScreenMaxValue:
+ Print(L"MaxValue");
+ break;
+ }
+ Print(L"\n");
+ Print(L"Graphics Support Avalaiable: ");
+ if (GopUgaExists)
+ Print(L"Yes");
+ else
+ Print(L"No");
+ Print(L"\n");
+
+ Print(L"\n");
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+CheckCCP(BOOLEAN Verbose, IN EFI_SYSTEM_TABLE *gST, IN EFI_BOOT_SERVICES *gBS)
+{
+ EFI_GUID gEfiConsoleControlProtocolGuid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
+ EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL;
+ EFI_HANDLE *HandleBuffer = NULL;
+ UINTN HandleCount = 0;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ // get from ConsoleOutHandle?
+ Status = gBS->HandleProtocol( gST->ConsoleOutHandle,
+ &gEfiConsoleControlProtocolGuid,
+ (VOID **) &ConsoleControl);
+ if (EFI_ERROR (Status)) {
+ Print(L"No ConsoleControl handle found via HandleProtocol\n");
+ } else {
+ Print(L"ConsoleControl handle found via HandleProtocol\n");
+ if (Verbose)
+ PrintCCP(ConsoleControl);
+ }
+
+ // try locating directly
+ Status = gBS->LocateProtocol( &gEfiConsoleControlProtocolGuid,
+ NULL,
+ (VOID **) &ConsoleControl);
+ if (EFI_ERROR(Status) || ConsoleControl == NULL) {
+ Print(L"No ConsoleControl handle found via LocateProtocol\n");
+ } else {
+ Print(L"Found ConsoleControl handle via LocateProtocol\n");
+ if (Verbose)
+ PrintCCP(ConsoleControl);
+ }
+
+ // try locating by handle
+ Status = gBS->LocateHandleBuffer( ByProtocol,
+ &gEfiConsoleControlProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer);
+ if (EFI_ERROR (Status)) {
+ Print(L"No ConsoleControl handles found via LocateHandleBuffer\n");
+ } else {
+ Print(L"Found %d ConsoleControl handles via LocateHandleBuffer\n", HandleCount);
+ for (int i = 0; i < HandleCount; i++) {
+ Status = gBS->HandleProtocol( HandleBuffer[i],
+ &gEfiConsoleControlProtocolGuid,
+ (VOID*) &ConsoleControl);
+ if (!EFI_ERROR (Status))
+ if (Verbose)
+ PrintCCP(ConsoleControl);
+ }
+ FreePool(HandleBuffer);
+ }
+
+ Print(L"\n");
+
+ return Status;
+}
+
+EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE ImageHandle,
@@ -153,7 +253,9 @@ UefiMain (
)
{
- CheckGOP(TRUE, SystemTable, SystemTable->BootServices);
+ CheckGOP(FALSE, SystemTable, SystemTable->BootServices);
+
+ CheckCCP(FALSE, SystemTable, SystemTable->BootServices);
return EFI_SUCCESS;
diff --git a/memtestEDK/Memtest/GraphicsOutput/TextOutput.c b/memtestEDK/Memtest/GraphicsOutput/TextOutput.c
new file mode 100644
index 0000000..2438786
--- /dev/null
+++ b/memtestEDK/Memtest/GraphicsOutput/TextOutput.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+#include <stdint.h>
+#include <Uefi.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiApplicationEntryPoint.h>
+
+EFI_STATUS
+EFIAPI
+UefiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console = SystemTable->ConOut;
+ Console->ClearScreen(Console);
+ while(1) {}
+ return EFI_SUCCESS;
+
+} \ No newline at end of file
diff --git a/memtestEDK/Memtest/GraphicsOutput/TextOutput.inf b/memtestEDK/Memtest/GraphicsOutput/TextOutput.inf
new file mode 100644
index 0000000..eac926e
--- /dev/null
+++ b/memtestEDK/Memtest/GraphicsOutput/TextOutput.inf
@@ -0,0 +1,32 @@
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = TextOutput
+ FILE_GUID = a4870141-61cf-430d-87e7-a5a3b0cfa899
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = UefiMain
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC Etc...
+#
+
+[Sources]
+ TextOutput.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ UefiApplicationEntryPoint
+ UefiLib
+
+[Guids]
+
+[Ppis]
+
+[Protocols]
+
+[FeaturePcd]
+
+[Pcd]
diff --git a/memtestEDK/Memtest/run.sh b/memtestEDK/Memtest/run.sh
index fb605af..82ecd19 100755
--- a/memtestEDK/Memtest/run.sh
+++ b/memtestEDK/Memtest/run.sh
@@ -3,7 +3,7 @@
(cd ..;. edksetup.sh BaseTools; build -a X64 -p MdeModulePkg/MdeModulePkg.dsc)
if [ $? -ne 0 ]; then exit 1; fi
-(cd ..; cp Build/MdeModule/DEBUG_GCC5/X64/GraphicsOutputProtocol.efi ../../git/working_dir/memtest86/test_code/hda-contents/)
+(cd ..; cp Build/MdeModule/DEBUG_GCC5/X64/TextOutput.efi ../../git/working_dir/memtest86/test_code/hda-contents/)
if [ $? -ne 0 ]; then exit 1; fi
(cd ../../../git/working_dir/memtest86/test_code; sudo ./run.sh )