Re: [SeaBIOS] [PATCH v2] add acpi pmtimer support

2012-09-06 Thread Gerd Hoffmann
  Hi,

 +u32 pmtimer = inl(ioport);
 +return (u64)wraps << 24 | pmtimer;
>>> BTW, why is this "<< 24", and if it should be that way, shouldn't the
>>> pmtimer be "inl(ioport) & 0xff" ?
>> The pmtimer is defined to be 24 bits wide, so the shift is correct.
> This is not true in general.  It can be either 24 or 32 bits.  What it
> is depends on ACPI data (acpi_gbl_FADT->tmr_val_ext).

The piix4 emulated by qemu has 24 bits.

>  However it is
> valid to only used 24 bits.

And we certainly want to mask the ioport read (as suggested by kevin and
done in v3 of the patch) so we only pick up the 24 bits we actually use.

thanks
  Gerd


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH v3] add acpi pmtimer support

2012-09-06 Thread Kevin O'Connor
On Wed, Sep 05, 2012 at 07:28:15AM +0200, Gerd Hoffmann wrote:
> This patch makes seabios use the acpi pmtimer instead of tsc for
> timekeeping.  The pmtimer has a fixed frequency and doesn't need
> calibration, thus it doesn't suffer from calibration errors due to a
> loaded host machine.
> 
> [ v3: mask port ioport read ]
[...]
> +static u64 pmtimer_get(void)
> +{
> +u16 ioport = GET_GLOBAL(pmtimer_ioport);
> +u32 wraps = GET_LOW(pmtimer_wraps);
> +u32 pmtimer = inl(ioport);

Mask still missing?

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-09-06 Thread Markus Armbruster
Markus Armbruster  writes:

> "Kevin O'Connor"  writes:
>
>> On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
>>> Peter Stuge  writes:
>>> > Markus Armbruster wrote:
>>> >> Could SeaBIOS fail more cleanly when it detects insufficient RAM?
>>> >
>>> > What would you propose?
>>> 
>>> Fail POST with panic("Not enough RAM")?
>>
>> The amount of memory is communicated from QEMU to SeaBIOS via nvram
>> variables.  As far as I know, those variables can only communicate ram
>> sizes in 1meg chunks - so there is no way to communicate (and/or
>> detect) a ramsize of under 1 meg.
>
> Not true, the variables *can* communicate more.
>
> Here's what QEMU stores in the RTC's NVRAM ("CMOS memory") on RAM:
>
> addr  size  meaning [unit]
> 0x15 2  base memory (below 1MiB) [KiB]
> 0x17 2  extended memory (between 1MiB and 64MiB) [KiB]
> 0x30 2  copy of 0x17/0x18
> 0x34 2  memory between 16MiB and 4GiB [64KiB]
> 0x5b 3  memory above 4GiB [64KiB]
>
> Thus, memory sizes up to 16MiB can be declared with 1KiB granularity,
> and up to 1TiB with 64KiB granularity.
>
> Note that RAM 0xa..0xf is inaccessible.
>
> However, the values QEMU *currently* stores are buggy for RAM sizes
> under 640KiB: base memory is set to 640KiB, and extended memory
> underflows.  Code is pc_cmos_init() in hw/pc.c.  I'll try to get that
> fixed, either by storing correct values, or by enforcing a 1MiB minimum.

1MiB minimum was rejected.  Instead, QEMU 1.2 got this fix:

commit e89001f72edde37fb36fa7c964daa1bbeb2eca26
Author: Markus Armbruster 
Date:   Wed Aug 15 13:12:20 2012 +0200

pc: Fix RTC CMOS info on RAM for ram_size < 1MiB

pc_cmos_init() always claims 640KiB base memory, and ram_size - 1MiB
extended memory.  The latter can underflow to "lots of extended
memory".  Fix both, and clean up some.

Note: SeaBIOS currently requires 1MiB of RAM, and doesn't check
whether it got enough.

[...]

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


[SeaBIOS] RFC: Add a new boot parameter to set delay time before seabios retry to boot

2012-09-06 Thread Amos Kong

Hi all,

Seabios supports automatically reboot after X second delay on failed 
boot [1],
I want to add a parameter for qemu, it's used put a boot parameter into 
romfile

for seabios to set the delay time.

# qemu ... -boot order=n,menu=on,delay=5 ...


Comments & suggestions ? Thanks!


[1] commit b8fcf46826e77c835da0ad8127a17895bb2e2fca
Author: Kevin O'Connor 
Date:   Sat May 12 22:12:22 2012 -0400

Automatically reboot after 60 second delay on failed boot.

If no valid boot devices are found, display the error for 60 seconds
(by default) and then reboot.  This enables a periodic retry in case
one of the boot devices is still coming online.

Signed-off-by: Kevin O'Connor 



--
Amos.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] RFC: Add a new boot parameter to set delay time before seabios retry to boot

