1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef MACIO_H
27#define MACIO_H
28
29#include "hw/char/escc.h"
30#include "hw/intc/heathrow_pic.h"
31#include "hw/misc/macio/cuda.h"
32#include "hw/misc/macio/gpio.h"
33#include "hw/misc/macio/pmu.h"
34#include "hw/ppc/mac_dbdma.h"
35#include "hw/ppc/openpic.h"
36
37
38#define TYPE_MACIO_BUS "macio-bus"
39#define MACIO_BUS(obj) OBJECT_CHECK(MacIOBusState, (obj), TYPE_MACIO_BUS)
40
41typedef struct MacIOBusState {
42
43 BusState parent_obj;
44} MacIOBusState;
45
46
47#define TYPE_MACIO_IDE "macio-ide"
48#define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE)
49
50typedef struct MACIOIDEState {
51
52 SysBusDevice parent_obj;
53
54 uint32_t addr;
55 uint32_t channel;
56 qemu_irq real_ide_irq;
57 qemu_irq real_dma_irq;
58 qemu_irq ide_irq;
59 qemu_irq dma_irq;
60
61 MemoryRegion mem;
62 IDEBus bus;
63 IDEDMA dma;
64 void *dbdma;
65 bool dma_active;
66 uint32_t timing_reg;
67 uint32_t irq_reg;
68} MACIOIDEState;
69
70void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table);
71void macio_ide_register_dma(MACIOIDEState *ide);
72
73#define TYPE_MACIO "macio"
74#define MACIO(obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO)
75
76typedef struct MacIOState {
77
78 PCIDevice parent;
79
80
81 MacIOBusState macio_bus;
82 MemoryRegion bar;
83 CUDAState cuda;
84 PMUState pmu;
85 DBDMAState dbdma;
86 ESCCState escc;
87 uint64_t frequency;
88} MacIOState;
89
90#define TYPE_OLDWORLD_MACIO "macio-oldworld"
91#define OLDWORLD_MACIO(obj) \
92 OBJECT_CHECK(OldWorldMacIOState, (obj), TYPE_OLDWORLD_MACIO)
93
94typedef struct OldWorldMacIOState {
95
96 MacIOState parent_obj;
97
98
99 HeathrowState *pic;
100
101 MacIONVRAMState nvram;
102 MACIOIDEState ide[2];
103} OldWorldMacIOState;
104
105#define TYPE_NEWWORLD_MACIO "macio-newworld"
106#define NEWWORLD_MACIO(obj) \
107 OBJECT_CHECK(NewWorldMacIOState, (obj), TYPE_NEWWORLD_MACIO)
108
109typedef struct NewWorldMacIOState {
110
111 MacIOState parent_obj;
112
113
114 bool has_pmu;
115 bool has_adb;
116 OpenPICState *pic;
117 MACIOIDEState ide[2];
118 MacIOGPIOState gpio;
119} NewWorldMacIOState;
120
121#endif
122