summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--documentation/memtest86+ code/main_c5
-rw-r--r--efi_memtest/memtest86+/bios/display.c37
-rw-r--r--efi_memtest/memtest86+/efi/display.c51
-rw-r--r--efi_memtest/memtest86+/main.c19
-rw-r--r--efi_memtest/memtest86+/smp.h2
5 files changed, 91 insertions, 23 deletions
diff --git a/documentation/memtest86+ code/main_c b/documentation/memtest86+ code/main_c
index d35dc47..ffeba34 100644
--- a/documentation/memtest86+ code/main_c
+++ b/documentation/memtest86+ code/main_c
@@ -1,5 +1,6 @@
-
-
+cpu_id defined in cpuid.c
+barrier_s in smp.h
+barrier_s *barr in smp.c
void next_test() {}
diff --git a/efi_memtest/memtest86+/bios/display.c b/efi_memtest/memtest86+/bios/display.c
index 6f44950..7994c9d 100644
--- a/efi_memtest/memtest86+/bios/display.c
+++ b/efi_memtest/memtest86+/bios/display.c
@@ -1,6 +1,11 @@
#include "test.h"
+#include "bios/logger.h" // TODO must be implemented
+#include "smp.h"
+#include "cpuid.h"
+
extern volatile short btflag;
+extern struct barrier_s *barr;
void clear_screen()
{
@@ -21,3 +26,35 @@ void clear_screen()
}
}
+
+
+/* Boot trace function */
+short tidx = 25;
+void btrace(int me, int line, char *msg, int wait, long v1, long v2)
+{
+ int y, x;
+
+ /* Is tracing turned on? */
+ if (btflag == 0) return;
+
+ spin_lock(&barr->mutex);
+ y = tidx%13;
+ x = tidx/13*40;
+ cplace(y+11, x+1, ' ');
+ if (++tidx > 25) {
+ tidx = 0;
+ }
+ y = tidx%13;
+ x = tidx/13*40;
+
+ cplace(y+11, x+1, '>');
+ dprint(y+11, x+2, me, 2, 0);
+ dprint(y+11, x+5, line, 4, 0);
+ cprint(y+11, x+10, msg);
+ hprint(y+11, x+22, v1);
+ hprint(y+11, x+31, v2);
+ if (wait) {
+ wait_keyup();
+ }
+ spin_unlock(&barr->mutex);
+}
diff --git a/efi_memtest/memtest86+/efi/display.c b/efi_memtest/memtest86+/efi/display.c
index 6e5672b..5dd98fb 100644
--- a/efi_memtest/memtest86+/efi/display.c
+++ b/efi_memtest/memtest86+/efi/display.c
@@ -1,18 +1,22 @@
+#include "Uefi.h"
+#include "Library/UefiLib.h"
+
#include "test.h"
#include "efi/logger.h"
#include "smp.h"
+#include "cpuid.h"
-#include "Uefi.h"
-#include "Library/UefiLib.h"
// #include "Library/UefiApplicationEntryPoint.h"
extern volatile short btflag;
extern EFI_SYSTEM_TABLE *gST;
+extern struct barrier_s *barr;
void clear_screen()
{
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console = gST->ConOut;
+
Console->SetMode(Console, 2);
Console->SetAttribute(Console, EFI_TEXT_ATTR(EFI_BLACK, EFI_CYAN));
Console->ClearScreen(Console);
@@ -35,10 +39,24 @@ void clear_screen()
}
+// TODO UEFI functions
+void getChar16FromInt(CHAR16* buffer, int num) {
+
+ int length = 0;
+ int tmp = num;
+ while(tmp > 10) {
+ tmp = tmp / 10;
+ Print(L"HJK %d", 6);
+ length++;
+ }
+}
+
/* Boot trace function */
short tidx = 25;
void btrace(int me, int line, char *msg, int wait, long v1, long v2)
{
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console = gST->ConOut;
+
int y, x;
/* Is tracing turned on? */
@@ -54,14 +72,25 @@ void btrace(int me, int line, char *msg, int wait, long v1, long v2)
y = tidx%13;
x = tidx/13*40;
- cplace(y+11, x+1, '>');
- dprint(y+11, x+2, me, 2, 0);
- dprint(y+11, x+5, line, 4, 0);
- cprint(y+11, x+10, msg);
- hprint(y+11, x+22, v1);
- hprint(y+11, x+31, v2);
- if (wait) {
+ Console->SetCursorPosition(Console, 1, 11);
+ Console->OutputString(Console, L">\n");
+ CHAR16 *buff;
+ getChar16FromInt(buff, me);
+ //cplace(y+11, x+1, '>');
+ /* TODO Console->SetCursorPosition(Console, 2, 11);
+ CHAR16 num[8];
+ itoa(num, me);
+ Console->OutputString(Console, num);*/
+ //dprint(y+11, x+2, me, 2, 0);
+ //dprint(y+11, x+5, line, 4, 0);
+ /* Console->SetCursorPosition(Console, 10, 11);
+ Console->OutputString(Console, msg);
+ cprint(y+11, x+10, msg);*/
+ //hprint(y+11, x+22, v1);
+ //hprint(y+11, x+31, v2);
+ /*if (wait) {
wait_keyup();
- }
- spin_unlock(&barr->mutex);
+ }*/
+ //spin_unlock(&barr->mutex);
}
+
diff --git a/efi_memtest/memtest86+/main.c b/efi_memtest/memtest86+/main.c
index aef1688..7cbafbb 100644
--- a/efi_memtest/memtest86+/main.c
+++ b/efi_memtest/memtest86+/main.c
@@ -246,24 +246,23 @@ static void parse_command_line(void)
char *cp/*, *dummy*/; // TODO modified
/*int i, j, k;*/
- print_log("5", 2);
+ print_log("Parsing command line\n", 50);
if (cmdline_parsed) {
return;
}
- print_log("5", 2);
+ print_log("Fill in cpu mask with default\n", 50);
/* Fill in the cpu mask array with the default */
for (int i=0; i<MAX_CPUS; i++) {
cpu_mask[i] = 1;
}
- print_log("5", 2);
-
+ print_log("Check if OLD_CL_MAGIC available\n", 50);
if (*OLD_CL_MAGIC_ADDR != OLD_CL_MAGIC) {
return;
}
- print_log("5", 2);
+ print_log("CL_MAGIC available\n", 50);
unsigned short offset = *OLD_CL_OFFSET_ADDR;
cp = MK_PTR(INITSEG, offset);
@@ -351,7 +350,7 @@ static void parse_command_line(void)
void test_start(void)
{ // TODO logger to file or print
// TODO smp is disabled at the moment
- int my_cpu_num, my_cpu_ord/*, run*/;
+ int my_cpu_num, my_cpu_ord/*, run*/;
btflag = 1; // TODO remove
@@ -382,14 +381,14 @@ void test_start(void)
my_cpu_ord = cpu_ord++;
smp_set_ordinal(my_cpu_num, my_cpu_ord);
- parse_command_line();
+ parse_command_line(); // TODO not possible yet
- print_log("3", 2);
+ print_log("Command line parsed, now clear_screen()\n", 50);
clear_screen();
/* Initialize the barrier so the lock in btrace will work.
* Will get redone later when we know how many CPUs we have */
- barrier_init(1);
- // btrace(my_cpu_num, __LINE__, "Begin ", 1, 0, 0);
+ barrier_init(1); // TOT Just sets some values
+ btrace(my_cpu_num, __LINE__, "Begin ", 1, 0, 0);
/* Find memory size */
/* mem_size();*/ /* must be called before initialise_cpus(); */
/* Fill in the CPUID table */
diff --git a/efi_memtest/memtest86+/smp.h b/efi_memtest/memtest86+/smp.h
index 9ed23b0..8b8014a 100644
--- a/efi_memtest/memtest86+/smp.h
+++ b/efi_memtest/memtest86+/smp.h
@@ -7,6 +7,8 @@
#define _SMP_H_
#include "stdint.h"
#include "defs.h"
+#include "cpuid.h"
+
#define MAX_CPUS 32
#include "rsdp.h"