xref: /qemu/include/hw/misc/macio/macio.h (revision 9277d81f)
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 
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 #define TYPE_MACIO "macio"
38 #define MACIO(obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO)
39 
40 typedef struct MacIOState {
41     /*< private >*/
42     PCIDevice parent;
43     /*< public >*/
44 
45     MemoryRegion bar;
46     CUDAState cuda;
47     PMUState pmu;
48     DBDMAState dbdma;
49     ESCCState escc;
50     uint64_t frequency;
51 } MacIOState;
52 
53 #define TYPE_OLDWORLD_MACIO "macio-oldworld"
54 #define OLDWORLD_MACIO(obj) \
55     OBJECT_CHECK(OldWorldMacIOState, (obj), TYPE_OLDWORLD_MACIO)
56 
57 typedef struct OldWorldMacIOState {
58     /*< private >*/
59     MacIOState parent_obj;
60     /*< public >*/
61 
62     HeathrowState *pic;
63 
64     MacIONVRAMState nvram;
65     MACIOIDEState ide[2];
66 } OldWorldMacIOState;
67 
68 #define TYPE_NEWWORLD_MACIO "macio-newworld"
69 #define NEWWORLD_MACIO(obj) \
70     OBJECT_CHECK(NewWorldMacIOState, (obj), TYPE_NEWWORLD_MACIO)
71 
72 typedef struct NewWorldMacIOState {
73     /*< private >*/
74     MacIOState parent_obj;
75     /*< public >*/
76 
77     bool has_pmu;
78     bool has_adb;
79     OpenPICState *pic;
80     MACIOIDEState ide[2];
81     MacIOGPIOState gpio;
82 } NewWorldMacIOState;
83 
84 #endif /* MACIO_H */
85