[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bochs-dev
Subject:    [Bochs-developers] bios: define diagnostic port
From:       "Sebastian Herbszt" <herbszt () gmx ! de>
Date:       2010-05-09 20:54:38
Message-ID: 7AE02E6A67064A75B0D15E21965A11E4 () FSCPC
[Download RAW message or body]

Define diagnostic port.

Sebastian

Index: bios/rombios.c
===================================================================
--- bios.orig/rombios.c
+++ bios/rombios.c
@@ -1680,12 +1680,12 @@ keyboard_init()
     /* ------------------- Flush buffers ------------------------*/
     /* Wait until buffer is empty */
     max=0xffff;
-    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x00);
+    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x00);
 
     /* flush incoming keys */
     max=0x2000;
     while (--max > 0) {
-        outb(0x80, 0x00);
+        outb(PORT_DIAG, 0x00);
         if (inb(PORT_PS2_STATUS) & 0x01) {
             inb(PORT_PS2_DATA);
             max = 0x2000;
@@ -1703,12 +1703,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x00);
+    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x00);
     if (max==0x0) keyboard_panic(00);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x01);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x01);
     if (max==0x0) keyboard_panic(01);
 
     /* read self-test result, 0x55 should be returned from 0x60 */
@@ -1721,12 +1721,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x10);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x10);
     if (max==0x0) keyboard_panic(10);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x11);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x11);
     if (max==0x0) keyboard_panic(11);
 
     /* read keyboard interface test result, */
@@ -1745,12 +1745,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x20);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x20);
     if (max==0x0) keyboard_panic(20);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x21);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x21);
     if (max==0x0) keyboard_panic(21);
 
     /* keyboard should return ACK */
@@ -1760,7 +1760,7 @@ keyboard_init()
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x31);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x31);
     if (max==0x0) keyboard_panic(31);
 
     if ((inb(PORT_PS2_DATA) != 0xaa)) {
@@ -1772,12 +1772,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x40);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x40);
     if (max==0x0) keyboard_panic(40);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x41);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x41);
     if (max==0x0) keyboard_panic(41);
 
     /* keyboard should return ACK */
@@ -1790,7 +1790,7 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x50);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x50);
     if (max==0x0) keyboard_panic(50);
 
     /* send cmd: scan code convert, disable mouse, enable IRQ 1 */
@@ -1798,7 +1798,7 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x60);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x60);
     if (max==0x0) keyboard_panic(60);
 
     /* Enable keyboard */
@@ -1806,12 +1806,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x70);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x70);
     if (max==0x0) keyboard_panic(70);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x71);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x71);
     if (max==0x0) keyboard_panic(70);
 
     /* keyboard should return ACK */
@@ -1819,7 +1819,7 @@ keyboard_init()
         keyboard_panic(996);
     }
 
-    outb(0x80, 0x77);
+    outb(PORT_DIAG, 0x77);
 }
 
 //--------------------------------------------------------------------------
@@ -4713,12 +4713,12 @@ ASM_START
     cli
 ASM_END
     outb(PORT_PS2_DATA, 0xed);
-    while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(0x80, 0x21);
+    while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(PORT_DIAG, 0x21);
     if ((inb(PORT_PS2_DATA) == 0xfa)) {
       led_flags &= 0xf8;
       led_flags |= ((shift_flags >> 4) & 0x07);
       outb(PORT_PS2_DATA, led_flags & 0x07);
-      while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(0x80, 0x21);
+      while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(PORT_DIAG, 0x21);
       inb(PORT_PS2_DATA);
       write_byte(0x0040, 0x97, led_flags);
     }
@@ -4783,12 +4783,12 @@ ASM_END
       outb(PORT_PS2_DATA, 0xf2);
       /* Wait for data */
       max=0xffff;
-      while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x00);
+      while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x00);
       if (max>0x0) {
         if ((inb(PORT_PS2_DATA) == 0xfa)) {
           do {
             max=0xffff;
-            while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x00);
+            while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x00);
             if (max>0x0) {
               kbd_code >>= 8;
               kbd_code |= (inb(PORT_PS2_DATA) << 8);
Index: bios/rombios.h
===================================================================
--- bios.orig/rombios.h
+++ bios/rombios.h
@@ -153,6 +153,7 @@
 #define PORT_PS2_STATUS        0x0064
 #define PORT_CMOS_INDEX        0x0070
 #define PORT_CMOS_DATA         0x0071
+#define PORT_DIAG              0x0080
 #define PORT_DMA_PAGE_2        0x0081
 #define PORT_A20               0x0092
 #define PORT_PIC2_CMD          0x00a0

["define_diag_port.diff" (application/octet-stream)]

Index: bios/rombios.c
===================================================================
--- bios.orig/rombios.c
+++ bios/rombios.c
@@ -1680,12 +1680,12 @@ keyboard_init()
     /* ------------------- Flush buffers ------------------------*/
     /* Wait until buffer is empty */
     max=0xffff;
-    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x00);
+    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x00);
 
     /* flush incoming keys */
     max=0x2000;
     while (--max > 0) {
-        outb(0x80, 0x00);
+        outb(PORT_DIAG, 0x00);
         if (inb(PORT_PS2_STATUS) & 0x01) {
             inb(PORT_PS2_DATA);
             max = 0x2000;
@@ -1703,12 +1703,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x00);
+    while ( (inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x00);
     if (max==0x0) keyboard_panic(00);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x01);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x01);
     if (max==0x0) keyboard_panic(01);
 
     /* read self-test result, 0x55 should be returned from 0x60 */
