xref: /openbmc/qemu/include/hw/nubus/nubus.h (revision 62437f90)
1fa2ba3b8SLaurent Vivier /*
2fa2ba3b8SLaurent Vivier  * Copyright (c) 2013-2018 Laurent Vivier <laurent@vivier.eu>
3fa2ba3b8SLaurent Vivier  *
4fa2ba3b8SLaurent Vivier  * This work is licensed under the terms of the GNU GPL, version 2 or later.
5fa2ba3b8SLaurent Vivier  * See the COPYING file in the top-level directory.
6fa2ba3b8SLaurent Vivier  *
7fa2ba3b8SLaurent Vivier  */
8fa2ba3b8SLaurent Vivier 
9fa2ba3b8SLaurent Vivier #ifndef HW_NUBUS_NUBUS_H
10fa2ba3b8SLaurent Vivier #define HW_NUBUS_NUBUS_H
11fa2ba3b8SLaurent Vivier 
12fa2ba3b8SLaurent Vivier #include "hw/qdev-properties.h"
13fa2ba3b8SLaurent Vivier #include "exec/address-spaces.h"
14db1015e9SEduardo Habkost #include "qom/object.h"
153616f424SMark Cave-Ayland #include "qemu/units.h"
16fa2ba3b8SLaurent Vivier 
17fa2ba3b8SLaurent Vivier #define NUBUS_SUPER_SLOT_SIZE 0x10000000U
1803deab99SMark Cave-Ayland #define NUBUS_SUPER_SLOT_NB   0xe
19fa2ba3b8SLaurent Vivier 
20*62437f90SMark Cave-Ayland #define NUBUS_SLOT_BASE       (NUBUS_SUPER_SLOT_SIZE * \
21*62437f90SMark Cave-Ayland                                (NUBUS_SUPER_SLOT_NB + 1))
22*62437f90SMark Cave-Ayland 
23fa2ba3b8SLaurent Vivier #define NUBUS_SLOT_SIZE       0x01000000
2403deab99SMark Cave-Ayland #define NUBUS_FIRST_SLOT      0x0
2503deab99SMark Cave-Ayland #define NUBUS_LAST_SLOT       0xf
2603deab99SMark Cave-Ayland #define NUBUS_SLOT_NB         (NUBUS_LAST_SLOT - NUBUS_FIRST_SLOT + 1)
27fa2ba3b8SLaurent Vivier 
28fa2ba3b8SLaurent Vivier #define TYPE_NUBUS_DEVICE "nubus-device"
298063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE)
30fa2ba3b8SLaurent Vivier 
31fa2ba3b8SLaurent Vivier #define TYPE_NUBUS_BUS "nubus-bus"
328063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(NubusBus, NUBUS_BUS)
33fa2ba3b8SLaurent Vivier 
34fa2ba3b8SLaurent Vivier #define TYPE_NUBUS_BRIDGE "nubus-bridge"
35fa2ba3b8SLaurent Vivier 
36db1015e9SEduardo Habkost struct NubusBus {
37fa2ba3b8SLaurent Vivier     BusState qbus;
38fa2ba3b8SLaurent Vivier 
39*62437f90SMark Cave-Ayland     AddressSpace nubus_as;
40*62437f90SMark Cave-Ayland     MemoryRegion nubus_mr;
41*62437f90SMark Cave-Ayland 
42fa2ba3b8SLaurent Vivier     MemoryRegion super_slot_io;
43fa2ba3b8SLaurent Vivier     MemoryRegion slot_io;
44fa2ba3b8SLaurent Vivier 
4503deab99SMark Cave-Ayland     uint16_t slot_available_mask;
46db1015e9SEduardo Habkost };
47fa2ba3b8SLaurent Vivier 
483616f424SMark Cave-Ayland #define NUBUS_DECL_ROM_MAX_SIZE    (128 * KiB)
493616f424SMark Cave-Ayland 
50db1015e9SEduardo Habkost struct NubusDevice {
51fa2ba3b8SLaurent Vivier     DeviceState qdev;
52fa2ba3b8SLaurent Vivier 
5303deab99SMark Cave-Ayland     int32_t slot;
5490be1deaSMark Cave-Ayland     MemoryRegion super_slot_mem;
55fa2ba3b8SLaurent Vivier     MemoryRegion slot_mem;
563616f424SMark Cave-Ayland 
573616f424SMark Cave-Ayland     char *romfile;
583616f424SMark Cave-Ayland     MemoryRegion decl_rom;
59db1015e9SEduardo Habkost };
60fa2ba3b8SLaurent Vivier 
61fa2ba3b8SLaurent Vivier #endif
62