2018-03-09 01:39:29 +03:00
|
|
|
/*
|
|
|
|
* Generic ISA Super I/O
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018 Philippe Mathieu-Daudé
|
|
|
|
*
|
2020-03-13 00:37:12 +03:00
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
2018-03-09 01:39:29 +03: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 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2018-03-09 01:39:29 +03:00
|
|
|
|
|
|
|
#define TYPE_ISA_SUPERIO "isa-superio"
|
2020-09-03 23:43:22 +03:00
|
|
|
typedef struct ISASuperIOClass ISASuperIOClass;
|
|
|
|
typedef struct ISASuperIODevice ISASuperIODevice;
|
2020-09-01 00:07:33 +03:00
|
|
|
DECLARE_OBJ_CHECKERS(ISASuperIODevice, ISASuperIOClass,
|
|
|
|
ISA_SUPERIO, TYPE_ISA_SUPERIO)
|
2018-03-09 01:39:29 +03:00
|
|
|
|
2018-04-20 17:52:47 +03:00
|
|
|
#define SUPERIO_MAX_SERIAL_PORTS 4
|
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
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;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2018-03-09 01:39:29 +03: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 23:43:22 +03:00
|
|
|
struct ISASuperIOClass {
|
2018-03-09 01:39:29 +03:00
|
|
|
/*< private >*/
|
2023-02-14 14:48:15 +03:00
|
|
|
DeviceClass parent_class;
|
2018-03-09 01:39:29 +03:00
|
|
|
/*< 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;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2018-03-09 01:39:29 +03:00
|
|
|
|
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 */
|