return 0;
}
+static void pic_irq_request(void *opaque, int level)
+{
+ if (level)
+ cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HARD);
+ else
+ cpu_reset_interrupt(cpu_single_env, CPU_INTERRUPT_HARD);
+}
+
/* PCI intack register */
/* Read-only register (?) */
static void _PPC_intack_write (void *opaque, target_phys_addr_t addr, uint32_t value)
uint32_t retval = 0;
if (addr == 0xBFFFFFF0)
- retval = pic_intack_read(NULL);
+ retval = pic_intack_read(isa_pic);
// printf("%s: 0x%08x <= %d\n", __func__, addr, retval);
return retval;
uint8_t syscontrol;
uint8_t fake_io[2];
int contiguous_map;
+ int endian;
} sysctrl_t;
enum {
}
/* Check LE mode */
if (val & 0x02) {
- printf("Little Endian mode isn't supported (yet ?)\n");
- abort();
+ sysctrl->endian = 1;
+ } else {
+ sysctrl->endian = 0;
}
break;
case 0x0800:
&PPC_prep_io_readl,
};
-extern CPUPPCState *global_env;
-
#define NVRAM_SIZE 0x2000
/* PowerPC PREP hardware initialisation */
int ret, linux_boot, i, nb_nics1;
unsigned long bios_offset;
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
+ ppc_def_t *def;
PCIBus *pci_bus;
sysctrl = qemu_mallocz(sizeof(sysctrl_t));
}
cpu_register_physical_memory((uint32_t)(-BIOS_SIZE),
BIOS_SIZE, bios_offset | IO_MEM_ROM);
- cpu_single_env->nip = 0xfffffffc;
if (linux_boot) {
kernel_base = KERNEL_LOAD_ADDR;
}
/* Register CPU as a 604 */
- cpu_ppc_register(cpu_single_env, 0x00040000);
+ /* XXX: CPU model (or PVR) should be provided on command line */
+ // ppc_find_by_name("604r", &def);
+ // ppc_find_by_name("604e", &def);
+ ppc_find_by_name("604", &def);
+ if (def == NULL) {
+ cpu_abort(cpu_single_env, "Unable to find PowerPC CPU definition\n");
+ }
+ cpu_ppc_register(cpu_single_env, def);
/* Set time-base frequency to 100 Mhz */
cpu_ppc_tb_init(cpu_single_env, 100UL * 1000UL * 1000UL);
/* init basic PC hardware */
vga_initialize(pci_bus, ds, phys_ram_base + ram_size, ram_size,
- vga_ram_size);
+ vga_ram_size, 0, 0);
rtc_init(0x70, 8);
// openpic = openpic_init(0x00000000, 0xF0000000, 1);
- // pic_init(openpic);
- pic_init();
+ isa_pic = pic_init(pic_irq_request, cpu_single_env);
// pit = pit_init(0x40, 0);
serial_init(0x3f8, 4, serial_hds[0]);