1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef QEMU_PC_DIMM_H
17#define QEMU_PC_DIMM_H
18
19#include "exec/memory.h"
20#include "hw/qdev-core.h"
21
22#define TYPE_PC_DIMM "pc-dimm"
23#define PC_DIMM(obj) \
24 OBJECT_CHECK(PCDIMMDevice, (obj), TYPE_PC_DIMM)
25#define PC_DIMM_CLASS(oc) \
26 OBJECT_CLASS_CHECK(PCDIMMDeviceClass, (oc), TYPE_PC_DIMM)
27#define PC_DIMM_GET_CLASS(obj) \
28 OBJECT_GET_CLASS(PCDIMMDeviceClass, (obj), TYPE_PC_DIMM)
29
30#define PC_DIMM_ADDR_PROP "addr"
31#define PC_DIMM_SLOT_PROP "slot"
32#define PC_DIMM_NODE_PROP "node"
33#define PC_DIMM_SIZE_PROP "size"
34#define PC_DIMM_MEMDEV_PROP "memdev"
35
36#define PC_DIMM_UNASSIGNED_SLOT -1
37
38
39
40
41
42
43
44
45
46
47typedef struct PCDIMMDevice {
48
49 DeviceState parent_obj;
50
51
52 uint64_t addr;
53 uint32_t node;
54 int32_t slot;
55 HostMemoryBackend *hostmem;
56} PCDIMMDevice;
57
58
59
60
61
62
63
64
65
66typedef struct PCDIMMDeviceClass {
67
68 DeviceClass parent_class;
69
70
71 void (*realize)(PCDIMMDevice *dimm, Error **errp);
72 MemoryRegion *(*get_vmstate_memory_region)(PCDIMMDevice *dimm,
73 Error **errp);
74} PCDIMMDeviceClass;
75
76void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine,
77 const uint64_t *legacy_align, Error **errp);
78void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp);
79void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine);
80#endif
81