Skip to contentSkip to conversation

[Qemu-devel] [PATCH 0/4]

PATCH New Cory Fields 6 participants 12 messages Feb 12, 2009 – Feb 14, 2009

lore
Share & tools
lore
#0 lore raw

cover [Qemu-devel] [PATCH 0/4]

This patchset creates new -boot options quiet and prompt.
Syntax: qemu -boot cad,quiet=foo,prompt=bar

See discussion on the kvm mailing list:
http://kerneltrap.org/mailarchive/linux-kvm/2009/2/7/4921514/thread

quiet silences normal text output from the bios and vgabios. I rarely care to see this output and it looks much cleaner when the first thing shown in a KVM window is init or splash (or the dreaded Windows logo)

prompt=0 lets you explicitly skip the "Press f12 for boot menu" option saving ~3 seconds on each boot. It is also implied by quietboot. This is the default action. prompt=1 must be specified in order to see this menu.

I'm very new to patches and mailing lists so any etiquette/procedural comments or critiques are appreciated. Feel free to bash me or the code...

Also, my asm-fu is weak so I'm sure those few lines need some help.

Cory Fields

#1 lore raw

PATCH 1/1 Define a new route for sending data to bios

---
 hw/fw_cfg.c |    2 ++
 hw/fw_cfg.h |    2 ++
 sysemu.h    |    3 +++
 3 files changed, 7 insertions(+), 0 deletions(-)
hw/fw_cfg.c +2 -0
index 4333ed9..fe5d393 100644
@@ -287,6 +287,8 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
     fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
     fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)nographic);
     fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
+    fw_cfg_add_i16(s, FW_CFG_QUIETBIOS, (uint16_t)quietbios);
+    fw_cfg_add_i16(s, FW_CFG_BIOSPROMPT, (uint16_t)biosprompt);
 
     register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s);
     qemu_register_reset(fw_cfg_reset, s);
hw/fw_cfg.h +2 -0
index ef8f378..a119867 100644
@@ -8,6 +8,8 @@
 #define FW_CFG_NOGRAPHIC        0x04
 #define FW_CFG_NB_CPUS          0x05
 #define FW_CFG_MACHINE_ID       0x06
+#define FW_CFG_BIOSPROMPT       0x07
+#define FW_CFG_QUIETBIOS        0x08
 #define FW_CFG_MAX_ENTRY        0x10
 
 #define FW_CFG_WRITE_CHANNEL    0x4000
sysemu.h +3 -0
index bc6d5af..14b9aef 100644
@@ -85,6 +85,9 @@ extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
 extern int nographic;
+extern int quietbios;
+extern int biosprompt;
+
 extern const char *keyboard_layout;
 extern int win2k_install_hack;
 extern int rtc_td_hack;
Signature · 1 line
1.6.0.6
#2 lore raw

Re: [Qemu-devel] [PATCH] Define a new route for sending data to bios

hw/fw_cfg.h line 14

Quoted 12 lines · Cory Fields
hw/fw_cfg.h +2 -0
index ef8f378..a119867 100644
@@ -8,6 +8,8 @@
 #define FW_CFG_NOGRAPHIC        0x04
 #define FW_CFG_NB_CPUS          0x05
 #define FW_CFG_MACHINE_ID       0x06
+#define FW_CFG_BIOSPROMPT       0x07
+#define FW_CFG_QUIETBIOS        0x08
 #define FW_CFG_MAX_ENTRY        0x10
 

Are these config parameters relevant to platforms other then x86?

Quoted 19 lines
hw/fw_cfg.h +0 -0
 #define FW_CFG_WRITE_CHANNEL    0x4000
sysemu.h +3 -0
index bc6d5af..14b9aef 100644
@@ -85,6 +85,9 @@ extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
 extern int nographic;
+extern int quietbios;
+extern int biosprompt;
+
 extern const char *keyboard_layout;
 extern int win2k_install_hack;
 extern int rtc_td_hack;
Signature · 1 line
1.6.0.6

--
Gleb.

#3 lore raw

Re: [Qemu-devel] [PATCH] Define a new route for sending data to bios

Quoted 15 lines · Gleb Natapov

hw/fw_cfg.h line 14

