Imported Upstream version 16.04
[deb_dpdk.git] / drivers / net / enic / base / vnic_resource.h
1 /*
2  * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
3  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
4  *
5  * Copyright (c) 2014, Cisco Systems, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34
35 #ifndef _VNIC_RESOURCE_H_
36 #define _VNIC_RESOURCE_H_
37
38 #define VNIC_RES_MAGIC          0x766E6963L     /* 'vnic' */
39 #define VNIC_RES_VERSION        0x00000000L
40 #define MGMTVNIC_MAGIC          0x544d474dL     /* 'MGMT' */
41 #define MGMTVNIC_VERSION        0x00000000L
42
43 /* The MAC address assigned to the CFG vNIC is fixed. */
44 #define MGMTVNIC_MAC            { 0x02, 0x00, 0x54, 0x4d, 0x47, 0x4d }
45
46 /* vNIC resource types */
47 enum vnic_res_type {
48         RES_TYPE_EOL,                   /* End-of-list */
49         RES_TYPE_WQ,                    /* Work queues */
50         RES_TYPE_RQ,                    /* Receive queues */
51         RES_TYPE_CQ,                    /* Completion queues */
52         RES_TYPE_MEM,                   /* Window to dev memory */
53         RES_TYPE_NIC_CFG,               /* Enet NIC config registers */
54         RES_TYPE_RSS_KEY,               /* Enet RSS secret key */
55         RES_TYPE_RSS_CPU,               /* Enet RSS indirection table */
56         RES_TYPE_TX_STATS,              /* Netblock Tx statistic regs */
57         RES_TYPE_RX_STATS,              /* Netblock Rx statistic regs */
58         RES_TYPE_INTR_CTRL,             /* Interrupt ctrl table */
59         RES_TYPE_INTR_TABLE,            /* MSI/MSI-X Interrupt table */
60         RES_TYPE_INTR_PBA,              /* MSI/MSI-X PBA table */
61         RES_TYPE_INTR_PBA_LEGACY,       /* Legacy intr status */
62         RES_TYPE_DEBUG,                 /* Debug-only info */
63         RES_TYPE_DEV,                   /* Device-specific region */
64         RES_TYPE_DEVCMD,                /* Device command region */
65         RES_TYPE_PASS_THRU_PAGE,        /* Pass-thru page */
66         RES_TYPE_SUBVNIC,               /* subvnic resource type */
67         RES_TYPE_MQ_WQ,                 /* MQ Work queues */
68         RES_TYPE_MQ_RQ,                 /* MQ Receive queues */
69         RES_TYPE_MQ_CQ,                 /* MQ Completion queues */
70         RES_TYPE_DEPRECATED1,           /* Old version of devcmd 2 */
71         RES_TYPE_DEVCMD2,               /* Device control region */
72         RES_TYPE_MAX,                   /* Count of resource types */
73 };
74
75 struct vnic_resource_header {
76         u32 magic;
77         u32 version;
78 };
79
80 struct mgmt_barmap_hdr {
81         u32 magic;                      /* magic number */
82         u32 version;                    /* header format version */
83         u16 lif;                        /* loopback lif for mgmt frames */
84         u16 pci_slot;                   /* installed pci slot */
85         char serial[16];                /* card serial number */
86 };
87
88 struct vnic_resource {
89         u8 type;
90         u8 bar;
91         u8 pad[2];
92         u32 bar_offset;
93         u32 count;
94 };
95
96 #endif /* _VNIC_RESOURCE_H_ */