xref: /openbmc/qemu/include/hw/nubus/nubus.h (revision 6a02465f)
1 /*
2  * Copyright (c) 2013-2018 Laurent Vivier <laurent@vivier.eu>
3  *
4  * This work is licensed under the terms of the GNU GPL, version 2 or later.
5  * See the COPYING file in the top-level directory.
6  *
7  */
8 
9 #ifndef HW_NUBUS_NUBUS_H
10 #define HW_NUBUS_NUBUS_H
11 
12 #include "hw/qdev-properties.h"
13 #include "hw/sysbus.h"
14 #include "exec/address-spaces.h"
15 #include "qom/object.h"
16 #include "qemu/units.h"
17 
18 #define NUBUS_SUPER_SLOT_SIZE 0x10000000U
19 #define NUBUS_SUPER_SLOT_NB   0xe
20 
21 #define NUBUS_SLOT_BASE       (NUBUS_SUPER_SLOT_SIZE * \
22                                (NUBUS_SUPER_SLOT_NB + 1))
23 
24 #define NUBUS_SLOT_SIZE       0x01000000
25 #define NUBUS_FIRST_SLOT      0x0
26 #define NUBUS_LAST_SLOT       0xf
27 #define NUBUS_SLOT_NB         (NUBUS_LAST_SLOT - NUBUS_FIRST_SLOT + 1)
28 
29 #define NUBUS_IRQS            16
30 
31 #define TYPE_NUBUS_DEVICE "nubus-device"
32 OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE)
33 
34 #define TYPE_NUBUS_BUS "nubus-bus"
35 OBJECT_DECLARE_SIMPLE_TYPE(NubusBus, NUBUS_BUS)
36 
37 #define TYPE_NUBUS_BRIDGE "nubus-bridge"
38 OBJECT_DECLARE_SIMPLE_TYPE(NubusBridge, NUBUS_BRIDGE);
39 
40 struct NubusBus {
41     BusState qbus;
42 
43     AddressSpace nubus_as;
44     MemoryRegion nubus_mr;
45 
46     MemoryRegion super_slot_io;
47     MemoryRegion slot_io;
48 
49     uint16_t slot_available_mask;
50 
51     qemu_irq irqs[NUBUS_IRQS];
52 };
53 
54 #define NUBUS_DECL_ROM_MAX_SIZE    (1 * MiB)
55 
56 struct NubusDevice {
57     DeviceState qdev;
58 
59     int32_t slot;
60     MemoryRegion super_slot_mem;
61     MemoryRegion slot_mem;
62 
63     char *romfile;
64     MemoryRegion decl_rom;
65 };
66 
67 void nubus_set_irq(NubusDevice *nd, int level);
68 
69 struct NubusBridge {
70     SysBusDevice parent_obj;
71 
72     NubusBus bus;
73 };
74 
75 #endif
76