Quoted 12 lines · Cory Fields
hw/fw_cfg.h +2 -0
index ef8f378..a119867 100644
@@ -8,6 +8,8 @@
 #define FW_CFG_NOGRAPHIC        0x04
 #define FW_CFG_NB_CPUS          0x05
 #define FW_CFG_MACHINE_ID       0x06
+#define FW_CFG_BIOSPROMPT       0x07
+#define FW_CFG_QUIETBIOS        0x08
 #define FW_CFG_MAX_ENTRY        0x10
 

Are these config parameters relevant to platforms other then x86?

Sparc and PPC use -prom-env 'auto-boot?=false' for !BIOSPROMPT
equivalent: OpenBIOS boots without delay from the device specified with -boot, with auto-boot? variable set to false you get the Forth prompt.

It would be possible to add FW_CFG_BIOSPROMPT support to OpenBIOS, but it's duplicate functionality.

#4 lore raw

PATCH 1/1 Add args for quiet and prompt

In reply to Cory Fields

Syntax is -boot [cad],prompt=x,quiet=x where x is [0,1,true,false] Boot drive is mandatory
If prompt is set user will see "Press f12 for boot menu" This behavior has changed, it is now off by default

If quiet is set user will see no normal text output from bios. Errors will stil be displayed.

---
 vl.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)
vl.c +44 -4
index 3676537..b2da109 100644
@@ -230,6 +230,9 @@ int no_shutdown = 0;
 int cursor_hide = 1;
 int graphic_rotate = 0;
 int daemonize = 0;
+int biosprompt = 0;
+int quietbios = 0;
+
 const char *option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
 int semihosting_enabled = 0;
@@ -3875,6 +3878,10 @@ static void help(int exitcode)
            "-sd file        use 'file' as SecureDigital card image\n"
            "-pflash file    use 'file' as a parallel flash image\n"
            "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n"
+           "      [,quiet=true|false]\n"
+           "                hide bios text [default=false]\n"
+           "      [,prompt=true|false]\n"
+           "                hide boot menu prompt [default=true]\n"
            "-snapshot       write to temporary files instead of disk image files\n"
            "-m megs         set virtual RAM size to megs MB [default=%d]\n"
 #ifndef _WIN32
@@ -4556,7 +4563,7 @@ int main(int argc, char **argv, char **envp)
     int snapshot, linux_boot, net_boot;
     const char *initrd_filename;
     const char *kernel_filename, *kernel_cmdline;
-    const char *boot_devices = "";
+    char boot_devices[32] = "";
     DisplayState *ds;
     DisplayChangeListener *dcl;
     int cyls, heads, secs, translation;
@@ -4829,14 +4836,15 @@ int main(int argc, char **argv, char **envp)
                 drive_add(optarg, CDROM_ALIAS);
                 break;
             case QEMU_OPTION_boot:
