]>
Commit | Line | Data |
---|---|---|
e1218e48 MCA |
1 | /* |
2 | * PowerMac MacIO device emulation | |
3 | * | |
4 | * Copyright (c) 2005-2007 Fabrice Bellard | |
5 | * Copyright (c) 2007 Jocelyn Mayer | |
6 | * | |
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
8 | * of this software and associated documentation files (the "Software"), to deal | |
9 | * in the Software without restriction, including without limitation the rights | |
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
11 | * copies of the Software, and to permit persons to whom the Software is | |
12 | * furnished to do so, subject to the following conditions: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
23 | * THE SOFTWARE. | |
24 | */ | |
25 | ||
26 | #ifndef MACIO_H | |
27 | #define MACIO_H | |
28 | ||
7c4166a9 | 29 | #include "hw/char/escc.h" |
5a6ac100 | 30 | #include "hw/pci/pci.h" |
ec150c7e | 31 | #include "hw/ide/internal.h" |
017812df | 32 | #include "hw/intc/heathrow_pic.h" |
e1218e48 | 33 | #include "hw/misc/macio/cuda.h" |
7c4166a9 | 34 | #include "hw/misc/macio/gpio.h" |
d811d61f | 35 | #include "hw/misc/macio/pmu.h" |
ec150c7e | 36 | #include "hw/ppc/mac.h" |
e1218e48 | 37 | #include "hw/ppc/mac_dbdma.h" |
dda12e9a | 38 | #include "hw/ppc/openpic.h" |
db1015e9 | 39 | #include "qom/object.h" |
e1218e48 | 40 | |
bf31c56f MCA |
41 | /* MacIO virtual bus */ |
42 | #define TYPE_MACIO_BUS "macio-bus" | |
db1015e9 | 43 | typedef struct MacIOBusState MacIOBusState; |
8110fa1d EH |
44 | DECLARE_INSTANCE_CHECKER(MacIOBusState, MACIO_BUS, |
45 | TYPE_MACIO_BUS) | |
bf31c56f | 46 | |
db1015e9 | 47 | struct MacIOBusState { |
bf31c56f MCA |
48 | /*< private >*/ |
49 | BusState parent_obj; | |
db1015e9 | 50 | }; |
bf31c56f | 51 | |
9b164a46 MCA |
52 | /* MacIO IDE */ |
53 | #define TYPE_MACIO_IDE "macio-ide" | |
db1015e9 | 54 | typedef struct MACIOIDEState MACIOIDEState; |
8110fa1d EH |
55 | DECLARE_INSTANCE_CHECKER(MACIOIDEState, MACIO_IDE, |
56 | TYPE_MACIO_IDE) | |
9b164a46 | 57 | |
db1015e9 | 58 | struct MACIOIDEState { |
9b164a46 MCA |
59 | /*< private >*/ |
60 | SysBusDevice parent_obj; | |
61 | /*< public >*/ | |
5c8e3d17 | 62 | uint32_t addr; |
9b164a46 MCA |
63 | uint32_t channel; |
64 | qemu_irq real_ide_irq; | |
65 | qemu_irq real_dma_irq; | |
66 | qemu_irq ide_irq; | |
67 | qemu_irq dma_irq; | |
68 | ||
69 | MemoryRegion mem; | |
70 | IDEBus bus; | |
71 | IDEDMA dma; | |
72 | void *dbdma; | |
73 | bool dma_active; | |
74 | uint32_t timing_reg; | |
75 | uint32_t irq_reg; | |
db1015e9 | 76 | }; |
9b164a46 MCA |
77 | |
78 | void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); | |
79 | void macio_ide_register_dma(MACIOIDEState *ide); | |
80 | ||
e1218e48 | 81 | #define TYPE_MACIO "macio" |
db1015e9 | 82 | typedef struct MacIOState MacIOState; |
8110fa1d EH |
83 | DECLARE_INSTANCE_CHECKER(MacIOState, MACIO, |
84 | TYPE_MACIO) | |
e1218e48 | 85 | |
db1015e9 | 86 | struct MacIOState { |
e1218e48 MCA |
87 | /*< private >*/ |
88 | PCIDevice parent; | |
89 | /*< public >*/ | |
90 | ||
bf31c56f | 91 | MacIOBusState macio_bus; |
e1218e48 MCA |
92 | MemoryRegion bar; |
93 | CUDAState cuda; | |
d811d61f | 94 | PMUState pmu; |
e1218e48 MCA |
95 | DBDMAState dbdma; |
96 | ESCCState escc; | |
e1218e48 | 97 | uint64_t frequency; |
db1015e9 | 98 | }; |
e1218e48 MCA |
99 | |
100 | #define TYPE_OLDWORLD_MACIO "macio-oldworld" | |
db1015e9 | 101 | typedef struct OldWorldMacIOState OldWorldMacIOState; |
8110fa1d EH |
102 | DECLARE_INSTANCE_CHECKER(OldWorldMacIOState, OLDWORLD_MACIO, |
103 | TYPE_OLDWORLD_MACIO) | |
e1218e48 | 104 | |
db1015e9 | 105 | struct OldWorldMacIOState { |
e1218e48 MCA |
106 | /*< private >*/ |
107 | MacIOState parent_obj; | |
108 | /*< public >*/ | |
109 | ||
017812df | 110 | HeathrowState *pic; |
e1218e48 MCA |
111 | |
112 | MacIONVRAMState nvram; | |
113 | MACIOIDEState ide[2]; | |
db1015e9 | 114 | }; |
e1218e48 MCA |
115 | |
116 | #define TYPE_NEWWORLD_MACIO "macio-newworld" | |
db1015e9 | 117 | typedef struct NewWorldMacIOState NewWorldMacIOState; |
8110fa1d EH |
118 | DECLARE_INSTANCE_CHECKER(NewWorldMacIOState, NEWWORLD_MACIO, |
119 | TYPE_NEWWORLD_MACIO) | |
e1218e48 | 120 | |
db1015e9 | 121 | struct NewWorldMacIOState { |
e1218e48 MCA |
122 | /*< private >*/ |
123 | MacIOState parent_obj; | |
124 | /*< public >*/ | |
dda12e9a | 125 | |
f1114c17 MCA |
126 | bool has_pmu; |
127 | bool has_adb; | |
dda12e9a | 128 | OpenPICState *pic; |
e1218e48 | 129 | MACIOIDEState ide[2]; |
7c4166a9 | 130 | MacIOGPIOState gpio; |
db1015e9 | 131 | }; |
e1218e48 MCA |
132 | |
133 | #endif /* MACIO_H */ |