Emulate the
PATCH 1/1 Emulate the
6 files changed, 491 insertions(+), 1 deletion(-) qemu/hw/ppc440.c | 27 +++ qemu/hw/ppc440.h | 1 qemu/hw/ppc440_bamboo.c | 15 + qemu/hw/ppc4xx.h | 41 +++++ qemu/hw/ppc4xx_devs.c | 369 +++++++++++++++++++++++++++++++++++++++++++++++ qemu/pc-bios/bamboo.dts | 39 ++++
# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Date 1206672309 18000
# Branch merge
# Node ID e0e325f28fdb922e2911a383a96ce7d66c800e72
# Parent 5c61aade5a1cfeecc270f4c0c176709a3a611e87
[qemu ppc pci] Emulate the PCI(-legacy) controller found on some 440 SoCs.
The physical memory map used here is hardcoded to match 440EP, but it could be abstracted in the future.
qemu/hw/ppc440.c +27 -0
@@ -8,17 +8,32 @@* */ + +#include "hw.h" +#include "hw/isa.h" #include "ppc440.h" + +#define PPC440EP_PCI_CONFIG 0xeec00000 +#define PPC440EP_PCI_INTACK 0xeed00000 +#define PPC440EP_PCI_SPECIAL 0xeed00000 +#define PPC440EP_PCI_REGS 0xef400000 +#define PPC440EP_PCI_IO 0xe8000000 +#define PPC440EP_PCI_IOLEN 0x10000 +#define PPC440EP_PCI_MEM 0xa0000000 +#define PPC440EP_PCI_MEMLEN 0x20000000 +void ppc440ep_init (CPUState *env,target_phys_addr_t ram_bases[2 ],target_phys_addr_t ram_sizes[2 ],qemu_irq **picp, +ppc4xx_pci_t **pcip,int do_init) {ppc4xx_mmio_t *mmio;qemu_irq *pic, *irqs;ram_addr_t offset; +ppc4xx_pci_t *pci;int i;ppc_dcr_init (env,NULL ,NULL );
@@ -44,6 +59,18 @@ void ppc440ep_init(CPUState *env,for (i =0 ; i <2 ; i++) offset += ram_sizes[i]; +/* PCI */ + pci =ppc4xx_pci_init (env, pic, +PPC440EP_PCI_CONFIG , +PPC440EP_PCI_INTACK , +PPC440EP_PCI_SPECIAL , +PPC440EP_PCI_REGS ); +if (!pci) +printf ("couldn't create PCI controller!\n" ); + *pcip = pci; + +isa_mmio_init (PPC440EP_PCI_IO ,PPC440EP_PCI_IOLEN ); +/* serial ports on page 126 of 440EP user manual */ if (serial_hds[0 ]) {printf ("Initializing first serial port\n" );
qemu/hw/ppc440.h +1 -0
@@ -24,6 +24,7 @@ void ppc440ep_init(CPUState *env,target_phys_addr_t ram_bases[2 ], target_phys_addr_t ram_sizes[2], qemu_irq **picp, + ppc4xx_pci_t **pcip, int do_init);#endif
qemu/hw/ppc440_bamboo.c +14 -1
@@ -9,6 +9,10 @@*/ #include "config.h" +#include "qemu-common.h" +#include "net.h" +#include "hw.h" +#include "pci.h" #include "ppc440.h" #include "qemu-kvm.h" #include "device_tree.h"
@@ -26,7 +30,9 @@ void bamboo_init(ram_addr_t ram_size, in {char *buf=NULL ;target_phys_addr_t ram_bases[4 ], ram_sizes[4 ]; +NICInfo *nd;qemu_irq *pic; +ppc4xx_pci_t *pci;CPUState *env;target_ulong ep=0 ;target_ulong la=0 ;
@@ -77,7 +83,7 @@ void bamboo_init(ram_addr_t ram_size, in/* call init */ printf ("Calling function ppc440_init\n" ); -ppc440ep_init (env, ram_bases, ram_sizes, &pic,1 ); +ppc440ep_init (env, ram_bases, ram_sizes, &pic, &pci,1 );printf ("Done calling ppc440_init\n" );/* Register mem */
@@ -171,6 +177,13 @@ void bamboo_init(ram_addr_t ram_size, inkvm_load_registers (env); } +for (i =0 ; i < nb_nics; i++) { + nd = &nd_table[i]; +if (!nd->model) + nd->model ="rtl8139" ; +pci_nic_init (pci->bus, nd,-1 ); + } +printf ("%s: DONE\n" , __func__); }
qemu/hw/ppc4xx.h +41 -0
45 lines not on this page · raw message
qemu/hw/ppc4xx_devs.c +369 -0
378 lines not on this page · raw message
qemu/pc-bios/bamboo.dts +39 -0
@@ -187,6 +187,45 @@ }; + PCI0: pci@ec000000 { + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + compatible = "ibm,plb440ep-pci", "ibm,plb-pci"; + primary; + reg = <0 eec00000 8 /* Config space access */ + 0 eed00000 4 /* IACK */ + 0 eed00000 4 /* Special cycle */ + 0 ef400000 40>; /* Internal registers */ + + /* Outbound ranges, one memory and one IO, + * later cannot be changed. Chip supports a second + * IO range but we don't use it for now + */ + ranges = <02000000 0 a0000000 0 a0000000 0 20000000 + 01000000 0 00000000 0 e8000000 0 00010000>; + + /* Inbound 2GB range starting at 0 */ + dma-ranges = <42000000 0 0 0 0 0 80000000>; + + /* Bamboo has all 4 IRQ pins tied together per slot */ + interrupt-map-mask = <f800 0 0 0>; + interrupt-map = < + /* IDSEL 1 */ + 0800 0 0 0 &UIC0 1c 8 + + /* IDSEL 2 */ + 1000 0 0 0 &UIC0 1b 8 + + /* IDSEL 3 */ + 1800 0 0 0 &UIC0 1a 8 + + /* IDSEL 4 */ + 2000 0 0 0 &UIC0 19 8 + >; + }; + }; chosen {
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Hollis Blanchard wrote:
I always used a bamboo.dts -> dtb out of my kernel tree and used that one along time, so I never saw this issue.
I tried to convert this bamboo.dts file in qemu into a dtb file today and saw that it does not compile (nether with nor without that new patch, the patch only pointed me to that file).
paelzer@HeliosPrime ~/Desktop/KVM/ppc_port/kvm-userspace-vio/qemu/pc-bios $ dtc -I dts -O dtb -o bamboo.dtb2 bamboo.dts
DTC: dts->dtb on file "bamboo.dts"
bamboo.dts:20 syntax error
FATAL ERROR: Couldn't read input tree
Is this correct/expected atm or do we have to fix something here before this goes upstream ?
Quoted 59 lines
qemu/pc-bios/bamboo.dts +39
-1@@ -187,6 +187,45 @@ }; + PCI0: pci@ec000000 { + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + compatible = "ibm,plb440ep-pci", "ibm,plb-pci"; + primary; + reg = <0 eec00000 8 /* Config space access */ + 0 eed00000 4 /* IACK */ + 0 eed00000 4 /* Special cycle */ + 0 ef400000 40>; /* Internal registers */ + + /* Outbound ranges, one memory and one IO, + * later cannot be changed. Chip supports a second + * IO range but we don't use it for now + */ + ranges = <02000000 0 a0000000 0 a0000000 0 20000000 + 01000000 0 00000000 0 e8000000 0 00010000>; + + /* Inbound 2GB range starting at 0 */ + dma-ranges = <42000000 0 0 0 0 0 80000000>; + + /* Bamboo has all 4 IRQ pins tied together per slot */ + interrupt-map-mask = <f800 0 0 0>; + interrupt-map = < + /* IDSEL 1 */ + 0800 0 0 0 &UIC0 1c 8 + + /* IDSEL 2 */ + 1000 0 0 0 &UIC0 1b 8 + + /* IDSEL 3 */ + 1800 0 0 0 &UIC0 1a 8 + + /* IDSEL 4 */ + 2000 0 0 0 &UIC0 19 8 + >; + }; + }; chosen { -------------------------------------------------------------------------Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Signature · 13 lines
Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel