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