aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic/vnic_dev.c
diff options
context:
space:
mode:
authorRoopa Prabhu <roprabhu@cisco.com>2010-08-10 14:55:00 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-17 05:32:56 -0400
commit90cf0b53d74ebca4f62d865ae39d21ed3bdbf877 (patch)
treeddac723d5e1fe07d7aa45768e2dc38293612fb9b /drivers/net/enic/vnic_dev.c
parent294dab25e7068f9df80af53aceed332f9621c970 (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/vnic_dev.c')
-rw-r--r--drivers/net/enic/vnic_dev.c25
1 files changed, 18 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