mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
e3976af5a4
All files in this driver directory contain the following notice: See LICENSE.qla4xxx for copyright and licensing details. LICENSE.qla4xxx can be found in Documentation/scsi/. The file contains: - A copyright notice This copyright notice is redundant as all files contain the same copyright notice already - A license notice You may modify and redistribute the device driver code under the GNU General Public License (a copy of which is attached hereto as Exhibit A) published by the Free Software Foundation (version 2). - The full GPLv2 license text This can be replaced with the corresponding SPDX license identifier (GPL-2.0-only) in the source files which reference this license file. - The full GPLv2 license text A redundant copy of LICENSES/preferred/GPL-2.0 Remove the notices and add the SPDX license identifier GPL-2.0-only to the source files. Finally remove the now redundant LICENSE.qla4xxx file. Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Jilayne Lovejoy <opensource@jilayne.com> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Acked-by: Nilesh Javali <njavali@marvell.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
96 lines
2.3 KiB
C
96 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* QLogic iSCSI HBA Driver
|
|
* Copyright (c) 2003-2013 QLogic Corporation
|
|
*/
|
|
|
|
/*
|
|
*
|
|
* qla4xxx_lookup_ddb_by_fw_index
|
|
* This routine locates a device handle given the firmware device
|
|
* database index. If device doesn't exist, returns NULL.
|
|
*
|
|
* Input:
|
|
* ha - Pointer to host adapter structure.
|
|
* fw_ddb_index - Firmware's device database index
|
|
*
|
|
* Returns:
|
|
* Pointer to the corresponding internal device database structure
|
|
*/
|
|
static inline struct ddb_entry *
|
|
qla4xxx_lookup_ddb_by_fw_index(struct scsi_qla_host *ha, uint32_t fw_ddb_index)
|
|
{
|
|
struct ddb_entry *ddb_entry = NULL;
|
|
|
|
if ((fw_ddb_index < MAX_DDB_ENTRIES) &&
|
|
(ha->fw_ddb_index_map[fw_ddb_index] !=
|
|
(struct ddb_entry *) INVALID_ENTRY)) {
|
|
ddb_entry = ha->fw_ddb_index_map[fw_ddb_index];
|
|
}
|
|
|
|
DEBUG3(printk("scsi%d: %s: ddb [%d], ddb_entry = %p\n",
|
|
ha->host_no, __func__, fw_ddb_index, ddb_entry));
|
|
|
|
return ddb_entry;
|
|
}
|
|
|
|
static inline void
|
|
__qla4xxx_enable_intrs(struct scsi_qla_host *ha)
|
|
{
|
|
if (is_qla4022(ha) | is_qla4032(ha)) {
|
|
writel(set_rmask(IMR_SCSI_INTR_ENABLE),
|
|
&ha->reg->u1.isp4022.intr_mask);
|
|
readl(&ha->reg->u1.isp4022.intr_mask);
|
|
} else {
|
|
writel(set_rmask(CSR_SCSI_INTR_ENABLE), &ha->reg->ctrl_status);
|
|
readl(&ha->reg->ctrl_status);
|
|
}
|
|
set_bit(AF_INTERRUPTS_ON, &ha->flags);
|
|
}
|
|
|
|
static inline void
|
|
__qla4xxx_disable_intrs(struct scsi_qla_host *ha)
|
|
{
|
|
if (is_qla4022(ha) | is_qla4032(ha)) {
|
|
writel(clr_rmask(IMR_SCSI_INTR_ENABLE),
|
|
&ha->reg->u1.isp4022.intr_mask);
|
|
readl(&ha->reg->u1.isp4022.intr_mask);
|
|
} else {
|
|
writel(clr_rmask(CSR_SCSI_INTR_ENABLE), &ha->reg->ctrl_status);
|
|
readl(&ha->reg->ctrl_status);
|
|
}
|
|
clear_bit(AF_INTERRUPTS_ON, &ha->flags);
|
|
}
|
|
|
|
static inline void
|
|
qla4xxx_enable_intrs(struct scsi_qla_host *ha)
|
|
{
|
|
unsigned long flags;
|
|
|
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
|
__qla4xxx_enable_intrs(ha);
|
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
|
}
|
|
|
|
static inline void
|
|
qla4xxx_disable_intrs(struct scsi_qla_host *ha)
|
|
{
|
|
unsigned long flags;
|
|
|
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
|
__qla4xxx_disable_intrs(ha);
|
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
|
}
|
|
|
|
static inline int qla4xxx_get_chap_type(struct ql4_chap_table *chap_entry)
|
|
{
|
|
int type;
|
|
|
|
if (chap_entry->flags & BIT_7)
|
|
type = LOCAL_CHAP;
|
|
else
|
|
type = BIDI_CHAP;
|
|
|
|
return type;
|
|
}
|