IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters
Add a low-level IB driver for QLogic PCIe adapters. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
9a6edb60ec
commit
f931551baf
51 changed files with 52965 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ config INFINIBAND_ADDR_TRANS
|
|||
|
||||
source "drivers/infiniband/hw/mthca/Kconfig"
|
||||
source "drivers/infiniband/hw/ipath/Kconfig"
|
||||
source "drivers/infiniband/hw/qib/Kconfig"
|
||||
source "drivers/infiniband/hw/ehca/Kconfig"
|
||||
source "drivers/infiniband/hw/amso1100/Kconfig"
|
||||
source "drivers/infiniband/hw/cxgb3/Kconfig"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
obj-$(CONFIG_INFINIBAND) += core/
|
||||
obj-$(CONFIG_INFINIBAND_MTHCA) += hw/mthca/
|
||||
obj-$(CONFIG_INFINIBAND_IPATH) += hw/ipath/
|
||||
obj-$(CONFIG_INFINIBAND_QIB) += hw/qib/
|
||||
obj-$(CONFIG_INFINIBAND_EHCA) += hw/ehca/
|
||||
obj-$(CONFIG_INFINIBAND_AMSO1100) += hw/amso1100/
|
||||
obj-$(CONFIG_INFINIBAND_CXGB3) += hw/cxgb3/
|
||||
|
|
|
|||
7
drivers/infiniband/hw/qib/Kconfig
Normal file
7
drivers/infiniband/hw/qib/Kconfig
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
config INFINIBAND_QIB
|
||||
tristate "QLogic PCIe HCA support"
|
||||
depends on 64BIT && NET
|
||||
---help---
|
||||
This is a low-level driver for QLogic PCIe QLE InfiniBand host
|
||||
channel adapters. This driver does not support the QLogic
|
||||
HyperTransport card (model QHT7140).
|
||||
15
drivers/infiniband/hw/qib/Makefile
Normal file
15
drivers/infiniband/hw/qib/Makefile
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
obj-$(CONFIG_INFINIBAND_QIB) += ib_qib.o
|
||||
|
||||
ib_qib-y := qib_cq.o qib_diag.o qib_dma.o qib_driver.o qib_eeprom.o \
|
||||
qib_file_ops.o qib_fs.o qib_init.o qib_intr.o qib_keys.o \
|
||||
qib_mad.o qib_mmap.o qib_mr.o qib_pcie.o qib_pio_copy.o \
|
||||
qib_qp.o qib_qsfp.o qib_rc.o qib_ruc.o qib_sdma.o qib_srq.o \
|
||||
qib_sysfs.o qib_twsi.o qib_tx.o qib_uc.o qib_ud.o \
|
||||
qib_user_pages.o qib_user_sdma.o qib_verbs_mcast.o qib_iba7220.o \
|
||||
qib_sd7220.o qib_sd7220_img.o qib_iba7322.o qib_verbs.o
|
||||
|
||||
# 6120 has no fallback if no MSI interrupts, others can do INTx
|
||||
ib_qib-$(CONFIG_PCI_MSI) += qib_iba6120.o
|
||||
|
||||
ib_qib-$(CONFIG_X86_64) += qib_wc_x86_64.o
|
||||
ib_qib-$(CONFIG_PPC64) += qib_wc_ppc64.o
|
||||
1439
drivers/infiniband/hw/qib/qib.h
Normal file
1439
drivers/infiniband/hw/qib/qib.h
Normal file
File diff suppressed because it is too large
Load diff
977
drivers/infiniband/hw/qib/qib_6120_regs.h
Normal file
977
drivers/infiniband/hw/qib/qib_6120_regs.h
Normal file
|
|
@ -0,0 +1,977 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2009, 2010 QLogic Corporation. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* This file is mechanically generated from RTL. Any hand-edits will be lost! */
|
||||
|
||||
#define QIB_6120_Revision_OFFS 0x0
|
||||
#define QIB_6120_Revision_R_Simulator_LSB 0x3F
|
||||
#define QIB_6120_Revision_R_Simulator_RMASK 0x1
|
||||
#define QIB_6120_Revision_Reserved_LSB 0x28
|
||||
#define QIB_6120_Revision_Reserved_RMASK 0x7FFFFF
|
||||
#define QIB_6120_Revision_BoardID_LSB 0x20
|
||||
#define QIB_6120_Revision_BoardID_RMASK 0xFF
|
||||
#define QIB_6120_Revision_R_SW_LSB 0x18
|
||||
#define QIB_6120_Revision_R_SW_RMASK 0xFF
|
||||
#define QIB_6120_Revision_R_Arch_LSB 0x10
|
||||
#define QIB_6120_Revision_R_Arch_RMASK 0xFF
|
||||
#define QIB_6120_Revision_R_ChipRevMajor_LSB 0x8
|
||||
#define QIB_6120_Revision_R_ChipRevMajor_RMASK 0xFF
|
||||
#define QIB_6120_Revision_R_ChipRevMinor_LSB 0x0
|
||||
#define QIB_6120_Revision_R_ChipRevMinor_RMASK 0xFF
|
||||
|
||||
#define QIB_6120_Control_OFFS 0x8
|
||||
#define QIB_6120_Control_TxLatency_LSB 0x4
|
||||
#define QIB_6120_Control_TxLatency_RMASK 0x1
|
||||
#define QIB_6120_Control_PCIERetryBufDiagEn_LSB 0x3
|
||||
#define QIB_6120_Control_PCIERetryBufDiagEn_RMASK 0x1
|
||||
#define QIB_6120_Control_LinkEn_LSB 0x2
|
||||
#define QIB_6120_Control_LinkEn_RMASK 0x1
|
||||
#define QIB_6120_Control_FreezeMode_LSB 0x1
|
||||
#define QIB_6120_Control_FreezeMode_RMASK 0x1
|
||||
#define QIB_6120_Control_SyncReset_LSB 0x0
|
||||
#define QIB_6120_Control_SyncReset_RMASK 0x1
|
||||
|
||||
#define QIB_6120_PageAlign_OFFS 0x10
|
||||
|
||||
#define QIB_6120_PortCnt_OFFS 0x18
|
||||
|
||||
#define QIB_6120_SendRegBase_OFFS 0x30
|
||||
|
||||
#define QIB_6120_UserRegBase_OFFS 0x38
|
||||
|
||||
#define QIB_6120_CntrRegBase_OFFS 0x40
|
||||
|
||||
#define QIB_6120_Scratch_OFFS 0x48
|
||||
#define QIB_6120_Scratch_TopHalf_LSB 0x20
|
||||
#define QIB_6120_Scratch_TopHalf_RMASK 0xFFFFFFFF
|
||||
#define QIB_6120_Scratch_BottomHalf_LSB 0x0
|
||||
#define QIB_6120_Scratch_BottomHalf_RMASK 0xFFFFFFFF
|
||||
|
||||
#define QIB_6120_IntBlocked_OFFS 0x60
|
||||
#define QIB_6120_IntBlocked_ErrorIntBlocked_LSB 0x1F
|
||||
#define QIB_6120_IntBlocked_ErrorIntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_PioSetIntBlocked_LSB 0x1E
|
||||
#define QIB_6120_IntBlocked_PioSetIntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_PioBufAvailIntBlocked_LSB 0x1D
|
||||
#define QIB_6120_IntBlocked_PioBufAvailIntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_assertGPIOIntBlocked_LSB 0x1C
|
||||
#define QIB_6120_IntBlocked_assertGPIOIntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_Reserved_LSB 0xF
|
||||
#define QIB_6120_IntBlocked_Reserved_RMASK 0x1FFF
|
||||
#define QIB_6120_IntBlocked_RcvAvail4IntBlocked_LSB 0x10
|
||||
#define QIB_6120_IntBlocked_RcvAvail4IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvAvail3IntBlocked_LSB 0xF
|
||||
#define QIB_6120_IntBlocked_RcvAvail3IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvAvail2IntBlocked_LSB 0xE
|
||||
#define QIB_6120_IntBlocked_RcvAvail2IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvAvail1IntBlocked_LSB 0xD
|
||||
#define QIB_6120_IntBlocked_RcvAvail1IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvAvail0IntBlocked_LSB 0xC
|
||||
#define QIB_6120_IntBlocked_RcvAvail0IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_Reserved1_LSB 0x5
|
||||
#define QIB_6120_IntBlocked_Reserved1_RMASK 0x7F
|
||||
#define QIB_6120_IntBlocked_RcvUrg4IntBlocked_LSB 0x4
|
||||
#define QIB_6120_IntBlocked_RcvUrg4IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvUrg3IntBlocked_LSB 0x3
|
||||
#define QIB_6120_IntBlocked_RcvUrg3IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvUrg2IntBlocked_LSB 0x2
|
||||
#define QIB_6120_IntBlocked_RcvUrg2IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvUrg1IntBlocked_LSB 0x1
|
||||
#define QIB_6120_IntBlocked_RcvUrg1IntBlocked_RMASK 0x1
|
||||
#define QIB_6120_IntBlocked_RcvUrg0IntBlocked_LSB 0x0
|
||||
#define QIB_6120_IntBlocked_RcvUrg0IntBlocked_RMASK 0x1
|
||||
|
||||
#define QIB_6120_IntMask_OFFS 0x68
|
||||
#define QIB_6120_IntMask_ErrorIntMask_LSB 0x1F
|
||||
#define QIB_6120_IntMask_ErrorIntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_PioSetIntMask_LSB 0x1E
|
||||
#define QIB_6120_IntMask_PioSetIntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_PioBufAvailIntMask_LSB 0x1D
|
||||
#define QIB_6120_IntMask_PioBufAvailIntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_assertGPIOIntMask_LSB 0x1C
|
||||
#define QIB_6120_IntMask_assertGPIOIntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_Reserved_LSB 0x11
|
||||
#define QIB_6120_IntMask_Reserved_RMASK 0x7FF
|
||||
#define QIB_6120_IntMask_RcvAvail4IntMask_LSB 0x10
|
||||
#define QIB_6120_IntMask_RcvAvail4IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvAvail3IntMask_LSB 0xF
|
||||
#define QIB_6120_IntMask_RcvAvail3IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvAvail2IntMask_LSB 0xE
|
||||
#define QIB_6120_IntMask_RcvAvail2IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvAvail1IntMask_LSB 0xD
|
||||
#define QIB_6120_IntMask_RcvAvail1IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvAvail0IntMask_LSB 0xC
|
||||
#define QIB_6120_IntMask_RcvAvail0IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_Reserved1_LSB 0x5
|
||||
#define QIB_6120_IntMask_Reserved1_RMASK 0x7F
|
||||
#define QIB_6120_IntMask_RcvUrg4IntMask_LSB 0x4
|
||||
#define QIB_6120_IntMask_RcvUrg4IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvUrg3IntMask_LSB 0x3
|
||||
#define QIB_6120_IntMask_RcvUrg3IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvUrg2IntMask_LSB 0x2
|
||||
#define QIB_6120_IntMask_RcvUrg2IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvUrg1IntMask_LSB 0x1
|
||||
#define QIB_6120_IntMask_RcvUrg1IntMask_RMASK 0x1
|
||||
#define QIB_6120_IntMask_RcvUrg0IntMask_LSB 0x0
|
||||
#define QIB_6120_IntMask_RcvUrg0IntMask_RMASK 0x1
|
||||
|
||||
#define QIB_6120_IntStatus_OFFS 0x70
|
||||
#define QIB_6120_IntStatus_Error_LSB 0x1F
|
||||
#define QIB_6120_IntStatus_Error_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_PioSent_LSB 0x1E
|
||||
#define QIB_6120_IntStatus_PioSent_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_PioBufAvail_LSB 0x1D
|
||||
#define QIB_6120_IntStatus_PioBufAvail_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_assertGPIO_LSB 0x1C
|
||||
#define QIB_6120_IntStatus_assertGPIO_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_Reserved_LSB 0xF
|
||||
#define QIB_6120_IntStatus_Reserved_RMASK 0x1FFF
|
||||
#define QIB_6120_IntStatus_RcvAvail4_LSB 0x10
|
||||
#define QIB_6120_IntStatus_RcvAvail4_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvAvail3_LSB 0xF
|
||||
#define QIB_6120_IntStatus_RcvAvail3_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvAvail2_LSB 0xE
|
||||
#define QIB_6120_IntStatus_RcvAvail2_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvAvail1_LSB 0xD
|
||||
#define QIB_6120_IntStatus_RcvAvail1_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvAvail0_LSB 0xC
|
||||
#define QIB_6120_IntStatus_RcvAvail0_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_Reserved1_LSB 0x5
|
||||
#define QIB_6120_IntStatus_Reserved1_RMASK 0x7F
|
||||
#define QIB_6120_IntStatus_RcvUrg4_LSB 0x4
|
||||
#define QIB_6120_IntStatus_RcvUrg4_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvUrg3_LSB 0x3
|
||||
#define QIB_6120_IntStatus_RcvUrg3_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvUrg2_LSB 0x2
|
||||
#define QIB_6120_IntStatus_RcvUrg2_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvUrg1_LSB 0x1
|
||||
#define QIB_6120_IntStatus_RcvUrg1_RMASK 0x1
|
||||
#define QIB_6120_IntStatus_RcvUrg0_LSB 0x0
|
||||
#define QIB_6120_IntStatus_RcvUrg0_RMASK 0x1
|
||||
|
||||
#define QIB_6120_IntClear_OFFS 0x78
|
||||
#define QIB_6120_IntClear_ErrorIntClear_LSB 0x1F
|
||||
#define QIB_6120_IntClear_ErrorIntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_PioSetIntClear_LSB 0x1E
|
||||
#define QIB_6120_IntClear_PioSetIntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_PioBufAvailIntClear_LSB 0x1D
|
||||
#define QIB_6120_IntClear_PioBufAvailIntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_assertGPIOIntClear_LSB 0x1C
|
||||
#define QIB_6120_IntClear_assertGPIOIntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_Reserved_LSB 0xF
|
||||
#define QIB_6120_IntClear_Reserved_RMASK 0x1FFF
|
||||
#define QIB_6120_IntClear_RcvAvail4IntClear_LSB 0x10
|
||||
#define QIB_6120_IntClear_RcvAvail4IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvAvail3IntClear_LSB 0xF
|
||||
#define QIB_6120_IntClear_RcvAvail3IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvAvail2IntClear_LSB 0xE
|
||||
#define QIB_6120_IntClear_RcvAvail2IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvAvail1IntClear_LSB 0xD
|
||||
#define QIB_6120_IntClear_RcvAvail1IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvAvail0IntClear_LSB 0xC
|
||||
#define QIB_6120_IntClear_RcvAvail0IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_Reserved1_LSB 0x5
|
||||
#define QIB_6120_IntClear_Reserved1_RMASK 0x7F
|
||||
#define QIB_6120_IntClear_RcvUrg4IntClear_LSB 0x4
|
||||
#define QIB_6120_IntClear_RcvUrg4IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvUrg3IntClear_LSB 0x3
|
||||
#define QIB_6120_IntClear_RcvUrg3IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvUrg2IntClear_LSB 0x2
|
||||
#define QIB_6120_IntClear_RcvUrg2IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvUrg1IntClear_LSB 0x1
|
||||
#define QIB_6120_IntClear_RcvUrg1IntClear_RMASK 0x1
|
||||
#define QIB_6120_IntClear_RcvUrg0IntClear_LSB 0x0
|
||||
#define QIB_6120_IntClear_RcvUrg0IntClear_RMASK 0x1
|
||||
|
||||
#define QIB_6120_ErrMask_OFFS 0x80
|
||||
#define QIB_6120_ErrMask_Reserved_LSB 0x34
|
||||
#define QIB_6120_ErrMask_Reserved_RMASK 0xFFF
|
||||
#define QIB_6120_ErrMask_HardwareErrMask_LSB 0x33
|
||||
#define QIB_6120_ErrMask_HardwareErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_ResetNegatedMask_LSB 0x32
|
||||
#define QIB_6120_ErrMask_ResetNegatedMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_InvalidAddrErrMask_LSB 0x31
|
||||
#define QIB_6120_ErrMask_InvalidAddrErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_IBStatusChangedMask_LSB 0x30
|
||||
#define QIB_6120_ErrMask_IBStatusChangedMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_Reserved1_LSB 0x26
|
||||
#define QIB_6120_ErrMask_Reserved1_RMASK 0x3FF
|
||||
#define QIB_6120_ErrMask_SendUnsupportedVLErrMask_LSB 0x25
|
||||
#define QIB_6120_ErrMask_SendUnsupportedVLErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendUnexpectedPktNumErrMask_LSB 0x24
|
||||
#define QIB_6120_ErrMask_SendUnexpectedPktNumErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendPioArmLaunchErrMask_LSB 0x23
|
||||
#define QIB_6120_ErrMask_SendPioArmLaunchErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendDroppedDataPktErrMask_LSB 0x22
|
||||
#define QIB_6120_ErrMask_SendDroppedDataPktErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendDroppedSmpPktErrMask_LSB 0x21
|
||||
#define QIB_6120_ErrMask_SendDroppedSmpPktErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendPktLenErrMask_LSB 0x20
|
||||
#define QIB_6120_ErrMask_SendPktLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendUnderRunErrMask_LSB 0x1F
|
||||
#define QIB_6120_ErrMask_SendUnderRunErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendMaxPktLenErrMask_LSB 0x1E
|
||||
#define QIB_6120_ErrMask_SendMaxPktLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_SendMinPktLenErrMask_LSB 0x1D
|
||||
#define QIB_6120_ErrMask_SendMinPktLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_Reserved2_LSB 0x12
|
||||
#define QIB_6120_ErrMask_Reserved2_RMASK 0x7FF
|
||||
#define QIB_6120_ErrMask_RcvIBLostLinkErrMask_LSB 0x11
|
||||
#define QIB_6120_ErrMask_RcvIBLostLinkErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvHdrErrMask_LSB 0x10
|
||||
#define QIB_6120_ErrMask_RcvHdrErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvHdrLenErrMask_LSB 0xF
|
||||
#define QIB_6120_ErrMask_RcvHdrLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvBadTidErrMask_LSB 0xE
|
||||
#define QIB_6120_ErrMask_RcvBadTidErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvHdrFullErrMask_LSB 0xD
|
||||
#define QIB_6120_ErrMask_RcvHdrFullErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvEgrFullErrMask_LSB 0xC
|
||||
#define QIB_6120_ErrMask_RcvEgrFullErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvBadVersionErrMask_LSB 0xB
|
||||
#define QIB_6120_ErrMask_RcvBadVersionErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvIBFlowErrMask_LSB 0xA
|
||||
#define QIB_6120_ErrMask_RcvIBFlowErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvEBPErrMask_LSB 0x9
|
||||
#define QIB_6120_ErrMask_RcvEBPErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvUnsupportedVLErrMask_LSB 0x8
|
||||
#define QIB_6120_ErrMask_RcvUnsupportedVLErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvUnexpectedCharErrMask_LSB 0x7
|
||||
#define QIB_6120_ErrMask_RcvUnexpectedCharErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvShortPktLenErrMask_LSB 0x6
|
||||
#define QIB_6120_ErrMask_RcvShortPktLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvLongPktLenErrMask_LSB 0x5
|
||||
#define QIB_6120_ErrMask_RcvLongPktLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvMaxPktLenErrMask_LSB 0x4
|
||||
#define QIB_6120_ErrMask_RcvMaxPktLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvMinPktLenErrMask_LSB 0x3
|
||||
#define QIB_6120_ErrMask_RcvMinPktLenErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvICRCErrMask_LSB 0x2
|
||||
#define QIB_6120_ErrMask_RcvICRCErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvVCRCErrMask_LSB 0x1
|
||||
#define QIB_6120_ErrMask_RcvVCRCErrMask_RMASK 0x1
|
||||
#define QIB_6120_ErrMask_RcvFormatErrMask_LSB 0x0
|
||||
#define QIB_6120_ErrMask_RcvFormatErrMask_RMASK 0x1
|
||||
|
||||
#define QIB_6120_ErrStatus_OFFS 0x88
|
||||
#define QIB_6120_ErrStatus_Reserved_LSB 0x34
|
||||
#define QIB_6120_ErrStatus_Reserved_RMASK 0xFFF
|
||||
#define QIB_6120_ErrStatus_HardwareErr_LSB 0x33
|
||||
#define QIB_6120_ErrStatus_HardwareErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_ResetNegated_LSB 0x32
|
||||
#define QIB_6120_ErrStatus_ResetNegated_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_InvalidAddrErr_LSB 0x31
|
||||
#define QIB_6120_ErrStatus_InvalidAddrErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_IBStatusChanged_LSB 0x30
|
||||
#define QIB_6120_ErrStatus_IBStatusChanged_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_Reserved1_LSB 0x26
|
||||
#define QIB_6120_ErrStatus_Reserved1_RMASK 0x3FF
|
||||
#define QIB_6120_ErrStatus_SendUnsupportedVLErr_LSB 0x25
|
||||
#define QIB_6120_ErrStatus_SendUnsupportedVLErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendUnexpectedPktNumErr_LSB 0x24
|
||||
#define QIB_6120_ErrStatus_SendUnexpectedPktNumErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendPioArmLaunchErr_LSB 0x23
|
||||
#define QIB_6120_ErrStatus_SendPioArmLaunchErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendDroppedDataPktErr_LSB 0x22
|
||||
#define QIB_6120_ErrStatus_SendDroppedDataPktErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendDroppedSmpPktErr_LSB 0x21
|
||||
#define QIB_6120_ErrStatus_SendDroppedSmpPktErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendPktLenErr_LSB 0x20
|
||||
#define QIB_6120_ErrStatus_SendPktLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendUnderRunErr_LSB 0x1F
|
||||
#define QIB_6120_ErrStatus_SendUnderRunErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendMaxPktLenErr_LSB 0x1E
|
||||
#define QIB_6120_ErrStatus_SendMaxPktLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_SendMinPktLenErr_LSB 0x1D
|
||||
#define QIB_6120_ErrStatus_SendMinPktLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_Reserved2_LSB 0x12
|
||||
#define QIB_6120_ErrStatus_Reserved2_RMASK 0x7FF
|
||||
#define QIB_6120_ErrStatus_RcvIBLostLinkErr_LSB 0x11
|
||||
#define QIB_6120_ErrStatus_RcvIBLostLinkErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvHdrErr_LSB 0x10
|
||||
#define QIB_6120_ErrStatus_RcvHdrErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvHdrLenErr_LSB 0xF
|
||||
#define QIB_6120_ErrStatus_RcvHdrLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvBadTidErr_LSB 0xE
|
||||
#define QIB_6120_ErrStatus_RcvBadTidErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvHdrFullErr_LSB 0xD
|
||||
#define QIB_6120_ErrStatus_RcvHdrFullErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvEgrFullErr_LSB 0xC
|
||||
#define QIB_6120_ErrStatus_RcvEgrFullErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvBadVersionErr_LSB 0xB
|
||||
#define QIB_6120_ErrStatus_RcvBadVersionErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvIBFlowErr_LSB 0xA
|
||||
#define QIB_6120_ErrStatus_RcvIBFlowErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvEBPErr_LSB 0x9
|
||||
#define QIB_6120_ErrStatus_RcvEBPErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvUnsupportedVLErr_LSB 0x8
|
||||
#define QIB_6120_ErrStatus_RcvUnsupportedVLErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvUnexpectedCharErr_LSB 0x7
|
||||
#define QIB_6120_ErrStatus_RcvUnexpectedCharErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvShortPktLenErr_LSB 0x6
|
||||
#define QIB_6120_ErrStatus_RcvShortPktLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvLongPktLenErr_LSB 0x5
|
||||
#define QIB_6120_ErrStatus_RcvLongPktLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvMaxPktLenErr_LSB 0x4
|
||||
#define QIB_6120_ErrStatus_RcvMaxPktLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvMinPktLenErr_LSB 0x3
|
||||
#define QIB_6120_ErrStatus_RcvMinPktLenErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvICRCErr_LSB 0x2
|
||||
#define QIB_6120_ErrStatus_RcvICRCErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvVCRCErr_LSB 0x1
|
||||
#define QIB_6120_ErrStatus_RcvVCRCErr_RMASK 0x1
|
||||
#define QIB_6120_ErrStatus_RcvFormatErr_LSB 0x0
|
||||
#define QIB_6120_ErrStatus_RcvFormatErr_RMASK 0x1
|
||||
|
||||
#define QIB_6120_ErrClear_OFFS 0x90
|
||||
#define QIB_6120_ErrClear_Reserved_LSB 0x34
|
||||
#define QIB_6120_ErrClear_Reserved_RMASK 0xFFF
|
||||
#define QIB_6120_ErrClear_HardwareErrClear_LSB 0x33
|
||||
#define QIB_6120_ErrClear_HardwareErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_ResetNegatedClear_LSB 0x32
|
||||
#define QIB_6120_ErrClear_ResetNegatedClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_InvalidAddrErrClear_LSB 0x31
|
||||
#define QIB_6120_ErrClear_InvalidAddrErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_IBStatusChangedClear_LSB 0x30
|
||||
#define QIB_6120_ErrClear_IBStatusChangedClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_Reserved1_LSB 0x26
|
||||
#define QIB_6120_ErrClear_Reserved1_RMASK 0x3FF
|
||||
#define QIB_6120_ErrClear_SendUnsupportedVLErrClear_LSB 0x25
|
||||
#define QIB_6120_ErrClear_SendUnsupportedVLErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendUnexpectedPktNumErrClear_LSB 0x24
|
||||
#define QIB_6120_ErrClear_SendUnexpectedPktNumErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendPioArmLaunchErrClear_LSB 0x23
|
||||
#define QIB_6120_ErrClear_SendPioArmLaunchErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendDroppedDataPktErrClear_LSB 0x22
|
||||
#define QIB_6120_ErrClear_SendDroppedDataPktErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendDroppedSmpPktErrClear_LSB 0x21
|
||||
#define QIB_6120_ErrClear_SendDroppedSmpPktErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendPktLenErrClear_LSB 0x20
|
||||
#define QIB_6120_ErrClear_SendPktLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendUnderRunErrClear_LSB 0x1F
|
||||
#define QIB_6120_ErrClear_SendUnderRunErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendMaxPktLenErrClear_LSB 0x1E
|
||||
#define QIB_6120_ErrClear_SendMaxPktLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_SendMinPktLenErrClear_LSB 0x1D
|
||||
#define QIB_6120_ErrClear_SendMinPktLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_Reserved2_LSB 0x12
|
||||
#define QIB_6120_ErrClear_Reserved2_RMASK 0x7FF
|
||||
#define QIB_6120_ErrClear_RcvIBLostLinkErrClear_LSB 0x11
|
||||
#define QIB_6120_ErrClear_RcvIBLostLinkErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvHdrErrClear_LSB 0x10
|
||||
#define QIB_6120_ErrClear_RcvHdrErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvHdrLenErrClear_LSB 0xF
|
||||
#define QIB_6120_ErrClear_RcvHdrLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvBadTidErrClear_LSB 0xE
|
||||
#define QIB_6120_ErrClear_RcvBadTidErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvHdrFullErrClear_LSB 0xD
|
||||
#define QIB_6120_ErrClear_RcvHdrFullErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvEgrFullErrClear_LSB 0xC
|
||||
#define QIB_6120_ErrClear_RcvEgrFullErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvBadVersionErrClear_LSB 0xB
|
||||
#define QIB_6120_ErrClear_RcvBadVersionErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvIBFlowErrClear_LSB 0xA
|
||||
#define QIB_6120_ErrClear_RcvIBFlowErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvEBPErrClear_LSB 0x9
|
||||
#define QIB_6120_ErrClear_RcvEBPErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvUnsupportedVLErrClear_LSB 0x8
|
||||
#define QIB_6120_ErrClear_RcvUnsupportedVLErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvUnexpectedCharErrClear_LSB 0x7
|
||||
#define QIB_6120_ErrClear_RcvUnexpectedCharErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvShortPktLenErrClear_LSB 0x6
|
||||
#define QIB_6120_ErrClear_RcvShortPktLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvLongPktLenErrClear_LSB 0x5
|
||||
#define QIB_6120_ErrClear_RcvLongPktLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvMaxPktLenErrClear_LSB 0x4
|
||||
#define QIB_6120_ErrClear_RcvMaxPktLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvMinPktLenErrClear_LSB 0x3
|
||||
#define QIB_6120_ErrClear_RcvMinPktLenErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvICRCErrClear_LSB 0x2
|
||||
#define QIB_6120_ErrClear_RcvICRCErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvVCRCErrClear_LSB 0x1
|
||||
#define QIB_6120_ErrClear_RcvVCRCErrClear_RMASK 0x1
|
||||
#define QIB_6120_ErrClear_RcvFormatErrClear_LSB 0x0
|
||||
#define QIB_6120_ErrClear_RcvFormatErrClear_RMASK 0x1
|
||||
|
||||
#define QIB_6120_HwErrMask_OFFS 0x98
|
||||
#define QIB_6120_HwErrMask_IBCBusFromSPCParityErrMask_LSB 0x3F
|
||||
#define QIB_6120_HwErrMask_IBCBusFromSPCParityErrMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_IBCBusToSPCParityErrMask_LSB 0x3E
|
||||
#define QIB_6120_HwErrMask_IBCBusToSPCParityErrMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_Reserved_LSB 0x3D
|
||||
#define QIB_6120_HwErrMask_Reserved_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_IBSerdesPClkNotDetectMask_LSB 0x3C
|
||||
#define QIB_6120_HwErrMask_IBSerdesPClkNotDetectMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_PCIESerdesQ0PClkNotDetectMask_LSB 0x3B
|
||||
#define QIB_6120_HwErrMask_PCIESerdesQ0PClkNotDetectMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_PCIESerdesQ1PClkNotDetectMask_LSB 0x3A
|
||||
#define QIB_6120_HwErrMask_PCIESerdesQ1PClkNotDetectMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_Reserved1_LSB 0x39
|
||||
#define QIB_6120_HwErrMask_Reserved1_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_IBPLLrfSlipMask_LSB 0x38
|
||||
#define QIB_6120_HwErrMask_IBPLLrfSlipMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_IBPLLfbSlipMask_LSB 0x37
|
||||
#define QIB_6120_HwErrMask_IBPLLfbSlipMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_PowerOnBISTFailedMask_LSB 0x36
|
||||
#define QIB_6120_HwErrMask_PowerOnBISTFailedMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_Reserved2_LSB 0x33
|
||||
#define QIB_6120_HwErrMask_Reserved2_RMASK 0x7
|
||||
#define QIB_6120_HwErrMask_RXEMemParityErrMask_LSB 0x2C
|
||||
#define QIB_6120_HwErrMask_RXEMemParityErrMask_RMASK 0x7F
|
||||
#define QIB_6120_HwErrMask_TXEMemParityErrMask_LSB 0x28
|
||||
#define QIB_6120_HwErrMask_TXEMemParityErrMask_RMASK 0xF
|
||||
#define QIB_6120_HwErrMask_Reserved3_LSB 0x22
|
||||
#define QIB_6120_HwErrMask_Reserved3_RMASK 0x3F
|
||||
#define QIB_6120_HwErrMask_PCIeBusParityErrMask_LSB 0x1F
|
||||
#define QIB_6120_HwErrMask_PCIeBusParityErrMask_RMASK 0x7
|
||||
#define QIB_6120_HwErrMask_PcieCplTimeoutMask_LSB 0x1E
|
||||
#define QIB_6120_HwErrMask_PcieCplTimeoutMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_PoisonedTLPMask_LSB 0x1D
|
||||
#define QIB_6120_HwErrMask_PoisonedTLPMask_RMASK 0x1
|
||||
#define QIB_6120_HwErrMask_Reserved4_LSB 0x6
|
||||
#define QIB_6120_HwErrMask_Reserved4_RMASK 0x7FFFFF
|
||||
#define QIB_6120_HwErrMask_PCIeMemParityErrMask_LSB 0x0
|
||||
#define QIB_6120_HwErrMask_PCIeMemParityErrMask_RMASK 0x3F
|
||||
|
||||
#define QIB_6120_HwErrStatus_OFFS 0xA0
|
||||
#define QIB_6120_HwErrStatus_IBCBusFromSPCParityErr_LSB 0x3F
|
||||
#define QIB_6120_HwErrStatus_IBCBusFromSPCParityErr_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_IBCBusToSPCParityErr_LSB 0x3E
|
||||
#define QIB_6120_HwErrStatus_IBCBusToSPCParityErr_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_Reserved_LSB 0x3D
|
||||
#define QIB_6120_HwErrStatus_Reserved_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_IBSerdesPClkNotDetect_LSB 0x3C
|
||||
#define QIB_6120_HwErrStatus_IBSerdesPClkNotDetect_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_PCIESerdesQ0PClkNotDetect_LSB 0x3B
|
||||
#define QIB_6120_HwErrStatus_PCIESerdesQ0PClkNotDetect_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_PCIESerdesQ1PClkNotDetect_LSB 0x3A
|
||||
#define QIB_6120_HwErrStatus_PCIESerdesQ1PClkNotDetect_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_Reserved1_LSB 0x39
|
||||
#define QIB_6120_HwErrStatus_Reserved1_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_IBPLLrfSlip_LSB 0x38
|
||||
#define QIB_6120_HwErrStatus_IBPLLrfSlip_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_IBPLLfbSlip_LSB 0x37
|
||||
#define QIB_6120_HwErrStatus_IBPLLfbSlip_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_PowerOnBISTFailed_LSB 0x36
|
||||
#define QIB_6120_HwErrStatus_PowerOnBISTFailed_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_Reserved2_LSB 0x33
|
||||
#define QIB_6120_HwErrStatus_Reserved2_RMASK 0x7
|
||||
#define QIB_6120_HwErrStatus_RXEMemParity_LSB 0x2C
|
||||
#define QIB_6120_HwErrStatus_RXEMemParity_RMASK 0x7F
|
||||
#define QIB_6120_HwErrStatus_TXEMemParity_LSB 0x28
|
||||
#define QIB_6120_HwErrStatus_TXEMemParity_RMASK 0xF
|
||||
#define QIB_6120_HwErrStatus_Reserved3_LSB 0x22
|
||||
#define QIB_6120_HwErrStatus_Reserved3_RMASK 0x3F
|
||||
#define QIB_6120_HwErrStatus_PCIeBusParity_LSB 0x1F
|
||||
#define QIB_6120_HwErrStatus_PCIeBusParity_RMASK 0x7
|
||||
#define QIB_6120_HwErrStatus_PcieCplTimeout_LSB 0x1E
|
||||
#define QIB_6120_HwErrStatus_PcieCplTimeout_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_PoisenedTLP_LSB 0x1D
|
||||
#define QIB_6120_HwErrStatus_PoisenedTLP_RMASK 0x1
|
||||
#define QIB_6120_HwErrStatus_Reserved4_LSB 0x6
|
||||
#define QIB_6120_HwErrStatus_Reserved4_RMASK 0x7FFFFF
|
||||
#define QIB_6120_HwErrStatus_PCIeMemParity_LSB 0x0
|
||||
#define QIB_6120_HwErrStatus_PCIeMemParity_RMASK 0x3F
|
||||
|
||||
#define QIB_6120_HwErrClear_OFFS 0xA8
|
||||
#define QIB_6120_HwErrClear_IBCBusFromSPCParityErrClear_LSB 0x3F
|
||||
#define QIB_6120_HwErrClear_IBCBusFromSPCParityErrClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_IBCBusToSPCparityErrClear_LSB 0x3E
|
||||
#define QIB_6120_HwErrClear_IBCBusToSPCparityErrClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_Reserved_LSB 0x3D
|
||||
#define QIB_6120_HwErrClear_Reserved_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_IBSerdesPClkNotDetectClear_LSB 0x3C
|
||||
#define QIB_6120_HwErrClear_IBSerdesPClkNotDetectClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_PCIESerdesQ0PClkNotDetectClear_LSB 0x3B
|
||||
#define QIB_6120_HwErrClear_PCIESerdesQ0PClkNotDetectClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_PCIESerdesQ1PClkNotDetectClear_LSB 0x3A
|
||||
#define QIB_6120_HwErrClear_PCIESerdesQ1PClkNotDetectClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_Reserved1_LSB 0x39
|
||||
#define QIB_6120_HwErrClear_Reserved1_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_IBPLLrfSlipClear_LSB 0x38
|
||||
#define QIB_6120_HwErrClear_IBPLLrfSlipClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_IBPLLfbSlipClear_LSB 0x37
|
||||
#define QIB_6120_HwErrClear_IBPLLfbSlipClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_PowerOnBISTFailedClear_LSB 0x36
|
||||
#define QIB_6120_HwErrClear_PowerOnBISTFailedClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_Reserved2_LSB 0x33
|
||||
#define QIB_6120_HwErrClear_Reserved2_RMASK 0x7
|
||||
#define QIB_6120_HwErrClear_RXEMemParityClear_LSB 0x2C
|
||||
#define QIB_6120_HwErrClear_RXEMemParityClear_RMASK 0x7F
|
||||
#define QIB_6120_HwErrClear_TXEMemParityClear_LSB 0x28
|
||||
#define QIB_6120_HwErrClear_TXEMemParityClear_RMASK 0xF
|
||||
#define QIB_6120_HwErrClear_Reserved3_LSB 0x22
|
||||
#define QIB_6120_HwErrClear_Reserved3_RMASK 0x3F
|
||||
#define QIB_6120_HwErrClear_PCIeBusParityClr_LSB 0x1F
|
||||
#define QIB_6120_HwErrClear_PCIeBusParityClr_RMASK 0x7
|
||||
#define QIB_6120_HwErrClear_PcieCplTimeoutClear_LSB 0x1E
|
||||
#define QIB_6120_HwErrClear_PcieCplTimeoutClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_PoisonedTLPClear_LSB 0x1D
|
||||
#define QIB_6120_HwErrClear_PoisonedTLPClear_RMASK 0x1
|
||||
#define QIB_6120_HwErrClear_Reserved4_LSB 0x6
|
||||
#define QIB_6120_HwErrClear_Reserved4_RMASK 0x7FFFFF
|
||||
#define QIB_6120_HwErrClear_PCIeMemParityClr_LSB 0x0
|
||||
#define QIB_6120_HwErrClear_PCIeMemParityClr_RMASK 0x3F
|
||||
|
||||
#define QIB_6120_HwDiagCtrl_OFFS 0xB0
|
||||
#define QIB_6120_HwDiagCtrl_ForceIBCBusFromSPCParityErr_LSB 0x3F
|
||||
#define QIB_6120_HwDiagCtrl_ForceIBCBusFromSPCParityErr_RMASK 0x1
|
||||
#define QIB_6120_HwDiagCtrl_ForceIBCBusToSPCParityErr_LSB 0x3E
|
||||
#define QIB_6120_HwDiagCtrl_ForceIBCBusToSPCParityErr_RMASK 0x1
|
||||
#define QIB_6120_HwDiagCtrl_CounterWrEnable_LSB 0x3D
|
||||
#define QIB_6120_HwDiagCtrl_CounterWrEnable_RMASK 0x1
|
||||
#define QIB_6120_HwDiagCtrl_CounterDisable_LSB 0x3C
|
||||
#define QIB_6120_HwDiagCtrl_CounterDisable_RMASK 0x1
|
||||
#define QIB_6120_HwDiagCtrl_Reserved_LSB 0x33
|
||||
#define QIB_6120_HwDiagCtrl_Reserved_RMASK 0x1FF
|
||||
#define QIB_6120_HwDiagCtrl_ForceRxMemParityErr_LSB 0x2C
|
||||
#define QIB_6120_HwDiagCtrl_ForceRxMemParityErr_RMASK 0x7F
|
||||
#define QIB_6120_HwDiagCtrl_ForceTxMemparityErr_LSB 0x28
|
||||
#define QIB_6120_HwDiagCtrl_ForceTxMemparityErr_RMASK 0xF
|
||||
#define QIB_6120_HwDiagCtrl_Reserved1_LSB 0x23
|
||||
#define QIB_6120_HwDiagCtrl_Reserved1_RMASK 0x1F
|
||||
#define QIB_6120_HwDiagCtrl_forcePCIeBusParity_LSB 0x1F
|
||||
#define QIB_6120_HwDiagCtrl_forcePCIeBusParity_RMASK 0xF
|
||||
#define QIB_6120_HwDiagCtrl_Reserved2_LSB 0x6
|
||||
#define QIB_6120_HwDiagCtrl_Reserved2_RMASK 0x1FFFFFF
|
||||
#define QIB_6120_HwDiagCtrl_forcePCIeMemParity_LSB 0x0
|
||||
#define QIB_6120_HwDiagCtrl_forcePCIeMemParity_RMASK 0x3F
|
||||
|
||||
#define QIB_6120_IBCStatus_OFFS 0xC0
|
||||
#define QIB_6120_IBCStatus_TxCreditOk_LSB 0x1F
|
||||
#define QIB_6120_IBCStatus_TxCreditOk_RMASK 0x1
|
||||
#define QIB_6120_IBCStatus_TxReady_LSB 0x1E
|
||||
#define QIB_6120_IBCStatus_TxReady_RMASK 0x1
|
||||
#define QIB_6120_IBCStatus_Reserved_LSB 0x7
|
||||
#define QIB_6120_IBCStatus_Reserved_RMASK 0x7FFFFF
|
||||
#define QIB_6120_IBCStatus_LinkState_LSB 0x4
|
||||
#define QIB_6120_IBCStatus_LinkState_RMASK 0x7
|
||||
#define QIB_6120_IBCStatus_LinkTrainingState_LSB 0x0
|
||||
#define QIB_6120_IBCStatus_LinkTrainingState_RMASK 0xF
|
||||
|
||||
#define QIB_6120_IBCCtrl_OFFS 0xC8
|
||||
#define QIB_6120_IBCCtrl_Loopback_LSB 0x3F
|
||||
#define QIB_6120_IBCCtrl_Loopback_RMASK 0x1
|
||||
#define QIB_6120_IBCCtrl_LinkDownDefaultState_LSB 0x3E
|
||||
#define QIB_6120_IBCCtrl_LinkDownDefaultState_RMASK 0x1
|
||||
#define QIB_6120_IBCCtrl_Reserved_LSB 0x2B
|
||||
#define QIB_6120_IBCCtrl_Reserved_RMASK 0x7FFFF
|
||||
#define QIB_6120_IBCCtrl_CreditScale_LSB 0x28
|
||||
#define QIB_6120_IBCCtrl_CreditScale_RMASK 0x7
|
||||
#define QIB_6120_IBCCtrl_OverrunThreshold_LSB 0x24
|
||||
#define QIB_6120_IBCCtrl_OverrunThreshold_RMASK 0xF
|
||||
#define QIB_6120_IBCCtrl_PhyerrThreshold_LSB 0x20
|
||||
#define QIB_6120_IBCCtrl_PhyerrThreshold_RMASK 0xF
|
||||
#define QIB_6120_IBCCtrl_Reserved1_LSB 0x1F
|
||||
#define QIB_6120_IBCCtrl_Reserved1_RMASK 0x1
|
||||
#define QIB_6120_IBCCtrl_MaxPktLen_LSB 0x14
|
||||
#define QIB_6120_IBCCtrl_MaxPktLen_RMASK 0x7FF
|
||||
#define QIB_6120_IBCCtrl_LinkCmd_LSB 0x12
|
||||
#define QIB_6120_IBCCtrl_LinkCmd_RMASK 0x3
|
||||
#define QIB_6120_IBCCtrl_LinkInitCmd_LSB 0x10
|
||||
#define QIB_6120_IBCCtrl_LinkInitCmd_RMASK 0x3
|
||||
#define QIB_6120_IBCCtrl_FlowCtrlWaterMark_LSB 0x8
|
||||
#define QIB_6120_IBCCtrl_FlowCtrlWaterMark_RMASK 0xFF
|
||||
#define QIB_6120_IBCCtrl_FlowCtrlPeriod_LSB 0x0
|
||||
#define QIB_6120_IBCCtrl_FlowCtrlPeriod_RMASK 0xFF
|
||||
|
||||
#define QIB_6120_EXTStatus_OFFS 0xD0
|
||||
#define QIB_6120_EXTStatus_GPIOIn_LSB 0x30
|
||||
#define QIB_6120_EXTStatus_GPIOIn_RMASK 0xFFFF
|
||||
#define QIB_6120_EXTStatus_Reserved_LSB 0x20
|
||||
#define QIB_6120_EXTStatus_Reserved_RMASK 0xFFFF
|
||||
#define QIB_6120_EXTStatus_Reserved1_LSB 0x10
|
||||
#define QIB_6120_EXTStatus_Reserved1_RMASK 0xFFFF
|
||||
#define QIB_6120_EXTStatus_MemBISTFoundErr_LSB 0xF
|
||||
#define QIB_6120_EXTStatus_MemBISTFoundErr_RMASK 0x1
|
||||
#define QIB_6120_EXTStatus_MemBISTEndTest_LSB 0xE
|
||||
#define QIB_6120_EXTStatus_MemBISTEndTest_RMASK 0x1
|
||||
#define QIB_6120_EXTStatus_Reserved2_LSB 0x0
|
||||
#define QIB_6120_EXTStatus_Reserved2_RMASK 0x3FFF
|
||||
|
||||
#define QIB_6120_EXTCtrl_OFFS 0xD8
|
||||
#define QIB_6120_EXTCtrl_GPIOOe_LSB 0x30
|
||||
#define QIB_6120_EXTCtrl_GPIOOe_RMASK 0xFFFF
|
||||
#define QIB_6120_EXTCtrl_GPIOInvert_LSB 0x20
|
||||
#define QIB_6120_EXTCtrl_GPIOInvert_RMASK 0xFFFF
|
||||
#define QIB_6120_EXTCtrl_Reserved_LSB 0x4
|
||||
#define QIB_6120_EXTCtrl_Reserved_RMASK 0xFFFFFFF
|
||||
#define QIB_6120_EXTCtrl_LEDPriPortGreenOn_LSB 0x3
|
||||
#define QIB_6120_EXTCtrl_LEDPriPortGreenOn_RMASK 0x1
|
||||
#define QIB_6120_EXTCtrl_LEDPriPortYellowOn_LSB 0x2
|
||||
#define QIB_6120_EXTCtrl_LEDPriPortYellowOn_RMASK 0x1
|
||||
#define QIB_6120_EXTCtrl_LEDGblOkGreenOn_LSB 0x1
|
||||
#define QIB_6120_EXTCtrl_LEDGblOkGreenOn_RMASK 0x1
|
||||
#define QIB_6120_EXTCtrl_LEDGblErrRedOff_LSB 0x0
|
||||
#define QIB_6120_EXTCtrl_LEDGblErrRedOff_RMASK 0x1
|
||||
|
||||
#define QIB_6120_GPIOOut_OFFS 0xE0
|
||||
|
||||
#define QIB_6120_GPIOMask_OFFS 0xE8
|
||||
|
||||
#define QIB_6120_GPIOStatus_OFFS 0xF0
|
||||
|
||||
#define QIB_6120_GPIOClear_OFFS 0xF8
|
||||
|
||||
#define QIB_6120_RcvCtrl_OFFS 0x100
|
||||
#define QIB_6120_RcvCtrl_TailUpd_LSB 0x1F
|
||||
#define QIB_6120_RcvCtrl_TailUpd_RMASK 0x1
|
||||
#define QIB_6120_RcvCtrl_RcvPartitionKeyDisable_LSB 0x1E
|
||||
#define QIB_6120_RcvCtrl_RcvPartitionKeyDisable_RMASK 0x1
|
||||
#define QIB_6120_RcvCtrl_Reserved_LSB 0x15
|
||||
#define QIB_6120_RcvCtrl_Reserved_RMASK 0x1FF
|
||||
#define QIB_6120_RcvCtrl_IntrAvail_LSB 0x10
|
||||
#define QIB_6120_RcvCtrl_IntrAvail_RMASK 0x1F
|
||||
#define QIB_6120_RcvCtrl_Reserved1_LSB 0x9
|
||||
#define QIB_6120_RcvCtrl_Reserved1_RMASK 0x7F
|
||||
#define QIB_6120_RcvCtrl_Reserved2_LSB 0x5
|
||||
#define QIB_6120_RcvCtrl_Reserved2_RMASK 0xF
|
||||
#define QIB_6120_RcvCtrl_PortEnable_LSB 0x0
|
||||
#define QIB_6120_RcvCtrl_PortEnable_RMASK 0x1F
|
||||
|
||||
#define QIB_6120_RcvBTHQP_OFFS 0x108
|
||||
#define QIB_6120_RcvBTHQP_BTHQP_Mask_LSB 0x1E
|
||||
#define QIB_6120_RcvBTHQP_BTHQP_Mask_RMASK 0x3
|
||||
#define QIB_6120_RcvBTHQP_Reserved_LSB 0x18
|
||||
#define QIB_6120_RcvBTHQP_Reserved_RMASK 0x3F
|
||||
#define QIB_6120_RcvBTHQP_RcvBTHQP_LSB 0x0
|
||||
#define QIB_6120_RcvBTHQP_RcvBTHQP_RMASK 0xFFFFFF
|
||||
|
||||
#define QIB_6120_RcvHdrSize_OFFS 0x110
|
||||
|
||||
#define QIB_6120_RcvHdrCnt_OFFS 0x118
|
||||
|
||||
#define QIB_6120_RcvHdrEntSize_OFFS 0x120
|
||||
|
||||
#define QIB_6120_RcvTIDBase_OFFS 0x128
|
||||
|
||||
#define QIB_6120_RcvTIDCnt_OFFS 0x130
|
||||
|
||||
#define QIB_6120_RcvEgrBase_OFFS 0x138
|
||||
|
||||
#define QIB_6120_RcvEgrCnt_OFFS 0x140
|
||||
|
||||
#define QIB_6120_RcvBufBase_OFFS 0x148
|
||||
|
||||
#define QIB_6120_RcvBufSize_OFFS 0x150
|
||||
|
||||
#define QIB_6120_RxIntMemBase_OFFS 0x158
|
||||
|
||||
#define QIB_6120_RxIntMemSize_OFFS 0x160
|
||||
|
||||
#define QIB_6120_RcvPartitionKey_OFFS 0x168
|
||||
|
||||
#define QIB_6120_RcvPktLEDCnt_OFFS 0x178
|
||||
#define QIB_6120_RcvPktLEDCnt_ONperiod_LSB 0x20
|
||||
#define QIB_6120_RcvPktLEDCnt_ONperiod_RMASK 0xFFFFFFFF
|
||||
#define QIB_6120_RcvPktLEDCnt_OFFperiod_LSB 0x0
|
||||
#define QIB_6120_RcvPktLEDCnt_OFFperiod_RMASK 0xFFFFFFFF
|
||||
|
||||
#define QIB_6120_SendCtrl_OFFS 0x1C0
|
||||
#define QIB_6120_SendCtrl_Disarm_LSB 0x1F
|
||||
#define QIB_6120_SendCtrl_Disarm_RMASK 0x1
|
||||
#define QIB_6120_SendCtrl_Reserved_LSB 0x17
|
||||
#define QIB_6120_SendCtrl_Reserved_RMASK 0xFF
|
||||
#define QIB_6120_SendCtrl_DisarmPIOBuf_LSB 0x10
|
||||
#define QIB_6120_SendCtrl_DisarmPIOBuf_RMASK 0x7F
|
||||
#define QIB_6120_SendCtrl_Reserved1_LSB 0x4
|
||||
#define QIB_6120_SendCtrl_Reserved1_RMASK 0xFFF
|
||||
#define QIB_6120_SendCtrl_PIOEnable_LSB 0x3
|
||||
#define QIB_6120_SendCtrl_PIOEnable_RMASK 0x1
|
||||
#define QIB_6120_SendCtrl_PIOBufAvailUpd_LSB 0x2
|
||||
#define QIB_6120_SendCtrl_PIOBufAvailUpd_RMASK 0x1
|
||||
#define QIB_6120_SendCtrl_PIOIntBufAvail_LSB 0x1
|
||||
#define QIB_6120_SendCtrl_PIOIntBufAvail_RMASK 0x1
|
||||
#define QIB_6120_SendCtrl_Abort_LSB 0x0
|
||||
#define QIB_6120_SendCtrl_Abort_RMASK 0x1
|
||||
|
||||
#define QIB_6120_SendPIOBufBase_OFFS 0x1C8
|
||||
#define QIB_6120_SendPIOBufBase_Reserved_LSB 0x35
|
||||
#define QIB_6120_SendPIOBufBase_Reserved_RMASK 0x7FF
|
||||
#define QIB_6120_SendPIOBufBase_BaseAddr_LargePIO_LSB 0x20
|
||||
#define QIB_6120_SendPIOBufBase_BaseAddr_LargePIO_RMASK 0x1FFFFF
|
||||
#define QIB_6120_SendPIOBufBase_Reserved1_LSB 0x15
|
||||
#define QIB_6120_SendPIOBufBase_Reserved1_RMASK 0x7FF
|
||||
#define QIB_6120_SendPIOBufBase_BaseAddr_SmallPIO_LSB 0x0
|
||||
#define QIB_6120_SendPIOBufBase_BaseAddr_SmallPIO_RMASK 0x1FFFFF
|
||||
|
||||
#define QIB_6120_SendPIOSize_OFFS 0x1D0
|
||||
#define QIB_6120_SendPIOSize_Reserved_LSB 0x2D
|
||||
#define QIB_6120_SendPIOSize_Reserved_RMASK 0xFFFFF
|
||||
#define QIB_6120_SendPIOSize_Size_LargePIO_LSB 0x20
|
||||
#define QIB_6120_SendPIOSize_Size_LargePIO_RMASK 0x1FFF
|
||||
#define QIB_6120_SendPIOSize_Reserved1_LSB 0xC
|
||||
#define QIB_6120_SendPIOSize_Reserved1_RMASK 0xFFFFF
|
||||
#define QIB_6120_SendPIOSize_Size_SmallPIO_LSB 0x0
|
||||
#define QIB_6120_SendPIOSize_Size_SmallPIO_RMASK 0xFFF
|
||||
|
||||
#define QIB_6120_SendPIOBufCnt_OFFS 0x1D8
|
||||
#define QIB_6120_SendPIOBufCnt_Reserved_LSB 0x24
|
||||
#define QIB_6120_SendPIOBufCnt_Reserved_RMASK 0xFFFFFFF
|
||||
#define QIB_6120_SendPIOBufCnt_Num_LargePIO_LSB 0x20
|
||||
#define QIB_6120_SendPIOBufCnt_Num_LargePIO_RMASK 0xF
|
||||
#define QIB_6120_SendPIOBufCnt_Reserved1_LSB 0x9
|
||||
#define QIB_6120_SendPIOBufCnt_Reserved1_RMASK 0x7FFFFF
|
||||
#define QIB_6120_SendPIOBufCnt_Num_SmallPIO_LSB 0x0
|
||||
#define QIB_6120_SendPIOBufCnt_Num_SmallPIO_RMASK 0x1FF
|
||||
|
||||
#define QIB_6120_SendPIOAvailAddr_OFFS 0x1E0
|
||||
#define QIB_6120_SendPIOAvailAddr_SendPIOAvailAddr_LSB 0x6
|
||||
#define QIB_6120_SendPIOAvailAddr_SendPIOAvailAddr_RMASK 0x3FFFFFFFF
|
||||
#define QIB_6120_SendPIOAvailAddr_Reserved_LSB 0x0
|
||||
#define QIB_6120_SendPIOAvailAddr_Reserved_RMASK 0x3F
|
||||
|
||||
#define QIB_6120_SendBufErr0_OFFS 0x240
|
||||
#define QIB_6120_SendBufErr0_SendBufErrPIO_63_0_LSB 0x0
|
||||
#define QIB_6120_SendBufErr0_SendBufErrPIO_63_0_RMASK 0x0
|
||||
|
||||
#define QIB_6120_RcvHdrAddr0_OFFS 0x280
|
||||
#define QIB_6120_RcvHdrAddr0_RcvHdrAddr0_LSB 0x2
|
||||
#define QIB_6120_RcvHdrAddr0_RcvHdrAddr0_RMASK 0x3FFFFFFFFF
|
||||
#define QIB_6120_RcvHdrAddr0_Reserved_LSB 0x0
|
||||
#define QIB_6120_RcvHdrAddr0_Reserved_RMASK 0x3
|
||||
|
||||
#define QIB_6120_RcvHdrTailAddr0_OFFS 0x300
|
||||
#define QIB_6120_RcvHdrTailAddr0_RcvHdrTailAddr0_LSB 0x2
|
||||
#define QIB_6120_RcvHdrTailAddr0_RcvHdrTailAddr0_RMASK 0x3FFFFFFFFF
|
||||
#define QIB_6120_RcvHdrTailAddr0_Reserved_LSB 0x0
|
||||
#define QIB_6120_RcvHdrTailAddr0_Reserved_RMASK 0x3
|
||||
|
||||
#define QIB_6120_SerdesCfg0_OFFS 0x3C0
|
||||
#define QIB_6120_SerdesCfg0_DisableIBTxIdleDetect_LSB 0x3F
|
||||
#define QIB_6120_SerdesCfg0_DisableIBTxIdleDetect_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_Reserved_LSB 0x38
|
||||
#define QIB_6120_SerdesCfg0_Reserved_RMASK 0x7F
|
||||
#define QIB_6120_SerdesCfg0_RxEqCtl_LSB 0x36
|
||||
#define QIB_6120_SerdesCfg0_RxEqCtl_RMASK 0x3
|
||||
#define QIB_6120_SerdesCfg0_TxTermAdj_LSB 0x34
|
||||
#define QIB_6120_SerdesCfg0_TxTermAdj_RMASK 0x3
|
||||
#define QIB_6120_SerdesCfg0_RxTermAdj_LSB 0x32
|
||||
#define QIB_6120_SerdesCfg0_RxTermAdj_RMASK 0x3
|
||||
#define QIB_6120_SerdesCfg0_TermAdj1_LSB 0x31
|
||||
#define QIB_6120_SerdesCfg0_TermAdj1_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_TermAdj0_LSB 0x30
|
||||
#define QIB_6120_SerdesCfg0_TermAdj0_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_LPBKA_LSB 0x2F
|
||||
#define QIB_6120_SerdesCfg0_LPBKA_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_LPBKB_LSB 0x2E
|
||||
#define QIB_6120_SerdesCfg0_LPBKB_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_LPBKC_LSB 0x2D
|
||||
#define QIB_6120_SerdesCfg0_LPBKC_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_LPBKD_LSB 0x2C
|
||||
#define QIB_6120_SerdesCfg0_LPBKD_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_PW_LSB 0x2B
|
||||
#define QIB_6120_SerdesCfg0_PW_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_RefSel_LSB 0x29
|
||||
#define QIB_6120_SerdesCfg0_RefSel_RMASK 0x3
|
||||
#define QIB_6120_SerdesCfg0_ParReset_LSB 0x28
|
||||
#define QIB_6120_SerdesCfg0_ParReset_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_ParLPBK_LSB 0x27
|
||||
#define QIB_6120_SerdesCfg0_ParLPBK_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_OffsetEn_LSB 0x26
|
||||
#define QIB_6120_SerdesCfg0_OffsetEn_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_Offset_LSB 0x1E
|
||||
#define QIB_6120_SerdesCfg0_Offset_RMASK 0xFF
|
||||
#define QIB_6120_SerdesCfg0_L2PwrDn_LSB 0x1D
|
||||
#define QIB_6120_SerdesCfg0_L2PwrDn_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_ResetPLL_LSB 0x1C
|
||||
#define QIB_6120_SerdesCfg0_ResetPLL_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_RxTermEnX_LSB 0x18
|
||||
#define QIB_6120_SerdesCfg0_RxTermEnX_RMASK 0xF
|
||||
#define QIB_6120_SerdesCfg0_BeaconTxEnX_LSB 0x14
|
||||
#define QIB_6120_SerdesCfg0_BeaconTxEnX_RMASK 0xF
|
||||
#define QIB_6120_SerdesCfg0_RxDetEnX_LSB 0x10
|
||||
#define QIB_6120_SerdesCfg0_RxDetEnX_RMASK 0xF
|
||||
#define QIB_6120_SerdesCfg0_TxIdeEnX_LSB 0xC
|
||||
#define QIB_6120_SerdesCfg0_TxIdeEnX_RMASK 0xF
|
||||
#define QIB_6120_SerdesCfg0_RxIdleEnX_LSB 0x8
|
||||
#define QIB_6120_SerdesCfg0_RxIdleEnX_RMASK 0xF
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnA_LSB 0x7
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnA_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnB_LSB 0x6
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnB_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnC_LSB 0x5
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnC_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnD_LSB 0x4
|
||||
#define QIB_6120_SerdesCfg0_L1PwrDnD_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_ResetA_LSB 0x3
|
||||
#define QIB_6120_SerdesCfg0_ResetA_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_ResetB_LSB 0x2
|
||||
#define QIB_6120_SerdesCfg0_ResetB_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_ResetC_LSB 0x1
|
||||
#define QIB_6120_SerdesCfg0_ResetC_RMASK 0x1
|
||||
#define QIB_6120_SerdesCfg0_ResetD_LSB 0x0
|
||||
#define QIB_6120_SerdesCfg0_ResetD_RMASK 0x1
|
||||
|
||||
#define QIB_6120_SerdesStat_OFFS 0x3D0
|
||||
#define QIB_6120_SerdesStat_Reserved_LSB 0xC
|
||||
#define QIB_6120_SerdesStat_Reserved_RMASK 0xFFFFFFFFFFFFF
|
||||
#define QIB_6120_SerdesStat_BeaconDetA_LSB 0xB
|
||||
#define QIB_6120_SerdesStat_BeaconDetA_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_BeaconDetB_LSB 0xA
|
||||
#define QIB_6120_SerdesStat_BeaconDetB_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_BeaconDetC_LSB 0x9
|
||||
#define QIB_6120_SerdesStat_BeaconDetC_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_BeaconDetD_LSB 0x8
|
||||
#define QIB_6120_SerdesStat_BeaconDetD_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_RxDetA_LSB 0x7
|
||||
#define QIB_6120_SerdesStat_RxDetA_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_RxDetB_LSB 0x6
|
||||
#define QIB_6120_SerdesStat_RxDetB_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_RxDetC_LSB 0x5
|
||||
#define QIB_6120_SerdesStat_RxDetC_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_RxDetD_LSB 0x4
|
||||
#define QIB_6120_SerdesStat_RxDetD_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_TxIdleDetA_LSB 0x3
|
||||
#define QIB_6120_SerdesStat_TxIdleDetA_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_TxIdleDetB_LSB 0x2
|
||||
#define QIB_6120_SerdesStat_TxIdleDetB_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_TxIdleDetC_LSB 0x1
|
||||
#define QIB_6120_SerdesStat_TxIdleDetC_RMASK 0x1
|
||||
#define QIB_6120_SerdesStat_TxIdleDetD_LSB 0x0
|
||||
#define QIB_6120_SerdesStat_TxIdleDetD_RMASK 0x1
|
||||
|
||||
#define QIB_6120_XGXSCfg_OFFS 0x3D8
|
||||
#define QIB_6120_XGXSCfg_ArmLaunchErrorDisable_LSB 0x3F
|
||||
#define QIB_6120_XGXSCfg_ArmLaunchErrorDisable_RMASK 0x1
|
||||
#define QIB_6120_XGXSCfg_Reserved_LSB 0x17
|
||||
#define QIB_6120_XGXSCfg_Reserved_RMASK 0xFFFFFFFFFF
|
||||
#define QIB_6120_XGXSCfg_polarity_inv_LSB 0x13
|
||||
#define QIB_6120_XGXSCfg_polarity_inv_RMASK 0xF
|
||||
#define QIB_6120_XGXSCfg_link_sync_mask_LSB 0x9
|
||||
#define QIB_6120_XGXSCfg_link_sync_mask_RMASK 0x3FF
|
||||
#define QIB_6120_XGXSCfg_port_addr_LSB 0x4
|
||||
#define QIB_6120_XGXSCfg_port_addr_RMASK 0x1F
|
||||
#define QIB_6120_XGXSCfg_mdd_30_LSB 0x3
|
||||
#define QIB_6120_XGXSCfg_mdd_30_RMASK 0x1
|
||||
#define QIB_6120_XGXSCfg_xcv_resetn_LSB 0x2
|
||||
#define QIB_6120_XGXSCfg_xcv_resetn_RMASK 0x1
|
||||
#define QIB_6120_XGXSCfg_Reserved1_LSB 0x1
|
||||
#define QIB_6120_XGXSCfg_Reserved1_RMASK 0x1
|
||||
#define QIB_6120_XGXSCfg_tx_rx_resetn_LSB 0x0
|
||||
#define QIB_6120_XGXSCfg_tx_rx_resetn_RMASK 0x1
|
||||
|
||||
#define QIB_6120_LBIntCnt_OFFS 0x12000
|
||||
|
||||
#define QIB_6120_LBFlowStallCnt_OFFS 0x12008
|
||||
|
||||
#define QIB_6120_TxUnsupVLErrCnt_OFFS 0x12018
|
||||
|
||||
#define QIB_6120_TxDataPktCnt_OFFS 0x12020
|
||||
|
||||
#define QIB_6120_TxFlowPktCnt_OFFS 0x12028
|
||||
|
||||
#define QIB_6120_TxDwordCnt_OFFS 0x12030
|
||||
|
||||
#define QIB_6120_TxLenErrCnt_OFFS 0x12038
|
||||
|
||||
#define QIB_6120_TxMaxMinLenErrCnt_OFFS 0x12040
|
||||
|
||||
#define QIB_6120_TxUnderrunCnt_OFFS 0x12048
|
||||
|
||||
#define QIB_6120_TxFlowStallCnt_OFFS 0x12050
|
||||
|
||||
#define QIB_6120_TxDroppedPktCnt_OFFS 0x12058
|
||||
|
||||
#define QIB_6120_RxDroppedPktCnt_OFFS 0x12060
|
||||
|
||||
#define QIB_6120_RxDataPktCnt_OFFS 0x12068
|
||||
|
||||
#define QIB_6120_RxFlowPktCnt_OFFS 0x12070
|
||||
|
||||
#define QIB_6120_RxDwordCnt_OFFS 0x12078
|
||||
|
||||
#define QIB_6120_RxLenErrCnt_OFFS 0x12080
|
||||
|
||||
#define QIB_6120_RxMaxMinLenErrCnt_OFFS 0x12088
|
||||
|
||||
#define QIB_6120_RxICRCErrCnt_OFFS 0x12090
|
||||
|
||||
#define QIB_6120_RxVCRCErrCnt_OFFS 0x12098
|
||||
|
||||
#define QIB_6120_RxFlowCtrlErrCnt_OFFS 0x120A0
|
||||
|
||||
#define QIB_6120_RxBadFormatCnt_OFFS 0x120A8
|
||||
|
||||
#define QIB_6120_RxLinkProblemCnt_OFFS 0x120B0
|
||||
|
||||
#define QIB_6120_RxEBPCnt_OFFS 0x120B8
|
||||
|
||||
#define QIB_6120_RxLPCRCErrCnt_OFFS 0x120C0
|
||||
|
||||
#define QIB_6120_RxBufOvflCnt_OFFS 0x120C8
|
||||
|
||||
#define QIB_6120_RxTIDFullErrCnt_OFFS 0x120D0
|
||||
|
||||
#define QIB_6120_RxTIDValidErrCnt_OFFS 0x120D8
|
||||
|
||||
#define QIB_6120_RxPKeyMismatchCnt_OFFS 0x120E0
|
||||
|
||||
#define QIB_6120_RxP0HdrEgrOvflCnt_OFFS 0x120E8
|
||||
|
||||
#define QIB_6120_IBStatusChangeCnt_OFFS 0x12140
|
||||
|
||||
#define QIB_6120_IBLinkErrRecoveryCnt_OFFS 0x12148
|
||||
|
||||
#define QIB_6120_IBLinkDownedCnt_OFFS 0x12150
|
||||
|
||||
#define QIB_6120_IBSymbolErrCnt_OFFS 0x12158
|
||||
|
||||
#define QIB_6120_PcieRetryBufDiagQwordCnt_OFFS 0x12170
|
||||
|
||||
#define QIB_6120_RcvEgrArray0_OFFS 0x14000
|
||||
|
||||
#define QIB_6120_RcvTIDArray0_OFFS 0x54000
|
||||
|
||||
#define QIB_6120_PIOLaunchFIFO_OFFS 0x64000
|
||||
|
||||
#define QIB_6120_SendPIOpbcCache_OFFS 0x64800
|
||||
|
||||
#define QIB_6120_RcvBuf1_OFFS 0x72000
|
||||
|
||||
#define QIB_6120_RcvBuf2_OFFS 0x75000
|
||||
|
||||
#define QIB_6120_RcvFlags_OFFS 0x77000
|
||||
|
||||
#define QIB_6120_RcvLookupBuf1_OFFS 0x79000
|
||||
|
||||
#define QIB_6120_RcvDMABuf_OFFS 0x7B000
|
||||
|
||||
#define QIB_6120_MiscRXEIntMem_OFFS 0x7C000
|
||||
|
||||
#define QIB_6120_PCIERcvBuf_OFFS 0x80000
|
||||
|
||||
#define QIB_6120_PCIERetryBuf_OFFS 0x82000
|
||||
|
||||
#define QIB_6120_PCIERcvBufRdToWrAddr_OFFS 0x84000
|
||||
|
||||
#define QIB_6120_PIOBuf0_MA_OFFS 0x100000
|
||||
156
drivers/infiniband/hw/qib/qib_7220.h
Normal file
156
drivers/infiniband/hw/qib/qib_7220.h
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
#ifndef _QIB_7220_H
|
||||
#define _QIB_7220_H
|
||||
/*
|
||||
* Copyright (c) 2007, 2009, 2010 QLogic Corporation. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* grab register-defs auto-generated by HW */
|
||||
#include "qib_7220_regs.h"
|
||||
|
||||
/* The number of eager receive TIDs for context zero. */
|
||||
#define IBA7220_KRCVEGRCNT 2048U
|
||||
|
||||
#define IB_7220_LT_STATE_CFGRCVFCFG 0x09
|
||||
#define IB_7220_LT_STATE_CFGWAITRMT 0x0a
|
||||
#define IB_7220_LT_STATE_TXREVLANES 0x0d
|
||||
#define IB_7220_LT_STATE_CFGENH 0x10
|
||||
|
||||
struct qib_chip_specific {
|
||||
u64 __iomem *cregbase;
|
||||
u64 *cntrs;
|
||||
u64 *portcntrs;
|
||||
spinlock_t sdepb_lock; /* serdes EPB bus */
|
||||
spinlock_t rcvmod_lock; /* protect rcvctrl shadow changes */
|
||||
spinlock_t gpio_lock; /* RMW of shadows/regs for ExtCtrl and GPIO */
|
||||
u64 hwerrmask;
|
||||
u64 errormask;
|
||||
u64 gpio_out; /* shadow of kr_gpio_out, for rmw ops */
|
||||
u64 gpio_mask; /* shadow the gpio mask register */
|
||||
u64 extctrl; /* shadow the gpio output enable, etc... */
|
||||
u32 ncntrs;
|
||||
u32 nportcntrs;
|
||||
u32 cntrnamelen;
|
||||
u32 portcntrnamelen;
|
||||
u32 numctxts;
|
||||
u32 rcvegrcnt;
|
||||
u32 autoneg_tries;
|
||||
u32 serdes_first_init_done;
|
||||
u32 sdmabufcnt;
|
||||
u32 lastbuf_for_pio;
|
||||
u32 updthresh; /* current AvailUpdThld */
|
||||
u32 updthresh_dflt; /* default AvailUpdThld */
|
||||
int irq;
|
||||
u8 presets_needed;
|
||||
u8 relock_timer_active;
|
||||
char emsgbuf[128];
|
||||
char sdmamsgbuf[192];
|
||||
char bitsmsgbuf[64];
|
||||
struct timer_list relock_timer;
|
||||
unsigned int relock_interval; /* in jiffies */
|
||||
};
|
||||
|
||||
struct qib_chippport_specific {
|
||||
struct qib_pportdata pportdata;
|
||||
wait_queue_head_t autoneg_wait;
|
||||
struct delayed_work autoneg_work;
|
||||
struct timer_list chase_timer;
|
||||
/*
|
||||
* these 5 fields are used to establish deltas for IB symbol
|
||||
* errors and linkrecovery errors. They can be reported on
|
||||
* some chips during link negotiation prior to INIT, and with
|
||||
* DDR when faking DDR negotiations with non-IBTA switches.
|
||||
* The chip counters are adjusted at driver unload if there is
|
||||
* a non-zero delta.
|
||||
*/
|
||||
u64 ibdeltainprog;
|
||||
u64 ibsymdelta;
|
||||
u64 ibsymsnap;
|
||||
u64 iblnkerrdelta;
|
||||
u64 iblnkerrsnap;
|
||||
u64 ibcctrl; /* kr_ibcctrl shadow */
|
||||
u64 ibcddrctrl; /* kr_ibcddrctrl shadow */
|
||||
u64 chase_end;
|
||||
u32 last_delay_mult;
|
||||
};
|
||||
|
||||
/*
|
||||
* This header file provides the declarations and common definitions
|
||||
* for (mostly) manipulation of the SerDes blocks within the IBA7220.
|
||||
* the functions declared should only be called from within other
|
||||
* 7220-related files such as qib_iba7220.c or qib_sd7220.c.
|
||||
*/
|
||||
int qib_sd7220_presets(struct qib_devdata *dd);
|
||||
int qib_sd7220_init(struct qib_devdata *dd);
|
||||
int qib_sd7220_prog_ld(struct qib_devdata *dd, int sdnum, u8 *img,
|
||||
int len, int offset);
|
||||
int qib_sd7220_prog_vfy(struct qib_devdata *dd, int sdnum, const u8 *img,
|
||||
int len, int offset);
|
||||
void qib_sd7220_clr_ibpar(struct qib_devdata *);
|
||||
/*
|
||||
* Below used for sdnum parameter, selecting one of the two sections
|
||||
* used for PCIe, or the single SerDes used for IB, which is the
|
||||
* only one currently used
|
||||
*/
|
||||
#define IB_7220_SERDES 2
|
||||
|
||||
int qib_sd7220_ib_load(struct qib_devdata *dd);
|
||||
int qib_sd7220_ib_vfy(struct qib_devdata *dd);
|
||||
|
||||
static inline u32 qib_read_kreg32(const struct qib_devdata *dd,
|
||||
const u16 regno)
|
||||
{
|
||||
if (!dd->kregbase || !(dd->flags & QIB_PRESENT))
|
||||
return -1;
|
||||
return readl((u32 __iomem *)&dd->kregbase[regno]);
|
||||
}
|
||||
|
||||
static inline u64 qib_read_kreg64(const struct qib_devdata *dd,
|
||||
const u16 regno)
|
||||
{
|
||||
if (!dd->kregbase || !(dd->flags & QIB_PRESENT))
|
||||
return -1;
|
||||
|
||||
return readq(&dd->kregbase[regno]);
|
||||
}
|
||||
|
||||
static inline void qib_write_kreg(const struct qib_devdata *dd,
|
||||
const u16 regno, u64 value)
|
||||
{
|
||||
if (dd->kregbase)
|
||||
writeq(value, &dd->kregbase[regno]);
|
||||
}
|
||||
|
||||
void set_7220_relock_poll(struct qib_devdata *, int);
|
||||
void shutdown_7220_relock_poll(struct qib_devdata *);
|
||||
void toggle_7220_rclkrls(struct qib_devdata *);
|
||||
|
||||
|
||||
#endif /* _QIB_7220_H */
|
||||
1496
drivers/infiniband/hw/qib/qib_7220_regs.h
Normal file
1496
drivers/infiniband/hw/qib/qib_7220_regs.h
Normal file
File diff suppressed because it is too large
Load diff
3163
drivers/infiniband/hw/qib/qib_7322_regs.h
Normal file
3163
drivers/infiniband/hw/qib/qib_7322_regs.h
Normal file
File diff suppressed because it is too large
Load diff
758
drivers/infiniband/hw/qib/qib_common.h
Normal file
758
drivers/infiniband/hw/qib/qib_common.h
Normal file
|
|
@ -0,0 +1,758 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _QIB_COMMON_H
|
||||
#define _QIB_COMMON_H
|
||||
|
||||
/*
|
||||
* This file contains defines, structures, etc. that are used
|
||||
* to communicate between kernel and user code.
|
||||
*/
|
||||
|
||||
/* This is the IEEE-assigned OUI for QLogic Inc. QLogic_IB */
|
||||
#define QIB_SRC_OUI_1 0x00
|
||||
#define QIB_SRC_OUI_2 0x11
|
||||
#define QIB_SRC_OUI_3 0x75
|
||||
|
||||
/* version of protocol header (known to chip also). In the long run,
|
||||
* we should be able to generate and accept a range of version numbers;
|
||||
* for now we only accept one, and it's compiled in.
|
||||
*/
|
||||
#define IPS_PROTO_VERSION 2
|
||||
|
||||
/*
|
||||
* These are compile time constants that you may want to enable or disable
|
||||
* if you are trying to debug problems with code or performance.
|
||||
* QIB_VERBOSE_TRACING define as 1 if you want additional tracing in
|
||||
* fastpath code
|
||||
* QIB_TRACE_REGWRITES define as 1 if you want register writes to be
|
||||
* traced in faspath code
|
||||
* _QIB_TRACING define as 0 if you want to remove all tracing in a
|
||||
* compilation unit
|
||||
*/
|
||||
|
||||
/*
|
||||
* The value in the BTH QP field that QLogic_IB uses to differentiate
|
||||
* an qlogic_ib protocol IB packet vs standard IB transport
|
||||
* This it needs to be even (0x656b78), because the LSB is sometimes
|
||||
* used for the MSB of context. The change may cause a problem
|
||||
* interoperating with older software.
|
||||
*/
|
||||
#define QIB_KD_QP 0x656b78
|
||||
|
||||
/*
|
||||
* These are the status bits readable (in ascii form, 64bit value)
|
||||
* from the "status" sysfs file. For binary compatibility, values
|
||||
* must remain as is; removed states can be reused for different
|
||||
* purposes.
|
||||
*/
|
||||
#define QIB_STATUS_INITTED 0x1 /* basic initialization done */
|
||||
/* Chip has been found and initted */
|
||||
#define QIB_STATUS_CHIP_PRESENT 0x20
|
||||
/* IB link is at ACTIVE, usable for data traffic */
|
||||
#define QIB_STATUS_IB_READY 0x40
|
||||
/* link is configured, LID, MTU, etc. have been set */
|
||||
#define QIB_STATUS_IB_CONF 0x80
|
||||
/* A Fatal hardware error has occurred. */
|
||||
#define QIB_STATUS_HWERROR 0x200
|
||||
|
||||
/*
|
||||
* The list of usermode accessible registers. Also see Reg_* later in file.
|
||||
*/
|
||||
enum qib_ureg {
|
||||
/* (RO) DMA RcvHdr to be used next. */
|
||||
ur_rcvhdrtail = 0,
|
||||
/* (RW) RcvHdr entry to be processed next by host. */
|
||||
ur_rcvhdrhead = 1,
|
||||
/* (RO) Index of next Eager index to use. */
|
||||
ur_rcvegrindextail = 2,
|
||||
/* (RW) Eager TID to be processed next */
|
||||
ur_rcvegrindexhead = 3,
|
||||
/* For internal use only; max register number. */
|
||||
_QIB_UregMax
|
||||
};
|
||||
|
||||
/* bit values for spi_runtime_flags */
|
||||
#define QIB_RUNTIME_PCIE 0x0002
|
||||
#define QIB_RUNTIME_FORCE_WC_ORDER 0x0004
|
||||
#define QIB_RUNTIME_RCVHDR_COPY 0x0008
|
||||
#define QIB_RUNTIME_MASTER 0x0010
|
||||
#define QIB_RUNTIME_RCHK 0x0020
|
||||
#define QIB_RUNTIME_NODMA_RTAIL 0x0080
|
||||
#define QIB_RUNTIME_SPECIAL_TRIGGER 0x0100
|
||||
#define QIB_RUNTIME_SDMA 0x0200
|
||||
#define QIB_RUNTIME_FORCE_PIOAVAIL 0x0400
|
||||
#define QIB_RUNTIME_PIO_REGSWAPPED 0x0800
|
||||
#define QIB_RUNTIME_CTXT_MSB_IN_QP 0x1000
|
||||
#define QIB_RUNTIME_CTXT_REDIRECT 0x2000
|
||||
#define QIB_RUNTIME_HDRSUPP 0x4000
|
||||
|
||||
/*
|
||||
* This structure is returned by qib_userinit() immediately after
|
||||
* open to get implementation-specific info, and info specific to this
|
||||
* instance.
|
||||
*
|
||||
* This struct must have explict pad fields where type sizes
|
||||
* may result in different alignments between 32 and 64 bit
|
||||
* programs, since the 64 bit * bit kernel requires the user code
|
||||
* to have matching offsets
|
||||
*/
|
||||
struct qib_base_info {
|
||||
/* version of hardware, for feature checking. */
|
||||
__u32 spi_hw_version;
|
||||
/* version of software, for feature checking. */
|
||||
__u32 spi_sw_version;
|
||||
/* QLogic_IB context assigned, goes into sent packets */
|
||||
__u16 spi_ctxt;
|
||||
__u16 spi_subctxt;
|
||||
/*
|
||||
* IB MTU, packets IB data must be less than this.
|
||||
* The MTU is in bytes, and will be a multiple of 4 bytes.
|
||||
*/
|
||||
__u32 spi_mtu;
|
||||
/*
|
||||
* Size of a PIO buffer. Any given packet's total size must be less
|
||||
* than this (in words). Included is the starting control word, so
|
||||
* if 513 is returned, then total pkt size is 512 words or less.
|
||||
*/
|
||||
__u32 spi_piosize;
|
||||
/* size of the TID cache in qlogic_ib, in entries */
|
||||
__u32 spi_tidcnt;
|
||||
/* size of the TID Eager list in qlogic_ib, in entries */
|
||||
__u32 spi_tidegrcnt;
|
||||
/* size of a single receive header queue entry in words. */
|
||||
__u32 spi_rcvhdrent_size;
|
||||
/*
|
||||
* Count of receive header queue entries allocated.
|
||||
* This may be less than the spu_rcvhdrcnt passed in!.
|
||||
*/
|
||||
__u32 spi_rcvhdr_cnt;
|
||||
|
||||
/* per-chip and other runtime features bitmap (QIB_RUNTIME_*) */
|
||||
__u32 spi_runtime_flags;
|
||||
|
||||
/* address where hardware receive header queue is mapped */
|
||||
__u64 spi_rcvhdr_base;
|
||||
|
||||
/* user program. */
|
||||
|
||||
/* base address of eager TID receive buffers used by hardware. */
|
||||
__u64 spi_rcv_egrbufs;
|
||||
|
||||
/* Allocated by initialization code, not by protocol. */
|
||||
|
||||
/*
|
||||
* Size of each TID buffer in host memory, starting at
|
||||
* spi_rcv_egrbufs. The buffers are virtually contiguous.
|
||||
*/
|
||||
__u32 spi_rcv_egrbufsize;
|
||||
/*
|
||||
* The special QP (queue pair) value that identifies an qlogic_ib
|
||||
* protocol packet from standard IB packets. More, probably much
|
||||
* more, to be added.
|
||||
*/
|
||||
__u32 spi_qpair;
|
||||
|
||||
/*
|
||||
* User register base for init code, not to be used directly by
|
||||
* protocol or applications. Always points to chip registers,
|
||||
* for normal or shared context.
|
||||
*/
|
||||
__u64 spi_uregbase;
|
||||
/*
|
||||
* Maximum buffer size in bytes that can be used in a single TID
|
||||
* entry (assuming the buffer is aligned to this boundary). This is
|
||||
* the minimum of what the hardware and software support Guaranteed
|
||||
* to be a power of 2.
|
||||
*/
|
||||
__u32 spi_tid_maxsize;
|
||||
/*
|
||||
* alignment of each pio send buffer (byte count
|
||||
* to add to spi_piobufbase to get to second buffer)
|
||||
*/
|
||||
__u32 spi_pioalign;
|
||||
/*
|
||||
* The index of the first pio buffer available to this process;
|
||||
* needed to do lookup in spi_pioavailaddr; not added to
|
||||
* spi_piobufbase.
|
||||
*/
|
||||
__u32 spi_pioindex;
|
||||
/* number of buffers mapped for this process */
|
||||
__u32 spi_piocnt;
|
||||
|
||||
/*
|
||||
* Base address of writeonly pio buffers for this process.
|
||||
* Each buffer has spi_piosize words, and is aligned on spi_pioalign
|
||||
* boundaries. spi_piocnt buffers are mapped from this address
|
||||
*/
|
||||
__u64 spi_piobufbase;
|
||||
|
||||
/*
|
||||
* Base address of readonly memory copy of the pioavail registers.
|
||||
* There are 2 bits for each buffer.
|
||||
*/
|
||||
__u64 spi_pioavailaddr;
|
||||
|
||||
/*
|
||||
* Address where driver updates a copy of the interface and driver
|
||||
* status (QIB_STATUS_*) as a 64 bit value. It's followed by a
|
||||
* link status qword (formerly combined with driver status), then a
|
||||
* string indicating hardware error, if there was one.
|
||||
*/
|
||||
__u64 spi_status;
|
||||
|
||||
/* number of chip ctxts available to user processes */
|
||||
__u32 spi_nctxts;
|
||||
__u16 spi_unit; /* unit number of chip we are using */
|
||||
__u16 spi_port; /* IB port number we are using */
|
||||
/* num bufs in each contiguous set */
|
||||
__u32 spi_rcv_egrperchunk;
|
||||
/* size in bytes of each contiguous set */
|
||||
__u32 spi_rcv_egrchunksize;
|
||||
/* total size of mmap to cover full rcvegrbuffers */
|
||||
__u32 spi_rcv_egrbuftotlen;
|
||||
__u32 spi_rhf_offset; /* dword offset in hdrqent for rcvhdr flags */
|
||||
/* address of readonly memory copy of the rcvhdrq tail register. */
|
||||
__u64 spi_rcvhdr_tailaddr;
|
||||
|
||||
/*
|
||||
* shared memory pages for subctxts if ctxt is shared; these cover
|
||||
* all the processes in the group sharing a single context.
|
||||
* all have enough space for the num_subcontexts value on this job.
|
||||
*/
|
||||
__u64 spi_subctxt_uregbase;
|
||||
__u64 spi_subctxt_rcvegrbuf;
|
||||
__u64 spi_subctxt_rcvhdr_base;
|
||||
|
||||
/* shared memory page for send buffer disarm status */
|
||||
__u64 spi_sendbuf_status;
|
||||
} __attribute__ ((aligned(8)));
|
||||
|
||||
/*
|
||||
* This version number is given to the driver by the user code during
|
||||
* initialization in the spu_userversion field of qib_user_info, so
|
||||
* the driver can check for compatibility with user code.
|
||||
*
|
||||
* The major version changes when data structures
|
||||
* change in an incompatible way. The driver must be the same or higher
|
||||
* for initialization to succeed. In some cases, a higher version
|
||||
* driver will not interoperate with older software, and initialization
|
||||
* will return an error.
|
||||
*/
|
||||
#define QIB_USER_SWMAJOR 1
|
||||
|
||||
/*
|
||||
* Minor version differences are always compatible
|
||||
* a within a major version, however if user software is larger
|
||||
* than driver software, some new features and/or structure fields
|
||||
* may not be implemented; the user code must deal with this if it
|
||||
* cares, or it must abort after initialization reports the difference.
|
||||
*/
|
||||
#define QIB_USER_SWMINOR 10
|
||||
|
||||
#define QIB_USER_SWVERSION ((QIB_USER_SWMAJOR << 16) | QIB_USER_SWMINOR)
|
||||
|
||||
#ifndef QIB_KERN_TYPE
|
||||
#define QIB_KERN_TYPE 0
|
||||
#define QIB_IDSTR "QLogic kernel.org driver"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Similarly, this is the kernel version going back to the user. It's
|
||||
* slightly different, in that we want to tell if the driver was built as
|
||||
* part of a QLogic release, or from the driver from openfabrics.org,
|
||||
* kernel.org, or a standard distribution, for support reasons.
|
||||
* The high bit is 0 for non-QLogic and 1 for QLogic-built/supplied.
|
||||
*
|
||||
* It's returned by the driver to the user code during initialization in the
|
||||
* spi_sw_version field of qib_base_info, so the user code can in turn
|
||||
* check for compatibility with the kernel.
|
||||
*/
|
||||
#define QIB_KERN_SWVERSION ((QIB_KERN_TYPE << 31) | QIB_USER_SWVERSION)
|
||||
|
||||
/*
|
||||
* This structure is passed to qib_userinit() to tell the driver where
|
||||
* user code buffers are, sizes, etc. The offsets and sizes of the
|
||||
* fields must remain unchanged, for binary compatibility. It can
|
||||
* be extended, if userversion is changed so user code can tell, if needed
|
||||
*/
|
||||
struct qib_user_info {
|
||||
/*
|
||||
* version of user software, to detect compatibility issues.
|
||||
* Should be set to QIB_USER_SWVERSION.
|
||||
*/
|
||||
__u32 spu_userversion;
|
||||
|
||||
__u32 _spu_unused2;
|
||||
|
||||
/* size of struct base_info to write to */
|
||||
__u32 spu_base_info_size;
|
||||
|
||||
__u32 _spu_unused3;
|
||||
|
||||
/*
|
||||
* If two or more processes wish to share a context, each process
|
||||
* must set the spu_subctxt_cnt and spu_subctxt_id to the same
|
||||
* values. The only restriction on the spu_subctxt_id is that
|
||||
* it be unique for a given node.
|
||||
*/
|
||||
__u16 spu_subctxt_cnt;
|
||||
__u16 spu_subctxt_id;
|
||||
|
||||
__u32 spu_port; /* IB port requested by user if > 0 */
|
||||
|
||||
/*
|
||||
* address of struct base_info to write to
|
||||
*/
|
||||
__u64 spu_base_info;
|
||||
|
||||
} __attribute__ ((aligned(8)));
|
||||
|
||||
/* User commands. */
|
||||
|
||||
/* 16 available, was: old set up userspace (for old user code) */
|
||||
#define QIB_CMD_CTXT_INFO 17 /* find out what resources we got */
|
||||
#define QIB_CMD_RECV_CTRL 18 /* control receipt of packets */
|
||||
#define QIB_CMD_TID_UPDATE 19 /* update expected TID entries */
|
||||
#define QIB_CMD_TID_FREE 20 /* free expected TID entries */
|
||||
#define QIB_CMD_SET_PART_KEY 21 /* add partition key */
|
||||
/* 22 available, was: return info on slave processes (for old user code) */
|
||||
#define QIB_CMD_ASSIGN_CTXT 23 /* allocate HCA and ctxt */
|
||||
#define QIB_CMD_USER_INIT 24 /* set up userspace */
|
||||
#define QIB_CMD_UNUSED_1 25
|
||||
#define QIB_CMD_UNUSED_2 26
|
||||
#define QIB_CMD_PIOAVAILUPD 27 /* force an update of PIOAvail reg */
|
||||
#define QIB_CMD_POLL_TYPE 28 /* set the kind of polling we want */
|
||||
#define QIB_CMD_ARMLAUNCH_CTRL 29 /* armlaunch detection control */
|
||||
/* 30 is unused */
|
||||
#define QIB_CMD_SDMA_INFLIGHT 31 /* sdma inflight counter request */
|
||||
#define QIB_CMD_SDMA_COMPLETE 32 /* sdma completion counter request */
|
||||
/* 33 available, was a testing feature */
|
||||
#define QIB_CMD_DISARM_BUFS 34 /* disarm send buffers w/ errors */
|
||||
#define QIB_CMD_ACK_EVENT 35 /* ack & clear bits */
|
||||
#define QIB_CMD_CPUS_LIST 36 /* list of cpus allocated, for pinned
|
||||
* processes: qib_cpus_list */
|
||||
|
||||
/*
|
||||
* QIB_CMD_ACK_EVENT obsoletes QIB_CMD_DISARM_BUFS, but we keep it for
|
||||
* compatibility with libraries from previous release. The ACK_EVENT
|
||||
* will take appropriate driver action (if any, just DISARM for now),
|
||||
* then clear the bits passed in as part of the mask. These bits are
|
||||
* in the first 64bit word at spi_sendbuf_status, and are passed to
|
||||
* the driver in the event_mask union as well.
|
||||
*/
|
||||
#define _QIB_EVENT_DISARM_BUFS_BIT 0
|
||||
#define _QIB_EVENT_LINKDOWN_BIT 1
|
||||
#define _QIB_EVENT_LID_CHANGE_BIT 2
|
||||
#define _QIB_EVENT_LMC_CHANGE_BIT 3
|
||||
#define _QIB_EVENT_SL2VL_CHANGE_BIT 4
|
||||
#define _QIB_MAX_EVENT_BIT _QIB_EVENT_SL2VL_CHANGE_BIT
|
||||
|
||||
#define QIB_EVENT_DISARM_BUFS_BIT (1UL << _QIB_EVENT_DISARM_BUFS_BIT)
|
||||
#define QIB_EVENT_LINKDOWN_BIT (1UL << _QIB_EVENT_LINKDOWN_BIT)
|
||||
#define QIB_EVENT_LID_CHANGE_BIT (1UL << _QIB_EVENT_LID_CHANGE_BIT)
|
||||
#define QIB_EVENT_LMC_CHANGE_BIT (1UL << _QIB_EVENT_LMC_CHANGE_BIT)
|
||||
#define QIB_EVENT_SL2VL_CHANGE_BIT (1UL << _QIB_EVENT_SL2VL_CHANGE_BIT)
|
||||
|
||||
|
||||
/*
|
||||
* Poll types
|
||||
*/
|
||||
#define QIB_POLL_TYPE_ANYRCV 0x0
|
||||
#define QIB_POLL_TYPE_URGENT 0x1
|
||||
|
||||
struct qib_ctxt_info {
|
||||
__u16 num_active; /* number of active units */
|
||||
__u16 unit; /* unit (chip) assigned to caller */
|
||||
__u16 port; /* IB port assigned to caller (1-based) */
|
||||
__u16 ctxt; /* ctxt on unit assigned to caller */
|
||||
__u16 subctxt; /* subctxt on unit assigned to caller */
|
||||
__u16 num_ctxts; /* number of ctxts available on unit */
|
||||
__u16 num_subctxts; /* number of subctxts opened on ctxt */
|
||||
__u16 rec_cpu; /* cpu # for affinity (ffff if none) */
|
||||
};
|
||||
|
||||
struct qib_tid_info {
|
||||
__u32 tidcnt;
|
||||
/* make structure same size in 32 and 64 bit */
|
||||
__u32 tid__unused;
|
||||
/* virtual address of first page in transfer */
|
||||
__u64 tidvaddr;
|
||||
/* pointer (same size 32/64 bit) to __u16 tid array */
|
||||
__u64 tidlist;
|
||||
|
||||
/*
|
||||
* pointer (same size 32/64 bit) to bitmap of TIDs used
|
||||
* for this call; checked for being large enough at open
|
||||
*/
|
||||
__u64 tidmap;
|
||||
};
|
||||
|
||||
struct qib_cmd {
|
||||
__u32 type; /* command type */
|
||||
union {
|
||||
struct qib_tid_info tid_info;
|
||||
struct qib_user_info user_info;
|
||||
|
||||
/*
|
||||
* address in userspace where we should put the sdma
|
||||
* inflight counter
|
||||
*/
|
||||
__u64 sdma_inflight;
|
||||
/*
|
||||
* address in userspace where we should put the sdma
|
||||
* completion counter
|
||||
*/
|
||||
__u64 sdma_complete;
|
||||
/* address in userspace of struct qib_ctxt_info to
|
||||
write result to */
|
||||
__u64 ctxt_info;
|
||||
/* enable/disable receipt of packets */
|
||||
__u32 recv_ctrl;
|
||||
/* enable/disable armlaunch errors (non-zero to enable) */
|
||||
__u32 armlaunch_ctrl;
|
||||
/* partition key to set */
|
||||
__u16 part_key;
|
||||
/* user address of __u32 bitmask of active slaves */
|
||||
__u64 slave_mask_addr;
|
||||
/* type of polling we want */
|
||||
__u16 poll_type;
|
||||
/* back pressure enable bit for one particular context */
|
||||
__u8 ctxt_bp;
|
||||
/* qib_user_event_ack(), IPATH_EVENT_* bits */
|
||||
__u64 event_mask;
|
||||
} cmd;
|
||||
};
|
||||
|
||||
struct qib_iovec {
|
||||
/* Pointer to data, but same size 32 and 64 bit */
|
||||
__u64 iov_base;
|
||||
|
||||
/*
|
||||
* Length of data; don't need 64 bits, but want
|
||||
* qib_sendpkt to remain same size as before 32 bit changes, so...
|
||||
*/
|
||||
__u64 iov_len;
|
||||
};
|
||||
|
||||
/*
|
||||
* Describes a single packet for send. Each packet can have one or more
|
||||
* buffers, but the total length (exclusive of IB headers) must be less
|
||||
* than the MTU, and if using the PIO method, entire packet length,
|
||||
* including IB headers, must be less than the qib_piosize value (words).
|
||||
* Use of this necessitates including sys/uio.h
|
||||
*/
|
||||
struct __qib_sendpkt {
|
||||
__u32 sps_flags; /* flags for packet (TBD) */
|
||||
__u32 sps_cnt; /* number of entries to use in sps_iov */
|
||||
/* array of iov's describing packet. TEMPORARY */
|
||||
struct qib_iovec sps_iov[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* Diagnostics can send a packet by "writing" the following
|
||||
* structs to the diag data special file.
|
||||
* This allows a custom
|
||||
* pbc (+ static rate) qword, so that special modes and deliberate
|
||||
* changes to CRCs can be used. The elements were also re-ordered
|
||||
* for better alignment and to avoid padding issues.
|
||||
*/
|
||||
#define _DIAG_XPKT_VERS 3
|
||||
struct qib_diag_xpkt {
|
||||
__u16 version;
|
||||
__u16 unit;
|
||||
__u16 port;
|
||||
__u16 len;
|
||||
__u64 data;
|
||||
__u64 pbc_wd;
|
||||
};
|
||||
|
||||
/*
|
||||
* Data layout in I2C flash (for GUID, etc.)
|
||||
* All fields are little-endian binary unless otherwise stated
|
||||
*/
|
||||
#define QIB_FLASH_VERSION 2
|
||||
struct qib_flash {
|
||||
/* flash layout version (QIB_FLASH_VERSION) */
|
||||
__u8 if_fversion;
|
||||
/* checksum protecting if_length bytes */
|
||||
__u8 if_csum;
|
||||
/*
|
||||
* valid length (in use, protected by if_csum), including
|
||||
* if_fversion and if_csum themselves)
|
||||
*/
|
||||
__u8 if_length;
|
||||
/* the GUID, in network order */
|
||||
__u8 if_guid[8];
|
||||
/* number of GUIDs to use, starting from if_guid */
|
||||
__u8 if_numguid;
|
||||
/* the (last 10 characters of) board serial number, in ASCII */
|
||||
char if_serial[12];
|
||||
/* board mfg date (YYYYMMDD ASCII) */
|
||||
char if_mfgdate[8];
|
||||
/* last board rework/test date (YYYYMMDD ASCII) */
|
||||
char if_testdate[8];
|
||||
/* logging of error counts, TBD */
|
||||
__u8 if_errcntp[4];
|
||||
/* powered on hours, updated at driver unload */
|
||||
__u8 if_powerhour[2];
|
||||
/* ASCII free-form comment field */
|
||||
char if_comment[32];
|
||||
/* Backwards compatible prefix for longer QLogic Serial Numbers */
|
||||
char if_sprefix[4];
|
||||
/* 82 bytes used, min flash size is 128 bytes */
|
||||
__u8 if_future[46];
|
||||
};
|
||||
|
||||
/*
|
||||
* These are the counters implemented in the chip, and are listed in order.
|
||||
* The InterCaps naming is taken straight from the chip spec.
|
||||
*/
|
||||
struct qlogic_ib_counters {
|
||||
__u64 LBIntCnt;
|
||||
__u64 LBFlowStallCnt;
|
||||
__u64 TxSDmaDescCnt; /* was Reserved1 */
|
||||
__u64 TxUnsupVLErrCnt;
|
||||
__u64 TxDataPktCnt;
|
||||
__u64 TxFlowPktCnt;
|
||||
__u64 TxDwordCnt;
|
||||
__u64 TxLenErrCnt;
|
||||
__u64 TxMaxMinLenErrCnt;
|
||||
__u64 TxUnderrunCnt;
|
||||
__u64 TxFlowStallCnt;
|
||||
__u64 TxDroppedPktCnt;
|
||||
__u64 RxDroppedPktCnt;
|
||||
__u64 RxDataPktCnt;
|
||||
__u64 RxFlowPktCnt;
|
||||
__u64 RxDwordCnt;
|
||||
__u64 RxLenErrCnt;
|
||||
__u64 RxMaxMinLenErrCnt;
|
||||
__u64 RxICRCErrCnt;
|
||||
__u64 RxVCRCErrCnt;
|
||||
__u64 RxFlowCtrlErrCnt;
|
||||
__u64 RxBadFormatCnt;
|
||||
__u64 RxLinkProblemCnt;
|
||||
__u64 RxEBPCnt;
|
||||
__u64 RxLPCRCErrCnt;
|
||||
__u64 RxBufOvflCnt;
|
||||
__u64 RxTIDFullErrCnt;
|
||||
__u64 RxTIDValidErrCnt;
|
||||
__u64 RxPKeyMismatchCnt;
|
||||
__u64 RxP0HdrEgrOvflCnt;
|
||||
__u64 RxP1HdrEgrOvflCnt;
|
||||
__u64 RxP2HdrEgrOvflCnt;
|
||||
__u64 RxP3HdrEgrOvflCnt;
|
||||
__u64 RxP4HdrEgrOvflCnt;
|
||||
__u64 RxP5HdrEgrOvflCnt;
|
||||
__u64 RxP6HdrEgrOvflCnt;
|
||||
__u64 RxP7HdrEgrOvflCnt;
|
||||
__u64 RxP8HdrEgrOvflCnt;
|
||||
__u64 RxP9HdrEgrOvflCnt;
|
||||
__u64 RxP10HdrEgrOvflCnt;
|
||||
__u64 RxP11HdrEgrOvflCnt;
|
||||
__u64 RxP12HdrEgrOvflCnt;
|
||||
__u64 RxP13HdrEgrOvflCnt;
|
||||
__u64 RxP14HdrEgrOvflCnt;
|
||||
__u64 RxP15HdrEgrOvflCnt;
|
||||
__u64 RxP16HdrEgrOvflCnt;
|
||||
__u64 IBStatusChangeCnt;
|
||||
__u64 IBLinkErrRecoveryCnt;
|
||||
__u64 IBLinkDownedCnt;
|
||||
__u64 IBSymbolErrCnt;
|
||||
__u64 RxVL15DroppedPktCnt;
|
||||
__u64 RxOtherLocalPhyErrCnt;
|
||||
__u64 PcieRetryBufDiagQwordCnt;
|
||||
__u64 ExcessBufferOvflCnt;
|
||||
__u64 LocalLinkIntegrityErrCnt;
|
||||
__u64 RxVlErrCnt;
|
||||
__u64 RxDlidFltrCnt;
|
||||
};
|
||||
|
||||
/*
|
||||
* The next set of defines are for packet headers, and chip register
|
||||
* and memory bits that are visible to and/or used by user-mode software.
|
||||
*/
|
||||
|
||||
/* RcvHdrFlags bits */
|
||||
#define QLOGIC_IB_RHF_LENGTH_MASK 0x7FF
|
||||
#define QLOGIC_IB_RHF_LENGTH_SHIFT 0
|
||||
#define QLOGIC_IB_RHF_RCVTYPE_MASK 0x7
|
||||
#define QLOGIC_IB_RHF_RCVTYPE_SHIFT 11
|
||||
#define QLOGIC_IB_RHF_EGRINDEX_MASK 0xFFF
|
||||
#define QLOGIC_IB_RHF_EGRINDEX_SHIFT 16
|
||||
#define QLOGIC_IB_RHF_SEQ_MASK 0xF
|
||||
#define QLOGIC_IB_RHF_SEQ_SHIFT 0
|
||||
#define QLOGIC_IB_RHF_HDRQ_OFFSET_MASK 0x7FF
|
||||
#define QLOGIC_IB_RHF_HDRQ_OFFSET_SHIFT 4
|
||||
#define QLOGIC_IB_RHF_H_ICRCERR 0x80000000
|
||||
#define QLOGIC_IB_RHF_H_VCRCERR 0x40000000
|
||||
#define QLOGIC_IB_RHF_H_PARITYERR 0x20000000
|
||||
#define QLOGIC_IB_RHF_H_LENERR 0x10000000
|
||||
#define QLOGIC_IB_RHF_H_MTUERR 0x08000000
|
||||
#define QLOGIC_IB_RHF_H_IHDRERR 0x04000000
|
||||
#define QLOGIC_IB_RHF_H_TIDERR 0x02000000
|
||||
#define QLOGIC_IB_RHF_H_MKERR 0x01000000
|
||||
#define QLOGIC_IB_RHF_H_IBERR 0x00800000
|
||||
#define QLOGIC_IB_RHF_H_ERR_MASK 0xFF800000
|
||||
#define QLOGIC_IB_RHF_L_USE_EGR 0x80000000
|
||||
#define QLOGIC_IB_RHF_L_SWA 0x00008000
|
||||
#define QLOGIC_IB_RHF_L_SWB 0x00004000
|
||||
|
||||
/* qlogic_ib header fields */
|
||||
#define QLOGIC_IB_I_VERS_MASK 0xF
|
||||
#define QLOGIC_IB_I_VERS_SHIFT 28
|
||||
#define QLOGIC_IB_I_CTXT_MASK 0xF
|
||||
#define QLOGIC_IB_I_CTXT_SHIFT 24
|
||||
#define QLOGIC_IB_I_TID_MASK 0x7FF
|
||||
#define QLOGIC_IB_I_TID_SHIFT 13
|
||||
#define QLOGIC_IB_I_OFFSET_MASK 0x1FFF
|
||||
#define QLOGIC_IB_I_OFFSET_SHIFT 0
|
||||
|
||||
/* K_PktFlags bits */
|
||||
#define QLOGIC_IB_KPF_INTR 0x1
|
||||
#define QLOGIC_IB_KPF_SUBCTXT_MASK 0x3
|
||||
#define QLOGIC_IB_KPF_SUBCTXT_SHIFT 1
|
||||
|
||||
#define QLOGIC_IB_MAX_SUBCTXT 4
|
||||
|
||||
/* SendPIO per-buffer control */
|
||||
#define QLOGIC_IB_SP_TEST 0x40
|
||||
#define QLOGIC_IB_SP_TESTEBP 0x20
|
||||
#define QLOGIC_IB_SP_TRIGGER_SHIFT 15
|
||||
|
||||
/* SendPIOAvail bits */
|
||||
#define QLOGIC_IB_SENDPIOAVAIL_BUSY_SHIFT 1
|
||||
#define QLOGIC_IB_SENDPIOAVAIL_CHECK_SHIFT 0
|
||||
|
||||
/* qlogic_ib header format */
|
||||
struct qib_header {
|
||||
/*
|
||||
* Version - 4 bits, Context - 4 bits, TID - 10 bits and Offset -
|
||||
* 14 bits before ECO change ~28 Dec 03. After that, Vers 4,
|
||||
* Context 4, TID 11, offset 13.
|
||||
*/
|
||||
__le32 ver_ctxt_tid_offset;
|
||||
__le16 chksum;
|
||||
__le16 pkt_flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* qlogic_ib user message header format.
|
||||
* This structure contains the first 4 fields common to all protocols
|
||||
* that employ qlogic_ib.
|
||||
*/
|
||||
struct qib_message_header {
|
||||
__be16 lrh[4];
|
||||
__be32 bth[3];
|
||||
/* fields below this point are in host byte order */
|
||||
struct qib_header iph;
|
||||
__u8 sub_opcode;
|
||||
};
|
||||
|
||||
/* IB - LRH header consts */
|
||||
#define QIB_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */
|
||||
#define QIB_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH */
|
||||
|
||||
/* misc. */
|
||||
#define SIZE_OF_CRC 1
|
||||
|
||||
#define QIB_DEFAULT_P_KEY 0xFFFF
|
||||
#define QIB_PERMISSIVE_LID 0xFFFF
|
||||
#define QIB_AETH_CREDIT_SHIFT 24
|
||||
#define QIB_AETH_CREDIT_MASK 0x1F
|
||||
#define QIB_AETH_CREDIT_INVAL 0x1F
|
||||
#define QIB_PSN_MASK 0xFFFFFF
|
||||
#define QIB_MSN_MASK 0xFFFFFF
|
||||
#define QIB_QPN_MASK 0xFFFFFF
|
||||
#define QIB_MULTICAST_LID_BASE 0xC000
|
||||
#define QIB_EAGER_TID_ID QLOGIC_IB_I_TID_MASK
|
||||
#define QIB_MULTICAST_QPN 0xFFFFFF
|
||||
|
||||
/* Receive Header Queue: receive type (from qlogic_ib) */
|
||||
#define RCVHQ_RCV_TYPE_EXPECTED 0
|
||||
#define RCVHQ_RCV_TYPE_EAGER 1
|
||||
#define RCVHQ_RCV_TYPE_NON_KD 2
|
||||
#define RCVHQ_RCV_TYPE_ERROR 3
|
||||
|
||||
#define QIB_HEADER_QUEUE_WORDS 9
|
||||
|
||||
/* functions for extracting fields from rcvhdrq entries for the driver.
|
||||
*/
|
||||
static inline __u32 qib_hdrget_err_flags(const __le32 *rbuf)
|
||||
{
|
||||
return __le32_to_cpu(rbuf[1]) & QLOGIC_IB_RHF_H_ERR_MASK;
|
||||
}
|
||||
|
||||
static inline __u32 qib_hdrget_rcv_type(const __le32 *rbuf)
|
||||
{
|
||||
return (__le32_to_cpu(rbuf[0]) >> QLOGIC_IB_RHF_RCVTYPE_SHIFT) &
|
||||
QLOGIC_IB_RHF_RCVTYPE_MASK;
|
||||
}
|
||||
|
||||
static inline __u32 qib_hdrget_length_in_bytes(const __le32 *rbuf)
|
||||
{
|
||||
return ((__le32_to_cpu(rbuf[0]) >> QLOGIC_IB_RHF_LENGTH_SHIFT) &
|
||||
QLOGIC_IB_RHF_LENGTH_MASK) << 2;
|
||||
}
|
||||
|
||||
static inline __u32 qib_hdrget_index(const __le32 *rbuf)
|
||||
{
|
||||
return (__le32_to_cpu(rbuf[0]) >> QLOGIC_IB_RHF_EGRINDEX_SHIFT) &
|
||||
QLOGIC_IB_RHF_EGRINDEX_MASK;
|
||||
}
|
||||
|
||||
static inline __u32 qib_hdrget_seq(const __le32 *rbuf)
|
||||
{
|
||||
return (__le32_to_cpu(rbuf[1]) >> QLOGIC_IB_RHF_SEQ_SHIFT) &
|
||||
QLOGIC_IB_RHF_SEQ_MASK;
|
||||
}
|
||||
|
||||
static inline __u32 qib_hdrget_offset(const __le32 *rbuf)
|
||||
{
|
||||
return (__le32_to_cpu(rbuf[1]) >> QLOGIC_IB_RHF_HDRQ_OFFSET_SHIFT) &
|
||||
QLOGIC_IB_RHF_HDRQ_OFFSET_MASK;
|
||||
}
|
||||
|
||||
static inline __u32 qib_hdrget_use_egr_buf(const __le32 *rbuf)
|
||||
{
|
||||
return __le32_to_cpu(rbuf[0]) & QLOGIC_IB_RHF_L_USE_EGR;
|
||||
}
|
||||
|
||||
static inline __u32 qib_hdrget_qib_ver(__le32 hdrword)
|
||||
{
|
||||
return (__le32_to_cpu(hdrword) >> QLOGIC_IB_I_VERS_SHIFT) &
|
||||
QLOGIC_IB_I_VERS_MASK;
|
||||
}
|
||||
|
||||
#endif /* _QIB_COMMON_H */
|
||||
484
drivers/infiniband/hw/qib/qib_cq.c
Normal file
484
drivers/infiniband/hw/qib/qib_cq.c
Normal file
|
|
@ -0,0 +1,484 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2010 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include "qib_verbs.h"
|
||||
|
||||
/**
|
||||
* qib_cq_enter - add a new entry to the completion queue
|
||||
* @cq: completion queue
|
||||
* @entry: work completion entry to add
|
||||
* @sig: true if @entry is a solicitated entry
|
||||
*
|
||||
* This may be called with qp->s_lock held.
|
||||
*/
|
||||
void qib_cq_enter(struct qib_cq *cq, struct ib_wc *entry, int solicited)
|
||||
{
|
||||
struct qib_cq_wc *wc;
|
||||
unsigned long flags;
|
||||
u32 head;
|
||||
u32 next;
|
||||
|
||||
spin_lock_irqsave(&cq->lock, flags);
|
||||
|
||||
/*
|
||||
* Note that the head pointer might be writable by user processes.
|
||||
* Take care to verify it is a sane value.
|
||||
*/
|
||||
wc = cq->queue;
|
||||
head = wc->head;
|
||||
if (head >= (unsigned) cq->ibcq.cqe) {
|
||||
head = cq->ibcq.cqe;
|
||||
next = 0;
|
||||
} else
|
||||
next = head + 1;
|
||||
if (unlikely(next == wc->tail)) {
|
||||
spin_unlock_irqrestore(&cq->lock, flags);
|
||||
if (cq->ibcq.event_handler) {
|
||||
struct ib_event ev;
|
||||
|
||||
ev.device = cq->ibcq.device;
|
||||
ev.element.cq = &cq->ibcq;
|
||||
ev.event = IB_EVENT_CQ_ERR;
|
||||
cq->ibcq.event_handler(&ev, cq->ibcq.cq_context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (cq->ip) {
|
||||
wc->uqueue[head].wr_id = entry->wr_id;
|
||||
wc->uqueue[head].status = entry->status;
|
||||
wc->uqueue[head].opcode = entry->opcode;
|
||||
wc->uqueue[head].vendor_err = entry->vendor_err;
|
||||
wc->uqueue[head].byte_len = entry->byte_len;
|
||||
wc->uqueue[head].ex.imm_data =
|
||||
(__u32 __force)entry->ex.imm_data;
|
||||
wc->uqueue[head].qp_num = entry->qp->qp_num;
|
||||
wc->uqueue[head].src_qp = entry->src_qp;
|
||||
wc->uqueue[head].wc_flags = entry->wc_flags;
|
||||
wc->uqueue[head].pkey_index = entry->pkey_index;
|
||||
wc->uqueue[head].slid = entry->slid;
|
||||
wc->uqueue[head].sl = entry->sl;
|
||||
wc->uqueue[head].dlid_path_bits = entry->dlid_path_bits;
|
||||
wc->uqueue[head].port_num = entry->port_num;
|
||||
/* Make sure entry is written before the head index. */
|
||||
smp_wmb();
|
||||
} else
|
||||
wc->kqueue[head] = *entry;
|
||||
wc->head = next;
|
||||
|
||||
if (cq->notify == IB_CQ_NEXT_COMP ||
|
||||
(cq->notify == IB_CQ_SOLICITED && solicited)) {
|
||||
cq->notify = IB_CQ_NONE;
|
||||
cq->triggered++;
|
||||
/*
|
||||
* This will cause send_complete() to be called in
|
||||
* another thread.
|
||||
*/
|
||||
queue_work(qib_cq_wq, &cq->comptask);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&cq->lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_poll_cq - poll for work completion entries
|
||||
* @ibcq: the completion queue to poll
|
||||
* @num_entries: the maximum number of entries to return
|
||||
* @entry: pointer to array where work completions are placed
|
||||
*
|
||||
* Returns the number of completion entries polled.
|
||||
*
|
||||
* This may be called from interrupt context. Also called by ib_poll_cq()
|
||||
* in the generic verbs code.
|
||||
*/
|
||||
int qib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry)
|
||||
{
|
||||
struct qib_cq *cq = to_icq(ibcq);
|
||||
struct qib_cq_wc *wc;
|
||||
unsigned long flags;
|
||||
int npolled;
|
||||
u32 tail;
|
||||
|
||||
/* The kernel can only poll a kernel completion queue */
|
||||
if (cq->ip) {
|
||||
npolled = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&cq->lock, flags);
|
||||
|
||||
wc = cq->queue;
|
||||
tail = wc->tail;
|
||||
if (tail > (u32) cq->ibcq.cqe)
|
||||
tail = (u32) cq->ibcq.cqe;
|
||||
for (npolled = 0; npolled < num_entries; ++npolled, ++entry) {
|
||||
if (tail == wc->head)
|
||||
break;
|
||||
/* The kernel doesn't need a RMB since it has the lock. */
|
||||
*entry = wc->kqueue[tail];
|
||||
if (tail >= cq->ibcq.cqe)
|
||||
tail = 0;
|
||||
else
|
||||
tail++;
|
||||
}
|
||||
wc->tail = tail;
|
||||
|
||||
spin_unlock_irqrestore(&cq->lock, flags);
|
||||
|
||||
bail:
|
||||
return npolled;
|
||||
}
|
||||
|
||||
static void send_complete(struct work_struct *work)
|
||||
{
|
||||
struct qib_cq *cq = container_of(work, struct qib_cq, comptask);
|
||||
|
||||
/*
|
||||
* The completion handler will most likely rearm the notification
|
||||
* and poll for all pending entries. If a new completion entry
|
||||
* is added while we are in this routine, queue_work()
|
||||
* won't call us again until we return so we check triggered to
|
||||
* see if we need to call the handler again.
|
||||
*/
|
||||
for (;;) {
|
||||
u8 triggered = cq->triggered;
|
||||
|
||||
/*
|
||||
* IPoIB connected mode assumes the callback is from a
|
||||
* soft IRQ. We simulate this by blocking "bottom halves".
|
||||
* See the implementation for ipoib_cm_handle_tx_wc(),
|
||||
* netif_tx_lock_bh() and netif_tx_lock().
|
||||
*/
|
||||
local_bh_disable();
|
||||
cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
|
||||
local_bh_enable();
|
||||
|
||||
if (cq->triggered == triggered)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_create_cq - create a completion queue
|
||||
* @ibdev: the device this completion queue is attached to
|
||||
* @entries: the minimum size of the completion queue
|
||||
* @context: unused by the QLogic_IB driver
|
||||
* @udata: user data for libibverbs.so
|
||||
*
|
||||
* Returns a pointer to the completion queue or negative errno values
|
||||
* for failure.
|
||||
*
|
||||
* Called by ib_create_cq() in the generic verbs code.
|
||||
*/
|
||||
struct ib_cq *qib_create_cq(struct ib_device *ibdev, int entries,
|
||||
int comp_vector, struct ib_ucontext *context,
|
||||
struct ib_udata *udata)
|
||||
{
|
||||
struct qib_ibdev *dev = to_idev(ibdev);
|
||||
struct qib_cq *cq;
|
||||
struct qib_cq_wc *wc;
|
||||
struct ib_cq *ret;
|
||||
u32 sz;
|
||||
|
||||
if (entries < 1 || entries > ib_qib_max_cqes) {
|
||||
ret = ERR_PTR(-EINVAL);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Allocate the completion queue structure. */
|
||||
cq = kmalloc(sizeof(*cq), GFP_KERNEL);
|
||||
if (!cq) {
|
||||
ret = ERR_PTR(-ENOMEM);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the completion queue entries and head/tail pointers.
|
||||
* This is allocated separately so that it can be resized and
|
||||
* also mapped into user space.
|
||||
* We need to use vmalloc() in order to support mmap and large
|
||||
* numbers of entries.
|
||||
*/
|
||||
sz = sizeof(*wc);
|
||||
if (udata && udata->outlen >= sizeof(__u64))
|
||||
sz += sizeof(struct ib_uverbs_wc) * (entries + 1);
|
||||
else
|
||||
sz += sizeof(struct ib_wc) * (entries + 1);
|
||||
wc = vmalloc_user(sz);
|
||||
if (!wc) {
|
||||
ret = ERR_PTR(-ENOMEM);
|
||||
goto bail_cq;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the address of the WC as the offset to mmap.
|
||||
* See qib_mmap() for details.
|
||||
*/
|
||||
if (udata && udata->outlen >= sizeof(__u64)) {
|
||||
int err;
|
||||
|
||||
cq->ip = qib_create_mmap_info(dev, sz, context, wc);
|
||||
if (!cq->ip) {
|
||||
ret = ERR_PTR(-ENOMEM);
|
||||
goto bail_wc;
|
||||
}
|
||||
|
||||
err = ib_copy_to_udata(udata, &cq->ip->offset,
|
||||
sizeof(cq->ip->offset));
|
||||
if (err) {
|
||||
ret = ERR_PTR(err);
|
||||
goto bail_ip;
|
||||
}
|
||||
} else
|
||||
cq->ip = NULL;
|
||||
|
||||
spin_lock(&dev->n_cqs_lock);
|
||||
if (dev->n_cqs_allocated == ib_qib_max_cqs) {
|
||||
spin_unlock(&dev->n_cqs_lock);
|
||||
ret = ERR_PTR(-ENOMEM);
|
||||
goto bail_ip;
|
||||
}
|
||||
|
||||
dev->n_cqs_allocated++;
|
||||
spin_unlock(&dev->n_cqs_lock);
|
||||
|
||||
if (cq->ip) {
|
||||
spin_lock_irq(&dev->pending_lock);
|
||||
list_add(&cq->ip->pending_mmaps, &dev->pending_mmaps);
|
||||
spin_unlock_irq(&dev->pending_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* ib_create_cq() will initialize cq->ibcq except for cq->ibcq.cqe.
|
||||
* The number of entries should be >= the number requested or return
|
||||
* an error.
|
||||
*/
|
||||
cq->ibcq.cqe = entries;
|
||||
cq->notify = IB_CQ_NONE;
|
||||
cq->triggered = 0;
|
||||
spin_lock_init(&cq->lock);
|
||||
INIT_WORK(&cq->comptask, send_complete);
|
||||
wc->head = 0;
|
||||
wc->tail = 0;
|
||||
cq->queue = wc;
|
||||
|
||||
ret = &cq->ibcq;
|
||||
|
||||
goto done;
|
||||
|
||||
bail_ip:
|
||||
kfree(cq->ip);
|
||||
bail_wc:
|
||||
vfree(wc);
|
||||
bail_cq:
|
||||
kfree(cq);
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_destroy_cq - destroy a completion queue
|
||||
* @ibcq: the completion queue to destroy.
|
||||
*
|
||||
* Returns 0 for success.
|
||||
*
|
||||
* Called by ib_destroy_cq() in the generic verbs code.
|
||||
*/
|
||||
int qib_destroy_cq(struct ib_cq *ibcq)
|
||||
{
|
||||
struct qib_ibdev *dev = to_idev(ibcq->device);
|
||||
struct qib_cq *cq = to_icq(ibcq);
|
||||
|
||||
flush_work(&cq->comptask);
|
||||
spin_lock(&dev->n_cqs_lock);
|
||||
dev->n_cqs_allocated--;
|
||||
spin_unlock(&dev->n_cqs_lock);
|
||||
if (cq->ip)
|
||||
kref_put(&cq->ip->ref, qib_release_mmap_info);
|
||||
else
|
||||
vfree(cq->queue);
|
||||
kfree(cq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_req_notify_cq - change the notification type for a completion queue
|
||||
* @ibcq: the completion queue
|
||||
* @notify_flags: the type of notification to request
|
||||
*
|
||||
* Returns 0 for success.
|
||||
*
|
||||
* This may be called from interrupt context. Also called by
|
||||
* ib_req_notify_cq() in the generic verbs code.
|
||||
*/
|
||||
int qib_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags)
|
||||
{
|
||||
struct qib_cq *cq = to_icq(ibcq);
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(&cq->lock, flags);
|
||||
/*
|
||||
* Don't change IB_CQ_NEXT_COMP to IB_CQ_SOLICITED but allow
|
||||
* any other transitions (see C11-31 and C11-32 in ch. 11.4.2.2).
|
||||
*/
|
||||
if (cq->notify != IB_CQ_NEXT_COMP)
|
||||
cq->notify = notify_flags & IB_CQ_SOLICITED_MASK;
|
||||
|
||||
if ((notify_flags & IB_CQ_REPORT_MISSED_EVENTS) &&
|
||||
cq->queue->head != cq->queue->tail)
|
||||
ret = 1;
|
||||
|
||||
spin_unlock_irqrestore(&cq->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_resize_cq - change the size of the CQ
|
||||
* @ibcq: the completion queue
|
||||
*
|
||||
* Returns 0 for success.
|
||||
*/
|
||||
int qib_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
|
||||
{
|
||||
struct qib_cq *cq = to_icq(ibcq);
|
||||
struct qib_cq_wc *old_wc;
|
||||
struct qib_cq_wc *wc;
|
||||
u32 head, tail, n;
|
||||
int ret;
|
||||
u32 sz;
|
||||
|
||||
if (cqe < 1 || cqe > ib_qib_max_cqes) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to use vmalloc() if we want to support large #s of entries.
|
||||
*/
|
||||
sz = sizeof(*wc);
|
||||
if (udata && udata->outlen >= sizeof(__u64))
|
||||
sz += sizeof(struct ib_uverbs_wc) * (cqe + 1);
|
||||
else
|
||||
sz += sizeof(struct ib_wc) * (cqe + 1);
|
||||
wc = vmalloc_user(sz);
|
||||
if (!wc) {
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Check that we can write the offset to mmap. */
|
||||
if (udata && udata->outlen >= sizeof(__u64)) {
|
||||
__u64 offset = 0;
|
||||
|
||||
ret = ib_copy_to_udata(udata, &offset, sizeof(offset));
|
||||
if (ret)
|
||||
goto bail_free;
|
||||
}
|
||||
|
||||
spin_lock_irq(&cq->lock);
|
||||
/*
|
||||
* Make sure head and tail are sane since they
|
||||
* might be user writable.
|
||||
*/
|
||||
old_wc = cq->queue;
|
||||
head = old_wc->head;
|
||||
if (head > (u32) cq->ibcq.cqe)
|
||||
head = (u32) cq->ibcq.cqe;
|
||||
tail = old_wc->tail;
|
||||
if (tail > (u32) cq->ibcq.cqe)
|
||||
tail = (u32) cq->ibcq.cqe;
|
||||
if (head < tail)
|
||||
n = cq->ibcq.cqe + 1 + head - tail;
|
||||
else
|
||||
n = head - tail;
|
||||
if (unlikely((u32)cqe < n)) {
|
||||
ret = -EINVAL;
|
||||
goto bail_unlock;
|
||||
}
|
||||
for (n = 0; tail != head; n++) {
|
||||
if (cq->ip)
|
||||
wc->uqueue[n] = old_wc->uqueue[tail];
|
||||
else
|
||||
wc->kqueue[n] = old_wc->kqueue[tail];
|
||||
if (tail == (u32) cq->ibcq.cqe)
|
||||
tail = 0;
|
||||
else
|
||||
tail++;
|
||||
}
|
||||
cq->ibcq.cqe = cqe;
|
||||
wc->head = n;
|
||||
wc->tail = 0;
|
||||
cq->queue = wc;
|
||||
spin_unlock_irq(&cq->lock);
|
||||
|
||||
vfree(old_wc);
|
||||
|
||||
if (cq->ip) {
|
||||
struct qib_ibdev *dev = to_idev(ibcq->device);
|
||||
struct qib_mmap_info *ip = cq->ip;
|
||||
|
||||
qib_update_mmap_info(dev, ip, sz, wc);
|
||||
|
||||
/*
|
||||
* Return the offset to mmap.
|
||||
* See qib_mmap() for details.
|
||||
*/
|
||||
if (udata && udata->outlen >= sizeof(__u64)) {
|
||||
ret = ib_copy_to_udata(udata, &ip->offset,
|
||||
sizeof(ip->offset));
|
||||
if (ret)
|
||||
goto bail;
|
||||
}
|
||||
|
||||
spin_lock_irq(&dev->pending_lock);
|
||||
if (list_empty(&ip->pending_mmaps))
|
||||
list_add(&ip->pending_mmaps, &dev->pending_mmaps);
|
||||
spin_unlock_irq(&dev->pending_lock);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
goto bail;
|
||||
|
||||
bail_unlock:
|
||||
spin_unlock_irq(&cq->lock);
|
||||
bail_free:
|
||||
vfree(wc);
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
894
drivers/infiniband/hw/qib/qib_diag.c
Normal file
894
drivers/infiniband/hw/qib/qib_diag.c
Normal file
|
|
@ -0,0 +1,894 @@
|
|||
/*
|
||||
* Copyright (c) 2010 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains support for diagnostic functions. It is accessed by
|
||||
* opening the qib_diag device, normally minor number 129. Diagnostic use
|
||||
* of the QLogic_IB chip may render the chip or board unusable until the
|
||||
* driver is unloaded, or in some cases, until the system is rebooted.
|
||||
*
|
||||
* Accesses to the chip through this interface are not similar to going
|
||||
* through the /sys/bus/pci resource mmap interface.
|
||||
*/
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#include "qib.h"
|
||||
#include "qib_common.h"
|
||||
|
||||
/*
|
||||
* Each client that opens the diag device must read then write
|
||||
* offset 0, to prevent lossage from random cat or od. diag_state
|
||||
* sequences this "handshake".
|
||||
*/
|
||||
enum diag_state { UNUSED = 0, OPENED, INIT, READY };
|
||||
|
||||
/* State for an individual client. PID so children cannot abuse handshake */
|
||||
static struct qib_diag_client {
|
||||
struct qib_diag_client *next;
|
||||
struct qib_devdata *dd;
|
||||
pid_t pid;
|
||||
enum diag_state state;
|
||||
} *client_pool;
|
||||
|
||||
/*
|
||||
* Get a client struct. Recycled if possible, else kmalloc.
|
||||
* Must be called with qib_mutex held
|
||||
*/
|
||||
static struct qib_diag_client *get_client(struct qib_devdata *dd)
|
||||
{
|
||||
struct qib_diag_client *dc;
|
||||
|
||||
dc = client_pool;
|
||||
if (dc)
|
||||
/* got from pool remove it and use */
|
||||
client_pool = dc->next;
|
||||
else
|
||||
/* None in pool, alloc and init */
|
||||
dc = kmalloc(sizeof *dc, GFP_KERNEL);
|
||||
|
||||
if (dc) {
|
||||
dc->next = NULL;
|
||||
dc->dd = dd;
|
||||
dc->pid = current->pid;
|
||||
dc->state = OPENED;
|
||||
}
|
||||
return dc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return to pool. Must be called with qib_mutex held
|
||||
*/
|
||||
static void return_client(struct qib_diag_client *dc)
|
||||
{
|
||||
struct qib_devdata *dd = dc->dd;
|
||||
struct qib_diag_client *tdc, *rdc;
|
||||
|
||||
rdc = NULL;
|
||||
if (dc == dd->diag_client) {
|
||||
dd->diag_client = dc->next;
|
||||
rdc = dc;
|
||||
} else {
|
||||
tdc = dc->dd->diag_client;
|
||||
while (tdc) {
|
||||
if (dc == tdc->next) {
|
||||
tdc->next = dc->next;
|
||||
rdc = dc;
|
||||
break;
|
||||
}
|
||||
tdc = tdc->next;
|
||||
}
|
||||
}
|
||||
if (rdc) {
|
||||
rdc->state = UNUSED;
|
||||
rdc->dd = NULL;
|
||||
rdc->pid = 0;
|
||||
rdc->next = client_pool;
|
||||
client_pool = rdc;
|
||||
}
|
||||
}
|
||||
|
||||
static int qib_diag_open(struct inode *in, struct file *fp);
|
||||
static int qib_diag_release(struct inode *in, struct file *fp);
|
||||
static ssize_t qib_diag_read(struct file *fp, char __user *data,
|
||||
size_t count, loff_t *off);
|
||||
static ssize_t qib_diag_write(struct file *fp, const char __user *data,
|
||||
size_t count, loff_t *off);
|
||||
|
||||
static const struct file_operations diag_file_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.write = qib_diag_write,
|
||||
.read = qib_diag_read,
|
||||
.open = qib_diag_open,
|
||||
.release = qib_diag_release
|
||||
};
|
||||
|
||||
static atomic_t diagpkt_count = ATOMIC_INIT(0);
|
||||
static struct cdev *diagpkt_cdev;
|
||||
static struct device *diagpkt_device;
|
||||
|
||||
static ssize_t qib_diagpkt_write(struct file *fp, const char __user *data,
|
||||
size_t count, loff_t *off);
|
||||
|
||||
static const struct file_operations diagpkt_file_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.write = qib_diagpkt_write,
|
||||
};
|
||||
|
||||
int qib_diag_add(struct qib_devdata *dd)
|
||||
{
|
||||
char name[16];
|
||||
int ret = 0;
|
||||
|
||||
if (atomic_inc_return(&diagpkt_count) == 1) {
|
||||
ret = qib_cdev_init(QIB_DIAGPKT_MINOR, "ipath_diagpkt",
|
||||
&diagpkt_file_ops, &diagpkt_cdev,
|
||||
&diagpkt_device);
|
||||
if (ret)
|
||||
goto done;
|
||||
}
|
||||
|
||||
snprintf(name, sizeof(name), "ipath_diag%d", dd->unit);
|
||||
ret = qib_cdev_init(QIB_DIAG_MINOR_BASE + dd->unit, name,
|
||||
&diag_file_ops, &dd->diag_cdev,
|
||||
&dd->diag_device);
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void qib_unregister_observers(struct qib_devdata *dd);
|
||||
|
||||
void qib_diag_remove(struct qib_devdata *dd)
|
||||
{
|
||||
struct qib_diag_client *dc;
|
||||
|
||||
if (atomic_dec_and_test(&diagpkt_count))
|
||||
qib_cdev_cleanup(&diagpkt_cdev, &diagpkt_device);
|
||||
|
||||
qib_cdev_cleanup(&dd->diag_cdev, &dd->diag_device);
|
||||
|
||||
/*
|
||||
* Return all diag_clients of this device. There should be none,
|
||||
* as we are "guaranteed" that no clients are still open
|
||||
*/
|
||||
while (dd->diag_client)
|
||||
return_client(dd->diag_client);
|
||||
|
||||
/* Now clean up all unused client structs */
|
||||
while (client_pool) {
|
||||
dc = client_pool;
|
||||
client_pool = dc->next;
|
||||
kfree(dc);
|
||||
}
|
||||
/* Clean up observer list */
|
||||
qib_unregister_observers(dd);
|
||||
}
|
||||
|
||||
/* qib_remap_ioaddr32 - remap an offset into chip address space to __iomem *
|
||||
*
|
||||
* @dd: the qlogic_ib device
|
||||
* @offs: the offset in chip-space
|
||||
* @cntp: Pointer to max (byte) count for transfer starting at offset
|
||||
* This returns a u32 __iomem * so it can be used for both 64 and 32-bit
|
||||
* mapping. It is needed because with the use of PAT for control of
|
||||
* write-combining, the logically contiguous address-space of the chip
|
||||
* may be split into virtually non-contiguous spaces, with different
|
||||
* attributes, which are them mapped to contiguous physical space
|
||||
* based from the first BAR.
|
||||
*
|
||||
* The code below makes the same assumptions as were made in
|
||||
* init_chip_wc_pat() (qib_init.c), copied here:
|
||||
* Assumes chip address space looks like:
|
||||
* - kregs + sregs + cregs + uregs (in any order)
|
||||
* - piobufs (2K and 4K bufs in either order)
|
||||
* or:
|
||||
* - kregs + sregs + cregs (in any order)
|
||||
* - piobufs (2K and 4K bufs in either order)
|
||||
* - uregs
|
||||
*
|
||||
* If cntp is non-NULL, returns how many bytes from offset can be accessed
|
||||
* Returns 0 if the offset is not mapped.
|
||||
*/
|
||||
static u32 __iomem *qib_remap_ioaddr32(struct qib_devdata *dd, u32 offset,
|
||||
u32 *cntp)
|
||||
{
|
||||
u32 kreglen;
|
||||
u32 snd_bottom, snd_lim = 0;
|
||||
u32 __iomem *krb32 = (u32 __iomem *)dd->kregbase;
|
||||
u32 __iomem *map = NULL;
|
||||
u32 cnt = 0;
|
||||
|
||||
/* First, simplest case, offset is within the first map. */
|
||||
kreglen = (dd->kregend - dd->kregbase) * sizeof(u64);
|
||||
if (offset < kreglen) {
|
||||
map = krb32 + (offset / sizeof(u32));
|
||||
cnt = kreglen - offset;
|
||||
goto mapped;
|
||||
}
|
||||
|
||||
/*
|
||||
* Next check for user regs, the next most common case,
|
||||
* and a cheap check because if they are not in the first map
|
||||
* they are last in chip.
|
||||
*/
|
||||
if (dd->userbase) {
|
||||
/* If user regs mapped, they are after send, so set limit. */
|
||||
u32 ulim = (dd->cfgctxts * dd->ureg_align) + dd->uregbase;
|
||||
snd_lim = dd->uregbase;
|
||||
krb32 = (u32 __iomem *)dd->userbase;
|
||||
if (offset >= dd->uregbase && offset < ulim) {
|
||||
map = krb32 + (offset - dd->uregbase) / sizeof(u32);
|
||||
cnt = ulim - offset;
|
||||
goto mapped;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Lastly, check for offset within Send Buffers.
|
||||
* This is gnarly because struct devdata is deliberately vague
|
||||
* about things like 7322 VL15 buffers, and we are not in
|
||||
* chip-specific code here, so should not make many assumptions.
|
||||
* The one we _do_ make is that the only chip that has more sndbufs
|
||||
* than we admit is the 7322, and it has userregs above that, so
|
||||
* we know the snd_lim.
|
||||
*/
|
||||
/* Assume 2K buffers are first. */
|
||||
snd_bottom = dd->pio2k_bufbase;
|
||||
if (snd_lim == 0) {
|
||||
u32 tot2k = dd->piobcnt2k * ALIGN(dd->piosize2k, dd->palign);
|
||||
snd_lim = snd_bottom + tot2k;
|
||||
}
|
||||
/* If 4k buffers exist, account for them by bumping
|
||||
* appropriate limit.
|
||||
*/
|
||||
if (dd->piobcnt4k) {
|
||||
u32 tot4k = dd->piobcnt4k * dd->align4k;
|
||||
u32 offs4k = dd->piobufbase >> 32;
|
||||
if (snd_bottom > offs4k)
|
||||
snd_bottom = offs4k;
|
||||
else {
|
||||
/* 4k above 2k. Bump snd_lim, if needed*/
|
||||
if (!dd->userbase)
|
||||
snd_lim = offs4k + tot4k;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Judgement call: can we ignore the space between SendBuffs and
|
||||
* UserRegs, where we would like to see vl15 buffs, but not more?
|
||||
*/
|
||||
if (offset >= snd_bottom && offset < snd_lim) {
|
||||
offset -= snd_bottom;
|
||||
map = (u32 __iomem *)dd->piobase + (offset / sizeof(u32));
|
||||
cnt = snd_lim - offset;
|
||||
}
|
||||
|
||||
mapped:
|
||||
if (cntp)
|
||||
*cntp = cnt;
|
||||
return map;
|
||||
}
|
||||
|
||||
/*
|
||||
* qib_read_umem64 - read a 64-bit quantity from the chip into user space
|
||||
* @dd: the qlogic_ib device
|
||||
* @uaddr: the location to store the data in user memory
|
||||
* @regoffs: the offset from BAR0 (_NOT_ full pointer, anymore)
|
||||
* @count: number of bytes to copy (multiple of 32 bits)
|
||||
*
|
||||
* This function also localizes all chip memory accesses.
|
||||
* The copy should be written such that we read full cacheline packets
|
||||
* from the chip. This is usually used for a single qword
|
||||
*
|
||||
* NOTE: This assumes the chip address is 64-bit aligned.
|
||||
*/
|
||||
static int qib_read_umem64(struct qib_devdata *dd, void __user *uaddr,
|
||||
u32 regoffs, size_t count)
|
||||
{
|
||||
const u64 __iomem *reg_addr;
|
||||
const u64 __iomem *reg_end;
|
||||
u32 limit;
|
||||
int ret;
|
||||
|
||||
reg_addr = (const u64 __iomem *)qib_remap_ioaddr32(dd, regoffs, &limit);
|
||||
if (reg_addr == NULL || limit == 0 || !(dd->flags & QIB_PRESENT)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
if (count >= limit)
|
||||
count = limit;
|
||||
reg_end = reg_addr + (count / sizeof(u64));
|
||||
|
||||
/* not very efficient, but it works for now */
|
||||
while (reg_addr < reg_end) {
|
||||
u64 data = readq(reg_addr);
|
||||
|
||||
if (copy_to_user(uaddr, &data, sizeof(u64))) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
reg_addr++;
|
||||
uaddr += sizeof(u64);
|
||||
}
|
||||
ret = 0;
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* qib_write_umem64 - write a 64-bit quantity to the chip from user space
|
||||
* @dd: the qlogic_ib device
|
||||
* @regoffs: the offset from BAR0 (_NOT_ full pointer, anymore)
|
||||
* @uaddr: the source of the data in user memory
|
||||
* @count: the number of bytes to copy (multiple of 32 bits)
|
||||
*
|
||||
* This is usually used for a single qword
|
||||
* NOTE: This assumes the chip address is 64-bit aligned.
|
||||
*/
|
||||
|
||||
static int qib_write_umem64(struct qib_devdata *dd, u32 regoffs,
|
||||
const void __user *uaddr, size_t count)
|
||||
{
|
||||
u64 __iomem *reg_addr;
|
||||
const u64 __iomem *reg_end;
|
||||
u32 limit;
|
||||
int ret;
|
||||
|
||||
reg_addr = (u64 __iomem *)qib_remap_ioaddr32(dd, regoffs, &limit);
|
||||
if (reg_addr == NULL || limit == 0 || !(dd->flags & QIB_PRESENT)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
if (count >= limit)
|
||||
count = limit;
|
||||
reg_end = reg_addr + (count / sizeof(u64));
|
||||
|
||||
/* not very efficient, but it works for now */
|
||||
while (reg_addr < reg_end) {
|
||||
u64 data;
|
||||
if (copy_from_user(&data, uaddr, sizeof(data))) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
writeq(data, reg_addr);
|
||||
|
||||
reg_addr++;
|
||||
uaddr += sizeof(u64);
|
||||
}
|
||||
ret = 0;
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* qib_read_umem32 - read a 32-bit quantity from the chip into user space
|
||||
* @dd: the qlogic_ib device
|
||||
* @uaddr: the location to store the data in user memory
|
||||
* @regoffs: the offset from BAR0 (_NOT_ full pointer, anymore)
|
||||
* @count: number of bytes to copy
|
||||
*
|
||||
* read 32 bit values, not 64 bit; for memories that only
|
||||
* support 32 bit reads; usually a single dword.
|
||||
*/
|
||||
static int qib_read_umem32(struct qib_devdata *dd, void __user *uaddr,
|
||||
u32 regoffs, size_t count)
|
||||
{
|
||||
const u32 __iomem *reg_addr;
|
||||
const u32 __iomem *reg_end;
|
||||
u32 limit;
|
||||
int ret;
|
||||
|
||||
reg_addr = qib_remap_ioaddr32(dd, regoffs, &limit);
|
||||
if (reg_addr == NULL || limit == 0 || !(dd->flags & QIB_PRESENT)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
if (count >= limit)
|
||||
count = limit;
|
||||
reg_end = reg_addr + (count / sizeof(u32));
|
||||
|
||||
/* not very efficient, but it works for now */
|
||||
while (reg_addr < reg_end) {
|
||||
u32 data = readl(reg_addr);
|
||||
|
||||
if (copy_to_user(uaddr, &data, sizeof(data))) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
reg_addr++;
|
||||
uaddr += sizeof(u32);
|
||||
|
||||
}
|
||||
ret = 0;
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* qib_write_umem32 - write a 32-bit quantity to the chip from user space
|
||||
* @dd: the qlogic_ib device
|
||||
* @regoffs: the offset from BAR0 (_NOT_ full pointer, anymore)
|
||||
* @uaddr: the source of the data in user memory
|
||||
* @count: number of bytes to copy
|
||||
*
|
||||
* write 32 bit values, not 64 bit; for memories that only
|
||||
* support 32 bit write; usually a single dword.
|
||||
*/
|
||||
|
||||
static int qib_write_umem32(struct qib_devdata *dd, u32 regoffs,
|
||||
const void __user *uaddr, size_t count)
|
||||
{
|
||||
u32 __iomem *reg_addr;
|
||||
const u32 __iomem *reg_end;
|
||||
u32 limit;
|
||||
int ret;
|
||||
|
||||
reg_addr = qib_remap_ioaddr32(dd, regoffs, &limit);
|
||||
if (reg_addr == NULL || limit == 0 || !(dd->flags & QIB_PRESENT)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
if (count >= limit)
|
||||
count = limit;
|
||||
reg_end = reg_addr + (count / sizeof(u32));
|
||||
|
||||
while (reg_addr < reg_end) {
|
||||
u32 data;
|
||||
|
||||
if (copy_from_user(&data, uaddr, sizeof(data))) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
writel(data, reg_addr);
|
||||
|
||||
reg_addr++;
|
||||
uaddr += sizeof(u32);
|
||||
}
|
||||
ret = 0;
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qib_diag_open(struct inode *in, struct file *fp)
|
||||
{
|
||||
int unit = iminor(in) - QIB_DIAG_MINOR_BASE;
|
||||
struct qib_devdata *dd;
|
||||
struct qib_diag_client *dc;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&qib_mutex);
|
||||
|
||||
dd = qib_lookup(unit);
|
||||
|
||||
if (dd == NULL || !(dd->flags & QIB_PRESENT) ||
|
||||
!dd->kregbase) {
|
||||
ret = -ENODEV;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dc = get_client(dd);
|
||||
if (!dc) {
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
dc->next = dd->diag_client;
|
||||
dd->diag_client = dc;
|
||||
fp->private_data = dc;
|
||||
ret = 0;
|
||||
bail:
|
||||
mutex_unlock(&qib_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_diagpkt_write - write an IB packet
|
||||
* @fp: the diag data device file pointer
|
||||
* @data: qib_diag_pkt structure saying where to get the packet
|
||||
* @count: size of data to write
|
||||
* @off: unused by this code
|
||||
*/
|
||||
static ssize_t qib_diagpkt_write(struct file *fp,
|
||||
const char __user *data,
|
||||
size_t count, loff_t *off)
|
||||
{
|
||||
u32 __iomem *piobuf;
|
||||
u32 plen, clen, pbufn;
|
||||
struct qib_diag_xpkt dp;
|
||||
u32 *tmpbuf = NULL;
|
||||
struct qib_devdata *dd;
|
||||
struct qib_pportdata *ppd;
|
||||
ssize_t ret = 0;
|
||||
|
||||
if (count != sizeof(dp)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
if (copy_from_user(&dp, data, sizeof(dp))) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dd = qib_lookup(dp.unit);
|
||||
if (!dd || !(dd->flags & QIB_PRESENT) || !dd->kregbase) {
|
||||
ret = -ENODEV;
|
||||
goto bail;
|
||||
}
|
||||
if (!(dd->flags & QIB_INITTED)) {
|
||||
/* no hardware, freeze, etc. */
|
||||
ret = -ENODEV;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (dp.version != _DIAG_XPKT_VERS) {
|
||||
qib_dev_err(dd, "Invalid version %u for diagpkt_write\n",
|
||||
dp.version);
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
/* send count must be an exact number of dwords */
|
||||
if (dp.len & 3) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
if (!dp.port || dp.port > dd->num_pports) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
ppd = &dd->pport[dp.port - 1];
|
||||
|
||||
/* need total length before first word written */
|
||||
/* +1 word is for the qword padding */
|
||||
plen = sizeof(u32) + dp.len;
|
||||
clen = dp.len >> 2;
|
||||
|
||||
if ((plen + 4) > ppd->ibmaxlen) {
|
||||
ret = -EINVAL;
|
||||
goto bail; /* before writing pbc */
|
||||
}
|
||||
tmpbuf = vmalloc(plen);
|
||||
if (!tmpbuf) {
|
||||
qib_devinfo(dd->pcidev, "Unable to allocate tmp buffer, "
|
||||
"failing\n");
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (copy_from_user(tmpbuf,
|
||||
(const void __user *) (unsigned long) dp.data,
|
||||
dp.len)) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
plen >>= 2; /* in dwords */
|
||||
|
||||
if (dp.pbc_wd == 0)
|
||||
dp.pbc_wd = plen;
|
||||
|
||||
piobuf = dd->f_getsendbuf(ppd, dp.pbc_wd, &pbufn);
|
||||
if (!piobuf) {
|
||||
ret = -EBUSY;
|
||||
goto bail;
|
||||
}
|
||||
/* disarm it just to be extra sure */
|
||||
dd->f_sendctrl(dd->pport, QIB_SENDCTRL_DISARM_BUF(pbufn));
|
||||
|
||||
/* disable header check on pbufn for this packet */
|
||||
dd->f_txchk_change(dd, pbufn, 1, TXCHK_CHG_TYPE_DIS1, NULL);
|
||||
|
||||
writeq(dp.pbc_wd, piobuf);
|
||||
/*
|
||||
* Copy all but the trigger word, then flush, so it's written
|
||||
* to chip before trigger word, then write trigger word, then
|
||||
* flush again, so packet is sent.
|
||||
*/
|
||||
if (dd->flags & QIB_PIO_FLUSH_WC) {
|
||||
qib_flush_wc();
|
||||
qib_pio_copy(piobuf + 2, tmpbuf, clen - 1);
|
||||
qib_flush_wc();
|
||||
__raw_writel(tmpbuf[clen - 1], piobuf + clen + 1);
|
||||
} else
|
||||
qib_pio_copy(piobuf + 2, tmpbuf, clen);
|
||||
|
||||
if (dd->flags & QIB_USE_SPCL_TRIG) {
|
||||
u32 spcl_off = (pbufn >= dd->piobcnt2k) ? 2047 : 1023;
|
||||
|
||||
qib_flush_wc();
|
||||
__raw_writel(0xaebecede, piobuf + spcl_off);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure buffer is written to the chip, then re-enable
|
||||
* header checks (if supported by chip). The txchk
|
||||
* code will ensure seen by chip before returning.
|
||||
*/
|
||||
qib_flush_wc();
|
||||
qib_sendbuf_done(dd, pbufn);
|
||||
dd->f_txchk_change(dd, pbufn, 1, TXCHK_CHG_TYPE_ENAB1, NULL);
|
||||
|
||||
ret = sizeof(dp);
|
||||
|
||||
bail:
|
||||
vfree(tmpbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qib_diag_release(struct inode *in, struct file *fp)
|
||||
{
|
||||
mutex_lock(&qib_mutex);
|
||||
return_client(fp->private_data);
|
||||
fp->private_data = NULL;
|
||||
mutex_unlock(&qib_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Chip-specific code calls to register its interest in
|
||||
* a specific range.
|
||||
*/
|
||||
struct diag_observer_list_elt {
|
||||
struct diag_observer_list_elt *next;
|
||||
const struct diag_observer *op;
|
||||
};
|
||||
|
||||
int qib_register_observer(struct qib_devdata *dd,
|
||||
const struct diag_observer *op)
|
||||
{
|
||||
struct diag_observer_list_elt *olp;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (!dd || !op)
|
||||
goto bail;
|
||||
ret = -ENOMEM;
|
||||
olp = vmalloc(sizeof *olp);
|
||||
if (!olp) {
|
||||
printk(KERN_ERR QIB_DRV_NAME ": vmalloc for observer failed\n");
|
||||
goto bail;
|
||||
}
|
||||
if (olp) {
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&dd->qib_diag_trans_lock, flags);
|
||||
olp->op = op;
|
||||
olp->next = dd->diag_observer_list;
|
||||
dd->diag_observer_list = olp;
|
||||
spin_unlock_irqrestore(&dd->qib_diag_trans_lock, flags);
|
||||
ret = 0;
|
||||
}
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Remove all registered observers when device is closed */
|
||||
static void qib_unregister_observers(struct qib_devdata *dd)
|
||||
{
|
||||
struct diag_observer_list_elt *olp;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&dd->qib_diag_trans_lock, flags);
|
||||
olp = dd->diag_observer_list;
|
||||
while (olp) {
|
||||
/* Pop one observer, let go of lock */
|
||||
dd->diag_observer_list = olp->next;
|
||||
spin_unlock_irqrestore(&dd->qib_diag_trans_lock, flags);
|
||||
vfree(olp);
|
||||
/* try again. */
|
||||
spin_lock_irqsave(&dd->qib_diag_trans_lock, flags);
|
||||
olp = dd->diag_observer_list;
|
||||
}
|
||||
spin_unlock_irqrestore(&dd->qib_diag_trans_lock, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the observer, if any, for the specified address. Initial implementation
|
||||
* is simple stack of observers. This must be called with diag transaction
|
||||
* lock held.
|
||||
*/
|
||||
static const struct diag_observer *diag_get_observer(struct qib_devdata *dd,
|
||||
u32 addr)
|
||||
{
|
||||
struct diag_observer_list_elt *olp;
|
||||
const struct diag_observer *op = NULL;
|
||||
|
||||
olp = dd->diag_observer_list;
|
||||
while (olp) {
|
||||
op = olp->op;
|
||||
if (addr >= op->bottom && addr <= op->top)
|
||||
break;
|
||||
olp = olp->next;
|
||||
}
|
||||
if (!olp)
|
||||
op = NULL;
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
static ssize_t qib_diag_read(struct file *fp, char __user *data,
|
||||
size_t count, loff_t *off)
|
||||
{
|
||||
struct qib_diag_client *dc = fp->private_data;
|
||||
struct qib_devdata *dd = dc->dd;
|
||||
void __iomem *kreg_base;
|
||||
ssize_t ret;
|
||||
|
||||
if (dc->pid != current->pid) {
|
||||
ret = -EPERM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
kreg_base = dd->kregbase;
|
||||
|
||||
if (count == 0)
|
||||
ret = 0;
|
||||
else if ((count % 4) || (*off % 4))
|
||||
/* address or length is not 32-bit aligned, hence invalid */
|
||||
ret = -EINVAL;
|
||||
else if (dc->state < READY && (*off || count != 8))
|
||||
ret = -EINVAL; /* prevent cat /dev/qib_diag* */
|
||||
else {
|
||||
unsigned long flags;
|
||||
u64 data64 = 0;
|
||||
int use_32;
|
||||
const struct diag_observer *op;
|
||||
|
||||
use_32 = (count % 8) || (*off % 8);
|
||||
ret = -1;
|
||||
spin_lock_irqsave(&dd->qib_diag_trans_lock, flags);
|
||||
/*
|
||||
* Check for observer on this address range.
|
||||
* we only support a single 32 or 64-bit read
|
||||
* via observer, currently.
|
||||
*/
|
||||
op = diag_get_observer(dd, *off);
|
||||
if (op) {
|
||||
u32 offset = *off;
|
||||
ret = op->hook(dd, op, offset, &data64, 0, use_32);
|
||||
}
|
||||
/*
|
||||
* We need to release lock before any copy_to_user(),
|
||||
* whether implicit in qib_read_umem* or explicit below.
|
||||
*/
|
||||
spin_unlock_irqrestore(&dd->qib_diag_trans_lock, flags);
|
||||
if (!op) {
|
||||
if (use_32)
|
||||
/*
|
||||
* Address or length is not 64-bit aligned;
|
||||
* do 32-bit rd
|
||||
*/
|
||||
ret = qib_read_umem32(dd, data, (u32) *off,
|
||||
count);
|
||||
else
|
||||
ret = qib_read_umem64(dd, data, (u32) *off,
|
||||
count);
|
||||
} else if (ret == count) {
|
||||
/* Below finishes case where observer existed */
|
||||
ret = copy_to_user(data, &data64, use_32 ?
|
||||
sizeof(u32) : sizeof(u64));
|
||||
if (ret)
|
||||
ret = -EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret >= 0) {
|
||||
*off += count;
|
||||
ret = count;
|
||||
if (dc->state == OPENED)
|
||||
dc->state = INIT;
|
||||
}
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t qib_diag_write(struct file *fp, const char __user *data,
|
||||
size_t count, loff_t *off)
|
||||
{
|
||||
struct qib_diag_client *dc = fp->private_data;
|
||||
struct qib_devdata *dd = dc->dd;
|
||||
void __iomem *kreg_base;
|
||||
ssize_t ret;
|
||||
|
||||
if (dc->pid != current->pid) {
|
||||
ret = -EPERM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
kreg_base = dd->kregbase;
|
||||
|
||||
if (count == 0)
|
||||
ret = 0;
|
||||
else if ((count % 4) || (*off % 4))
|
||||
/* address or length is not 32-bit aligned, hence invalid */
|
||||
ret = -EINVAL;
|
||||
else if (dc->state < READY &&
|
||||
((*off || count != 8) || dc->state != INIT))
|
||||
/* No writes except second-step of init seq */
|
||||
ret = -EINVAL; /* before any other write allowed */
|
||||
else {
|
||||
unsigned long flags;
|
||||
const struct diag_observer *op = NULL;
|
||||
int use_32 = (count % 8) || (*off % 8);
|
||||
|
||||
/*
|
||||
* Check for observer on this address range.
|
||||
* We only support a single 32 or 64-bit write
|
||||
* via observer, currently. This helps, because
|
||||
* we would otherwise have to jump through hoops
|
||||
* to make "diag transaction" meaningful when we
|
||||
* cannot do a copy_from_user while holding the lock.
|
||||
*/
|
||||
if (count == 4 || count == 8) {
|
||||
u64 data64;
|
||||
u32 offset = *off;
|
||||
ret = copy_from_user(&data64, data, count);
|
||||
if (ret) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
spin_lock_irqsave(&dd->qib_diag_trans_lock, flags);
|
||||
op = diag_get_observer(dd, *off);
|
||||
if (op)
|
||||
ret = op->hook(dd, op, offset, &data64, ~0Ull,
|
||||
use_32);
|
||||
spin_unlock_irqrestore(&dd->qib_diag_trans_lock, flags);
|
||||
}
|
||||
|
||||
if (!op) {
|
||||
if (use_32)
|
||||
/*
|
||||
* Address or length is not 64-bit aligned;
|
||||
* do 32-bit write
|
||||
*/
|
||||
ret = qib_write_umem32(dd, (u32) *off, data,
|
||||
count);
|
||||
else
|
||||
ret = qib_write_umem64(dd, (u32) *off, data,
|
||||
count);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret >= 0) {
|
||||
*off += count;
|
||||
ret = count;
|
||||
if (dc->state == INIT)
|
||||
dc->state = READY; /* all read/write OK now */
|
||||
}
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
182
drivers/infiniband/hw/qib/qib_dma.c
Normal file
182
drivers/infiniband/hw/qib/qib_dma.c
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2009, 2010 QLogic, Corporation. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include "qib_verbs.h"
|
||||
|
||||
#define BAD_DMA_ADDRESS ((u64) 0)
|
||||
|
||||
/*
|
||||
* The following functions implement driver specific replacements
|
||||
* for the ib_dma_*() functions.
|
||||
*
|
||||
* These functions return kernel virtual addresses instead of
|
||||
* device bus addresses since the driver uses the CPU to copy
|
||||
* data instead of using hardware DMA.
|
||||
*/
|
||||
|
||||
static int qib_mapping_error(struct ib_device *dev, u64 dma_addr)
|
||||
{
|
||||
return dma_addr == BAD_DMA_ADDRESS;
|
||||
}
|
||||
|
||||
static u64 qib_dma_map_single(struct ib_device *dev, void *cpu_addr,
|
||||
size_t size, enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(!valid_dma_direction(direction));
|
||||
return (u64) cpu_addr;
|
||||
}
|
||||
|
||||
static void qib_dma_unmap_single(struct ib_device *dev, u64 addr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(!valid_dma_direction(direction));
|
||||
}
|
||||
|
||||
static u64 qib_dma_map_page(struct ib_device *dev, struct page *page,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
u64 addr;
|
||||
|
||||
BUG_ON(!valid_dma_direction(direction));
|
||||
|
||||
if (offset + size > PAGE_SIZE) {
|
||||
addr = BAD_DMA_ADDRESS;
|
||||
goto done;
|
||||
}
|
||||
|
||||
addr = (u64) page_address(page);
|
||||
if (addr)
|
||||
addr += offset;
|
||||
/* TODO: handle highmem pages */
|
||||
|
||||
done:
|
||||
return addr;
|
||||
}
|
||||
|
||||
static void qib_dma_unmap_page(struct ib_device *dev, u64 addr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(!valid_dma_direction(direction));
|
||||
}
|
||||
|
||||
static int qib_map_sg(struct ib_device *dev, struct scatterlist *sgl,
|
||||
int nents, enum dma_data_direction direction)
|
||||
{
|
||||
struct scatterlist *sg;
|
||||
u64 addr;
|
||||
int i;
|
||||
int ret = nents;
|
||||
|
||||
BUG_ON(!valid_dma_direction(direction));
|
||||
|
||||
for_each_sg(sgl, sg, nents, i) {
|
||||
addr = (u64) page_address(sg_page(sg));
|
||||
/* TODO: handle highmem pages */
|
||||
if (!addr) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void qib_unmap_sg(struct ib_device *dev,
|
||||
struct scatterlist *sg, int nents,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(!valid_dma_direction(direction));
|
||||
}
|
||||
|
||||
static u64 qib_sg_dma_address(struct ib_device *dev, struct scatterlist *sg)
|
||||
{
|
||||
u64 addr = (u64) page_address(sg_page(sg));
|
||||
|
||||
if (addr)
|
||||
addr += sg->offset;
|
||||
return addr;
|
||||
}
|
||||
|
||||
static unsigned int qib_sg_dma_len(struct ib_device *dev,
|
||||
struct scatterlist *sg)
|
||||
{
|
||||
return sg->length;
|
||||
}
|
||||
|
||||
static void qib_sync_single_for_cpu(struct ib_device *dev, u64 addr,
|
||||
size_t size, enum dma_data_direction dir)
|
||||
{
|
||||
}
|
||||
|
||||
static void qib_sync_single_for_device(struct ib_device *dev, u64 addr,
|
||||
size_t size,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
}
|
||||
|
||||
static void *qib_dma_alloc_coherent(struct ib_device *dev, size_t size,
|
||||
u64 *dma_handle, gfp_t flag)
|
||||
{
|
||||
struct page *p;
|
||||
void *addr = NULL;
|
||||
|
||||
p = alloc_pages(flag, get_order(size));
|
||||
if (p)
|
||||
addr = page_address(p);
|
||||
if (dma_handle)
|
||||
*dma_handle = (u64) addr;
|
||||
return addr;
|
||||
}
|
||||
|
||||
static void qib_dma_free_coherent(struct ib_device *dev, size_t size,
|
||||
void *cpu_addr, u64 dma_handle)
|
||||
{
|
||||
free_pages((unsigned long) cpu_addr, get_order(size));
|
||||
}
|
||||
|
||||
struct ib_dma_mapping_ops qib_dma_mapping_ops = {
|
||||
.mapping_error = qib_mapping_error,
|
||||
.map_single = qib_dma_map_single,
|
||||
.unmap_single = qib_dma_unmap_single,
|
||||
.map_page = qib_dma_map_page,
|
||||
.unmap_page = qib_dma_unmap_page,
|
||||
.map_sg = qib_map_sg,
|
||||
.unmap_sg = qib_unmap_sg,
|
||||
.dma_address = qib_sg_dma_address,
|
||||
.dma_len = qib_sg_dma_len,
|
||||
.sync_single_for_cpu = qib_sync_single_for_cpu,
|
||||
.sync_single_for_device = qib_sync_single_for_device,
|
||||
.alloc_coherent = qib_dma_alloc_coherent,
|
||||
.free_coherent = qib_dma_free_coherent
|
||||
};
|
||||
665
drivers/infiniband/hw/qib/qib_driver.c
Normal file
665
drivers/infiniband/hw/qib/qib_driver.c
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include "qib.h"
|
||||
|
||||
/*
|
||||
* The size has to be longer than this string, so we can append
|
||||
* board/chip information to it in the init code.
|
||||
*/
|
||||
const char ib_qib_version[] = QIB_IDSTR "\n";
|
||||
|
||||
DEFINE_SPINLOCK(qib_devs_lock);
|
||||
LIST_HEAD(qib_dev_list);
|
||||
DEFINE_MUTEX(qib_mutex); /* general driver use */
|
||||
|
||||
unsigned qib_ibmtu;
|
||||
module_param_named(ibmtu, qib_ibmtu, uint, S_IRUGO);
|
||||
MODULE_PARM_DESC(ibmtu, "Set max IB MTU (0=2KB, 1=256, 2=512, ... 5=4096");
|
||||
|
||||
unsigned qib_compat_ddr_negotiate = 1;
|
||||
module_param_named(compat_ddr_negotiate, qib_compat_ddr_negotiate, uint,
|
||||
S_IWUSR | S_IRUGO);
|
||||
MODULE_PARM_DESC(compat_ddr_negotiate,
|
||||
"Attempt pre-IBTA 1.2 DDR speed negotiation");
|
||||
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
MODULE_AUTHOR("QLogic <support@qlogic.com>");
|
||||
MODULE_DESCRIPTION("QLogic IB driver");
|
||||
|
||||
/*
|
||||
* QIB_PIO_MAXIBHDR is the max IB header size allowed for in our
|
||||
* PIO send buffers. This is well beyond anything currently
|
||||
* defined in the InfiniBand spec.
|
||||
*/
|
||||
#define QIB_PIO_MAXIBHDR 128
|
||||
|
||||
struct qlogic_ib_stats qib_stats;
|
||||
|
||||
const char *qib_get_unit_name(int unit)
|
||||
{
|
||||
static char iname[16];
|
||||
|
||||
snprintf(iname, sizeof iname, "infinipath%u", unit);
|
||||
return iname;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return count of units with at least one port ACTIVE.
|
||||
*/
|
||||
int qib_count_active_units(void)
|
||||
{
|
||||
struct qib_devdata *dd;
|
||||
struct qib_pportdata *ppd;
|
||||
unsigned long flags;
|
||||
int pidx, nunits_active = 0;
|
||||
|
||||
spin_lock_irqsave(&qib_devs_lock, flags);
|
||||
list_for_each_entry(dd, &qib_dev_list, list) {
|
||||
if (!(dd->flags & QIB_PRESENT) || !dd->kregbase)
|
||||
continue;
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
|
||||
ppd = dd->pport + pidx;
|
||||
if (ppd->lid && (ppd->lflags & (QIBL_LINKINIT |
|
||||
QIBL_LINKARMED | QIBL_LINKACTIVE))) {
|
||||
nunits_active++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&qib_devs_lock, flags);
|
||||
return nunits_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return count of all units, optionally return in arguments
|
||||
* the number of usable (present) units, and the number of
|
||||
* ports that are up.
|
||||
*/
|
||||
int qib_count_units(int *npresentp, int *nupp)
|
||||
{
|
||||
int nunits = 0, npresent = 0, nup = 0;
|
||||
struct qib_devdata *dd;
|
||||
unsigned long flags;
|
||||
int pidx;
|
||||
struct qib_pportdata *ppd;
|
||||
|
||||
spin_lock_irqsave(&qib_devs_lock, flags);
|
||||
|
||||
list_for_each_entry(dd, &qib_dev_list, list) {
|
||||
nunits++;
|
||||
if ((dd->flags & QIB_PRESENT) && dd->kregbase)
|
||||
npresent++;
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
|
||||
ppd = dd->pport + pidx;
|
||||
if (ppd->lid && (ppd->lflags & (QIBL_LINKINIT |
|
||||
QIBL_LINKARMED | QIBL_LINKACTIVE)))
|
||||
nup++;
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&qib_devs_lock, flags);
|
||||
|
||||
if (npresentp)
|
||||
*npresentp = npresent;
|
||||
if (nupp)
|
||||
*nupp = nup;
|
||||
|
||||
return nunits;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_wait_linkstate - wait for an IB link state change to occur
|
||||
* @dd: the qlogic_ib device
|
||||
* @state: the state to wait for
|
||||
* @msecs: the number of milliseconds to wait
|
||||
*
|
||||
* wait up to msecs milliseconds for IB link state change to occur for
|
||||
* now, take the easy polling route. Currently used only by
|
||||
* qib_set_linkstate. Returns 0 if state reached, otherwise
|
||||
* -ETIMEDOUT state can have multiple states set, for any of several
|
||||
* transitions.
|
||||
*/
|
||||
int qib_wait_linkstate(struct qib_pportdata *ppd, u32 state, int msecs)
|
||||
{
|
||||
int ret;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&ppd->lflags_lock, flags);
|
||||
if (ppd->state_wanted) {
|
||||
spin_unlock_irqrestore(&ppd->lflags_lock, flags);
|
||||
ret = -EBUSY;
|
||||
goto bail;
|
||||
}
|
||||
ppd->state_wanted = state;
|
||||
spin_unlock_irqrestore(&ppd->lflags_lock, flags);
|
||||
wait_event_interruptible_timeout(ppd->state_wait,
|
||||
(ppd->lflags & state),
|
||||
msecs_to_jiffies(msecs));
|
||||
spin_lock_irqsave(&ppd->lflags_lock, flags);
|
||||
ppd->state_wanted = 0;
|
||||
spin_unlock_irqrestore(&ppd->lflags_lock, flags);
|
||||
|
||||
if (!(ppd->lflags & state))
|
||||
ret = -ETIMEDOUT;
|
||||
else
|
||||
ret = 0;
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int qib_set_linkstate(struct qib_pportdata *ppd, u8 newstate)
|
||||
{
|
||||
u32 lstate;
|
||||
int ret;
|
||||
struct qib_devdata *dd = ppd->dd;
|
||||
unsigned long flags;
|
||||
|
||||
switch (newstate) {
|
||||
case QIB_IB_LINKDOWN_ONLY:
|
||||
dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LSTATE,
|
||||
IB_LINKCMD_DOWN | IB_LINKINITCMD_NOP);
|
||||
/* don't wait */
|
||||
ret = 0;
|
||||
goto bail;
|
||||
|
||||
case QIB_IB_LINKDOWN:
|
||||
dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LSTATE,
|
||||
IB_LINKCMD_DOWN | IB_LINKINITCMD_POLL);
|
||||
/* don't wait */
|
||||
ret = 0;
|
||||
goto bail;
|
||||
|
||||
case QIB_IB_LINKDOWN_SLEEP:
|
||||
dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LSTATE,
|
||||
IB_LINKCMD_DOWN | IB_LINKINITCMD_SLEEP);
|
||||
/* don't wait */
|
||||
ret = 0;
|
||||
goto bail;
|
||||
|
||||
case QIB_IB_LINKDOWN_DISABLE:
|
||||
dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LSTATE,
|
||||
IB_LINKCMD_DOWN | IB_LINKINITCMD_DISABLE);
|
||||
/* don't wait */
|
||||
ret = 0;
|
||||
goto bail;
|
||||
|
||||
case QIB_IB_LINKARM:
|
||||
if (ppd->lflags & QIBL_LINKARMED) {
|
||||
ret = 0;
|
||||
goto bail;
|
||||
}
|
||||
if (!(ppd->lflags & (QIBL_LINKINIT | QIBL_LINKACTIVE))) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
/*
|
||||
* Since the port can be ACTIVE when we ask for ARMED,
|
||||
* clear QIBL_LINKV so we can wait for a transition.
|
||||
* If the link isn't ARMED, then something else happened
|
||||
* and there is no point waiting for ARMED.
|
||||
*/
|
||||
spin_lock_irqsave(&ppd->lflags_lock, flags);
|
||||
ppd->lflags &= ~QIBL_LINKV;
|
||||
spin_unlock_irqrestore(&ppd->lflags_lock, flags);
|
||||
dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LSTATE,
|
||||
IB_LINKCMD_ARMED | IB_LINKINITCMD_NOP);
|
||||
lstate = QIBL_LINKV;
|
||||
break;
|
||||
|
||||
case QIB_IB_LINKACTIVE:
|
||||
if (ppd->lflags & QIBL_LINKACTIVE) {
|
||||
ret = 0;
|
||||
goto bail;
|
||||
}
|
||||
if (!(ppd->lflags & QIBL_LINKARMED)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LSTATE,
|
||||
IB_LINKCMD_ACTIVE | IB_LINKINITCMD_NOP);
|
||||
lstate = QIBL_LINKACTIVE;
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
ret = qib_wait_linkstate(ppd, lstate, 10);
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get address of eager buffer from it's index (allocated in chunks, not
|
||||
* contiguous).
|
||||
*/
|
||||
static inline void *qib_get_egrbuf(const struct qib_ctxtdata *rcd, u32 etail)
|
||||
{
|
||||
const u32 chunk = etail / rcd->rcvegrbufs_perchunk;
|
||||
const u32 idx = etail % rcd->rcvegrbufs_perchunk;
|
||||
|
||||
return rcd->rcvegrbuf[chunk] + idx * rcd->dd->rcvegrbufsize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if error was a CRC, else 0.
|
||||
* Needed for some chip's synthesized error counters.
|
||||
*/
|
||||
static u32 qib_rcv_hdrerr(struct qib_pportdata *ppd, u32 ctxt,
|
||||
u32 eflags, u32 l, u32 etail, __le32 *rhf_addr,
|
||||
struct qib_message_header *hdr)
|
||||
{
|
||||
u32 ret = 0;
|
||||
|
||||
if (eflags & (QLOGIC_IB_RHF_H_ICRCERR | QLOGIC_IB_RHF_H_VCRCERR))
|
||||
ret = 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* qib_kreceive - receive a packet
|
||||
* @rcd: the qlogic_ib context
|
||||
* @llic: gets count of good packets needed to clear lli,
|
||||
* (used with chips that need need to track crcs for lli)
|
||||
*
|
||||
* called from interrupt handler for errors or receive interrupt
|
||||
* Returns number of CRC error packets, needed by some chips for
|
||||
* local link integrity tracking. crcs are adjusted down by following
|
||||
* good packets, if any, and count of good packets is also tracked.
|
||||
*/
|
||||
u32 qib_kreceive(struct qib_ctxtdata *rcd, u32 *llic, u32 *npkts)
|
||||
{
|
||||
struct qib_devdata *dd = rcd->dd;
|
||||
struct qib_pportdata *ppd = rcd->ppd;
|
||||
__le32 *rhf_addr;
|
||||
void *ebuf;
|
||||
const u32 rsize = dd->rcvhdrentsize; /* words */
|
||||
const u32 maxcnt = dd->rcvhdrcnt * rsize; /* words */
|
||||
u32 etail = -1, l, hdrqtail;
|
||||
struct qib_message_header *hdr;
|
||||
u32 eflags, etype, tlen, i = 0, updegr = 0, crcs = 0;
|
||||
int last;
|
||||
u64 lval;
|
||||
struct qib_qp *qp, *nqp;
|
||||
|
||||
l = rcd->head;
|
||||
rhf_addr = (__le32 *) rcd->rcvhdrq + l + dd->rhf_offset;
|
||||
if (dd->flags & QIB_NODMA_RTAIL) {
|
||||
u32 seq = qib_hdrget_seq(rhf_addr);
|
||||
if (seq != rcd->seq_cnt)
|
||||
goto bail;
|
||||
hdrqtail = 0;
|
||||
} else {
|
||||
hdrqtail = qib_get_rcvhdrtail(rcd);
|
||||
if (l == hdrqtail)
|
||||
goto bail;
|
||||
smp_rmb(); /* prevent speculative reads of dma'ed hdrq */
|
||||
}
|
||||
|
||||
for (last = 0, i = 1; !last; i += !last) {
|
||||
hdr = dd->f_get_msgheader(dd, rhf_addr);
|
||||
eflags = qib_hdrget_err_flags(rhf_addr);
|
||||
etype = qib_hdrget_rcv_type(rhf_addr);
|
||||
/* total length */
|
||||
tlen = qib_hdrget_length_in_bytes(rhf_addr);
|
||||
ebuf = NULL;
|
||||
if ((dd->flags & QIB_NODMA_RTAIL) ?
|
||||
qib_hdrget_use_egr_buf(rhf_addr) :
|
||||
(etype != RCVHQ_RCV_TYPE_EXPECTED)) {
|
||||
etail = qib_hdrget_index(rhf_addr);
|
||||
updegr = 1;
|
||||
if (tlen > sizeof(*hdr) ||
|
||||
etype >= RCVHQ_RCV_TYPE_NON_KD)
|
||||
ebuf = qib_get_egrbuf(rcd, etail);
|
||||
}
|
||||
if (!eflags) {
|
||||
u16 lrh_len = be16_to_cpu(hdr->lrh[2]) << 2;
|
||||
|
||||
if (lrh_len != tlen) {
|
||||
qib_stats.sps_lenerrs++;
|
||||
goto move_along;
|
||||
}
|
||||
}
|
||||
if (etype == RCVHQ_RCV_TYPE_NON_KD && !eflags &&
|
||||
ebuf == NULL &&
|
||||
tlen > (dd->rcvhdrentsize - 2 + 1 -
|
||||
qib_hdrget_offset(rhf_addr)) << 2) {
|
||||
goto move_along;
|
||||
}
|
||||
|
||||
/*
|
||||
* Both tiderr and qibhdrerr are set for all plain IB
|
||||
* packets; only qibhdrerr should be set.
|
||||
*/
|
||||
if (unlikely(eflags))
|
||||
crcs += qib_rcv_hdrerr(ppd, rcd->ctxt, eflags, l,
|
||||
etail, rhf_addr, hdr);
|
||||
else if (etype == RCVHQ_RCV_TYPE_NON_KD) {
|
||||
qib_ib_rcv(rcd, hdr, ebuf, tlen);
|
||||
if (crcs)
|
||||
crcs--;
|
||||
else if (llic && *llic)
|
||||
--*llic;
|
||||
}
|
||||
move_along:
|
||||
l += rsize;
|
||||
if (l >= maxcnt)
|
||||
l = 0;
|
||||
rhf_addr = (__le32 *) rcd->rcvhdrq + l + dd->rhf_offset;
|
||||
if (dd->flags & QIB_NODMA_RTAIL) {
|
||||
u32 seq = qib_hdrget_seq(rhf_addr);
|
||||
|
||||
if (++rcd->seq_cnt > 13)
|
||||
rcd->seq_cnt = 1;
|
||||
if (seq != rcd->seq_cnt)
|
||||
last = 1;
|
||||
} else if (l == hdrqtail)
|
||||
last = 1;
|
||||
/*
|
||||
* Update head regs etc., every 16 packets, if not last pkt,
|
||||
* to help prevent rcvhdrq overflows, when many packets
|
||||
* are processed and queue is nearly full.
|
||||
* Don't request an interrupt for intermediate updates.
|
||||
*/
|
||||
lval = l;
|
||||
if (!last && !(i & 0xf)) {
|
||||
dd->f_update_usrhead(rcd, lval, updegr, etail);
|
||||
updegr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
rcd->head = l;
|
||||
rcd->pkt_count += i;
|
||||
|
||||
/*
|
||||
* Iterate over all QPs waiting to respond.
|
||||
* The list won't change since the IRQ is only run on one CPU.
|
||||
*/
|
||||
list_for_each_entry_safe(qp, nqp, &rcd->qp_wait_list, rspwait) {
|
||||
list_del_init(&qp->rspwait);
|
||||
if (qp->r_flags & QIB_R_RSP_NAK) {
|
||||
qp->r_flags &= ~QIB_R_RSP_NAK;
|
||||
qib_send_rc_ack(qp);
|
||||
}
|
||||
if (qp->r_flags & QIB_R_RSP_SEND) {
|
||||
unsigned long flags;
|
||||
|
||||
qp->r_flags &= ~QIB_R_RSP_SEND;
|
||||
spin_lock_irqsave(&qp->s_lock, flags);
|
||||
if (ib_qib_state_ops[qp->state] &
|
||||
QIB_PROCESS_OR_FLUSH_SEND)
|
||||
qib_schedule_send(qp);
|
||||
spin_unlock_irqrestore(&qp->s_lock, flags);
|
||||
}
|
||||
if (atomic_dec_and_test(&qp->refcount))
|
||||
wake_up(&qp->wait);
|
||||
}
|
||||
|
||||
bail:
|
||||
/* Report number of packets consumed */
|
||||
if (npkts)
|
||||
*npkts = i;
|
||||
|
||||
/*
|
||||
* Always write head at end, and setup rcv interrupt, even
|
||||
* if no packets were processed.
|
||||
*/
|
||||
lval = (u64)rcd->head | dd->rhdrhead_intr_off;
|
||||
dd->f_update_usrhead(rcd, lval, updegr, etail);
|
||||
return crcs;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_set_mtu - set the MTU
|
||||
* @ppd: the perport data
|
||||
* @arg: the new MTU
|
||||
*
|
||||
* We can handle "any" incoming size, the issue here is whether we
|
||||
* need to restrict our outgoing size. For now, we don't do any
|
||||
* sanity checking on this, and we don't deal with what happens to
|
||||
* programs that are already running when the size changes.
|
||||
* NOTE: changing the MTU will usually cause the IBC to go back to
|
||||
* link INIT state...
|
||||
*/
|
||||
int qib_set_mtu(struct qib_pportdata *ppd, u16 arg)
|
||||
{
|
||||
u32 piosize;
|
||||
int ret, chk;
|
||||
|
||||
if (arg != 256 && arg != 512 && arg != 1024 && arg != 2048 &&
|
||||
arg != 4096) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
chk = ib_mtu_enum_to_int(qib_ibmtu);
|
||||
if (chk > 0 && arg > chk) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
piosize = ppd->ibmaxlen;
|
||||
ppd->ibmtu = arg;
|
||||
|
||||
if (arg >= (piosize - QIB_PIO_MAXIBHDR)) {
|
||||
/* Only if it's not the initial value (or reset to it) */
|
||||
if (piosize != ppd->init_ibmaxlen) {
|
||||
if (arg > piosize && arg <= ppd->init_ibmaxlen)
|
||||
piosize = ppd->init_ibmaxlen - 2 * sizeof(u32);
|
||||
ppd->ibmaxlen = piosize;
|
||||
}
|
||||
} else if ((arg + QIB_PIO_MAXIBHDR) != ppd->ibmaxlen) {
|
||||
piosize = arg + QIB_PIO_MAXIBHDR - 2 * sizeof(u32);
|
||||
ppd->ibmaxlen = piosize;
|
||||
}
|
||||
|
||||
ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_MTU, 0);
|
||||
|
||||
ret = 0;
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int qib_set_lid(struct qib_pportdata *ppd, u32 lid, u8 lmc)
|
||||
{
|
||||
struct qib_devdata *dd = ppd->dd;
|
||||
ppd->lid = lid;
|
||||
ppd->lmc = lmc;
|
||||
|
||||
dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LIDLMC,
|
||||
lid | (~((1U << lmc) - 1)) << 16);
|
||||
|
||||
qib_devinfo(dd->pcidev, "IB%u:%u got a lid: 0x%x\n",
|
||||
dd->unit, ppd->port, lid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Following deal with the "obviously simple" task of overriding the state
|
||||
* of the LEDS, which normally indicate link physical and logical status.
|
||||
* The complications arise in dealing with different hardware mappings
|
||||
* and the board-dependent routine being called from interrupts.
|
||||
* and then there's the requirement to _flash_ them.
|
||||
*/
|
||||
#define LED_OVER_FREQ_SHIFT 8
|
||||
#define LED_OVER_FREQ_MASK (0xFF<<LED_OVER_FREQ_SHIFT)
|
||||
/* Below is "non-zero" to force override, but both actual LEDs are off */
|
||||
#define LED_OVER_BOTH_OFF (8)
|
||||
|
||||
static void qib_run_led_override(unsigned long opaque)
|
||||
{
|
||||
struct qib_pportdata *ppd = (struct qib_pportdata *)opaque;
|
||||
struct qib_devdata *dd = ppd->dd;
|
||||
int timeoff;
|
||||
int ph_idx;
|
||||
|
||||
if (!(dd->flags & QIB_INITTED))
|
||||
return;
|
||||
|
||||
ph_idx = ppd->led_override_phase++ & 1;
|
||||
ppd->led_override = ppd->led_override_vals[ph_idx];
|
||||
timeoff = ppd->led_override_timeoff;
|
||||
|
||||
dd->f_setextled(ppd, 1);
|
||||
/*
|
||||
* don't re-fire the timer if user asked for it to be off; we let
|
||||
* it fire one more time after they turn it off to simplify
|
||||
*/
|
||||
if (ppd->led_override_vals[0] || ppd->led_override_vals[1])
|
||||
mod_timer(&ppd->led_override_timer, jiffies + timeoff);
|
||||
}
|
||||
|
||||
void qib_set_led_override(struct qib_pportdata *ppd, unsigned int val)
|
||||
{
|
||||
struct qib_devdata *dd = ppd->dd;
|
||||
int timeoff, freq;
|
||||
|
||||
if (!(dd->flags & QIB_INITTED))
|
||||
return;
|
||||
|
||||
/* First check if we are blinking. If not, use 1HZ polling */
|
||||
timeoff = HZ;
|
||||
freq = (val & LED_OVER_FREQ_MASK) >> LED_OVER_FREQ_SHIFT;
|
||||
|
||||
if (freq) {
|
||||
/* For blink, set each phase from one nybble of val */
|
||||
ppd->led_override_vals[0] = val & 0xF;
|
||||
ppd->led_override_vals[1] = (val >> 4) & 0xF;
|
||||
timeoff = (HZ << 4)/freq;
|
||||
} else {
|
||||
/* Non-blink set both phases the same. */
|
||||
ppd->led_override_vals[0] = val & 0xF;
|
||||
ppd->led_override_vals[1] = val & 0xF;
|
||||
}
|
||||
ppd->led_override_timeoff = timeoff;
|
||||
|
||||
/*
|
||||
* If the timer has not already been started, do so. Use a "quick"
|
||||
* timeout so the function will be called soon, to look at our request.
|
||||
*/
|
||||
if (atomic_inc_return(&ppd->led_override_timer_active) == 1) {
|
||||
/* Need to start timer */
|
||||
init_timer(&ppd->led_override_timer);
|
||||
ppd->led_override_timer.function = qib_run_led_override;
|
||||
ppd->led_override_timer.data = (unsigned long) ppd;
|
||||
ppd->led_override_timer.expires = jiffies + 1;
|
||||
add_timer(&ppd->led_override_timer);
|
||||
} else {
|
||||
if (ppd->led_override_vals[0] || ppd->led_override_vals[1])
|
||||
mod_timer(&ppd->led_override_timer, jiffies + 1);
|
||||
atomic_dec(&ppd->led_override_timer_active);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_reset_device - reset the chip if possible
|
||||
* @unit: the device to reset
|
||||
*
|
||||
* Whether or not reset is successful, we attempt to re-initialize the chip
|
||||
* (that is, much like a driver unload/reload). We clear the INITTED flag
|
||||
* so that the various entry points will fail until we reinitialize. For
|
||||
* now, we only allow this if no user contexts are open that use chip resources
|
||||
*/
|
||||
int qib_reset_device(int unit)
|
||||
{
|
||||
int ret, i;
|
||||
struct qib_devdata *dd = qib_lookup(unit);
|
||||
struct qib_pportdata *ppd;
|
||||
unsigned long flags;
|
||||
int pidx;
|
||||
|
||||
if (!dd) {
|
||||
ret = -ENODEV;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
qib_devinfo(dd->pcidev, "Reset on unit %u requested\n", unit);
|
||||
|
||||
if (!dd->kregbase || !(dd->flags & QIB_PRESENT)) {
|
||||
qib_devinfo(dd->pcidev, "Invalid unit number %u or "
|
||||
"not initialized or not present\n", unit);
|
||||
ret = -ENXIO;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&dd->uctxt_lock, flags);
|
||||
if (dd->rcd)
|
||||
for (i = dd->first_user_ctxt; i < dd->cfgctxts; i++) {
|
||||
if (!dd->rcd[i] || !dd->rcd[i]->cnt)
|
||||
continue;
|
||||
spin_unlock_irqrestore(&dd->uctxt_lock, flags);
|
||||
ret = -EBUSY;
|
||||
goto bail;
|
||||
}
|
||||
spin_unlock_irqrestore(&dd->uctxt_lock, flags);
|
||||
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
|
||||
ppd = dd->pport + pidx;
|
||||
if (atomic_read(&ppd->led_override_timer_active)) {
|
||||
/* Need to stop LED timer, _then_ shut off LEDs */
|
||||
del_timer_sync(&ppd->led_override_timer);
|
||||
atomic_set(&ppd->led_override_timer_active, 0);
|
||||
}
|
||||
|
||||
/* Shut off LEDs after we are sure timer is not running */
|
||||
ppd->led_override = LED_OVER_BOTH_OFF;
|
||||
dd->f_setextled(ppd, 0);
|
||||
if (dd->flags & QIB_HAS_SEND_DMA)
|
||||
qib_teardown_sdma(ppd);
|
||||
}
|
||||
|
||||
ret = dd->f_reset(dd);
|
||||
if (ret == 1)
|
||||
ret = qib_init(dd, 1);
|
||||
else
|
||||
ret = -EAGAIN;
|
||||
if (ret)
|
||||
qib_dev_err(dd, "Reinitialize unit %u after "
|
||||
"reset failed with %d\n", unit, ret);
|
||||
else
|
||||
qib_devinfo(dd->pcidev, "Reinitialized unit %u after "
|
||||
"resetting\n", unit);
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
451
drivers/infiniband/hw/qib/qib_eeprom.c
Normal file
451
drivers/infiniband/hw/qib/qib_eeprom.c
Normal file
|
|
@ -0,0 +1,451 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include "qib.h"
|
||||
|
||||
/*
|
||||
* Functions specific to the serial EEPROM on cards handled by ib_qib.
|
||||
* The actual serail interface code is in qib_twsi.c. This file is a client
|
||||
*/
|
||||
|
||||
/**
|
||||
* qib_eeprom_read - receives bytes from the eeprom via I2C
|
||||
* @dd: the qlogic_ib device
|
||||
* @eeprom_offset: address to read from
|
||||
* @buffer: where to store result
|
||||
* @len: number of bytes to receive
|
||||
*/
|
||||
int qib_eeprom_read(struct qib_devdata *dd, u8 eeprom_offset,
|
||||
void *buff, int len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = mutex_lock_interruptible(&dd->eep_lock);
|
||||
if (!ret) {
|
||||
ret = qib_twsi_reset(dd);
|
||||
if (ret)
|
||||
qib_dev_err(dd, "EEPROM Reset for read failed\n");
|
||||
else
|
||||
ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev,
|
||||
eeprom_offset, buff, len);
|
||||
mutex_unlock(&dd->eep_lock);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Actually update the eeprom, first doing write enable if
|
||||
* needed, then restoring write enable state.
|
||||
* Must be called with eep_lock held
|
||||
*/
|
||||
static int eeprom_write_with_enable(struct qib_devdata *dd, u8 offset,
|
||||
const void *buf, int len)
|
||||
{
|
||||
int ret, pwen;
|
||||
|
||||
pwen = dd->f_eeprom_wen(dd, 1);
|
||||
ret = qib_twsi_reset(dd);
|
||||
if (ret)
|
||||
qib_dev_err(dd, "EEPROM Reset for write failed\n");
|
||||
else
|
||||
ret = qib_twsi_blk_wr(dd, dd->twsi_eeprom_dev,
|
||||
offset, buf, len);
|
||||
dd->f_eeprom_wen(dd, pwen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_eeprom_write - writes data to the eeprom via I2C
|
||||
* @dd: the qlogic_ib device
|
||||
* @eeprom_offset: where to place data
|
||||
* @buffer: data to write
|
||||
* @len: number of bytes to write
|
||||
*/
|
||||
int qib_eeprom_write(struct qib_devdata *dd, u8 eeprom_offset,
|
||||
const void *buff, int len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = mutex_lock_interruptible(&dd->eep_lock);
|
||||
if (!ret) {
|
||||
ret = eeprom_write_with_enable(dd, eeprom_offset, buff, len);
|
||||
mutex_unlock(&dd->eep_lock);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u8 flash_csum(struct qib_flash *ifp, int adjust)
|
||||
{
|
||||
u8 *ip = (u8 *) ifp;
|
||||
u8 csum = 0, len;
|
||||
|
||||
/*
|
||||
* Limit length checksummed to max length of actual data.
|
||||
* Checksum of erased eeprom will still be bad, but we avoid
|
||||
* reading past the end of the buffer we were passed.
|
||||
*/
|
||||
len = ifp->if_length;
|
||||
if (len > sizeof(struct qib_flash))
|
||||
len = sizeof(struct qib_flash);
|
||||
while (len--)
|
||||
csum += *ip++;
|
||||
csum -= ifp->if_csum;
|
||||
csum = ~csum;
|
||||
if (adjust)
|
||||
ifp->if_csum = csum;
|
||||
|
||||
return csum;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_get_eeprom_info- get the GUID et al. from the TSWI EEPROM device
|
||||
* @dd: the qlogic_ib device
|
||||
*
|
||||
* We have the capability to use the nguid field, and get
|
||||
* the guid from the first chip's flash, to use for all of them.
|
||||
*/
|
||||
void qib_get_eeprom_info(struct qib_devdata *dd)
|
||||
{
|
||||
void *buf;
|
||||
struct qib_flash *ifp;
|
||||
__be64 guid;
|
||||
int len, eep_stat;
|
||||
u8 csum, *bguid;
|
||||
int t = dd->unit;
|
||||
struct qib_devdata *dd0 = qib_lookup(0);
|
||||
|
||||
if (t && dd0->nguid > 1 && t <= dd0->nguid) {
|
||||
u8 oguid;
|
||||
dd->base_guid = dd0->base_guid;
|
||||
bguid = (u8 *) &dd->base_guid;
|
||||
|
||||
oguid = bguid[7];
|
||||
bguid[7] += t;
|
||||
if (oguid > bguid[7]) {
|
||||
if (bguid[6] == 0xff) {
|
||||
if (bguid[5] == 0xff) {
|
||||
qib_dev_err(dd, "Can't set %s GUID"
|
||||
" from base, wraps to"
|
||||
" OUI!\n",
|
||||
qib_get_unit_name(t));
|
||||
dd->base_guid = 0;
|
||||
goto bail;
|
||||
}
|
||||
bguid[5]++;
|
||||
}
|
||||
bguid[6]++;
|
||||
}
|
||||
dd->nguid = 1;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read full flash, not just currently used part, since it may have
|
||||
* been written with a newer definition.
|
||||
* */
|
||||
len = sizeof(struct qib_flash);
|
||||
buf = vmalloc(len);
|
||||
if (!buf) {
|
||||
qib_dev_err(dd, "Couldn't allocate memory to read %u "
|
||||
"bytes from eeprom for GUID\n", len);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use "public" eeprom read function, which does locking and
|
||||
* figures out device. This will migrate to chip-specific.
|
||||
*/
|
||||
eep_stat = qib_eeprom_read(dd, 0, buf, len);
|
||||
|
||||
if (eep_stat) {
|
||||
qib_dev_err(dd, "Failed reading GUID from eeprom\n");
|
||||
goto done;
|
||||
}
|
||||
ifp = (struct qib_flash *)buf;
|
||||
|
||||
csum = flash_csum(ifp, 0);
|
||||
if (csum != ifp->if_csum) {
|
||||
qib_devinfo(dd->pcidev, "Bad I2C flash checksum: "
|
||||
"0x%x, not 0x%x\n", csum, ifp->if_csum);
|
||||
goto done;
|
||||
}
|
||||
if (*(__be64 *) ifp->if_guid == cpu_to_be64(0) ||
|
||||
*(__be64 *) ifp->if_guid == ~cpu_to_be64(0)) {
|
||||
qib_dev_err(dd, "Invalid GUID %llx from flash; ignoring\n",
|
||||
*(unsigned long long *) ifp->if_guid);
|
||||
/* don't allow GUID if all 0 or all 1's */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* complain, but allow it */
|
||||
if (*(u64 *) ifp->if_guid == 0x100007511000000ULL)
|
||||
qib_devinfo(dd->pcidev, "Warning, GUID %llx is "
|
||||
"default, probably not correct!\n",
|
||||
*(unsigned long long *) ifp->if_guid);
|
||||
|
||||
bguid = ifp->if_guid;
|
||||
if (!bguid[0] && !bguid[1] && !bguid[2]) {
|
||||
/*
|
||||
* Original incorrect GUID format in flash; fix in
|
||||
* core copy, by shifting up 2 octets; don't need to
|
||||
* change top octet, since both it and shifted are 0.
|
||||
*/
|
||||
bguid[1] = bguid[3];
|
||||
bguid[2] = bguid[4];
|
||||
bguid[3] = 0;
|
||||
bguid[4] = 0;
|
||||
guid = *(__be64 *) ifp->if_guid;
|
||||
} else
|
||||
guid = *(__be64 *) ifp->if_guid;
|
||||
dd->base_guid = guid;
|
||||
dd->nguid = ifp->if_numguid;
|
||||
/*
|
||||
* Things are slightly complicated by the desire to transparently
|
||||
* support both the Pathscale 10-digit serial number and the QLogic
|
||||
* 13-character version.
|
||||
*/
|
||||
if ((ifp->if_fversion > 1) && ifp->if_sprefix[0] &&
|
||||
((u8 *) ifp->if_sprefix)[0] != 0xFF) {
|
||||
char *snp = dd->serial;
|
||||
|
||||
/*
|
||||
* This board has a Serial-prefix, which is stored
|
||||
* elsewhere for backward-compatibility.
|
||||
*/
|
||||
memcpy(snp, ifp->if_sprefix, sizeof ifp->if_sprefix);
|
||||
snp[sizeof ifp->if_sprefix] = '\0';
|
||||
len = strlen(snp);
|
||||
snp += len;
|
||||
len = (sizeof dd->serial) - len;
|
||||
if (len > sizeof ifp->if_serial)
|
||||
len = sizeof ifp->if_serial;
|
||||
memcpy(snp, ifp->if_serial, len);
|
||||
} else
|
||||
memcpy(dd->serial, ifp->if_serial,
|
||||
sizeof ifp->if_serial);
|
||||
if (!strstr(ifp->if_comment, "Tested successfully"))
|
||||
qib_dev_err(dd, "Board SN %s did not pass functional "
|
||||
"test: %s\n", dd->serial, ifp->if_comment);
|
||||
|
||||
memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT);
|
||||
/*
|
||||
* Power-on (actually "active") hours are kept as little-endian value
|
||||
* in EEPROM, but as seconds in a (possibly as small as 24-bit)
|
||||
* atomic_t while running.
|
||||
*/
|
||||
atomic_set(&dd->active_time, 0);
|
||||
dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8);
|
||||
|
||||
done:
|
||||
vfree(buf);
|
||||
|
||||
bail:;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_update_eeprom_log - copy active-time and error counters to eeprom
|
||||
* @dd: the qlogic_ib device
|
||||
*
|
||||
* Although the time is kept as seconds in the qib_devdata struct, it is
|
||||
* rounded to hours for re-write, as we have only 16 bits in EEPROM.
|
||||
* First-cut code reads whole (expected) struct qib_flash, modifies,
|
||||
* re-writes. Future direction: read/write only what we need, assuming
|
||||
* that the EEPROM had to have been "good enough" for driver init, and
|
||||
* if not, we aren't making it worse.
|
||||
*
|
||||
*/
|
||||
int qib_update_eeprom_log(struct qib_devdata *dd)
|
||||
{
|
||||
void *buf;
|
||||
struct qib_flash *ifp;
|
||||
int len, hi_water;
|
||||
uint32_t new_time, new_hrs;
|
||||
u8 csum;
|
||||
int ret, idx;
|
||||
unsigned long flags;
|
||||
|
||||
/* first, check if we actually need to do anything. */
|
||||
ret = 0;
|
||||
for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
|
||||
if (dd->eep_st_new_errs[idx]) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
new_time = atomic_read(&dd->active_time);
|
||||
|
||||
if (ret == 0 && new_time < 3600)
|
||||
goto bail;
|
||||
|
||||
/*
|
||||
* The quick-check above determined that there is something worthy
|
||||
* of logging, so get current contents and do a more detailed idea.
|
||||
* read full flash, not just currently used part, since it may have
|
||||
* been written with a newer definition
|
||||
*/
|
||||
len = sizeof(struct qib_flash);
|
||||
buf = vmalloc(len);
|
||||
ret = 1;
|
||||
if (!buf) {
|
||||
qib_dev_err(dd, "Couldn't allocate memory to read %u "
|
||||
"bytes from eeprom for logging\n", len);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Grab semaphore and read current EEPROM. If we get an
|
||||
* error, let go, but if not, keep it until we finish write.
|
||||
*/
|
||||
ret = mutex_lock_interruptible(&dd->eep_lock);
|
||||
if (ret) {
|
||||
qib_dev_err(dd, "Unable to acquire EEPROM for logging\n");
|
||||
goto free_bail;
|
||||
}
|
||||
ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len);
|
||||
if (ret) {
|
||||
mutex_unlock(&dd->eep_lock);
|
||||
qib_dev_err(dd, "Unable read EEPROM for logging\n");
|
||||
goto free_bail;
|
||||
}
|
||||
ifp = (struct qib_flash *)buf;
|
||||
|
||||
csum = flash_csum(ifp, 0);
|
||||
if (csum != ifp->if_csum) {
|
||||
mutex_unlock(&dd->eep_lock);
|
||||
qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n",
|
||||
csum, ifp->if_csum);
|
||||
ret = 1;
|
||||
goto free_bail;
|
||||
}
|
||||
hi_water = 0;
|
||||
spin_lock_irqsave(&dd->eep_st_lock, flags);
|
||||
for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
|
||||
int new_val = dd->eep_st_new_errs[idx];
|
||||
if (new_val) {
|
||||
/*
|
||||
* If we have seen any errors, add to EEPROM values
|
||||
* We need to saturate at 0xFF (255) and we also
|
||||
* would need to adjust the checksum if we were
|
||||
* trying to minimize EEPROM traffic
|
||||
* Note that we add to actual current count in EEPROM,
|
||||
* in case it was altered while we were running.
|
||||
*/
|
||||
new_val += ifp->if_errcntp[idx];
|
||||
if (new_val > 0xFF)
|
||||
new_val = 0xFF;
|
||||
if (ifp->if_errcntp[idx] != new_val) {
|
||||
ifp->if_errcntp[idx] = new_val;
|
||||
hi_water = offsetof(struct qib_flash,
|
||||
if_errcntp) + idx;
|
||||
}
|
||||
/*
|
||||
* update our shadow (used to minimize EEPROM
|
||||
* traffic), to match what we are about to write.
|
||||
*/
|
||||
dd->eep_st_errs[idx] = new_val;
|
||||
dd->eep_st_new_errs[idx] = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Now update active-time. We would like to round to the nearest hour
|
||||
* but unless atomic_t are sure to be proper signed ints we cannot,
|
||||
* because we need to account for what we "transfer" to EEPROM and
|
||||
* if we log an hour at 31 minutes, then we would need to set
|
||||
* active_time to -29 to accurately count the _next_ hour.
|
||||
*/
|
||||
if (new_time >= 3600) {
|
||||
new_hrs = new_time / 3600;
|
||||
atomic_sub((new_hrs * 3600), &dd->active_time);
|
||||
new_hrs += dd->eep_hrs;
|
||||
if (new_hrs > 0xFFFF)
|
||||
new_hrs = 0xFFFF;
|
||||
dd->eep_hrs = new_hrs;
|
||||
if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) {
|
||||
ifp->if_powerhour[0] = new_hrs & 0xFF;
|
||||
hi_water = offsetof(struct qib_flash, if_powerhour);
|
||||
}
|
||||
if ((new_hrs >> 8) != ifp->if_powerhour[1]) {
|
||||
ifp->if_powerhour[1] = new_hrs >> 8;
|
||||
hi_water = offsetof(struct qib_flash, if_powerhour) + 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* There is a tiny possibility that we could somehow fail to write
|
||||
* the EEPROM after updating our shadows, but problems from holding
|
||||
* the spinlock too long are a much bigger issue.
|
||||
*/
|
||||
spin_unlock_irqrestore(&dd->eep_st_lock, flags);
|
||||
if (hi_water) {
|
||||
/* we made some change to the data, uopdate cksum and write */
|
||||
csum = flash_csum(ifp, 1);
|
||||
ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1);
|
||||
}
|
||||
mutex_unlock(&dd->eep_lock);
|
||||
if (ret)
|
||||
qib_dev_err(dd, "Failed updating EEPROM\n");
|
||||
|
||||
free_bail:
|
||||
vfree(buf);
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_inc_eeprom_err - increment one of the four error counters
|
||||
* that are logged to EEPROM.
|
||||
* @dd: the qlogic_ib device
|
||||
* @eidx: 0..3, the counter to increment
|
||||
* @incr: how much to add
|
||||
*
|
||||
* Each counter is 8-bits, and saturates at 255 (0xFF). They
|
||||
* are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log()
|
||||
* is called, but it can only be called in a context that allows sleep.
|
||||
* This function can be called even at interrupt level.
|
||||
*/
|
||||
void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr)
|
||||
{
|
||||
uint new_val;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&dd->eep_st_lock, flags);
|
||||
new_val = dd->eep_st_new_errs[eidx] + incr;
|
||||
if (new_val > 255)
|
||||
new_val = 255;
|
||||
dd->eep_st_new_errs[eidx] = new_val;
|
||||
spin_unlock_irqrestore(&dd->eep_st_lock, flags);
|
||||
}
|
||||
2317
drivers/infiniband/hw/qib/qib_file_ops.c
Normal file
2317
drivers/infiniband/hw/qib/qib_file_ops.c
Normal file
File diff suppressed because it is too large
Load diff
613
drivers/infiniband/hw/qib/qib_fs.c
Normal file
613
drivers/infiniband/hw/qib/qib_fs.c
Normal file
|
|
@ -0,0 +1,613 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/namei.h>
|
||||
|
||||
#include "qib.h"
|
||||
|
||||
#define QIBFS_MAGIC 0x726a77
|
||||
|
||||
static struct super_block *qib_super;
|
||||
|
||||
#define private2dd(file) ((file)->f_dentry->d_inode->i_private)
|
||||
|
||||
static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
|
||||
int mode, const struct file_operations *fops,
|
||||
void *data)
|
||||
{
|
||||
int error;
|
||||
struct inode *inode = new_inode(dir->i_sb);
|
||||
|
||||
if (!inode) {
|
||||
error = -EPERM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
inode->i_mode = mode;
|
||||
inode->i_uid = 0;
|
||||
inode->i_gid = 0;
|
||||
inode->i_blocks = 0;
|
||||
inode->i_atime = CURRENT_TIME;
|
||||
inode->i_mtime = inode->i_atime;
|
||||
inode->i_ctime = inode->i_atime;
|
||||
inode->i_private = data;
|
||||
if ((mode & S_IFMT) == S_IFDIR) {
|
||||
inode->i_op = &simple_dir_inode_operations;
|
||||
inc_nlink(inode);
|
||||
inc_nlink(dir);
|
||||
}
|
||||
|
||||
inode->i_fop = fops;
|
||||
|
||||
d_instantiate(dentry, inode);
|
||||
error = 0;
|
||||
|
||||
bail:
|
||||
return error;
|
||||
}
|
||||
|
||||
static int create_file(const char *name, mode_t mode,
|
||||
struct dentry *parent, struct dentry **dentry,
|
||||
const struct file_operations *fops, void *data)
|
||||
{
|
||||
int error;
|
||||
|
||||
*dentry = NULL;
|
||||
mutex_lock(&parent->d_inode->i_mutex);
|
||||
*dentry = lookup_one_len(name, parent, strlen(name));
|
||||
if (!IS_ERR(*dentry))
|
||||
error = qibfs_mknod(parent->d_inode, *dentry,
|
||||
mode, fops, data);
|
||||
else
|
||||
error = PTR_ERR(*dentry);
|
||||
mutex_unlock(&parent->d_inode->i_mutex);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static ssize_t driver_stats_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
return simple_read_from_buffer(buf, count, ppos, &qib_stats,
|
||||
sizeof qib_stats);
|
||||
}
|
||||
|
||||
/*
|
||||
* driver stats field names, one line per stat, single string. Used by
|
||||
* programs like ipathstats to print the stats in a way which works for
|
||||
* different versions of drivers, without changing program source.
|
||||
* if qlogic_ib_stats changes, this needs to change. Names need to be
|
||||
* 12 chars or less (w/o newline), for proper display by ipathstats utility.
|
||||
*/
|
||||
static const char qib_statnames[] =
|
||||
"KernIntr\n"
|
||||
"ErrorIntr\n"
|
||||
"Tx_Errs\n"
|
||||
"Rcv_Errs\n"
|
||||
"H/W_Errs\n"
|
||||
"NoPIOBufs\n"
|
||||
"CtxtsOpen\n"
|
||||
"RcvLen_Errs\n"
|
||||
"EgrBufFull\n"
|
||||
"EgrHdrFull\n"
|
||||
;
|
||||
|
||||
static ssize_t driver_names_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
return simple_read_from_buffer(buf, count, ppos, qib_statnames,
|
||||
sizeof qib_statnames - 1); /* no null */
|
||||
}
|
||||
|
||||
static const struct file_operations driver_ops[] = {
|
||||
{ .read = driver_stats_read, },
|
||||
{ .read = driver_names_read, },
|
||||
};
|
||||
|
||||
/* read the per-device counters */
|
||||
static ssize_t dev_counters_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
u64 *counters;
|
||||
struct qib_devdata *dd = private2dd(file);
|
||||
|
||||
return simple_read_from_buffer(buf, count, ppos, counters,
|
||||
dd->f_read_cntrs(dd, *ppos, NULL, &counters));
|
||||
}
|
||||
|
||||
/* read the per-device counters */
|
||||
static ssize_t dev_names_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
char *names;
|
||||
struct qib_devdata *dd = private2dd(file);
|
||||
|
||||
return simple_read_from_buffer(buf, count, ppos, names,
|
||||
dd->f_read_cntrs(dd, *ppos, &names, NULL));
|
||||
}
|
||||
|
||||
static const struct file_operations cntr_ops[] = {
|
||||
{ .read = dev_counters_read, },
|
||||
{ .read = dev_names_read, },
|
||||
};
|
||||
|
||||
/*
|
||||
* Could use file->f_dentry->d_inode->i_ino to figure out which file,
|
||||
* instead of separate routine for each, but for now, this works...
|
||||
*/
|
||||
|
||||
/* read the per-port names (same for each port) */
|
||||
static ssize_t portnames_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
char *names;
|
||||
struct qib_devdata *dd = private2dd(file);
|
||||
|
||||
return simple_read_from_buffer(buf, count, ppos, names,
|
||||
dd->f_read_portcntrs(dd, *ppos, 0, &names, NULL));
|
||||
}
|
||||
|
||||
/* read the per-port counters for port 1 (pidx 0) */
|
||||
static ssize_t portcntrs_1_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
u64 *counters;
|
||||
struct qib_devdata *dd = private2dd(file);
|
||||
|
||||
return simple_read_from_buffer(buf, count, ppos, counters,
|
||||
dd->f_read_portcntrs(dd, *ppos, 0, NULL, &counters));
|
||||
}
|
||||
|
||||
/* read the per-port counters for port 2 (pidx 1) */
|
||||
static ssize_t portcntrs_2_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
u64 *counters;
|
||||
struct qib_devdata *dd = private2dd(file);
|
||||
|
||||
return simple_read_from_buffer(buf, count, ppos, counters,
|
||||
dd->f_read_portcntrs(dd, *ppos, 1, NULL, &counters));
|
||||
}
|
||||
|
||||
static const struct file_operations portcntr_ops[] = {
|
||||
{ .read = portnames_read, },
|
||||
{ .read = portcntrs_1_read, },
|
||||
{ .read = portcntrs_2_read, },
|
||||
};
|
||||
|
||||
/*
|
||||
* read the per-port QSFP data for port 1 (pidx 0)
|
||||
*/
|
||||
static ssize_t qsfp_1_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct qib_devdata *dd = private2dd(file);
|
||||
char *tmp;
|
||||
int ret;
|
||||
|
||||
tmp = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = qib_qsfp_dump(dd->pport, tmp, PAGE_SIZE);
|
||||
if (ret > 0)
|
||||
ret = simple_read_from_buffer(buf, count, ppos, tmp, ret);
|
||||
kfree(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* read the per-port QSFP data for port 2 (pidx 1)
|
||||
*/
|
||||
static ssize_t qsfp_2_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct qib_devdata *dd = private2dd(file);
|
||||
char *tmp;
|
||||
int ret;
|
||||
|
||||
if (dd->num_pports < 2)
|
||||
return -ENODEV;
|
||||
|
||||
tmp = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = qib_qsfp_dump(dd->pport + 1, tmp, PAGE_SIZE);
|
||||
if (ret > 0)
|
||||
ret = simple_read_from_buffer(buf, count, ppos, tmp, ret);
|
||||
kfree(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations qsfp_ops[] = {
|
||||
{ .read = qsfp_1_read, },
|
||||
{ .read = qsfp_2_read, },
|
||||
};
|
||||
|
||||
static ssize_t flash_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct qib_devdata *dd;
|
||||
ssize_t ret;
|
||||
loff_t pos;
|
||||
char *tmp;
|
||||
|
||||
pos = *ppos;
|
||||
|
||||
if (pos < 0) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (pos >= sizeof(struct qib_flash)) {
|
||||
ret = 0;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (count > sizeof(struct qib_flash) - pos)
|
||||
count = sizeof(struct qib_flash) - pos;
|
||||
|
||||
tmp = kmalloc(count, GFP_KERNEL);
|
||||
if (!tmp) {
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dd = private2dd(file);
|
||||
if (qib_eeprom_read(dd, pos, tmp, count)) {
|
||||
qib_dev_err(dd, "failed to read from flash\n");
|
||||
ret = -ENXIO;
|
||||
goto bail_tmp;
|
||||
}
|
||||
|
||||
if (copy_to_user(buf, tmp, count)) {
|
||||
ret = -EFAULT;
|
||||
goto bail_tmp;
|
||||
}
|
||||
|
||||
*ppos = pos + count;
|
||||
ret = count;
|
||||
|
||||
bail_tmp:
|
||||
kfree(tmp);
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t flash_write(struct file *file, const char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct qib_devdata *dd;
|
||||
ssize_t ret;
|
||||
loff_t pos;
|
||||
char *tmp;
|
||||
|
||||
pos = *ppos;
|
||||
|
||||
if (pos != 0) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (count != sizeof(struct qib_flash)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
tmp = kmalloc(count, GFP_KERNEL);
|
||||
if (!tmp) {
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (copy_from_user(tmp, buf, count)) {
|
||||
ret = -EFAULT;
|
||||
goto bail_tmp;
|
||||
}
|
||||
|
||||
dd = private2dd(file);
|
||||
if (qib_eeprom_write(dd, pos, tmp, count)) {
|
||||
ret = -ENXIO;
|
||||
qib_dev_err(dd, "failed to write to flash\n");
|
||||
goto bail_tmp;
|
||||
}
|
||||
|
||||
*ppos = pos + count;
|
||||
ret = count;
|
||||
|
||||
bail_tmp:
|
||||
kfree(tmp);
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations flash_ops = {
|
||||
.read = flash_read,
|
||||
.write = flash_write,
|
||||
};
|
||||
|
||||
static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
|
||||
{
|
||||
struct dentry *dir, *tmp;
|
||||
char unit[10];
|
||||
int ret, i;
|
||||
|
||||
/* create the per-unit directory */
|
||||
snprintf(unit, sizeof unit, "%u", dd->unit);
|
||||
ret = create_file(unit, S_IFDIR|S_IRUGO|S_IXUGO, sb->s_root, &dir,
|
||||
&simple_dir_operations, dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s) failed: %d\n", unit, ret);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* create the files in the new directory */
|
||||
ret = create_file("counters", S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&cntr_ops[0], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/counters) failed: %d\n",
|
||||
unit, ret);
|
||||
goto bail;
|
||||
}
|
||||
ret = create_file("counter_names", S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&cntr_ops[1], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/counter_names) failed: %d\n",
|
||||
unit, ret);
|
||||
goto bail;
|
||||
}
|
||||
ret = create_file("portcounter_names", S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&portcntr_ops[0], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/%s) failed: %d\n",
|
||||
unit, "portcounter_names", ret);
|
||||
goto bail;
|
||||
}
|
||||
for (i = 1; i <= dd->num_pports; i++) {
|
||||
char fname[24];
|
||||
|
||||
sprintf(fname, "port%dcounters", i);
|
||||
/* create the files in the new directory */
|
||||
ret = create_file(fname, S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&portcntr_ops[i], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/%s) failed: %d\n",
|
||||
unit, fname, ret);
|
||||
goto bail;
|
||||
}
|
||||
if (!(dd->flags & QIB_HAS_QSFP))
|
||||
continue;
|
||||
sprintf(fname, "qsfp%d", i);
|
||||
ret = create_file(fname, S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&qsfp_ops[i - 1], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/%s) failed: %d\n",
|
||||
unit, fname, ret);
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
ret = create_file("flash", S_IFREG|S_IWUSR|S_IRUGO, dir, &tmp,
|
||||
&flash_ops, dd);
|
||||
if (ret)
|
||||
printk(KERN_ERR "create_file(%s/flash) failed: %d\n",
|
||||
unit, ret);
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int remove_file(struct dentry *parent, char *name)
|
||||
{
|
||||
struct dentry *tmp;
|
||||
int ret;
|
||||
|
||||
tmp = lookup_one_len(name, parent, strlen(name));
|
||||
|
||||
if (IS_ERR(tmp)) {
|
||||
ret = PTR_ERR(tmp);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
spin_lock(&dcache_lock);
|
||||
spin_lock(&tmp->d_lock);
|
||||
if (!(d_unhashed(tmp) && tmp->d_inode)) {
|
||||
dget_locked(tmp);
|
||||
__d_drop(tmp);
|
||||
spin_unlock(&tmp->d_lock);
|
||||
spin_unlock(&dcache_lock);
|
||||
simple_unlink(parent->d_inode, tmp);
|
||||
} else {
|
||||
spin_unlock(&tmp->d_lock);
|
||||
spin_unlock(&dcache_lock);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
bail:
|
||||
/*
|
||||
* We don't expect clients to care about the return value, but
|
||||
* it's there if they need it.
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int remove_device_files(struct super_block *sb,
|
||||
struct qib_devdata *dd)
|
||||
{
|
||||
struct dentry *dir, *root;
|
||||
char unit[10];
|
||||
int ret, i;
|
||||
|
||||
root = dget(sb->s_root);
|
||||
mutex_lock(&root->d_inode->i_mutex);
|
||||
snprintf(unit, sizeof unit, "%u", dd->unit);
|
||||
dir = lookup_one_len(unit, root, strlen(unit));
|
||||
|
||||
if (IS_ERR(dir)) {
|
||||
ret = PTR_ERR(dir);
|
||||
printk(KERN_ERR "Lookup of %s failed\n", unit);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
remove_file(dir, "counters");
|
||||
remove_file(dir, "counter_names");
|
||||
remove_file(dir, "portcounter_names");
|
||||
for (i = 0; i < dd->num_pports; i++) {
|
||||
char fname[24];
|
||||
|
||||
sprintf(fname, "port%dcounters", i + 1);
|
||||
remove_file(dir, fname);
|
||||
if (dd->flags & QIB_HAS_QSFP) {
|
||||
sprintf(fname, "qsfp%d", i + 1);
|
||||
remove_file(dir, fname);
|
||||
}
|
||||
}
|
||||
remove_file(dir, "flash");
|
||||
d_delete(dir);
|
||||
ret = simple_rmdir(root->d_inode, dir);
|
||||
|
||||
bail:
|
||||
mutex_unlock(&root->d_inode->i_mutex);
|
||||
dput(root);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* This fills everything in when the fs is mounted, to handle umount/mount
|
||||
* after device init. The direct add_cntr_files() call handles adding
|
||||
* them from the init code, when the fs is already mounted.
|
||||
*/
|
||||
static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
{
|
||||
struct qib_devdata *dd, *tmp;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
static struct tree_descr files[] = {
|
||||
[2] = {"driver_stats", &driver_ops[0], S_IRUGO},
|
||||
[3] = {"driver_stats_names", &driver_ops[1], S_IRUGO},
|
||||
{""},
|
||||
};
|
||||
|
||||
ret = simple_fill_super(sb, QIBFS_MAGIC, files);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "simple_fill_super failed: %d\n", ret);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&qib_devs_lock, flags);
|
||||
|
||||
list_for_each_entry_safe(dd, tmp, &qib_dev_list, list) {
|
||||
spin_unlock_irqrestore(&qib_devs_lock, flags);
|
||||
ret = add_cntr_files(sb, dd);
|
||||
if (ret) {
|
||||
deactivate_super(sb);
|
||||
goto bail;
|
||||
}
|
||||
spin_lock_irqsave(&qib_devs_lock, flags);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&qib_devs_lock, flags);
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qibfs_get_sb(struct file_system_type *fs_type, int flags,
|
||||
const char *dev_name, void *data, struct vfsmount *mnt)
|
||||
{
|
||||
int ret = get_sb_single(fs_type, flags, data,
|
||||
qibfs_fill_super, mnt);
|
||||
if (ret >= 0)
|
||||
qib_super = mnt->mnt_sb;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void qibfs_kill_super(struct super_block *s)
|
||||
{
|
||||
kill_litter_super(s);
|
||||
qib_super = NULL;
|
||||
}
|
||||
|
||||
int qibfs_add(struct qib_devdata *dd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* On first unit initialized, qib_super will not yet exist
|
||||
* because nobody has yet tried to mount the filesystem, so
|
||||
* we can't consider that to be an error; if an error occurs
|
||||
* during the mount, that will get a complaint, so this is OK.
|
||||
* add_cntr_files() for all units is done at mount from
|
||||
* qibfs_fill_super(), so one way or another, everything works.
|
||||
*/
|
||||
if (qib_super == NULL)
|
||||
ret = 0;
|
||||
else
|
||||
ret = add_cntr_files(qib_super, dd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int qibfs_remove(struct qib_devdata *dd)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (qib_super)
|
||||
ret = remove_device_files(qib_super, dd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct file_system_type qibfs_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ipathfs",
|
||||
.get_sb = qibfs_get_sb,
|
||||
.kill_sb = qibfs_kill_super,
|
||||
};
|
||||
|
||||
int __init qib_init_qibfs(void)
|
||||
{
|
||||
return register_filesystem(&qibfs_fs_type);
|
||||
}
|
||||
|
||||
int __exit qib_exit_qibfs(void)
|
||||
{
|
||||
return unregister_filesystem(&qibfs_fs_type);
|
||||
}
|
||||
3588
drivers/infiniband/hw/qib/qib_iba6120.c
Normal file
3588
drivers/infiniband/hw/qib/qib_iba6120.c
Normal file
File diff suppressed because it is too large
Load diff
4618
drivers/infiniband/hw/qib/qib_iba7220.c
Normal file
4618
drivers/infiniband/hw/qib/qib_iba7220.c
Normal file
File diff suppressed because it is too large
Load diff
8058
drivers/infiniband/hw/qib/qib_iba7322.c
Normal file
8058
drivers/infiniband/hw/qib/qib_iba7322.c
Normal file
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue