qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH] Define a new route for sending data to bios
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Define a new route for sending data to bios Cory Fields
@ 2009-02-12  6:41   ` Gleb Natapov
  2009-02-12 15:50     ` Blue Swirl
  0 siblings, 1 reply; 13+ messages in thread
From: Gleb Natapov @ 2009-02-12  6:41 UTC (permalink / raw)
  To: qemu-devel

On Thu, Feb 12, 2009 at 01:48:46AM -0500, Cory Fields wrote:
> diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
> index ef8f378..a119867 100644
> --- a/hw/fw_cfg.h
> +++ b/hw/fw_cfg.h
> @@ -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?

>  #define FW_CFG_WRITE_CHANNEL    0x4000
> diff --git a/sysemu.h b/sysemu.h
> index bc6d5af..14b9aef 100644
> --- a/sysemu.h
> +++ b/sysemu.h
> @@ -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;
> -- 
> 1.6.0.6
> 
> 

--
			Gleb.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 0/4]
@ 2009-02-12  6:48 Cory Fields
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Define a new route for sending data to bios Cory Fields
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Cory Fields @ 2009-02-12  6:48 UTC (permalink / raw)
  To: qemu-devel


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH] Define a new route for sending data to bios
  2009-02-12  6:48 [Qemu-devel] [PATCH 0/4] Cory Fields
@ 2009-02-12  6:48 ` Cory Fields
  2009-02-12  6:41   ` Gleb Natapov
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Add args for quiet and prompt Cory Fields
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Cory Fields @ 2009-02-12  6:48 UTC (permalink / raw)
  To: qemu-devel

---
 hw/fw_cfg.c |    2 ++
 hw/fw_cfg.h |    2 ++
 sysemu.h    |    3 +++
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 4333ed9..fe5d393 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -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);
diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
index ef8f378..a119867 100644
--- a/hw/fw_cfg.h
+++ b/hw/fw_cfg.h
@@ -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
diff --git a/sysemu.h b/sysemu.h
index bc6d5af..14b9aef 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -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;
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH] Add args for quiet and prompt
  2009-02-12  6:48 [Qemu-devel] [PATCH 0/4] Cory Fields
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Define a new route for sending data to bios Cory Fields
@ 2009-02-12  6:48 ` Cory Fields
  2009-02-12 10:42   ` Kevin Wolf
  2009-02-14 22:27   ` Anthony Liguori
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] enable quietbios and biosprompt checks Cory Fields
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] enable quietbios check Cory Fields
  3 siblings, 2 replies; 13+ messages in thread
From: Cory Fields @ 2009-02-12  6:48 UTC (permalink / raw)
  To: qemu-devel

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.

Signed-off-by: Cory Fields <FOSS@AtlasTechnologiesInc.com>
---
 vl.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/vl.c b/vl.c
index 3676537..b2da109 100644
--- a/vl.c
+++ b/vl.c
@@ -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);
 
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH] enable quietbios and biosprompt checks
  2009-02-12  6:48 [Qemu-devel] [PATCH 0/4] Cory Fields
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Define a new route for sending data to bios Cory Fields
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Add args for quiet and prompt Cory Fields
@ 2009-02-12  6:48 ` Cory Fields
  2009-02-14 22:28   ` Anthony Liguori
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] enable quietbios check Cory Fields
  3 siblings, 1 reply; 13+ messages in thread
From: Cory Fields @ 2009-02-12  6:48 UTC (permalink / raw)
  To: qemu-devel

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

Signed-off-by: Cory Fields <FOSS@AtlasTechnologiesInc.com>
---
 bios/rombios.c |   90 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 67 insertions(+), 23 deletions(-)

diff --git a/bios/rombios.c b/bios/rombios.c
index ee46e42..39a79b1 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -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
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH] enable quietbios check
  2009-02-12  6:48 [Qemu-devel] [PATCH 0/4] Cory Fields
                   ` (2 preceding siblings ...)
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] enable quietbios and biosprompt checks Cory Fields
@ 2009-02-12  6:48 ` Cory Fields
  3 siblings, 0 replies; 13+ messages in thread
From: Cory Fields @ 2009-02-12  6:48 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Cory Fields <FOSS@AtlasTechnologiesInc.com>
---
 vgabios.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/vgabios.c b/vgabios.c
index fbc3588..bb78bd5 100644
--- a/vgabios.c
+++ b/vgabios.c
@@ -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
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] Add args for quiet and prompt
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Add args for quiet and prompt Cory Fields
@ 2009-02-12 10:42   ` Kevin Wolf
  2009-02-14 22:27   ` Anthony Liguori
  1 sibling, 0 replies; 13+ messages in thread
From: Kevin Wolf @ 2009-02-12 10:42 UTC (permalink / raw)
  To: FOSS; +Cc: qemu-devel

Cory Fields schrieb:
> 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.
> 
> Signed-off-by: Cory Fields <FOSS@AtlasTechnologiesInc.com>
> ---
>  vl.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 44 insertions(+), 4 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index 3676537..b2da109 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -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;

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

> @@ -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;

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

> +                        num_drive_letters++;
> +
> +                    }
> +                    
> +                    strcpy(boot_opts,optarg);

...and here. ;-)

Kevin

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] Define a new route for sending data to bios
  2009-02-12  6:41   ` Gleb Natapov
