2018-03-09 01:39:29 +03:00
|
|
|
/*
|
|
|
|
* Generic ISA Super I/O
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018 Philippe Mathieu-Daudé
|
|
|
|
*
|
|
|
|
* This code is licensed under the GNU GPLv2 and later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
#ifndef HW_ISA_SUPERIO_H
|
|
|
|
#define HW_ISA_SUPERIO_H
|
|
|
|
|
|
|
|
#include "sysemu/sysemu.h"
|
|
|
|
#include "hw/isa/isa.h"
|
|
|
|
|
|
|
|
#define TYPE_ISA_SUPERIO "isa-superio"
|
|
|
|
#define ISA_SUPERIO(obj) \
|
|
|
|
OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO)
|
|
|
|
#define ISA_SUPERIO_GET_CLASS(obj) \
|
|
|
|
OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO)
|
|
|
|
#define ISA_SUPERIO_CLASS(klass) \
|
|
|
|
OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)
|
|
|
|
|
2018-04-20 17:52:47 +03:00
|
|
|
#define SUPERIO_MAX_SERIAL_PORTS 4
|
|
|
|
|
2018-03-09 01:39:29 +03:00
|
|
|
typedef struct ISASuperIODevice {
|
2018-03-09 01:39:31 +03:00
|
|
|
/*< private >*/
|
2018-03-09 01:39:29 +03:00
|
|
|
ISADevice parent_obj;
|
2018-03-09 01:39:31 +03:00
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
ISADevice *parallel[MAX_PARALLEL_PORTS];
|
2018-04-20 17:52:47 +03:00
|
|
|
ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS];
|
2018-03-09 01:39:33 +03:00
|
|
|
ISADevice *floppy;
|
2018-03-09 01:39:34 +03:00
|
|
|
ISADevice *kbc;
|
2018-03-09 01:39:35 +03:00
|
|
|
ISADevice *ide;
|
2018-03-09 01:39:29 +03:00
|
|
|
} ISASuperIODevice;
|
|
|
|
|
|
|
|
typedef struct ISASuperIOFuncs {
|
|
|
|
size_t count;
|
|
|
|
bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
|
|
|
|
uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
|
|
|
|
unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
|
|
|
|
unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
|
|
|
|
} ISASuperIOFuncs;
|
|
|
|
|
|
|
|
typedef struct ISASuperIOClass {
|
|
|
|
/*< private >*/
|
|
|
|
ISADeviceClass parent_class;
|
|
|
|
/*< public >*/
|
|
|
|
DeviceRealize parent_realize;
|
2018-03-09 01:39:31 +03:00
|
|
|
|
|
|
|
ISASuperIOFuncs parallel;
|
2018-03-09 01:39:32 +03:00
|
|
|
ISASuperIOFuncs serial;
|
2018-03-09 01:39:33 +03:00
|
|
|
ISASuperIOFuncs floppy;
|
2018-03-09 01:39:35 +03:00
|
|
|
ISASuperIOFuncs ide;
|
2018-03-09 01:39:29 +03:00
|
|
|
} ISASuperIOClass;
|
|
|
|
|
2018-03-09 01:39:37 +03:00
|
|
|
#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
|
2018-03-09 01:39:43 +03:00
|
|
|
#define TYPE_SMC37C669_SUPERIO "smc37c669-superio"
|
2018-03-09 01:39:37 +03:00
|
|
|
|
2018-03-09 01:39:29 +03:00
|
|
|
#endif /* HW_ISA_SUPERIO_H */
|