diff options
author | Roopa Prabhu <roprabhu@cisco.com> | 2010-08-10 14:55:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-17 05:32:56 -0400 |
commit | 90cf0b53d74ebca4f62d865ae39d21ed3bdbf877 (patch) | |
tree | ddac723d5e1fe07d7aa45768e2dc38293612fb9b /drivers/net/enic | |
parent | 294dab25e7068f9df80af53aceed332f9621c970 (diff) |
enic: Add support for firmware management device
This patch adds support for firmware management device in enic driver.
A management device is a virtual PCIe device that firmware can present
to the host as its management endpoint. It provides the interface between
the host and adapter firmware for all management operations.
Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/enic')
-rw-r--r-- | drivers/net/enic/vnic_dev.c | 25 | ||||
-rw-r--r-- | drivers/net/enic/vnic_resource.h | 13 |
2 files changed, 31 insertions, 7 deletions
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c index 6a5b578a69e1..08d5d42da260 100644 --- a/drivers/net/enic/vnic_dev.c +++ b/drivers/net/enic/vnic_dev.c | |||
@@ -74,6 +74,7 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, | |||
74 | struct vnic_dev_bar *bar, unsigned int num_bars) | 74 | struct vnic_dev_bar *bar, unsigned int num_bars) |
75 | { | 75 | { |
76 | struct vnic_resource_header __iomem *rh; | 76 | struct vnic_resource_header __iomem *rh; |
77 | struct mgmt_barmap_hdr __iomem *mrh; | ||
77 | struct vnic_resource __iomem *r; | 78 | struct vnic_resource __iomem *r; |
78 | u8 type; | 79 | u8 type; |
79 | 80 | ||
@@ -85,22 +86,32 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, | |||
85 | return -EINVAL; | 86 | return -EINVAL; |
86 | } | 87 | } |
87 | 88 | ||
88 | rh = bar->vaddr; | 89 | rh = bar->vaddr; |
90 | mrh = bar->vaddr; | ||
89 | if (!rh) { | 91 | if (!rh) { |
90 | pr_err("vNIC BAR0 res hdr not mem-mapped\n"); | 92 | pr_err("vNIC BAR0 res hdr not mem-mapped\n"); |
91 | return -EINVAL; | 93 | return -EINVAL; |
92 | } | 94 | } |
93 | 95 | ||
94 | if (ioread32(&rh->magic) != VNIC_RES_MAGIC || | 96 | /* Check for mgmt vnic in addition to normal vnic */ |
95 | ioread32(&rh->version) != VNIC_RES_VERSION) { | 97 | if ((ioread32(&rh->magic) != VNIC_RES_MAGIC) || |
96 | pr_err("vNIC BAR0 res magic/version error " | 98 | (ioread32(&rh->version) != VNIC_RES_VERSION)) { |
97 | "exp (%lx/%lx) curr (%x/%x)\n", | 99 | if ((ioread32(&mrh->magic) != MGMTVNIC_MAGIC) || |
100 | (ioread32(&mrh->version) != MGMTVNIC_VERSION)) { | ||
101 | pr_err("vNIC BAR0 res magic/version error " | ||
102 | "exp (%lx/%lx) or (%lx/%lx), curr (%x/%x)\n", | ||
98 | VNIC_RES_MAGIC, VNIC_RES_VERSION, | 103 | VNIC_RES_MAGIC, VNIC_RES_VERSION, |
104 | MGMTVNIC_MAGIC, MGMTVNIC_VERSION, | ||
99 | ioread32(&rh->magic), ioread32(&rh->version)); | 105 | ioread32(&rh->magic), ioread32(&rh->version)); |
100 | return -EINVAL; | 106 | return -EINVAL; |
107 | } | ||
101 | } | 108 | } |
102 | 109 | ||
103 | r = (struct vnic_resource __iomem *)(rh + 1); | 110 | if (ioread32(&mrh->magic) == MGMTVNIC_MAGIC) |
111 | r = (struct vnic_resource __iomem *)(mrh + 1); | ||
112 | else | ||
113 | r = (struct vnic_resource __iomem *)(rh + 1); | ||
114 | |||
104 | 115 | ||
105 | while ((type = ioread8(&r->type)) != RES_TYPE_EOL) { | 116 | while ((type = ioread8(&r->type)) != RES_TYPE_EOL) { |
106 | 117 | ||
diff --git a/drivers/net/enic/vnic_resource.h b/drivers/net/enic/vnic_resource.h index 810287beff14..e0a73f1ca6f4 100644 --- a/drivers/net/enic/vnic_resource.h +++ b/drivers/net/enic/vnic_resource.h | |||
@@ -22,6 +22,11 @@ | |||
22 | 22 | ||
23 | #define VNIC_RES_MAGIC 0x766E6963L /* 'vnic' */ | 23 | #define VNIC_RES_MAGIC 0x766E6963L /* 'vnic' */ |
24 | #define VNIC_RES_VERSION 0x00000000L | 24 | #define VNIC_RES_VERSION 0x00000000L |
25 | #define MGMTVNIC_MAGIC 0x544d474dL /* 'MGMT' */ | ||
26 | #define MGMTVNIC_VERSION 0x00000000L | ||
27 | |||
28 | /* The MAC address assigned to the CFG vNIC is fixed. */ | ||
29 | #define MGMTVNIC_MAC { 0x02, 0x00, 0x54, 0x4d, 0x47, 0x4d } | ||
25 | 30 | ||
26 | /* vNIC resource types */ | 31 | /* vNIC resource types */ |
27 | enum vnic_res_type { | 32 | enum vnic_res_type { |
@@ -52,6 +57,14 @@ struct vnic_resource_header { | |||
52 | u32 version; | 57 | u32 version; |
53 | }; | 58 | }; |
54 | 59 | ||
60 | struct mgmt_barmap_hdr { | ||
61 | u32 magic; /* magic number */ | ||
62 | u32 version; /* header format version */ | ||
63 | u16 lif; /* loopback lif for mgmt frames */ | ||
64 | u16 pci_slot; /* installed pci slot */ | ||
65 | char serial[16]; /* card serial number */ | ||
66 | }; | ||
67 | |||
55 | struct vnic_resource { | 68 | struct vnic_resource { |
56 | u8 type; | 69 | u8 type; |
57 | u8 bar; | 70 | u8 bar; |