2012-04-15 00:48:35 +04:00
|
|
|
/*
|
|
|
|
* QEMU National Semiconductor PC87312 (Super I/O)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010-2012 Herve Poussineau
|
|
|
|
* Copyright (c) 2011-2012 Andreas Färber
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2016-01-26 21:16:58 +03:00
|
|
|
#include "qemu/osdep.h"
|
2013-02-05 20:06:20 +04:00
|
|
|
#include "hw/isa/pc87312.h"
|
include/qemu/osdep.h: Don't include qapi/error.h
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.
Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.
Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.
This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-14 11:01:28 +03:00
|
|
|
#include "qapi/error.h"
|
2013-02-04 14:37:52 +04:00
|
|
|
#include "qemu/error-report.h"
|
2012-04-15 00:48:35 +04:00
|
|
|
#include "trace.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define REG_FER 0
|
|
|
|
#define REG_FAR 1
|
|
|
|
#define REG_PTR 2
|
|
|
|
|
|
|
|
#define FER_PARALLEL_EN 0x01
|
|
|
|
#define FER_UART1_EN 0x02
|
|
|
|
#define FER_UART2_EN 0x04
|
|
|
|
#define FER_FDC_EN 0x08
|
|
|
|
#define FER_FDC_4 0x10
|
|
|
|
#define FER_FDC_ADDR 0x20
|
|
|
|
#define FER_IDE_EN 0x40
|
|
|
|
#define FER_IDE_ADDR 0x80
|
|
|
|
|
|
|
|
#define FAR_PARALLEL_ADDR 0x03
|
|
|
|
#define FAR_UART1_ADDR 0x0C
|
|
|
|
#define FAR_UART2_ADDR 0x30
|
|
|
|
#define FAR_UART_3_4 0xC0
|
|
|
|
|
|
|
|
#define PTR_POWER_DOWN 0x01
|
|
|
|
#define PTR_CLOCK_DOWN 0x02
|
|
|
|
#define PTR_PWDN 0x04
|
|
|
|
#define PTR_IRQ_5_7 0x08
|
|
|
|
#define PTR_UART1_TEST 0x10
|
|
|
|
#define PTR_UART2_TEST 0x20
|
|
|
|
#define PTR_LOCK_CONF 0x40
|
|
|
|
#define PTR_EPP_MODE 0x80
|
|
|
|
|
|
|
|
|
|
|
|
/* Parallel port */
|
|
|
|
|
2018-03-09 01:39:31 +03:00
|
|
|
static bool is_parallel_enabled(ISASuperIODevice *sio, uint8_t index)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:31 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
|
|
|
return index ? false : s->regs[REG_FER] & FER_PARALLEL_EN;
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:27 +03:00
|
|
|
static const uint16_t parallel_base[] = { 0x378, 0x3bc, 0x278, 0x00 };
|
2012-04-15 00:48:35 +04:00
|
|
|
|
2018-03-09 01:39:31 +03:00
|
|
|
static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:31 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
2013-01-13 12:12:45 +04:00
|
|
|
return parallel_base[s->regs[REG_FAR] & FAR_PARALLEL_ADDR];
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:28 +03:00
|
|
|
static const unsigned int parallel_irq[] = { 5, 7, 5, 0 };
|
2012-04-15 00:48:35 +04:00
|
|
|
|
2018-03-09 01:39:31 +03:00
|
|
|
static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:31 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
2012-04-15 00:48:35 +04:00
|
|
|
int idx;
|
2013-01-13 12:12:45 +04:00
|
|
|
idx = (s->regs[REG_FAR] & FAR_PARALLEL_ADDR);
|
2012-04-15 00:48:35 +04:00
|
|
|
if (idx == 0) {
|
2013-01-13 12:12:45 +04:00
|
|
|
return (s->regs[REG_PTR] & PTR_IRQ_5_7) ? 7 : 5;
|
2012-04-15 00:48:35 +04:00
|
|
|
} else {
|
|
|
|
return parallel_irq[idx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* UARTs */
|
|
|
|
|
2018-03-09 01:39:27 +03:00
|
|
|
static const uint16_t uart_base[2][4] = {
|
2012-04-15 00:48:35 +04:00
|
|
|
{ 0x3e8, 0x338, 0x2e8, 0x220 },
|
|
|
|
{ 0x2e8, 0x238, 0x2e0, 0x228 }
|
|
|
|
};
|
|
|
|
|
2018-03-09 01:39:32 +03:00
|
|
|
static uint16_t get_uart_iobase(ISASuperIODevice *sio, uint8_t i)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:32 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
2012-04-15 00:48:35 +04:00
|
|
|
int idx;
|
2013-01-13 12:12:45 +04:00
|
|
|
idx = (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3;
|
2012-04-15 00:48:35 +04:00
|
|
|
if (idx == 0) {
|
|
|
|
return 0x3f8;
|
|
|
|
} else if (idx == 1) {
|
|
|
|
return 0x2f8;
|
|
|
|
} else {
|
2013-01-13 12:12:45 +04:00
|
|
|
return uart_base[idx & 1][(s->regs[REG_FAR] & FAR_UART_3_4) >> 6];
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:32 +03:00
|
|
|
static unsigned int get_uart_irq(ISASuperIODevice *sio, uint8_t i)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:32 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
2012-04-15 00:48:35 +04:00
|
|
|
int idx;
|
2013-01-13 12:12:45 +04:00
|
|
|
idx = (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3;
|
2012-04-15 00:48:35 +04:00
|
|
|
return (idx & 1) ? 3 : 4;
|
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:32 +03:00
|
|
|
static bool is_uart_enabled(ISASuperIODevice *sio, uint8_t i)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:32 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
2013-01-13 12:12:45 +04:00
|
|
|
return s->regs[REG_FER] & (FER_UART1_EN << i);
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Floppy controller */
|
|
|
|
|
2018-03-09 01:39:33 +03:00
|
|
|
static bool is_fdc_enabled(ISASuperIODevice *sio, uint8_t index)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:33 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
|
|
|
assert(!index);
|
2013-01-13 12:12:45 +04:00
|
|
|
return s->regs[REG_FER] & FER_FDC_EN;
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:33 +03:00
|
|
|
static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:33 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
|
|
|
assert(!index);
|
2013-01-13 12:12:45 +04:00
|
|
|
return (s->regs[REG_FER] & FER_FDC_ADDR) ? 0x370 : 0x3f0;
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:33 +03:00
|
|
|
static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index)
|
|
|
|
{
|
|
|
|
assert(!index);
|
|
|
|
return 6;
|
|
|
|
}
|
|
|
|
|
2012-04-15 00:48:35 +04:00
|
|
|
|
|
|
|
/* IDE controller */
|
|
|
|
|
2018-03-09 01:39:35 +03:00
|
|
|
static bool is_ide_enabled(ISASuperIODevice *sio, uint8_t index)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:35 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
|
|
|
|
2013-01-13 12:12:45 +04:00
|
|
|
return s->regs[REG_FER] & FER_IDE_EN;
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:35 +03:00
|
|
|
static uint16_t get_ide_iobase(ISASuperIODevice *sio, uint8_t index)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
2018-03-09 01:39:35 +03:00
|
|
|
PC87312State *s = PC87312(sio);
|
|
|
|
|
|
|
|
if (index == 1) {
|
|
|
|
return get_ide_iobase(sio, 0) + 0x206;
|
|
|
|
}
|
2013-01-13 12:12:45 +04:00
|
|
|
return (s->regs[REG_FER] & FER_IDE_ADDR) ? 0x170 : 0x1f0;
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
2018-03-09 01:39:35 +03:00
|
|
|
static unsigned int get_ide_irq(ISASuperIODevice *sio, uint8_t index)
|
|
|
|
{
|
|
|
|
assert(index == 0);
|
|
|
|
return 14;
|
|
|
|
}
|
2012-04-15 00:48:35 +04:00
|
|
|
|
|
|
|
static void reconfigure_devices(PC87312State *s)
|
|
|
|
{
|
|
|
|
error_report("pc87312: unsupported device reconfiguration (%02x %02x %02x)",
|
2013-01-13 12:12:45 +04:00
|
|
|
s->regs[REG_FER], s->regs[REG_FAR], s->regs[REG_PTR]);
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void pc87312_soft_reset(PC87312State *s)
|
|
|
|
{
|
|
|
|
static const uint8_t fer_init[] = {
|
|
|
|
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4b, 0x4b,
|
|
|
|
0x4b, 0x4b, 0x4b, 0x4b, 0x0f, 0x0f, 0x0f, 0x0f,
|
|
|
|
0x49, 0x49, 0x49, 0x49, 0x07, 0x07, 0x07, 0x07,
|
|
|
|
0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x08, 0x00,
|
|
|
|
};
|
|
|
|
static const uint8_t far_init[] = {
|
|
|
|
0x10, 0x11, 0x11, 0x39, 0x24, 0x38, 0x00, 0x01,
|
|
|
|
0x01, 0x09, 0x08, 0x08, 0x10, 0x11, 0x39, 0x24,
|
|
|
|
0x00, 0x01, 0x01, 0x00, 0x10, 0x11, 0x39, 0x24,
|
|
|
|
0x10, 0x11, 0x11, 0x39, 0x24, 0x38, 0x10, 0x10,
|
|
|
|
};
|
|
|
|
static const uint8_t ptr_init[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
|
|
|
|
};
|
|
|
|
|
|
|
|
s->read_id_step = 0;
|
|
|
|
s->selected_index = REG_FER;
|
|
|
|
|
2013-01-13 12:12:45 +04:00
|
|
|
s->regs[REG_FER] = fer_init[s->config & 0x1f];
|
|
|
|
s->regs[REG_FAR] = far_init[s->config & 0x1f];
|
|
|
|
s->regs[REG_PTR] = ptr_init[s->config & 0x1f];
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void pc87312_hard_reset(PC87312State *s)
|
|
|
|
{
|
|
|
|
pc87312_soft_reset(s);
|
|
|
|
}
|
|
|
|
|
2013-01-12 00:11:20 +04:00
|
|
|
static void pc87312_io_write(void *opaque, hwaddr addr, uint64_t val,
|
|
|
|
unsigned int size)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
|
|
|
PC87312State *s = opaque;
|
|
|
|
|
|
|
|
trace_pc87312_io_write(addr, val);
|
|
|
|
|
|
|
|
if ((addr & 1) == 0) {
|
|
|
|
/* Index register */
|
|
|
|
s->read_id_step = 2;
|
|
|
|
s->selected_index = val;
|
|
|
|
} else {
|
|
|
|
/* Data register */
|
|
|
|
if (s->selected_index < 3) {
|
|
|
|
s->regs[s->selected_index] = val;
|
|
|
|
reconfigure_devices(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-12 00:11:20 +04:00
|
|
|
static uint64_t pc87312_io_read(void *opaque, hwaddr addr, unsigned int size)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
|
|
|
PC87312State *s = opaque;
|
|
|
|
uint32_t val;
|
|
|
|
|
|
|
|
if ((addr & 1) == 0) {
|
|
|
|
/* Index register */
|
|
|
|
if (s->read_id_step++ == 0) {
|
|
|
|
val = 0x88;
|
|
|
|
} else if (s->read_id_step++ == 1) {
|
|
|
|
val = 0;
|
|
|
|
} else {
|
|
|
|
val = s->selected_index;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Data register */
|
|
|
|
if (s->selected_index < 3) {
|
|
|
|
val = s->regs[s->selected_index];
|
|
|
|
} else {
|
|
|
|
/* Invalid selected index */
|
|
|
|
val = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
trace_pc87312_io_read(addr, val);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2013-01-12 00:11:20 +04:00
|
|
|
static const MemoryRegionOps pc87312_io_ops = {
|
|
|
|
.read = pc87312_io_read,
|
|
|
|
.write = pc87312_io_write,
|
|
|
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
|
|
|
.valid = {
|
|
|
|
.min_access_size = 1,
|
|
|
|
.max_access_size = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-04-15 00:48:35 +04:00
|
|
|
static int pc87312_post_load(void *opaque, int version_id)
|
|
|
|
{
|
|
|
|
PC87312State *s = opaque;
|
|
|
|
|
|
|
|
reconfigure_devices(s);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void pc87312_reset(DeviceState *d)
|
|
|
|
{
|
|
|
|
PC87312State *s = PC87312(d);
|
|
|
|
|
|
|
|
pc87312_soft_reset(s);
|
|
|
|
}
|
|
|
|
|
2012-11-25 05:37:14 +04:00
|
|
|
static void pc87312_realize(DeviceState *dev, Error **errp)
|
2012-04-15 00:48:35 +04:00
|
|
|
{
|
|
|
|
PC87312State *s;
|
|
|
|
ISADevice *isa;
|
2018-03-09 01:39:30 +03:00
|
|
|
Error *local_err = NULL;
|
2012-04-15 00:48:35 +04:00
|
|
|
|
|
|
|
s = PC87312(dev);
|
2012-11-25 05:37:14 +04:00
|
|
|
isa = ISA_DEVICE(dev);
|
|
|
|
isa_register_ioport(isa, &s->io, s->iobase);
|
2012-04-15 00:48:35 +04:00
|
|
|
pc87312_hard_reset(s);
|
|
|
|
|
2018-03-09 01:39:30 +03:00
|
|
|
ISA_SUPERIO_GET_CLASS(dev)->parent_realize(dev, &local_err);
|
|
|
|
if (local_err) {
|
|
|
|
error_propagate(errp, local_err);
|
|
|
|
return;
|
|
|
|
}
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
2013-01-12 00:11:20 +04:00
|
|
|
static void pc87312_initfn(Object *obj)
|
|
|
|
{
|
|
|
|
PC87312State *s = PC87312(obj);
|
|
|
|
|
2013-06-07 05:25:08 +04:00
|
|
|
memory_region_init_io(&s->io, obj, &pc87312_io_ops, s, "pc87312", 2);
|
2013-01-12 00:11:20 +04:00
|
|
|
}
|
|
|
|
|
2012-04-15 00:48:35 +04:00
|
|
|
static const VMStateDescription vmstate_pc87312 = {
|
|
|
|
.name = "pc87312",
|
|
|
|
.version_id = 1,
|
|
|
|
.minimum_version_id = 1,
|
|
|
|
.post_load = pc87312_post_load,
|
|
|
|
.fields = (VMStateField[]) {
|
|
|
|
VMSTATE_UINT8(read_id_step, PC87312State),
|
|
|
|
VMSTATE_UINT8(selected_index, PC87312State),
|
|
|
|
VMSTATE_UINT8_ARRAY(regs, PC87312State, 3),
|
|
|
|
VMSTATE_END_OF_LIST()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static Property pc87312_properties[] = {
|
2018-03-09 01:39:27 +03:00
|
|
|
DEFINE_PROP_UINT16("iobase", PC87312State, iobase, 0x398),
|
2012-04-15 00:48:35 +04:00
|
|
|
DEFINE_PROP_UINT8("config", PC87312State, config, 1),
|
|
|
|
DEFINE_PROP_END_OF_LIST()
|
|
|
|
};
|
|
|
|
|
|
|
|
static void pc87312_class_init(ObjectClass *klass, void *data)
|
|
|
|
{
|
|
|
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
2018-03-09 01:39:30 +03:00
|
|
|
ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
|
2012-04-15 00:48:35 +04:00
|
|
|
|
2018-03-09 01:39:30 +03:00
|
|
|
sc->parent_realize = dc->realize;
|
2012-11-25 05:37:14 +04:00
|
|
|
dc->realize = pc87312_realize;
|
2012-04-15 00:48:35 +04:00
|
|
|
dc->reset = pc87312_reset;
|
|
|
|
dc->vmsd = &vmstate_pc87312;
|
|
|
|
dc->props = pc87312_properties;
|
2018-03-09 01:39:31 +03:00
|
|
|
|
|
|
|
sc->parallel = (ISASuperIOFuncs){
|
|
|
|
.count = 1,
|
|
|
|
.is_enabled = is_parallel_enabled,
|
|
|
|
.get_iobase = get_parallel_iobase,
|
|
|
|
.get_irq = get_parallel_irq,
|
|
|
|
};
|
2018-03-09 01:39:32 +03:00
|
|
|
sc->serial = (ISASuperIOFuncs){
|
|
|
|
.count = 2,
|
|
|
|
.is_enabled = is_uart_enabled,
|
|
|
|
.get_iobase = get_uart_iobase,
|
|
|
|
.get_irq = get_uart_irq,
|
|
|
|
};
|
2018-03-09 01:39:33 +03:00
|
|
|
sc->floppy = (ISASuperIOFuncs){
|
|
|
|
.count = 1,
|
|
|
|
.is_enabled = is_fdc_enabled,
|
|
|
|
.get_iobase = get_fdc_iobase,
|
|
|
|
.get_irq = get_fdc_irq,
|
|
|
|
};
|
2018-03-09 01:39:35 +03:00
|
|
|
sc->ide = (ISASuperIOFuncs){
|
|
|
|
.count = 1,
|
|
|
|
.is_enabled = is_ide_enabled,
|
|
|
|
.get_iobase = get_ide_iobase,
|
|
|
|
.get_irq = get_ide_irq,
|
|
|
|
};
|
2012-04-15 00:48:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static const TypeInfo pc87312_type_info = {
|
2018-03-09 01:39:26 +03:00
|
|
|
.name = TYPE_PC87312_SUPERIO,
|
2018-03-09 01:39:30 +03:00
|
|
|
.parent = TYPE_ISA_SUPERIO,
|
2012-04-15 00:48:35 +04:00
|
|
|
.instance_size = sizeof(PC87312State),
|
2013-01-12 00:11:20 +04:00
|
|
|
.instance_init = pc87312_initfn,
|
2012-04-15 00:48:35 +04:00
|
|
|
.class_init = pc87312_class_init,
|
2018-03-09 01:39:33 +03:00
|
|
|
/* FIXME use a qdev drive property instead of drive_get() */
|
2012-04-15 00:48:35 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static void pc87312_register_types(void)
|
|
|
|
{
|
|
|
|
type_register_static(&pc87312_type_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
type_init(pc87312_register_types)
|