[OpenBIOS] [PATCH 6/6] SPARC64: add model to hwdefs array and set it to a suitable value

Artyom Tarasenko atar4qemu at gmail.com
Mon Jul 28 16:33:29 CEST 2014


On Sun, Jul 27, 2014 at 10:44 PM, Mark Cave-Ayland
<mark.cave-ayland at ilande.co.uk> wrote:
> At the moment we are probably closest to an Ultra250 with an UltraSPARC-IIi
> processor and PCI bus.

Are we? I thought QEMU was targeting Ultra-5. Both Ultra-5 and
Enterpise-250 have different serial ports, but Enterprise-250 may have
multiple CPUs, whereas QEMU can't.

> This property is checked by NetBSD during boot.

Does it have to be something existing? Since QEMU doesn't exactly
match any real machine, I'd prefer something like "QEMU,sun4u", but
maybe it's personal.

Regards,
Artyom

> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
> ---
>  openbios-devel/arch/sparc64/openbios.c |   17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/openbios-devel/arch/sparc64/openbios.c b/openbios-devel/arch/sparc64/openbios.c
> index 9cc1ac2..9ca0851 100644
> --- a/openbios-devel/arch/sparc64/openbios.c
> +++ b/openbios-devel/arch/sparc64/openbios.c
> @@ -47,6 +47,7 @@ static uint8_t idprom[NVRAM_IDPROM_SIZE];
>
>  struct hwdef {
>      pci_arch_t pci;
> +    const char *model;
>      uint16_t machine_id_low, machine_id_high;
>  };
>
> @@ -67,11 +68,14 @@ static const struct hwdef hwdefs[] = {
>              .io_len = 0x10000,
>              .irqs = { 0, 1, 2, 3 },
>          },
> +        .model = "SUNW,501-4681",
>          .machine_id_low = 0,
>          .machine_id_high = 255,
>      },
>  };
>
> +static const struct hwdef *hwdef = NULL;
> +
>  struct cpudef {
>      unsigned long iu_version;
>      const char *name;
> @@ -570,6 +574,8 @@ extern volatile uint64_t *obp_ticks_pointer;
>  static void
>  arch_init( void )
>  {
> +       phandle_t ph;
> +
>         openbios_init();
>         modules_init();
>  #ifdef CONFIG_DRIVER_PCI
> @@ -578,6 +584,15 @@ arch_init( void )
>          nvconf_init();
>          device_end();
>
> +        /* Set the model name */
> +        ph = find_dev("/");
> +        PUSH(pointer2cell(hwdef->model));
> +        PUSH(strlen(hwdef->model));
> +        fword("encode-string");
> +        push_str("model");
> +        PUSH_ph(ph);
> +        fword("set-property");
> +
>          /* Point to the Forth obp-ticks variable */
>          fword("obp-ticks");
>          obp_ticks_pointer = cell2pointer(POP());
> @@ -594,8 +609,6 @@ int openbios(void)
>  {
>          unsigned int i;
>          uint16_t machine_id;
> -        const struct hwdef *hwdef = NULL;
> -
>
>          for (i = 0; i < sizeof(hwdefs) / sizeof(struct hwdef); i++) {
>              isa_io_base = hwdefs[i].pci.io_base;
> --
> 1.7.10.4
>



-- 
Regards,
Artyom Tarasenko

linux/sparc and solaris/sparc under qemu blog:
http://tyom.blogspot.com/search/label/qemu



More information about the OpenBIOS mailing list