Skip to content

Commit

Permalink
[vxge] Add support for new function mode "multi-function 8 Direct IO"
Browse files Browse the repository at this point in the history
Support 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.vettuparambil@exar.com>
Signed-off-by: Sivakumar Subramani <sivakumar.subramani@exar.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
Masroor Vettuparambil authored and mcb30 committed Jan 27, 2011
1 parent 2288241 commit aa69bf8
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 25 deletions.
63 changes: 48 additions & 15 deletions src/drivers/net/vxge/vxge_config.c
Expand Up @@ -17,6 +17,7 @@ FILE_LICENCE(GPL2_ONLY);
#include <stdlib.h>
#include <stdio.h>
#include <ipxe/malloc.h>
#include <ipxe/pci.h>
#include <ipxe/iobuf.h>
#include <ipxe/ethernet.h>
#include <byteswap.h>
Expand Down Expand Up @@ -186,28 +187,47 @@ __vxge_hw_device_vpath_reset_in_prog_check(u64 __iomem *vpath_rst_in_prog)
return status;
}

/*
* __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;
}

Expand All @@ -224,17 +244,23 @@ __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;
}

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 =
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 3 additions & 7 deletions src/drivers/net/vxge/vxge_config.h
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/drivers/net/vxge/vxge_main.c
Expand Up @@ -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)
Expand Down Expand Up @@ -533,7 +534,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",
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/net/vxge/vxge_version.h
Expand Up @@ -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))
Expand Down

0 comments on commit aa69bf8

Please sign in to comment.