net/ionic: register and initialize adapter
[dpdk.git] / drivers / net / ionic / ionic.h
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
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           "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 /*
44  * Structure to store private data for each driver instance (for each adapter).
45  */
46 struct ionic_adapter {
47         struct ionic_hw hw;
48         struct ionic_dev idev;
49         struct ionic_dev_bar bars[IONIC_BARS_MAX];
50         struct ionic_identity   ident;
51         uint32_t num_bars;
52         bool is_mgmt_nic;
53         struct rte_pci_device *pci_dev;
54         LIST_ENTRY(ionic_adapter) pci_adapters;
55 };
56
57 int ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait);
58 int ionic_setup(struct ionic_adapter *adapter);
59
60 int ionic_identify(struct ionic_adapter *adapter);
61 int ionic_init(struct ionic_adapter *adapter);
62 int ionic_reset(struct ionic_adapter *adapter);
63
64 #endif /* _IONIC_H_ */