static fdctrl_t *floppy_controller;
static RTCState *rtc_state;
static PITState *pit;
+static IOAPICState *ioapic;
static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
{
return qemu_get_clock(vm_clock);
}
+/* IRQ handling */
+int cpu_get_pic_interrupt(CPUState *env)
+{
+ int intno;
+
+ intno = apic_get_interrupt(env);
+ if (intno >= 0) {
+ /* set irq request if a PIC irq is still pending */
+ /* XXX: improve that */
+ pic_update_irq(isa_pic);
+ return intno;
+ }
+ /* read the irq from the PIC */
+ intno = pic_read_irq(isa_pic);
+ return intno;
+}
+
+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);
+}
+
/* PC cmos mappings */
#define REG_EQUIPMENT_BYTE 0x14
static int serial_io[MAX_SERIAL_PORTS] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
static int serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 };
+static int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
+static int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
+
/* PC hardware initialisation */
-void pc_init(int ram_size, int vga_ram_size, int boot_device,
- DisplayState *ds, const char **fd_filename, int snapshot,
- const char *kernel_filename, const char *kernel_cmdline,
- const char *initrd_filename)
+static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
+ DisplayState *ds, const char **fd_filename, int snapshot,
+ const char *kernel_filename, const char *kernel_cmdline,
+ const char *initrd_filename)
{
char buf[1024];
int ret, linux_boot, initrd_size, i, nb_nics1;
unsigned long bios_offset, vga_bios_offset;
int bios_size, isa_bios_size;
PCIBus *pci_bus;
-
+
linux_boot = (kernel_filename != NULL);
/* allocate RAM */
}
} else {
vga_initialize(pci_bus, ds, phys_ram_base + ram_size, ram_size,
- vga_ram_size);
+ vga_ram_size, 0, 0);
}
rtc_state = rtc_init(0x70, 8);
register_ioport_read(0x92, 1, 1, ioport92_read, NULL);
register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
- pic_init();
+ if (pci_enabled) {
+ apic_init(cpu_single_env);
+ ioapic = ioapic_init();
+ }
+ isa_pic = pic_init(pic_irq_request, cpu_single_env);
pit = pit_init(0x40, 0);
+ if (pci_enabled) {
+ pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic);
+ }
for(i = 0; i < MAX_SERIAL_PORTS; i++) {
if (serial_hds[i]) {
}
}
+ for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
+ if (parallel_hds[i]) {
+ parallel_init(parallel_io[i], parallel_irq[i], parallel_hds[i]);
+ }
+ }
+
if (pci_enabled) {
for(i = 0; i < nb_nics; i++) {
pci_ne2000_init(pci_bus, &nd_table[i]);
if (audio_enabled) {
AUD_init();
-#ifdef USE_SB16
if (sb16_enabled)
SB16_init ();
-#endif
#ifdef CONFIG_ADLIB
if (adlib_enabled)
Adlib_init ();
#endif
-#ifdef USE_GUS
+#ifdef CONFIG_GUS
if (gus_enabled)
GUS_init ();
#endif
+ if (pci_enabled && es1370_enabled)
+ es1370_init (pci_bus);
}
floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table);
cmos_init(ram_size, boot_device, bs_table);
+ if (pci_enabled && usb_enabled) {
+ USBPort *usb_root_ports[2];
+ USBDevice *usb_hub;
+ usb_uhci_init(pci_bus, usb_root_ports);
+#if 0
+ {
+ USBPort *usb_hub1_ports[4];
+ USBPort *usb_hub2_ports[2];
+ /* test: we simulate a USB hub */
+ usb_hub = usb_hub_init(usb_hub1_ports, 4);
+ usb_attach(usb_root_ports[0], usb_hub);
+
+ /* test: we simulate a USB hub */
+ usb_hub = usb_hub_init(usb_hub2_ports, 2);
+ usb_attach(usb_hub1_ports[0], usb_hub);
+ }
+#endif
+ /* simulated hub with the host USB devices connected to it */
+ usb_hub = usb_host_hub_init();
+ usb_attach(usb_root_ports[0], usb_hub);
+ }
+
/* must be done after all PCI devices are instanciated */
/* XXX: should be done in the Bochs BIOS */
if (pci_enabled) {
pci_bios_init();
}
}
+
+QEMUMachine pc_machine = {
+ "pc",
+ "Standard PC",
+ pc_init1,
+};