2012-09-06 Thread Gleb Natapov
On Thu, Sep 06, 2012 at 12:15:13PM +0800, Amos Kong wrote:
> Hi all,
> 
> Seabios supports automatically reboot after X second delay on failed
> boot [1],
> I want to add a parameter for qemu, it's used put a boot parameter
> into romfile
> for seabios to set the delay time.
> 
> # qemu ... -boot order=n,menu=on,delay=5 ...
> 
> 
> Comments & suggestions ? Thanks!
> 
It is not cleat what "delay" mean. May be call it "reboot-timeout".

> 
> [1] commit b8fcf46826e77c835da0ad8127a17895bb2e2fca
> Author: Kevin O'Connor 
> Date:   Sat May 12 22:12:22 2012 -0400
> 
> Automatically reboot after 60 second delay on failed boot.
> 
> If no valid boot devices are found, display the error for 60 seconds
> (by default) and then reboot.  This enables a periodic retry in case
> one of the boot devices is still coming online.
> 
> Signed-off-by: Kevin O'Connor 
> 
> 
> 
> -- 
>   Amos.

--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


[SeaBIOS] [PATCH] add acpi pmtimer support

2012-09-06 Thread Gerd Hoffmann
This patch makes seabios use the acpi pmtimer instead of tsc for
timekeeping.  The pmtimer has a fixed frequency and doesn't need
calibration, thus it doesn't suffer from calibration errors due to a
loaded host machine.

[ v4: mask port ioport read ]
[ v2: add CONFIG_PMTIMER ]

Signed-off-by: Gerd Hoffmann 
---
 src/Kconfig   |6 ++
 src/clock.c   |   31 +++
 src/pciinit.c |5 +
 src/util.h|1 +
 4 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index 6de3e71..b5dd63b 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -222,6 +222,12 @@ menu "Hardware support"
 default y
 help
 Initialize the Memory Type Range Registers (on emulators).
+config PMTIMER
+depends on !COREBOOT
+bool "Use ACPI timer"
+default y
+help
+Use the ACPI timer instead of the TSC for timekeeping (on qemu).
 endmenu
 
 menu "BIOS interfaces"
diff --git a/src/clock.c b/src/clock.c
index 69e9f17..71b913e 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -129,11 +129,42 @@ emulate_tsc(void)
 return ret;
 }
 
+u16 pmtimer_ioport VAR16VISIBLE;
+u32 pmtimer_wraps VARLOW;
+u32 pmtimer_last VARLOW;
+
+void pmtimer_init(u16 ioport, u32 khz)
+{
+if (!CONFIG_PMTIMER)
+return;
+dprintf(1, "Using pmtimer, ioport 0x%x, freq %d kHz\n", ioport, khz);
+SET_GLOBAL(pmtimer_ioport, ioport);
+SET_GLOBAL(cpu_khz, khz);
+}
+
+static u64 pmtimer_get(void)
+{
+u16 ioport = GET_GLOBAL(pmtimer_ioport);
+u32 wraps = GET_LOW(pmtimer_wraps);
+u32 pmtimer = inl(ioport) & 0xff;
+
+if (pmtimer < GET_LOW(pmtimer_last)) {
+wraps++;
+SET_LOW(pmtimer_wraps, wraps);
+}
+SET_LOW(pmtimer_last, pmtimer);
+
+dprintf(9, "pmtimer: %u:%u\n", wraps, pmtimer);
+return (u64)wraps << 24 | pmtimer;
+}
+
 static u64
 get_tsc(void)
 {
 if (unlikely(GET_GLOBAL(no_tsc)))
 return emulate_tsc();
+if (CONFIG_PMTIMER && GET_GLOBAL(pmtimer_ioport))
+return pmtimer_get();
 return rdtscll();
 }
 
