2 * Memory Device Interface
4 * Copyright (c) 2018 Red Hat, Inc.
7 * David Hildenbrand <david@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #ifndef MEMORY_DEVICE_H
14 #define MEMORY_DEVICE_H
16 #include "qom/object.h"
19 #define TYPE_MEMORY_DEVICE "memory-device"
21 #define MEMORY_DEVICE_CLASS(klass) \
22 OBJECT_CLASS_CHECK(MemoryDeviceClass, (klass), TYPE_MEMORY_DEVICE)
23 #define MEMORY_DEVICE_GET_CLASS(obj) \
24 OBJECT_GET_CLASS(MemoryDeviceClass, (obj), TYPE_MEMORY_DEVICE)
25 #define MEMORY_DEVICE(obj) \
26 INTERFACE_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE)
28 typedef struct MemoryDeviceState
{
32 typedef struct MemoryDeviceClass
{
33 InterfaceClass parent_class
;
35 uint64_t (*get_addr
)(const MemoryDeviceState
*md
);
36 uint64_t (*get_plugged_size
)(const MemoryDeviceState
*md
);
37 uint64_t (*get_region_size
)(const MemoryDeviceState
*md
);
38 void (*fill_device_info
)(const MemoryDeviceState
*md
,
39 MemoryDeviceInfo
*info
);
42 MemoryDeviceInfoList
*qmp_memory_device_list(void);
43 uint64_t get_plugged_memory_size(void);
44 uint64_t memory_device_get_free_addr(MachineState
*ms
, const uint64_t *hint
,
45 uint64_t align
, uint64_t size
,
47 void memory_device_plug_region(MachineState
*ms
, MemoryRegion
*mr
,
49 void memory_device_unplug_region(MachineState
*ms
, MemoryRegion
*mr
);