-                boot_devices = optarg;
                 /* We just do some generic consistency checks */
                 {
                     /* Could easily be extended to 64 devices if needed */
                     const char *p;
+                    int num_drive_letters = 0;  
+                    char boot_opts[128];
                     
                     boot_devices_bitmap = 0;
-                    for (p = boot_devices; *p != '\0'; p++) {
+                    for (p = optarg; *p != '\0' && *p != ','; p++) {
                         /* Allowed boot devices are:
                          * a b     : floppy disk drives
                          * c ... f : IDE disk drives
@@ -4856,6 +4864,38 @@ int main(int argc, char **argv, char **envp)
                             exit(1);
                         }
                         boot_devices_bitmap |= 1 << (*p - 'a');
+                        boot_devices[num_drive_letters]=*p;
+                        num_drive_letters++;
+
+                    }
+                    
+                    strcpy(boot_opts,optarg);
+                    if (*p == ',') p++;
+                    if (get_param_value(boot_opts, sizeof(boot_opts), "quiet", p)) {
+                      if (!strcmp(boot_opts, "true") || !strcmp(boot_opts, "1")) {
+                        quietbios=1;
+                        biosprompt=0;
+                         }
+                      else if (!strcmp(boot_opts, "false") || !strcmp(boot_opts, "0")) {
+                        quietbios=0;
+                      }
+                      else {
+                        printf("Boot option not recognized\n");
+                        exit(1);
+                      }
+                    }
+
+                    if (get_param_value(boot_opts, sizeof(boot_opts), "prompt", p)){
+                      if (!strcmp(boot_opts, "true") || !strcmp(boot_opts, "1")) {
+                        biosprompt=1;
+                      }
+                      else if (!strcmp(boot_opts, "false") || !strcmp(boot_opts, "0"))  {
+                        biosprompt=0;
+                      }
+                      else {
+                        printf("Boot option not recognized\n");
+                        exit(1);
+                      }
                     }
                 }
                 break;
@@ -5343,7 +5383,7 @@ int main(int argc, char **argv, char **envp)
 
     /* boot to floppy or the default cd if no hard disk defined yet */
     if (!boot_devices[0]) {
-        boot_devices = "cad";
+        strcpy(boot_devices,"cad");
     }
     setvbuf(stdout, NULL, _IOLBF, 0);
 
Signature · 1 line
1.6.0.6
#5 lore raw

Re: [Qemu-devel] [PATCH] Add args for quiet and prompt

Quoted 39 lines · Cory Fields

Syntax is -boot [cad],prompt=x,quiet=x where x is [0,1,true,false] Boot drive is mandatory
If prompt is set user will see "Press f12 for boot menu" This behavior has changed, it is now off by default

If quiet is set user will see no normal text output from bios. Errors will stil be displayed.

---
 vl.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)
vl.c +7 -0
index 3676537..b2da109 100644
@@ -230,6 +230,9 @@ int no_shutdown = 0;
 int cursor_hide = 1;
 int graphic_rotate = 0;
 int daemonize = 0;
+int biosprompt = 0;
+int quietbios = 0;
+
 const char *option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
 int semihosting_enabled = 0;
@@ -3875,6 +3878,10 @@ static void help(int exitcode)
            "-sd file        use 'file' as SecureDigital card image\n"
            "-pflash file    use 'file' as a parallel flash image\n"
            "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n"
+           "      [,quiet=true|false]\n"
+           "                hide bios text [default=false]\n"
+           "      [,prompt=true|false]\n"
+           "                hide boot menu prompt [default=true]\n"
            "-snapshot       write to temporary files instead of disk image files\n"
            "-m megs         set virtual RAM size to megs MB [default=%d]\n"
 #ifndef _WIN32

vl.c int main(int argc, char **argv, char **envp) · line 4569

Quoted 8 lines
vl.c +1 -1
@@ -4556,7 +4563,7 @@ int main(int argc, char **argv, char **envp)
     int snapshot, linux_boot, net_boot;
     const char *initrd_filename;
     const char *kernel_filename, *kernel_cmdline;
-    const char *boot_devices = "";
+    char boot_devices[32] = "";
     DisplayState *ds;
     DisplayChangeListener *dcl;
     int cyls, heads, secs, translation;

What is the reason for this change? You could still split optarg in the code below and keep boot_devices as a pointer...

Quoted 19 lines
vl.c +3 -2
@@ -4829,14 +4836,15 @@ int main(int argc, char **argv, char **envp)
                 drive_add(optarg, CDROM_ALIAS);
                 break;
             case QEMU_OPTION_boot:
-                boot_devices = optarg;
                 /* We just do some generic consistency checks */
                 {
                     /* Could easily be extended to 64 devices if needed */
                     const char *p;
+                    int num_drive_letters = 0;  
+                    char boot_opts[128];
 
                     boot_devices_bitmap = 0;
-                    for (p = boot_devices; *p != '\0'; p++) {
+                    for (p = optarg; *p != '\0' && *p != ','; p++) {
                         /* Allowed boot devices are:
                          * a b     : floppy disk drives
                          * c ... f : IDE disk drives

vl.c int main(int argc, char **argv, char **envp) · line 4867

Quoted 4 lines
vl.c +1 -0
@@ -4856,6 +4864,38 @@ int main(int argc, char **argv, char **envp)
                             exit(1);
                         }
                         boot_devices_bitmap |= 1 << (*p - 'a');
+                        boot_devices[num_drive_letters]=*p;

...so you would avoid a buffer overflow here...

vl.c int main(int argc, char **argv, char **envp) · line 4872

Quoted 5 lines
vl.c +5 -0
+                        num_drive_letters++;
+
+                    }
+                    
+                    strcpy(boot_opts,optarg);

...and here. ;-)

Kevin

#6 lore raw

Re: [Qemu-devel] [PATCH] Add args for quiet and prompt

In reply to Cory Fields
Quoted 66 lines · Cory Fields

Syntax is -boot [cad],prompt=x,quiet=x where x is [0,1,true,false] Boot drive is mandatory
If prompt is set user will see "Press f12 for boot menu" This behavior has changed, it is now off by default

If quiet is set user will see no normal text output from bios. Errors will stil be displayed.

---
 vl.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)
vl.c +11 -3
index 3676537..b2da109 100644
@@ -230,6 +230,9 @@ int no_shutdown = 0;
 int cursor_hide = 1;
 int graphic_rotate = 0;
 int daemonize = 0;
+int biosprompt = 0;
+int quietbios = 0;
+
 const char *option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
 int semihosting_enabled = 0;
@@ -3875,6 +3878,10 @@ static void help(int exitcode)
            "-sd file        use 'file' as SecureDigital card image\n"
            "-pflash file    use 'file' as a parallel flash image\n"
            "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n"
+           "      [,quiet=true|false]\n"
+           "                hide bios text [default=false]\n"
+           "      [,prompt=true|false]\n"
+           "                hide boot menu prompt [default=true]\n"
            "-snapshot       write to temporary files instead of disk image files\n"
            "-m megs         set virtual RAM size to megs MB [default=%d]\n"
 #ifndef _WIN32
@@ -4556,7 +4563,7 @@ int main(int argc, char **argv, char **envp)
     int snapshot, linux_boot, net_boot;
     const char *initrd_filename;
     const char *kernel_filename, *kernel_cmdline;
-    const char *boot_devices = "";
+    char boot_devices[32] = "";
     DisplayState *ds;
     DisplayChangeListener *dcl;
     int cyls, heads, secs, translation;
@@ -4829,14 +4836,15 @@ int main(int argc, char **argv, char **envp)
                 drive_add(optarg, CDROM_ALIAS);
                 break;
             case QEMU_OPTION_boot:
-                boot_devices = optarg;
                 /* We just do some generic consistency checks */
                 {
                     /* Could easily be extended to 64 devices if needed */
                     const char *p;
+                    int num_drive_letters = 0;  
+                    char boot_opts[128];
 
                     boot_devices_bitmap = 0;
-                    for (p = boot_devices; *p != '\0'; p++) {
+                    for (p = optarg; *p != '\0' && *p != ','; p++) {
                         /* Allowed boot devices are:
                          * a b     : floppy disk drives
                          * c ... f : IDE disk drives

vl.c int main(int argc, char **argv, char **envp) · line 4873

Quoted 10 lines
vl.c +6 -0
@@ -4856,6 +4864,38 @@ int main(int argc, char **argv, char **envp)
                             exit(1);
                         }
                         boot_devices_bitmap |= 1 << (*p - 'a');
+                        boot_devices[num_drive_letters]=*p;
+                        num_drive_letters++;
+
+                    }
+                    
+                    strcpy(boot_opts,optarg);
 

snprintf(), optarg has no bounds and boot_opts does.

vl.c int main(int argc, char **argv, char **envp)

Quoted 7 lines
vl.c +6 -0
+                    if (*p == ',') p++;
+                    if (get_param_value(boot_opts, sizeof(boot_opts), "quiet", p)) {
+                      if (!strcmp(boot_opts, "true") || !strcmp(boot_opts, "1")) {
+                        quietbios=1;
+                        biosprompt=0;
+                         }
 

The whitespace looks a little weird to me.

Quoted 12 lines
vl.c +11 -0
+                      else if (!strcmp(boot_opts, "false") || !strcmp(boot_opts, "0")) {
+                        quietbios=0;
+                      }
+                      else {
+                        printf("Boot option not recognized\n");
+                        exit(1);
+                      }
+                    }
+
+                    if (get_param_value(boot_opts, sizeof(boot_opts), "prompt", p)){
+                      if (!strcmp(boot_opts, "true") || !strcmp(boot_opts, "1")) {

vl.c int main(int argc, char **argv, char **envp) · line 4899

Quoted 10 lines
vl.c +9 -0
+                        biosprompt=1;
+                      }
+                      else if (!strcmp(boot_opts, "false") || !strcmp(boot_opts, "0"))  {
+                        biosprompt=0;
+                      }
+                      else {
+                        printf("Boot option not recognized\n");
+                        exit(1);
+                      }
                     }

This all looks like 2-space tabs, QEMU uses 4-space tabs. I'd suggest factoring this out into a separate function too.

Regards,

Anthony Liguori

Quoted 12 lines
                 }
                 break;
vl.c +1 -1
@@ -5343,7 +5383,7 @@ int main(int argc, char **argv, char **envp)
 
     /* boot to floppy or the default cd if no hard disk defined yet */
     if (!boot_devices[0]) {
-        boot_devices = "cad";
+        strcpy(boot_devices,"cad");
     }
     setvbuf(stdout, NULL, _IOLBF, 0);
 
#7 lore raw

Re: [Qemu-devel] [PATCH] Add args for quiet and prompt

Quoted 7 lines

This all looks like 2-space tabs, QEMU uses 4-space tabs. I'd suggest factoring this out into a separate function too.

Regards,

Anthony Liguori

Just sent out a patch to fix vl.c before i noticed your suggestions. Will fix whitespace and move into a new function.

Cory Fields

#8 lore raw

PATCH 1/1 enable quietbios and biosprompt checks

In reply to Cory Fields

Note: Default behavior is changed. Now it will default to skipping the boot menu.

---
 bios/rombios.c |   90 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 67 insertions(+), 23 deletions(-)
bios/rombios.c +67 -23
index ee46e42..39a79b1 100644
@@ -144,6 +144,12 @@
 #define BX_PCIBIOS       1
 #define BX_APM           1
 
+#define BX_CFG_CTL_PORT    0x510
+#define BX_CFG_DATA_PORT   0x511
+#define BX_CFG_SIGNATURE   0x0
+#define BX_CFG_BIOSPROMPT  0x07
+#define BX_CFG_QUIETBIOS   0x08
+
 #define BX_USE_ATADRV    1
 #define BX_ELTORITO_BOOT 1
 
@@ -2014,6 +2020,32 @@ Bit16u i; ipl_entry_t *e;
   return 1;
 }
 
+int qemu_cfg_port_probe()
+{
+  outw(BX_CFG_CTL_PORT, BX_CFG_SIGNATURE);
+  if (inb(BX_CFG_DATA_PORT) != 'Q') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'E') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'M') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'U') return 0;
+  return 1;
+}
+
+int qemu_biosprompt_probe()
+{
+  if(qemu_cfg_port_probe()) 
+    outw(BX_CFG_CTL_PORT, BX_CFG_BIOSPROMPT);
+      if (inb(BX_CFG_DATA_PORT)) return 1;
+  return 0;
+}
+
+int qemu_quietbios_probe()
+{
+  if(qemu_cfg_port_probe())
+    outw(BX_CFG_CTL_PORT, BX_CFG_QUIETBIOS);
+      if (inb(BX_CFG_DATA_PORT)) return 1;
+  return 0;
+}
+
 #if BX_ELTORITO_BOOT
   void
 interactive_bootkey()
@@ -2478,7 +2510,7 @@ static int await_ide(when_done,base,timeout)
 void ata_detect( )
 {
   Bit16u ebda_seg=read_word(0x0040,0x000E);
-  Bit8u  hdcount, cdcount, device, type;
+  Bit8u  hdcount, cdcount, device, type, quietbios;
   Bit8u  buffer[0x0200];
 
 #if BX_MAX_ATA_INTERFACES > 0
@@ -2738,26 +2770,28 @@ void ata_detect( )
           break;
         }
 
-      switch (type) {
-        case ATA_TYPE_ATA:
-          printf("ata%d %s: ",channel,slave?" slave":"master");
-          i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
-	  if (sizeinmb < (1UL<<16))
-            printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
-	  else
-            printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10));
-          break;
-        case ATA_TYPE_ATAPI:
-          printf("ata%d %s: ",channel,slave?" slave":"master");
-          i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
-          if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM)
-            printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version);
-          else
-            printf(" ATAPI-%d Device\n",version);
-          break;
-        case ATA_TYPE_UNKNOWN:
-          printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master");
-          break;
+      if (!quietbios){
+        switch (type) {
+          case ATA_TYPE_ATA:
+            printf("ata%d %s: ",channel,slave?" slave":"master");
+            i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
+	    if (sizeinmb < (1UL<<16))
+              printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
+            else
+              printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10));
+            break;
+          case ATA_TYPE_ATAPI:
+            printf("ata%d %s: ",channel,slave?" slave":"master");
+            i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
+            if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM)
+              printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version);
+            else
+              printf(" ATAPI-%d Device\n",version);
+            break;
+          case ATA_TYPE_UNKNOWN:
+            printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master");
+            break;
+          }
         }
       }
     }
