54
52
#if defined (HARD_DEBUG_PPC_IO)
55
53
#define PPC_IO_DPRINTF(fmt, args...) \
57
if (loglevel & CPU_LOG_IOPORT) { \
58
fprintf(logfile, "%s: " fmt, __func__ , ##args); \
55
if (qemu_loglevel_mask(CPU_LOG_IOPORT)) { \
56
qemu_log("%s: " fmt, __func__ , ##args); \
60
58
printf("%s : " fmt, __func__ , ##args); \
63
61
#elif defined (DEBUG_PPC_IO)
64
#define PPC_IO_DPRINTF(fmt, args...) \
66
if (loglevel & CPU_LOG_IOPORT) { \
67
fprintf(logfile, "%s: " fmt, __func__ , ##args); \
62
#define PPC_IO_DPRINTF(fmt, args...) qemu_log_mask(CPU_LOG_IOPORT, ## __VA_ARGS__)
71
64
#define PPC_IO_DPRINTF(fmt, args...) do { } while (0)
86
79
/* ISA IO ports bridge */
87
80
#define PPC_IO_BASE 0x80000000
89
83
/* Speaker port 0x61 */
91
int dummy_refresh_clock;
84
static int speaker_data_on;
85
static int dummy_refresh_clock;
93
88
static void speaker_ioport_write (void *opaque, uint32_t addr, uint32_t val)
535
530
#define NVRAM_SIZE 0x2000
537
532
/* PowerPC PREP hardware initialisation */
538
static void ppc_prep_init (int ram_size, int vga_ram_size,
539
const char *boot_device, DisplayState *ds,
533
static void ppc_prep_init (ram_addr_t ram_size, int vga_ram_size,
534
const char *boot_device,
540
535
const char *kernel_filename,
541
536
const char *kernel_cmdline,
542
537
const char *initrd_filename,
548
543
m48t59_t *m48t59;
549
544
int PPC_io_memory;
550
545
int linux_boot, i, nb_nics1, bios_size;
551
unsigned long bios_offset;
546
ram_addr_t ram_offset, vga_ram_offset, bios_offset;
552
547
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
580
573
cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
582
575
qemu_register_reset(&cpu_ppc_reset, env);
583
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
587
579
/* allocate RAM */
588
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
580
ram_offset = qemu_ram_alloc(ram_size);
581
cpu_register_physical_memory(0, ram_size, ram_offset);
583
/* allocate VGA RAM */
584
vga_ram_offset = qemu_ram_alloc(vga_ram_size);
590
586
/* allocate and load BIOS */
591
bios_offset = ram_size + vga_ram_size;
587
bios_offset = qemu_ram_alloc(BIOS_SIZE);
592
588
if (bios_name == NULL)
593
589
bios_name = BIOS_FILENAME;
594
590
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
661
657
cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory);
663
659
/* init basic PC hardware */
664
pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size,
660
pci_vga_init(pci_bus, phys_ram_base + vga_ram_offset,
661
vga_ram_offset, vga_ram_size, 0, 0);
666
662
// openpic = openpic_init(0x00000000, 0xF0000000, 1);
667
663
// pit = pit_init(0x40, i8259[0]);
668
rtc_init(0x70, i8259[8]);
664
rtc_init(0x70, i8259[8], 2000);
670
serial_init(0x3f8, i8259[4], serial_hds[0]);
666
serial_init(0x3f8, i8259[4], 115200, serial_hds[0]);
671
667
nb_nics1 = nb_nics;
672
668
if (nb_nics1 > NE2000_NB_MAX)
673
669
nb_nics1 = NE2000_NB_MAX;
674
670
for(i = 0; i < nb_nics1; i++) {
675
if (nd_table[i].model == NULL
676
|| strcmp(nd_table[i].model, "ne2k_isa") == 0) {
671
if (nd_table[i].model == NULL) {
672
nd_table[i].model = "ne2k_isa";
674
if (strcmp(nd_table[i].model, "ne2k_isa") == 0) {
677
675
isa_ne2000_init(ne2000_io[i], i8259[ne2000_irq[i]], &nd_table[i]);
679
pci_nic_init(pci_bus, &nd_table[i], -1);
677
pci_nic_init(pci_bus, &nd_table[i], -1, "ne2k_pci");