/* AUTOMATICALLY GENERATED by qapi-gen.py DO NOT MODIFY */

/*
 * Schema-defined QAPI types
 *
 * Copyright IBM, Corp. 2011
 * Copyright (c) 2013-2018 Red Hat Inc.
 *
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
 * See the COPYING.LIB file in the top-level directory.
 */

#ifndef QAPI_TYPES_MISC_I386_H
#define QAPI_TYPES_MISC_I386_H

#include "qapi/qapi-builtin-types.h"

typedef enum SevState {
    SEV_STATE_UNINIT,
    SEV_STATE_LAUNCH_UPDATE,
    SEV_STATE_LAUNCH_SECRET,
    SEV_STATE_RUNNING,
    SEV_STATE_SEND_UPDATE,
    SEV_STATE_RECEIVE_UPDATE,
    SEV_STATE__MAX,
} SevState;

#define SevState_str(val) \
    qapi_enum_lookup(&SevState_lookup, (val))

extern const QEnumLookup SevState_lookup;

typedef enum SevGuestType {
    SEV_GUEST_TYPE_SEV,
    SEV_GUEST_TYPE_SEV_SNP,
    SEV_GUEST_TYPE__MAX,
} SevGuestType;

#define SevGuestType_str(val) \
    qapi_enum_lookup(&SevGuestType_lookup, (val))

extern const QEnumLookup SevGuestType_lookup;

typedef struct SevGuestInfo SevGuestInfo;

typedef struct SevSnpGuestInfo SevSnpGuestInfo;

typedef struct q_obj_SevInfo_base q_obj_SevInfo_base;

typedef struct SevInfo SevInfo;

typedef struct SevLaunchMeasureInfo SevLaunchMeasureInfo;

typedef struct SevCapability SevCapability;

typedef struct q_obj_sev_inject_launch_secret_arg q_obj_sev_inject_launch_secret_arg;

typedef struct SevAttestationReport SevAttestationReport;

typedef struct q_obj_query_sev_attestation_report_arg q_obj_query_sev_attestation_report_arg;

typedef struct SgxEpcSection SgxEpcSection;

typedef struct SgxEpcSectionList SgxEpcSectionList;

typedef struct SgxInfo SgxInfo;

typedef enum EvtchnPortType {
    EVTCHN_PORT_TYPE_CLOSED,
    EVTCHN_PORT_TYPE_UNBOUND,
    EVTCHN_PORT_TYPE_INTERDOMAIN,
    EVTCHN_PORT_TYPE_PIRQ,
    EVTCHN_PORT_TYPE_VIRQ,
    EVTCHN_PORT_TYPE_IPI,
    EVTCHN_PORT_TYPE__MAX,
} EvtchnPortType;

#define EvtchnPortType_str(val) \
    qapi_enum_lookup(&EvtchnPortType_lookup, (val))

extern const QEnumLookup EvtchnPortType_lookup;

typedef struct EvtchnInfo EvtchnInfo;

typedef struct EvtchnInfoList EvtchnInfoList;

typedef struct q_obj_xen_event_inject_arg q_obj_xen_event_inject_arg;

struct SevGuestInfo {
    uint32_t policy;
    uint32_t handle;
};

void qapi_free_SevGuestInfo(SevGuestInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevGuestInfo, qapi_free_SevGuestInfo)

struct SevSnpGuestInfo {
    uint64_t snp_policy;
};

void qapi_free_SevSnpGuestInfo(SevSnpGuestInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevSnpGuestInfo, qapi_free_SevSnpGuestInfo)

struct q_obj_SevInfo_base {
    bool enabled;
    uint8_t api_major;
    uint8_t api_minor;
    uint8_t build_id;
    SevState state;
    SevGuestType sev_type;
};

struct SevInfo {
    bool enabled;
    uint8_t api_major;
    uint8_t api_minor;
    uint8_t build_id;
    SevState state;
    SevGuestType sev_type;
    union { /* union tag is @sev_type */
        SevGuestInfo sev;
        SevSnpGuestInfo sev_snp;
    } u;
};

void qapi_free_SevInfo(SevInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevInfo, qapi_free_SevInfo)

struct SevLaunchMeasureInfo {
    char *data;
};

void qapi_free_SevLaunchMeasureInfo(SevLaunchMeasureInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevLaunchMeasureInfo, qapi_free_SevLaunchMeasureInfo)

struct SevCapability {
    char *pdh;
    char *cert_chain;
    char *cpu0_id;
    int64_t cbitpos;
    int64_t reduced_phys_bits;
};

void qapi_free_SevCapability(SevCapability *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevCapability, qapi_free_SevCapability)

struct q_obj_sev_inject_launch_secret_arg {
    char *packet_header;
    char *secret;
    bool has_gpa;
    uint64_t gpa;
};

struct SevAttestationReport {
    char *data;
};

void qapi_free_SevAttestationReport(SevAttestationReport *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SevAttestationReport, qapi_free_SevAttestationReport)

struct q_obj_query_sev_attestation_report_arg {
    char *mnonce;
};

struct SgxEpcSection {
    int64_t node;
    uint64_t size;
};

void qapi_free_SgxEpcSection(SgxEpcSection *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SgxEpcSection, qapi_free_SgxEpcSection)

struct SgxEpcSectionList {
    SgxEpcSectionList *next;
    SgxEpcSection *value;
};

void qapi_free_SgxEpcSectionList(SgxEpcSectionList *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SgxEpcSectionList, qapi_free_SgxEpcSectionList)

struct SgxInfo {
    bool sgx;
    bool sgx1;
    bool sgx2;
    bool flc;
    SgxEpcSectionList *sections;
};

void qapi_free_SgxInfo(SgxInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SgxInfo, qapi_free_SgxInfo)

struct EvtchnInfo {
    uint16_t port;
    uint32_t vcpu;
    EvtchnPortType type;
    char *remote_domain;
    uint16_t target;
    bool pending;
    bool masked;
};

void qapi_free_EvtchnInfo(EvtchnInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(EvtchnInfo, qapi_free_EvtchnInfo)

struct EvtchnInfoList {
    EvtchnInfoList *next;
    EvtchnInfo *value;
};

void qapi_free_EvtchnInfoList(EvtchnInfoList *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(EvtchnInfoList, qapi_free_EvtchnInfoList)

struct q_obj_xen_event_inject_arg {
    uint32_t port;
};

#endif /* QAPI_TYPES_MISC_I386_H */
