]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/misc/unimp.h
Include qemu/main-loop.h less
[mirror_qemu.git] / include / hw / misc / unimp.h
CommitLineData
f5095aa3
PM
1/*
2 * "Unimplemented" device
3 *
4 * Copyright Linaro Limited, 2017
5 * Written by Peter Maydell
6 */
7
8#ifndef HW_MISC_UNIMP_H
9#define HW_MISC_UNIMP_H
10
8f7b1bd6
PMD
11#include "hw/sysbus.h"
12
f5095aa3
PM
13#define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"
14
a7bc4ee5
PM
15#define UNIMPLEMENTED_DEVICE(obj) \
16 OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE)
17
18typedef struct {
19 SysBusDevice parent_obj;
20 MemoryRegion iomem;
21 char *name;
22 uint64_t size;
23} UnimplementedDeviceState;
24
f5095aa3
PM
25/**
26 * create_unimplemented_device: create and map a dummy device
27 * @name: name of the device for debug logging
28 * @base: base address of the device's MMIO region
29 * @size: size of the device's MMIO region
30 *
31 * This utility function creates and maps an instance of unimplemented-device,
32 * which is a dummy device which simply logs all guest accesses to
33 * it via the qemu_log LOG_UNIMP debug log.
34 * The device is mapped at priority -1000, which means that you can
35 * use it to cover a large region and then map other devices on top of it
36 * if necessary.
37 */
38static inline void create_unimplemented_device(const char *name,
39 hwaddr base,
40 hwaddr size)
41{
42 DeviceState *dev = qdev_create(NULL, TYPE_UNIMPLEMENTED_DEVICE);
43
44 qdev_prop_set_string(dev, "name", name);
45 qdev_prop_set_uint64(dev, "size", size);
46 qdev_init_nofail(dev);
47
48 sysbus_mmio_map_overlap(SYS_BUS_DEVICE(dev), 0, base, -1000);
49}
50
51#endif