@@ -1721,12 +1721,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x10);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x10);
     if (max==0x0) keyboard_panic(10);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x11);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x11);
     if (max==0x0) keyboard_panic(11);
 
     /* read keyboard interface test result, */
@@ -1745,12 +1745,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x20);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x20);
     if (max==0x0) keyboard_panic(20);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x21);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x21);
     if (max==0x0) keyboard_panic(21);
 
     /* keyboard should return ACK */
@@ -1760,7 +1760,7 @@ keyboard_init()
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x31);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x31);
     if (max==0x0) keyboard_panic(31);
 
     if ((inb(PORT_PS2_DATA) != 0xaa)) {
@@ -1772,12 +1772,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x40);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x40);
     if (max==0x0) keyboard_panic(40);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x41);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x41);
     if (max==0x0) keyboard_panic(41);
 
     /* keyboard should return ACK */
@@ -1790,7 +1790,7 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x50);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x50);
     if (max==0x0) keyboard_panic(50);
 
     /* send cmd: scan code convert, disable mouse, enable IRQ 1 */
@@ -1798,7 +1798,7 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x60);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x60);
     if (max==0x0) keyboard_panic(60);
 
     /* Enable keyboard */
@@ -1806,12 +1806,12 @@ keyboard_init()
 
     /* Wait until buffer is empty */
     max=0xffff;
-    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(0x80, 0x70);
+    while ((inb(PORT_PS2_STATUS) & 0x02) && (--max>0)) outb(PORT_DIAG, 0x70);
     if (max==0x0) keyboard_panic(70);
 
     /* Wait for data */
     max=0xffff;
-    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x71);
+    while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x71);
     if (max==0x0) keyboard_panic(70);
 
     /* keyboard should return ACK */
@@ -1819,7 +1819,7 @@ keyboard_init()
         keyboard_panic(996);
     }
 
-    outb(0x80, 0x77);
+    outb(PORT_DIAG, 0x77);
 }
 
 //--------------------------------------------------------------------------
@@ -4713,12 +4713,12 @@ ASM_START
     cli
 ASM_END
     outb(PORT_PS2_DATA, 0xed);
-    while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(0x80, 0x21);
+    while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(PORT_DIAG, 0x21);
     if ((inb(PORT_PS2_DATA) == 0xfa)) {
       led_flags &= 0xf8;
       led_flags |= ((shift_flags >> 4) & 0x07);
       outb(PORT_PS2_DATA, led_flags & 0x07);
-      while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(0x80, 0x21);
+      while ((inb(PORT_PS2_STATUS) & 0x01) == 0) outb(PORT_DIAG, 0x21);
       inb(PORT_PS2_DATA);
       write_byte(0x0040, 0x97, led_flags);
     }
@@ -4783,12 +4783,12 @@ ASM_END
       outb(PORT_PS2_DATA, 0xf2);
       /* Wait for data */
       max=0xffff;
-      while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x00);
+      while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x00);
       if (max>0x0) {
         if ((inb(PORT_PS2_DATA) == 0xfa)) {
           do {
             max=0xffff;
-            while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(0x80, 0x00);
+            while ( ((inb(PORT_PS2_STATUS) & 0x01) == 0) && (--max>0) ) outb(PORT_DIAG, 0x00);
             if (max>0x0) {
               kbd_code >>= 8;
               kbd_code |= (inb(PORT_PS2_DATA) << 8);
Index: bios/rombios.h
===================================================================
--- bios.orig/rombios.h
+++ bios/rombios.h
@@ -153,6 +153,7 @@
 #define PORT_PS2_STATUS        0x0064
 #define PORT_CMOS_INDEX        0x0070
 #define PORT_CMOS_DATA         0x0071
+#define PORT_DIAG              0x0080
 #define PORT_DMA_PAGE_2        0x0081
 #define PORT_A20               0x0092
 #define PORT_PIC2_CMD          0x00a0


------------------------------------------------------------------------------



_______________________________________________
bochs-developers mailing list
bochs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-developers


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic