Pegasos2 emulation
v6 cover Pegasos2 emulation
Hello,
This is adding a new PPC board called pegasos2. More info on it can be found at:
https://osdn.net/projects/qmiga/wiki/SubprojectPegasos2
Currently it needs a firmware ROM image that I cannot include due to original copyright holder (bPlan) did not release it under a free licence but I have plans to write a replacement in the future. With the original board firmware it can boot MorphOS now as:
qemu-system-ppc -M pegasos2 -cdrom morphos.iso -device ati-vga,romfile="" -serial stdio
then enter "boot cd boot.img" at the firmware "ok" prompt as described in the MorphOS.readme. To boot Linux use same command line with e.g. -cdrom debian-8.11.0-powerpc-netinst.iso then enter
"boot cd install/pegasos"
The last patch adds the actual board code after previous patches adding VT8231 and MV64361 system controller chip emulation.
Regards,
BALATON Zoltan
v6: Rebased on master, updated commit message about migration change
v5: Changes for review comments from David and Philippe
V4: Rename pegasos2_reset to pegasos2_cpu_reset
Add new files to MAINTAINERS
BALATON Zoltan (7):
vt82c686: Implement control of serial port io ranges via config regs
vt82c686: QOM-ify superio related functionality
vt82c686: Add VT8231_SUPERIO based on VIA_SUPERIO
vt82c686: Introduce abstract TYPE_VIA_ISA and base vt82c686b_isa on it
vt82c686: Add emulation of VT8231 south bridge hw/pci-host: Add emulation of Marvell MV64361 PPC system controller hw/ppc: Add emulation of Genesi/bPlan Pegasos II
Philippe Mathieu-Daudé (1):
hw/isa/Kconfig: Add missing dependency VIA VT82C686 -> APM
MAINTAINERS | 10 + default-configs/devices/ppc-softmmu.mak | 2 + hw/isa/Kconfig | 1 + hw/isa/vt82c686.c | 515 +++++++++++-- hw/pci-host/Kconfig | 4 + hw/pci-host/meson.build | 2 + hw/pci-host/mv64361.c | 966 ++++++++++++++++++++++++ hw/pci-host/mv643xx.h | 918 ++++++++++++++++++++++ hw/pci-host/trace-events | 6 + hw/ppc/Kconfig | 9 + hw/ppc/meson.build | 2 + hw/ppc/pegasos2.c | 144 ++++ include/hw/isa/vt82c686.h | 2 +- include/hw/pci-host/mv64361.h | 8 + include/hw/pci/pci_ids.h | 4 +- 15 files changed, 2510 insertions(+), 83 deletions(-) create mode 100644 hw/pci-host/mv64361.c create mode 100644 hw/pci-host/mv643xx.h create mode 100644 hw/ppc/pegasos2.c create mode 100644 include/hw/pci-host/mv64361.h
Signature · 1 line
2.21.3
PATCH v6 1/8 vt82c686: Implement control of serial port io ranges via config regs
In VIA super south bridge the io ranges of superio components (parallel and serial ports and FDC) can be controlled by superio config registers to set their base address and enable/disable them. This is not easy to implement in QEMU because ISA emulation is only designed to set io base address once on creating the device and io ranges are registered at creation and cannot easily be disabled or moved later.
In this patch we hack around that but only for serial ports because those have a single io range at port base that's relatively easy to handle and it's what guests actually use and set address different than the default.
We do not attempt to handle controlling the parallel and FDC regions because those have multiple io ranges so handling them would be messy and guests either don't change their deafult or don't care. We could even get away with disabling and not emulating them, but since they are already there, this patch leaves them mapped at their default address just in case this could be useful for a guest in the future.
--- hw/isa/vt82c686.c | 84 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 2 deletions(-)
hw/isa/vt82c686.c +82 -2
@@ -252,8 +252,24 @@ static const TypeInfo vt8231_pm_info = {typedef struct SuperIOConfig {uint8_t regs[0x100 ];MemoryRegion io; +ISASuperIODevice *superio; +MemoryRegion *serial_io[SUPERIO_MAX_SERIAL_PORTS ]; }SuperIOConfig ; +static MemoryRegion *find_subregion (ISADevice *d,MemoryRegion *parent, +int offs) +{ +MemoryRegion *subregion, *mr =NULL ; + + QTAILQ_FOREACH(subregion, &parent->subregions, subregions_link) { +if (subregion->addr == offs) { + mr = subregion; +break ; + } + } +return mr; +} +static void superio_cfg_write (void *opaque,hwaddr addr,uint64_t data,unsigned size) {
@@ -279,7 +295,53 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data, case 0xfd ... 0xff:/* ignore write to read only registers */ return ; -/* case 0xe6 ... 0xe8: Should set base port of parallel and serial */ +case 0xe2 : + { + data &=0x1f ; +if (data &BIT (2 )) {/* Serial port 1 enable */ +ISADevice *dev = sc->superio->serial[0 ]; +if (!memory_region_is_mapped (sc->serial_io[0 ])) { +memory_region_add_subregion (isa_address_space_io (dev), + dev->ioport_id, sc->serial_io[0 ]); + } + }else { +MemoryRegion *io =isa_address_space_io (sc->superio->serial[0 ]); +if (memory_region_is_mapped (sc->serial_io[0 ])) { +memory_region_del_subregion (io, sc->serial_io[0 ]); + } + } +if (data &BIT (3 )) {/* Serial port 2 enable */ +ISADevice *dev = sc->superio->serial[1 ]; +if (!memory_region_is_mapped (sc->serial_io[1 ])) { +memory_region_add_subregion (isa_address_space_io (dev), + dev->ioport_id, sc->serial_io[1 ]); + } + }else { +MemoryRegion *io =isa_address_space_io (sc->superio->serial[1 ]); +if (memory_region_is_mapped (sc->serial_io[1 ])) { +memory_region_del_subregion (io, sc->serial_io[1 ]); + } + } +break ; + } +case 0xe7 :/* Serial port 1 io base address */ + { + data &=0xfe ; + sc->superio->serial[0 ]->ioport_id = data <<2 ; +if (memory_region_is_mapped (sc->serial_io[0 ])) { +memory_region_set_address (sc->serial_io[0 ], data <<2 ); + } +break ; + } +case 0xe8 :/* Serial port 2 io base address */ + { + data &=0xfe ; + sc->superio->serial[1 ]->ioport_id = data <<2 ; +if (memory_region_is_mapped (sc->serial_io[1 ])) { +memory_region_set_address (sc->serial_io[1 ], data <<2 ); + } +break ; + }default :qemu_log_mask (LOG_UNIMP ,"via_superio_cfg: unimplemented register 0x%x\n" , idx);
@@ -385,6 +447,7 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp)DeviceState *dev =DEVICE (d);ISABus *isa_bus;qemu_irq *isa_irq; +ISASuperIOClass *ic;int i;qdev_init_gpio_out (dev, &s->cpu_intr,1 );
@@ -394,7 +457,9 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp)isa_bus_irqs (isa_bus,i8259_init (isa_bus, *isa_irq));i8254_pit_init (isa_bus,0x40 ,0 ,NULL );i8257_dma_init (isa_bus,0 ); -isa_create_simple (isa_bus,TYPE_VT82C686B_SUPERIO ); + s->superio_cfg.superio =ISA_SUPERIO (isa_create_simple (isa_bus, +TYPE_VT82C686B_SUPERIO )); + ic =ISA_SUPERIO_GET_CLASS (s->superio_cfg.superio);mc146818_rtc_init (isa_bus,2000 ,NULL );for (i =0 ; i <PCI_CONFIG_HEADER_SIZE ; i++) {
@@ -412,6 +477,21 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp)*/ memory_region_add_subregion (isa_bus->address_space_io,0x3f0 , &s->superio_cfg.io); + +/* Grab io regions of serial devices so we can control them */ +for (i =0 ; i < ic->serial.count; i++) { +ISADevice *sd = s->superio_cfg.superio->serial[i]; +MemoryRegion *io =isa_address_space_io (sd); +MemoryRegion *mr =find_subregion (sd, io, sd->ioport_id); +if (!mr) { +error_setg (errp,"Could not get io region for serial %d" , i); +return ; + } + s->superio_cfg.serial_io[i] = mr; +if (memory_region_is_mapped (mr)) { +memory_region_del_subregion (io, mr); + } + } }static void via_class_init (ObjectClass *klass,void *data)
Signature · 1 line
2.21.3
PATCH v6 2/8 vt82c686: QOM-ify superio related functionality
In reply to BALATON ZoltanCollect superio functionality and its controlling config registers handling in an abstract VIA_SUPERIO class that is a subclass of ISA_SUPERIO and put vt82c686b specific parts in a subclass of this abstract class.
--- hw/isa/vt82c686.c | 240 ++++++++++++++++++++++++-------------- include/hw/isa/vt82c686.h | 1 - 2 files changed, 150 insertions(+), 91 deletions(-)
hw/isa/vt82c686.c +150 -90
@@ -249,12 +249,21 @@ static const TypeInfo vt8231_pm_info = { }; -typedef struct SuperIOConfig { +#define TYPE_VIA_SUPERIO "via-superio" +OBJECT_DECLARE_SIMPLE_TYPE(ViaSuperIOState, VIA_SUPERIO) + +struct ViaSuperIOState { +ISASuperIODevice superio;uint8_t regs[0x100 ]; +const MemoryRegionOps *io_ops;MemoryRegion io; -ISASuperIODevice *superio;MemoryRegion *serial_io[SUPERIO_MAX_SERIAL_PORTS ]; -}SuperIOConfig ; +}; + +static inline void via_superio_io_enable (ViaSuperIOState *s,bool enable) +{ +memory_region_set_enabled (&s->io, enable); +}static MemoryRegion *find_subregion (ISADevice *d,MemoryRegion *parent,int offs)
@@ -270,10 +279,76 @@ static MemoryRegion *find_subregion(ISADevice *d, MemoryRegion *parent,return mr; } -static void superio_cfg_write (void *opaque,hwaddr addr,uint64_t data, -unsigned size) +static void via_superio_realize (DeviceState *d,Error **errp) +{ +ViaSuperIOState *s =VIA_SUPERIO (d); +ISASuperIOClass *ic =ISA_SUPERIO_GET_CLASS (s); +int i; + +assert (s->io_ops); + ic->parent_realize (d, errp); +if (*errp) { +return ; + } +/* Grab io regions of serial devices so we can control them */ +for (i =0 ; i < ic->serial.count; i++) { +ISADevice *sd = s->superio.serial[i]; +MemoryRegion *io =isa_address_space_io (sd); +MemoryRegion *mr =find_subregion (sd, io, sd->ioport_id); +if (!mr) { +error_setg (errp,"Could not get io region for serial %d" , i); +return ; + } + s->serial_io[i] = mr; + } + +memory_region_init_io (&s->io,OBJECT (d), s->io_ops, s,"via-superio" ,2 ); +memory_region_set_enabled (&s->io, false); +/* The floppy also uses 0x3f0 and 0x3f1 but this seems to work anyway */ +memory_region_add_subregion (isa_address_space_io (ISA_DEVICE (s)),0x3f0 , + &s->io); +} + +static uint64_t via_superio_cfg_read (void *opaque,hwaddr addr,unsigned size) +{ +ViaSuperIOState *sc = opaque; +uint8_t idx = sc->regs[0 ]; +uint8_t val = sc->regs[idx]; + +if (addr ==0 ) { +return idx; + } +if (addr ==1 && idx ==0 ) { + val =0 ;/* reading reg 0 where we store index value */ + } +trace_via_superio_read (idx, val); +return val; +} + +static void via_superio_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + + sc->parent_realize = dc->realize; + dc->realize = via_superio_realize; +} + +static const TypeInfo via_superio_info = { + .name =TYPE_VIA_SUPERIO , + .parent =TYPE_ISA_SUPERIO , + .instance_size =sizeof (ViaSuperIOState), + .class_size =sizeof (ISASuperIOClass), + .class_init = via_superio_class_init, + .abstract = true, +}; + +#define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" + +static void vt82c686b_superio_cfg_write (void *opaque,hwaddr addr, +uint64_t data,unsigned size) { -SuperIOConfig *sc = opaque; +ViaSuperIOState *sc = opaque;uint8_t idx = sc->regs[0 ];if (addr ==0 ) {/* config index register */
@@ -295,29 +370,29 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data, case 0xfd ... 0xff:/* ignore write to read only registers */ return ; -case 0xe2 : +case 0xe2 :/* Function select */ { data &=0x1f ;if (data &BIT (2 )) {/* Serial port 1 enable */ -ISADevice *dev = sc->superio->serial[0 ]; +ISADevice *dev = sc->superio.serial[0 ];if (!memory_region_is_mapped (sc->serial_io[0 ])) {memory_region_add_subregion (isa_address_space_io (dev), dev->ioport_id, sc->serial_io[0 ]); } }else { -MemoryRegion *io =isa_address_space_io (sc->superio->serial[0 ]); +MemoryRegion *io =isa_address_space_io (sc->superio.serial[0 ]);if (memory_region_is_mapped (sc->serial_io[0 ])) {memory_region_del_subregion (io, sc->serial_io[0 ]); } }if (data &BIT (3 )) {/* Serial port 2 enable */ -ISADevice *dev = sc->superio->serial[1 ]; +ISADevice *dev = sc->superio.serial[1 ];if (!memory_region_is_mapped (sc->serial_io[1 ])) {memory_region_add_subregion (isa_address_space_io (dev), dev->ioport_id, sc->serial_io[1 ]); } }else { -MemoryRegion *io =isa_address_space_io (sc->superio->serial[1 ]); +MemoryRegion *io =isa_address_space_io (sc->superio.serial[1 ]);if (memory_region_is_mapped (sc->serial_io[1 ])) {memory_region_del_subregion (io, sc->serial_io[1 ]); }
@@ -327,7 +402,7 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,case 0xe7 :/* Serial port 1 io base address */ { data &=0xfe ; - sc->superio->serial[0 ]->ioport_id = data <<2 ; + sc->superio.serial[0 ]->ioport_id = data <<2 ;if (memory_region_is_mapped (sc->serial_io[0 ])) {memory_region_set_address (sc->serial_io[0 ], data <<2 ); }
@@ -336,7 +411,7 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,case 0xe8 :/* Serial port 2 io base address */ { data &=0xfe ; - sc->superio->serial[1 ]->ioport_id = data <<2 ; + sc->superio.serial[1 ]->ioport_id = data <<2 ;if (memory_region_is_mapped (sc->serial_io[1 ])) {memory_region_set_address (sc->serial_io[1 ], data <<2 ); }
@@ -350,25 +425,9 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data, sc->regs[idx] = data; } -static uint64_t superio_cfg_read (void *opaque,hwaddr addr,unsigned size) -{ -SuperIOConfig *sc = opaque; -uint8_t idx = sc->regs[0 ]; -uint8_t val = sc->regs[idx]; - -if (addr ==0 ) { -return idx; - } -if (addr ==1 && idx ==0 ) { - val =0 ;/* reading reg 0 where we store index value */ - } -trace_via_superio_read (idx, val); -return val; -} - -static const MemoryRegionOps superio_cfg_ops = { - .read = superio_cfg_read, - .write = superio_cfg_write, +static const MemoryRegionOps vt82c686b_superio_cfg_ops = { + .read = via_superio_cfg_read, + .write = vt82c686b_superio_cfg_write, .endianness =DEVICE_NATIVE_ENDIAN , .impl = { .min_access_size =1 ,
@@ -376,13 +435,66 @@ static const MemoryRegionOps superio_cfg_ops = { }, }; +static void vt82c686b_superio_reset (DeviceState *dev) +{ +ViaSuperIOState *s =VIA_SUPERIO (dev); + +memset (s->regs,0 ,sizeof (s->regs)); +/* Device ID */ +vt82c686b_superio_cfg_write (s,0 ,0xe0 ,1 ); +vt82c686b_superio_cfg_write (s,1 ,0x3c ,1 ); +/* Function select - all disabled */ +vt82c686b_superio_cfg_write (s,0 ,0xe2 ,1 ); +vt82c686b_superio_cfg_write (s,1 ,0x03 ,1 ); +/* Floppy ctrl base addr */ +vt82c686b_superio_cfg_write (s,0 ,0xe3 ,1 ); +vt82c686b_superio_cfg_write (s,1 ,0xfc ,1 ); +/* Parallel port base addr */ +vt82c686b_superio_cfg_write (s,0 ,0xe6 ,1 ); +vt82c686b_superio_cfg_write (s,1 ,0xde ,1 ); +/* Serial port 1 base addr */ +vt82c686b_superio_cfg_write (s,0 ,0xe7 ,1 ); +vt82c686b_superio_cfg_write (s,1 ,0xfe ,1 ); +/* Serial port 2 base addr */ +vt82c686b_superio_cfg_write (s,0 ,0xe8 ,1 ); +vt82c686b_superio_cfg_write (s,1 ,0xbe ,1 ); + +vt82c686b_superio_cfg_write (s,0 ,0 ,1 ); +} + +static void vt82c686b_superio_init (Object *obj) +{ +VIA_SUPERIO (obj)->io_ops = &vt82c686b_superio_cfg_ops; +} + +static void vt82c686b_superio_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + + dc->reset = vt82c686b_superio_reset; + sc->serial.count =2 ; + sc->parallel.count =1 ; + sc->ide.count =0 ;/* emulated by via-ide */ + sc->floppy.count =1 ; +} + +static const TypeInfo vt82c686b_superio_info = { + .name =TYPE_VT82C686B_SUPERIO , + .parent =TYPE_VIA_SUPERIO , + .instance_size =sizeof (ViaSuperIOState), + .instance_init = vt82c686b_superio_init, + .class_size =sizeof (ISASuperIOClass), + .class_init = vt82c686b_superio_class_init, +}; + OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BISAState, VT82C686B_ISA)struct VT82C686BISAState {PCIDevice dev;qemu_irq cpu_intr; -SuperIOConfig superio_cfg; +ViaSuperIOState *via_sio; };static void via_isa_request_i8259_irq (void *opaque,int irq,int level)
@@ -400,7 +512,7 @@ static void vt82c686b_write_config(PCIDevice *d, uint32_t addr,pci_default_write_config (d, addr, val, len);if (addr ==0x85 ) {/* BIT(1): enable or disable superio config io ports */ -memory_region_set_enabled (&s->superio_cfg.io, val &BIT (1 )); +via_superio_io_enable (s->via_sio, val &BIT (1 )); } }
@@ -432,13 +544,6 @@ static void vt82c686b_isa_reset(DeviceState *dev) pci_conf[0x5a ] =0x04 ;/* KBC/RTC Control*/ pci_conf[0x5f ] =0x04 ; pci_conf[0x77 ] =0x10 ;/* GPIO Control 1/2/3/4 */ - - s->superio_cfg.regs[0xe0 ] =0x3c ;/* Device ID */ - s->superio_cfg.regs[0xe2 ] =0x03 ;/* Function select */ - s->superio_cfg.regs[0xe3 ] =0xfc ;/* Floppy ctrl base addr */ - s->superio_cfg.regs[0xe6 ] =0xde ;/* Parallel port base addr */ - s->superio_cfg.regs[0xe7 ] =0xfe ;/* Serial port 1 base addr */ - s->superio_cfg.regs[0xe8 ] =0xbe ;/* Serial port 2 base addr */ }static void vt82c686b_realize (PCIDevice *d,Error **errp)
@@ -447,7 +552,6 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp)DeviceState *dev =DEVICE (d);ISABus *isa_bus;qemu_irq *isa_irq; -ISASuperIOClass *ic;int i;qdev_init_gpio_out (dev, &s->cpu_intr,1 );
@@ -457,9 +561,8 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp)isa_bus_irqs (isa_bus,i8259_init (isa_bus, *isa_irq));i8254_pit_init (isa_bus,0x40 ,0 ,NULL );i8257_dma_init (isa_bus,0 ); - s->superio_cfg.superio =ISA_SUPERIO (isa_create_simple (isa_bus, -TYPE_VT82C686B_SUPERIO )); - ic =ISA_SUPERIO_GET_CLASS (s->superio_cfg.superio); + s->via_sio =VIA_SUPERIO (isa_create_simple (isa_bus, +TYPE_VT82C686B_SUPERIO ));mc146818_rtc_init (isa_bus,2000 ,NULL );for (i =0 ; i <PCI_CONFIG_HEADER_SIZE ; i++) {
@@ -467,31 +570,6 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp) d->wmask[i] =0 ; } } - -memory_region_init_io (&s->superio_cfg.io,OBJECT (d), &superio_cfg_ops, - &s->superio_cfg,"superio_cfg" ,2 ); -memory_region_set_enabled (&s->superio_cfg.io, false); -/* -* The floppy also uses 0x3f0 and 0x3f1. -* But we do not emulate a floppy, so just set it here. -*/ -memory_region_add_subregion (isa_bus->address_space_io,0x3f0 , - &s->superio_cfg.io); - -/* Grab io regions of serial devices so we can control them */ -for (i =0 ; i < ic->serial.count; i++) { -ISADevice *sd = s->superio_cfg.superio->serial[i]; -MemoryRegion *io =isa_address_space_io (sd); -MemoryRegion *mr =find_subregion (sd, io, sd->ioport_id); -if (!mr) { -error_setg (errp,"Could not get io region for serial %d" , i); -return ; - } - s->superio_cfg.serial_io[i] = mr; -if (memory_region_is_mapped (mr)) { -memory_region_del_subregion (io, mr); - } - } }static void via_class_init (ObjectClass *klass,void *data)
@@ -527,32 +605,14 @@ 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_pm_info);type_register_static (&vt82c686b_pm_info);type_register_static (&vt8231_pm_info); -type_register_static (&via_info);type_register_static (&via_superio_info); +type_register_static (&vt82c686b_superio_info); +type_register_static (&via_info); }type_init (vt82c686b_register_types)
include/hw/isa/vt82c686.h +0 -1
@@ -2,7 +2,6 @@#define HW_VT82C686_H #define TYPE_VT82C686B_ISA "vt82c686b-isa" -#define TYPE_VT82C686B_SUPERIO "vt82c686b-superio"#define TYPE_VT82C686B_PM "vt82c686b-pm"#define TYPE_VT8231_PM "vt8231-pm"#define TYPE_VIA_AC97 "via-ac97"
Signature · 1 line
2.21.3
Re: [PATCH v6 2/8] vt82c686: QOM-ify superio related functionality
Quoted 18 lines · BALATON Zoltan
Collect superio functionality and its controlling config registers handling in an abstract
VIA_SUPERIOclass that is a subclass ofISA_SUPERIOand put vt82c686b specific parts in a subclass of this abstract class.Signed-off-by BALATON Zoltan <[email protected]>--- hw/isa/vt82c686.c | 240 ++++++++++++++++++++++++-------------- include/hw/isa/vt82c686.h | 1 - 2 files changed, 150 insertions(+), 91 deletions(-)static MemoryRegion *find_subregion(ISADevice *d, MemoryRegion *parent,
int offs)hw/isa/vt82c686.c +0
-1@@ -270,10 +279,76 @@ static MemoryRegion *find_subregion(ISADevice *d, MemoryRegion *parent,return mr; } -static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,
hw/isa/vt82c686.c static MemoryRegion *find_subregion(ISADevice *d, MemoryRegion *parent, · line 290
Quoted 10 lines
hw/isa/vt82c686.c +9
-1- unsigned size) +static void via_superio_realize (DeviceState *d,Error **errp) +{ +ViaSuperIOState *s =VIA_SUPERIO (d); +ISASuperIOClass *ic =ISA_SUPERIO_GET_CLASS (s); +int i; + +assert (s->io_ops); + ic->parent_realize (d, errp); +if (*errp) {
Unfortunately this doesn't work because errp can be NULL... This is described in "qapi/error.h". You have to use a local_err.
Quoted 2 lines
(quoted diff) +2
-0+ return; + }
PATCH v6 3/8 vt82c686: Add VT8231_SUPERIO based on VIA_SUPERIO
In reply to BALATON ZoltanThe VT8231 south bridge is very similar to VT82C686B but there are some differences in register addresses and functionality, e.g. the VT8231 only has one serial port. This commit adds VT8231_SUPERIO subclass based on the abstract VIA_SUPERIO class to emulate the superio part of VT8231.
--- hw/isa/vt82c686.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+)
hw/isa/vt82c686.c +121 -0
@@ -489,6 +489,126 @@ static const TypeInfo vt82c686b_superio_info = { }; +#define TYPE_VT8231_SUPERIO "vt8231-superio" + +static void vt8231_superio_cfg_write (void *opaque,hwaddr addr, +uint64_t data,unsigned size) +{ +ViaSuperIOState *sc = opaque; +uint8_t idx = sc->regs[0 ]; + +if (addr ==0 ) {/* config index register */ + sc->regs[0 ] = data; +return ; + } + +/* config data register */ +trace_via_superio_write (idx, data); +switch (idx) { + case 0x00 ... 0xdf: + case 0xe7 ... 0xef: + case 0xf0 ... 0xf1: +case 0xf5 : +case 0xf8 : +case 0xfd : +/* ignore write to read only registers */ +return ; +case 0xf2 :/* Function select */ + { + data &=0x17 ; +if (data &BIT (2 )) {/* Serial port enable */ +ISADevice *dev = sc->superio.serial[0 ]; +if (!memory_region_is_mapped (sc->serial_io[0 ])) { +memory_region_add_subregion (isa_address_space_io (dev), + dev->ioport_id, sc->serial_io[0 ]); + } + }else { +MemoryRegion *io =isa_address_space_io (sc->superio.serial[0 ]); +if (memory_region_is_mapped (sc->serial_io[0 ])) { +memory_region_del_subregion (io, sc->serial_io[0 ]); + } + } +break ; + } +case 0xf4 :/* Serial port io base address */ + { + data &=0xfe ; + sc->superio.serial[0 ]->ioport_id = data <<2 ; +if (memory_region_is_mapped (sc->serial_io[0 ])) { +memory_region_set_address (sc->serial_io[0 ], data <<2 ); + } +break ; + } +default : +qemu_log_mask (LOG_UNIMP , +"via_superio_cfg: unimplemented register 0x%x\n" , idx); +break ; + } + sc->regs[idx] = data; +} + +static const MemoryRegionOps vt8231_superio_cfg_ops = { + .read = via_superio_cfg_read, + .write = vt8231_superio_cfg_write, + .endianness =DEVICE_NATIVE_ENDIAN , + .impl = { + .min_access_size =1 , + .max_access_size =1 , + }, +}; + +static void vt8231_superio_reset (DeviceState *dev) +{ +ViaSuperIOState *s =VIA_SUPERIO (dev); + +memset (s->regs,0 ,sizeof (s->regs)); +/* Device ID */ + s->regs[0xf0 ] =0x3c ; +/* Device revision */ + s->regs[0xf1 ] =0x01 ; +/* Function select - all disabled */ +vt8231_superio_cfg_write (s,0 ,0xf2 ,1 ); +vt8231_superio_cfg_write (s,1 ,0x03 ,1 ); +/* Serial port base addr */ +vt8231_superio_cfg_write (s,0 ,0xf4 ,1 ); +vt8231_superio_cfg_write (s,1 ,0xfe ,1 ); +/* Parallel port base addr */ +vt8231_superio_cfg_write (s,0 ,0xf6 ,1 ); +vt8231_superio_cfg_write (s,1 ,0xde ,1 ); +/* Floppy ctrl base addr */ +vt8231_superio_cfg_write (s,0 ,0xf7 ,1 ); +vt8231_superio_cfg_write (s,1 ,0xfc ,1 ); + +vt8231_superio_cfg_write (s,0 ,0 ,1 ); +} + +static void vt8231_superio_init (Object *obj) +{ +VIA_SUPERIO (obj)->io_ops = &vt8231_superio_cfg_ops; +} + +static void vt8231_superio_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + + dc->reset = vt8231_superio_reset; + sc->serial.count =1 ; + sc->parallel.count =1 ; + sc->ide.count =0 ;/* emulated by via-ide */ + sc->floppy.count =1 ; +} + +static const TypeInfo vt8231_superio_info = { + .name =TYPE_VT8231_SUPERIO , + .parent =TYPE_VIA_SUPERIO , + .instance_size =sizeof (ViaSuperIOState), + .instance_init = vt8231_superio_init, + .class_size =sizeof (ISASuperIOClass), + .class_init = vt8231_superio_class_init, +}; + + OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BISAState, VT82C686B_ISA)struct VT82C686BISAState {
@@ -612,6 +732,7 @@ static void vt82c686b_register_types(void)type_register_static (&vt8231_pm_info);type_register_static (&via_superio_info);type_register_static (&vt82c686b_superio_info); +type_register_static (&vt8231_superio_info);type_register_static (&via_info); }
Signature · 1 line
2.21.3
PATCH v6 4/8 vt82c686: Introduce abstract TYPE_VIA_ISA and base vt82c686b_isa on it
In reply to BALATON ZoltanTo allow reusing ISA bridge emulation for vt8231_isa move the device state of vt82c686b_isa emulation in an abstract via_isa class. This change breaks migration back compatibility but this is not an issue for Fuloong2E machine which is not versioned or migration supported.
--- hw/isa/vt82c686.c | 70 ++++++++++++++++++++++------------------ include/hw/pci/pci_ids.h | 2 +- 2 files changed, 40 insertions(+), 32 deletions(-)
hw/isa/vt82c686.c +39 -31
@@ -609,24 +609,48 @@ static const TypeInfo vt8231_superio_info = { }; -OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BISAState, VT82C686B_ISA) +#define TYPE_VIA_ISA "via-isa" +OBJECT_DECLARE_SIMPLE_TYPE(ViaISAState, VIA_ISA) -struct VT82C686BISAState { +struct ViaISAState {PCIDevice dev;qemu_irq cpu_intr;ViaSuperIOState *via_sio; }; +static const VMStateDescription vmstate_via = { + .name ="via-isa" , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_PCI_DEVICE (dev, ViaISAState), +VMSTATE_END_OF_LIST () + } +}; + +static const TypeInfo via_isa_info = { + .name =TYPE_VIA_ISA , + .parent =TYPE_PCI_DEVICE , + .instance_size =sizeof (ViaISAState), + .abstract = true, + .interfaces = (InterfaceInfo []) { + {INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; +static void via_isa_request_i8259_irq (void *opaque,int irq,int level) { -VT82C686BISAState *s = opaque; +ViaISAState *s = opaque;qemu_set_irq (s->cpu_intr, level); } +/* TYPE_VT82C686B_ISA */ +static void vt82c686b_write_config (PCIDevice *d,uint32_t addr,uint32_t val,int len) { -VT82C686BISAState *s =VT82C686B_ISA (d); +ViaISAState *s =VIA_ISA (d);trace_via_isa_write (addr, val, len);pci_default_write_config (d, addr, val, len);
@@ -636,19 +660,9 @@ static void vt82c686b_write_config(PCIDevice *d, uint32_t addr, } } -static const VMStateDescription vmstate_via = { - .name ="vt82c686b" , - .version_id =1 , - .minimum_version_id =1 , - .fields = (VMStateField []) { -VMSTATE_PCI_DEVICE (dev, VT82C686BISAState), -VMSTATE_END_OF_LIST () - } -}; -static void vt82c686b_isa_reset (DeviceState *dev) { -VT82C686BISAState *s =VT82C686B_ISA (dev); +ViaISAState *s =VIA_ISA (dev);uint8_t *pci_conf = s->dev.config;pci_set_long (pci_conf +PCI_CAPABILITY_LIST ,0x000000c0 );
@@ -668,7 +682,7 @@ static void vt82c686b_isa_reset(DeviceState *dev)static void vt82c686b_realize (PCIDevice *d,Error **errp) { -VT82C686BISAState *s =VT82C686B_ISA (d); +ViaISAState *s =VIA_ISA (d);DeviceState *dev =DEVICE (d);ISABus *isa_bus;qemu_irq *isa_irq;
@@ -692,7 +706,7 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp) } } -static void via_class_init (ObjectClass *klass,void *data) +static void vt82c686b_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);PCIDeviceClass *k =PCI_DEVICE_CLASS (klass);
@@ -700,28 +714,21 @@ static void via_class_init(ObjectClass *klass, void *data) k->realize = vt82c686b_realize; k->config_write = vt82c686b_write_config; k->vendor_id =PCI_VENDOR_ID_VIA ; - k->device_id =PCI_DEVICE_ID_VIA_ISA_BRIDGE ; + k->device_id =PCI_DEVICE_ID_VIA_82C686B_ISA ; k->class_id =PCI_CLASS_BRIDGE_ISA ; k->revision =0x40 ; dc->reset = vt82c686b_isa_reset; dc->desc ="ISA bridge" ; dc->vmsd = &vmstate_via; -/* -* Reason: part of VIA VT82C686 southbridge, needs to be wired up, -* e.g. by mips_fuloong2e_init() -*/ +/* Reason: part of VIA VT82C686 southbridge, needs to be wired up */ dc->user_creatable = false; } -static const TypeInfo via_info = { +static const TypeInfo vt82c686b_isa_info = { .name =TYPE_VT82C686B_ISA , - .parent =TYPE_PCI_DEVICE , - .instance_size =sizeof (VT82C686BISAState), - .class_init = via_class_init, - .interfaces = (InterfaceInfo []) { - {INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, + .parent =TYPE_VIA_ISA , + .instance_size =sizeof (ViaISAState), + .class_init = vt82c686b_class_init, };
@@ -733,7 +740,8 @@ static void vt82c686b_register_types(void)type_register_static (&via_superio_info);type_register_static (&vt82c686b_superio_info);type_register_static (&vt8231_superio_info); -type_register_static (&via_info); +type_register_static (&via_isa_info); +type_register_static (&vt82c686b_isa_info); }type_init (vt82c686b_register_types)
include/hw/pci/pci_ids.h +1 -1
@@ -204,7 +204,7 @@#define PCI_VENDOR_ID_XILINX 0x10ee#define PCI_VENDOR_ID_VIA 0x1106 -#define PCI_DEVICE_ID_VIA_ISA_BRIDGE 0x0686 +#define PCI_DEVICE_ID_VIA_82C686B_ISA 0x0686#define PCI_DEVICE_ID_VIA_IDE 0x0571#define PCI_DEVICE_ID_VIA_UHCI 0x3038#define PCI_DEVICE_ID_VIA_82C686B_PM 0x3057
Signature · 1 line
2.21.3
Re: [PATCH v6 4/8] vt82c686: Introduce abstract TYPE_VIA_ISA and base vt82c686b_isa on it
Quoted 10 lines · BALATON Zoltan
To allow reusing ISA bridge emulation for
vt8231_isamove the device state ofvt82c686b_isaemulation in an abstractvia_isaclass. This change breaks migration back compatibility but this is not an issue for Fuloong2E machine which is not versioned or migration supported.Signed-off-by BALATON Zoltan <[email protected]>--- hw/isa/vt82c686.c | 70 ++++++++++++++++++++++------------------ include/hw/pci/pci_ids.h | 2 +- 2 files changed, 40 insertions(+), 32 deletions(-)
This should be OK if this other series is accepted:
"hw/usb: Extract Extract VT82C686 UHCI PCI function into new unit"
https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg03083.html
I'll come back to this patch after the former series is reviewed.
Re: [PATCH v6 4/8] vt82c686: Introduce abstract TYPE_VIA_ISA and base vt82c686b_isa on it
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 10 lines · BALATON Zoltan
To allow reusing ISA bridge emulation for
vt8231_isamove the device state ofvt82c686b_isaemulation in an abstractvia_isaclass. This change breaks migration back compatibility but this is not an issue for Fuloong2E machine which is not versioned or migration supported.Signed-off-by BALATON Zoltan <[email protected]>--- hw/isa/vt82c686.c | 70 ++++++++++++++++++++++------------------ include/hw/pci/pci_ids.h | 2 +- 2 files changed, 40 insertions(+), 32 deletions(-)
Quoted 3 lines
This should be OK if this other series is accepted:
"hw/usb: Extract Extract VT82C686 UHCI PCI function into new unit"
https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg03083.html
How is this patch related to that series? This one changes the isa bridge part and that makes the usb part compiled only if configured. These seem unrelated and independent to me.
Regards,
BALATON Zoltan
Quoted 3 lines
I'll come back to this patch after the former series is reviewed.
PATCH v6 5/8 vt82c686: Add emulation of VT8231 south bridge
In reply to BALATON ZoltanAdd emulation of VT8231 south bridge ISA part based on the similar VT82C686B but implemented in a separate subclass that holds the differences while reusing parts that can be shared.
--- hw/isa/vt82c686.c | 84 +++++++++++++++++++++++++++++++++++++++ include/hw/isa/vt82c686.h | 1 + include/hw/pci/pci_ids.h | 1 + 3 files changed, 86 insertions(+)
hw/isa/vt82c686.c +84 -0
@@ -8,6 +8,9 @@* * Contributions after 2012-01-13 are licensed under the terms of the * GNU GPL, version 2 or (at your option) any later version. +* +* VT8231 south bridge support and general clean up to allow it +* Copyright (c) 2018-2020 BALATON Zoltan */ #include "qemu/osdep.h"
@@ -731,6 +734,86 @@ static const TypeInfo vt82c686b_isa_info = { .class_init = vt82c686b_class_init, }; +/* TYPE_VT8231_ISA */ + +static void vt8231_write_config (PCIDevice *d,uint32_t addr, +uint32_t val,int len) +{ +ViaISAState *s =VIA_ISA (d); + +trace_via_isa_write (addr, val, len); +pci_default_write_config (d, addr, val, len); +if (addr ==0x50 ) { +/* BIT(2): enable or disable superio config io ports */ +via_superio_io_enable (s->via_sio, val &BIT (2 )); + } +} + +static void vt8231_isa_reset (DeviceState *dev) +{ +ViaISAState *s =VIA_ISA (dev); +uint8_t *pci_conf = s->dev.config; + +pci_set_long (pci_conf +PCI_CAPABILITY_LIST ,0x000000c0 ); +pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_IO |PCI_COMMAND_MEMORY | +PCI_COMMAND_MASTER |PCI_COMMAND_SPECIAL ); +pci_set_word (pci_conf +PCI_STATUS ,PCI_STATUS_DEVSEL_MEDIUM ); + + pci_conf[0x58 ] =0x40 ;/* Miscellaneous Control 0 */ + pci_conf[0x67 ] =0x08 ;/* Fast IR Config */ + pci_conf[0x6b ] =0x01 ;/* Fast IR I/O Base */ +} + +static void vt8231_realize (PCIDevice *d,Error **errp) +{ +ViaISAState *s =VIA_ISA (d); +DeviceState *dev =DEVICE (d); +ISABus *isa_bus; +qemu_irq *isa_irq; +int i; + +qdev_init_gpio_out (dev, &s->cpu_intr,1 ); + isa_irq =qemu_allocate_irqs (via_isa_request_i8259_irq, s,1 ); + isa_bus =isa_bus_new (dev,get_system_memory (),pci_address_space_io (d), + &error_fatal); +isa_bus_irqs (isa_bus,i8259_init (isa_bus, *isa_irq)); +i8254_pit_init (isa_bus,0x40 ,0 ,NULL ); +i8257_dma_init (isa_bus,0 ); + s->via_sio =VIA_SUPERIO (isa_create_simple (isa_bus,TYPE_VT8231_SUPERIO )); +mc146818_rtc_init (isa_bus,2000 ,NULL ); + +for (i =0 ; i <PCI_CONFIG_HEADER_SIZE ; i++) { +if (i <PCI_COMMAND || i >=PCI_REVISION_ID ) { + d->wmask[i] =0 ; + } + } +} + +static void vt8231_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->realize = vt8231_realize; + k->config_write = vt8231_write_config; + k->vendor_id =PCI_VENDOR_ID_VIA ; + k->device_id =PCI_DEVICE_ID_VIA_8231_ISA ; + k->class_id =PCI_CLASS_BRIDGE_ISA ; + k->revision =0x10 ; + dc->reset = vt8231_isa_reset; + dc->desc ="ISA bridge" ; + dc->vmsd = &vmstate_via; +/* Reason: part of VIA VT8231 southbridge, needs to be wired up */ + dc->user_creatable = false; +} + +static const TypeInfo vt8231_isa_info = { + .name =TYPE_VT8231_ISA , + .parent =TYPE_VIA_ISA , + .instance_size =sizeof (ViaISAState), + .class_init = vt8231_class_init, +}; +static void vt82c686b_register_types (void ) {
@@ -742,6 +825,7 @@ static void vt82c686b_register_types(void)type_register_static (&vt8231_superio_info);type_register_static (&via_isa_info);type_register_static (&vt82c686b_isa_info); +type_register_static (&vt8231_isa_info); }type_init (vt82c686b_register_types)
include/hw/isa/vt82c686.h +1 -0
@@ -3,6 +3,7 @@#define TYPE_VT82C686B_ISA "vt82c686b-isa"#define TYPE_VT82C686B_PM "vt82c686b-pm" +#define TYPE_VT8231_ISA "vt8231-isa"#define TYPE_VT8231_PM "vt8231-pm"#define TYPE_VIA_AC97 "via-ac97"#define TYPE_VIA_MC97 "via-mc97"
include/hw/pci/pci_ids.h +1 -0
@@ -210,6 +210,7 @@#define PCI_DEVICE_ID_VIA_82C686B_PM 0x3057#define PCI_DEVICE_ID_VIA_AC97 0x3058#define PCI_DEVICE_ID_VIA_MC97 0x3068 +#define PCI_DEVICE_ID_VIA_8231_ISA 0x8231#define PCI_DEVICE_ID_VIA_8231_PM 0x8235#define PCI_VENDOR_ID_MARVELL 0x11ab
Signature · 1 line
2.21.3
PATCH v6 6/8 hw/isa/Kconfig: Add missing dependency VIA VT82C686 -> APM
In reply to BALATON ZoltanFrom: Philippe Mathieu-Daudé <[email protected]>
TYPE_VIA_PM calls apm_init() in via_pm_realize(), so requires APM to be selected.
--- hw/isa/Kconfig | 1 + 1 file changed, 1 insertion(+)
hw/isa/Kconfig +1 -0
@@ -47,6 +47,7 @@ config VT82C686 select ACPI_SMBUS select SERIAL_ISA select FDC + select APM config SMC37C669 bool
Signature · 1 line
2.21.3
Re: [PATCH v6 6/8] hw/isa/Kconfig: Add missing dependency VIA VT82C686 -> APM
Quoted 8 lines · BALATON Zoltan
From: Philippe Mathieu-Daudé <[email protected]>
TYPE_VIA_PMcallsapm_init()invia_pm_realize(), so requires APM to be selected.Reported-by BALATON Zoltan <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by BALATON Zoltan <[email protected]>
r~
Quoted 17 lines
--- hw/isa/Kconfig | 1 + 1 file changed, 1 insertion(+)hw/isa/Kconfig +1
-0@@ -47,6 +47,7 @@ config VT82C686 select ACPI_SMBUS select SERIAL_ISA select FDC + select APM config SMC37C669 bool
PATCH v6 7/8 hw/pci-host: Add emulation of Marvell MV64361 PPC system controller
In reply to BALATON ZoltanThe Marvell Discovery II aka. MV64361 is a PowerPC system controller chip that is used on the pegasos2 PPC board. This adds emulation of it that models the device enough to boot guests on this board. The mv643xx.h header with register definitions is taken from Linux 4.15.10 only fixing white space errors, removing not needed parts and changing formatting for QEMU coding style.
--- hw/pci-host/Kconfig | 4 + hw/pci-host/meson.build | 2 + hw/pci-host/mv64361.c | 966 ++++++++++++++++++++++++++++++++++ hw/pci-host/mv643xx.h | 918 ++++++++++++++++++++++++++++++++ hw/pci-host/trace-events | 6 + include/hw/pci-host/mv64361.h | 8 + include/hw/pci/pci_ids.h | 1 + 7 files changed, 1905 insertions(+) create mode 100644 hw/pci-host/mv64361.c create mode 100644 hw/pci-host/mv643xx.h create mode 100644 include/hw/pci-host/mv64361.h
hw/pci-host/Kconfig +4 -0
@@ -72,3 +72,7 @@ config REMOTE_PCIHOST config SH_PCI bool select PCI + +config MV64361 + bool + select PCI
hw/pci-host/meson.build +2 -0
@@ -19,6 +19,8 @@ pci_ss.add(when: 'CONFIG_GRACKLE_PCI', if_true: files('grackle.c')) pci_ss.add(when: 'CONFIG_UNIN_PCI', if_true: files('uninorth.c')) # PowerPC E500 boards pci_ss.add(when: 'CONFIG_PPCE500_PCI', if_true: files('ppce500.c')) +# Pegasos2 +pci_ss.add(when: 'CONFIG_MV64361', if_true: files('mv64361.c')) # ARM devices pci_ss.add(when: 'CONFIG_VERSATILE_PCI', if_true: files('versatile.c'))
hw/pci-host/mv64361.c new file +966 -0
966 lines not on this page · raw message
hw/pci-host/mv643xx.h new file +918 -0
918 lines not on this page · raw message
hw/pci-host/trace-events +6 -0
@@ -3,6 +3,12 @@ # grackle.c grackle_set_irq(int irq_num, int level) "set_irq num %d level %d" +# mv64361.c +mv64361_region_map(const char *name, uint64_t poffs, uint64_t size, uint64_t moffs) "Mapping %s 0x%"PRIx64"+0x%"PRIx64" @ 0x%"PRIx64 +mv64361_region_enable(const char *op, int num) "Should %s region %d" +mv64361_reg_read(uint64_t addr, uint32_t val) "0x%"PRIx64" -> 0x%x" +mv64361_reg_write(uint64_t addr, uint64_t val) "0x%"PRIx64" <- 0x%"PRIx64 + # sabre.c sabre_set_request(int irq_num) "request irq %d" sabre_clear_request(int irq_num) "clear request irq %d"
include/hw/pci-host/mv64361.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef MV64361_H +#define MV64361_H + +#define TYPE_MV64361 "mv64361" + +PCIBus *mv64361_get_pci_bus (DeviceState *dev,int n); + +#endif
include/hw/pci/pci_ids.h +1 -0
@@ -214,6 +214,7 @@#define PCI_DEVICE_ID_VIA_8231_PM 0x8235#define PCI_VENDOR_ID_MARVELL 0x11ab +#define PCI_DEVICE_ID_MARVELL_MV6436X 0x6460#define PCI_VENDOR_ID_SILICON_MOTION 0x126f#define PCI_DEVICE_ID_SM501 0x0501
Signature · 1 line
2.21.3
PATCH v6 8/8 hw/ppc: Add emulation of Genesi/bPlan Pegasos II
In reply to BALATON ZoltanAdd new machine called pegasos2 emulating the Genesi/bPlan Pegasos II, a PowerPC board based on the Marvell MV64361 system controller and the VIA VT8231 integrated south bridge/superio chips. It can run Linux, AmigaOS and a wide range of MorphOS versions. Currently a firmware ROM image is needed to boot and only MorphOS has a video driver to produce graphics output. Linux could work too but distros that supported this machine don't include usual video drivers so those only run with serial console for now.
--- MAINTAINERS | 10 ++ default-configs/devices/ppc-softmmu.mak | 2 + hw/ppc/Kconfig | 9 ++ hw/ppc/meson.build | 2 + hw/ppc/pegasos2.c | 144 ++++++++++++++++++++++++ 5 files changed, 167 insertions(+) create mode 100644 hw/ppc/pegasos2.c
MAINTAINERS +10 -0
@@ -1345,6 +1345,16 @@ F: pc-bios/canyonlands.dt[sb] F: pc-bios/u-boot-sam460ex-20100605.bin F: roms/u-boot-sam460ex +pegasos2 +M: BALATON Zoltan <[email protected]> +R: David Gibson <[email protected]> +L: [email protected] +S: Maintained +F: hw/ppc/pegasos2.c +F: hw/pci-host/mv64361.c +F: hw/pci-host/mv643xx.h +F: include/hw/pci-host/mv64361.h + RISC-V Machines --------------- OpenTitan
default-configs/devices/ppc-softmmu.mak +2 -0
@@ -14,5 +14,7 @@ CONFIG_SAM460EX=y CONFIG_MAC_OLDWORLD=y CONFIG_MAC_NEWWORLD=y +CONFIG_PEGASOS2=y + # For PReP CONFIG_PREP=y
hw/ppc/Kconfig +9 -0
@@ -68,6 +68,15 @@ config SAM460EX select USB_OHCI select FDT_PPC +config PEGASOS2 + bool + select MV64361 + select VT82C686 + select IDE_VIA + select SMBUS_EEPROM +# This should come with VT82C686 + select ACPI_X86 + config PREP bool imply PCI_DEVICES
hw/ppc/meson.build +2 -0
@@ -78,5 +78,7 @@ ppc_ss.add(when: 'CONFIG_E500', if_true: files( )) # PowerPC 440 Xilinx ML507 reference board. ppc_ss.add(when: 'CONFIG_VIRTEX', if_true: files('virtex_ml507.c')) +# Pegasos2 +ppc_ss.add(when: 'CONFIG_PEGASOS2', if_true: files('pegasos2.c')) hw_arch += {'ppc': ppc_ss}
hw/ppc/pegasos2.c new file +144 -0
144 lines not on this page · raw message
Signature · 1 line
2.21.3