Neat when doing ResetVector coding.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 OvmfPkg/ResetVector/DebugCon.asm      | 43 +++++++++++++++++++++++++++
 OvmfPkg/ResetVector/ResetVector.nasmb |  2 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 OvmfPkg/ResetVector/DebugCon.asm

diff --git a/OvmfPkg/ResetVector/DebugCon.asm b/OvmfPkg/ResetVector/DebugCon.asm
new file mode 100644
index 000000000000..9c57d1a52c75
--- /dev/null
+++ b/OvmfPkg/ResetVector/DebugCon.asm
@@ -0,0 +1,43 @@
+;------------------------------------------------------------------------------
+; @file
+; qemu debug console support macros (based on serial port macros)
+;
+; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;------------------------------------------------------------------------------
+
+%macro  outToDebugPort 1
+    mov     dx, 0x402
+    mov     al, %1
+    out     dx, al
+%endmacro
+
+%macro  debugShowCharacter 1
+    outToDebugPort %1
+%endmacro
+
+%macro  debugShowHexDigit 1
+  %if (%1 < 0xa)
+    debugShowCharacter BYTE ('0' + (%1))
+  %else
+    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
+  %endif
+%endmacro
+
+%macro  debugNewline 0
+    debugShowCharacter `\r`
+    debugShowCharacter `\n`
+%endmacro
+
+%macro  debugShowPostCode 1
+    debugShowHexDigit (((%1) >> 4) & 0xf)
+    debugShowHexDigit ((%1) & 0xf)
+    debugNewline
+%endmacro
+
+BITS    16
+
+%macro  debugInitialize 0
+    ; not required
+%endmacro
diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb 
b/OvmfPkg/ResetVector/ResetVector.nasmb
index 5832aaa8abf7..f1655ddfcde3 100644
--- a/OvmfPkg/ResetVector/ResetVector.nasmb
+++ b/OvmfPkg/ResetVector/ResetVector.nasmb
@@ -41,7 +41,7 @@
 %elifdef DEBUG_SERIAL
   %include "SerialDebug.asm"
 %else
-  %include "DebugDisabled.asm"
+  %include "DebugCon.asm"
 %endif
 
 %include "Ia32/SearchForBfvBase.asm"
-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114312): https://edk2.groups.io/g/devel/message/114312
Mute This Topic: https://groups.io/mt/103933942/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to