diff --git a/src/pciinit.c b/src/pciinit.c
index 68f302a..31115ee 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -180,6 +180,9 @@ static const struct pci_device_id pci_class_tbl[] = {
 PCI_DEVICE_END,
 };
 
+/* PM Timer ticks per second (HZ) */
+#define PM_TIMER_FREQUENCY  3579545
+
 /* PIIX4 Power Management device (for ACPI) */
 static void piix4_pm_init(struct pci_device *pci, void *arg)
 {
@@ -191,6 +194,8 @@ static void piix4_pm_init(struct pci_device *pci, void *arg)
 pci_config_writeb(bdf, 0x80, 0x01); /* enable PM io space */
 pci_config_writel(bdf, 0x90, PORT_SMB_BASE | 1);
 pci_config_writeb(bdf, 0xd2, 0x09); /* enable SMBus io space */
+
+pmtimer_init(PORT_ACPI_PM_BASE + 0x08, PM_TIMER_FREQUENCY / 1000);
 }
 
 static const struct pci_device_id pci_device_tbl[] = {
diff --git a/src/util.h b/src/util.h
index 062eea3..7723bb1 100644
--- a/src/util.h
+++ b/src/util.h
@@ -282,6 +282,7 @@ void lpt_setup(void);
 // clock.c
 #define PIT_TICK_RATE 1193180   // Underlying HZ of PIT
 #define PIT_TICK_INTERVAL 65536 // Default interval for 18.2Hz timer
+void pmtimer_init(u16 ioport, u32 khz);
 int check_tsc(u64 end);
 void timer_setup(void);
 void ndelay(u32 count);
-- 
1.7.1


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH v3] add acpi pmtimer support

2012-09-06 Thread Gerd Hoffmann
On 09/06/12 01:28, Kevin O'Connor wrote:
> On Wed, Sep 05, 2012 at 07:28:15AM +0200, Gerd Hoffmann wrote:
>> This patch makes seabios use the acpi pmtimer instead of tsc for
>> timekeeping.  The pmtimer has a fixed frequency and doesn't need
>> calibration, thus it doesn't suffer from calibration errors due to a
>> loaded host machine.
>>
>> [ v3: mask port ioport read ]
> [...]
>> +static u64 pmtimer_get(void)
>> +{
>> +u16 ioport = GET_GLOBAL(pmtimer_ioport);
>> +u32 wraps = GET_LOW(pmtimer_wraps);
>> +u32 pmtimer = inl(ioport);
> 
> Mask still missing?

Oops.  Change was still uncommitted in my work tree, /me just forgot
'git add' I guess.  New version on the way.

cheers,
  Gerd


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] add acpi pmtimer support

2012-09-06 Thread Don Slutz

On 09/06/12 02:01, Gerd Hoffmann wrote:

This patch makes seabios use the acpi pmtimer instead of tsc for
timekeeping.  The pmtimer has a fixed frequency and doesn't need
calibration, thus it doesn't suffer from calibration errors due to a
loaded host machine.

[ v4: mask port ioport read ]
[ v2: add CONFIG_PMTIMER ]

Signed-off-by: Gerd Hoffmann 
---
  src/Kconfig   |6 ++
  src/clock.c   |   31 +++
  src/pciinit.c |5 +
  src/util.h|1 +
  4 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index 6de3e71..b5dd63b 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -222,6 +222,12 @@ menu "Hardware support"
  default y
  help
  Initialize the Memory Type Range Registers (on emulators).
+config PMTIMER
+depends on !COREBOOT
+bool "Use ACPI timer"
+default y
+help
+Use the ACPI timer instead of the TSC for timekeeping (on qemu).
  endmenu
  
  menu "BIOS interfaces"

diff --git a/src/clock.c b/src/clock.c
index 69e9f17..71b913e 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -129,11 +129,42 @@ emulate_tsc(void)
  return ret;
  }
  
+u16 pmtimer_ioport VAR16VISIBLE;