@@ -2767,7 +2801,7 @@ void ata_detect( )
   write_byte(ebda_seg,&EbdaData->ata.cdcount, cdcount);
   write_byte(0x40,0x75, hdcount);
 
-  printf("\n");
+  if (!quietbios) printf("\n");
 
   // FIXME : should use bios=cmos|auto|disable bits
   // FIXME : should know about translation bits
@@ -10613,7 +10647,11 @@ post_default_ints:
   mov  ax, #0xc780
   call rom_scan
 
+  call   _qemu_quietbios_probe
+  test   al,al
+  jnz    skip_bios_print
   call _print_bios_banner
+  skip_bios_print:
 
 #if BX_ROMBIOS32
   call rombios32_init
@@ -10660,7 +10698,13 @@ post_default_ints:
   call rom_scan
 
 #if BX_ELTORITO_BOOT
-  call _interactive_bootkey
+
+ call   _qemu_biosprompt_probe
+ test   al,al
+ jz    skip_timer
+ call _interactive_bootkey
+ 
+skip_timer:
 #endif // BX_ELTORITO_BOOT
 
   sti        ;; enable interrupts
Signature · 1 line
1.6.0.6
#9 lore raw

Re: [Qemu-devel] [PATCH] enable quietbios and biosprompt checks

Quoted 117 lines · Cory Fields

