1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2008-2017 Cisco Systems, Inc.  All rights reserved.
3 * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
4 */
5
6#ifndef _VNIC_RESOURCE_H_
7#define _VNIC_RESOURCE_H_
8
9#define VNIC_RES_MAGIC		0x766E6963L	/* 'vnic' */
10#define VNIC_RES_VERSION	0x00000000L
11#define MGMTVNIC_MAGIC		0x544d474dL	/* 'MGMT' */
12#define MGMTVNIC_VERSION	0x00000000L
13
14/* The MAC address assigned to the CFG vNIC is fixed. */
15#define MGMTVNIC_MAC		{ 0x02, 0x00, 0x54, 0x4d, 0x47, 0x4d }
16
17/* vNIC resource types */
18enum vnic_res_type {
19	RES_TYPE_EOL,			/* End-of-list */
20	RES_TYPE_WQ,			/* Work queues */
21	RES_TYPE_RQ,			/* Receive queues */
22	RES_TYPE_CQ,			/* Completion queues */
23	RES_TYPE_MEM,			/* Window to dev memory */
24	RES_TYPE_NIC_CFG,		/* Enet NIC config registers */
25	RES_TYPE_RSS_KEY,		/* Enet RSS secret key */
26	RES_TYPE_RSS_CPU,		/* Enet RSS indirection table */
27	RES_TYPE_TX_STATS,		/* Netblock Tx statistic regs */
28	RES_TYPE_RX_STATS,		/* Netblock Rx statistic regs */
29	RES_TYPE_INTR_CTRL,		/* Interrupt ctrl table */
30	RES_TYPE_INTR_TABLE,		/* MSI/MSI-X Interrupt table */
31	RES_TYPE_INTR_PBA,		/* MSI/MSI-X PBA table */
32	RES_TYPE_INTR_PBA_LEGACY,	/* Legacy intr status */
33	RES_TYPE_DEBUG,			/* Debug-only info */
34	RES_TYPE_DEV,			/* Device-specific region */
35	RES_TYPE_DEVCMD,		/* Device command region */
36	RES_TYPE_PASS_THRU_PAGE,	/* Pass-thru page */
37	RES_TYPE_SUBVNIC,               /* subvnic resource type */
38	RES_TYPE_MQ_WQ,                 /* MQ Work queues */
39	RES_TYPE_MQ_RQ,                 /* MQ Receive queues */
40	RES_TYPE_MQ_CQ,                 /* MQ Completion queues */
41	RES_TYPE_DEPRECATED1,           /* Old version of devcmd 2 */
42	RES_TYPE_DEVCMD2,               /* Device control region */
43	RES_TYPE_MAX,			/* Count of resource types */
44};
45
46struct vnic_resource_header {
47	u32 magic;
48	u32 version;
49};
50
51struct mgmt_barmap_hdr {
52	u32 magic;			/* magic number */
53	u32 version;			/* header format version */
54	u16 lif;			/* loopback lif for mgmt frames */
55	u16 pci_slot;			/* installed pci slot */
56	char serial[16];		/* card serial number */
57};
58
59struct vnic_resource {
60	u8 type;
61	u8 bar;
62	u8 pad[2];
63	u32 bar_offset;
64	u32 count;
65};
66
67#endif /* _VNIC_RESOURCE_H_ */
68