hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180308223946.26784-17-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
78f16256c1
commit
7313b1f28b
@ -187,9 +187,28 @@ static const TypeInfo isa_superio_type_info = {
|
|||||||
.class_init = isa_superio_class_init,
|
.class_init = isa_superio_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* SMS FDC37M817 Super I/O */
|
||||||
|
static void fdc37m81x_class_init(ObjectClass *klass, void *data)
|
||||||
|
{
|
||||||
|
ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
|
||||||
|
|
||||||
|
sc->serial.count = 2; /* NS16C550A */
|
||||||
|
sc->parallel.count = 1;
|
||||||
|
sc->floppy.count = 1; /* SMSC 82077AA Compatible */
|
||||||
|
sc->ide.count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo fdc37m81x_type_info = {
|
||||||
|
.name = TYPE_FDC37M81X_SUPERIO,
|
||||||
|
.parent = TYPE_ISA_SUPERIO,
|
||||||
|
.instance_size = sizeof(ISASuperIODevice),
|
||||||
|
.class_init = fdc37m81x_class_init,
|
||||||
|
};
|
||||||
|
|
||||||
static void isa_superio_register_types(void)
|
static void isa_superio_register_types(void)
|
||||||
{
|
{
|
||||||
type_register_static(&isa_superio_type_info);
|
type_register_static(&isa_superio_type_info);
|
||||||
|
type_register_static(&fdc37m81x_type_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
type_init(isa_superio_register_types)
|
type_init(isa_superio_register_types)
|
||||||
|
@ -27,14 +27,12 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/i386/pc.h"
|
#include "hw/i386/pc.h"
|
||||||
|
#include "hw/isa/superio.h"
|
||||||
#include "hw/dma/i8257.h"
|
#include "hw/dma/i8257.h"
|
||||||
#include "hw/char/serial.h"
|
#include "hw/char/serial.h"
|
||||||
#include "hw/char/parallel.h"
|
|
||||||
#include "hw/block/fdc.h"
|
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/i2c/smbus.h"
|
#include "hw/i2c/smbus.h"
|
||||||
#include "sysemu/block-backend.h"
|
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
#include "hw/mips/mips.h"
|
#include "hw/mips/mips.h"
|
||||||
#include "hw/mips/cpudevs.h"
|
#include "hw/mips/cpudevs.h"
|
||||||
@ -47,7 +45,6 @@
|
|||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "hw/timer/mc146818rtc.h"
|
#include "hw/timer/mc146818rtc.h"
|
||||||
#include "hw/input/i8042.h"
|
|
||||||
#include "hw/timer/i8254.h"
|
#include "hw/timer/i8254.h"
|
||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
@ -1005,10 +1002,8 @@ void mips_malta_init(MachineState *machine)
|
|||||||
qemu_irq cbus_irq, i8259_irq;
|
qemu_irq cbus_irq, i8259_irq;
|
||||||
int piix4_devfn;
|
int piix4_devfn;
|
||||||
I2CBus *smbus;
|
I2CBus *smbus;
|
||||||
int i;
|
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||||
DriveInfo *fd[MAX_FD];
|
|
||||||
int fl_idx = 0;
|
int fl_idx = 0;
|
||||||
int fl_sectors = bios_size >> 16;
|
int fl_sectors = bios_size >> 16;
|
||||||
int be;
|
int be;
|
||||||
@ -1023,15 +1018,6 @@ void mips_malta_init(MachineState *machine)
|
|||||||
|
|
||||||
qdev_init_nofail(dev);
|
qdev_init_nofail(dev);
|
||||||
|
|
||||||
/* Make sure the first 3 serial ports are associated with a device. */
|
|
||||||
for(i = 0; i < 3; i++) {
|
|
||||||
if (!serial_hds[i]) {
|
|
||||||
char label[32];
|
|
||||||
snprintf(label, sizeof(label), "serial%d", i);
|
|
||||||
serial_hds[i] = qemu_chr_new(label, "null");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create CPU */
|
/* create CPU */
|
||||||
mips_create_cpu(s, machine->cpu_type, &cbus_irq, &i8259_irq);
|
mips_create_cpu(s, machine->cpu_type, &cbus_irq, &i8259_irq);
|
||||||
|
|
||||||
@ -1067,7 +1053,14 @@ void mips_malta_init(MachineState *machine)
|
|||||||
#else
|
#else
|
||||||
be = 0;
|
be = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FPGA */
|
/* FPGA */
|
||||||
|
|
||||||
|
/* Make sure the second serial port is associated with a device. */
|
||||||
|
if (!serial_hds[2]) {
|
||||||
|
serial_hds[2] = qemu_chr_new("fpga-uart", "null");
|
||||||
|
}
|
||||||
|
|
||||||
/* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 */
|
/* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 */
|
||||||
malta_fpga_init(system_memory, FPGA_ADDRESS, cbus_irq, serial_hds[2]);
|
malta_fpga_init(system_memory, FPGA_ADDRESS, cbus_irq, serial_hds[2]);
|
||||||
|
|
||||||
@ -1214,16 +1207,8 @@ void mips_malta_init(MachineState *machine)
|
|||||||
smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
|
smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
|
||||||
g_free(smbus_eeprom_buf);
|
g_free(smbus_eeprom_buf);
|
||||||
|
|
||||||
/* Super I/O */
|
/* Super I/O: SMS FDC37M817 */
|
||||||
isa_create_simple(isa_bus, TYPE_I8042);
|
isa_create_simple(isa_bus, TYPE_FDC37M81X_SUPERIO);
|
||||||
|
|
||||||
serial_hds_isa_init(isa_bus, 0, 2);
|
|
||||||
parallel_hds_isa_init(isa_bus, 1);
|
|
||||||
|
|
||||||
for(i = 0; i < MAX_FD; i++) {
|
|
||||||
fd[i] = drive_get(IF_FLOPPY, 0, i);
|
|
||||||
}
|
|
||||||
fdctrl_init_isa(isa_bus, fd);
|
|
||||||
|
|
||||||
/* Network card */
|
/* Network card */
|
||||||
network_init(pci_bus);
|
network_init(pci_bus);
|
||||||
|
@ -54,4 +54,6 @@ typedef struct ISASuperIOClass {
|
|||||||
ISASuperIOFuncs ide;
|
ISASuperIOFuncs ide;
|
||||||
} ISASuperIOClass;
|
} ISASuperIOClass;
|
||||||
|
|
||||||
|
#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
|
||||||
|
|
||||||
#endif /* HW_ISA_SUPERIO_H */
|
#endif /* HW_ISA_SUPERIO_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user