qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/5] serial: convert isa to qdev


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 4/5] serial: convert isa to qdev
Date: Fri, 18 Sep 2009 17:04:38 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Gerd Hoffmann <address@hidden> writes:

> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
>  hw/mips_malta.c |    4 +-
>  hw/mips_r4k.c   |    6 +---
>  hw/pc.c         |    6 +---
>  hw/pc.h         |    1 +
>  hw/ppc_prep.c   |    3 +-
>  hw/serial.c     |   77 +++++++++++++++++++++++++++++++++++++++++++++++-------
>  hw/sun4u.c      |    6 +---
>  7 files changed, 75 insertions(+), 28 deletions(-)

Stupid question: how did you figure out which serials are ISA?

[...]
> diff --git a/hw/pc.h b/hw/pc.h
> index c9cdd4a..b547d17 100644
> --- a/hw/pc.h
> +++ b/hw/pc.h
> @@ -12,6 +12,7 @@ SerialState *serial_init(int base, qemu_irq irq, int 
> baudbase,
>  SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
>                               qemu_irq irq, int baudbase,
>                               CharDriverState *chr, int ioregister);
> +SerialState *serial_isa_init(int index, CharDriverState *chr);
>  
>  /* parallel.c */
>  
> diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
> index 32f987c..3f57cbb 100644
> --- a/hw/ppc_prep.c
> +++ b/hw/ppc_prep.c
> @@ -684,7 +684,8 @@ static void ppc_prep_init (ram_addr_t ram_size,
>      //    pit = pit_init(0x40, i8259[0]);
>      rtc_init(2000);
>  
> -    serial_init(0x3f8, i8259[4], 115200, serial_hds[0]);
> +    if (serial_hds[0])
> +        serial_isa_init(0, serial_hds[0]);
>      nb_nics1 = nb_nics;
>      if (nb_nics1 > NE2000_NB_MAX)
>          nb_nics1 = NE2000_NB_MAX;

Why the new conditional?  Bug fix perhaps?

> diff --git a/hw/serial.c b/hw/serial.c
> index 1f4ce77..81021e9 100644
> --- a/hw/serial.c
> +++ b/hw/serial.c
[...]
> @@ -733,7 +735,37 @@ static void serial_init_core(SerialState *s, qemu_irq 
> irq, int baudbase,
>                            serial_event, s);
>  }
>  
> -/* If fd is zero, it means that the serial device uses the console */
> +static int serial_isa_initfn(ISADevice *dev)
> +{
> +    ISASerialState *isa = DO_UPCAST(ISASerialState, dev, dev);
> +    SerialState *s = &isa->state;
> +
> +    s->baudbase = 115200;

The initial baudbase.  Used to be defined as argument to serial_init(),
but all arguments were 115200.  Okay.

> +    isa_init_irq(dev, &s->irq, isa->isairq);
> +    serial_init_core(s);
> +    vmstate_register(isa->iobase, &vmstate_serial, s);
> +
> +    register_ioport_write(isa->iobase, 8, 1, serial_ioport_write, s);
> +    register_ioport_read(isa->iobase, 8, 1, serial_ioport_read, s);
> +    return 0;
> +}
> +
[...]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]