1*17fcb3dcSFan Gong /* SPDX-License-Identifier: GPL-2.0 */ 2*17fcb3dcSFan Gong /* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved. */ 3*17fcb3dcSFan Gong 4*17fcb3dcSFan Gong #ifndef _HINIC3_HW_CFG_H_ 5*17fcb3dcSFan Gong #define _HINIC3_HW_CFG_H_ 6*17fcb3dcSFan Gong 7*17fcb3dcSFan Gong #include <linux/mutex.h> 8*17fcb3dcSFan Gong #include <linux/pci.h> 9*17fcb3dcSFan Gong 10*17fcb3dcSFan Gong struct hinic3_hwdev; 11*17fcb3dcSFan Gong 12*17fcb3dcSFan Gong struct hinic3_irq { 13*17fcb3dcSFan Gong u32 irq_id; 14*17fcb3dcSFan Gong u16 msix_entry_idx; 15*17fcb3dcSFan Gong bool allocated; 16*17fcb3dcSFan Gong }; 17*17fcb3dcSFan Gong 18*17fcb3dcSFan Gong struct hinic3_irq_info { 19*17fcb3dcSFan Gong struct hinic3_irq *irq; 20*17fcb3dcSFan Gong u16 num_irq; 21*17fcb3dcSFan Gong /* device max irq number */ 22*17fcb3dcSFan Gong u16 num_irq_hw; 23*17fcb3dcSFan Gong /* protect irq alloc and free */ 24*17fcb3dcSFan Gong struct mutex irq_mutex; 25*17fcb3dcSFan Gong }; 26*17fcb3dcSFan Gong 27*17fcb3dcSFan Gong struct hinic3_nic_service_cap { 28*17fcb3dcSFan Gong u16 max_sqs; 29*17fcb3dcSFan Gong }; 30*17fcb3dcSFan Gong 31*17fcb3dcSFan Gong /* Device capabilities */ 32*17fcb3dcSFan Gong struct hinic3_dev_cap { 33*17fcb3dcSFan Gong /* Bitmasks of services supported by device */ 34*17fcb3dcSFan Gong u16 supp_svcs_bitmap; 35*17fcb3dcSFan Gong /* Physical port */ 36*17fcb3dcSFan Gong u8 port_id; 37*17fcb3dcSFan Gong struct hinic3_nic_service_cap nic_svc_cap; 38*17fcb3dcSFan Gong }; 39*17fcb3dcSFan Gong 40*17fcb3dcSFan Gong struct hinic3_cfg_mgmt_info { 41*17fcb3dcSFan Gong struct hinic3_irq_info irq_info; 42*17fcb3dcSFan Gong struct hinic3_dev_cap cap; 43*17fcb3dcSFan Gong }; 44*17fcb3dcSFan Gong 45*17fcb3dcSFan Gong int hinic3_alloc_irqs(struct hinic3_hwdev *hwdev, u16 num, 46*17fcb3dcSFan Gong struct msix_entry *alloc_arr, u16 *act_num); 47*17fcb3dcSFan Gong void hinic3_free_irq(struct hinic3_hwdev *hwdev, u32 irq_id); 48*17fcb3dcSFan Gong 49*17fcb3dcSFan Gong bool hinic3_support_nic(struct hinic3_hwdev *hwdev); 50*17fcb3dcSFan Gong u16 hinic3_func_max_qnum(struct hinic3_hwdev *hwdev); 51*17fcb3dcSFan Gong u8 hinic3_physical_port_id(struct hinic3_hwdev *hwdev); 52*17fcb3dcSFan Gong 53*17fcb3dcSFan Gong #endif 54