@ 2009-02-12 15:50     ` Blue Swirl
  0 siblings, 0 replies; 13+ messages in thread
From: Blue Swirl @ 2009-02-12 15:50 UTC (permalink / raw)
  To: qemu-devel

On 2/12/09, Gleb Natapov <gleb@redhat.com> wrote:
> On Thu, Feb 12, 2009 at 01:48:46AM -0500, Cory Fields wrote:
>  > diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
>  > index ef8f378..a119867 100644
>  > --- a/hw/fw_cfg.h
>  > +++ b/hw/fw_cfg.h
>  > @@ -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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] Add args for quiet and prompt
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] Add args for quiet and prompt Cory Fields
  2009-02-12 10:42   ` Kevin Wolf
@ 2009-02-14 22:27   ` Anthony Liguori
  2009-02-15  0:07     ` Cory Fields
  1 sibling, 1 reply; 13+ messages in thread
From: Anthony Liguori @ 2009-02-14 22:27 UTC (permalink / raw)
  To: qemu-devel

Cory Fields wrote:
> 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.
>
> Signed-off-by: Cory Fields <FOSS@AtlasTechnologiesInc.com>
> ---
>  vl.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 3676537..b2da109 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -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);
>   

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

> +                    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.

> +                      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);
> +                      }
>                      }
>   

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

>                  }
>                  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);
>  
>   

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] enable quietbios and biosprompt checks
  2009-02-12  6:48 ` [Qemu-devel] [PATCH] enable quietbios and biosprompt checks Cory Fields
@ 2009-02-14 22:28   ` Anthony Liguori
  2009-02-15  0:09     ` Cory Fields
  0 siblings, 1 reply; 13+ messages in thread
From: Anthony Liguori @ 2009-02-14 22:28 UTC (permalink / raw)
  To: qemu-devel

Cory Fields wrote:
> Note: Default behavior is changed. Now it will default to skipping
> the boot menu.
>
> Signed-off-by: Cory Fields <FOSS@AtlasTechnologiesInc.com>
> ---
>  bios/rombios.c |   90 +++++++++++++++++++++++++++++++++++++++++--------------
>  1 files changed, 67 insertions(+), 23 deletions(-)
>
> diff --git a/bios/rombios.c b/bios/rombios.c
> index ee46e42..39a79b1 100644
> --- a/bios/rombios.c
> +++ b/bios/rombios.c
> @@ -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");
>   

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

Regards,

Anthony Liguori

>    // 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
>   

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH] enable quietbios and biosprompt checks
  2009-02-14 23:57 [Qemu-devel] [PATCH 0/4] Option to suppress bios output and prompt (v2) Cory Fields
@ 2009-02-14 23:57 ` Cory Fields
  0 siblings, 0 replies; 13+ messages in thread
From: Cory Fields @ 2009-02-14 23:57 UTC (permalink / raw)
  To: qemu-devel

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

Signed-off-by: Cory Fields <FOSS@AtlasTechnologiesInc.com>
---
 bios/rombios.c |   90 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 67 insertions(+), 23 deletions(-)

diff --git a/bios/rombios.c b/bios/rombios.c
index ee46e42..39a79b1 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -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
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] Add args for quiet and prompt
  2009-02-14 22:27   ` Anthony Liguori
@ 2009-02-15  0:07     ` Cory Fields
  0 siblings, 0 replies; 13+ messages in thread
From: Cory Fields @ 2009-02-15  0:07 UTC (permalink / raw)
  To: qemu-devel

> 
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] enable quietbios and biosprompt checks
  2009-02-14 22:28   ` Anthony Liguori
@ 2009-02-15  0:09     ` Cory Fields
  0 siblings, 0 replies; 13+ messages in thread
From: Cory Fields @ 2009-02-15  0:09 UTC (permalink / raw)
  To: qemu-devel

 > 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-02-14 23:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-12  6:48 [Qemu-devel] [PATCH 0/4] Cory Fields
2009-02-12  6:48 ` [Qemu-devel] [PATCH] Define a new route for sending data to bios Cory Fields
2009-02-12  6:41   ` Gleb Natapov
2009-02-12 15:50     ` Blue Swirl
2009-02-12  6:48 ` [Qemu-devel] [PATCH] Add args for quiet and prompt Cory Fields
2009-02-12 10:42   ` Kevin Wolf
2009-02-14 22:27   ` Anthony Liguori
2009-02-15  0:07     ` Cory Fields
2009-02-12  6:48 ` [Qemu-devel] [PATCH] enable quietbios and biosprompt checks Cory Fields
2009-02-14 22:28   ` Anthony Liguori
2009-02-15  0:09     ` Cory Fields
2009-02-12  6:48 ` [Qemu-devel] [PATCH] enable quietbios check Cory Fields
  -- strict thread matches above, loose matches on Subject: below --
2009-02-14 23:57 [Qemu-devel] [PATCH 0/4] Option to suppress bios output and prompt (v2) Cory Fields
2009-02-14 23:57 ` [Qemu-devel] [PATCH] enable quietbios and biosprompt checks Cory Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).