superio.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Generic ISA Super I/O
  3. *
  4. * Copyright (c) 2018 Philippe Mathieu-Daudé
  5. *
  6. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  7. * See the COPYING file in the top-level directory.
  8. * SPDX-License-Identifier: GPL-2.0-or-later
  9. */
  10. #ifndef HW_ISA_SUPERIO_H
  11. #define HW_ISA_SUPERIO_H
  12. #include "system/system.h"
  13. #include "hw/isa/isa.h"
  14. #include "qom/object.h"
  15. #define TYPE_ISA_SUPERIO "isa-superio"
  16. typedef struct ISASuperIOClass ISASuperIOClass;
  17. typedef struct ISASuperIODevice ISASuperIODevice;
  18. DECLARE_OBJ_CHECKERS(ISASuperIODevice, ISASuperIOClass,
  19. ISA_SUPERIO, TYPE_ISA_SUPERIO)
  20. #define SUPERIO_MAX_SERIAL_PORTS 4
  21. struct ISASuperIODevice {
  22. /*< private >*/
  23. ISADevice parent_obj;
  24. /*< public >*/
  25. ISADevice *parallel[MAX_PARALLEL_PORTS];
  26. ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS];
  27. ISADevice *floppy;
  28. ISADevice *kbc;
  29. ISADevice *ide;
  30. };
  31. typedef struct ISASuperIOFuncs {
  32. size_t count;
  33. bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
  34. uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
  35. unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
  36. unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
  37. } ISASuperIOFuncs;
  38. struct ISASuperIOClass {
  39. /*< private >*/
  40. DeviceClass parent_class;
  41. /*< public >*/
  42. DeviceRealize parent_realize;
  43. ISASuperIOFuncs parallel;
  44. ISASuperIOFuncs serial;
  45. ISASuperIOFuncs floppy;
  46. ISASuperIOFuncs ide;
  47. };
  48. #define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
  49. #define TYPE_SMC37C669_SUPERIO "smc37c669-superio"
  50. #endif /* HW_ISA_SUPERIO_H */