ppc/prep: add IBM RS/6000 43p machine
cover ppc/prep: add IBM RS/6000 43p machine
Hi,
This patchset (sent as RFC) adds an emulation of the IBM RS/6000 43p, also known as 7248. It contains the strict minimum to be able to boot a PReP boot partition on a IDE hard disk.
It has been tested with the official firmware, named P93H1904.IMG.
However, Andreas has already some preliminary patches for OpenBIOS to support PReP machines.
Command line may look like
qemu-system-ppc -M 43p -bios P93H1904.IMG -readconfig ibm_43p.cfg -device ide-hd,drive=hd0 -drive if=none,id=hd0,cache=writeback,file="hda.qcow2"
Known bugs/missing parts:
- incomplete MPC105 (PCI host bridge) emulation (IRQs, memory controller)
- no video card (should be a S3)
- can't boot from IDE cdroms (overlapping commands not supported by QEMU IDE emulation)
- can't boot from floppies (READ commands are issued, but it seems completion is ignored)
- can't boot from network
- hack added in the m48t59 device (anyone knowing the m48t59 emulation to comment?)
- QEMU can't change endianness at runtime
Patchet also doesn't pass checkpatch.pl yet.
Please comment.
Regards,
Hervé
Hervé Poussineau (6):
pci: add MPC105 PCI host bridge emulation
prep: add IBM RS/6000 7248 (43p) machine emulation
prep: add RS/6000 debug device
m48t59: move ISA ports registration to QOM constructor
m48t59: hack(?) to make it work on IBM 43p
prep: QOM'ify System I/O
default-configs/ppc-softmmu.mak | 1 + docs/ibm_43p.cfg | 48 +++++ hw/Makefile.objs | 1 + hw/m48t59.c | 11 +- hw/mpc105.c | 419 +++++++++++++++++++++++++++++++++++++++ hw/pci/pci_ids.h | 1 + hw/ppc/Makefile.objs | 2 + hw/ppc/prep.c | 94 +++++++++ hw/ppc/prep_systemio.c | 290 +++++++++++++++++++++++++++ hw/ppc/rs6000_debug.c | 260 ++++++++++++++++++++++++ trace-events | 11 + 11 files changed, 1133 insertions(+), 5 deletions(-) create mode 100644 docs/ibm_43p.cfg create mode 100644 hw/mpc105.c create mode 100644 hw/ppc/prep_systemio.c create mode 100644 hw/ppc/rs6000_debug.c
Signature · 1 line
1.7.10.4
RFC 1/6 pci: add MPC105 PCI host bridge emulation
Missing parts are:
- set_irq() and map_irq() functions
- missing handling of non-contiguous I/O
- migration
There is also somewhere a bug in the memory controller, which means that some real firmwares may not detect the correct amount of memory. This can be bypassed by adding '-m 1G' on the command line.
--- default-configs/ppc-softmmu.mak | 1 + hw/Makefile.objs | 1 + hw/mpc105.c | 419 +++++++++++++++++++++++++++++++++++++++ hw/pci/pci_ids.h | 1 + trace-events | 7 + 5 files changed, 429 insertions(+) create mode 100644 hw/mpc105.c
default-configs/ppc-softmmu.mak +1 -0
@@ -27,6 +27,7 @@ CONFIG_MAC_NVRAM=y CONFIG_MAC_DBDMA=y CONFIG_HEATHROW_PIC=y CONFIG_GRACKLE_PCI=y +CONFIG_MPC105_PCI=y CONFIG_UNIN_PCI=y CONFIG_DEC_PCI=y CONFIG_PPCE500_PCI=y
hw/Makefile.objs +1 -0
@@ -50,6 +50,7 @@ common-obj-y += pam.o common-obj-$(CONFIG_PREP_PCI) += prep_pci.o common-obj-$(CONFIG_I82378) += i82378.o common-obj-$(CONFIG_PC87312) += pc87312.o +common-obj-$(CONFIG_MPC105_PCI) += mpc105.o # Mac shared devices common-obj-$(CONFIG_MACIO) += macio.o common-obj-$(CONFIG_CUDA) += cuda.o
hw/mpc105.c new file +419 -0
419 lines not on this page · raw message
hw/pci/pci_ids.h +1 -0
@@ -69,6 +69,7 @@#define PCI_VENDOR_ID_TI 0x104c#define PCI_VENDOR_ID_MOTOROLA 0x1057 +#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801
trace-events +7 -0
@@ -757,6 +757,13 @@ 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" +# hw/mpc105.c +mpc105_unassigned_mem_read(uint64_t addr) "Unassigned mem read %" PRIx64 +mpc105_unassigned_mem_write(uint64_t addr, uint64_t val) "Unassigned mem write %" PRIx64 " = 0x%" PRIx64 +mpc105_simm_enable(int id, uint32_t start, uint32_t end) "SIMM #%d 0x%08x-0x%08x" +mpc105_simm_disable(int id) "SIMM #%d disabled" +mpc105_simm_size(int id, uint32_t size) "SIMM #%d is %u MB" + # xen-all.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i"
Signature · 1 line
1.7.10.4
RFC 2/6 prep: add IBM RS/6000 7248 (43p) machine emulation
In reply to Hervé PoussineauMachine is very simple (only one PCI host bridge and an ISA bridge). Provide a ibm_43p.cfg file to add more devices to this machine.
Syntax is:
qemu-system-ppc -M 43p -readconfig ibm_43p.cfg
--- docs/ibm_43p.cfg | 34 ++++++++++++++++++++ hw/ppc/prep.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 docs/ibm_43p.cfg
docs/ibm_43p.cfg new file +34 -0
@@ -0,0 +1,34 @@ +############################################################################ +# +# qemu-system-ppc -M 43p creates a bare machine with just the very essential +# chipset devices being present: +# +# 00.0 - Host bridge +# 0b.0 - ISA bridge +# +# This config file documents the other devices and how they are +# created. You can simply use "-readconfig $thisfile" to create +# them all. + +[device] + driver = "i8042" + +[device] + driver = "pc87312" + config = "12" + +[device] + driver = "pcnet" + addr = "12.0" + +[device] + driver = "isa-ide" + iobase = "0x1f0" + iobase2 = "0x3f6" + irq = "14" + +[device] + driver = "isa-ide" + iobase = "0x170" + iobase2 = "0x376" + irq = "15"
hw/ppc/prep.c +94 -0
115 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC 3/6 prep: add RS/6000 debug device
In reply to Hervé PoussineauDocument it for the IBM 43p emulation.
--- docs/ibm_43p.cfg | 3 + hw/ppc/Makefile.objs | 1 + hw/ppc/rs6000_debug.c | 260 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 264 insertions(+) create mode 100644 hw/ppc/rs6000_debug.c
docs/ibm_43p.cfg +3 -0
@@ -32,3 +32,6 @@ iobase = "0x170" iobase2 = "0x376" irq = "15" + +[device] + driver = "rs6000-debug"
hw/ppc/Makefile.objs +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o obj-y += ppc405_boards.o ppc4xx_devs.o ppc405_uc.o ppc440_bamboo.o # PReP obj-y += prep.o +obj-y += rs6000_debug.o # OldWorld PowerMac obj-y += mac_oldworld.o # NewWorld PowerMac
hw/ppc/rs6000_debug.c new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC 4/6 m48t59: move ISA ports registration to QOM constructor
In reply to Hervé Poussineau-device m48t59 can now be used to create a fully functional nvram, and m48t59_init_isa() becomes a much simpler helper.
--- hw/m48t59.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
hw/m48t59.c +4 -5
@@ -676,11 +676,6 @@ M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size, d =DO_UPCAST (M48t59ISAState, busdev, dev); s = &d->state; -memory_region_init_io (&d->io, &m48t59_io_ops, s,"m48t59" ,4 ); -if (io_base !=0 ) { -isa_register_ioport (dev, &d->io, io_base); - } -return s; }
@@ -703,6 +698,10 @@ static int m48t59_init_isa1(ISADevice *dev)isa_init_irq (dev, &s->IRQ,8 );m48t59_init_common (s); +memory_region_init_io (&d->io, &m48t59_io_ops, s,"m48t59" ,4 ); +if (s->io_base !=0 ) { +isa_register_ioport (dev, &d->io, s->io_base); + }return 0 ; }
Signature · 1 line
1.7.10.4
RFC 5/6 m48t59: hack(?) to make it work on IBM 43p
In reply to Hervé PoussineauDocument it for the IBM 43p emulation.
--- docs/ibm_43p.cfg | 6 ++++++ hw/m48t59.c | 2 ++ 2 files changed, 8 insertions(+)
docs/ibm_43p.cfg +6 -0
@@ -11,6 +11,12 @@ # them all. [device] + driver = "m48t59_isa" + io_base = "0x74" + model = "59" + size = "0x1000" + +[device] driver = "i8042" [device]
hw/m48t59.c +2 -0
@@ -491,6 +491,7 @@ static void NVRAM_writeb(void *opaque, hwaddr addr, uint64_t val,NVRAM ->addr &= ~0xFF00 ;NVRAM ->addr |= val <<8 ;break ; +case 2 :case 3 :m48t59_write (NVRAM ,NVRAM ->addr, val);NVRAM ->addr =0x0000 ;
@@ -506,6 +507,7 @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr, unsigned size)uint32_t retval;switch (addr) { +case 2 :case 3 : retval =m48t59_read (NVRAM ,NVRAM ->addr);break ;
Signature · 1 line
1.7.10.4
RFC 6/6 prep: QOM'ify System I/O
In reply to Hervé PoussineauMost of the functionality is extracted from hw/ppc/prep.c. Also add support for board identification/equipment registers.
Document it for the IBM 43p emulation.
--- docs/ibm_43p.cfg | 5 + hw/ppc/Makefile.objs | 1 + hw/ppc/prep_systemio.c | 290 ++++++++++++++++++++++++++++++++++++++++++++++++ trace-events | 4 + 4 files changed, 300 insertions(+) create mode 100644 hw/ppc/prep_systemio.c
docs/ibm_43p.cfg +5 -0
@@ -41,3 +41,8 @@ [device] driver = "rs6000-debug" + +[device] + driver = "prep-systemio800" + ibm-planar-id = "0xc0" + equipment = "0xff"
hw/ppc/Makefile.objs +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o obj-y += ppc405_boards.o ppc4xx_devs.o ppc405_uc.o ppc440_bamboo.o # PReP obj-y += prep.o +obj-y += prep_systemio.o obj-y += rs6000_debug.o # OldWorld PowerMac obj-y += mac_oldworld.o
hw/ppc/prep_systemio.c new file +290 -0
290 lines not on this page · raw message
trace-events +4 -0
@@ -757,6 +757,10 @@ 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" +# hw/ppc/prep_systemio.c +prep_systemio_read(uint32_t addr, uint32_t val) "read addr=%x val=%x" +prep_systemio_write(uint32_t addr, uint32_t val) "write addr=%x val=%x" + # hw/mpc105.c mpc105_unassigned_mem_read(uint64_t addr) "Unassigned mem read %" PRIx64 mpc105_unassigned_mem_write(uint64_t addr, uint64_t val) "Unassigned mem write %" PRIx64 " = 0x%" PRIx64
Signature · 1 line
1.7.10.4