Hi all,

This patch is for supporting a new function mode introduced in Exar's X3100 
series Ethernet adapter.

Thanks,
Masroor

Patch:

Supports a new function mode "multi-function 8 Direct IO" which is used in ESX 
Direct I/O configuration. 
Update driver version to 3.5.0.1

Signed-off-by: Masroor Vettuparambil <masroor.vettuparam...@exar.com>
Signed-off-by: Sivakumar Subramani <sivakumar.subram...@exar.com>
---
 src/drivers/net/vxge/vxge_config.c  |   63 ++++++++++++++++++++++++++--------
 src/drivers/net/vxge/vxge_config.h  |   10 ++----
 src/drivers/net/vxge/vxge_main.c    |    3 +-
 src/drivers/net/vxge/vxge_version.h |    4 +-
 4 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/src/drivers/net/vxge/vxge_config.c 
b/src/drivers/net/vxge/vxge_config.c
index 6613cb2..939b5c1 100644
--- a/src/drivers/net/vxge/vxge_config.c
+++ b/src/drivers/net/vxge/vxge_config.c
@@ -17,6 +17,7 @@ FILE_LICENCE(GPL2_ONLY);
 #include <stdlib.h>
 #include <stdio.h>
 #include <gpxe/malloc.h>
+#include <gpxe/pci.h>
 #include <gpxe/iobuf.h>
 #include <gpxe/ethernet.h>
 #include <byteswap.h>
@@ -187,27 +188,46 @@ __vxge_hw_device_vpath_reset_in_prog_check(u64 __iomem 
*vpath_rst_in_prog)
 }
 
 /*
+ * __vxge_hw_device_get_legacy_reg
+ * This routine gets the legacy register section's memory mapped address
+ * and sets the swapper.
+ */
+static struct vxge_hw_legacy_reg __iomem *
+__vxge_hw_device_get_legacy_reg(struct pci_device *pdev, void __iomem *bar0)
+{
+       enum vxge_hw_status status;
+       struct vxge_hw_legacy_reg __iomem *legacy_reg;
+       /*
+        * If the length of Bar0 is 16MB, then assume that we are configured
+        * in MF8P_VP2 mode and then add 8MB to the legacy_reg offsets
+        */
+       if (pci_bar_size(pdev, PCI_BASE_ADDRESS_0) == 0x1000000)
+               legacy_reg = (struct vxge_hw_legacy_reg __iomem *)
+                               (bar0 + 0x800000);
+       else
+               legacy_reg = (struct vxge_hw_legacy_reg __iomem *)bar0;
+
+       status = __vxge_hw_legacy_swapper_set(legacy_reg);
+       if (status != VXGE_HW_OK)
+               return NULL;
+
+       return legacy_reg;
+}
+/*
  * __vxge_hw_device_toc_get
  * This routine sets the swapper and reads the toc pointer and returns the
  * memory mapped address of the toc
  */
 struct vxge_hw_toc_reg __iomem *
-__vxge_hw_device_toc_get(void __iomem *bar0)
+__vxge_hw_device_toc_get(void __iomem *bar0,
+       struct vxge_hw_legacy_reg __iomem *legacy_reg)
 {
        u64 val64;
        struct vxge_hw_toc_reg __iomem *toc = NULL;
-       enum vxge_hw_status status;
-
-       struct vxge_hw_legacy_reg __iomem *legacy_reg =
-               (struct vxge_hw_legacy_reg __iomem *)bar0;
-
-       status = __vxge_hw_legacy_swapper_set(legacy_reg);
-       if (status != VXGE_HW_OK)
-               goto exit;
 
        val64 = readq(&legacy_reg->toc_first_pointer);
        toc = (struct vxge_hw_toc_reg __iomem *)(bar0+val64);
-exit:
+
        return toc;
 }
 
@@ -224,9 +244,15 @@ __vxge_hw_device_reg_addr_get(struct __vxge_hw_device 
*hldev)
        u32 i;
        enum vxge_hw_status status = VXGE_HW_OK;
 
-       hldev->legacy_reg = (struct vxge_hw_legacy_reg __iomem *)hldev->bar0;
+       hldev->legacy_reg = __vxge_hw_device_get_legacy_reg(hldev->pdev,
+                                       hldev->bar0);
+       if (hldev->legacy_reg  == NULL) {
+               status = VXGE_HW_FAIL;
+               goto exit;
+       }
 
