aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/enic/vnic_dev.c97
-rw-r--r--drivers/net/enic/vnic_dev.h6
-rw-r--r--drivers/net/enic/vnic_devcmd.h57
3 files changed, 111 insertions, 49 deletions
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c
index c089b362a36f..68f24ae860ae 100644
--- a/drivers/net/enic/vnic_dev.c
+++ b/drivers/net/enic/vnic_dev.c
@@ -786,48 +786,6 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)
786 return r; 786 return r;
787} 787}
788 788
789int vnic_dev_init_done(struct vnic_dev *vdev, int *done, int *err)
790{
791 u64 a0 = 0, a1 = 0;
792 int wait = 1000;
793 int ret;
794
795 *done = 0;
796
797 ret = vnic_dev_cmd(vdev, CMD_INIT_STATUS, &a0, &a1, wait);
798 if (ret)
799 return ret;
800
801 *done = (a0 == 0);
802
803 *err = (a0 == 0) ? (int)a1:0;
804
805 return 0;
806}
807
808int vnic_dev_init_prov(struct vnic_dev *vdev, u8 *buf, u32 len)
809{
810 u64 a0, a1 = len;
811 int wait = 1000;
812 dma_addr_t prov_pa;
813 void *prov_buf;
814 int ret;
815
816 prov_buf = pci_alloc_consistent(vdev->pdev, len, &prov_pa);
817 if (!prov_buf)
818 return -ENOMEM;
819
820 memcpy(prov_buf, buf, len);
821
822 a0 = prov_pa;
823
824 ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO, &a0, &a1, wait);
825
826 pci_free_consistent(vdev->pdev, len, prov_buf, prov_pa);
827
828 return ret;
829}
830
831int vnic_dev_deinit(struct vnic_dev *vdev) 789int vnic_dev_deinit(struct vnic_dev *vdev)
832{ 790{
833 u64 a0 = 0, a1 = 0; 791 u64 a0 = 0, a1 = 0;
@@ -927,4 +885,59 @@ err_out:
927 return NULL; 885 return NULL;
928} 886}
929 887
888int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len)
889{
890 u64 a0, a1 = len;
891 int wait = 1000;
892 dma_addr_t prov_pa;
893 void *prov_buf;
894 int ret;
895
896 prov_buf = pci_alloc_consistent(vdev->pdev, len, &prov_pa);
897 if (!prov_buf)
898 return -ENOMEM;
930 899
900 memcpy(prov_buf, buf, len);
901
902 a0 = prov_pa;
903
904 ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO2, &a0, &a1, wait);
905
906 pci_free_consistent(vdev->pdev, len, prov_buf, prov_pa);
907
908 return ret;
909}
910
911int vnic_dev_enable2(struct vnic_dev *vdev, int active)
912{
913 u64 a0, a1 = 0;
914 int wait = 1000;
915
916 a0 = (active ? CMD_ENABLE2_ACTIVE : 0);
917
918 return vnic_dev_cmd(vdev, CMD_ENABLE2, &a0, &a1, wait);
919}
920
921static int vnic_dev_cmd_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
922 int *status)
923{
924 u64 a0 = cmd, a1 = 0;
925 int wait = 1000;
926 int ret;
927
928 ret = vnic_dev_cmd(vdev, CMD_STATUS, &a0, &a1, wait);
929 if (!ret)
930 *status = (int)a0;
931
932 return ret;
933}
934
935int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status)
936{
937 return vnic_dev_cmd_status(vdev, CMD_ENABLE2, status);
938}
939
940int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status)
941{
942 return vnic_dev_cmd_status(vdev, CMD_DEINIT, status);
943}
diff --git a/drivers/net/enic/vnic_dev.h b/drivers/net/enic/vnic_dev.h
index e837546213a8..cf482a2c9dd9 100644
--- a/drivers/net/enic/vnic_dev.h
+++ b/drivers/net/enic/vnic_dev.h
@@ -108,8 +108,6 @@ int vnic_dev_disable(struct vnic_dev *vdev);
108int vnic_dev_open(struct vnic_dev *vdev, int arg); 108int vnic_dev_open(struct vnic_dev *vdev, int arg);
109int vnic_dev_open_done(struct vnic_dev *vdev, int *done); 109int vnic_dev_open_done(struct vnic_dev *vdev, int *done);
110int vnic_dev_init(struct vnic_dev *vdev, int arg); 110int vnic_dev_init(struct vnic_dev *vdev, int arg);
111int vnic_dev_init_done(struct vnic_dev *vdev, int *done, int *err);
112int vnic_dev_init_prov(struct vnic_dev *vdev, u8 *buf, u32 len);
113int vnic_dev_deinit(struct vnic_dev *vdev); 111int vnic_dev_deinit(struct vnic_dev *vdev);
114int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg); 112int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg);
115int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done); 113int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done);
@@ -122,5 +120,9 @@ int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev,
122struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, 120struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
123 void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar, 121 void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar,
124 unsigned int num_bars); 122 unsigned int num_bars);
123int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len);
124int vnic_dev_enable2(struct vnic_dev *vdev, int active);
125int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status);
126int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status);
125 127
126#endif /* _VNIC_DEV_H_ */ 128#endif /* _VNIC_DEV_H_ */
diff --git a/drivers/net/enic/vnic_devcmd.h b/drivers/net/enic/vnic_devcmd.h
index d833a071bac5..c5569bfb47ac 100644
--- a/drivers/net/enic/vnic_devcmd.h
+++ b/drivers/net/enic/vnic_devcmd.h
@@ -267,17 +267,62 @@ enum vnic_devcmd_cmd {
267 267
268 /* 268 /*
269 * As for BY_BDF except a0 is index of hvnlink subordinate vnic 269 * As for BY_BDF except a0 is index of hvnlink subordinate vnic
270 * or SR-IOV virtual vnic */ 270 * or SR-IOV virtual vnic
271 */
271 CMD_PROXY_BY_INDEX = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 43), 272 CMD_PROXY_BY_INDEX = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 43),
272 273
273 /* 274 /*
274 * in: (u64)a0=paddr of buffer to put latest VIC VIF-CONFIG-INFO TLV in 275 * For HPP toggle:
275 * (u32)a1=length of buffer in a0 276 * adapter-info-get
276 * out: (u64)a0=paddr of buffer with latest VIC VIF-CONFIG-INFO TLV 277 * in: (u64)a0=phsical address of buffer passed in from caller.
277 * (u32)a1=actual length of latest VIC VIF-CONFIG-INFO TLV */ 278 * (u16)a1=size of buffer specified in a0.
279 * out: (u64)a0=phsical address of buffer passed in from caller.
280 * (u16)a1=actual bytes from VIF-CONFIG-INFO TLV, or
281 * 0 if no VIF-CONFIG-INFO TLV was ever received. */
278 CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44), 282 CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44),
283
284 /* init_prov_info2:
285 * Variant of CMD_INIT_PROV_INFO, where it will not try to enable
286 * the vnic until CMD_ENABLE2 is issued.
287 * (u64)a0=paddr of vnic_devcmd_provinfo
288 * (u32)a1=sizeof provision info */
289 CMD_INIT_PROV_INFO2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47),
290
291 /* enable2:
292 * (u32)a0=0 ==> standby
293 * =CMD_ENABLE2_ACTIVE ==> active
294 */
295 CMD_ENABLE2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 48),
296
297 /*
298 * cmd_status:
299 * Returns the status of the specified command
300 * Input:
301 * a0 = command for which status is being queried.
302 * Possible values are:
303 * CMD_SOFT_RESET
304 * CMD_HANG_RESET
305 * CMD_OPEN
306 * CMD_INIT
307 * CMD_INIT_PROV_INFO
308 * CMD_DEINIT
309 * CMD_INIT_PROV_INFO2
310 * CMD_ENABLE2
311 * Output:
312 * if status == STAT_ERROR
313 * a0 = ERR_ENOTSUPPORTED - status for command in a0 is
314 * not supported
315 * if status == STAT_NONE
316 * a0 = status of the devcmd specified in a0 as follows.
317 * ERR_SUCCESS - command in a0 completed successfully
318 * ERR_EINPROGRESS - command in a0 is still in progress
319 */
320 CMD_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 49),
279}; 321};
280 322
323/* CMD_ENABLE2 flags */
324#define CMD_ENABLE2_ACTIVE 0x1
325
281/* flags for CMD_OPEN */ 326/* flags for CMD_OPEN */
282#define CMD_OPENF_OPROM 0x1 /* open coming from option rom */ 327#define CMD_OPENF_OPROM 0x1 /* open coming from option rom */
283 328
@@ -315,6 +360,8 @@ enum vnic_devcmd_error {
315 ERR_ETIMEDOUT = 8, 360 ERR_ETIMEDOUT = 8,
316 ERR_ELINKDOWN = 9, 361 ERR_ELINKDOWN = 9,
317 ERR_EMAXRES = 10, 362 ERR_EMAXRES = 10,
363 ERR_ENOTSUPPORTED = 11,
364 ERR_EINPROGRESS = 12,
318}; 365};
319 366
320/* 367/*