2019-10-26 19:45:42 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013-2018 Laurent Vivier <laurent@vivier.eu>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HW_NUBUS_NUBUS_H
|
|
|
|
#define HW_NUBUS_NUBUS_H
|
|
|
|
|
|
|
|
#include "hw/qdev-properties.h"
|
2021-09-24 10:38:01 +03:00
|
|
|
#include "hw/sysbus.h"
|
2019-10-26 19:45:42 +03:00
|
|
|
#include "exec/address-spaces.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2021-09-24 10:37:59 +03:00
|
|
|
#include "qemu/units.h"
|
2019-10-26 19:45:42 +03:00
|
|
|
|
|
|
|
#define NUBUS_SUPER_SLOT_SIZE 0x10000000U
|
2021-09-24 10:37:52 +03:00
|
|
|
#define NUBUS_SUPER_SLOT_NB 0xe
|
2019-10-26 19:45:42 +03:00
|
|
|
|
2021-09-24 10:38:00 +03:00
|
|
|
#define NUBUS_SLOT_BASE (NUBUS_SUPER_SLOT_SIZE * \
|
|
|
|
(NUBUS_SUPER_SLOT_NB + 1))
|
|
|
|
|
2019-10-26 19:45:42 +03:00
|
|
|
#define NUBUS_SLOT_SIZE 0x01000000
|
2021-09-24 10:37:52 +03:00
|
|
|
#define NUBUS_FIRST_SLOT 0x0
|
|
|
|
#define NUBUS_LAST_SLOT 0xf
|
|
|
|
#define NUBUS_SLOT_NB (NUBUS_LAST_SLOT - NUBUS_FIRST_SLOT + 1)
|
2019-10-26 19:45:42 +03:00
|
|
|
|
2021-09-24 10:38:06 +03:00
|
|
|
#define NUBUS_IRQS 16
|
|
|
|
|
2019-10-26 19:45:42 +03:00
|
|
|
#define TYPE_NUBUS_DEVICE "nubus-device"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE)
|
2019-10-26 19:45:42 +03:00
|
|
|
|
|
|
|
#define TYPE_NUBUS_BUS "nubus-bus"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(NubusBus, NUBUS_BUS)
|
2019-10-26 19:45:42 +03:00
|
|
|
|
|
|
|
#define TYPE_NUBUS_BRIDGE "nubus-bridge"
|
2021-09-24 10:38:01 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(NubusBridge, NUBUS_BRIDGE);
|
2019-10-26 19:45:42 +03:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct NubusBus {
|
2019-10-26 19:45:42 +03:00
|
|
|
BusState qbus;
|
|
|
|
|
2021-09-24 10:38:00 +03:00
|
|
|
AddressSpace nubus_as;
|
|
|
|
MemoryRegion nubus_mr;
|
|
|
|
|
2019-10-26 19:45:42 +03:00
|
|
|
MemoryRegion super_slot_io;
|
|
|
|
MemoryRegion slot_io;
|
|
|
|
|
2021-09-24 10:37:52 +03:00
|
|
|
uint16_t slot_available_mask;
|
2021-09-24 10:38:06 +03:00
|
|
|
|
|
|
|
qemu_irq irqs[NUBUS_IRQS];
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2019-10-26 19:45:42 +03:00
|
|
|
|
2021-09-24 10:37:59 +03:00
|
|
|
#define NUBUS_DECL_ROM_MAX_SIZE (128 * KiB)
|
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct NubusDevice {
|
2019-10-26 19:45:42 +03:00
|
|
|
DeviceState qdev;
|
|
|
|
|
2021-09-24 10:37:52 +03:00
|
|
|
int32_t slot;
|
2021-09-24 10:37:51 +03:00
|
|
|
MemoryRegion super_slot_mem;
|
2019-10-26 19:45:42 +03:00
|
|
|
MemoryRegion slot_mem;
|
2021-09-24 10:37:59 +03:00
|
|
|
|
|
|
|
char *romfile;
|
|
|
|
MemoryRegion decl_rom;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2019-10-26 19:45:42 +03:00
|
|
|
|
2021-09-24 10:38:06 +03:00
|
|
|
void nubus_set_irq(NubusDevice *nd, int level);
|
|
|
|
|
2021-09-24 10:38:01 +03:00
|
|
|
struct NubusBridge {
|
|
|
|
SysBusDevice parent_obj;
|
2021-09-24 10:38:03 +03:00
|
|
|
|
2021-09-24 10:38:04 +03:00
|
|
|
NubusBus bus;
|
2021-09-24 10:38:01 +03:00
|
|
|
};
|
|
|
|
|
2019-10-26 19:45:42 +03:00
|
|
|
#endif
|