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 16 #define NUBUS_SUPER_SLOT_SIZE 0x10000000U 17 #define NUBUS_SUPER_SLOT_NB 0x9 18 19 #define NUBUS_SLOT_SIZE 0x01000000 20 #define NUBUS_SLOT_NB 0xF 21 22 #define NUBUS_FIRST_SLOT 0x9 23 #define NUBUS_LAST_SLOT 0xF 24 25 #define TYPE_NUBUS_DEVICE "nubus-device" 26 typedef struct NubusDevice NubusDevice; 27 DECLARE_INSTANCE_CHECKER(NubusDevice, NUBUS_DEVICE, 28 TYPE_NUBUS_DEVICE) 29 30 #define TYPE_NUBUS_BUS "nubus-bus" 31 typedef struct NubusBus NubusBus; 32 DECLARE_INSTANCE_CHECKER(NubusBus, NUBUS_BUS, 33 TYPE_NUBUS_BUS) 34 35 #define TYPE_NUBUS_BRIDGE "nubus-bridge" 36 37 struct NubusBus { 38 BusState qbus; 39 40 MemoryRegion super_slot_io; 41 MemoryRegion slot_io; 42 43 int current_slot; 44 }; 45 46 struct NubusDevice { 47 DeviceState qdev; 48 49 int slot_nb; 50 MemoryRegion slot_mem; 51 52 /* Format Block */ 53 54 MemoryRegion fblock_io; 55 56 uint32_t rom_length; 57 uint32_t rom_crc; 58 uint8_t rom_rev; 59 uint8_t rom_format; 60 uint8_t byte_lanes; 61 int32_t directory_offset; 62 63 /* ROM */ 64 65 MemoryRegion rom_io; 66 const uint8_t *rom; 67 }; 68 69 void nubus_register_rom(NubusDevice *dev, const uint8_t *rom, uint32_t size, 70 int revision, int format, uint8_t byte_lanes); 71 72 #endif 73