Note: Default behavior is changed. Now it will default to skipping the boot menu.

---
 bios/rombios.c |   90 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 67 insertions(+), 23 deletions(-)
bios/rombios.c +55 -21
index ee46e42..39a79b1 100644
@@ -144,6 +144,12 @@
 #define BX_PCIBIOS       1
 #define BX_APM           1
 
+#define BX_CFG_CTL_PORT    0x510
+#define BX_CFG_DATA_PORT   0x511
+#define BX_CFG_SIGNATURE   0x0
+#define BX_CFG_BIOSPROMPT  0x07
+#define BX_CFG_QUIETBIOS   0x08
+
 #define BX_USE_ATADRV    1
 #define BX_ELTORITO_BOOT 1
 
@@ -2014,6 +2020,32 @@ Bit16u i; ipl_entry_t *e;
   return 1;
 }
 
+int qemu_cfg_port_probe()
+{
+  outw(BX_CFG_CTL_PORT, BX_CFG_SIGNATURE);
+  if (inb(BX_CFG_DATA_PORT) != 'Q') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'E') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'M') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'U') return 0;
+  return 1;
+}
+
+int qemu_biosprompt_probe()
+{
+  if(qemu_cfg_port_probe()) 
+    outw(BX_CFG_CTL_PORT, BX_CFG_BIOSPROMPT);
+      if (inb(BX_CFG_DATA_PORT)) return 1;
+  return 0;
+}
+
+int qemu_quietbios_probe()
+{
+  if(qemu_cfg_port_probe())
+    outw(BX_CFG_CTL_PORT, BX_CFG_QUIETBIOS);
+      if (inb(BX_CFG_DATA_PORT)) return 1;
+  return 0;
+}
+
 #if BX_ELTORITO_BOOT
   void
 interactive_bootkey()
