Revision 1baffa46
b/hw/sun4u.c | ||
---|---|---|
32 | 32 |
#include "boards.h" |
33 | 33 |
#include "firmware_abi.h" |
34 | 34 |
#include "fw_cfg.h" |
35 |
#include "sysbus.h" |
|
35 | 36 |
|
36 | 37 |
//#define DEBUG_IRQ |
37 | 38 |
|
... | ... | |
342 | 343 |
|
343 | 344 |
device_init(pci_ebus_register); |
344 | 345 |
|
346 |
/* Boot PROM (OpenBIOS) */ |
|
347 |
static void prom_init(target_phys_addr_t addr, const char *bios_name) |
|
348 |
{ |
|
349 |
DeviceState *dev; |
|
350 |
SysBusDevice *s; |
|
351 |
char *filename; |
|
352 |
int ret; |
|
353 |
|
|
354 |
dev = qdev_create(NULL, "openprom"); |
|
355 |
qdev_init(dev); |
|
356 |
s = sysbus_from_qdev(dev); |
|
357 |
|
|
358 |
sysbus_mmio_map(s, 0, addr); |
|
359 |
|
|
360 |
/* load boot prom */ |
|
361 |
if (bios_name == NULL) { |
|
362 |
bios_name = PROM_FILENAME; |
|
363 |
} |
|
364 |
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); |
|
365 |
if (filename) { |
|
366 |
ret = load_elf(filename, addr - PROM_VADDR, NULL, NULL, NULL); |
|
367 |
if (ret < 0 || ret > PROM_SIZE_MAX) { |
|
368 |
ret = load_image_targphys(filename, addr, PROM_SIZE_MAX); |
|
369 |
} |
|
370 |
qemu_free(filename); |
|
371 |
} else { |
|
372 |
ret = -1; |
|
373 |
} |
|
374 |
if (ret < 0 || ret > PROM_SIZE_MAX) { |
|
375 |
fprintf(stderr, "qemu: could not load prom '%s'\n", bios_name); |
|
376 |
exit(1); |
|
377 |
} |
|
378 |
} |
|
379 |
|
|
380 |
static void prom_init1(SysBusDevice *dev) |
|
381 |
{ |
|
382 |
ram_addr_t prom_offset; |
|
383 |
|
|
384 |
prom_offset = qemu_ram_alloc(PROM_SIZE_MAX); |
|
385 |
sysbus_init_mmio(dev, PROM_SIZE_MAX, prom_offset | IO_MEM_ROM); |
|
386 |
} |
|
387 |
|
|
388 |
static SysBusDeviceInfo prom_info = { |
|
389 |
.init = prom_init1, |
|
390 |
.qdev.name = "openprom", |
|
391 |
.qdev.size = sizeof(SysBusDevice), |
|
392 |
.qdev.props = (Property[]) { |
|
393 |
{/* end of property list */} |
|
394 |
} |
|
395 |
}; |
|
396 |
|
|
397 |
static void prom_register_devices(void) |
|
398 |
{ |
|
399 |
sysbus_register_withprop(&prom_info); |
|
400 |
} |
|
401 |
|
|
402 |
device_init(prom_register_devices); |
|
403 |
|
|
345 | 404 |
static void sun4uv_init(ram_addr_t RAM_size, |
346 | 405 |
const char *boot_devices, |
347 | 406 |
const char *kernel_filename, const char *kernel_cmdline, |
... | ... | |
349 | 408 |
const struct hwdef *hwdef) |
350 | 409 |
{ |
351 | 410 |
CPUState *env; |
352 |
char *filename; |
|
353 | 411 |
m48t59_t *nvram; |
354 |
int ret, linux_boot;
|
|
412 |
int linux_boot; |
|
355 | 413 |
unsigned int i; |
356 |
ram_addr_t ram_offset, prom_offset;
|
|
414 |
ram_addr_t ram_offset; |
|
357 | 415 |
long initrd_size, kernel_size; |
358 | 416 |
PCIBus *pci_bus, *pci_bus2, *pci_bus3; |
359 | 417 |
QEMUBH *bh; |
... | ... | |
400 | 458 |
ram_offset = qemu_ram_alloc(RAM_size); |
401 | 459 |
cpu_register_physical_memory(0, RAM_size, ram_offset); |
402 | 460 |
|
403 |
prom_offset = qemu_ram_alloc(PROM_SIZE_MAX); |
|
404 |
cpu_register_physical_memory(hwdef->prom_addr, |
|
405 |
(PROM_SIZE_MAX + TARGET_PAGE_SIZE) & |
|
406 |
TARGET_PAGE_MASK, |
|
407 |
prom_offset | IO_MEM_ROM); |
|
408 |
|
|
409 |
if (bios_name == NULL) |
|
410 |
bios_name = PROM_FILENAME; |
|
411 |
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); |
|
412 |
if (filename) { |
|
413 |
ret = load_elf(filename, hwdef->prom_addr - PROM_VADDR, |
|
414 |
NULL, NULL, NULL); |
|
415 |
if (ret < 0) { |
|
416 |
ret = load_image_targphys(filename, hwdef->prom_addr, |
|
417 |
(PROM_SIZE_MAX + TARGET_PAGE_SIZE) & |
|
418 |
TARGET_PAGE_MASK); |
|
419 |
} |
|
420 |
qemu_free(filename); |
|
421 |
} else { |
|
422 |
ret = -1; |
|
423 |
} |
|
424 |
if (ret < 0) { |
|
425 |
fprintf(stderr, "qemu: could not load prom '%s'\n", |
|
426 |
bios_name); |
|
427 |
exit(1); |
|
428 |
} |
|
461 |
prom_init(hwdef->prom_addr, bios_name); |
|
429 | 462 |
|
430 | 463 |
kernel_size = 0; |
431 | 464 |
initrd_size = 0; |
Also available in: Unified diff