1 /* 2 * Virtual Machine coreinfo device 3 * 4 * Copyright (C) 2017 Red Hat, Inc. 5 * 6 * Authors: Marc-André Lureau <marcandre.lureau@redhat.com> 7 * 8 * This work is licensed under the terms of the GNU GPL, version 2 or later. 9 * See the COPYING file in the top-level directory. 10 * 11 */ 12 #ifndef VMCOREINFO_H 13 #define VMCOREINFO_H 14 15 #include "hw/qdev-core.h" 16 #include "standard-headers/linux/qemu_fw_cfg.h" 17 #include "qom/object.h" 18 19 #define TYPE_VMCOREINFO "vmcoreinfo" 20 typedef struct VMCoreInfoState VMCoreInfoState; 21 DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO, TYPE_VMCOREINFO) 22 23 typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo; 24 25 struct VMCoreInfoState { 26 DeviceState parent_obj; 27 28 bool has_vmcoreinfo; 29 FWCfgVMCoreInfo vmcoreinfo; 30 }; 31 32 /* returns NULL unless there is exactly one device */ 33 static inline VMCoreInfoState *vmcoreinfo_find(void) 34 { 35 Object *o = object_resolve_path_type("", TYPE_VMCOREINFO, NULL); 36 37 return o ? VMCOREINFO(o) : NULL; 38 } 39 40 #endif 41