@@ -2478,7 +2510,7 @@ static int await_ide(when_done,base,timeout)
 void ata_detect( )
 {
   Bit16u ebda_seg=read_word(0x0040,0x000E);
-  Bit8u  hdcount, cdcount, device, type;
+  Bit8u  hdcount, cdcount, device, type, quietbios;
   Bit8u  buffer[0x0200];
 
 #if BX_MAX_ATA_INTERFACES > 0
@@ -2738,26 +2770,28 @@ void ata_detect( )
           break;
         }
 
-      switch (type) {
-        case ATA_TYPE_ATA:
-          printf("ata%d %s: ",channel,slave?" slave":"master");
-          i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
-	  if (sizeinmb < (1UL<<16))
-            printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
-	  else
-            printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10));
-          break;
-        case ATA_TYPE_ATAPI:
-          printf("ata%d %s: ",channel,slave?" slave":"master");
-          i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
-          if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM)
-            printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version);
-          else
-            printf(" ATAPI-%d Device\n",version);
-          break;
-        case ATA_TYPE_UNKNOWN:
-          printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master");
-          break;
+      if (!quietbios){
+        switch (type) {
+          case ATA_TYPE_ATA:
+            printf("ata%d %s: ",channel,slave?" slave":"master");
+            i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
+	    if (sizeinmb < (1UL<<16))
+              printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
+            else
+              printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10));
+            break;
+          case ATA_TYPE_ATAPI:
+            printf("ata%d %s: ",channel,slave?" slave":"master");
+            i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
+            if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM)
+              printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version);
+            else
+              printf(" ATAPI-%d Device\n",version);
+            break;
+          case ATA_TYPE_UNKNOWN:
+            printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master");
+            break;
+          }
         }
       }
     }

