remove i386/pc dependency: generic SuperIO, PIIX cleanup
cover remove i386/pc dependency: generic SuperIO, PIIX cleanup
Hi,
This series could be the 'part 2' of my previous "remove i386/pc dependency from non-PC world" I started around 2.9.
As Hervé sent a PIIX4 series [1], I awoke this old branch to reduce duplicated effort and added Hervé patches.
Hervé: what is missing from your series is the 'user_creatable' part, I'll fix this when I find more spare time.
Regards,
Phil.
[1]: http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg01028.html
Hervé Poussineau (8):
mc146818rtc: always register rtc to rtc list
piix4: rename some variables in realize function
piix4: convert reset function to QOM
piix4: add Reset Control Register
piix4: add a i8259 interrupt controller as specified in datasheet
piix4: add a i8257 dma controller as specified in datasheet
piix4: add a i8254 pit controller as specified in datasheet
piix4: add a speaker as specified in datasheet
Philippe Mathieu-Daudé (21):
hw/acpi: add mem/nvdimm.h dependency
pci/pci_host: move generic definitions out of i386/pc.h hw/isa: extract parallel-isa specific code
hw/dma/i8257: rename DMA_init() to i8257_dma_init() hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h hw/isa: add a generic isa_superio_init()
hw/i386/pc: use isa_superio_init()
hw/mips/fulong2e: use isa_superio_init()
hw/mips/malta: code movement
hw/mips/malta: add fdc37m81x_init() which uses isa_superio_init() Revert "irq: introduce qemu_irq_proxy()"
piix: move piix4 declaration into new southbridge/i82371_piix.h
piix: move southbridge related declarations/definitions to i82371_piix.h
piix3: extract piix3_init() from i440fx_init()
hw/i386: extract i440fx related declarations/definitions to i440fx.h hw/i386: extract i440fx code from piix.c into i440fx.c hw/i386: move piix from hw/pci-host to hw/southbridge configs/mips-softmmu: use common CONFIG_PCI_PIIX instead of CONFIG_PIIX4
piix3: convert reset function to QOM
piix: merge common code from isa/piix4.c with southbridge piix3
piix4: add isa_superio_init
default-configs/i386-softmmu.mak | 1 +
default-configs/mips-softmmu-common.mak | 2 +-
default-configs/x86_64-softmmu.mak | 1 +
include/hw/acpi/piix4.h | 6 -
include/hw/char/parallel.h | 14 +
include/hw/{isa => dma}/i8257.h | 6 +
include/hw/i386/pc.h | 63 ----
include/hw/input/i8042.h | 25 ++
include/hw/irq.h | 5 -
include/hw/isa/isa.h | 2 -
include/hw/isa/superio.h | 17 +
include/hw/pci-host/i440fx.h | 51 +++
include/hw/pci/pci_host.h | 8 +
include/hw/southbridge/i82371_piix.h | 38 +++
hw/acpi/ich9.c | 1 +
hw/acpi/pcihp.c | 2 +-
hw/acpi/piix4.c | 3 +-
hw/alpha/dp264.c | 3 +-
hw/char/parallel-isa.c | 29 ++
hw/char/parallel.c | 2 +-
hw/core/irq.c | 14 -
hw/dma/i82374.c | 3 +-
hw/dma/i8257.c | 4 +-
hw/i386/acpi-build.c | 2 +-
hw/i386/pc.c | 22 +-
hw/i386/pc_piix.c | 2 +
hw/i386/vmmouse.c | 1 +
hw/i386/vmport.c | 1 +
hw/input/pckbd.c | 2 +-
hw/isa/isa-bus.c | 26 --
hw/isa/isa-superio.c | 45 +++
hw/isa/piix4.c | 146 --------
hw/mips/gt64xxx_pci.c | 1 +
hw/mips/mips_fulong2e.c | 12 +-
hw/mips/mips_jazz.c | 5 +-
hw/mips/mips_malta.c | 71 ++--
hw/mips/mips_r4k.c | 3 +-
hw/pci-host/{piix.c => i440fx.c} | 409 +---------------------
hw/ppc/prep.c | 5 +-
hw/southbridge/piix.c | 586 ++++++++++++++++++++++++++++++++
hw/sparc/sun4m.c | 4 -
hw/sparc64/sun4u.c | 8 +-
hw/timer/mc146818rtc.c | 6 +-
hw/unicore32/puv3.c | 1 +
stubs/pci-host-piix.c | 3 +-
MAINTAINERS | 14 +-
hw/Makefile.objs | 1 +
hw/char/Makefile.objs | 1 +
hw/isa/Makefile.objs | 2 +-
hw/pci-host/Makefile.objs | 2 +-
hw/southbridge/Makefile.objs | 1 +
51 files changed, 923 insertions(+), 759 deletions(-)
delete mode 100644 include/hw/acpi/piix4.h
create mode 100644 include/hw/char/parallel.h
rename include/hw/{isa => dma}/i8257.h (86%)
create mode 100644 include/hw/input/i8042.h
create mode 100644 include/hw/isa/superio.h
create mode 100644 include/hw/pci-host/i440fx.h
create mode 100644 include/hw/southbridge/i82371_piix.h
create mode 100644 hw/char/parallel-isa.c
create mode 100644 hw/isa/isa-superio.c
delete mode 100644 hw/isa/piix4.c
rename hw/pci-host/{piix.c => i440fx.c} (59%)
create mode 100644 hw/southbridge/piix.c
create mode 100644 hw/southbridge/Makefile.objsSignature · 1 line
2.15.1
PATCH 1/29 hw/acpi: add mem/nvdimm.h dependency
--- hw/acpi/ich9.c | 1 + hw/acpi/piix4.c | 1 + 2 files changed, 2 insertions(+)
hw/acpi/ich9.c +1 -0
@@ -37,6 +37,7 @@#include "hw/i386/ich9.h" #include "hw/mem/pc-dimm.h" +#include "hw/mem/nvdimm.h" //#define DEBUG
hw/acpi/piix4.c +1 -0
@@ -37,6 +37,7 @@#include "hw/acpi/cpu.h" #include "hw/hotplug.h" #include "hw/mem/pc-dimm.h" +#include "hw/mem/nvdimm.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/acpi_dev_interface.h" #include "hw/xen/xen.h"
Signature · 1 line
2.15.1
PATCH 2/29 pci/pci_host: move generic definitions out of i386/pc.h
In reply to Philippe Mathieu-Daudé--- include/hw/i386/pc.h | 9 --------- include/hw/pci/pci_host.h | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-)
include/hw/i386/pc.h +0 -9
@@ -218,15 +218,6 @@ void pc_acpi_init(const char *default_dsdt);void pc_guest_info_init (PCMachineState *pcms); -#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" -#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" -#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" -#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end" -#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size" -#define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size" -#define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size" - -void pc_pci_as_mapping_init (Object *owner,MemoryRegion *system_memory,MemoryRegion *pci_address_space);
include/hw/pci/pci_host.h +8 -0
@@ -56,6 +56,14 @@ typedef struct PCIHostBridgeClass {const char *(*root_bus_path)(PCIHostState *,PCIBus *); } PCIHostBridgeClass; +#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" +#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" +#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" +#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end" +#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size" +#define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size" +#define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size" +/* common internal helpers for PCI/PCIe hosts, cut off overflows */ void pci_host_config_write_common (PCIDevice *pci_dev,uint32_t addr,uint32_t limit,uint32_t val,uint32_t len);
Signature · 1 line
2.15.1
PATCH 3/29 hw/isa: extract parallel-isa specific code
In reply to Philippe Mathieu-Daudé--- include/hw/char/parallel.h | 14 ++++++++++++++ include/hw/i386/pc.h | 8 -------- hw/char/parallel-isa.c | 29 +++++++++++++++++++++++++++++ hw/char/parallel.c | 2 +- hw/i386/pc.c | 1 + hw/isa/isa-bus.c | 26 -------------------------- hw/mips/mips_fulong2e.c | 1 + hw/mips/mips_jazz.c | 1 + hw/mips/mips_malta.c | 1 + hw/sparc64/sun4u.c | 1 + MAINTAINERS | 3 ++- hw/char/Makefile.objs | 1 + 12 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 include/hw/char/parallel.h create mode 100644 hw/char/parallel-isa.c
include/hw/char/parallel.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef HW_PARALLEL_H +#define HW_PARALLEL_H + +#include "exec/memory.h" +#include "hw/isa/isa.h" +#include "chardev/char.h" + +void parallel_hds_isa_init (ISABus *bus,int n); + +bool parallel_mm_init (MemoryRegion *address_space, +hwaddr base,int it_shift,qemu_irq irq, +Chardev *chr); + +#endif
include/hw/i386/pc.h +0 -8
@@ -151,14 +151,6 @@ struct PCMachineClass {#define PC_MACHINE_CLASS (klass) \ OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) -/* parallel.c */ - -void parallel_hds_isa_init (ISABus *bus,int n); - -bool parallel_mm_init (MemoryRegion *address_space, -hwaddr base,int it_shift,qemu_irq irq, -Chardev *chr); -/* i8259.c */ extern DeviceState *isa_pic;
hw/char/parallel-isa.c new file +29 -0
@@ -0,0 +1,29 @@ +#include "qemu/osdep.h" +#include "sysemu/sysemu.h" +#include "hw/isa/isa.h" +#include "hw/char/parallel.h" + +static void parallel_init (ISABus *bus,int index,Chardev *chr) +{ +DeviceState *dev; +ISADevice *isadev; + + isadev =isa_create (bus,"isa-parallel" ); + dev =DEVICE (isadev); +qdev_prop_set_uint32 (dev,"index" , index); +qdev_prop_set_chr (dev,"chardev" , chr); +qdev_init_nofail (dev); +} + +void parallel_hds_isa_init (ISABus *bus,int n) +{ +int i; + +assert (n <=MAX_PARALLEL_PORTS ); + +for (i =0 ; i < n; i++) { +if (parallel_hds[i]) { +parallel_init (bus, i, parallel_hds[i]); + } + } +}
hw/char/parallel.c +1 -1
@@ -28,7 +28,7 @@#include "chardev/char-parallel.h" #include "chardev/char-fe.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" +#include "hw/char/parallel.h" #include "sysemu/sysemu.h" //#define DEBUG_PARALLEL
hw/i386/pc.c +1 -0
@@ -25,6 +25,7 @@#include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/i386/apic.h" #include "hw/i386/topology.h" #include "sysemu/cpus.h"
hw/isa/isa-bus.c +0 -26
@@ -23,7 +23,6 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" static ISABus *isabus;
@@ -287,28 +286,3 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) }type_init (isabus_register_types) - -static void parallel_init(ISABus *bus, int index, Chardev *chr) -{ -DeviceState *dev; -ISADevice *isadev; - - isadev =isa_create (bus,"isa-parallel" ); - dev =DEVICE (isadev); -qdev_prop_set_uint32 (dev,"index" , index); -qdev_prop_set_chr (dev,"chardev" , chr); -qdev_init_nofail (dev); -} - -void parallel_hds_isa_init (ISABus *bus,int n) -{ -int i; - -assert (n <=MAX_PARALLEL_PORTS ); - -for (i =0 ; i < n; i++) { -if (parallel_hds[i]) { -parallel_init (bus, i, parallel_hds[i]); - } - } -}
hw/mips/mips_fulong2e.c +1 -0
@@ -23,6 +23,7 @@#include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h"
hw/mips/mips_jazz.c +1 -0
@@ -28,6 +28,7 @@#include "hw/mips/cpudevs.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "sysemu/sysemu.h"
hw/mips/mips_malta.c +1 -0
@@ -28,6 +28,7 @@#include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h"
hw/sparc64/sun4u.c +1 -0
@@ -31,6 +31,7 @@#include "hw/pci-host/apb.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/timer/m48t59.h" #include "hw/block/fdc.h" #include "net/net.h"
MAINTAINERS +2 -1
@@ -867,7 +867,7 @@ M: Michael S. Tsirkin <[email protected]> M: Paolo Bonzini <[email protected]> S: Supported F: hw/char/debugcon.c -F: hw/char/parallel.c +F: hw/char/parallel* F: hw/char/serial* F: hw/dma/i8257* F: hw/i2c/pm_smbus.c
@@ -882,6 +882,7 @@ F: hw/timer/i8254* F: hw/timer/mc146818rtc* F: hw/watchdog/wdt_ib700.c F: include/hw/display/vga.h +F: include/hw/char/parallel.h F: include/hw/i2c/pm_smbus.h F: include/hw/isa/i8257.h F: include/hw/timer/hpet.h
hw/char/Makefile.objs +1 -0
@@ -1,6 +1,7 @@ common-obj-$(CONFIG_IPACK) += ipoctal232.o common-obj-$(CONFIG_ESCC) += escc.o common-obj-$(CONFIG_PARALLEL) += parallel.o +common-obj-$(CONFIG_PARALLEL) += parallel-isa.o common-obj-$(CONFIG_PL011) += pl011.o common-obj-$(CONFIG_SERIAL) += serial.o common-obj-$(CONFIG_SERIAL_ISA) += serial-isa.o
Signature · 1 line
2.15.1
PATCH 4/29 hw/dma/i8257: rename DMA_init() to i8257_dma_init()
In reply to Philippe Mathieu-Daudé- move the header from hw/isa/ to hw/dma/
- remove the old i386/pc dependency
---
include/hw/{isa => dma}/i8257.h | 6 ++++++
include/hw/isa/isa.h | 2 --
hw/dma/i82374.c | 3 ++-
hw/dma/i8257.c | 4 ++--
hw/i386/pc.c | 3 ++-
hw/mips/mips_fulong2e.c | 3 ++-
hw/mips/mips_jazz.c | 3 ++-
hw/mips/mips_malta.c | 3 ++-
hw/sparc/sun4m.c | 4 ----
hw/sparc64/sun4u.c | 4 ----
MAINTAINERS | 2 +-
11 files changed, 19 insertions(+), 18 deletions(-)
rename include/hw/{isa => dma}/i8257.h (86%)include/hw/dma/i8257.h renamed from include/hw/isa/i8257.h +6 -0
@@ -1,6 +1,10 @@ #ifndef HW_I8257_H #define HW_I8257_H +#include "hw/hw.h" +#include "hw/isa/isa.h" +#include "exec/ioport.h" + #define TYPE_I8257 "i8257" typedef struct I8257Regs {
@@ -40,4 +44,6 @@ typedef struct I8257State { PortioList portio_pageh; } I8257State; +void i8257_dma_init (ISABus *bus,int high_page_enable); +#endif
include/hw/isa/isa.h +0 -2
@@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d) return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); } -/* i8257.c */ -void DMA_init (ISABus *bus,int high_page_enable);#endif
hw/dma/i82374.c +2 -1
@@ -24,6 +24,7 @@#include "qemu/osdep.h" #include "hw/isa/isa.h" +#include "hw/dma/i8257.h" #define TYPE_I82374 "i82374"#define I82374 (obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **errp)portio_list_add (&s->port_list,isa_address_space_io (&s->parent_obj), s->iobase); -DMA_init (isa_bus_from_device (ISA_DEVICE (dev)),1 ); +i8257_dma_init (isa_bus_from_device (ISA_DEVICE (dev)),1 );memset (s->commands,0 ,sizeof (s->commands)); }
hw/dma/i8257.c +2 -2
@@ -24,7 +24,7 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/isa/isa.h" -#include "hw/isa/i8257.h" +#include "hw/dma/i8257.h" #include "qemu/main-loop.h" #include "trace.h"
@@ -622,7 +622,7 @@ static void i8257_register_types(void)type_init (i8257_register_types) -void DMA_init(ISABus *bus, int high_page_enable) +void i8257_dma_init(ISABus *bus, int high_page_enable) {ISADevice *isa1, *isa2;DeviceState *d;
hw/i386/pc.c +2 -1
@@ -40,6 +40,7 @@#include "elf.h" #include "multiboot.h" #include "hw/timer/mc146818rtc.h" +#include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/audio/pcspk.h" #include "hw/pci/msi.h"
@@ -1605,7 +1606,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,port92_init (port92, a20_line[1 ]);g_free (a20_line); -DMA_init (isa_bus,0 ); +i8257_dma_init (isa_bus,0 );for (i =0 ; i <MAX_FD ; i++) { fd[i] =drive_get (IF_FLOPPY ,0 , i);
hw/mips/mips_fulong2e.c +2 -1
@@ -22,6 +22,7 @@#include "qapi/error.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/block/fdc.h"
@@ -361,7 +362,7 @@ static void mips_fulong2e_init(MachineState *machine)/* init other devices */ pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); -DMA_init (isa_bus,0 ); +i8257_dma_init (isa_bus,0 );/* Super I/O */ isa_create_simple (isa_bus,"i8042" );
hw/mips/mips_jazz.c +2 -1
@@ -27,6 +27,7 @@#include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/isa/isa.h"
@@ -219,7 +220,7 @@ static void mips_jazz_init(MachineState *machine,/* ISA devices */ i8259 =i8259_init (isa_bus, env->irq[4 ]);isa_bus_irqs (isa_bus, i8259); -DMA_init (isa_bus,0 ); +i8257_dma_init (isa_bus,0 ); pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL );pcspk_init (isa_bus, pit);
hw/mips/mips_malta.c +2 -1
@@ -27,6 +27,7 @@#include "cpu.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/block/fdc.h"
@@ -1210,7 +1211,7 @@ void mips_malta_init(MachineState *machine)smbus_eeprom_init (smbus,8 , smbus_eeprom_buf, smbus_eeprom_size);g_free (smbus_eeprom_buf); pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); -DMA_init (isa_bus,0 ); +i8257_dma_init (isa_bus,0 );/* Super I/O */ isa_create_simple (isa_bus,"i8042" );
hw/sparc/sun4m.c +0 -4
@@ -99,10 +99,6 @@ struct sun4m_hwdef {uint8_t nvram_machine_id; }; -void DMA_init (ISABus *bus,int high_page_enable) -{ -} -static void fw_cfg_boot_set (void *opaque,const char *boot_device,Error **errp) {
hw/sparc64/sun4u.c +0 -4
@@ -87,10 +87,6 @@ typedef struct EbusState {MemoryRegion bar1; } EbusState; -void DMA_init (ISABus *bus,int high_page_enable) -{ -} -static void fw_cfg_boot_set (void *opaque,const char *boot_device,Error **errp) {
MAINTAINERS +1 -1
@@ -883,8 +883,8 @@ F: hw/timer/mc146818rtc* F: hw/watchdog/wdt_ib700.c 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/i8257.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*
Signature · 1 line
2.15.1
PATCH 5/29 hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h
In reply to Philippe Mathieu-Daudé--- include/hw/i386/pc.h | 9 --------- include/hw/input/i8042.h | 25 +++++++++++++++++++++++++ hw/alpha/dp264.c | 3 ++- hw/i386/pc.c | 1 + hw/i386/vmmouse.c | 1 + hw/i386/vmport.c | 1 + hw/input/pckbd.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 1 + hw/mips/mips_malta.c | 3 ++- hw/mips/mips_r4k.c | 3 ++- hw/ppc/prep.c | 5 +++-- hw/sparc64/sun4u.c | 3 ++- hw/unicore32/puv3.c | 1 + MAINTAINERS | 1 + 15 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 include/hw/input/i8042.h
include/hw/i386/pc.h +0 -9
@@ -188,15 +188,6 @@ void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);void vmmouse_get_data (uint32_t *data);void vmmouse_set_data (const uint32_t *data); -/* pckbd.c */ -#define I8042_A20_LINE "a20" - -void i8042_mm_init (qemu_irq kbd_irq,qemu_irq mouse_irq, -MemoryRegion *region,ram_addr_t size, -hwaddr mask); -void i8042_isa_mouse_fake_event (void *opaque); -void i8042_setup_a20_line (ISADevice *dev,qemu_irq a20_out); -/* pc.c */ extern int fd_bootchk;
include/hw/input/i8042.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* QEMU PS/2 Controller +* +* Copyright (c) 2003 Fabrice Bellard +* +* 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_INPUT_I8042_H +#define HW_INPUT_I8042_H + +#include "hw/hw.h" +#include "hw/isa/isa.h" + +#define TYPE_I8042 "i8042" + +#define I8042_A20_LINE "a20" + +void i8042_mm_init (qemu_irq kbd_irq,qemu_irq mouse_irq, +MemoryRegion *region,ram_addr_t size, +hwaddr mask); +void i8042_isa_mouse_fake_event (void *opaque); +void i8042_setup_a20_line (ISADevice *dev,qemu_irq a20_out); + +#endif /* HW_INPUT_I8042_H */
hw/alpha/dp264.c +2 -1
@@ -19,6 +19,7 @@#include "hw/timer/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/char/serial.h" #include "qemu/cutils.h"
@@ -81,7 +82,7 @@ static void clipper_init(MachineState *machine)mc146818_rtc_init (isa_bus,1900 , rtc_irq);i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );/* VGA setup. Don't bother loading the bios. */ pci_vga_init (pci_bus);
hw/i386/pc.c +1 -0
@@ -42,6 +42,7 @@#include "hw/timer/mc146818rtc.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/audio/pcspk.h" #include "hw/pci/msi.h" #include "hw/sysbus.h"
hw/i386/vmmouse.c +1 -0
@@ -25,6 +25,7 @@#include "hw/hw.h" #include "ui/console.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "hw/qdev.h" /* debug only vmmouse */
hw/i386/vmport.c +1 -0
@@ -25,6 +25,7 @@#include "hw/hw.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "sysemu/hw_accel.h" #include "hw/qdev.h" #include "qemu/log.h"
hw/input/pckbd.c +1 -1
@@ -26,6 +26,7 @@#include "hw/isa/isa.h" #include "hw/i386/pc.h" #include "hw/input/ps2.h" +#include "hw/input/i8042.h" #include "sysemu/sysemu.h" /* debug PC keyboard */
@@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,qemu_register_reset (kbd_reset, s); } -#define TYPE_I8042 "i8042"#define I8042 (obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) typedef struct ISAKBDState {
hw/mips/mips_fulong2e.c +2 -1
@@ -44,6 +44,7 @@#include "hw/isa/vt82c686.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h"
@@ -365,7 +366,7 @@ static void mips_fulong2e_init(MachineState *machine)i8257_dma_init (isa_bus,0 );/* Super I/O */ -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );mc146818_rtc_init (isa_bus,2000 ,NULL );
hw/mips/mips_jazz.c +1 -0
@@ -43,6 +43,7 @@#include "hw/timer/i8254.h" #include "hw/display/vga.h" #include "hw/audio/pcspk.h" +#include "hw/input/i8042.h" #include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h"
hw/mips/mips_malta.c +2 -1
@@ -47,6 +47,7 @@#include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h"
@@ -1214,7 +1215,7 @@ void mips_malta_init(MachineState *machine)i8257_dma_init (isa_bus,0 );/* Super I/O */ -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );mc146818_rtc_init (isa_bus,2000 ,NULL );serial_hds_isa_init (isa_bus,0 ,2 );
hw/mips/mips_r4k.c +2 -1
@@ -28,6 +28,7 @@#include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h"
@@ -288,7 +289,7 @@ void mips_r4k_init(MachineState *machine) hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 ); }static void mips_machine_init (MachineClass *mc)
hw/ppc/prep.c +3 -2
@@ -41,6 +41,7 @@#include "hw/ide.h" #include "hw/loader.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/isa/pc87312.h" #include "hw/net/ne2000-isa.h" #include "sysemu/block-backend.h"
@@ -641,7 +642,7 @@ static void ppc_prep_init(MachineState *machine) hd[2 * i], hd[2 * i + 1]); } -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 ); cpu =POWERPC_CPU (first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];
@@ -771,7 +772,7 @@ static void ibm_40p_init(MachineState *machine)/* add some more devices */ if (defaults_enabled ()) { -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 ); m48t59 =NVRAM (isa_create_simple (isa_bus,"isa-m48t59" )); dev =DEVICE (isa_create (isa_bus,"cs4231a" ));
hw/sparc64/sun4u.c +2 -1
@@ -33,6 +33,7 @@#include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/timer/m48t59.h" +#include "hw/input/i8042.h" #include "hw/block/fdc.h" #include "net/net.h" #include "qemu/timer.h"
@@ -513,7 +514,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,qdev_init_nofail (&pci_dev->qdev);pci_ide_create_devs (pci_dev, hd); -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );/* Floppy */ for (i =0 ; i <MAX_FD ; i++) {
hw/unicore32/puv3.c +1 -0
@@ -20,6 +20,7 @@#undef DEBUG_PUV3#include "hw/unicore32/puv3.h" +#include "hw/input/i8042.h" #define KERNEL_LOAD_ADDR 0x03000000#define KERNEL_MAX_SIZE 0x00800000/* Just a guess */
MAINTAINERS +1 -0
@@ -885,6 +885,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/input/i8042.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*
Signature · 1 line
2.15.1
Re: [Qemu-devel] [PATCH 05/29] hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h
Quoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
ppc parts
Quoted 297 lines
--- include/hw/i386/pc.h | 9 --------- include/hw/input/i8042.h | 25 +++++++++++++++++++++++++ hw/alpha/dp264.c | 3 ++- hw/i386/pc.c | 1 + hw/i386/vmmouse.c | 1 + hw/i386/vmport.c | 1 + hw/input/pckbd.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 1 + hw/mips/mips_malta.c | 3 ++- hw/mips/mips_r4k.c | 3 ++- hw/ppc/prep.c | 5 +++-- hw/sparc64/sun4u.c | 3 ++- hw/unicore32/puv3.c | 1 + MAINTAINERS | 1 + 15 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 include/hw/input/i8042.hinclude/hw/i386/pc.h +0
-9@@ -188,15 +188,6 @@ void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);void vmmouse_get_data (uint32_t *data);void vmmouse_set_data (const uint32_t *data); -/* pckbd.c */ -#define I8042_A20_LINE "a20" - -void i8042_mm_init (qemu_irq kbd_irq,qemu_irq mouse_irq, -MemoryRegion *region,ram_addr_t size, -hwaddr mask); -void i8042_isa_mouse_fake_event (void *opaque); -void i8042_setup_a20_line (ISADevice *dev,qemu_irq a20_out); -/* pc.c */ extern int fd_bootchk;include/hw/input/i8042.h new file +25
-0@@ -0,0 +1,25 @@ +/* +* QEMU PS/2 Controller +* +* Copyright (c) 2003 Fabrice Bellard +* +* 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_INPUT_I8042_H +#define HW_INPUT_I8042_H + +#include "hw/hw.h" +#include "hw/isa/isa.h" + +#define TYPE_I8042 "i8042" + +#define I8042_A20_LINE "a20" + +void i8042_mm_init (qemu_irq kbd_irq,qemu_irq mouse_irq, +MemoryRegion *region,ram_addr_t size, +hwaddr mask); +void i8042_isa_mouse_fake_event (void *opaque); +void i8042_setup_a20_line (ISADevice *dev,qemu_irq a20_out); + +#endif /* HW_INPUT_I8042_H */ hw/alpha/dp264.c +2
-1@@ -19,6 +19,7 @@#include "hw/timer/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/char/serial.h" #include "qemu/cutils.h" @@ -81,7 +82,7 @@ static void clipper_init(MachineState *machine)mc146818_rtc_init (isa_bus,1900 , rtc_irq);i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );/* VGA setup. Don't bother loading the bios. */ pci_vga_init (pci_bus);hw/i386/pc.c +1
-0@@ -42,6 +42,7 @@#include "hw/timer/mc146818rtc.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/audio/pcspk.h" #include "hw/pci/msi.h" #include "hw/sysbus.h" hw/i386/vmmouse.c +1
-0@@ -25,6 +25,7 @@#include "hw/hw.h" #include "ui/console.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "hw/qdev.h" /* debug only vmmouse */ hw/i386/vmport.c +1
-0@@ -25,6 +25,7 @@#include "hw/hw.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "sysemu/hw_accel.h" #include "hw/qdev.h" #include "qemu/log.h" hw/input/pckbd.c +1
-1@@ -26,6 +26,7 @@#include "hw/isa/isa.h" #include "hw/i386/pc.h" #include "hw/input/ps2.h" +#include "hw/input/i8042.h" #include "sysemu/sysemu.h" /* debug PC keyboard */ @@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,qemu_register_reset (kbd_reset, s); } -#define TYPE_I8042 "i8042"#define I8042 (obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) typedef struct ISAKBDState {hw/mips/mips_fulong2e.c +2
-1@@ -44,6 +44,7 @@#include "hw/isa/vt82c686.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" @@ -365,7 +366,7 @@ static void mips_fulong2e_init(MachineState *machine)i8257_dma_init (isa_bus,0 );/* Super I/O */ -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );mc146818_rtc_init (isa_bus,2000 ,NULL );hw/mips/mips_jazz.c +1
-0@@ -43,6 +43,7 @@#include "hw/timer/i8254.h" #include "hw/display/vga.h" #include "hw/audio/pcspk.h" +#include "hw/input/i8042.h" #include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" hw/mips/mips_malta.c +2
-1@@ -47,6 +47,7 @@#include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" @@ -1214,7 +1215,7 @@ void mips_malta_init(MachineState *machine)i8257_dma_init (isa_bus,0 );/* Super I/O */ -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );mc146818_rtc_init (isa_bus,2000 ,NULL );serial_hds_isa_init (isa_bus,0 ,2 );hw/mips/mips_r4k.c +2
-1@@ -28,6 +28,7 @@#include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h" @@ -288,7 +289,7 @@ void mips_r4k_init(MachineState *machine) hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 ); }static void mips_machine_init (MachineClass *mc)hw/ppc/prep.c +3
-2@@ -41,6 +41,7 @@#include "hw/ide.h" #include "hw/loader.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/isa/pc87312.h" #include "hw/net/ne2000-isa.h" #include "sysemu/block-backend.h" @@ -641,7 +642,7 @@ static void ppc_prep_init(MachineState *machine) hd[2 * i], hd[2 * i + 1]); } -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 ); cpu =POWERPC_CPU (first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];@@ -771,7 +772,7 @@ static void ibm_40p_init(MachineState *machine)/* add some more devices */ if (defaults_enabled ()) { -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 ); m48t59 =NVRAM (isa_create_simple (isa_bus,"isa-m48t59" )); dev =DEVICE (isa_create (isa_bus,"cs4231a" ));hw/sparc64/sun4u.c +2
-1@@ -33,6 +33,7 @@#include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/timer/m48t59.h" +#include "hw/input/i8042.h" #include "hw/block/fdc.h" #include "net/net.h" #include "qemu/timer.h" @@ -513,7 +514,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,qdev_init_nofail (&pci_dev->qdev);pci_ide_create_devs (pci_dev, hd); -isa_create_simple (isa_bus,"i8042" ); +isa_create_simple (isa_bus,TYPE_I8042 );/* Floppy */ for (i =0 ; i <MAX_FD ; i++) {hw/unicore32/puv3.c +1
-0@@ -20,6 +20,7 @@#undef DEBUG_PUV3#include "hw/unicore32/puv3.h" +#include "hw/input/i8042.h" #define KERNEL_LOAD_ADDR 0x03000000#define KERNEL_MAX_SIZE 0x00800000/* Just a guess */ MAINTAINERS +1
-0@@ -885,6 +885,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/input/i8042.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 6/29 hw/isa: add a generic isa_superio_init()
In reply to Philippe Mathieu-Daudé--- 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
include/hw/isa/superio.h new file +17 -0
@@ -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); + +#endif
hw/isa/isa-superio.c new file +45 -0
45 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -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*
hw/isa/Makefile.objs +1 -0
@@ -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
Signature · 1 line
2.15.1
Re: [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init()
Quoted 21 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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.cinclude/hw/isa/superio.h new file +5
-0@@ -0,0 +1,17 @@ +/* +* Generic ISA Super I/O +* +* Copyright (c) 2018 Philippe Mathieu-Daudé +*
include/hw/isa/superio.h line 15
Quoted 10 lines
include/hw/isa/superio.h new file +10
-0+* 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.
Quoted 84 lines
include/hw/isa/superio.h new file +2
-0+ +#endif hw/isa/isa-superio.c new file +45
-0@@ -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 ); +}MAINTAINERS +2
-0@@ -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*hw/isa/Makefile.objs +1
-0@@ -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
PATCH 7/29 hw/i386/pc: use isa_superio_init()
In reply to Philippe Mathieu-Daudé--- hw/i386/pc.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
hw/i386/pc.c +3 -16
@@ -24,12 +24,9 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/i386/pc.h" -#include "hw/char/serial.h" -#include "hw/char/parallel.h" #include "hw/i386/apic.h" #include "hw/i386/topology.h" #include "sysemu/cpus.h" -#include "hw/block/fdc.h" #include "hw/ide.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h"
@@ -41,6 +38,7 @@#include "multiboot.h" #include "hw/timer/mc146818rtc.h" #include "hw/dma/i8257.h" +#include "hw/isa/superio.h" #include "hw/timer/i8254.h" #include "hw/input/i8042.h" #include "hw/audio/pcspk.h"
@@ -1523,7 +1521,6 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, uint32_t hpet_irqs) {int i; -DriveInfo *fd[MAX_FD ];DeviceState *hpet =NULL ;int pit_isa_irq =0 ;qemu_irq pit_alt_irq =NULL ;
@@ -1586,11 +1583,9 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,pcspk_init (isa_bus, pit); } -serial_hds_isa_init (isa_bus,0 ,MAX_SERIAL_PORTS ); -parallel_hds_isa_init (isa_bus,MAX_PARALLEL_PORTS ); - a20_line =qemu_allocate_irqs (handle_a20_line_change, first_cpu,2 ); - i8042 =isa_create_simple (isa_bus,"i8042" ); + i8042 =isa_superio_init (isa_bus,MAX_SERIAL_PORTS ,1 , + create_fdctrl ?MAX_FD :0 );i8042_setup_a20_line (i8042, a20_line[0 ]);if (!no_vmport) {vmport_init (isa_bus);
@@ -1608,14 +1603,6 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,g_free (a20_line);i8257_dma_init (isa_bus,0 ); - -for (i =0 ; i <MAX_FD ; i++) { - fd[i] =drive_get (IF_FLOPPY ,0 , i); - create_fdctrl |= !!fd[i]; - } -if (create_fdctrl) { -fdctrl_init_isa (isa_bus, fd); - } }void pc_nic_init (ISABus *isa_bus,PCIBus *pci_bus)
Signature · 1 line
2.15.1
PATCH 8/29 hw/mips/fulong2e: use isa_superio_init()
In reply to Philippe Mathieu-Daudé--- hw/mips/mips_fulong2e.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
hw/mips/mips_fulong2e.c +2 -9
@@ -23,13 +23,10 @@#include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/dma/i8257.h" -#include "hw/char/serial.h" -#include "hw/char/parallel.h" -#include "hw/block/fdc.h" +#include "hw/isa/superio.h" #include "net/net.h" #include "hw/boards.h" #include "hw/i2c/smbus.h" -#include "sysemu/block-backend.h" #include "hw/block/flash.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h"
@@ -44,7 +41,6 @@#include "hw/isa/vt82c686.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" -#include "hw/input/i8042.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h"
@@ -366,13 +362,10 @@ static void mips_fulong2e_init(MachineState *machine)i8257_dma_init (isa_bus,0 );/* Super I/O */ -isa_create_simple (isa_bus,TYPE_I8042 ); +isa_superio_init (isa_bus,MAX_SERIAL_PORTS ,1 ,0 );mc146818_rtc_init (isa_bus,2000 ,NULL ); -serial_hds_isa_init (isa_bus,0 ,MAX_SERIAL_PORTS ); -parallel_hds_isa_init (isa_bus,1 ); -/* Sound card */ audio_init (pci_bus);/* Network card */
Signature · 1 line
2.15.1
PATCH 9/29 hw/mips/malta: code movement
In reply to Philippe Mathieu-Daudé--- hw/mips/mips_malta.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
hw/mips/mips_malta.c +7 -7
@@ -1063,10 +1063,6 @@ void mips_malta_init(MachineState *machine)memory_region_add_subregion (system_memory,512 <<20 , ram_low_postio); } -/* generate SPD EEPROM data */ -generate_eeprom_spd (&smbus_eeprom_buf[0 *256 ], ram_size); -generate_eeprom_serial (&smbus_eeprom_buf[6 *256 ]); -#ifdef TARGET_WORDS_BIGENDIAN be =1 ;#else
@@ -1209,15 +1205,19 @@ void mips_malta_init(MachineState *machine)pci_create_simple (pci_bus, piix4_devfn +2 ,"piix4-usb-uhci" ); smbus =piix4_pm_init (pci_bus, piix4_devfn +3 ,0x1100 ,isa_get_irq (NULL ,9 ),NULL ,0 ,NULL ); -smbus_eeprom_init (smbus,8 , smbus_eeprom_buf, smbus_eeprom_size); -g_free (smbus_eeprom_buf); pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL );i8257_dma_init (isa_bus,0 ); +mc146818_rtc_init (isa_bus,2000 ,NULL ); + +/* generate SPD EEPROM data */ +generate_eeprom_spd (&smbus_eeprom_buf[0 *256 ], ram_size); +generate_eeprom_serial (&smbus_eeprom_buf[6 *256 ]); +smbus_eeprom_init (smbus,8 , smbus_eeprom_buf, smbus_eeprom_size); +g_free (smbus_eeprom_buf);/* Super I/O */ isa_create_simple (isa_bus,TYPE_I8042 ); -mc146818_rtc_init (isa_bus,2000 ,NULL );serial_hds_isa_init (isa_bus,0 ,2 );parallel_hds_isa_init (isa_bus,1 );
Signature · 1 line
2.15.1
PATCH 10/29 hw/mips/malta: add fdc37m81x_init() which uses isa_superio_init()
In reply to Philippe Mathieu-Daudé--- hw/mips/mips_malta.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
hw/mips/mips_malta.c +13 -15
@@ -27,14 +27,12 @@#include "cpu.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/isa/superio.h" #include "hw/dma/i8257.h" #include "hw/char/serial.h" -#include "hw/char/parallel.h" -#include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h" #include "hw/i2c/smbus.h" -#include "sysemu/block-backend.h" #include "hw/block/flash.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h"
@@ -47,7 +45,6 @@#include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" -#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h"
@@ -980,6 +977,16 @@ static void mips_create_cpu(MaltaState *s, const char *cpu_type, } } +#define FDC37M81X_SERIAL_COUNT 2 +#define FDC37M81X_DRIVE_COUNT 2 +#define FDC37M81X_PARALLEL_COUNT 1 + +static ISADevice *fdc37m81x_init (ISABus *isa_bus) +{ +return isa_superio_init (isa_bus,FDC37M81X_SERIAL_COUNT , +FDC37M81X_PARALLEL_COUNT ,FDC37M81X_DRIVE_COUNT ); +} +static void mips_malta_init (MachineState *machine) {
@@ -1008,7 +1015,6 @@ void mips_malta_init(MachineState *machine)int i;DriveInfo *dinfo;DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ]; -DriveInfo *fd[MAX_FD ];int fl_idx =0 ;int fl_sectors = bios_size >>16 ;int be;
@@ -1215,16 +1221,8 @@ void mips_malta_init(MachineState *machine)smbus_eeprom_init (smbus,8 , smbus_eeprom_buf, smbus_eeprom_size);g_free (smbus_eeprom_buf); -/* Super I/O */ -isa_create_simple (isa_bus,TYPE_I8042 ); - -serial_hds_isa_init (isa_bus,0 ,2 ); -parallel_hds_isa_init (isa_bus,1 ); - -for (i =0 ; i <MAX_FD ; i++) { - fd[i] =drive_get (IF_FLOPPY ,0 , i); - } -fdctrl_init_isa (isa_bus, fd); +/* SuperI/O: SMS FDC37M817 */ +fdc37m81x_init (isa_bus);/* Network card */ network_init (pci_bus);
Signature · 1 line
2.15.1
PATCH 11/29 mc146818rtc: always register rtc to rtc list
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
We are not required anymore to use rtc_init() function.
--- hw/timer/mc146818rtc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
hw/timer/mc146818rtc.c +1 -5
@@ -997,17 +997,16 @@ static void rtc_realizefn(DeviceState *dev, Error **errp) OBJECT(s), "date", NULL);qdev_init_gpio_out (dev, &s->irq,1 ); +QLIST_INSERT_HEAD (&rtc_devices, s, link); }ISADevice *mc146818_rtc_init (ISABus *bus,int base_year,qemu_irq intercept_irq) {DeviceState *dev;ISADevice *isadev; -RTCState *s; isadev =isa_create (bus,TYPE_MC146818_RTC ); dev =DEVICE (isadev); - s =MC146818_RTC (isadev);qdev_prop_set_int32 (dev,"base_year" , base_year);qdev_init_nofail (dev);if (intercept_irq) {
@@ -1015,7 +1014,6 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq) }else {isa_connect_gpio_out (isadev,0 ,RTC_ISA_IRQ ); } -QLIST_INSERT_HEAD (&rtc_devices, s, link);return isadev; }
@@ -1046,8 +1044,6 @@ static void rtc_class_initfn(ObjectClass *klass, void *data) dc->reset = rtc_resetdev; dc->vmsd = &vmstate_rtc; dc->props = mc146818rtc_properties; -/* Reason: needs to be wired up by rtc_init() */ - dc->user_creatable = false; }static void rtc_finalize (Object *obj)
Signature · 1 line
2.15.1
PATCH 12/29 piix4: rename some variables in realize function
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
PIIX4 structure is now 's'
PCI device is now 'pci_dev'
DeviceState is now 'dev'
--- hw/isa/piix4.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
hw/isa/piix4.c +7 -6
@@ -87,16 +87,17 @@ static const VMStateDescription vmstate_piix4 = { } }; -static void piix4_realize (PCIDevice *dev,Error **errp) +static void piix4_realize (PCIDevice *pci_dev,Error **errp) { -PIIX4State *d =PIIX4_PCI_DEVICE (dev); +DeviceState *dev =DEVICE (pci_dev); +PIIX4State *s =DO_UPCAST (PIIX4State, dev, pci_dev); -if (!isa_bus_new (DEVICE (d),pci_address_space (dev), -pci_address_space_io (dev), errp)) { +if (!isa_bus_new (dev,pci_address_space (pci_dev), +pci_address_space_io (pci_dev), errp)) {return ; } - piix4_dev = &d->dev; -qemu_register_reset (piix4_reset, d); + piix4_dev = pci_dev; +qemu_register_reset (piix4_reset, s); }int piix4_init (PCIBus *bus,ISABus **isa_bus,int devfn)
Signature · 1 line
2.15.1
PATCH 13/29 piix4: convert reset function to QOM
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
--- hw/isa/piix4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/isa/piix4.c +4 -4
@@ -39,10 +39,10 @@ typedef struct PIIX4State {#define PIIX4_PCI_DEVICE (obj) \ OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE) -static void piix4_reset (void *opaque) +static void piix4_reset (DeviceState *dev) { -PIIX4State *d = opaque; -uint8_t *pci_conf = d->dev.config; +PIIX4State *s =PIIX4_PCI_DEVICE (dev); +uint8_t *pci_conf = s->dev.config; pci_conf[0x04 ] =0x07 ;// master, memory and I/O pci_conf[0x05 ] =0x00 ;
@@ -97,7 +97,6 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)return ; } piix4_dev = pci_dev; -qemu_register_reset (piix4_reset, s); }int piix4_init (PCIBus *bus,ISABus **isa_bus,int devfn)
@@ -118,6 +117,7 @@ static void piix4_class_init(ObjectClass *klass, void *data) k->vendor_id =PCI_VENDOR_ID_INTEL ; k->device_id =PCI_DEVICE_ID_INTEL_82371AB_0 ; k->class_id =PCI_CLASS_BRIDGE_ISA ; + dc->reset = piix4_reset; dc->desc ="ISA bridge" ; dc->vmsd = &vmstate_piix4;/*
Signature · 1 line
2.15.1
PATCH 14/29 piix4: add Reset Control Register
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
The RCR I/O port (0xcf9) is used to generate a hard reset or a soft reset.
--- hw/isa/piix4.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
hw/isa/piix4.c +39 -0
@@ -2,6 +2,7 @@* QEMU PIIX4 PCI Bridge Emulation * * Copyright (c) 2006 Fabrice Bellard +* Copyright (c) 2018 Hervé Poussineau * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +34,10 @@ PCIDevice *piix4_dev;typedef struct PIIX4State {PCIDevice dev; + +/* Reset Control Register */ +MemoryRegion rcr_mem; +uint8_t rcr; }PIIX4State ;#define TYPE_PIIX4_PCI_DEVICE "PIIX4"
@@ -87,6 +92,34 @@ static const VMStateDescription vmstate_piix4 = { } }; +static void piix4_rcr_write (void *opaque,hwaddr addr,uint64_t val, +unsigned int len) +{ +PIIX4State *s = opaque; + +if (val &4 ) { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +return ; + } + s->rcr = val &2 ;/* keep System Reset type only */ +} + +static uint64_t piix4_rcr_read (void *opaque,hwaddr addr,unsigned int len) +{ +PIIX4State *s = opaque; +return s->rcr; +} + +static const MemoryRegionOps piix4_rcr_ops = { + .read = piix4_rcr_read, + .write = piix4_rcr_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .impl = { + .min_access_size =1 , + .max_access_size =1 , + }, +}; +static void piix4_realize (PCIDevice *pci_dev,Error **errp) {DeviceState *dev =DEVICE (pci_dev);
@@ -96,6 +129,12 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp) pci_address_space_io(pci_dev), errp)) {return ; } + +memory_region_init_io (&s->rcr_mem,OBJECT (dev), &piix4_rcr_ops, s, +"reset-control" ,1 ); +memory_region_add_subregion_overlap (pci_address_space_io (pci_dev),0xcf9 , + &s->rcr_mem,1 ); + piix4_dev = pci_dev; }
Signature · 1 line
2.15.1
PATCH 15/29 piix4: add a i8259 interrupt controller as specified in datasheet
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
Add ISA irqs as piix4 gpio in, and CPU interrupt request as piix4 gpio out. Remove i8259 instanciated in malta board, to not have it twice.
We can also remove the now unused piix4_init() function.
--- include/hw/i386/pc.h | 1 - hw/isa/piix4.c | 38 ++++++++++++++++++++++++++++---------- hw/mips/mips_malta.c | 28 ++++++++++++---------------- 3 files changed, 40 insertions(+), 27 deletions(-)
include/hw/i386/pc.h +0 -1
@@ -274,7 +274,6 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,PCIBus *find_i440fx (void );/* piix4.c */ extern PCIDevice *piix4_dev; -int piix4_init (PCIBus *bus,ISABus **isa_bus,int devfn);/* pc_sysfw.c */ void pc_system_firmware_init(MemoryRegion *rom_memory,
hw/isa/piix4.c +28 -10
@@ -34,6 +34,8 @@ PCIDevice *piix4_dev; typedef struct PIIX4State { PCIDevice dev; + qemu_irq cpu_intr; + qemu_irq *isa; /* Reset Control Register */ MemoryRegion rcr_mem;
@@ -92,6 +94,18 @@ static const VMStateDescription vmstate_piix4 = { } }; +static void piix4_request_i8259_irq (void *opaque,int irq,int level) +{ +PIIX4State *s = opaque; +qemu_set_irq (s->cpu_intr, level); +} + +static void piix4_set_i8259_irq (void *opaque,int irq,int level) +{ +PIIX4State *s = opaque; +qemu_set_irq (s->isa[irq], level); +} +static void piix4_rcr_write (void *opaque,hwaddr addr,uint64_t val,unsigned int len) {
@@ -124,27 +138,31 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp) {DeviceState *dev =DEVICE (pci_dev);PIIX4State *s =DO_UPCAST (PIIX4State, dev, pci_dev); +ISABus *isa_bus; +qemu_irq *i8259_out_irq; -if (!isa_bus_new (dev,pci_address_space (pci_dev), -pci_address_space_io (pci_dev), errp)) { + isa_bus =isa_bus_new (dev,pci_address_space (pci_dev), +pci_address_space_io (pci_dev), errp); +if (!isa_bus) {return ; } +qdev_init_gpio_in_named (dev, piix4_set_i8259_irq,"isa" ,ISA_NUM_IRQS ); +qdev_init_gpio_out_named (dev, &s->cpu_intr,"intr" ,1 ); +memory_region_init_io (&s->rcr_mem,OBJECT (dev), &piix4_rcr_ops, s,"reset-control" ,1 );memory_region_add_subregion_overlap (pci_address_space_io (pci_dev),0xcf9 , &s->rcr_mem,1 ); - piix4_dev = pci_dev; -} +/* initialize i8259 pic */ + i8259_out_irq =qemu_allocate_irqs (piix4_request_i8259_irq, s,1 ); + s->isa =i8259_init (isa_bus, *i8259_out_irq); -int piix4_init (PCIBus *bus,ISABus **isa_bus,int devfn) -{ -PCIDevice *d; +/* initialize ISA irqs */ +isa_bus_irqs (isa_bus, s->isa); - d =pci_create_simple_multifunction (bus, devfn, true,"PIIX4" ); - *isa_bus =ISA_BUS (qdev_get_child_bus (DEVICE (d),"isa.0" )); -return d->devfn; + piix4_dev = pci_dev; }static void piix4_class_init (ObjectClass *klass,void *data)
hw/mips/mips_malta.c +12 -16
@@ -96,7 +96,7 @@ typedef struct {SysBusDevice parent_obj;MIPSCPSState *cps; -qemu_irq *i8259; +qemu_irq i8259[16 ]; } MaltaState;static ISADevice *pit;
@@ -1008,8 +1008,8 @@ void mips_malta_init(MachineState *machine)int64_t kernel_entry, bootloader_run_addr;PCIBus *pci_bus;ISABus *isa_bus; -qemu_irq *isa_irq;qemu_irq cbus_irq, i8259_irq; +PCIDevice *pci;int piix4_devfn;I2CBus *smbus;int i;
@@ -1185,28 +1185,24 @@ void mips_malta_init(MachineState *machine)/* Board ID = 0x420 (Malta Board with CoreLV) */ stl_p (memory_region_get_ram_ptr (bios_copy) +0x10 ,0x00000420 ); -/* -* We have a circular dependency problem: pci_bus depends on isa_irq, -* isa_irq is provided by i8259, i8259 depends on ISA, ISA depends -* on piix4, and piix4 depends on pci_bus. To stop the cycle we have -* qemu_irq_proxy() adds an extra bit of indirection, allowing us -* to resolve the isa_irq -> i8259 dependency after i8259 is initialized. -*/ - isa_irq =qemu_irq_proxy (&s->i8259,16 ); -/* Northbridge */ - pci_bus =gt64120_register (isa_irq); + pci_bus =gt64120_register (s->i8259);/* Southbridge */ ide_drive_get (hd,ARRAY_SIZE (hd)); - piix4_devfn =piix4_init (pci_bus, &isa_bus,80 ); + pci =pci_create_simple_multifunction (pci_bus,PCI_DEVFN (10 ,0 ), + true,"PIIX4" ); + dev =DEVICE (pci); + isa_bus =ISA_BUS (qdev_get_child_bus (dev,"isa.0" )); + piix4_devfn = pci->devfn;/* Interrupt controller */ -/* The 8259 is attached to the MIPS CPU INT0 pin, ie interrupt 2 */ - s->i8259 =i8259_init (isa_bus, i8259_irq); +qdev_connect_gpio_out_named (dev,"intr" ,0 , i8259_irq); +for (i =0 ; i <16 ; i++) { + s->i8259[i] =qdev_get_gpio_in_named (dev,"isa" , i); + } -isa_bus_irqs (isa_bus, s->i8259);pci_piix4_ide_init (pci_bus, hd, piix4_devfn +1 );pci_create_simple (pci_bus, piix4_devfn +2 ,"piix4-usb-uhci" ); smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
Signature · 1 line
2.15.1
RFC PATCH 16/29 Revert "irq: introduce qemu_irq_proxy()"
In reply to Philippe Mathieu-DaudéThis function isn't used anymore.
This reverts commit 22ec3283efba9ba0792790da786d6776d83f2a92.
---
I think circular IRQ dependencies should be avoided with today's QOM devices.
include/hw/irq.h | 5 ----- hw/core/irq.c | 14 -------------- 2 files changed, 19 deletions(-)
include/hw/irq.h +0 -5
@@ -53,11 +53,6 @@ qemu_irq qemu_irq_invert(qemu_irq irq);/* Returns a new IRQ which feeds into both the passed IRQs */ qemu_irq qemu_irq_split (qemu_irq irq1,qemu_irq irq2); -/* Returns a new IRQ set which connects 1:1 to another IRQ set, which -* may be set later. -*/ -qemu_irq *qemu_irq_proxy (qemu_irq **target,int n); -/* For internal use in qtest. Similar to qemu_irq_split, but operating on an existing vector of qemu_irq. */ void qemu_irq_intercept_in (qemu_irq *gpio_in,qemu_irq_handler handler,int n);
hw/core/irq.c +0 -14
@@ -121,20 +121,6 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)return qemu_allocate_irq (qemu_splitirq, s,0 ); } -static void proxy_irq_handler (void *opaque,int n,int level) -{ -qemu_irq **target = opaque; - -if (*target) { -qemu_set_irq ((*target)[n], level); - } -} - -qemu_irq *qemu_irq_proxy (qemu_irq **target,int n) -{ -return qemu_allocate_irqs (proxy_irq_handler, target, n); -} -void qemu_irq_intercept_in (qemu_irq *gpio_in,qemu_irq_handler handler,int n) {int i;
Signature · 1 line
2.15.1
PATCH 17/29 piix: move piix4 declaration into new southbridge/i82371_piix.h
In reply to Philippe Mathieu-Daudé--- include/hw/i386/pc.h | 2 -- include/hw/southbridge/i82371_piix.h | 17 +++++++++++++++++ hw/isa/piix4.c | 1 + hw/mips/gt64xxx_pci.c | 1 + MAINTAINERS | 1 + 5 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 include/hw/southbridge/i82371_piix.h
include/hw/i386/pc.h +0 -2
@@ -272,8 +272,6 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type, MemoryRegion *ram_memory);PCIBus *find_i440fx (void ); -/* piix4.c */ -extern PCIDevice *piix4_dev;/* pc_sysfw.c */ void pc_system_firmware_init(MemoryRegion *rom_memory,
include/hw/southbridge/i82371_piix.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Intel 82371 PIIX South Bridge Emulation +* +* 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_PIIX_H +#define HW_ISA_PIIX_H + +#include "hw/pci/pci.h" + +/* piix4.c */ +extern PCIDevice *piix4_dev; + +#endif /* HW_ISA_PIIX_H */
hw/isa/piix4.c +1 -0
@@ -28,6 +28,7 @@#include "hw/i386/pc.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" +#include "hw/southbridge/i82371_piix.h" #include "hw/sysbus.h" PCIDevice *piix4_dev;
hw/mips/gt64xxx_pci.c +1 -0
@@ -28,6 +28,7 @@#include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/i386/pc.h" +#include "hw/southbridge/i82371_piix.h" #include "exec/address-spaces.h" //#define DEBUG
MAINTAINERS +1 -0
@@ -888,6 +888,7 @@ 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/southbridge/i82371_piix.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*
Signature · 1 line
2.15.1
PATCH 18/29 piix4: add a i8257 dma controller as specified in datasheet
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
Remove i8257 instanciated in malta board, to not have it twice.
--- hw/isa/piix4.c | 4 ++++ hw/mips/mips_malta.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-)
hw/isa/piix4.c +4 -0
@@ -29,6 +29,7 @@#include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "hw/southbridge/i82371_piix.h" +#include "hw/dma/i8257.h" #include "hw/sysbus.h" PCIDevice *piix4_dev;
@@ -163,6 +164,9 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)/* initialize ISA irqs */ isa_bus_irqs (isa_bus, s->isa); +/* DMA */ +i8257_dma_init (isa_bus,0 ); + piix4_dev = pci_dev; }
hw/mips/mips_malta.c +0 -2
@@ -28,7 +28,6 @@#include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/isa/superio.h" -#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "net/net.h" #include "hw/boards.h"
@@ -1208,7 +1207,6 @@ void mips_malta_init(MachineState *machine) smbus =piix4_pm_init (pci_bus, piix4_devfn +3 ,0x1100 ,isa_get_irq (NULL ,9 ),NULL ,0 ,NULL ); pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); -i8257_dma_init (isa_bus,0 );mc146818_rtc_init (isa_bus,2000 ,NULL );/* generate SPD EEPROM data */
Signature · 1 line
2.15.1
PATCH 19/29 piix4: add a i8254 pit controller as specified in datasheet
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
Remove i8254 instanciated in malta board, to not have it twice.
--- hw/isa/piix4.c | 4 ++++ hw/mips/mips_malta.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-)
hw/isa/piix4.c +4 -0
@@ -31,6 +31,7 @@#include "hw/southbridge/i82371_piix.h" #include "hw/dma/i8257.h" #include "hw/sysbus.h" +#include "hw/timer/i8254.h" PCIDevice *piix4_dev;
@@ -164,6 +165,9 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)/* initialize ISA irqs */ isa_bus_irqs (isa_bus, s->isa); +/* initialize pit */ +i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); +/* DMA */ i8257_dma_init (isa_bus,0 );
hw/mips/mips_malta.c +0 -4
@@ -44,7 +44,6 @@#include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" -#include "hw/timer/i8254.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" /* SysBusDevice */
@@ -98,8 +97,6 @@ typedef struct {qemu_irq i8259[16 ]; } MaltaState; -static ISADevice *pit; - static struct _loaderparams { int ram_size, ram_low_size; const char *kernel_filename;
@@ -1206,7 +1203,6 @@ void mips_malta_init(MachineState *machine)pci_create_simple (pci_bus, piix4_devfn +2 ,"piix4-usb-uhci" ); smbus =piix4_pm_init (pci_bus, piix4_devfn +3 ,0x1100 ,isa_get_irq (NULL ,9 ),NULL ,0 ,NULL ); - pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL );mc146818_rtc_init (isa_bus,2000 ,NULL );/* generate SPD EEPROM data */
Signature · 1 line
2.15.1
PATCH 20/29 piix4: add a speaker as specified in datasheet
In reply to Philippe Mathieu-DaudéFrom: Hervé Poussineau <[email protected]>
--- hw/isa/piix4.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/isa/piix4.c +6 -1
@@ -31,6 +31,7 @@#include "hw/southbridge/i82371_piix.h" #include "hw/dma/i8257.h" #include "hw/sysbus.h" +#include "hw/audio/pcspk.h" #include "hw/timer/i8254.h" PCIDevice *piix4_dev;
@@ -142,6 +143,7 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)DeviceState *dev =DEVICE (pci_dev);PIIX4State *s =DO_UPCAST (PIIX4State, dev, pci_dev);ISABus *isa_bus; +ISADevice *pit;qemu_irq *i8259_out_irq; isa_bus = isa_bus_new(dev, pci_address_space(pci_dev),
@@ -166,7 +168,10 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)isa_bus_irqs (isa_bus, s->isa);/* initialize pit */ -i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); + pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); + +/* speaker */ +pcspk_init (isa_bus, pit);/* DMA */ i8257_dma_init (isa_bus,0 );
Signature · 1 line
2.15.1
PATCH 21/29 piix: move southbridge related declarations/definitions to i82371_piix.h
In reply to Philippe Mathieu-Daudé--- include/hw/acpi/piix4.h | 6 ------ include/hw/i386/pc.h | 12 ------------ include/hw/southbridge/i82371_piix.h | 17 +++++++++++++++++ hw/acpi/piix4.c | 2 +- hw/i386/acpi-build.c | 2 +- hw/i386/pc_piix.c | 1 + hw/mips/mips_malta.c | 2 +- hw/pci-host/piix.c | 1 - MAINTAINERS | 1 - 9 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 include/hw/acpi/piix4.h
include/hw/acpi/piix4.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef HW_ACPI_PIIX4_H -#define HW_ACPI_PIIX4_H - -Object *piix4_pm_find (void ); - -#endif
include/hw/i386/pc.h +0 -12
@@ -236,12 +236,6 @@ int cmos_get_fd_drive_type(FloppyDriveType fd0);#define PORT92_A20_LINE "a20" -/* acpi_piix.c */ - -I2CBus *piix4_pm_init (PCIBus *bus,int devfn,uint32_t smb_io_base, -qemu_irq sci_irq,qemu_irq smi_irq, -int smm_enabled,DeviceState **piix4_pm); -/* hpet.c */ extern int no_hpet;
@@ -254,12 +248,6 @@ typedef struct PCII440FXState PCII440FXState;#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" -/* -* Reset Control Register: PCI-accessible ISA-Compatible Register at address -* 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). -*/ -#define RCR_IOPORT 0xcf9 - PCIBus *i440fx_init(const char *host_type, const char *pci_type, PCII440FXState **pi440fx_state, int *piix_devfn, ISABus **isa_bus, qemu_irq *pic,
include/hw/southbridge/i82371_piix.h +17 -0
@@ -10,8 +10,25 @@#define HW_ISA_PIIX_H #include "hw/pci/pci.h" +#include "hw/isa/isa.h" + +#define TYPE_PIIX4_PCI_DEVICE "PIIX4" + +#define PIIX_NUM_PIRQS 4ULL/* PIRQ[A-D] */ + +/* +* Reset Control Register: PCI-accessible ISA-Compatible Register at address +* 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). +*/ +#define RCR_IOPORT 0xcf9/* piix4.c */ extern PCIDevice *piix4_dev; +/* acpi_piix.c */ +Object *piix4_pm_find (void ); +I2CBus *piix4_pm_init (PCIBus *bus,int devfn,uint32_t smb_io_base, +qemu_irq sci_irq,qemu_irq smi_irq, +int smm_enabled,DeviceState **piix4_pm); +#endif /* HW_ISA_PIIX_H */
hw/acpi/piix4.c +1 -1
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/southbridge/i82371_piix.h" #include "hw/isa/apm.h" #include "hw/i2c/pm_smbus.h" #include "hw/pci/pci.h"
@@ -31,7 +32,6 @@#include "exec/ioport.h" #include "hw/nvram/fw_cfg.h" #include "exec/address-spaces.h" -#include "hw/acpi/piix4.h" #include "hw/acpi/pcihp.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/cpu.h"
hw/i386/acpi-build.c +1 -1
@@ -48,7 +48,7 @@#include "sysemu/numa.h" /* Supported chipsets: */ -#include "hw/acpi/piix4.h" +#include "hw/southbridge/i82371_piix.h" #include "hw/acpi/pcihp.h" #include "hw/i386/ich9.h" #include "hw/pci/pci_bus.h"
hw/i386/pc_piix.c +1 -0
@@ -31,6 +31,7 @@#include "hw/smbios/smbios.h" #include "hw/pci/pci.h" #include "hw/pci/pci_ids.h" +#include "hw/southbridge/i82371_piix.h" #include "hw/usb.h" #include "net/net.h" #include "hw/boards.h"
hw/mips/mips_malta.c +1 -1
@@ -26,7 +26,7 @@#include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" -#include "hw/i386/pc.h" +#include "hw/southbridge/i82371_piix.h" #include "hw/isa/superio.h" #include "hw/char/serial.h" #include "net/net.h"
hw/pci-host/piix.c +0 -1
@@ -55,7 +55,6 @@ typedef struct I440FXState { } I440FXState;#define PIIX_NUM_PIC_IRQS 16/* i8259 * 2 */ -#define PIIX_NUM_PIRQS 4ULL/* PIRQ[A-D] */ #define XEN_PIIX_NUM_PIRQS 128ULL#define PIIX_PIRQC 0x60
MAINTAINERS +0 -1
@@ -859,7 +859,6 @@ F: hw/i2c/smbus_ich9.c F: hw/acpi/piix4.c F: hw/acpi/ich9.c F: include/hw/acpi/ich9.h -F: include/hw/acpi/piix4.h F: hw/misc/sga.c PC Chipset
Signature · 1 line
2.15.1
PATCH 22/29 piix3: extract piix3_init() from i440fx_init()
In reply to Philippe Mathieu-Daudé--- include/hw/southbridge/i82371_piix.h | 4 +++ hw/pci-host/piix.c | 62 ++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 28 deletions(-)
include/hw/southbridge/i82371_piix.h +4 -0
@@ -22,6 +22,10 @@*/ #define RCR_IOPORT 0xcf9 +/* piix.c */ +PCIDevice *piix3_init (PCIBus *bus,ISABus **isa_bus, +qemu_irq *pic,int *piix3_devfn); +/* piix4.c */ extern PCIDevice *piix4_dev;
hw/pci-host/piix.c +34 -28
92 lines not on this page · raw message
Signature · 1 line
2.15.1
PATCH 23/29 hw/i386: extract i440fx related declarations/definitions to i440fx.h
In reply to Philippe Mathieu-Daudé--- include/hw/i386/pc.h | 22 ------------------- include/hw/pci-host/i440fx.h | 51 ++++++++++++++++++++++++++++++++++++++++++++ hw/acpi/pcihp.c | 2 +- hw/i386/pc_piix.c | 1 + hw/pci-host/piix.c | 1 + stubs/pci-host-piix.c | 3 ++- MAINTAINERS | 1 + 7 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 include/hw/pci-host/i440fx.h
include/hw/i386/pc.h +0 -22
@@ -239,28 +239,6 @@ int cmos_get_fd_drive_type(FloppyDriveType fd0);/* hpet.c */ extern int no_hpet; -/* piix_pci.c */ -struct PCII440FXState ; -typedef struct PCII440FXState PCII440FXState ; - -#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" -#define TYPE_I440FX_PCI_DEVICE "i440FX" - -#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" - -PCIBus *i440fx_init (const char *host_type,const char *pci_type, -PCII440FXState **pi440fx_state,int *piix_devfn, -ISABus **isa_bus,qemu_irq *pic, -MemoryRegion *address_space_mem, -MemoryRegion *address_space_io, -ram_addr_t ram_size, -ram_addr_t below_4g_mem_size, -ram_addr_t above_4g_mem_size, -MemoryRegion *pci_memory, -MemoryRegion *ram_memory); - -PCIBus *find_i440fx (void ); -/* pc_sysfw.c */ void pc_system_firmware_init (MemoryRegion *rom_memory,bool isapc_ram_fw);
include/hw/pci-host/i440fx.h new file +51 -0
51 lines not on this page · raw message
hw/acpi/pcihp.c +1 -1
@@ -28,8 +28,8 @@#include "hw/acpi/pcihp.h" #include "hw/hw.h" -#include "hw/i386/pc.h" #include "hw/pci/pci.h" +#include "hw/pci-host/i440fx.h" #include "hw/acpi/acpi.h" #include "sysemu/sysemu.h" #include "exec/ioport.h"
hw/i386/pc_piix.c +1 -0
@@ -31,6 +31,7 @@#include "hw/smbios/smbios.h" #include "hw/pci/pci.h" #include "hw/pci/pci_ids.h" +#include "hw/pci-host/i440fx.h" #include "hw/southbridge/i82371_piix.h" #include "hw/usb.h" #include "net/net.h"
hw/pci-host/piix.c +1 -0
@@ -27,6 +27,7 @@#include "hw/i386/pc.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" +#include "hw/pci-host/i440fx.h" #include "hw/southbridge/i82371_piix.h" #include "hw/isa/isa.h" #include "hw/sysbus.h"
stubs/pci-host-piix.c +2 -1
@@ -1,5 +1,6 @@#include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/pci-host/i440fx.h" +PCIBus *find_i440fx (void ) {return NULL ;
MAINTAINERS +1 -0
@@ -859,6 +859,7 @@ F: hw/i2c/smbus_ich9.c F: hw/acpi/piix4.c F: hw/acpi/ich9.c F: include/hw/acpi/ich9.h +F: include/hw/pci-host/i440fx.h F: hw/misc/sga.c PC Chipset
Signature · 1 line
2.15.1
PATCH 24/29 hw/i386: extract i440fx code from piix.c into i440fx.c
In reply to Philippe Mathieu-Daudé--- default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + hw/pci-host/i440fx.c | 543 +++++++++++++++++++++++++++++++++++++ hw/pci-host/piix.c | 522 +---------------------------------- MAINTAINERS | 1 + hw/pci-host/Makefile.objs | 1 + 6 files changed, 552 insertions(+), 517 deletions(-) create mode 100644 hw/pci-host/i440fx.c
default-configs/i386-softmmu.mak +1 -0
@@ -38,6 +38,7 @@ CONFIG_I8259=y CONFIG_PFLASH_CFI01=y CONFIG_TPM_TIS=$(CONFIG_TPM) CONFIG_MC146818RTC=y +CONFIG_PCI_I440FX=y CONFIG_PCI_PIIX=y CONFIG_WDT_IB700=y CONFIG_ISA_DEBUG=y
default-configs/x86_64-softmmu.mak +1 -0
@@ -38,6 +38,7 @@ CONFIG_I8259=y CONFIG_PFLASH_CFI01=y CONFIG_TPM_TIS=$(CONFIG_TPM) CONFIG_MC146818RTC=y +CONFIG_PCI_I440FX=y CONFIG_PCI_PIIX=y CONFIG_WDT_IB700=y CONFIG_ISA_DEBUG=y
hw/pci-host/i440fx.c new file +543 -0
543 lines not on this page · raw message
hw/pci-host/piix.c +5 -517
556 lines not on this page · raw message
MAINTAINERS +1 -0
@@ -849,6 +849,7 @@ S: Supported F: include/hw/i386/ F: hw/i386/ F: hw/pci-host/piix.c +F: hw/pci-host/i440fx.c F: hw/pci-host/q35.c F: hw/pci-host/pam.c F: include/hw/pci-host/q35.h
hw/pci-host/Makefile.objs +1 -0
@@ -14,6 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o common-obj-$(CONFIG_PCI_APB) += apb.o common-obj-$(CONFIG_FULONG) += bonito.o common-obj-$(CONFIG_PCI_PIIX) += piix.o +common-obj-$(CONFIG_PCI_I440FX) += i440fx.o common-obj-$(CONFIG_PCI_Q35) += q35.o common-obj-$(CONFIG_PCI_GENERIC) += gpex.o common-obj-$(CONFIG_PCI_XILINX) += xilinx-pcie.o
Signature · 1 line
2.15.1
PATCH 25/29 hw/i386: move piix from hw/pci-host to hw/southbridge
In reply to Philippe Mathieu-Daudé---
hw/{pci-host => southbridge}/piix.c | 0
MAINTAINERS | 2 +-
hw/Makefile.objs | 1 +
hw/pci-host/Makefile.objs | 1 -
hw/southbridge/Makefile.objs | 1 +
5 files changed, 3 insertions(+), 2 deletions(-)
rename hw/{pci-host => southbridge}/piix.c (100%)
create mode 100644 hw/southbridge/Makefile.objshw/southbridge/piix.c renamed from hw/pci-host/piix.c +0 -0
MAINTAINERS +1 -1
@@ -848,7 +848,6 @@ M: Michael S. Tsirkin <[email protected]> S: Supported F: include/hw/i386/ F: hw/i386/ -F: hw/pci-host/piix.c F: hw/pci-host/i440fx.c F: hw/pci-host/q35.c F: hw/pci-host/pam.c
@@ -879,6 +878,7 @@ F: hw/intc/i8259* F: hw/isa/isa-superio.c F: hw/misc/debugexit.c F: hw/misc/pc-testdev.c +F: hw/southbridge/piix.c F: hw/timer/hpet* F: hw/timer/i8254* F: hw/timer/mc146818rtc*
hw/Makefile.objs +1 -0
@@ -21,6 +21,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += net/ devices-dirs-$(CONFIG_SOFTMMU) += nvram/ devices-dirs-$(CONFIG_SOFTMMU) += pci/ devices-dirs-$(CONFIG_PCI) += pci-bridge/ pci-host/ +devices-dirs-$(CONFIG_SOFTMMU) += southbridge/ devices-dirs-$(CONFIG_SOFTMMU) += pcmcia/ devices-dirs-$(CONFIG_SOFTMMU) += scsi/ devices-dirs-$(CONFIG_SOFTMMU) += sd/
hw/pci-host/Makefile.objs +0 -1
@@ -13,7 +13,6 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o common-obj-$(CONFIG_PCI_APB) += apb.o common-obj-$(CONFIG_FULONG) += bonito.o -common-obj-$(CONFIG_PCI_PIIX) += piix.o common-obj-$(CONFIG_PCI_I440FX) += i440fx.o common-obj-$(CONFIG_PCI_Q35) += q35.o common-obj-$(CONFIG_PCI_GENERIC) += gpex.o
hw/southbridge/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +common-obj-$(CONFIG_PCI_PIIX) += piix.o
Signature · 1 line
2.15.1
PATCH 26/29 configs/mips-softmmu: use common CONFIG_PCI_PIIX instead of CONFIG_PIIX4
In reply to Philippe Mathieu-Daudé--- default-configs/mips-softmmu-common.mak | 2 +- hw/isa/Makefile.objs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
default-configs/mips-softmmu-common.mak +1 -1
@@ -22,7 +22,7 @@ CONFIG_ACPI_NVDIMM=y CONFIG_ACPI_CPU_HOTPLUG=y CONFIG_APM=y CONFIG_I8257=y -CONFIG_PIIX4=y +CONFIG_PCI_PIIX=y CONFIG_IDE_ISA=y CONFIG_IDE_PIIX=y CONFIG_NE2000_ISA=y
hw/isa/Makefile.objs +1 -1
@@ -3,7 +3,7 @@ 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 -common-obj-$(CONFIG_PIIX4) += piix4.o +common-obj-$(CONFIG_PCI_PIIX) += piix4.o common-obj-$(CONFIG_VT82C686) += vt82c686.o obj-$(CONFIG_LPC_ICH9) += lpc_ich9.o
Signature · 1 line
2.15.1
PATCH 27/29 piix3: convert reset function to QOM
In reply to Philippe Mathieu-Daudé--- hw/southbridge/piix.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
hw/southbridge/piix.c +6 -7
@@ -203,10 +203,10 @@ static void piix3_write_config_xen(PCIDevice *dev,piix3_write_config (dev, address, val, len); } -static void piix3_reset (void *opaque) +static void piix3_reset (DeviceState *dev) { -PIIX3State *d = opaque; -uint8_t *pci_conf = d->dev.config; +PIIX3State *s =PIIX3_PCI_DEVICE (dev); +uint8_t *pci_conf = s->dev.config; pci_conf[0x04 ] =0x07 ;/* master, memory and I/O */ pci_conf[0x05 ] =0x00 ;
@@ -240,8 +240,8 @@ static void piix3_reset(void *opaque) pci_conf[0xac ] =0x00 ; pci_conf[0xae ] =0x00 ; - d->pic_levels =0 ; - d->rcr =0 ; + s->pic_levels =0 ; + s->rcr =0 ; }static int piix3_post_load (void *opaque,int version_id)
@@ -352,8 +352,6 @@ static void piix3_realize(PCIDevice *dev, Error **errp) "piix3-reset-control", 1);memory_region_add_subregion_overlap (pci_address_space_io (dev),RCR_IOPORT , &d->rcr_mem,1 ); - -qemu_register_reset (piix3_reset, d); }static void pci_piix3_class_init (ObjectClass *klass,void *data)
@@ -364,6 +362,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) dc->desc ="ISA bridge" ; dc->vmsd = &vmstate_piix3; dc->hotpluggable = false; + dc->reset = piix3_reset; k->realize = piix3_realize; k->vendor_id =PCI_VENDOR_ID_INTEL ;/* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
Signature · 1 line
2.15.1
PATCH 28/29 piix: merge common code from isa/piix4.c with southbridge piix3
In reply to Philippe Mathieu-Daudé--- hw/isa/piix4.c | 218 -------------------------------------------- hw/southbridge/piix.c | 246 +++++++++++++++++++++++++++++++++++++++++--------- hw/isa/Makefile.objs | 1 - 3 files changed, 203 insertions(+), 262 deletions(-) delete mode 100644 hw/isa/piix4.c
hw/isa/piix4.c deleted +0 -218
@@ -1,218 +0,0 @@ -/* -* QEMU PIIX4 PCI Bridge Emulation -* -* Copyright (c) 2006 Fabrice Bellard -* Copyright (c) 2018 Hervé Poussineau -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -* THE SOFTWARE. -*/ - -#include "qemu/osdep.h" -#include "hw/hw.h" -#include "hw/i386/pc.h" -#include "hw/pci/pci.h" -#include "hw/isa/isa.h" -#include "hw/southbridge/i82371_piix.h" -#include "hw/dma/i8257.h" -#include "hw/sysbus.h" -#include "hw/audio/pcspk.h" -#include "hw/timer/i8254.h" - -PCIDevice *piix4_dev; - -typedef struct PIIX4State { -PCIDevice dev; -qemu_irq cpu_intr; -qemu_irq *isa; - -/* Reset Control Register */ -MemoryRegion rcr_mem; -uint8_t rcr; -}PIIX4State ; - -#define TYPE_PIIX4_PCI_DEVICE "PIIX4" -#define PIIX4_PCI_DEVICE (obj) \ - OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE) - -static void piix4_reset (DeviceState *dev) -{ -PIIX4State *s =PIIX4_PCI_DEVICE (dev); -uint8_t *pci_conf = s->dev.config; - - pci_conf[0x04 ] =0x07 ;// master, memory and I/O - pci_conf[0x05 ] =0x00 ; - pci_conf[0x06 ] =0x00 ; - pci_conf[0x07 ] =0x02 ;// PCI_status_devsel_medium - pci_conf[0x4c ] =0x4d ; - pci_conf[0x4e ] =0x03 ; - pci_conf[0x4f ] =0x00 ; - pci_conf[0x60 ] =0x0a ;// PCI A -> IRQ 10 - pci_conf[0x61 ] =0x0a ;// PCI B -> IRQ 10 - pci_conf[0x62 ] =0x0b ;// PCI C -> IRQ 11 - pci_conf[0x63 ] =0x0b ;// PCI D -> IRQ 11 - pci_conf[0x69 ] =0x02 ; - pci_conf[0x70 ] =0x80 ; - pci_conf[0x76 ] =0x0c ; - pci_conf[0x77 ] =0x0c ; - pci_conf[0x78 ] =0x02 ; - pci_conf[0x79 ] =0x00 ; - pci_conf[0x80 ] =0x00 ; - pci_conf[0x82 ] =0x00 ; - pci_conf[0xa0 ] =0x08 ; - pci_conf[0xa2 ] =0x00 ; - pci_conf[0xa3 ] =0x00 ; - pci_conf[0xa4 ] =0x00 ; - pci_conf[0xa5 ] =0x00 ; - pci_conf[0xa6 ] =0x00 ; - pci_conf[0xa7 ] =0x00 ; - pci_conf[0xa8 ] =0x0f ; - pci_conf[0xaa ] =0x00 ; - pci_conf[0xab ] =0x00 ; - pci_conf[0xac ] =0x00 ; - pci_conf[0xae ] =0x00 ; -} - -static const VMStateDescription vmstate_piix4 = { - .name ="PIIX4" , - .version_id =2 , - .minimum_version_id =2 , - .fields = (VMStateField []) { -VMSTATE_PCI_DEVICE (dev, PIIX4State), -VMSTATE_END_OF_LIST () - } -}; - -static void piix4_request_i8259_irq (void *opaque,int irq,int level) -{ -PIIX4State *s = opaque; -qemu_set_irq (s->cpu_intr, level); -} - -static void piix4_set_i8259_irq (void *opaque,int irq,int level) -{ -PIIX4State *s = opaque; -qemu_set_irq (s->isa[irq], level); -} - -static void piix4_rcr_write (void *opaque,hwaddr addr,uint64_t val, -unsigned int len) -{ -PIIX4State *s = opaque; - -if (val &4 ) { -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); -return ; - } - s->rcr = val &2 ;/* keep System Reset type only */ -} - -static uint64_t piix4_rcr_read (void *opaque,hwaddr addr,unsigned int len) -{ -PIIX4State *s = opaque; -return s->rcr; -} - -static const MemoryRegionOps piix4_rcr_ops = { - .read = piix4_rcr_read, - .write = piix4_rcr_write, - .endianness =DEVICE_LITTLE_ENDIAN , - .impl = { - .min_access_size =1 , - .max_access_size =1 , - }, -}; - -static void piix4_realize (PCIDevice *pci_dev,Error **errp) -{ -DeviceState *dev =DEVICE (pci_dev); -PIIX4State *s =DO_UPCAST (PIIX4State, dev, pci_dev); -ISABus *isa_bus; -ISADevice *pit; -qemu_irq *i8259_out_irq; - - isa_bus =isa_bus_new (dev,pci_address_space (pci_dev), -pci_address_space_io (pci_dev), errp); -if (!isa_bus) { -return ; - } - -qdev_init_gpio_in_named (dev, piix4_set_i8259_irq,"isa" ,ISA_NUM_IRQS ); -qdev_init_gpio_out_named (dev, &s->cpu_intr,"intr" ,1 ); - -memory_region_init_io (&s->rcr_mem,OBJECT (dev), &piix4_rcr_ops, s, -"reset-control" ,1 ); -memory_region_add_subregion_overlap (pci_address_space_io (pci_dev),0xcf9 , - &s->rcr_mem,1 ); - -/* initialize i8259 pic */ - i8259_out_irq =qemu_allocate_irqs (piix4_request_i8259_irq, s,1 ); - s->isa =i8259_init (isa_bus, *i8259_out_irq); - -/* initialize ISA irqs */ -isa_bus_irqs (isa_bus, s->isa); - -/* initialize pit */ - pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); - -/* speaker */ -pcspk_init (isa_bus, pit); - -/* DMA */ -i8257_dma_init (isa_bus,0 ); - - piix4_dev = pci_dev; -} - -static void piix4_class_init (ObjectClass *klass,void *data) -{ -DeviceClass *dc =DEVICE_CLASS (klass); -PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - - k->realize = piix4_realize; - k->vendor_id =PCI_VENDOR_ID_INTEL ; - k->device_id =PCI_DEVICE_ID_INTEL_82371AB_0 ; - k->class_id =PCI_CLASS_BRIDGE_ISA ; - dc->reset = piix4_reset; - dc->desc ="ISA bridge" ; - dc->vmsd = &vmstate_piix4; -/* -* Reason: part of PIIX4 southbridge, needs to be wired up, -* e.g. by mips_malta_init() -*/ - dc->user_creatable = false; - dc->hotpluggable = false; -} - -static const TypeInfo piix4_info = { - .name =TYPE_PIIX4_PCI_DEVICE , - .parent =TYPE_PCI_DEVICE , - .instance_size =sizeof (PIIX4State), - .class_init = piix4_class_init, - .interfaces = (InterfaceInfo []) { - {INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - -static void piix4_register_types (void ) -{ -type_register_static (&piix4_info); -} - -type_init (piix4_register_types)
hw/southbridge/piix.c +203 -43
301 lines not on this page · raw message
hw/isa/Makefile.objs +0 -1
@@ -3,7 +3,6 @@ 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 -common-obj-$(CONFIG_PCI_PIIX) += piix4.o common-obj-$(CONFIG_VT82C686) += vt82c686.o obj-$(CONFIG_LPC_ICH9) += lpc_ich9.o
Signature · 1 line
2.15.1
PATCH 29/29 piix4: add isa_superio_init
In reply to Philippe Mathieu-DaudéFor Hervé to test his VirtualPC2007.
hw/southbridge/piix.c | 3 +++ 1 file changed, 3 insertions(+)
hw/southbridge/piix.c +3 -0
@@ -32,6 +32,7 @@#include "hw/dma/i8257.h" #include "hw/audio/pcspk.h" #include "hw/timer/i8254.h" +#include "hw/isa/superio.h" #include "hw/xen/xen.h" #define PIIX_NUM_PIC_IRQS 16/* i8259 * 2 */
@@ -538,6 +539,8 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)/* DMA */ i8257_dma_init (s->isa_bus,0 ); +isa_superio_init (s->isa_bus,2 ,1 ,1 ); + piix4_dev = pci_dev; }
Signature · 1 line
2.15.1