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