+u32 pmtimer_wraps VARLOW;
+u32 pmtimer_last VARLOW;
+
+void pmtimer_init(u16 ioport, u32 khz)
+{
+if (!CONFIG_PMTIMER)
+return;
+dprintf(1, "Using pmtimer, ioport 0x%x, freq %d kHz\n", ioport, khz);
+SET_GLOBAL(pmtimer_ioport, ioport);
+SET_GLOBAL(cpu_khz, khz);
+}
+
+static u64 pmtimer_get(void)
+{
+u16 ioport = GET_GLOBAL(pmtimer_ioport);
+u32 wraps = GET_LOW(pmtimer_wraps);
+u32 pmtimer = inl(ioport) & 0xff;
+
+if (pmtimer < GET_LOW(pmtimer_last)) {
+wraps++;
+SET_LOW(pmtimer_wraps, wraps);
+}
+SET_LOW(pmtimer_last, pmtimer);
+
+dprintf(9, "pmtimer: %u:%u\n", wraps, pmtimer);
+return (u64)wraps << 24 | pmtimer;
+}
+
  static u64
  get_tsc(void)
  {
  if (unlikely(GET_GLOBAL(no_tsc)))
  return emulate_tsc();
+if (CONFIG_PMTIMER && GET_GLOBAL(pmtimer_ioport))
+return pmtimer_get();
Should this be moved up before the 1st if?  Looks like no_tsc will 
override this change.

  return rdtscll();
  }
  
diff --git a/src/pciinit.c b/src/pciinit.c

index 68f302a..31115ee 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -180,6 +180,9 @@ static const struct pci_device_id pci_class_tbl[] = {
  PCI_DEVICE_END,
  };
  
+/* PM Timer ticks per second (HZ) */

