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 TYPE_NUBUS_DEVICE "nubus-device" 30 OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE) 31 32 #define TYPE_NUBUS_BUS "nubus-bus" 33 OBJECT_DECLARE_SIMPLE_TYPE(NubusBus, NUBUS_BUS) 34 35 #define TYPE_NUBUS_BRIDGE "nubus-bridge" 36 OBJECT_DECLARE_SIMPLE_TYPE(NubusBridge, NUBUS_BRIDGE); 37 38 struct NubusBus { 39 BusState qbus; 40 41 AddressSpace nubus_as; 42 MemoryRegion nubus_mr; 43 44 MemoryRegion super_slot_io; 45 MemoryRegion slot_io; 46 47 uint16_t slot_available_mask; 48 }; 49 50 #define NUBUS_DECL_ROM_MAX_SIZE (128 * KiB) 51 52 struct NubusDevice { 53 DeviceState qdev; 54 55 int32_t slot; 56 MemoryRegion super_slot_mem; 57 MemoryRegion slot_mem; 58 59 char *romfile; 60 MemoryRegion decl_rom; 61 }; 62 63 struct NubusBridge { 64 SysBusDevice parent_obj; 65 }; 66 67 #endif 68