$OpenBSD: patch-iodev_cmos_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/cmos.cc.orig	Sat Mar 25 21:28:48 2000
+++ iodev/cmos.cc	Fri Oct 20 19:00:32 2000
@@ -100,7 +100,7 @@ bx_cmos_c::init(bx_devices_c *d)
   else if (bx_options.cmos.time0 != 0)
           BX_CMOS_THIS s.timeval = bx_options.cmos.time0;
 
-  bx_printf("[cmos] Setting initial clock to: %s",
+  bio->printf("[CMOS] Setting initial clock to: %s",
     ctime(&(BX_CMOS_THIS s.timeval)));
 
   update_clock();
@@ -117,24 +117,24 @@ bx_cmos_c::init(bx_devices_c *d)
 #endif
              );
     if (fd < 0) {
-      perror("trying to open cmos image file.\n");
-      bx_panic("trying to open cmos image file '%s'\n",
+      perror("[CMOS] trying to open cmos image file.\n");
+      bio->panic("CMOS trying to open cmos image file '%s'\n",
         bx_options.cmos.path);
       }
     ret = fstat(fd, &stat_buf);
     if (ret) {
-      bx_panic("CMOS: could not fstat() image file.\n");
+      bio->panic("CMOS: could not fstat() image file.\n");
       }
     if (stat_buf.st_size != BX_NUM_CMOS_REGS) {
-      bx_panic("CMOS: image file not same size as BX_NUM_CMOS_REGS.\n");
+      bio->panic("CMOS: image file not same size as BX_NUM_CMOS_REGS.\n");
       }
 
     ret = read(fd, (bx_ptr_t) BX_CMOS_THIS s.reg, BX_NUM_CMOS_REGS);
     if (ret != BX_NUM_CMOS_REGS) {
-      bx_panic("CMOS: error reading cmos file.\n");
+      bio->panic("CMOS: error reading cmos file.\n");
       }
     close(fd);
-    bx_printf("CMOS: successfuly read from image file '%s'.\n",
+    bio->printf("[CMOS] loaded from '%s'.\n",
       bx_options.cmos.path);
     }
   else {
@@ -217,18 +217,18 @@ bx_cmos_c::read(Bit32u address, unsigned
   Bit8u ret8;
 
   if (io_len > 1)
-    bx_panic("cmos: io read from address %08x len=%u\n",
+    bio->panic("[CMOS] io read from address %08x len=%u\n",
              (unsigned) address, (unsigned) io_len);
 
-  if (bx_dbg.cmos)
-    bx_printf("CMOS read of CMOS register 0x%x\n",
+  if (bio->getdbg().cmos)
+    bio->printf("[CMOS] read of CMOS register 0x%x\n",
       (unsigned) BX_CMOS_THIS s.cmos_mem_address);
 
 
   switch (address) {
     case 0x0071:
       if (BX_CMOS_THIS s.cmos_mem_address >= BX_NUM_CMOS_REGS) {
-        bx_panic("unsupported cmos io read, register(0x%02x)!\n",
+        bio->panic("unsupported cmos io read, register(0x%02x)!\n",
             (unsigned) BX_CMOS_THIS s.cmos_mem_address);
         }
 
@@ -240,7 +240,7 @@ bx_cmos_c::read(Bit32u address, unsigned
       break;
 
     default:
-      bx_panic("unsupported cmos read, address=%0x%x!\n",
+      bio->panic("unsupported cmos read, address=%0x%x!\n",
         (unsigned) address);
       return(0);
       break;
@@ -268,11 +268,11 @@ bx_cmos_c::write(Bit32u address, Bit32u 
 #endif  // !BX_USE_CMOS_SMF
 
   if (io_len > 1)
-    bx_panic("cmos: io write to address %08x len=%u\n",
+    bio->panic("[CMOS] io write to address %08x len=%u\n",
              (unsigned) address, (unsigned) io_len);
 
-  if (bx_dbg.cmos)
-    bx_printf("CMOS write to address: 0x%x = 0x%x\n",
+  if (bio->getdbg().cmos)
+    bio->printf("[CMOS] write to address: 0x%x = 0x%x\n",
       (unsigned) address, (unsigned) value);
 
 
@@ -287,7 +287,7 @@ bx_cmos_c::write(Bit32u address, Bit32u 
 
     case 0x0071:
       if (BX_CMOS_THIS s.cmos_mem_address >= BX_NUM_CMOS_REGS) {
-        bx_panic("unsupported cmos io write, register(0x%02x)=%02x!\n",
+        bio->panic("unsupported cmos io write, register(0x%02x)=%02x!\n",
             (unsigned) BX_CMOS_THIS s.cmos_mem_address, (unsigned) value);
         return;
         }
@@ -302,8 +302,6 @@ bx_cmos_c::write(Bit32u address, Bit32u 
         case 0x07: // day of the month
         case 0x08: // month
         case 0x09: // year
-          //bx_printf("CMOS: write reg %02xh: value = %02xh\n",
-          //    (unsigned) BX_CMOS_THIS s.cmos_mem_address, (unsigned) value);
           BX_CMOS_THIS s.reg[BX_CMOS_THIS s.cmos_mem_address] = value;
           return;
           break;
@@ -343,7 +341,7 @@ bx_cmos_c::write(Bit32u address, Bit32u 
           unsigned dcc;
           dcc = (value >> 4) & 0x07;
           if (dcc != 0x02) {
-            bx_panic("cmos: CRA: divider chain control 0x%x\n", dcc);
+            bio->panic("[CMOS] CRA: divider chain control 0x%x\n", dcc);
             }
           BX_CMOS_THIS s.reg[0x0a] = value & 0x7f;
           BX_CMOS_THIS CRA_change();
@@ -378,9 +376,9 @@ bx_cmos_c::write(Bit32u address, Bit32u 
 
           // can not handle binary or 12-hour mode yet.
           if (value & 0x04)
-            bx_panic("cmos: write status reg B, binary format enabled.\n");
+            bio->panic("[CMOS] write status reg B, binary format enabled.\n");
           if ( !(value & 0x02) )
-            bx_panic("cmos: write status reg B, 12 hour mode enabled.\n");
+            bio->panic("[CMOS] write status reg B, 12 hour mode enabled.\n");
 
           value &= 0xf7; // bit3 always 0
           // Note: setting bit 7 clears bit 4
@@ -412,55 +410,57 @@ bx_cmos_c::write(Bit32u address, Bit32u 
 
         case 0x0c: // Control Register C
         case 0x0d: // Control Register D
-          bx_panic("cmos: write to control register 0x%x (read-only)\n",
+          bio->panic("[CMOS] write to control register 0x%x (read-only)\n",
                    BX_CMOS_THIS s.cmos_mem_address);
           break;
 
         case 0x0e: // diagnostic status
-          bx_printf("CMOS: write register 0Eh: %02x\n", (unsigned) value);
+          bio->printf("[CMOS] write register 0Eh: %02x\n", (unsigned) value);
           break;
 
 	case 0x0f: // shutdown status
           switch (value) {
             case 0x00: /* proceed with normal POST (soft reset) */
-              if (bx_dbg.reset)
-                bx_printf("CMOS: Reg 0F set to 0: shutdown action = normal POST\n");
+              if (bio->getdbg().reset)
+                bio->printf("[CMOS] Reg 0F set to 0: shutdown action = normal POST\n");
               break;
             case 0x02: /* shutdown after memory test */
-              if (bx_dbg.reset)
-                bx_printf("CMOS: Reg 0Fh: request to change shutdown action"
+              if (bio->getdbg().reset)
+                bio->printf("[CMOS] Reg 0Fh: request to change shutdown action"
                              " to shutdown after memory test\n");
               break;
             case 0x03:
-              bx_printf ("CMOS: Reg 0Fh(03) : Shutdown after memory test !\n");
+              bio->printf ("[CMOS] Reg 0Fh(03) : Shutdown after memory test !\n");
               break;
             case 0x04: /* jump to disk bootstrap routine */
-              bx_printf("CMOS: Reg 0Fh: request to change shutdown action "
+              bio->printf("[CMOS] Reg 0Fh: request to change shutdown action "
                              "to jump to disk bootstrap routine.\n");
               break;
             case 0x06:
-              bx_printf ("CMOS: Reg 0Fh(06) : Shutdown after memory test !\n");
+              bio->printf ("[CMOS] Reg 0Fh(06) : Shutdown after memory test !\n");
               break;
             case 0x09: /* return to BIOS extended memory block move
                        (interrupt 15h, func 87h was in progress) */
-              if (bx_dbg.reset)
-                bx_printf("CMOS: Reg 0Fh: request to change shutdown action "
+              if (bio->getdbg().reset)
+                bio->printf("[CMOS] Reg 0Fh: request to change shutdown action "
                              "to return to BIOS extended memory block move.\n");
               break;
             case 0x0a: /* jump to DWORD pointer at 40:67 */
-              if (bx_dbg.reset)
-                bx_printf("CMOS: Reg 0Fh: request to change shutdown action"
+              if (bio->getdbg().reset)
+                bio->printf("[CMOS] Reg 0Fh: request to change shutdown action"
                              " to jump to DWORD at 40:67\n");
               break;
             default:
-              bx_panic("unsupported cmos io write to reg F, case %x!\n",
+		if(bio->getdbg().unsupported_io)
+              bio->printf("[CMOS] cmos io write to reg F, case %x\n",
                 (unsigned) value);
               break;
             }
           break;
 
         default:
-          bx_printf("CMOS: write reg %02xh: value = %02xh\n",
+	  if(bio->getdbg().cmos)
+          bio->printf("[CMOS] write reg %02xh: value = %02xh\n",
             (unsigned) BX_CMOS_THIS s.cmos_mem_address, (unsigned) value);
           break;
         }