bios/rombios.c void ata_detect( ) · line 2805

Quoted 6 lines
bios/rombios.c +1 -1
@@ -2767,7 +2801,7 @@ void ata_detect( )
   write_byte(ebda_seg,&EbdaData->ata.cdcount, cdcount);
   write_byte(0x40,0x75, hdcount);
 
-  printf("\n");
+  if (!quietbios) printf("\n");
 

Maybe just make a change in printf() to suppress output if quietbios?

Regards,

Anthony Liguori

Quoted 30 lines
bios/rombios.c +11 -1
   // FIXME : should use bios=cmos|auto|disable bits
   // FIXME : should know about translation bits
@@ -10613,7 +10647,11 @@ post_default_ints:
   mov  ax, #0xc780
   call rom_scan
 
+  call   _qemu_quietbios_probe
+  test   al,al
+  jnz    skip_bios_print
   call _print_bios_banner
+  skip_bios_print:
 
 #if BX_ROMBIOS32
   call rombios32_init
@@ -10660,7 +10698,13 @@ post_default_ints:
   call rom_scan
 
 #if BX_ELTORITO_BOOT
-  call _interactive_bootkey
+
+ call   _qemu_biosprompt_probe
+ test   al,al
+ jz    skip_timer
+ call _interactive_bootkey
+ 
+skip_timer:
 #endif // BX_ELTORITO_BOOT
 
   sti        ;; enable interrupts
#10 lore raw

Re: [Qemu-devel] [PATCH] enable quietbios and biosprompt checks

Quoted 1 line

Maybe just make a change in printf() to suppress output if quietbios?

That's how it was first written, but that suppressed all output. This way only normal output is hidden but errors are still displayed. Do you think this behavior should be changed?

Cory Fields

#11 lore raw

PATCH 1/1 enable quietbios check

In reply to Cory Fields
---
 vgabios.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)
vgabios.c +26 -1
index fbc3588..bb78bd5 100644
@@ -55,6 +55,10 @@
 #endif
 
 #define USE_BX_INFO
+#define BX_CFG_CTL_PORT    0x510
+#define BX_CFG_DATA_PORT   0x511
+#define BX_CFG_SIGNATURE   0x00
+#define BX_CFG_QUIETBIOS   0x08
 
 /* Declares */
 static Bit8u          read_byte();
@@ -250,6 +254,10 @@ vgabios_init_func:
   call cirrus_init
 #endif
 
+ call   _qemu_quietbios_probe
+ test   al,al
+ jnz    skip_display
+
 ;; display splash screen
   call _display_splash_screen
 
@@ -269,7 +277,7 @@ vgabios_init_func:
 ;; show cirrus info
   call cirrus_display_info
 #endif
-
+skip_display:
   retf
 ASM_END
 
@@ -3897,6 +3905,23 @@ ASM_END
 #endif
 
 // --------------------------------------------------------------------------------------------
+int qemu_cfg_port_probe()
+{
+  outw(BX_CFG_CTL_PORT, BX_CFG_SIGNATURE);
+  if (inb(BX_CFG_DATA_PORT) != 'Q') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'E') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'M') return 0;
+  if (inb(BX_CFG_DATA_PORT) != 'U') return 0;
+  return 1;
+}
+
+int qemu_quietbios_probe()
+{
+  if(qemu_cfg_port_probe()) 
+    outw(BX_CFG_CTL_PORT, BX_CFG_QUIETBIOS);  
+      if (inb(BX_CFG_DATA_PORT)) return 1;
+  return 0;
+}
 
 ASM_START 
 ;; DATA_SEG_DEFS_HERE
Signature · 1 line
1.6.0.6