qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init()


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init()
Date: Sun, 14 Jan 2018 15:22:40 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 01/07/2018 11:45 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  include/hw/isa/superio.h | 17 +++++++++++++++++
>  hw/isa/isa-superio.c     | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  MAINTAINERS              |  2 ++
>  hw/isa/Makefile.objs     |  1 +
>  4 files changed, 65 insertions(+)
>  create mode 100644 include/hw/isa/superio.h
>  create mode 100644 hw/isa/isa-superio.c
> 
> diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
> new file mode 100644
> index 0000000000..e685b96653
> --- /dev/null
> +++ b/include/hw/isa/superio.h
> @@ -0,0 +1,17 @@
> +/*
> + * Generic ISA Super I/O
> + *
> + * Copyright (c) 2018 Philippe Mathieu-Daudé
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#ifndef HW_ISA_SUPERIO_H
> +#define HW_ISA_SUPERIO_H
> +
> +#include "hw/isa/isa.h"
> +
> +ISADevice *isa_superio_init(ISABus *isa_bus, int serial_count,
> +                            int parallel_count, int drive_count);

This approach is simple enough, but how Hervé wrote hw/isa/pc87312.c is
way cleaner, so I'll respin using it.

> +
> +#endif
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> new file mode 100644
> index 0000000000..93d8457c6b
> --- /dev/null
> +++ b/hw/isa/isa-superio.c
> @@ -0,0 +1,45 @@
> +/*
> + * Generic ISA Super I/O
> + *
> + * Copyright (c) 2018 Philippe Mathieu-Daudé
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#include "qemu/osdep.h"
> +#include "qemu/error-report.h"
> +#include "sysemu/blockdev.h"
> +#include "hw/isa/superio.h"
> +#include "hw/char/serial.h"
> +#include "hw/char/parallel.h"
> +#include "hw/block/fdc.h"
> +#include "hw/input/i8042.h"
> +
> +ISADevice *isa_superio_init(ISABus *isa_bus, int serial_count,
> +                            int parallel_count, int drive_count)
> +{
> +    serial_hds_isa_init(isa_bus, 0, serial_count);
> +
> +    parallel_hds_isa_init(isa_bus, parallel_count);
> +
> +    if (drive_count) {
> +        DriveInfo **fd;
> +        int i;
> +
> +        if (drive_count > MAX_FD) {
> +            warn_report("superio: ignoring %d floppy controllers",
> +                        drive_count - MAX_FD);
> +            drive_count = MAX_FD;
> +        }
> +        fd = g_new(DriveInfo *, drive_count);
> +
> +        for (i = 0; i < drive_count; i++) {
> +            fd[i] = drive_get(IF_FLOPPY, 0, i);
> +        }
> +        fdctrl_init_isa(isa_bus, fd);
> +
> +        g_free(fd); /* FIXME */
> +    }
> +
> +    return isa_create_simple(isa_bus, TYPE_I8042);
> +}
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7f9e98a046..6f867da743 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -875,6 +875,7 @@ F: hw/input/pckbd.c
>  F: hw/intc/apic*
>  F: hw/intc/ioapic*
>  F: hw/intc/i8259*
> +F: hw/isa/isa-superio.c
>  F: hw/misc/debugexit.c
>  F: hw/misc/pc-testdev.c
>  F: hw/timer/hpet*
> @@ -885,6 +886,7 @@ F: include/hw/display/vga.h
>  F: include/hw/char/parallel.h
>  F: include/hw/dma/i8257.h
>  F: include/hw/i2c/pm_smbus.h
> +F: include/hw/isa/superio.h
>  F: include/hw/input/i8042.h
>  F: include/hw/timer/hpet.h
>  F: include/hw/timer/i8254*
> diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
> index fb37c55cf2..cac655ba58 100644
> --- a/hw/isa/Makefile.objs
> +++ b/hw/isa/Makefile.objs
> @@ -1,4 +1,5 @@
>  common-obj-$(CONFIG_ISA_BUS) += isa-bus.o
> +common-obj-$(CONFIG_ISA_BUS) += isa-superio.o
>  common-obj-$(CONFIG_APM) += apm.o
>  common-obj-$(CONFIG_I82378) += i82378.o
>  common-obj-$(CONFIG_PC87312) += pc87312.o
> 



reply via email to

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