Revision 3960b04d
b/Makefile.target | ||
---|---|---|
250 | 250 |
obj-ppc-$(CONFIG_PSERIES) += spapr_pci.o device-hotplug.o pci-hotplug.o |
251 | 251 |
# PowerPC 4xx boards |
252 | 252 |
obj-ppc-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o |
253 |
obj-ppc-y += ppc440.o ppc440_bamboo.o
|
|
253 |
obj-ppc-y += ppc440_bamboo.o |
|
254 | 254 |
# PowerPC E500 boards |
255 | 255 |
obj-ppc-y += ppce500_mpc8544ds.o mpc8544_guts.o ppce500_spin.o |
256 | 256 |
# PowerPC 440 Xilinx ML507 reference board. |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Qemu PowerPC 440 chip emulation |
|
3 |
* |
|
4 |
* Copyright 2007 IBM Corporation. |
|
5 |
* Authors: |
|
6 |
* Jerone Young <jyoung5@us.ibm.com> |
|
7 |
* Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> |
|
8 |
* Hollis Blanchard <hollisb@us.ibm.com> |
|
9 |
* |
|
10 |
* This work is licensed under the GNU GPL license version 2 or later. |
|
11 |
* |
|
12 |
*/ |
|
13 |
|
|
14 |
#include "hw.h" |
|
15 |
#include "pc.h" |
|
16 |
#include "isa.h" |
|
17 |
#include "ppc.h" |
|
18 |
#include "ppc4xx.h" |
|
19 |
#include "ppc440.h" |
|
20 |
#include "ppc405.h" |
|
21 |
#include "sysemu.h" |
|
22 |
#include "kvm.h" |
|
23 |
|
|
24 |
#define PPC440EP_PCI_CONFIG 0xeec00000 |
|
25 |
#define PPC440EP_PCI_INTACK 0xeed00000 |
|
26 |
#define PPC440EP_PCI_SPECIAL 0xeed00000 |
|
27 |
#define PPC440EP_PCI_REGS 0xef400000 |
|
28 |
#define PPC440EP_PCI_IO 0xe8000000 |
|
29 |
#define PPC440EP_PCI_IOLEN 0x00010000 |
|
30 |
|
|
31 |
#define PPC440EP_SDRAM_NR_BANKS 4 |
|
32 |
|
|
33 |
static const unsigned int ppc440ep_sdram_bank_sizes[] = { |
|
34 |
256<<20, 128<<20, 64<<20, 32<<20, 16<<20, 8<<20, 0 |
|
35 |
}; |
|
36 |
|
|
37 |
CPUState *ppc440ep_init(MemoryRegion *address_space_mem, ram_addr_t *ram_size, |
|
38 |
PCIBus **pcip, const unsigned int pci_irq_nrs[4], |
|
39 |
int do_init, const char *cpu_model) |
|
40 |
{ |
|
41 |
MemoryRegion *ram_memories |
|
42 |
= g_malloc(PPC440EP_SDRAM_NR_BANKS * sizeof(*ram_memories)); |
|
43 |
target_phys_addr_t ram_bases[PPC440EP_SDRAM_NR_BANKS]; |
|
44 |
target_phys_addr_t ram_sizes[PPC440EP_SDRAM_NR_BANKS]; |
|
45 |
CPUState *env; |
|
46 |
qemu_irq *pic; |
|
47 |
qemu_irq *irqs; |
|
48 |
qemu_irq *pci_irqs; |
|
49 |
|
|
50 |
if (cpu_model == NULL) { |
|
51 |
cpu_model = "440EP"; |
|
52 |
} |
|
53 |
env = cpu_init(cpu_model); |
|
54 |
if (!env) { |
|
55 |
fprintf(stderr, "Unable to initialize CPU!\n"); |
|
56 |
exit(1); |
|
57 |
} |
|
58 |
|
|
59 |
ppc_booke_timers_init(env, 400000000, 0); |
|
60 |
ppc_dcr_init(env, NULL, NULL); |
|
61 |
|
|
62 |
/* interrupt controller */ |
|
63 |
irqs = g_malloc0(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB); |
|
64 |
irqs[PPCUIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]; |
|
65 |
irqs[PPCUIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]; |
|
66 |
pic = ppcuic_init(env, irqs, 0x0C0, 0, 1); |
|
67 |
|
|
68 |
/* SDRAM controller */ |
|
69 |
memset(ram_bases, 0, sizeof(ram_bases)); |
|
70 |
memset(ram_sizes, 0, sizeof(ram_sizes)); |
|
71 |
*ram_size = ppc4xx_sdram_adjust(*ram_size, PPC440EP_SDRAM_NR_BANKS, |
|
72 |
ram_memories, |
|
73 |
ram_bases, ram_sizes, |
|
74 |
ppc440ep_sdram_bank_sizes); |
|
75 |
/* XXX 440EP's ECC interrupts are on UIC1, but we've only created UIC0. */ |
|
76 |
ppc4xx_sdram_init(env, pic[14], PPC440EP_SDRAM_NR_BANKS, ram_memories, |
|
77 |
ram_bases, ram_sizes, do_init); |
|
78 |
|
|
79 |
/* PCI */ |
|
80 |
pci_irqs = g_malloc(sizeof(qemu_irq) * 4); |
|
81 |
pci_irqs[0] = pic[pci_irq_nrs[0]]; |
|
82 |
pci_irqs[1] = pic[pci_irq_nrs[1]]; |
|
83 |
pci_irqs[2] = pic[pci_irq_nrs[2]]; |
|
84 |
pci_irqs[3] = pic[pci_irq_nrs[3]]; |
|
85 |
*pcip = ppc4xx_pci_init(env, pci_irqs, |
|
86 |
PPC440EP_PCI_CONFIG, |
|
87 |
PPC440EP_PCI_INTACK, |
|
88 |
PPC440EP_PCI_SPECIAL, |
|
89 |
PPC440EP_PCI_REGS); |
|
90 |
if (!*pcip) |
|
91 |
printf("couldn't create PCI controller!\n"); |
|
92 |
|
|
93 |
isa_mmio_init(PPC440EP_PCI_IO, PPC440EP_PCI_IOLEN); |
|
94 |
|
|
95 |
if (serial_hds[0] != NULL) { |
|
96 |
serial_mm_init(address_space_mem, 0xef600300, 0, pic[0], |
|
97 |
PPC_SERIAL_MM_BAUDBASE, serial_hds[0], |
|
98 |
DEVICE_BIG_ENDIAN); |
|
99 |
} |
|
100 |
if (serial_hds[1] != NULL) { |
|
101 |
serial_mm_init(address_space_mem, 0xef600400, 0, pic[1], |
|
102 |
PPC_SERIAL_MM_BAUDBASE, serial_hds[1], |
|
103 |
DEVICE_BIG_ENDIAN); |
|
104 |
} |
|
105 |
|
|
106 |
return env; |
|
107 |
} |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Qemu PowerPC 440 board emualtion |
|
3 |
* |
|
4 |
* Copyright 2007 IBM Corporation. |
|
5 |
* Authors: Jerone Young <jyoung5@us.ibm.com> |
|
6 |
* Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> |
|
7 |
* |
|
8 |
* This work is licensed under the GNU GPL licence version 2 or later |
|
9 |
* |
|
10 |
*/ |
|
11 |
|
|
12 |
#ifndef QEMU_PPC440_H |
|
13 |
#define QEMU_PPC440_H |
|
14 |
|
|
15 |
#include "hw.h" |
|
16 |
|
|
17 |
CPUState *ppc440ep_init(MemoryRegion *address_space, ram_addr_t *ram_size, |
|
18 |
PCIBus **pcip, const unsigned int pci_irq_nrs[4], |
|
19 |
int do_init, const char *cpu_model); |
|
20 |
|
|
21 |
#endif |
b/hw/ppc440_bamboo.c | ||
---|---|---|
17 | 17 |
#include "hw.h" |
18 | 18 |
#include "pci.h" |
19 | 19 |
#include "boards.h" |
20 |
#include "ppc440.h" |
|
21 | 20 |
#include "kvm.h" |
22 | 21 |
#include "kvm_ppc.h" |
23 | 22 |
#include "device_tree.h" |
24 | 23 |
#include "loader.h" |
25 | 24 |
#include "elf.h" |
26 | 25 |
#include "exec-memory.h" |
26 |
#include "pc.h" |
|
27 |
#include "ppc.h" |
|
28 |
#include "ppc405.h" |
|
29 |
#include "sysemu.h" |
|
27 | 30 |
|
28 | 31 |
#define BINARY_DEVICE_TREE_FILE "bamboo.dtb" |
29 | 32 |
|
... | ... | |
32 | 35 |
#define FDT_ADDR 0x1800000 |
33 | 36 |
#define RAMDISK_ADDR 0x1900000 |
34 | 37 |
|
38 |
#define PPC440EP_PCI_CONFIG 0xeec00000 |
|
39 |
#define PPC440EP_PCI_INTACK 0xeed00000 |
|
40 |
#define PPC440EP_PCI_SPECIAL 0xeed00000 |
|
41 |
#define PPC440EP_PCI_REGS 0xef400000 |
|
42 |
#define PPC440EP_PCI_IO 0xe8000000 |
|
43 |
#define PPC440EP_PCI_IOLEN 0x00010000 |
|
44 |
|
|
45 |
#define PPC440EP_SDRAM_NR_BANKS 4 |
|
46 |
|
|
47 |
static const unsigned int ppc440ep_sdram_bank_sizes[] = { |
|
48 |
256<<20, 128<<20, 64<<20, 32<<20, 16<<20, 8<<20, 0 |
|
49 |
}; |
|
50 |
|
|
35 | 51 |
static target_phys_addr_t entry; |
36 | 52 |
|
37 | 53 |
static PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4], |
... | ... | |
43 | 59 |
return NULL; |
44 | 60 |
} |
45 | 61 |
|
62 |
CPUState *ppc440ep_init(MemoryRegion *address_space_mem, ram_addr_t *ram_size, |
|
63 |
PCIBus **pcip, const unsigned int pci_irq_nrs[4], |
|
64 |
int do_init, const char *cpu_model) |
|
65 |
{ |
|
66 |
MemoryRegion *ram_memories |
|
67 |
= g_malloc(PPC440EP_SDRAM_NR_BANKS * sizeof(*ram_memories)); |
|
68 |
target_phys_addr_t ram_bases[PPC440EP_SDRAM_NR_BANKS]; |
|
69 |
target_phys_addr_t ram_sizes[PPC440EP_SDRAM_NR_BANKS]; |
|
70 |
CPUState *env; |
|
71 |
qemu_irq *pic; |
|
72 |
qemu_irq *irqs; |
|
73 |
qemu_irq *pci_irqs; |
|
74 |
|
|
75 |
if (cpu_model == NULL) { |
|
76 |
cpu_model = "440EP"; |
|
77 |
} |
|
78 |
env = cpu_init(cpu_model); |
|
79 |
if (!env) { |
|
80 |
fprintf(stderr, "Unable to initialize CPU!\n"); |
|
81 |
exit(1); |
|
82 |
} |
|
83 |
|
|
84 |
ppc_booke_timers_init(env, 400000000, 0); |
|
85 |
ppc_dcr_init(env, NULL, NULL); |
|
86 |
|
|
87 |
/* interrupt controller */ |
|
88 |
irqs = g_malloc0(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB); |
|
89 |
irqs[PPCUIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]; |
|
90 |
irqs[PPCUIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]; |
|
91 |
pic = ppcuic_init(env, irqs, 0x0C0, 0, 1); |
|
92 |
|
|
93 |
/* SDRAM controller */ |
|
94 |
memset(ram_bases, 0, sizeof(ram_bases)); |
|
95 |
memset(ram_sizes, 0, sizeof(ram_sizes)); |
|
96 |
*ram_size = ppc4xx_sdram_adjust(*ram_size, PPC440EP_SDRAM_NR_BANKS, |
|
97 |
ram_memories, |
|
98 |
ram_bases, ram_sizes, |
|
99 |
ppc440ep_sdram_bank_sizes); |
|
100 |
/* XXX 440EP's ECC interrupts are on UIC1, but we've only created UIC0. */ |
|
101 |
ppc4xx_sdram_init(env, pic[14], PPC440EP_SDRAM_NR_BANKS, ram_memories, |
|
102 |
ram_bases, ram_sizes, do_init); |
|
103 |
|
|
104 |
/* PCI */ |
|
105 |
pci_irqs = g_malloc(sizeof(qemu_irq) * 4); |
|
106 |
pci_irqs[0] = pic[pci_irq_nrs[0]]; |
|
107 |
pci_irqs[1] = pic[pci_irq_nrs[1]]; |
|
108 |
pci_irqs[2] = pic[pci_irq_nrs[2]]; |
|
109 |
pci_irqs[3] = pic[pci_irq_nrs[3]]; |
|
110 |
*pcip = ppc4xx_pci_init(env, pci_irqs, |
|
111 |
PPC440EP_PCI_CONFIG, |
|
112 |
PPC440EP_PCI_INTACK, |
|
113 |
PPC440EP_PCI_SPECIAL, |
|
114 |
PPC440EP_PCI_REGS); |
|
115 |
if (!*pcip) |
|
116 |
printf("couldn't create PCI controller!\n"); |
|
117 |
|
|
118 |
isa_mmio_init(PPC440EP_PCI_IO, PPC440EP_PCI_IOLEN); |
|
119 |
|
|
120 |
if (serial_hds[0] != NULL) { |
|
121 |
serial_mm_init(address_space_mem, 0xef600300, 0, pic[0], |
|
122 |
PPC_SERIAL_MM_BAUDBASE, serial_hds[0], |
|
123 |
DEVICE_BIG_ENDIAN); |
|
124 |
} |
|
125 |
if (serial_hds[1] != NULL) { |
|
126 |
serial_mm_init(address_space_mem, 0xef600400, 0, pic[1], |
|
127 |
PPC_SERIAL_MM_BAUDBASE, serial_hds[1], |
|
128 |
DEVICE_BIG_ENDIAN); |
|
129 |
} |
|
130 |
|
|
131 |
return env; |
|
132 |
} |
|
133 |
|
|
46 | 134 |
static int bamboo_load_device_tree(target_phys_addr_t addr, |
47 | 135 |
uint32_t ramsize, |
48 | 136 |
target_phys_addr_t initrd_base, |
b/hw/virtex_ml507.c | ||
---|---|---|
38 | 38 |
|
39 | 39 |
#include "ppc.h" |
40 | 40 |
#include "ppc4xx.h" |
41 |
#include "ppc440.h" |
|
42 | 41 |
#include "ppc405.h" |
43 | 42 |
|
44 | 43 |
#include "blockdev.h" |
Also available in: Unified diff