1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright 2018-2022 Advanced Micro Devices, Inc. 3 */ 4 5 #ifndef _IONIC_H_ 6 #define _IONIC_H_ 7 8 #include <stdint.h> 9 #include <inttypes.h> 10 11 #include "ionic_dev.h" 12 #include "ionic_if.h" 13 #include "ionic_osdep.h" 14 15 #define IONIC_DRV_NAME "ionic" 16 #define IONIC_DRV_DESCRIPTION "AMD Pensando Ethernet NIC Driver" 17 #define IONIC_DRV_VERSION "0.11.0-49" 18 19 /* Vendor ID */ 20 #define IONIC_PENSANDO_VENDOR_ID 0x1dd8 21 22 /* Device IDs */ 23 #define IONIC_DEV_ID_ETH_PF 0x1002 24 #define IONIC_DEV_ID_ETH_VF 0x1003 25 #define IONIC_DEV_ID_ETH_MGMT 0x1004 26 27 enum ionic_mac_type { 28 IONIC_MAC_UNKNOWN = 0, 29 IONIC_MAC_CAPRI, 30 IONIC_NUM_MACS 31 }; 32 33 struct ionic_mac_info { 34 enum ionic_mac_type type; 35 }; 36 37 struct ionic_hw { 38 struct ionic_mac_info mac; 39 uint16_t device_id; 40 uint16_t vendor_id; 41 }; 42 43 struct ionic_bars { 44 struct ionic_dev_bar bar[IONIC_BARS_MAX]; 45 uint32_t num_bars; 46 }; 47 48 /* 49 * Structure to store private data for each driver instance (for each adapter). 50 */ 51 struct ionic_adapter { 52 struct ionic_hw hw; 53 struct ionic_dev idev; 54 const char *name; 55 struct ionic_bars bars; 56 const struct ionic_dev_intf *intf; 57 struct ionic_identity ident; 58 struct ionic_lif *lif; 59 uint32_t max_ntxqs_per_lif; 60 uint32_t max_nrxqs_per_lif; 61 uint32_t max_mac_addrs; 62 uint32_t link_speed; 63 uint32_t nintrs; 64 bool intrs[IONIC_INTR_CTRL_REGS_MAX]; 65 bool link_up; 66 char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN]; 67 void *bus_dev; 68 }; 69 70 /** ionic_admin_ctx - Admin command context. 71 * @pending_work: Flag that indicates a completion. 72 * @cmd: Admin command (64B) to be copied to the queue. 73 * @comp: Admin completion (16B) copied from the queue. 74 */ 75 struct ionic_admin_ctx { 76 bool pending_work; 77 union ionic_adminq_cmd cmd; 78 union ionic_adminq_comp comp; 79 }; 80 81 int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); 82 83 int ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait); 84 int ionic_setup(struct ionic_adapter *adapter); 85 86 int ionic_identify(struct ionic_adapter *adapter); 87 int ionic_init(struct ionic_adapter *adapter); 88 int ionic_reset(struct ionic_adapter *adapter); 89 90 int ionic_port_identify(struct ionic_adapter *adapter); 91 int ionic_port_init(struct ionic_adapter *adapter); 92 int ionic_port_reset(struct ionic_adapter *adapter); 93 94 #endif /* _IONIC_H_ */ 95