+#define PM_TIMER_FREQUENCY  3579545
+
  /* PIIX4 Power Management device (for ACPI) */
  static void piix4_pm_init(struct pci_device *pci, void *arg)
  {
@@ -191,6 +194,8 @@ static void piix4_pm_init(struct pci_device *pci, void *arg)
  pci_config_writeb(bdf, 0x80, 0x01); /* enable PM io space */
  pci_config_writel(bdf, 0x90, PORT_SMB_BASE | 1);
  pci_config_writeb(bdf, 0xd2, 0x09); /* enable SMBus io space */
+
+pmtimer_init(PORT_ACPI_PM_BASE + 0x08, PM_TIMER_FREQUENCY / 1000);
  }
  
  static const struct pci_device_id pci_device_tbl[] = {

diff --git a/src/util.h b/src/util.h
index 062eea3..7723bb1 100644
--- a/src/util.h
+++ b/src/util.h
@@ -282,6 +282,7 @@ void lpt_setup(void);
  // clock.c
  #define PIT_TICK_RATE 1193180   // Underlying HZ of PIT
  #define PIT_TICK_INTERVAL 65536 // Default interval for 18.2Hz timer
+void pmtimer_init(u16 ioport, u32 khz);
  int check_tsc(u64 end);
  void timer_setup(void);
  void ndelay(u32 count);

  -Don

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [Qemu-devel] RFC: Add a new boot parameter to set delay time before seabios retry to boot

2012-09-06 Thread Anthony Liguori
Amos Kong  writes:

> Hi all,
>
> Seabios supports automatically reboot after X second delay on failed 
> boot [1],
> I want to add a parameter for qemu, it's used put a boot parameter into 
> romfile
> for seabios to set the delay time.
>
> # qemu ... -boot order=n,menu=on,delay=5 ...
>
>
> Comments & suggestions ? Thanks!

Why use a file and not just a key/value?

Regards,

Anthony Liguori

>
>
> [1] commit b8fcf46826e77c835da0ad8127a17895bb2e2fca
> Author: Kevin O'Connor 
> Date:   Sat May 12 22:12:22 2012 -0400
>
>  Automatically reboot after 60 second delay on failed boot.
>
>  If no valid boot devices are found, display the error for 60 seconds
>  (by default) and then reboot.  This enables a periodic retry in case
>  one of the boot devices is still coming online.
>
>  Signed-off-by: Kevin O'Connor 
>
>
>
> -- 
>   Amos.


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [Qemu-devel] RFC: Add a new boot parameter to set delay time before seabios retry to boot

2012-09-06 Thread Steve Goodrich
I'm just guessing, but perhaps because a file can be changed without rebuilding 
SeaBIOS.

- Original Message -
From: "Anthony Liguori" 
To: "Amos Kong" 
Cc: seabios@seabios.org, qemu-de...@nongnu.org
Sent: Thursday, September 6, 2012 7:36:24 AM
Subject: Re: [SeaBIOS] [Qemu-devel] RFC: Add a new boot parameter to set
delay time before seabios retry to boot

Amos Kong  writes:

> Hi all,
>
> Seabios supports automatically reboot after X second delay on failed 
> boot [1],
> I want to add a parameter for qemu, it's used put a boot parameter into 
> romfile
> for seabios to set the delay time.
>
> # qemu ... -boot order=n,menu=on,delay=5 ...
>
>
> Comments & suggestions ? Thanks!

Why use a file and not just a key/value?

Regards,

Anthony Liguori

>
>
> [1] commit b8fcf46826e77c835da0ad8127a17895bb2e2fca
> Author: Kevin O'Connor 
> Date:   Sat May 12 22:12:22 2012 -0400
>
>  Automatically reboot after 60 second delay on failed boot.
>
>  If no valid boot devices are found, display the error for 60 seconds
>  (by default) and then reboot.  This enables a periodic retry in case
>  one of the boot devices is still coming online.
>
>  Signed-off-by: Kevin O'Connor 
>
>
>
> -- 
>   Amos.


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [Qemu-devel] RFC: Add a new boot parameter to set delay time before seabios retry to boot

2012-09-06 Thread Kevin O'Connor
On Thu, Sep 06, 2012 at 08:36:24AM -0500, Anthony Liguori wrote:
> Amos Kong  writes:
> 
> > Hi all,
> >
> > Seabios supports automatically reboot after X second delay on failed 
> > boot [1],
> > I want to add a parameter for qemu, it's used put a boot parameter into 
> > romfile
> > for seabios to set the delay time.
> >
> > # qemu ... -boot order=n,menu=on,delay=5 ...
> >
> >
> > Comments & suggestions ? Thanks!
> 
> Why use a file and not just a key/value?

SeaBIOS already accepts a number of run-time config settings (such as
the reboot delay) via helper functions.  For example:

u32 retrytime = romfile_loadint("etc/boot-fail-wait", 60*1000);

On QEMU, the above will pull the value from the fwcfg "file"
interface.  The "file" interface is used because SeaBIOS needs a
reliable way of obtaining a name, value size, and value.  It in no way
requires that there be a real file on the user's host machine.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [Qemu-devel] [PATCH] add a boot parameter to set reboot timeout

2012-09-06 Thread Amos Kong

On 06/09/12 20:46, Gleb Natapov wrote:

On Thu, Sep 06, 2012 at 08:39:24PM +0800, Amos Kong wrote:

Added an option to let qemu transfer a configuration file to bios,
"etc/boot-fail-wait", which could be specified by command
 -boot reboot-timeout=T
T have a max value of 0x, unit is ms.

With this option, guest will wait for a given time if not find
bootabled device, then reboot. This feature need the new seabios's
support.


IMO default should be no reboot just like before Seabios change.


Seabios reboots in 60s by default.

And I agree with you, will pass a '-1' to seabios by default,
then the default behavior of qemu is no-reboot.

Thanks, Amos


Signed-off-by: Amos Kong 
---
  hw/fw_cfg.c |   29 +
  qemu-config.c   |3 +++
  qemu-options.hx |   10 +++---
  vl.c|3 ++-
  4 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 7b3b576..a017184 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -183,6 +183,34 @@ static void fw_cfg_bootsplash(FWCfgState *s)
  }
  }

