* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef VIRTMNGAGENT_VPC_UNIT_H
#define VIRTMNGAGENT_VPC_UNIT_H
#include "ka_pci_pub.h"
#include "ka_base_pub.h"
#include "virtmng_msg_pub.h"
#include "virtmng_public_def.h"
#include "vpc_kernel_interface.h"
struct vmnga_vpc_msxi_ctrl {
ka_msix_entry_t entries[VIRTMNGAGENT_MSIX_MAX];
u32 msix_irq_num;
u32 msix_irq_base;
};
struct vmnga_vpc_start_dev {
ka_wait_queue_head_t wq;
ka_wait_queue_head_t wq_stop;
ka_atomic_t start_flag;
u32 db_id;
u32 msix_id;
};
struct vmnga_vpc_unit {
ka_pci_dev_t *pdev;
void __ka_mm_iomem *db_base;
void __ka_mm_iomem *msg_base;
void __ka_mm_iomem *ts_msg_base;
struct vmng_shr_para __ka_mm_iomem *shr_para;
struct vmnga_vpc_msxi_ctrl msix_ctrl;
struct vmnga_vpc_start_dev start_dev;
struct vmng_msg_dev *msg_dev;
u32 dev_id;
u32 fid;
};
void vmnga_bar_wr(void __ka_mm_iomem *io_base, u32 offset, u32 val);
void vmnga_bar_rd(const void __ka_mm_iomem *io_base, u32 offset, u32 *val);
void vmnga_set_doorbell(void __ka_mm_iomem *io_base, u32 db_id, u32 val);
int vmnga_register_vpc_irq_func(void *drvdata, u32 vector_index, ka_irqreturn_t (*callback_func)(int, void *), void *para,
const char *name);
int vmnga_unregister_vpc_irq_func(void *drvdata, u32 vector_index, void *para);
#endif