2018-03-08 23:39:29 +01:00
|
|
|
/*
|
|
|
|
* Generic ISA Super I/O
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018 Philippe Mathieu-Daudé
|
|
|
|
*
|
2020-03-12 22:37:12 +01:00
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
2018-03-08 23:39:29 +01:00
|
|
|
* 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"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2018-03-08 23:39:29 +01:00
|
|
|
|
|
|
|
#define TYPE_ISA_SUPERIO "isa-superio"
|
2020-09-03 22:43:22 +02:00
|
|
|
typedef struct ISASuperIOClass ISASuperIOClass;
|
|
|
|
typedef struct ISASuperIODevice ISASuperIODevice;
|
2020-08-31 23:07:33 +02:00
|
|
|
DECLARE_OBJ_CHECKERS(ISASuperIODevice, ISASuperIOClass,
|
|
|
|
ISA_SUPERIO, TYPE_ISA_SUPERIO)
|
2018-03-08 23:39:29 +01:00
|
|
|
|
2018-04-20 16:52:47 +02:00
|
|
|
#define SUPERIO_MAX_SERIAL_PORTS 4
|
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct ISASuperIODevice {
|
2018-03-08 23:39:31 +01:00
|
|
|
/*< private >*/
|
2018-03-08 23:39:29 +01:00
|
|
|
ISADevice parent_obj;
|
2018-03-08 23:39:31 +01:00
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
ISADevice *parallel[MAX_PARALLEL_PORTS];
|
2018-04-20 16:52:47 +02:00
|
|
|
ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS];
|
2018-03-08 23:39:33 +01:00
|
|
|
ISADevice *floppy;
|
2018-03-08 23:39:34 +01:00
|
|
|
ISADevice *kbc;
|
2018-03-08 23:39:35 +01:00
|
|
|
ISADevice *ide;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2018-03-08 23:39:29 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct ISASuperIOClass {
|
2018-03-08 23:39:29 +01:00
|
|
|
/*< private >*/
|
|
|
|
ISADeviceClass parent_class;
|
|
|
|
/*< public >*/
|
|
|
|
DeviceRealize parent_realize;
|
2018-03-08 23:39:31 +01:00
|
|
|
|
|
|
|
ISASuperIOFuncs parallel;
|
2018-03-08 23:39:32 +01:00
|
|
|
ISASuperIOFuncs serial;
|
2018-03-08 23:39:33 +01:00
|
|
|
ISASuperIOFuncs floppy;
|
2018-03-08 23:39:35 +01:00
|
|
|
ISASuperIOFuncs ide;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2018-03-08 23:39:29 +01:00
|
|
|
|
2018-03-08 23:39:37 +01:00
|
|
|
#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
|
2018-03-08 23:39:43 +01:00
|
|
|
#define TYPE_SMC37C669_SUPERIO "smc37c669-superio"
|
2018-03-08 23:39:37 +01:00
|
|
|
|
2018-03-08 23:39:29 +01:00
|
|
|
#endif /* HW_ISA_SUPERIO_H */
|