1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* SPDX-FileCopyrightText: Copyright Red Hat */ 3 4 #ifndef _ICE_ADAPTER_H_ 5 #define _ICE_ADAPTER_H_ 6 7 #include <linux/types.h> 8 #include <linux/spinlock_types.h> 9 #include <linux/refcount_types.h> 10 11 struct pci_dev; 12 struct ice_pf; 13 14 /** 15 * struct ice_port_list - data used to store the list of adapter ports 16 * 17 * This structure contains data used to maintain a list of adapter ports 18 * 19 * @ports: list of ports 20 * @lock: protect access to the ports list 21 */ 22 struct ice_port_list { 23 struct list_head ports; 24 /* To synchronize the ports list operations */ 25 struct mutex lock; 26 }; 27 28 /** 29 * struct ice_adapter - PCI adapter resources shared across PFs 30 * @refcount: Reference count. struct ice_pf objects hold the references. 31 * @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME 32 * register of the PTP clock. 33 * @txq_ctx_lock: Spinlock protecting access to the GLCOMM_QTX_CNTX_CTL register 34 * @ctrl_pf: Control PF of the adapter 35 * @ports: Ports list 36 * @device_serial_number: DSN cached for collision detection on 32bit systems 37 */ 38 struct ice_adapter { 39 refcount_t refcount; 40 /* For access to the GLTSYN_TIME register */ 41 spinlock_t ptp_gltsyn_time_lock; 42 /* For access to GLCOMM_QTX_CNTX_CTL register */ 43 spinlock_t txq_ctx_lock; 44 45 struct ice_pf *ctrl_pf; 46 struct ice_port_list ports; 47 u64 device_serial_number; 48 }; 49 50 struct ice_adapter *ice_adapter_get(struct pci_dev *pdev); 51 void ice_adapter_put(struct pci_dev *pdev); 52 53 #endif /* _ICE_ADAPTER_H */ 54