Hello list,

Please find here an update for memtest86+-4.20:
http://smat.ch/memtest86+.tgz for ports/sysutils/memtest86+

Tested on PC Engines APU2(beta BIOS) for memtest-serial (i386 5.8-current)
and on VMware Fusion for memtest (amd64 5.8-current)

patches/patch-config.h updated for SERIAL_BAUD_RATE 115200
(and pkg/README)
http://smat.ch/patch-config_h

patches/patch-lib_c is new, based on PR 138925 http://bugs.freebsd.org
http://smat.ch/patch-lib_c
(with small a modif for allowing the F1 key usage on the serial console, check ascii_map_string)

Problems remaining:
popup/popdown on serial_console is somehow buggy, VGA screen buffer handling is still applied... Shift P has the same effect of the F1 key (comment { 'P', 0x19}, in lib.c if you don't want that)

Enjoy,
Mathias

patch-lib_c follows (sorry for T'bird mangling spaces and tabs ...)
patch based on PR 138925 http://bugs.freebsd.org
--- lib.c.orig  Sun Jan 23 19:11:04 2011
+++ lib.c       Fri Nov 27 18:10:35 2015
@@ -577,23 +577,26 @@
 int get_key() {
        int c;

-       c = inb(0x64);
-       if ((c & 1) == 0) {
-               if (serial_cons) {
-                       int comstat;
-                       comstat = serial_echo_inb(UART_LSR);
-                       if (comstat & UART_LSR_DR) {
-                               c = serial_echo_inb(UART_RX);
-                               /* Pressing '.' has same effect as 'c'
-                                  on a keyboard.
-                                  Oct 056   Dec 46   Hex 2E   Ascii .
-                               */
-                               return (ascii_to_keycode(c));
-                       }
+       if (serial_cons) {
+               int comstat;
+               comstat = serial_echo_inb(UART_LSR);
+               if (comstat & UART_LSR_DR) {
+                       c = serial_echo_inb(UART_RX);
+                       /* Pressing '.' has same effect as 'c'
+                          on a keyboard.
+                          Oct 056   Dec 46   Hex 2E   Ascii .
+                       */
+                       return (ascii_to_keycode(c));
                }
                return(0);
        }
-       c = inb(0x60);
+
+       /* Poll the Keyboard Controler */
+       c = inb(0x64);
+       if ((c & 1) == 0)
+               return(0);
+       else
+               c = inb(0x60);
        return((c));
 }

@@ -609,7 +612,13 @@

                        /* tell the BIOS to do a warm start */
                        *((unsigned short *)0x472) = 0x1234;
-                       outb(0xfe,0x64);
+                       if (!serial_cons)
+                               /* Try Keyboard Controler */
+                               outb(0xfe,0x64);
+
+                       /* Try Reset Control Register */
+                       outb(0x02,0xcf9);
+                       outb(0x06,0xcf9);
                        break;
                case 46:
                        /* c - Configure */
@@ -802,11 +811,33 @@
        serial_echo_outb(lcr, UART_LCR); /* Done with divisor */


-       /* Prior to disabling interrupts, read the LSR and RBR
-        * registers */
-       comstat = serial_echo_inb(UART_LSR); /* COM? LSR */
-       comstat = serial_echo_inb(UART_RX);     /* COM? RBR */
-       serial_echo_outb(0x00, UART_IER); /* Disable all interrupts */
+       /* Disable interrupts */
+       comstat = serial_echo_inb(UART_IER);
+       comstat &= 0xf0;
+       serial_echo_outb(comstat, UART_IER);
+
+       /* disable fifo */
+       serial_echo_outb(0, UART_FCR);
+
+       /* Clear pending interrupts */
+ while (((comstat = serial_echo_inb(UART_IIR)) & UART_IIR_NO_INT) == 0) {
+               comstat &= 0x0f;
+               switch (comstat) {
+               case UART_IIR_RLSI:
+                       lsr = serial_echo_inb(UART_LSR);
+                       if (lsr & (UART_LSR_BI|UART_LSR_FE|UART_LSR_PE))
+                               (void)serial_echo_inb(UART_RX);
+                       break;
+               case UART_IIR_RDI:
+               case UART_IIR_RDI|0x8: /* fifo */
+                       (void)serial_echo_inb(UART_RX);
+                       break;
+               case UART_IIR_MSI:
+                       (void)serial_echo_inb(UART_MSR);
+               default:
+                       break;
+               }
+       }

        clear_screen_buf();

@@ -854,6 +885,7 @@
   {   9,   0x0f}, /* ^I/TAB -> TAB  */
   {  19,   0x39}, /* ^S     -> SP   */
   {  17,     28}, /* ^Q     -> CR   */
+  {  80,   0x3B}, /* F1 key for failsafe on serial_cons (and 'P') */

   { ' ',   0x39}, /*     SP -> SP   */
   { 'a',   0x1e},


Reply via email to