
#ifndef _G_HOST_ENG_NVOC_H_
#define _G_HOST_ENG_NVOC_H_

// Version of generated metadata structures
#ifdef NVOC_METADATA_VERSION
#undef NVOC_METADATA_VERSION
#endif
#define NVOC_METADATA_VERSION 2

#include "nvoc/runtime.h"
#include "nvoc/rtti.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
 * SPDX-FileCopyrightText: Copyright (c) 2013-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

#pragma once
#include "g_host_eng_nvoc.h"

#ifndef HOST_ENG_H
#define HOST_ENG_H

/*!
 * @file   host_eng.h
 * @brief  Provides definitions for all OBJHOSTENG data structures and interfaces.
 */

#include "core/core.h"
#include "gpu/gpu_timeout.h"

#include "kernel/gpu/fifo/kernel_channel.h"

/*!
 * Interface class for all Hosteng modules.
 */

// Private field names are wrapped in PRIVATE_FIELD, which does nothing for
// the matching C source file, but causes diagnostics to be issued if another
// source file references the field.
#ifdef NVOC_HOST_ENG_H_PRIVATE_ACCESS_ALLOWED
#define PRIVATE_FIELD(x) x
#else
#define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
#endif


// Metadata with per-class RTTI and vtable
struct NVOC_METADATA__OBJHOSTENG;
struct NVOC_VTABLE__OBJHOSTENG;


struct OBJHOSTENG {

    // Metadata starts with RTTI structure.
    union {
         const struct NVOC_METADATA__OBJHOSTENG *__nvoc_metadata_ptr;
         const struct NVOC_RTTI *__nvoc_rtti;
    };

    // Ancestor object pointers for `staticCast` feature
    struct OBJHOSTENG *__nvoc_pbase_OBJHOSTENG;    // hosteng

    // 1 PDB property
    NvBool PDB_PROP_HOSTENG_ENSURE_HALT_SUCCEEDS_BEFORE_RESET;

    // Data members
    NvBool bHostengHaltBeforeResetFailed;
};


// Vtable with 1 per-class function pointer
struct NVOC_VTABLE__OBJHOSTENG {
    NV_STATUS (*__hostengHaltAndReset__)(struct OBJGPU *, struct OBJHOSTENG * /*this*/, FIFO_CHANNEL_INFO, RMTIMEOUT *);  // virtual
};

// Metadata with per-class RTTI and vtable
struct NVOC_METADATA__OBJHOSTENG {
    const struct NVOC_RTTI rtti;
    const struct NVOC_VTABLE__OBJHOSTENG vtable;
};

#ifndef __nvoc_class_id_OBJHOSTENG
#define __nvoc_class_id_OBJHOSTENG 0xb356e7u
typedef struct OBJHOSTENG OBJHOSTENG;
#endif /* __nvoc_class_id_OBJHOSTENG */

// Casting support
extern const struct NVOC_CLASS_DEF __nvoc_class_def_OBJHOSTENG;

#define __staticCast_OBJHOSTENG(pThis) \
    ((pThis)->__nvoc_pbase_OBJHOSTENG)

#ifdef __nvoc_host_eng_h_disabled
#define __dynamicCast_OBJHOSTENG(pThis) ((OBJHOSTENG*) NULL)
#else //__nvoc_host_eng_h_disabled
#define __dynamicCast_OBJHOSTENG(pThis) \
    ((OBJHOSTENG*) __nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(OBJHOSTENG)))
#endif //__nvoc_host_eng_h_disabled

// Property macros
#define PDB_PROP_HOSTENG_ENSURE_HALT_SUCCEEDS_BEFORE_RESET_BASE_CAST
#define PDB_PROP_HOSTENG_ENSURE_HALT_SUCCEEDS_BEFORE_RESET_BASE_NAME PDB_PROP_HOSTENG_ENSURE_HALT_SUCCEEDS_BEFORE_RESET


NV_STATUS __nvoc_objCreateDynamic_OBJHOSTENG(OBJHOSTENG**, Dynamic*, NvU32, va_list);

NV_STATUS __nvoc_objCreate_OBJHOSTENG(OBJHOSTENG**, Dynamic*, NvU32);
#define __objCreate_OBJHOSTENG(__nvoc_ppNewObj, __nvoc_pParent, __nvoc_createFlags) \
    __nvoc_objCreate_OBJHOSTENG((__nvoc_ppNewObj), staticCast((__nvoc_pParent), Dynamic), (__nvoc_createFlags))


// Wrapper macros for implementation functions

// Wrapper macros for halified functions
#define hostengHaltAndReset_FNPTR(pHosteng) pHosteng->__nvoc_metadata_ptr->vtable.__hostengHaltAndReset__
#define hostengHaltAndReset(pGpu, pHosteng, rcChannelInfo, pRmTimeout) hostengHaltAndReset_DISPATCH(pGpu, pHosteng, rcChannelInfo, pRmTimeout)

// Dispatch functions
static inline NV_STATUS hostengHaltAndReset_DISPATCH(struct OBJGPU *pGpu, struct OBJHOSTENG *pHosteng, FIFO_CHANNEL_INFO rcChannelInfo, RMTIMEOUT *pRmTimeout) {
    return pHosteng->__nvoc_metadata_ptr->vtable.__hostengHaltAndReset__(pGpu, pHosteng, rcChannelInfo, pRmTimeout);
}

// Virtual method declarations and/or inline definitions
NV_STATUS hostengHaltAndReset_IMPL(struct OBJGPU *pGpu, struct OBJHOSTENG *pHosteng, FIFO_CHANNEL_INFO rcChannelInfo, RMTIMEOUT *pRmTimeout);

// Exported method declarations and/or inline definitions
// HAL method declarations without bodies
// Inline HAL method definitions
// Static dispatch method declarations
// Static inline method definitions
#undef PRIVATE_FIELD


#endif // HOST_ENG_H

#ifdef __cplusplus
} // extern "C"
#endif

#endif // _G_HOST_ENG_NVOC_H_
