Revision b6b8bd18 hw/ppc_chrp.c
b/hw/ppc_chrp.c | ||
---|---|---|
26 | 26 |
#define BIOS_FILENAME "ppc_rom.bin" |
27 | 27 |
#define NVRAM_SIZE 0x2000 |
28 | 28 |
|
29 |
#define KERNEL_LOAD_ADDR 0x01000000 |
|
30 |
#define INITRD_LOAD_ADDR 0x01800000 |
|
31 |
|
|
29 | 32 |
/* MacIO devices (mapped inside the MacIO address space): CUDA, DBDMA, |
30 | 33 |
NVRAM (not implemented). */ |
31 | 34 |
|
32 | 35 |
static int dbdma_mem_index; |
33 | 36 |
static int cuda_mem_index; |
37 |
static int ide0_mem_index; |
|
38 |
static int ide1_mem_index; |
|
34 | 39 |
|
35 | 40 |
/* DBDMA: currently no op - should suffice right now */ |
36 | 41 |
|
37 | 42 |
static void dbdma_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) |
38 | 43 |
{ |
44 |
printf("%s: 0x%08x <= 0x%08x\n", __func__, addr, value); |
|
39 | 45 |
} |
40 | 46 |
|
41 | 47 |
static void dbdma_writew (void *opaque, target_phys_addr_t addr, uint32_t value) |
... | ... | |
48 | 54 |
|
49 | 55 |
static uint32_t dbdma_readb (void *opaque, target_phys_addr_t addr) |
50 | 56 |
{ |
57 |
printf("%s: 0x%08x => 0x00000000\n", __func__, addr); |
|
51 | 58 |
return 0; |
52 | 59 |
} |
53 | 60 |
|
... | ... | |
78 | 85 |
{ |
79 | 86 |
cpu_register_physical_memory(addr + 0x08000, 0x1000, dbdma_mem_index); |
80 | 87 |
cpu_register_physical_memory(addr + 0x16000, 0x2000, cuda_mem_index); |
88 |
cpu_register_physical_memory(addr + 0x1f000, 0x1000, ide0_mem_index); |
|
89 |
cpu_register_physical_memory(addr + 0x20000, 0x1000, ide1_mem_index); |
|
81 | 90 |
} |
82 | 91 |
|
83 | 92 |
static void macio_init(void) |
... | ... | |
91 | 100 |
in PearPC */ |
92 | 101 |
d->config[0x00] = 0x6b; // vendor_id |
93 | 102 |
d->config[0x01] = 0x10; |
94 |
d->config[0x02] = 0x17;
|
|
103 |
d->config[0x02] = 0x22;
|
|
95 | 104 |
d->config[0x03] = 0x00; |
96 | 105 |
|
97 | 106 |
d->config[0x0a] = 0x00; // class_sub = pci2pci |
... | ... | |
113 | 122 |
const char *initrd_filename) |
114 | 123 |
{ |
115 | 124 |
char buf[1024]; |
125 |
openpic_t *openpic; |
|
116 | 126 |
m48t59_t *nvram; |
117 | 127 |
int PPC_io_memory; |
118 | 128 |
int ret, linux_boot, i, fd; |
119 | 129 |
unsigned long bios_offset; |
130 |
uint32_t kernel_base, kernel_size, initrd_base, initrd_size; |
|
120 | 131 |
|
121 | 132 |
linux_boot = (kernel_filename != NULL); |
122 | 133 |
|
... | ... | |
135 | 146 |
BIOS_SIZE, bios_offset | IO_MEM_ROM); |
136 | 147 |
cpu_single_env->nip = 0xfffffffc; |
137 | 148 |
|
149 |
if (linux_boot) { |
|
150 |
kernel_base = KERNEL_LOAD_ADDR; |
|
151 |
/* now we can load the kernel */ |
|
152 |
kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base); |
|
153 |
if (kernel_size < 0) { |
|
154 |
fprintf(stderr, "qemu: could not load kernel '%s'\n", |
|
155 |
kernel_filename); |
|
156 |
exit(1); |
|
157 |
} |
|
158 |
/* load initrd */ |
|
159 |
if (initrd_filename) { |
|
160 |
initrd_base = INITRD_LOAD_ADDR; |
|
161 |
initrd_size = load_image(initrd_filename, |
|
162 |
phys_ram_base + initrd_base); |
|
163 |
if (initrd_size < 0) { |
|
164 |
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", |
|
165 |
initrd_filename); |
|
166 |
exit(1); |
|
167 |
} |
|
168 |
} else { |
|
169 |
initrd_base = 0; |
|
170 |
initrd_size = 0; |
|
171 |
} |
|
172 |
boot_device = 'm'; |
|
173 |
} else { |
|
174 |
kernel_base = 0; |
|
175 |
kernel_size = 0; |
|
176 |
initrd_base = 0; |
|
177 |
initrd_size = 0; |
|
178 |
} |
|
138 | 179 |
/* Register CPU as a 74x/75x */ |
139 | 180 |
cpu_ppc_register(cpu_single_env, 0x00080000); |
140 | 181 |
/* Set time-base frequency to 100 Mhz */ |
141 | 182 |
cpu_ppc_tb_init(cpu_single_env, 100UL * 1000UL * 1000UL); |
142 | 183 |
|
143 |
isa_mem_base = 0xc0000000;
|
|
184 |
isa_mem_base = 0x80000000;
|
|
144 | 185 |
pci_pmac_init(); |
145 | 186 |
|
146 |
/* Register 64 KB of ISA IO space */
|
|
187 |
/* Register 8 MB of ISA IO space */
|
|
147 | 188 |
PPC_io_memory = cpu_register_io_memory(0, PPC_io_read, PPC_io_write, NULL); |
148 |
cpu_register_physical_memory(0x80000000, 0x10000, PPC_io_memory); |
|
149 |
// cpu_register_physical_memory(0xfe000000, 0xfe010000, PPC_io_memory); |
|
189 |
cpu_register_physical_memory(0xF2000000, 0x00800000, PPC_io_memory); |
|
150 | 190 |
|
151 | 191 |
/* init basic PC hardware */ |
152 | 192 |
vga_initialize(ds, phys_ram_base + ram_size, ram_size, |
153 | 193 |
vga_ram_size, 1); |
154 |
// openpic = openpic_init(0x00000000, 0xF0000000, 1); |
|
155 |
// pic_init(openpic); |
|
194 |
openpic = openpic_init(0x00000000, 0xF0000000, 1); |
|
195 |
|
|
196 |
/* XXX: suppress that */ |
|
156 | 197 |
pic_init(); |
157 |
// pit = pit_init(0x40, 0); |
|
158 | 198 |
|
159 | 199 |
/* XXX: use Mac Serial port */ |
160 | 200 |
fd = serial_open_device(); |
... | ... | |
164 | 204 |
pci_ne2000_init(&nd_table[i]); |
165 | 205 |
} |
166 | 206 |
|
167 |
pci_ide_init(bs_table); |
|
207 |
ide0_mem_index = pmac_ide_init(&bs_table[0], openpic, 0x13); |
|
208 |
ide1_mem_index = pmac_ide_init(&bs_table[2], openpic, 0x13); |
|
168 | 209 |
|
169 | 210 |
/* cuda also initialize ADB */ |
170 |
cuda_mem_index = cuda_init(); |
|
211 |
cuda_mem_index = cuda_init(openpic, 0x19);
|
|
171 | 212 |
|
172 | 213 |
adb_kbd_init(&adb_bus); |
173 | 214 |
adb_mouse_init(&adb_bus); |
174 | 215 |
|
175 | 216 |
macio_init(); |
176 | 217 |
|
177 |
nvram = m48t59_init(8, 0x0074, NVRAM_SIZE); |
|
218 |
nvram = m48t59_init(8, 0xFFF04000, 0x0074, NVRAM_SIZE); |
|
219 |
|
|
220 |
if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) |
|
221 |
graphic_depth = 15; |
|
178 | 222 |
|
179 |
PPC_NVRAM_set_params(nvram, NVRAM_SIZE, "PREP", ram_size, boot_device, |
|
180 |
0, 0, |
|
181 |
0, |
|
182 |
0, |
|
183 |
0, 0, |
|
223 |
PPC_NVRAM_set_params(nvram, NVRAM_SIZE, "CHRP", ram_size, boot_device, |
|
224 |
kernel_base, kernel_size, |
|
225 |
kernel_cmdline, |
|
226 |
initrd_base, initrd_size, |
|
184 | 227 |
/* XXX: need an option to load a NVRAM image */ |
185 |
0 |
|
186 |
); |
|
187 |
|
|
188 |
/* Special port to get debug messages from Open-Firmware */ |
|
189 |
register_ioport_write(0xFF00, 0x04, 1, &PREP_debug_write, NULL); |
|
190 |
register_ioport_write(0xFF00, 0x04, 2, &PREP_debug_write, NULL); |
|
191 |
|
|
192 |
pci_ppc_bios_init(); |
|
228 |
0, |
|
229 |
graphic_width, graphic_height, graphic_depth); |
|
230 |
/* No PCI init: the BIOS will do it */ |
|
193 | 231 |
} |
Also available in: Unified diff