xref: /qemu/include/hw/nubus/nubus.h (revision 62437f90cf90d1a0fda855f17ca6d9e7c0204f92)
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 "exec/address-spaces.h"
14 #include "qom/object.h"
15 #include "qemu/units.h"
16 
17 #define NUBUS_SUPER_SLOT_SIZE 0x10000000U
18 #define NUBUS_SUPER_SLOT_NB   0xe
19 
20 #define NUBUS_SLOT_BASE       (NUBUS_SUPER_SLOT_SIZE * \
21                                (NUBUS_SUPER_SLOT_NB + 1))
22 
23 #define NUBUS_SLOT_SIZE       0x01000000
24 #define NUBUS_FIRST_SLOT      0x0
25 #define NUBUS_LAST_SLOT       0xf
26 #define NUBUS_SLOT_NB         (NUBUS_LAST_SLOT - NUBUS_FIRST_SLOT + 1)
27 
28 #define TYPE_NUBUS_DEVICE "nubus-device"
29 OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE)
30 
31 #define TYPE_NUBUS_BUS "nubus-bus"
32 OBJECT_DECLARE_SIMPLE_TYPE(NubusBus, NUBUS_BUS)
33 
34 #define TYPE_NUBUS_BRIDGE "nubus-bridge"
35 
36 struct NubusBus {
37     BusState qbus;
38 
39     AddressSpace nubus_as;
40     MemoryRegion nubus_mr;
41 
42     MemoryRegion super_slot_io;
43     MemoryRegion slot_io;
44 
45     uint16_t slot_available_mask;
46 };
47 
48 #define NUBUS_DECL_ROM_MAX_SIZE    (128 * KiB)
49 
50 struct NubusDevice {
51     DeviceState qdev;
52 
53     int32_t slot;
54     MemoryRegion super_slot_mem;
55     MemoryRegion slot_mem;
56 
57     char *romfile;
58     MemoryRegion decl_rom;
59 };
60 
61 #endif
62