remove i386/pc dependency: generic SuperIO
cover remove i386/pc dependency: generic SuperIO
Hi Paolo, Michael, Hervé and Yongbok.
This series could be the 'part 2' of my previous "remove i386/pc dependency from non-PC world" I started around 2.9.
The goal is to unify the Super I/O device pattern.
In this rewrite I:
- extract the common SuperIO code from pc87312.c
- use it in few MIPS boards
- as example, easily add a new SuperIO chipset (SMC37C669) to the DP264 machine.
The SMC37C669 is very easily modeled and understandable in the "Add the SMC FDC37C669 Super I/O" patch. Once used by the DP264 machine, the machine direcly inherits of the parallel port and two floppy drives without any effort in the machine code (therefore, easier to qtest and maintain).
The emphasis of the differences is show in the link [2].
Since RFC v2:
- fixed missing .class_size of abstract class in "Add a Super I/O template"
- fixed ptrdiff_t Werror=format string (patchew)
- fixed incorrect/missing MAINTAINERS entries
- only use "discarded-" in device name when no backend provided
- added R-b tags (David Gibson)
tested on:
- Q35
- alpha DP264 [1], [2]
- mips Malta
- mips Fuloong (only monitor, no image to test) [3]
- PReP (only monitor, no image to test)
Paolo: I tested the series and think it is ready to go and shouldn't break upstream, but I'd like more testing for the Fuloong/PReP machines and eventually an Ack-by from Michael S. Tsirkin since his area is well touched by this series.
diff between master and this series here replied to previous thread there:
[1] http://lists.nongnu.org/archive/html/qemu-devel/2018-03/msg02510.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2018-03/msg02516.html
[3] http://lists.nongnu.org/archive/html/qemu-devel/2018-03/msg02515.html
Since RFC v1:
- complete rewrite, split out the PIIX devices for another series
More devices are being converted but I'm running out of time for the soft freeze (mips_r4k, hppa_dino, and the PC ones).
Regards,
Phil.
$ git backport-diff -u rfc_v2 [----] : patches are identical [####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
001/25:[----] [--] 'hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c' 002/25:[----] [--] 'hw/dma/i8257: Rename DMA_init() to i8257_dma_init()' 003/25:[----] [--] 'hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h' 004/25:[down] 'MAINTAINERS: Fix the PC87312 include path'
005/25:[----] [--] 'hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO' 006/25:[----] [--] 'hw/isa/pc87312: Use uint16_t for the ISA I/O base address' 007/25:[----] [--] 'hw/isa/pc87312: Use 'unsigned int' for the irq value' 008/25:[0003] [FC] 'hw/isa/superio: Add a Super I/O template based on the PC87312 device' 009/25:[----] [--] 'hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO' 010/25:[0006] [FC] 'hw/isa/superio: Factor out the parallel code from pc87312.c' 011/25:[0006] [FC] 'hw/isa/superio: Factor out the serial code from pc87312.c' 012/25:[----] [--] 'hw/isa/superio: Factor out the floppy disc controller code from pc87312.c' 013/25:[----] [--] 'hw/isa/superio: Add a keyboard/mouse controller (8042)' 014/25:[----] [--] 'hw/isa/superio: Factor out the IDE code from pc87312.c' 015/25:[----] [--] 'hw/mips/malta: Code movement'
016/25:[0001] [FC] 'hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c' 017/25:[----] [--] 'hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init()' 018/25:[----] [--] 'hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init()' 019/25:[----] [--] 'hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO' 020/25:[down] 'MAINTAINERS: Add entries for the VT82C686B Super I/O' 021/25:[down] 'MAINTAINERS: Split the Alpha TCG/machine section'
022/25:[0001] [FC] 'hw/isa/superio: Add the SMC FDC37C669 Super I/O' 023/25:[----] [--] 'hw/alpha/dp264: Add the ISA DMA controller'
024/25:[----] [--] 'hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO' 025/25:[----] [--] 'hw/i386/pc: Factor out the superio code'
Philippe Mathieu-Daudé (25):
hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c hw/dma/i8257: Rename DMA_init() to i8257_dma_init() hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h
MAINTAINERS: Fix the PC87312 include path
hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO hw/isa/pc87312: Use uint16_t for the ISA I/O base address hw/isa/pc87312: Use 'unsigned int' for the irq value hw/isa/superio: Add a Super I/O template based on the PC87312 device hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO hw/isa/superio: Factor out the parallel code from pc87312.c hw/isa/superio: Factor out the serial code from pc87312.c hw/isa/superio: Factor out the floppy disc controller code from pc87312.c hw/isa/superio: Add a keyboard/mouse controller (8042) hw/isa/superio: Factor out the IDE code from pc87312.c hw/mips/malta: Code movement
hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init() hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init() hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO
MAINTAINERS: Add entries for the VT82C686B Super I/O
MAINTAINERS: Split the Alpha TCG/machine section hw/isa/superio: Add the SMC FDC37C669 Super I/O hw/alpha/dp264: Add the ISA DMA controller
hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO
hw/i386/pc: Factor out the superio code
default-configs/alpha-softmmu.mak | 5 +
include/hw/char/parallel.h | 14 +++
include/hw/{isa => dma}/i8257.h | 6 ++
include/hw/i386/pc.h | 17 ---
include/hw/input/i8042.h | 24 +++++
include/hw/isa/isa.h | 2 -
include/hw/isa/pc87312.h | 24 ++---
include/hw/isa/superio.h | 60 +++++++++++
include/hw/isa/vt82c686.h | 4 +-
hw/alpha/dp264.c | 13 ++-
hw/char/parallel-isa.c | 36 +++++++
hw/char/parallel.c | 2 +-
hw/dma/i82374.c | 3 +-
hw/dma/i8257.c | 4 +-
hw/i386/pc.c | 77 ++++++++------
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 | 214 ++++++++++++++++++++++++++++++++++++++
hw/isa/pc87312.c | 178 ++++++++++++++-----------------
hw/isa/smc37c669-superio.c | 115 ++++++++++++++++++++
hw/isa/vt82c686.c | 22 +++-
hw/mips/mips_fulong2e.c | 85 +++++++--------
hw/mips/mips_jazz.c | 5 +-
hw/mips/mips_malta.c | 48 ++++-----
hw/mips/mips_r4k.c | 3 +-
hw/ppc/prep.c | 6 +-
hw/sparc/sun4m.c | 4 -
hw/sparc64/sun4u.c | 6 +-
hw/unicore32/puv3.c | 1 +
MAINTAINERS | 20 +++-
hw/char/Makefile.objs | 1 +
hw/isa/Makefile.objs | 1 +
hw/isa/trace-events | 10 +-
35 files changed, 737 insertions(+), 303 deletions(-)
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 hw/char/parallel-isa.c
create mode 100644 hw/isa/isa-superio.c
create mode 100644 hw/isa/smc37c669-superio.cSignature · 1 line
2.16.2
PATCH 1/25 hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c
Again... (after 07dc788054d7 and 9157eee1b1c0).
We now extract the ISA bus specific helpers.
--- include/hw/char/parallel.h | 14 ++++++++++++++ include/hw/i386/pc.h | 8 -------- hw/char/parallel-isa.c | 36 ++++++++++++++++++++++++++++++++++++ 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, 59 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 +36 -0
@@ -0,0 +1,36 @@ +/* +* QEMU Parallel PORT (ISA bus helpers) +* +* Copyright (c) 2003 Fabrice Bellard +* +* SPDX-License-Identifier: MIT +*/ +#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
@@ -26,6 +26,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
@@ -24,7 +24,6 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" static ISABus *isabus;
@@ -288,28 +287,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
@@ -34,6 +34,7 @@#include "hw/pci-host/sabre.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
@@ -913,7 +913,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
@@ -928,6 +928,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.16.2
PATCH 2/25 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
- use a bool type for the high_page_enable argument
---
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,bool 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)), true);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, bool high_page_enable) {ISADevice *isa1, *isa2;DeviceState *d;
hw/i386/pc.c +2 -1
@@ -41,6 +41,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"
@@ -1609,7 +1610,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"
@@ -360,7 +361,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"
@@ -220,7 +221,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"
@@ -1209,7 +1210,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
@@ -90,10 +90,6 @@ typedef struct EbusState {#define TYPE_EBUS "ebus"#define EBUS (obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) -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
@@ -929,8 +929,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.16.2
PATCH 3/25 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 | 24 ++++++++++++++++++++++++ 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 | 1 + hw/unicore32/puv3.c | 1 + MAINTAINERS | 1 + 15 files changed, 43 insertions(+), 16 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 +24 -0
@@ -0,0 +1,24 @@ +/* +* QEMU PS/2 Controller +* +* Copyright (c) 2003 Fabrice Bellard +* +* SPDX-License-Identifier: MIT +*/ +#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
@@ -43,6 +43,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"
@@ -364,7 +365,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"
@@ -1213,7 +1214,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"
@@ -286,7 +287,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 +1 -0
@@ -36,6 +36,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"
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
@@ -931,6 +931,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.16.2
PATCH 4/25 MAINTAINERS: Fix the PC87312 include path
In reply to Philippe Mathieu-DaudéMissed while moving it in 0d09e41a51aa.
--- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
MAINTAINERS +2 -1
@@ -765,9 +765,10 @@ F: hw/ppc/prep_systemio.c F: hw/ppc/rs6000_mc.c F: hw/pci-host/prep.[hc] F: hw/isa/i82378.c -F: hw/isa/pc87312.[hc] +F: hw/isa/pc87312.c F: hw/dma/i82374.c F: hw/timer/m48t59-isa.c +F: include/hw/isa/pc87312.h F: include/hw/timer/m48t59.h F: pc-bios/ppc_rom.bin
Signature · 1 line
2.16.2
PATCH 5/25 hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO
In reply to Philippe Mathieu-Daudé--- include/hw/isa/pc87312.h | 4 ++-- hw/isa/pc87312.c | 2 +- hw/ppc/prep.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
include/hw/isa/pc87312.h +2 -2
@@ -28,8 +28,8 @@#include "hw/isa/isa.h" -#define TYPE_PC87312 "pc87312" -#define PC87312 (obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312) +#define TYPE_PC87312_SUPERIO "pc87312" +#define PC87312 (obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERIO) typedef struct PC87312State { ISADevice dev;
hw/isa/pc87312.c +1 -1
@@ -391,7 +391,7 @@ static void pc87312_class_init(ObjectClass *klass, void *data) }static const TypeInfo pc87312_type_info = { - .name =TYPE_PC87312 , + .name =TYPE_PC87312_SUPERIO , .parent =TYPE_ISA_DEVICE , .instance_size =sizeof (PC87312State), .instance_init = pc87312_initfn,
hw/ppc/prep.c +1 -1
@@ -613,7 +613,7 @@ static void ppc_prep_init(MachineState *machine) isa_bus =ISA_BUS (qdev_get_child_bus (DEVICE (pci),"isa.0" ));/* Super I/O (parallel + serial ports) */ - isa =isa_create (isa_bus,TYPE_PC87312 ); + isa =isa_create (isa_bus,TYPE_PC87312_SUPERIO ); dev =DEVICE (isa);qdev_prop_set_uint8 (dev,"config" ,13 );/* fdc, ser0, ser1, par0 */ qdev_init_nofail (dev);
Signature · 1 line
2.16.2
PATCH 6/25 hw/isa/pc87312: Use uint16_t for the ISA I/O base address
In reply to Philippe Mathieu-DaudéThis matches the isa_register_ioport() prototype.
--- include/hw/isa/pc87312.h | 2 +- hw/isa/pc87312.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)
include/hw/isa/pc87312.h +1 -1
@@ -34,7 +34,7 @@ typedef struct PC87312State { ISADevice dev; - uint32_t iobase; + uint16_t iobase; uint8_t config; /* initial configuration */ struct {
hw/isa/pc87312.c +7 -7
@@ -69,9 +69,9 @@ static inline bool is_parallel_enabled(PC87312State *s)return s->regs[REG_FER ] &FER_PARALLEL_EN ; } -static const uint32_t parallel_base[] = {0x378 ,0x3bc ,0x278 ,0x00 }; +static const uint16_t parallel_base[] = {0x378 ,0x3bc ,0x278 ,0x00 }; -static inline uint32_t get_parallel_iobase (PC87312State *s) +static inline uint16_t get_parallel_iobase (PC87312State *s) {return parallel_base[s->regs[REG_FAR ] &FAR_PARALLEL_ADDR ]; }
@@ -92,12 +92,12 @@ static inline uint32_t get_parallel_irq(PC87312State *s)/* UARTs */ -static const uint32_t uart_base[2 ][4 ] = { +static const uint16_t uart_base[2 ][4 ] = { {0x3e8 ,0x338 ,0x2e8 ,0x220 }, {0x2e8 ,0x238 ,0x2e0 ,0x228 } }; -static inline uint32_t get_uart_iobase (PC87312State *s,int i) +static inline uint16_t get_uart_iobase (PC87312State *s,int i) {int idx; idx = (s->regs[REG_FAR ] >> (2 * i +2 )) &0x3 ;
@@ -130,7 +130,7 @@ static inline bool is_fdc_enabled(PC87312State *s)return s->regs[REG_FER ] &FER_FDC_EN ; } -static inline uint32_t get_fdc_iobase (PC87312State *s) +static inline uint16_t get_fdc_iobase (PC87312State *s) {return (s->regs[REG_FER ] &FER_FDC_ADDR ) ?0x370 :0x3f0 ; }
@@ -143,7 +143,7 @@ static inline bool is_ide_enabled(PC87312State *s)return s->regs[REG_FER ] &FER_IDE_EN ; } -static inline uint32_t get_ide_iobase (PC87312State *s) +static inline uint16_t get_ide_iobase (PC87312State *s) {return (s->regs[REG_FER ] &FER_IDE_ADDR ) ?0x170 :0x1f0 ; }
@@ -373,7 +373,7 @@ static const VMStateDescription vmstate_pc87312 = { };static Property pc87312_properties[] = { -DEFINE_PROP_UINT32 ("iobase" , PC87312State, iobase,0x398 ), +DEFINE_PROP_UINT16 ("iobase" , PC87312State, iobase,0x398 ),DEFINE_PROP_UINT8 ("config" , PC87312State, config,1 ),DEFINE_PROP_END_OF_LIST () };
Signature · 1 line
2.16.2
PATCH 7/25 hw/isa/pc87312: Use 'unsigned int' for the irq value
In reply to Philippe Mathieu-Daudé--- hw/isa/pc87312.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/isa/pc87312.c +3 -3
@@ -76,9 +76,9 @@ static inline uint16_t get_parallel_iobase(PC87312State *s)return parallel_base[s->regs[REG_FAR ] &FAR_PARALLEL_ADDR ]; } -static const uint32_t parallel_irq[] = {5 ,7 ,5 ,0 }; +static const unsigned int parallel_irq[] = {5 ,7 ,5 ,0 }; -static inline uint32_t get_parallel_irq (PC87312State *s) +static inline unsigned int get_parallel_irq (PC87312State *s) {int idx; idx = (s->regs[REG_FAR ] &FAR_PARALLEL_ADDR );
@@ -110,7 +110,7 @@ static inline uint16_t get_uart_iobase(PC87312State *s, int i) } } -static inline uint32_t get_uart_irq (PC87312State *s,int i) +static inline unsigned int get_uart_irq (PC87312State *s,int i) {int idx; idx = (s->regs[REG_FAR ] >> (2 * i +2 )) &0x3 ;
Signature · 1 line
2.16.2
PATCH 8/25 hw/isa/superio: Add a Super I/O template based on the PC87312 device
In reply to Philippe Mathieu-Daudé--- include/hw/isa/superio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ hw/isa/isa-superio.c | 28 ++++++++++++++++++++++++++++ MAINTAINERS | 2 ++ hw/isa/Makefile.objs | 1 + 4 files changed, 75 insertions(+) create mode 100644 include/hw/isa/superio.h create mode 100644 hw/isa/isa-superio.c
include/hw/isa/superio.h new file +44 -0
@@ -0,0 +1,44 @@ +/* +* Generic ISA Super I/O +* +* Copyright (c) 2018 Philippe Mathieu-Daudé +* +* This code is licensed under the GNU GPLv2 and later. +* See the COPYING file in the top-level directory. +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef HW_ISA_SUPERIO_H +#define HW_ISA_SUPERIO_H + +#include "qemu-common.h" +#include "sysemu/sysemu.h" +#include "hw/isa/isa.h" + +#define TYPE_ISA_SUPERIO "isa-superio" +#define ISA_SUPERIO (obj) \ + OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO) +#define ISA_SUPERIO_GET_CLASS (obj) \ + OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO) +#define ISA_SUPERIO_CLASS (klass) \ + OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO) + +typedef struct ISASuperIODevice { +ISADevice parent_obj; +}ISASuperIODevice ; + +typedef struct ISASuperIOFuncs { +size_t count; +bool (*is_enabled)(ISASuperIODevice *sio,uint8_t index); +uint16_t (*get_iobase)(ISASuperIODevice *sio,uint8_t index); +unsigned int (*get_irq)(ISASuperIODevice *sio,uint8_t index); +unsigned int (*get_dma)(ISASuperIODevice *sio,uint8_t index); +}ISASuperIOFuncs ; + +typedef struct ISASuperIOClass { +/*< private >*/ +ISADeviceClass parent_class; +/*< public >*/ +DeviceRealize parent_realize; +}ISASuperIOClass ; + +#endif /* HW_ISA_SUPERIO_H */
hw/isa/isa-superio.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Generic ISA Super I/O +* +* Copyright (c) 2010-2012 Herve Poussineau +* Copyright (c) 2011-2012 Andreas Färber +* Copyright (c) 2018 Philippe Mathieu-Daudé +* +* This code is licensed under the GNU GPLv2 and later. +* See the COPYING file in the top-level directory. +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "hw/isa/superio.h" +#include "trace.h" + +static const TypeInfo isa_superio_type_info = { + .name =TYPE_ISA_SUPERIO , + .parent =TYPE_ISA_DEVICE , + .abstract = true, + .class_size =sizeof (ISASuperIOClass), +}; + +static void isa_superio_register_types (void ) +{ +type_register_static (&isa_superio_type_info); +} + +type_init (isa_superio_register_types)
MAINTAINERS +2 -0
@@ -922,6 +922,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*
@@ -933,6 +934,7 @@ 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/isa/superio.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*
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.16.2
PATCH 9/25 hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO
In reply to Philippe Mathieu-Daudé--- include/hw/isa/pc87312.h | 6 ++++-- hw/isa/pc87312.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
include/hw/isa/pc87312.h +4 -2
@@ -25,14 +25,16 @@ #ifndef QEMU_PC87312_H #define QEMU_PC87312_H -#include "hw/isa/isa.h" +#include "hw/isa/superio.h" #define TYPE_PC87312_SUPERIO "pc87312" #define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERIO) typedef struct PC87312State { - ISADevice dev; + /*< private >*/ + ISASuperIODevice parent_dev; + /*< public >*/ uint16_t iobase; uint8_t config; /* initial configuration */
hw/isa/pc87312.c +10 -1
@@ -270,6 +270,7 @@ static void pc87312_realize(DeviceState *dev, Error **errp)ISABus *bus;Chardev *chr;DriveInfo *drive; +Error *local_err =NULL ;char name[5 ];int i;
@@ -279,6 +280,12 @@ static void pc87312_realize(DeviceState *dev, Error **errp)isa_register_ioport (isa, &s->io, s->iobase);pc87312_hard_reset (s); +ISA_SUPERIO_GET_CLASS (dev)->parent_realize (dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } +if (is_parallel_enabled (s)) {/* FIXME use a qdev chardev prop instead of parallel_hds[] */ chr = parallel_hds[0 ];
@@ -381,7 +388,9 @@ static Property pc87312_properties[] = {static void pc87312_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + sc->parent_realize = dc->realize; dc->realize = pc87312_realize; dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312;
@@ -392,7 +401,7 @@ static void pc87312_class_init(ObjectClass *klass, void *data)static const TypeInfo pc87312_type_info = { .name =TYPE_PC87312_SUPERIO , - .parent =TYPE_ISA_DEVICE , + .parent =TYPE_ISA_SUPERIO , .instance_size =sizeof (PC87312State), .instance_init = pc87312_initfn, .class_init = pc87312_class_init,
Signature · 1 line
2.16.2
PATCH 10/25 hw/isa/superio: Factor out the parallel code from pc87312.c
In reply to Philippe Mathieu-Daudé--- include/hw/isa/pc87312.h | 4 --- include/hw/isa/superio.h | 6 +++++ hw/isa/isa-superio.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 38 +++++++++++----------------- hw/isa/trace-events | 4 ++- 5 files changed, 89 insertions(+), 28 deletions(-)
include/hw/isa/pc87312.h +0 -4
@@ -39,10 +39,6 @@ typedef struct PC87312State {uint16_t iobase;uint8_t config;/* initial configuration */ -struct { -ISADevice *dev; - } parallel; -struct {ISADevice *dev; } uart[2 ];
include/hw/isa/superio.h +6 -0
@@ -23,7 +23,11 @@ OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)typedef struct ISASuperIODevice { +/*< private >*/ ISADevice parent_obj; +/*< public >*/ + +ISADevice *parallel[MAX_PARALLEL_PORTS ]; }ISASuperIODevice ; typedef struct ISASuperIOFuncs {
@@ -39,6 +43,8 @@ typedef struct ISASuperIOClass {ISADeviceClass parent_class;/*< public >*/ DeviceRealize parent_realize; + + ISASuperIOFuncs parallel; } ISASuperIOClass;#endif /* HW_ISA_SUPERIO_H */
hw/isa/isa-superio.c +65 -0
79 lines not on this page · raw message
hw/isa/pc87312.c +15 -23
@@ -64,22 +64,25 @@/* Parallel port */ -static inline bool is_parallel_enabled (PC87312State *s) +static bool is_parallel_enabled (ISASuperIODevice *sio,uint8_t index) { -return s->regs[REG_FER ] &FER_PARALLEL_EN ; +PC87312State *s =PC87312 (sio); +return index ? false : s->regs[REG_FER ] &FER_PARALLEL_EN ; }static const uint16_t parallel_base[] = {0x378 ,0x3bc ,0x278 ,0x00 }; -static inline uint16_t get_parallel_iobase (PC87312State *s) +static uint16_t get_parallel_iobase (ISASuperIODevice *sio,uint8_t index) { +PC87312State *s =PC87312 (sio);return parallel_base[s->regs[REG_FAR ] &FAR_PARALLEL_ADDR ]; }static const unsigned int parallel_irq[] = {5 ,7 ,5 ,0 }; -static inline unsigned int get_parallel_irq (PC87312State *s) +static unsigned int get_parallel_irq (ISASuperIODevice *sio,uint8_t index) { +PC87312State *s =PC87312 (sio);int idx; idx = (s->regs[REG_FAR ] &FAR_PARALLEL_ADDR );if (idx ==0 ) {
@@ -286,24 +289,6 @@ static void pc87312_realize(DeviceState *dev, Error **errp)return ; } -if (is_parallel_enabled (s)) { -/* FIXME use a qdev chardev prop instead of parallel_hds[] */ - chr = parallel_hds[0 ]; -if (chr ==NULL ) { - chr =qemu_chr_new ("par0" ,"null" ); - } - isa =isa_create (bus,"isa-parallel" ); - d =DEVICE (isa); -qdev_prop_set_uint32 (d,"index" ,0 ); -qdev_prop_set_uint32 (d,"iobase" ,get_parallel_iobase (s)); -qdev_prop_set_uint32 (d,"irq" ,get_parallel_irq (s)); -qdev_prop_set_chr (d,"chardev" , chr); -qdev_init_nofail (d); - s->parallel.dev = isa; -trace_pc87312_info_parallel (get_parallel_iobase (s), -get_parallel_irq (s)); - } -for (i =0 ; i <2 ; i++) {if (is_uart_enabled (s, i)) {/* FIXME use a qdev chardev prop instead of serial_hds[] */
@@ -395,8 +380,15 @@ static void pc87312_class_init(ObjectClass *klass, void *data) dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; dc->props = pc87312_properties; -/* Reason: Uses parallel_hds[0] in realize(), so it can't be used twice */ +/* Reason: Uses serial_hds[0] in realize(), so it can't be used twice */ dc->user_creatable = false; + + sc->parallel = (ISASuperIOFuncs ){ + .count =1 , + .is_enabled = is_parallel_enabled, + .get_iobase = get_parallel_iobase, + .get_irq = get_parallel_irq, + }; }static const TypeInfo pc87312_type_info = {
hw/isa/trace-events +3 -1
@@ -1,9 +1,11 @@ # See docs/devel/tracing.txt for syntax documentation. +# hw/isa/isa-superio.c +superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" + # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" -pc87312_info_parallel(uint32_t base, uint32_t irq) "base 0x%x, irq %u" pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=%d, base 0x%x, irq %u"
Signature · 1 line
2.16.2
PATCH 11/25 hw/isa/superio: Factor out the serial code from pc87312.c
In reply to Philippe Mathieu-Daudé--- include/hw/isa/pc87312.h | 4 ---- include/hw/isa/superio.h | 2 ++ hw/isa/isa-superio.c | 41 +++++++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 43 ++++++++++++------------------------------- hw/isa/trace-events | 2 +- 5 files changed, 56 insertions(+), 36 deletions(-)
include/hw/isa/pc87312.h +0 -4
@@ -39,10 +39,6 @@ typedef struct PC87312State {uint16_t iobase;uint8_t config;/* initial configuration */ -struct { -ISADevice *dev; - } uart[2 ]; -struct {ISADevice *dev; } fdc;
include/hw/isa/superio.h +2 -0
@@ -28,6 +28,7 @@ typedef struct ISASuperIODevice {/*< public >*/ ISADevice *parallel[MAX_PARALLEL_PORTS ]; +ISADevice *serial[MAX_SERIAL_PORTS ]; } ISASuperIODevice; typedef struct ISASuperIOFuncs {
@@ -45,6 +46,7 @@ typedef struct ISASuperIOClass {DeviceRealize parent_realize;ISASuperIOFuncs parallel; + ISASuperIOFuncs serial; } ISASuperIOClass;#endif /* HW_ISA_SUPERIO_H */
hw/isa/isa-superio.c +41 -0
53 lines not on this page · raw message
hw/isa/pc87312.c +12 -31
95 lines not on this page · raw message
hw/isa/trace-events +1 -1
@@ -2,10 +2,10 @@ # hw/isa/isa-superio.c superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" +superio_create_serial(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" -pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=%d, base 0x%x, irq %u"
Signature · 1 line
2.16.2
PATCH 12/25 hw/isa/superio: Factor out the floppy disc controller code from pc87312.c
In reply to Philippe Mathieu-Daudé--- include/hw/isa/pc87312.h | 4 ---- include/hw/isa/superio.h | 2 ++ hw/isa/isa-superio.c | 36 ++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 46 +++++++++++++++++++--------------------------- hw/isa/trace-events | 2 +- 5 files changed, 58 insertions(+), 32 deletions(-)
include/hw/isa/pc87312.h +0 -4
@@ -39,10 +39,6 @@ typedef struct PC87312State {uint16_t iobase;uint8_t config;/* initial configuration */ -struct { -ISADevice *dev; - } fdc; -struct {ISADevice *dev; } ide;
include/hw/isa/superio.h +2 -0
@@ -29,6 +29,7 @@ typedef struct ISASuperIODevice {ISADevice *parallel[MAX_PARALLEL_PORTS ];ISADevice *serial[MAX_SERIAL_PORTS ]; +ISADevice *floppy; } ISASuperIODevice; typedef struct ISASuperIOFuncs {
@@ -47,6 +48,7 @@ typedef struct ISASuperIOClass {ISASuperIOFuncs parallel;ISASuperIOFuncs serial; + ISASuperIOFuncs floppy; } ISASuperIOClass;#endif /* HW_ISA_SUPERIO_H */
hw/isa/isa-superio.c +36 -0
@@ -11,7 +11,10 @@*/ #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" +#include "sysemu/block-backend.h" +#include "sysemu/blockdev.h" #include "chardev/char.h" #include "hw/isa/superio.h" #include "hw/char/serial.h"
@@ -25,6 +28,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)ISADevice *isa;DeviceState *d;Chardev *chr; +DriveInfo *drive;char *name;int i;
@@ -107,6 +111,38 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)g_free (name); } } + +/* Floppy disc */ +if (!k->floppy.is_enabled || k->floppy.is_enabled (sio,0 )) { + isa =isa_create (bus,"isa-fdc" ); + d =DEVICE (isa); +if (k->floppy.get_iobase) { +qdev_prop_set_uint32 (d,"iobase" , k->floppy.get_iobase (sio,0 )); + } +if (k->floppy.get_irq) { +qdev_prop_set_uint32 (d,"irq" , k->floppy.get_irq (sio,0 )); + } +/* FIXME use a qdev drive property instead of drive_get() */ + drive =drive_get (IF_FLOPPY ,0 ,0 ); +if (drive !=NULL ) { +qdev_prop_set_drive (d,"driveA" ,blk_by_legacy_dinfo (drive), + &error_fatal); + } +/* FIXME use a qdev drive property instead of drive_get() */ + drive =drive_get (IF_FLOPPY ,0 ,1 ); +if (drive !=NULL ) { +qdev_prop_set_drive (d,"driveB" ,blk_by_legacy_dinfo (drive), + &error_fatal); + } +qdev_init_nofail (d); + sio->floppy = isa; +trace_superio_create_floppy (0 , + k->floppy.get_iobase ? + k->floppy.get_iobase (sio,0 ) :-1 , + k->floppy.get_irq ? + k->floppy.get_irq (sio,0 ) :-1 ); + } + }static void isa_superio_class_init (ObjectClass *oc,void *data)
hw/isa/pc87312.c +19 -27
90 lines not on this page · raw message
hw/isa/trace-events +1 -1
@@ -3,9 +3,9 @@ # hw/isa/isa-superio.c superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" superio_create_serial(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" +superio_create_floppy(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" -pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x"
Signature · 1 line
2.16.2
PATCH 13/25 hw/isa/superio: Add a keyboard/mouse controller (8042)
In reply to Philippe Mathieu-DaudéSince the PC87312 inherits this abstract model, we remove the I8042 instance in the PREP machine.
--- include/hw/isa/superio.h | 1 + hw/isa/isa-superio.c | 3 +++ hw/ppc/prep.c | 1 - 3 files changed, 4 insertions(+), 1 deletion(-)
include/hw/isa/superio.h +1 -0
@@ -30,6 +30,7 @@ typedef struct ISASuperIODevice {ISADevice *parallel[MAX_PARALLEL_PORTS ];ISADevice *serial[MAX_SERIAL_PORTS ];ISADevice *floppy; +ISADevice *kbc; } ISASuperIODevice; typedef struct ISASuperIOFuncs {
hw/isa/isa-superio.c +3 -0
@@ -17,6 +17,7 @@#include "sysemu/blockdev.h" #include "chardev/char.h" #include "hw/isa/superio.h" +#include "hw/input/i8042.h" #include "hw/char/serial.h" #include "trace.h"
@@ -143,6 +144,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) k->floppy.get_irq(sio, 0) : -1); } +/* Keyboard, mouse */ + sio->kbc =isa_create_simple (bus,TYPE_I8042 ); }static void isa_superio_class_init (ObjectClass *oc,void *data)
hw/ppc/prep.c +0 -1
@@ -642,7 +642,6 @@ static void ppc_prep_init(MachineState *machine) hd[2 * i], hd[2 * i + 1]); } -isa_create_simple (isa_bus,TYPE_I8042 ); cpu =POWERPC_CPU (first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];
Signature · 1 line
2.16.2
PATCH 14/25 hw/isa/superio: Factor out the IDE code from pc87312.c
In reply to Philippe Mathieu-Daudé--- include/hw/isa/superio.h | 2 ++ hw/isa/isa-superio.c | 22 ++++++++++++++++++++++ hw/isa/pc87312.c | 36 ++++++++++++++++++++---------------- hw/isa/trace-events | 2 +- 4 files changed, 45 insertions(+), 17 deletions(-)
include/hw/isa/superio.h +2 -0
@@ -31,6 +31,7 @@ typedef struct ISASuperIODevice {ISADevice *serial[MAX_SERIAL_PORTS ];ISADevice *floppy;ISADevice *kbc; +ISADevice *ide; } ISASuperIODevice; typedef struct ISASuperIOFuncs {
@@ -50,6 +51,7 @@ typedef struct ISASuperIOClass {ISASuperIOFuncs parallel;ISASuperIOFuncs serial;ISASuperIOFuncs floppy; + ISASuperIOFuncs ide; } ISASuperIOClass;#endif /* HW_ISA_SUPERIO_H */
hw/isa/isa-superio.c +22 -0
@@ -146,6 +146,28 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)/* Keyboard, mouse */ sio->kbc =isa_create_simple (bus,TYPE_I8042 ); + +/* IDE */ +if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled (sio,0 ))) { + isa =isa_create (bus,"isa-ide" ); + d =DEVICE (isa); +if (k->ide.get_iobase) { +qdev_prop_set_uint32 (d,"iobase" , k->ide.get_iobase (sio,0 )); + } +if (k->ide.get_iobase) { +qdev_prop_set_uint32 (d,"iobase2" , k->ide.get_iobase (sio,1 )); + } +if (k->ide.get_irq) { +qdev_prop_set_uint32 (d,"irq" , k->ide.get_irq (sio,0 )); + } +qdev_init_nofail (d); + sio->ide = isa; +trace_superio_create_ide (0 , + k->ide.get_iobase ? + k->ide.get_iobase (sio,0 ) :-1 , + k->ide.get_irq ? + k->ide.get_irq (sio,0 ) :-1 ); + } }static void isa_superio_class_init (ObjectClass *oc,void *data)
hw/isa/pc87312.c +20 -16
@@ -150,16 +150,28 @@ static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index)/* IDE controller */ -static inline bool is_ide_enabled (PC87312State *s) +static bool is_ide_enabled (ISASuperIODevice *sio,uint8_t index) { +PC87312State *s =PC87312 (sio); +return s->regs[REG_FER ] &FER_IDE_EN ; } -static inline uint16_t get_ide_iobase (PC87312State *s) +static uint16_t get_ide_iobase (ISASuperIODevice *sio,uint8_t index) { +PC87312State *s =PC87312 (sio); + +if (index ==1 ) { +return get_ide_iobase (sio,0 ) +0x206 ; + }return (s->regs[REG_FER ] &FER_IDE_ADDR ) ?0x170 :0x1f0 ; } +static unsigned int get_ide_irq (ISASuperIODevice *sio,uint8_t index) +{ +assert (index ==0 ); +return 14 ; +}static void reconfigure_devices (PC87312State *s) {
@@ -277,14 +289,11 @@ static void pc87312_reset(DeviceState *d)static void pc87312_realize (DeviceState *dev,Error **errp) {PC87312State *s; -DeviceState *d;ISADevice *isa; -ISABus *bus;Error *local_err =NULL ; s =PC87312 (dev); isa =ISA_DEVICE (dev); - bus =isa_bus_from_device (isa);isa_register_ioport (isa, &s->io, s->iobase);pc87312_hard_reset (s);
@@ -293,17 +302,6 @@ static void pc87312_realize(DeviceState *dev, Error **errp)error_propagate (errp, local_err);return ; } - -if (is_ide_enabled (s)) { - isa =isa_create (bus,"isa-ide" ); - d =DEVICE (isa); -qdev_prop_set_uint32 (d,"iobase" ,get_ide_iobase (s)); -qdev_prop_set_uint32 (d,"iobase2" ,get_ide_iobase (s) +0x206 ); -qdev_prop_set_uint32 (d,"irq" ,14 ); -qdev_init_nofail (d); - s->ide.dev = isa; -trace_pc87312_info_ide (get_ide_iobase (s)); - } }static void pc87312_initfn (Object *obj)
@@ -361,6 +359,12 @@ static void pc87312_class_init(ObjectClass *klass, void *data) .get_iobase = get_fdc_iobase, .get_irq = get_fdc_irq, }; + sc->ide = (ISASuperIOFuncs ){ + .count =1 , + .is_enabled = is_ide_enabled, + .get_iobase = get_ide_iobase, + .get_irq = get_ide_irq, + }; }static const TypeInfo pc87312_type_info = {
hw/isa/trace-events +1 -1
@@ -4,8 +4,8 @@ superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" superio_create_serial(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" superio_create_floppy(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" +superio_create_ide(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" -pc87312_info_ide(uint32_t base) "base 0x%x"
Signature · 1 line
2.16.2
PATCH 15/25 hw/mips/malta: Code movement
In reply to Philippe Mathieu-DaudéMove the SouthBridge peripherals first, and keep the Super I/O peripherals last.
--- hw/mips/mips_malta.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
hw/mips/mips_malta.c +7 -7
@@ -1062,10 +1062,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
@@ -1208,15 +1204,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.16.2
PATCH 16/25 hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c
In reply to Philippe Mathieu-Daudé--- include/hw/isa/superio.h | 2 ++ hw/isa/isa-superio.c | 19 +++++++++++++++++++ hw/mips/mips_malta.c | 35 ++++++++++------------------------- 3 files changed, 31 insertions(+), 25 deletions(-)
include/hw/isa/superio.h +2 -0
@@ -54,4 +54,6 @@ typedef struct ISASuperIOClass { ISASuperIOFuncs ide; } ISASuperIOClass; +#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" +#endif /* HW_ISA_SUPERIO_H */
hw/isa/isa-superio.c +19 -0
@@ -187,9 +187,28 @@ static const TypeInfo isa_superio_type_info = { .class_init = isa_superio_class_init, }; +/* SMS FDC37M817 Super I/O */ +static void fdc37m81x_class_init (ObjectClass *klass,void *data) +{ +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + + sc->serial.count =2 ;/* NS16C550A */ + sc->parallel.count =1 ; + sc->floppy.count =1 ;/* SMSC 82077AA Compatible */ + sc->ide.count =0 ; +} + +static const TypeInfo fdc37m81x_type_info = { + .name =TYPE_FDC37M81X_SUPERIO , + .parent =TYPE_ISA_SUPERIO , + .instance_size =sizeof (ISASuperIODevice), + .class_init = fdc37m81x_class_init, +}; +static void isa_superio_register_types (void ) {type_register_static (&isa_superio_type_info); +type_register_static (&fdc37m81x_type_info); }type_init (isa_superio_register_types)
hw/mips/mips_malta.c +10 -25
@@ -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"
@@ -1005,10 +1002,8 @@ void mips_malta_init(MachineState *machine)qemu_irq cbus_irq, i8259_irq;int piix4_devfn;I2CBus *smbus; -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;
@@ -1023,15 +1018,6 @@ void mips_malta_init(MachineState *machine)qdev_init_nofail (dev); -/* Make sure the first 3 serial ports are associated with a device. */ -for (i =0 ; i <3 ; i++) { -if (!serial_hds[i]) { -char label[32 ]; -snprintf (label,sizeof (label),"serial%d" , i); - serial_hds[i] =qemu_chr_new (label,"null" ); - } - } -/* create CPU */ mips_create_cpu (s, machine->cpu_type, &cbus_irq, &i8259_irq);
@@ -1067,7 +1053,14 @@ void mips_malta_init(MachineState *machine)#else be =0 ;#endif +/* FPGA */ + +/* Make sure the second serial port is associated with a device. */ +if (!serial_hds[2 ]) { + serial_hds[2 ] =qemu_chr_new ("fpga-uart" ,"null" ); + } +/* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 */ malta_fpga_init (system_memory,FPGA_ADDRESS , cbus_irq, serial_hds[2 ]);
@@ -1214,16 +1207,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); +/* Super I/O: SMS FDC37M817 */ +isa_create_simple (isa_bus,TYPE_FDC37M81X_SUPERIO );/* Network card */ network_init (pci_bus);
Signature · 1 line
2.16.2
PATCH 17/25 hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init()
In reply to Philippe Mathieu-Daudé--- hw/mips/mips_fulong2e.c | 83 ++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 42 deletions(-)
hw/mips/mips_fulong2e.c +41 -42
@@ -78,8 +78,6 @@#define FULONG2E_ATI_SLOT 6#define FULONG2E_RTL8139_SLOT 7 -static ISADevice *pit; - static struct _loaderparams { int ram_size; const char *kernel_filename;
@@ -232,11 +230,44 @@ static const uint8_t eeprom_spd[0x80] = {0x20 ,0x30 ,0x20 }; -/* Audio support */ -static void audio_init (PCIBus *pci_bus) +static void vt82c686b_southbridge_init (PCIBus *pci_bus,int slot,qemu_irq intc, +I2CBus **i2c_bus,ISABus **p_isa_bus) { -vt82c686b_ac97_init (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,5 )); -vt82c686b_mc97_init (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,6 )); +qemu_irq *i8259; +ISABus *isa_bus; +DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ]; + + isa_bus =vt82c686b_init (pci_bus,PCI_DEVFN (slot,0 )); +if (!isa_bus) { +fprintf (stderr,"vt82c686b_init error\n" ); +exit (1 ); + } + *p_isa_bus = isa_bus; +/* Interrupt controller */ +/* The 8259 -> IP5 */ + i8259 =i8259_init (isa_bus, intc); +isa_bus_irqs (isa_bus, i8259); +/* init other devices */ +i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); +i8257_dma_init (isa_bus,0 ); + +ide_drive_get (hd,ARRAY_SIZE (hd)); +vt82c686b_ide_init (pci_bus, hd,PCI_DEVFN (slot,1 )); + +pci_create_simple (pci_bus,PCI_DEVFN (slot,2 ),"vt82c686b-usb-uhci" ); +pci_create_simple (pci_bus,PCI_DEVFN (slot,3 ),"vt82c686b-usb-uhci" ); + + *i2c_bus =vt82c686b_pm_init (pci_bus,PCI_DEVFN (slot,4 ),0xeee1 ,NULL ); + +/* Audio support */ +vt82c686b_ac97_init (pci_bus,PCI_DEVFN (slot,5 )); +vt82c686b_mc97_init (pci_bus,PCI_DEVFN (slot,6 )); + +/* Super I/O */ +isa_create_simple (isa_bus,TYPE_I8042 ); + +serial_hds_isa_init (isa_bus,0 ,MAX_SERIAL_PORTS ); +parallel_hds_isa_init (isa_bus,1 ); }/* Network support */
@@ -269,11 +300,9 @@ static void mips_fulong2e_init(MachineState *machine)MemoryRegion *bios =g_new (MemoryRegion,1 );long bios_size;int64_t kernel_entry; -qemu_irq *i8259;PCIBus *pci_bus;ISABus *isa_bus;I2CBus *smbus; -DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];MIPSCPU *cpu;CPUMIPSState *env;
@@ -335,46 +364,16 @@ static void mips_fulong2e_init(MachineState *machine)/* North bridge, Bonito --> IP2 */ pci_bus =bonito_init ((qemu_irq *)&(env->irq[2 ])); -/* South bridge */ -ide_drive_get (hd,ARRAY_SIZE (hd)); - - isa_bus =vt82c686b_init (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,0 )); -if (!isa_bus) { -error_report ("vt82c686b_init error" ); -exit (1 ); - } - -/* Interrupt controller */ -/* The 8259 -> IP5 */ - i8259 =i8259_init (isa_bus, env->irq[5 ]); -isa_bus_irqs (isa_bus, i8259); - -vt82c686b_ide_init (pci_bus, hd,PCI_DEVFN (FULONG2E_VIA_SLOT ,1 )); -pci_create_simple (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,2 ), -"vt82c686b-usb-uhci" ); -pci_create_simple (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,3 ), -"vt82c686b-usb-uhci" ); +/* South bridge -> IP5 */ +vt82c686b_southbridge_init (pci_bus,FULONG2E_VIA_SLOT , env->irq[5 ], + &smbus, &isa_bus); - smbus =vt82c686b_pm_init (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,4 ), -0xeee1 ,NULL );/* TODO: Populate SPD eeprom data. */ smbus_eeprom_init (smbus,1 , eeprom_spd,sizeof (eeprom_spd)); -/* init other devices */ - pit =i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); -i8257_dma_init (isa_bus,0 ); - -/* Super I/O */ -isa_create_simple (isa_bus,TYPE_I8042 ); -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 */ +/* Network card: RTL8139D */ network_init (pci_bus); }
Signature · 1 line
2.16.2
PATCH 18/25 hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init()
In reply to Philippe Mathieu-DaudéThis function only initialize the ISA bus.
--- include/hw/isa/vt82c686.h | 2 +- hw/isa/vt82c686.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
include/hw/isa/vt82c686.h +1 -1
@@ -2,7 +2,7 @@#define HW_VT82C686_H /* vt82c686.c */ -ISABus *vt82c686b_init (PCIBus * bus,int devfn); +ISABus *vt82c686b_isa_init (PCIBus * bus,int devfn);void vt82c686b_ac97_init (PCIBus *bus,int devfn);void vt82c686b_mc97_init (PCIBus *bus,int devfn); I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
hw/isa/vt82c686.c +1 -1
@@ -478,7 +478,7 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp)qemu_register_reset (vt82c686b_reset, d); } -ISABus *vt82c686b_init (PCIBus *bus,int devfn) +ISABus *vt82c686b_isa_init (PCIBus *bus,int devfn) {PCIDevice *d;
hw/mips/mips_fulong2e.c +1 -1
@@ -237,7 +237,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc,ISABus *isa_bus;DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ]; - isa_bus =vt82c686b_init (pci_bus,PCI_DEVFN (slot,0 )); + isa_bus =vt82c686b_isa_init (pci_bus,PCI_DEVFN (slot,0 ));if (!isa_bus) {fprintf (stderr,"vt82c686b_init error\n" );exit (1 );
Signature · 1 line
2.16.2
PATCH 19/25 hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO
In reply to Philippe Mathieu-Daudé--- include/hw/isa/vt82c686.h | 2 ++ hw/isa/vt82c686.c | 20 ++++++++++++++++++++ hw/mips/mips_fulong2e.c | 15 +++------------ 3 files changed, 25 insertions(+), 12 deletions(-)
include/hw/isa/vt82c686.h +2 -0
@@ -1,6 +1,8 @@#ifndef HW_VT82C686_H #define HW_VT82C686_H +#define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" +/* vt82c686.c */ ISABus *vt82c686b_isa_init (PCIBus * bus,int devfn);void vt82c686b_ac97_init (PCIBus *bus,int devfn);
hw/isa/vt82c686.c +20 -0
@@ -17,6 +17,7 @@#include "hw/i2c/smbus.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" +#include "hw/isa/superio.h" #include "hw/sysbus.h" #include "hw/mips/mips.h" #include "hw/isa/apm.h"
@@ -519,11 +520,30 @@ static const TypeInfo via_info = { }, }; +static void vt82c686b_superio_class_init (ObjectClass *klass,void *data) +{ +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + + sc->serial.count =2 ; + sc->parallel.count =1 ; + sc->ide.count =0 ; + sc->floppy.count =1 ; +} + +static const TypeInfo via_superio_info = { + .name =TYPE_VT82C686B_SUPERIO , + .parent =TYPE_ISA_SUPERIO , + .instance_size =sizeof (ISASuperIODevice), + .class_size =sizeof (ISASuperIOClass), + .class_init = vt82c686b_superio_class_init, +}; +static void vt82c686b_register_types (void ) {type_register_static (&via_ac97_info);type_register_static (&via_mc97_info);type_register_static (&via_pm_info); +type_register_static (&via_superio_info);type_register_static (&via_info); }
hw/mips/mips_fulong2e.c +3 -12
@@ -23,9 +23,7 @@#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"
@@ -34,7 +32,6 @@#include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" -#include "sysemu/sysemu.h" #include "audio/audio.h" #include "qemu/log.h" #include "hw/loader.h"
@@ -44,8 +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" #include "qemu/error-report.h"
@@ -250,6 +245,8 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc,/* init other devices */ i8254_pit_init (isa_bus,0x40 ,0 ,NULL );i8257_dma_init (isa_bus,0 ); +/* Super I/O */ +isa_create_simple (isa_bus,TYPE_VT82C686B_SUPERIO );ide_drive_get (hd,ARRAY_SIZE (hd));vt82c686b_ide_init (pci_bus, hd,PCI_DEVFN (slot,1 ));
@@ -262,12 +259,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc,/* Audio support */ vt82c686b_ac97_init (pci_bus,PCI_DEVFN (slot,5 ));vt82c686b_mc97_init (pci_bus,PCI_DEVFN (slot,6 )); - -/* Super I/O */ -isa_create_simple (isa_bus,TYPE_I8042 ); - -serial_hds_isa_init (isa_bus,0 ,MAX_SERIAL_PORTS ); -parallel_hds_isa_init (isa_bus,1 ); }/* Network support */
Signature · 1 line
2.16.2
PATCH 20/25 MAINTAINERS: Add entries for the VT82C686B Super I/O
In reply to Philippe Mathieu-DaudéSo far, it is only used by the MIPS Fulong 2E mini PC.
--- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
@@ -689,6 +689,8 @@ Fulong 2E M: Yongbok Kim <[email protected]> S: Odd Fixes F: hw/mips/mips_fulong2e.c +F: hw/isa/vt82c686.c +F: include/hw/isa/vt82c686.h Boston M: Paul Burton <[email protected]>
Signature · 1 line
2.16.2
PATCH 21/25 MAINTAINERS: Split the Alpha TCG/machine section
In reply to Philippe Mathieu-Daudé--- MAINTAINERS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
MAINTAINERS +5 -1
@@ -127,7 +127,6 @@ Alpha M: Richard Henderson <[email protected]> S: Maintained F: target/alpha/ -F: hw/alpha/ F: tests/tcg/alpha/ F: disas/alpha.c
@@ -402,6 +401,11 @@ F: include/*/*win32* X: qga/*win32* F: qemu.nsi +Alpha Machines +M: Richard Henderson <[email protected]> +S: Maintained +F: hw/alpha/ + ARM Machines ------------ Allwinner-a10
Signature · 1 line
2.16.2
PATCH 22/25 hw/isa/superio: Add the SMC FDC37C669 Super I/O
In reply to Philippe Mathieu-Daudé---
Richard: I added the smc37c669 device in the Alpha machine, since it is the only user, as Michael previously suggested the non-PC devices should not be in the "PC chipset" entry which is already big (that's why some devices got moved from there to MIPS and PPC).
include/hw/isa/superio.h | 1 + hw/isa/smc37c669-superio.c | 115 +++++++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + hw/isa/Makefile.objs | 2 +- 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 hw/isa/smc37c669-superio.c
include/hw/isa/superio.h +1 -0
@@ -55,5 +55,6 @@ typedef struct ISASuperIOClass { } ISASuperIOClass;#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" +#define TYPE_SMC37C669_SUPERIO "smc37c669-superio"#endif /* HW_ISA_SUPERIO_H */
hw/isa/smc37c669-superio.c new file +115 -0
115 lines not on this page · raw message
MAINTAINERS +1 -0
@@ -405,6 +405,7 @@ Alpha Machines M: Richard Henderson <[email protected]> S: Maintained F: hw/alpha/ +F: hw/isa/smc37c669-superio.c ARM Machines ------------
hw/isa/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ common-obj-$(CONFIG_ISA_BUS) += isa-bus.o -common-obj-$(CONFIG_ISA_BUS) += isa-superio.o +common-obj-$(CONFIG_ISA_BUS) += isa-superio.o smc37c669-superio.o common-obj-$(CONFIG_APM) += apm.o common-obj-$(CONFIG_I82378) += i82378.o common-obj-$(CONFIG_PC87312) += pc87312.o
Signature · 1 line
2.16.2
PATCH 23/25 hw/alpha/dp264: Add the ISA DMA controller
In reply to Philippe Mathieu-Daudé--- default-configs/alpha-softmmu.mak | 2 ++ hw/alpha/dp264.c | 4 ++++ 2 files changed, 6 insertions(+)
default-configs/alpha-softmmu.mak +2 -0
@@ -4,7 +4,9 @@ include pci.mak include usb.mak CONFIG_SERIAL=y CONFIG_SERIAL_ISA=y +CONFIG_I82374=y CONFIG_I8254=y +CONFIG_I8257=y CONFIG_PCKBD=y CONFIG_VGA_CIRRUS=y CONFIG_IDE_CORE=y
hw/alpha/dp264.c +4 -0
@@ -21,6 +21,7 @@#include "hw/timer/i8254.h" #include "hw/input/i8042.h" #include "hw/char/serial.h" +#include "hw/dma/i8257.h" #include "qemu/cutils.h" #define MAX_IDE_BUS 2
@@ -95,6 +96,9 @@ static void clipper_init(MachineState *machine)pci_nic_init_nofail (&nd_table[i], pci_bus,"e1000" ,NULL ); } +/* 2 82C37 (dma) */ +isa_create_simple (isa_bus,"i82374" ); +/* IDE disk setup. */ {DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];
Signature · 1 line
2.16.2
PATCH 24/25 hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO
In reply to Philippe Mathieu-Daudé--- default-configs/alpha-softmmu.mak | 3 +++ hw/alpha/dp264.c | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-)
default-configs/alpha-softmmu.mak +3 -0
@@ -7,6 +7,9 @@ CONFIG_SERIAL_ISA=y CONFIG_I82374=y CONFIG_I8254=y CONFIG_I8257=y +CONFIG_PARALLEL=y +CONFIG_PARALLEL_ISA=y +CONFIG_FDC=y CONFIG_PCKBD=y CONFIG_VGA_CIRRUS=y CONFIG_IDE_CORE=y
hw/alpha/dp264.c +4 -6
@@ -19,8 +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 "hw/isa/superio.h" #include "hw/dma/i8257.h" #include "qemu/cutils.h"
@@ -83,14 +82,10 @@ 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,TYPE_I8042 );/* VGA setup. Don't bother loading the bios. */ pci_vga_init (pci_bus); -/* Serial code setup. */ -serial_hds_isa_init (isa_bus,0 ,MAX_SERIAL_PORTS ); -/* Network setup. e1000 is good enough, failing Tulip support. */ for (i =0 ; i < nb_nics; i++) {pci_nic_init_nofail (&nd_table[i], pci_bus,"e1000" ,NULL );
@@ -99,6 +94,9 @@ static void clipper_init(MachineState *machine)/* 2 82C37 (dma) */ isa_create_simple (isa_bus,"i82374" ); +/* Super I/O */ +isa_create_simple (isa_bus,TYPE_SMC37C669_SUPERIO ); +/* IDE disk setup. */ {DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];
Signature · 1 line
2.16.2
PATCH 25/25 hw/i386/pc: Factor out the superio code
In reply to Philippe Mathieu-Daudé--- hw/i386/pc.c | 72 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 31 deletions(-)
hw/i386/pc.c +41 -31
@@ -1519,6 +1519,44 @@ static const MemoryRegionOps ioportF0_io_ops = { }, }; +static void pc_superio_init (ISABus *isa_bus,bool create_fdctrl,bool no_vmport) +{ +int i; +DriveInfo *fd[MAX_FD ]; +qemu_irq *a20_line; +ISADevice *i8042, *port92, *vmmouse; + +serial_hds_isa_init (isa_bus,0 ,MAX_SERIAL_PORTS ); +parallel_hds_isa_init (isa_bus,MAX_PARALLEL_PORTS ); + +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); + } + + i8042 =isa_create_simple (isa_bus,"i8042" ); +if (!no_vmport) { +vmport_init (isa_bus); + vmmouse =isa_try_create (isa_bus,"vmmouse" ); + }else { + vmmouse =NULL ; + } +if (vmmouse) { +DeviceState *dev =DEVICE (vmmouse); +qdev_prop_set_ptr (dev,"ps2_mouse" , i8042); +qdev_init_nofail (dev); + } + port92 =isa_create_simple (isa_bus,"port92" ); + + a20_line =qemu_allocate_irqs (handle_a20_line_change, first_cpu,2 ); +i8042_setup_a20_line (i8042, a20_line[0 ]); +port92_init (port92, a20_line[1 ]); +g_free (a20_line); +} + void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, bool create_fdctrl,
@@ -1527,13 +1565,11 @@ 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 ;qemu_irq rtc_irq =NULL ; -qemu_irq *a20_line; -ISADevice *i8042, *port92, *vmmouse, *pit =NULL ; +ISADevice *pit =NULL ;MemoryRegion *ioport80_io =g_new (MemoryRegion,1 );MemoryRegion *ioportF0_io =g_new (MemoryRegion,1 );
@@ -1590,36 +1626,10 @@ 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_setup_a20_line (i8042, a20_line[0 ]); -if (!no_vmport) { -vmport_init (isa_bus); - vmmouse =isa_try_create (isa_bus,"vmmouse" ); - }else { - vmmouse =NULL ; - } -if (vmmouse) { -DeviceState *dev =DEVICE (vmmouse); -qdev_prop_set_ptr (dev,"ps2_mouse" , i8042); -qdev_init_nofail (dev); - } - port92 =isa_create_simple (isa_bus,"port92" ); -port92_init (port92, a20_line[1 ]); -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); - } +/* Super I/O */ +pc_superio_init (isa_bus, create_fdctrl, no_vmport); }void pc_nic_init (ISABus *isa_bus,PCIBus *pci_bus)
Signature · 1 line
2.16.2
Re: [Qemu-devel] [PATCH 01/25] hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c
In reply to Philippe Mathieu-DaudéQuoted 244 lines · Philippe Mathieu-Daudé
Again... (after
07dc788054d7and9157eee1b1c0).We now extract the ISA bus specific helpers.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/char/parallel.h | 14 ++++++++++++++ include/hw/i386/pc.h | 8 -------- hw/char/parallel-isa.c | 36 ++++++++++++++++++++++++++++++++++++ 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, 59 insertions(+), 36 deletions(-)create mode 100644
include/hw/char/parallel.h
create mode 100644hw/char/parallel-isa.cinclude/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 +36
-0@@ -0,0 +1,36 @@ +/* +* QEMU Parallel PORT (ISA bus helpers) +* +* Copyright (c) 2003 Fabrice Bellard +* +* SPDX-License-Identifier: MIT +*/ +#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@@ -26,6 +26,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@@ -24,7 +24,6 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" static ISABus *isabus;@@ -288,28 +287,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@@ -34,6 +34,7 @@#include "hw/pci-host/sabre.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@@ -913,7 +913,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@@ -928,6 +928,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.hhw/char/Makefile.objs +0
-0
hw/char/Makefile.objs line 7
Quoted 7 lines
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
For sun4u:
ATB,
Mark.
Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()
In reply to Philippe Mathieu-DaudéQuoted 219 lines · Philippe Mathieu-Daudé
- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for thehigh_page_enableargumentSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- 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,bool 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)), true);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, bool high_page_enable) {ISADevice *isa1, *isa2;DeviceState *d;hw/i386/pc.c +2
-1@@ -41,6 +41,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" @@ -1609,7 +1610,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" @@ -360,7 +361,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" @@ -220,7 +221,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" @@ -1209,7 +1210,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@@ -90,10 +90,6 @@ typedef struct EbusState {#define TYPE_EBUS "ebus"#define EBUS (obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) -void DMA_init (ISABus *bus,int high_page_enable) -{ -} -static void fw_cfg_boot_set (void *opaque,const char *boot_device,Error **errp) {MAINTAINERS +0
-0
MAINTAINERS F: hw/timer/mc146818rtc* · line 936
Quoted 9 lines
MAINTAINERS +1
-1@@ -929,8 +929,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*
Presumably these DMA_init() functions have been unused on sun4u/sun4m for a while which is why they are being removed? Might be worth a mention of this in the commit message.
ATB,
Mark.
Re: [Qemu-devel] [PATCH 03/25] hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h
In reply to Philippe Mathieu-DaudéQuoted 283 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/i386/pc.h | 9 --------- include/hw/input/i8042.h | 24 ++++++++++++++++++++++++ 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 | 1 + hw/unicore32/puv3.c | 1 + MAINTAINERS | 1 + 15 files changed, 43 insertions(+), 16 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 +24
-0@@ -0,0 +1,24 @@ +/* +* QEMU PS/2 Controller +* +* Copyright (c) 2003 Fabrice Bellard +* +* SPDX-License-Identifier: MIT +*/ +#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@@ -43,6 +43,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" @@ -364,7 +365,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" @@ -1213,7 +1214,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" @@ -286,7 +287,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 +1
-0@@ -36,6 +36,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" 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 +0
-0
MAINTAINERS F: include/hw/display/vga.h · line 937
Quoted 7 lines
MAINTAINERS +1
-0@@ -931,6 +931,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*
ATB,
Mark.
Re: [Qemu-devel] [PATCH 05/25] hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO
In reply to Philippe Mathieu-DaudéQuoted 42 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/isa/pc87312.h | 4 ++-- hw/isa/pc87312.c | 2 +- hw/ppc/prep.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)include/hw/isa/pc87312.h +2
-2@@ -28,8 +28,8 @@#include "hw/isa/isa.h" -#define TYPE_PC87312 "pc87312" -#define PC87312 (obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312) +#define TYPE_PC87312_SUPERIO "pc87312" +#define PC87312 (obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERIO) typedef struct PC87312State { ISADevice dev;hw/isa/pc87312.c +1
-1@@ -391,7 +391,7 @@ static void pc87312_class_init(ObjectClass *klass, void *data) }static const TypeInfo pc87312_type_info = { - .name =TYPE_PC87312 , + .name =TYPE_PC87312_SUPERIO , .parent =TYPE_ISA_DEVICE , .instance_size =sizeof (PC87312State), .instance_init = pc87312_initfn,hw/ppc/prep.c +0
-0
hw/ppc/prep.c static void ppc_prep_init(MachineState *machine) · line 619
Quoted 8 lines
hw/ppc/prep.c +1
-1@@ -613,7 +613,7 @@ static void ppc_prep_init(MachineState *machine) isa_bus =ISA_BUS (qdev_get_child_bus (DEVICE (pci),"isa.0" ));/* Super I/O (parallel + serial ports) */ - isa =isa_create (isa_bus,TYPE_PC87312 ); + isa =isa_create (isa_bus,TYPE_PC87312_SUPERIO ); dev =DEVICE (isa);qdev_prop_set_uint8 (dev,"config" ,13 );/* fdc, ser0, ser1, par0 */ qdev_init_nofail (dev);
ATB,
Mark.
Re: [Qemu-devel] [PATCH 07/25] hw/isa/pc87312: Use 'unsigned int' for the irq value
In reply to Philippe Mathieu-DaudéQuoted 23 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/isa/pc87312.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)hw/isa/pc87312.c +2
-2@@ -76,9 +76,9 @@ static inline uint16_t get_parallel_iobase(PC87312State *s)return parallel_base[s->regs[REG_FAR ] &FAR_PARALLEL_ADDR ]; } -static const uint32_t parallel_irq[] = {5 ,7 ,5 ,0 }; +static const unsigned int parallel_irq[] = {5 ,7 ,5 ,0 }; -static inline uint32_t get_parallel_irq (PC87312State *s) +static inline unsigned int get_parallel_irq (PC87312State *s) {int idx; idx = (s->regs[REG_FAR ] &FAR_PARALLEL_ADDR );
hw/isa/pc87312.c static inline uint16_t get_uart_iobase(PC87312State *s, int i) · line 116
Quoted 8 lines
hw/isa/pc87312.c +1
-1@@ -110,7 +110,7 @@ static inline uint16_t get_uart_iobase(PC87312State *s, int i) } } -static inline uint32_t get_uart_irq (PC87312State *s,int i) +static inline unsigned int get_uart_irq (PC87312State *s,int i) {int idx; idx = (s->regs[REG_FAR ] >> (2 * i +2 )) &0x3 ;
ATB,
Mark.
Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()
In reply to Mark Cave-AylandHi Mark,
Quoted 211 lines · Mark Cave-Ayland
Quoted 209 lines · Philippe Mathieu-Daudé
- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for thehigh_page_enableargumentSigned-off-by Philippe Mathieu-Daudé <[email protected]>---
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 +0
-0@@ -1,6 +1,10 @@ #ifndef HW_I8257_H #define HW_I8257_H+#include "
hw/hw.h"include/hw/dma/i8257.h renamed from include/hw/isa/i8257.h +3
-0+#include "hw/isa/isa.h" +#include "exec/ioport.h" +#define
TYPE_I8257"i8257"
typedef struct I8257Regs {include/hw/dma/i8257.h renamed from include/hw/isa/i8257.h +1
-0@@ -40,4 +44,6 @@ typedef struct I8257State { PortioList portio_pageh; } I8257State; +void i8257_dma_init(ISABus *bus, bool high_page_enable); + #endifinclude/hw/isa/isa.h +0
-0@@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d) return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); }-/*
i8257.c*/
-voidDMA_init(ISABus *bus, int high_page_enable); #endifhw/dma/i82374.c +2
-0@@ -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)), true); memset(s->commands, 0, sizeof(s->commands));}
diff --gita/hw/dma/i8257.cb/hw/dma/i8257.c
indexbd23e893bf..52675e97c9100644hw/dma/i8257.c +1
-1@@ -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)
-voidDMA_init(ISABus *bus, int high_page_enable)+voidi8257_dma_init(ISABus *bus, bool high_page_enable){
ISADevice *isa1, *isa2;
DeviceState *d;hw/i386/pc.c +2
-0@@ -41,6 +41,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"@@ -1609,7 +1610,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"@@ -360,7 +361,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"@@ -220,7 +221,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);diff --git
a/hw/mips/mips_malta.cb/hw/mips/mips_malta.cindexc74882c7e9..9cb86c432e100644hw/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"@@ -1209,7 +1210,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
-3@@ -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
-3@@ -90,10 +90,6 @@ typedef struct EbusState { #define TYPE_EBUS "ebus" #define EBUS(obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) -void DMA_init(ISABus *bus, int high_page_enable) -{ -} - static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) {MAINTAINERS +0
-0@@ -929,8 +929,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
Quoted 8 lines
Quoted 4 lines
F:
include/hw/timer/hpet.h
F:include/hw/timer/i8254*
F:include/hw/timer/mc146818rtc*Presumably these
DMA_init()functions have been unused on sun4u/sun4m for a while which is why they are being removed? Might be worth a mention of this in the commit message.
Apparently (from git log) once the Sparc machine was copied from the PC machine (~ 6f7e9aec5), using an empty stub, and finally got cleaned in ba0a71022 but this function was missed. So this function has never been implemented.
I'll add a comment if I need to respin, or gently add the maintainer to update the commit message if this series is accepted :)
Thanks!
Phil.
Quoted 6 lines
ATB,
Mark.
Mark Cave-Ayland
Reviewed-byRe: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()
Quoted 228 lines · Philippe Mathieu-Daudé
Hi Mark,
Quoted 211 lines · Mark Cave-Ayland
Quoted 209 lines · Philippe Mathieu-Daudé
- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for thehigh_page_enableargumentSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- 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 +4
-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, bool high_page_enable); + #endifinclude/hw/isa/isa.h +0
-1@@ -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); #endifhw/dma/i82374.c +2
-0@@ -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)), true); memset(s->commands, 0, sizeof(s->commands)); } diff --git a/hw/dma/i8257.c b/hw/dma/i8257.cindex
bd23e893bf..52675e97c9100644hw/dma/i8257.c +1
-1@@ -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)
-voidDMA_init(ISABus *bus, int high_page_enable)hw/dma/i8257.c +1
-0+void i8257_dma_init (ISABus *bus,bool high_page_enable) { ISADevice *isa1, *isa2; DeviceState *d;hw/i386/pc.c +2
-0@@ -41,6 +41,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"@@ -1609,7 +1610,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"@@ -360,7 +361,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"@@ -220,7 +221,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); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.cindex
c74882c7e9..9cb86c432e100644hw/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"@@ -1209,7 +1210,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
-3@@ -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
-3@@ -90,10 +90,6 @@ typedef struct EbusState { #define TYPE_EBUS "ebus" #define EBUS(obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) -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@@ -929,8 +929,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.hQuoted 8 lines
MAINTAINERS F: hw/timer/mc146818rtc* · line 936
Quoted 4 lines
MAINTAINERS +0
-0F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*Presumably these
DMA_init()functions have been unused on sun4u/sun4m for a while which is why they are being removed? Might be worth a mention of this in the commit message.Apparently (from git log) once the Sparc machine was copied from the PC machine (~
6f7e9aec5), using an empty stub, and finally got cleaned inba0a71022but this function was missed. So this function has never been implemented.
Quoted 6 lines
I'll add a comment if I need to respin, or gently add the maintainer to update the commit message if this series is accepted :)
Thanks!
Phil.
Got it. In that case for sun4/sun4u:
ATB,
Mark.
Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()
Quoted 236 lines · Mark Cave-Ayland
Quoted 235 lines · Philippe Mathieu-Daudé
Hi Mark,
Quoted 213 lines · Mark Cave-Ayland
Quoted 210 lines · Philippe Mathieu-Daudé
- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for thehigh_page_enableargumentSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- 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 +4
-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, bool high_page_enable); +#endif include/hw/isa/isa.h +0
-1@@ -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
-0@@ -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)), true);memset (s->commands,0 ,sizeof (s->commands)); } diff --git a/hw/dma/i8257.c b/hw/dma/i8257.cindex
bd23e893bf..52675e97c9100644hw/dma/i8257.c +1
-1@@ -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)hw/dma/i8257.c +1
-0+void i8257_dma_init (ISABus *bus,bool high_page_enable) {ISADevice *isa1, *isa2;DeviceState *d;hw/i386/pc.c +2
-0@@ -41,6 +41,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" @@ -1609,7 +1610,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" @@ -360,7 +361,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" @@ -220,7 +221,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); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.cindex
c74882c7e9..9cb86c432e100644hw/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" @@ -1209,7 +1210,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
-3@@ -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
-3@@ -90,10 +90,6 @@ typedef struct EbusState {#define TYPE_EBUS "ebus"#define EBUS (obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) -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@@ -929,8 +929,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.hQuoted 8 lines
MAINTAINERS F: hw/timer/mc146818rtc* · line 936
Quoted 4 lines
MAINTAINERS +0
-0F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*Presumably these
DMA_init()functions have been unused on sun4u/sun4m for a while which is why they are being removed? Might be worth a mention of this in the commit message.Apparently (from git log) once the Sparc machine was copied from the PC machine (~
6f7e9aec5), using an empty stub, and finally got cleaned inba0a71022but this function was missed. So this function has never been implemented.I'll add a comment if I need to respin, or gently add the maintainer to update the commit message if this series is accepted :)
Quoted 8 lines
Quoted 3 lines
Thanks!
Phil.
Got it. In that case for sun4/sun4u:
Reviewed-by Mark Cave-Ayland <[email protected]>
Out of curiosity, isn't ISA-DMA used by FDthree on Ultra-5/Ultra-10 machines?
Signature · 4 lines
Regards, Artyom Tarasenko SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()
Quoted 243 lines · Artyom Tarasenko
Quoted 241 lines · Mark Cave-Ayland
Quoted 238 lines · Philippe Mathieu-Daudé
Hi Mark,
Quoted 213 lines · Mark Cave-Ayland
Quoted 210 lines · Philippe Mathieu-Daudé
- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for thehigh_page_enableargumentSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- 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 +4
-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, bool high_page_enable); +#endif include/hw/isa/isa.h +0
-1@@ -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
-0@@ -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)), true);memset (s->commands,0 ,sizeof (s->commands)); } diff --git a/hw/dma/i8257.c b/hw/dma/i8257.cindex
bd23e893bf..52675e97c9100644hw/dma/i8257.c +1
-1@@ -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)
-voidDMA_init(ISABus *bus, int high_page_enable)hw/dma/i8257.c +1
-0+void i8257_dma_init (ISABus *bus,bool high_page_enable) {ISADevice *isa1, *isa2;DeviceState *d;hw/i386/pc.c +2
-0@@ -41,6 +41,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" @@ -1609,7 +1610,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" @@ -360,7 +361,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" @@ -220,7 +221,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); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.cindex
c74882c7e9..9cb86c432e100644hw/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" @@ -1209,7 +1210,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
-3@@ -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
-3@@ -90,10 +90,6 @@ typedef struct EbusState {#define TYPE_EBUS "ebus"#define EBUS (obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) -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@@ -929,8 +929,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.hQuoted 8 lines
MAINTAINERS F: hw/timer/mc146818rtc* · line 936
Quoted 4 lines
MAINTAINERS +0
-0F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc*Presumably these
DMA_init()functions have been unused on sun4u/sun4m for a while which is why they are being removed? Might be worth a mention of this in the commit message.Apparently (from git log) once the Sparc machine was copied from the PC machine (~
6f7e9aec5), using an empty stub, and finally got cleaned inba0a71022but this function was missed. So this function has never been implemented.I'll add a comment if I need to respin, or gently add the maintainer to update the commit message if this series is accepted :)
Thanks!
Phil.
Quoted 6 lines
Quoted 3 lines
Got it. In that case for sun4/sun4u:
Reviewed-by Mark Cave-Ayland <[email protected]>Out of curiosity, isn't ISA-DMA used by FDthree on Ultra-5/Ultra-10 machines?
Possibly - it's something I really test on a regular basis though. I believe Hervé switched the DMA interface over to use the new API on a previous patchset, so the function itself is obsolete regardless.
ATB,
Mark.