xref: /openbmc/qemu/include/hw/misc/unimp.h (revision c2b38b27)
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 
11 #define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"
12 
13 /**
14  * create_unimplemented_device: create and map a dummy device
15  * @name: name of the device for debug logging
16  * @base: base address of the device's MMIO region
17  * @size: size of the device's MMIO region
18  *
19  * This utility function creates and maps an instance of unimplemented-device,
20  * which is a dummy device which simply logs all guest accesses to
21  * it via the qemu_log LOG_UNIMP debug log.
22  * The device is mapped at priority -1000, which means that you can
23  * use it to cover a large region and then map other devices on top of it
24  * if necessary.
25  */
26 static inline void create_unimplemented_device(const char *name,
27                                                hwaddr base,
28                                                hwaddr size)
29 {
30     DeviceState *dev = qdev_create(NULL, TYPE_UNIMPLEMENTED_DEVICE);
31 
32     qdev_prop_set_string(dev, "name", name);
33     qdev_prop_set_uint64(dev, "size", size);
34     qdev_init_nofail(dev);
35 
36     sysbus_mmio_map_overlap(SYS_BUS_DEVICE(dev), 0, base, -1000);
37 }
38 
39 #endif
40