+static void fw_cfg_reboot(FWCfgState *s)
+{
+int reboot_timeout = -1;
+char *p;
+const char *temp;
+
+/* get user configuration */
+QemuOptsList *plist = qemu_find_opts("boot-opts");
+QemuOpts *opts = QTAILQ_FIRST(&plist->head);
+if (opts != NULL) {
+temp = qemu_opt_get(opts, "reboot-timeout");
+if (temp != NULL) {
+p = (char *)temp;
+reboot_timeout = strtol(p, (char **)&p, 10);
+}
+}
+if (reboot_timeout >= 0) {
+/* validate the input */
+if (reboot_timeout > 0x) {
+error_report("reboot timeout is larger than 65535,"
+ " force it to 65535.");
+reboot_timeout = 0x;
+}
+   fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&reboot_timeout, 4),
+   4);
+}
+}
+
  static void fw_cfg_write(FWCfgState *s, uint8_t value)
  {
  int arch = !!(s->cur_entry & FW_CFG_ARCH_LOCAL);
@@ -497,6 +525,7 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t 
data_port,
  fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
  fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
  fw_cfg_bootsplash(s);
+fw_cfg_reboot(s);

  s->machine_ready.notify = fw_cfg_machine_ready;
  qemu_add_machine_init_done_notifier(&s->machine_ready);
diff --git a/qemu-config.c b/qemu-config.c
index c05ffbc..b9f9e0f 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -638,6 +638,9 @@ QemuOptsList qemu_boot_opts = {
  }, {
  .name = "splash-time",
  .type = QEMU_OPT_STRING,
+}, {
+.name = "reboot-timeout",
+.type = QEMU_OPT_STRING,
  },
  { /*End of list */ }
  },
diff --git a/qemu-options.hx b/qemu-options.hx
index 3c411c4..d50505b 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -339,13 +339,14 @@ ETEXI

  DEF("boot", HAS_ARG, QEMU_OPTION_boot,
  "-boot [order=drives][,once=drives][,menu=on|off]\n"
-"  [,splash=sp_name][,splash-time=sp_time]\n"
+"  [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time]\n"
  "'drives': floppy (a), hard disk (c), CD-ROM (d), network 
(n)\n"
  "'sp_name': the file's name that would be passed to bios as 
logo picture, if menu=on\n"
-"'sp_time': the period that splash picture last if menu=on, 
unit is ms\n",
+"'sp_time': the period that splash picture last if menu=on, 
unit is ms\n"
+"'rb_timeout': the timeout before guest reboot when boot 
failed, unit is ms\n",
  QEMU_ARCH_ALL)
  STEXI
-@item -boot 
[order=@var{drives}][,once=@var{drives}][,menu=on|off][,splash=@var{sp_name}][,splash-time=@var{sp_time}]
+@item -boot 
[order=@var{drives}][,once=@var{drives}][,menu=on|off][,splash=@var{sp_name}][,splash-time=@var{sp_time}][,reboot-timeout=@var{rb_timeout}]
  @findex -boot
  Specify boot order @var{drives} as a string of drive letters. Valid
  drive letters depend on the target achitecture. The x86 PC uses: a, b
@@ -364,6 +365,9 @@ limitation: The splash file could be a jpeg file or a BMP 
file in 24 BPP
  format(true color). The resolution should be supported by the SVGA mode, so
  the recommended is 320x240, 640x480, 800x640.

+A timeout could be passed to bios, guest will pause for @var{rb_timeout} ms
+when boot failed, then reboot.
+
  @example
  # try to boot from network first, then from hard disk
  qemu-system-i386 -boot order=nc
diff --git a/vl.c b/vl.c
index 7c577fa..1bd9931 100644
--- a/vl.c
+++ b/vl.c
@@ -2622,7 +2622,8 @@ int main(int argc, char **argv, char **envp)
  {
  static const char * const params[] = {
  "order", "once", "menu",
-"splash", "splash-time", NULL
+"splash", "splash-time",
+ 

[SeaBIOS] [PATCH v2] add a boot parameter to set reboot timeout

2012-09-06 Thread Amos Kong
Added an option to let qemu transfer a configuration file to bios,
"etc/boot-fail-wait", which could be specified by command
-boot reboot-timeout=T
T have a max value of 0x, unit is ms.

With this option, guest will wait for a given time if not find
bootabled device, then reboot. If reboot-timeout is '-1', guest
will not reboot, qemu passes '-1' to bios by default.

This feature need the new seabios's support.

Seabios pulls the value from the fwcfg "file" interface, this
interface is used because SeaBIOS needs a reliable way of
obtaining a name, value size, and value. It in no way requires
that there be a real file on the user's host machine.

Signed-off-by: Amos Kong 
---
v2: qemu passes '-1' to bios, guest will not reboot

---
 hw/fw_cfg.c |   25 +
 qemu-config.c   |3 +++
 qemu-options.hx |   12 +---
 vl.c|3 ++-
 4 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 7b3b576..dcde1a9 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -183,6 +183,30 @@ static void fw_cfg_bootsplash(FWCfgState *s)
 }
 }
 