-       hldev->toc_reg = __vxge_hw_device_toc_get(hldev->bar0);
+       hldev->toc_reg = __vxge_hw_device_toc_get(hldev->bar0,
+                                       hldev->legacy_reg);
        if (hldev->toc_reg  == NULL) {
                status = VXGE_HW_FAIL;
                goto exit;
@@ -234,7 +260,7 @@ __vxge_hw_device_reg_addr_get(struct __vxge_hw_device 
*hldev)
 
        val64 = readq(&hldev->toc_reg->toc_common_pointer);
        hldev->common_reg =
-       (struct vxge_hw_common_reg __iomem *)(hldev->bar0 + val64);
+               (struct vxge_hw_common_reg __iomem *)(hldev->bar0 + val64);
 
        val64 = readq(&hldev->toc_reg->toc_mrpcim_pointer);
        hldev->mrpcim_reg =
@@ -355,7 +381,7 @@ void __vxge_hw_device_host_info_get(struct __vxge_hw_device 
*hldev)
  * each vpath
  */
 enum vxge_hw_status
-vxge_hw_device_hw_info_get(void __iomem *bar0,
+vxge_hw_device_hw_info_get(struct pci_device *pdev, void __iomem *bar0,
                                struct vxge_hw_device_hw_info *hw_info)
 {
        u32 i;
@@ -365,13 +391,20 @@ vxge_hw_device_hw_info_get(void __iomem *bar0,
        struct vxge_hw_common_reg __iomem *common_reg;
        struct vxge_hw_vpath_reg __iomem *vpath_reg;
        struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg;
+       struct vxge_hw_legacy_reg __iomem *legacy_reg;
        enum vxge_hw_status status;
 
        vxge_trace();
 
        memset(hw_info, 0, sizeof(struct vxge_hw_device_hw_info));
 
-       toc = __vxge_hw_device_toc_get(bar0);
+       legacy_reg = __vxge_hw_device_get_legacy_reg(pdev, bar0);
+       if (legacy_reg == NULL) {
+               status = VXGE_HW_ERR_CRITICAL;
+               goto exit;
+       }
+
+       toc = __vxge_hw_device_toc_get(bar0, legacy_reg);
        if (toc == NULL) {
                status = VXGE_HW_ERR_CRITICAL;
                goto exit;
diff --git a/src/drivers/net/vxge/vxge_config.h 
b/src/drivers/net/vxge/vxge_config.h
index 64f1e8c..3ae1848 100644
--- a/src/drivers/net/vxge/vxge_config.h
+++ b/src/drivers/net/vxge/vxge_config.h
@@ -440,7 +440,7 @@ struct vxge_hw_device_hw_info {
 #define VXGE_HW_VH_NORMAL_FUNCTION                             7
        u64             function_mode;
 #define VXGE_HW_FUNCTION_MODE_MIN                              0
-#define VXGE_HW_FUNCTION_MODE_MAX                              10
+#define VXGE_HW_FUNCTION_MODE_MAX                              11
 
 #define VXGE_HW_FUNCTION_MODE_SINGLE_FUNCTION                  0
 #define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION                   1
@@ -453,6 +453,7 @@ struct vxge_hw_device_hw_info {
 #define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION_2                 8
 #define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION_4                 9
 #define VXGE_HW_FUNCTION_MODE_MRIOV_4                          10
+#define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION_DIRECT_IO         11
 
        u32             func_id;
        u64             vpath_mask;
@@ -607,6 +608,7 @@ void vxge_hw_ring_rxd_1b_set(struct vxge_hw_ring_rxd_1 
*rxdp,
 }
 
 enum vxge_hw_status vxge_hw_device_hw_info_get(
+       struct pci_device *pdev,
        void __iomem *bar0,
        struct vxge_hw_device_hw_info *hw_info);
 
@@ -727,12 +729,6 @@ __vxge_hw_pio_mem_write64(u64 val64, void __iomem *addr,
        return status;
 }
 
-struct vxge_hw_toc_reg __iomem *
-__vxge_hw_device_toc_get(void __iomem *bar0);
-
-enum vxge_hw_status
-__vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev);
-
 void
 __vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev);
 
diff --git a/src/drivers/net/vxge/vxge_main.c b/src/drivers/net/vxge/vxge_main.c
index 8f5ba47..0ea970c 100644
--- a/src/drivers/net/vxge/vxge_main.c
+++ b/src/drivers/net/vxge/vxge_main.c
@@ -45,6 +45,7 @@ static char *vxge_func_mode_names[] = {
        "Multi Function 2 - 2 func, 8 vpath per func",
        "Multi Function 4 - 4 func, 4 vpath per func",
        "WLPEX/SharedIO 4 - 17 func, 1 vpath per func (PCIe ARI)",
+       "Multi Function 8 - For ESX DirectIO - 8 func, 2 vpath per func",
 };
 
 static inline int is_vxge_card_up(struct vxgedev *vdev)
@@ -534,7 +535,7 @@ vxge_probe(struct pci_device *pdev, const struct 
pci_device_id *id __unused)
                goto _exit0;
        }
 
-       status = vxge_hw_device_hw_info_get(bar0, &hw_info);
+       status = vxge_hw_device_hw_info_get(pdev, bar0, &hw_info);
        if (status != VXGE_HW_OK) {
                vxge_debug(VXGE_ERR,
                        "%s: Reading of hardware info failed.\n",
diff --git a/src/drivers/net/vxge/vxge_version.h 
b/src/drivers/net/vxge/vxge_version.h
index 55ad3bf..7add910 100644
--- a/src/drivers/net/vxge/vxge_version.h
+++ b/src/drivers/net/vxge/vxge_version.h
@@ -22,9 +22,9 @@ FILE_LICENCE(GPL2_ONLY);
  * Note: Each field must be a nibble size
  */
 #define VXGE_VERSION_MAJOR     3
-#define VXGE_VERSION_MINOR     1
+#define VXGE_VERSION_MINOR     5
 #define VXGE_VERSION_FIX       0
-#define VXGE_VERSION_BUILD     0
+#define VXGE_VERSION_BUILD     1
 
 #define VXGE_FW_VER(major, minor, build) \
        (((major) << 16) + ((minor) << 8) + (build))
_______________________________________________
gPXE-devel mailing list
gPXE-devel@etherboot.org
http://etherboot.org/mailman/listinfo/gpxe-devel

Reply via email to