1 /*
2 * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
3  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
4  *
5  * LICENSE_BEGIN
6  *
7  * This software is available to you under a choice of one of two
8  * licenses.  You may choose to be licensed under the terms of the GNU
9  * General Public License (GPL) Version 2, available from the file
10  * COPYING in the main directory of this source tree, or the
11  * BSD license below:
12  *
13  *     Redistribution and use in source and binary forms, with or
14  *     without modification, are permitted provided that the following
15  *     conditions are met:
16  *
17  *      - Redistributions of source code must retain the above
18  *        copyright notice, this list of conditions and the following
19  *        disclaimer.
20  *
21  *      - Redistributions in binary form must reproduce the above
22  *        copyright notice, this list of conditions and the following
23  *        disclaimer in the documentation and/or other materials
24  *        provided with the distribution.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGE.
38  *
39  * LICENSE_END
40  *
41  *
42  */
43 
44 #ifndef _VNIC_RESOURCE_H_
45 #define _VNIC_RESOURCE_H_
46 
47 #define VNIC_RES_MAGIC		0x766E6963L	/* 'vnic' */
48 #define VNIC_RES_VERSION	0x00000000L
49 #define MGMTVNIC_MAGIC		0x544d474dL	/* 'MGMT' */
50 #define MGMTVNIC_VERSION	0x00000000L
51 
52 /* The MAC address assigned to the CFG vNIC is fixed. */
53 #define MGMTVNIC_MAC		{ 0x02, 0x00, 0x54, 0x4d, 0x47, 0x4d }
54 
55 /* vNIC resource types */
56 enum vnic_res_type {
57 	RES_TYPE_EOL,			/* End-of-list */
58 	RES_TYPE_WQ,			/* Work queues */
59 	RES_TYPE_RQ,			/* Receive queues */
60 	RES_TYPE_CQ,			/* Completion queues */
61 	RES_TYPE_MEM,			/* Window to dev memory */
62 	RES_TYPE_NIC_CFG,		/* Enet NIC config registers */
63 	RES_TYPE_RSS_KEY,		/* Enet RSS secret key */
64 	RES_TYPE_RSS_CPU,		/* Enet RSS indirection table */
65 	RES_TYPE_TX_STATS,		/* Netblock Tx statistic regs */
66 	RES_TYPE_RX_STATS,		/* Netblock Rx statistic regs */
67 	RES_TYPE_INTR_CTRL,		/* Interrupt ctrl table */
68 	RES_TYPE_INTR_TABLE,		/* MSI/MSI-X Interrupt table */
69 	RES_TYPE_INTR_PBA,		/* MSI/MSI-X PBA table */
70 	RES_TYPE_INTR_PBA_LEGACY,	/* Legacy intr status */
71 	RES_TYPE_DEBUG,			/* Debug-only info */
72 	RES_TYPE_DEV,			/* Device-specific region */
73 	RES_TYPE_DEVCMD,		/* Device command region */
74 	RES_TYPE_PASS_THRU_PAGE,	/* Pass-thru page */
75 	RES_TYPE_SUBVNIC,		/* subvnic resource type */
76 	RES_TYPE_MQ_WQ,			/* MQ Work queues */
77 	RES_TYPE_MQ_RQ,			/* MQ Receive queues */
78 	RES_TYPE_MQ_CQ,			/* MQ Completion queues */
79 	RES_TYPE_DEPRECATED1,		/* Old version of devcmd 2 */
80 	RES_TYPE_DEPRECATED2,		/* Old version of devcmd 2 */
81 	RES_TYPE_DEVCMD2,		/* Device control region */
82 	RES_TYPE_RDMA_WQ,		/* RDMA WQ */
83 	RES_TYPE_RDMA_RQ,		/* RDMA RQ */
84 	RES_TYPE_RDMA_CQ,		/* RDMA CQ */
85 	RES_TYPE_RDMA_RKEY_TABLE,	/* RDMA RKEY table */
86 	RES_TYPE_RDMA_RQ_HEADER_TABLE,	/* RDMA RQ Header Table */
87 	RES_TYPE_RDMA_RQ_TABLE,		/* RDMA RQ Table */
88 	RES_TYPE_RDMA_RD_RESP_HEADER_TABLE,	/* RDMA Read Response Header Table */
89 	RES_TYPE_RDMA_RD_RESP_TABLE,	/* RDMA Read Response Table */
90 	RES_TYPE_RDMA_QP_STATS_TABLE,	/* RDMA per QP stats table */
91 	RES_TYPE_WQ_MREGS,		/* XXX snic proto only */
92 	RES_TYPE_GRPMBR_INTR,		/* Group member interrupt control */
93 	RES_TYPE_DPKT,			/* Direct Packet memory region */
94 
95 	RES_TYPE_MAX,			/* Count of resource types */
96 };
97 
98 struct vnic_resource_header {
99 	u32 magic;
100 	u32 version;
101 };
102 
103 struct mgmt_barmap_hdr {
104 	u32 magic;			/* magic number */
105 	u32 version;			/* header format version */
106 	u16 lif;			/* loopback lif for mgmt frames */
107 	u16 pci_slot;			/* installed pci slot */
108 	char serial[16];		/* card serial number */
109 };
110 
111 struct vnic_resource {
112 	u8 type;
113 	u8 bar;
114 	u8 pad[2];
115 	u32 bar_offset;
116 	u32 count;
117 };
118 
119 #endif /* _VNIC_RESOURCE_H_ */
120