In my "build everything" tree, changing hw/qdev-properties.h triggers a recompile of some 2700 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h). Many places including hw/qdev-properties.h (directly or via hw/qdev.h) actually need only hw/qdev-core.h. Include hw/qdev-core.h there instead. hw/qdev.h is actually pointless: all it does is include hw/qdev-core.h and hw/qdev-properties.h, which in turn includes hw/qdev-core.h. Replace the remaining uses of hw/qdev.h by hw/qdev-properties.h. While there, delete a few superfluous inclusions of hw/qdev-core.h. Touching hw/qdev-properties.h now recompiles some 1200 objects. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Daniel P. Berrangé" <berrange@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20190812052359.30071-22-armbru@redhat.com>
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * "Unimplemented" device
 | 
						|
 *
 | 
						|
 * Copyright Linaro Limited, 2017
 | 
						|
 * Written by Peter Maydell
 | 
						|
 */
 | 
						|
 | 
						|
#ifndef HW_MISC_UNIMP_H
 | 
						|
#define HW_MISC_UNIMP_H
 | 
						|
 | 
						|
#include "hw/qdev-properties.h"
 | 
						|
#include "hw/sysbus.h"
 | 
						|
 | 
						|
#define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"
 | 
						|
 | 
						|
#define UNIMPLEMENTED_DEVICE(obj) \
 | 
						|
    OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE)
 | 
						|
 | 
						|
typedef struct {
 | 
						|
    SysBusDevice parent_obj;
 | 
						|
    MemoryRegion iomem;
 | 
						|
    char *name;
 | 
						|
    uint64_t size;
 | 
						|
} UnimplementedDeviceState;
 | 
						|
 | 
						|
/**
 | 
						|
 * create_unimplemented_device: create and map a dummy device
 | 
						|
 * @name: name of the device for debug logging
 | 
						|
 * @base: base address of the device's MMIO region
 | 
						|
 * @size: size of the device's MMIO region
 | 
						|
 *
 | 
						|
 * This utility function creates and maps an instance of unimplemented-device,
 | 
						|
 * which is a dummy device which simply logs all guest accesses to
 | 
						|
 * it via the qemu_log LOG_UNIMP debug log.
 | 
						|
 * The device is mapped at priority -1000, which means that you can
 | 
						|
 * use it to cover a large region and then map other devices on top of it
 | 
						|
 * if necessary.
 | 
						|
 */
 | 
						|
static inline void create_unimplemented_device(const char *name,
 | 
						|
                                               hwaddr base,
 | 
						|
                                               hwaddr size)
 | 
						|
{
 | 
						|
    DeviceState *dev = qdev_create(NULL, TYPE_UNIMPLEMENTED_DEVICE);
 | 
						|
 | 
						|
    qdev_prop_set_string(dev, "name", name);
 | 
						|
    qdev_prop_set_uint64(dev, "size", size);
 | 
						|
    qdev_init_nofail(dev);
 | 
						|
 | 
						|
    sysbus_mmio_map_overlap(SYS_BUS_DEVICE(dev), 0, base, -1000);
 | 
						|
}
 | 
						|
 | 
						|
#endif
 |