+static void fw_cfg_reboot(FWCfgState *s)
+{
+int reboot_timeout = -1;
+char *p;
+const char *temp;
+
+/* get user configuration */
+QemuOptsList *plist = qemu_find_opts("boot-opts");
+QemuOpts *opts = QTAILQ_FIRST(&plist->head);
+if (opts != NULL) {
+temp = qemu_opt_get(opts, "reboot-timeout");
+if (temp != NULL) {
+p = (char *)temp;
+reboot_timeout = strtol(p, (char **)&p, 10);
+}
+}
+/* validate the input */
+if (reboot_timeout > 0x) {
+error_report("reboot timeout is larger than 65535, force it to 
65535.");
+reboot_timeout = 0x;
+}
+fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&reboot_timeout, 4), 4);
+}
+
 static void fw_cfg_write(FWCfgState *s, uint8_t value)
 {
 int arch = !!(s->cur_entry & FW_CFG_ARCH_LOCAL);
@@ -497,6 +521,7 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t 
data_port,
 fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
 fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
 fw_cfg_bootsplash(s);
+fw_cfg_reboot(s);
 
 s->machine_ready.notify = fw_cfg_machine_ready;
 qemu_add_machine_init_done_notifier(&s->machine_ready);
diff --git a/qemu-config.c b/qemu-config.c
index c05ffbc..b9f9e0f 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -638,6 +638,9 @@ QemuOptsList qemu_boot_opts = {
 }, {
 .name = "splash-time",
 .type = QEMU_OPT_STRING,
+}, {
+.name = "reboot-timeout",
+.type = QEMU_OPT_STRING,
 },
 { /*End of list */ }
 },
diff --git a/qemu-options.hx b/qemu-options.hx
index 3c411c4..0249a60 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -339,13 +339,14 @@ ETEXI
 
 DEF("boot", HAS_ARG, QEMU_OPTION_boot,
 "-boot [order=drives][,once=drives][,menu=on|off]\n"
-"  [,splash=sp_name][,splash-time=sp_time]\n"
+"  [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time]\n"
 "'drives': floppy (a), hard disk (c), CD-ROM (d), network 
(n)\n"
 "'sp_name': the file's name that would be passed to bios 
as logo picture, if menu=on\n"
-"'sp_time': the period that splash picture last if 
menu=on, unit is ms\n",
+"'sp_time': the period that splash picture last if 
menu=on, unit is ms\n"
+"'rb_timeout': the timeout before guest reboot when boot 
failed, unit is ms\n",
 QEMU_ARCH_ALL)
 STEXI
-@item -boot 
[order=@var{drives}][,once=@var{drives}][,menu=on|off][,splash=@var{sp_name}][,splash-time=@var{sp_time}]
+@item -boot 
[order=@var{drives}][,once=@var{drives}][,menu=on|off][,splash=@var{sp_name}][,splash-time=@var{sp_time}][,reboot-timeout=@var{rb_timeout}]
 @findex -boot
 Specify boot order @var{drives} as a string of drive letters. Valid
 drive letters depend on the target achitecture. The x86 PC uses: a, b
@@ -364,6 +365,11 @@ limitation: The splash file could be a jpeg file or a BMP 
file in 24 BPP
 format(true color). The resolution should be supported by the SVGA mode, so
 the recommended is 320x240, 640x480, 800x640.
 
+A timeout could be passed to bios, guest will pause for @var{rb_timeout} ms
+when boot failed, then reboot. If @var{rb_timeout} is '-1', guest will not
+reboot, qemu passes '-1' to bios by default. Currently Seabios for X86
+system support it.
+
 @example
 # try to boot from network first, then from hard disk
 qemu-system-i386 -boot order=nc
diff --git a/vl.c b/vl.c
index 7c577fa..1bd9931 100644
--- a/vl.c
+++ b/vl.c
@@ -2622,7 +2622,8 @@ int main(int argc, char **argv, char **envp)
 {
 static const char * const params[] = {
 "order", "once", "menu",
-"splash", "splash-time", NULL
+ 

[SeaBIOS] Is there any sheduler for supporting USB 3.0 in SeaBIOS ?

2012-09-06 Thread wx




Hi,Is there any plan for supporting USB 3.0?Thanks! 
  ___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios