qla2xxx: Minimize diffs with upstream

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8976 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-05-23 22:53:52 +00:00
parent ac5f86c035
commit a88046be97
11 changed files with 108 additions and 52 deletions
@@ -438,7 +438,8 @@ static int sqa_qla2xxx_handle_cmd(scsi_qla_host_t *vha,
goto out;
}
scst_cmd_set_tag(cmd->scst_cmd, atio->u.isp24.exchange_addr);
scst_cmd_set_tag(cmd->scst_cmd,
le32_to_cpu(atio->u.isp24.exchange_addr));
scst_cmd_set_tgt_priv(cmd->scst_cmd, cmd);
if (atio->u.isp24.fcp_cmnd.rddata && atio->u.isp24.fcp_cmnd.wrdata)
+5 -4
View File
@@ -855,10 +855,11 @@ qla2x00_process_loopback(struct bsg_job *bsg_job)
bsg_request->rqst_data.h_vendor.vendor_cmd[2];
if (atomic_read(&vha->loop_state) == LOOP_READY &&
(ha->current_topology == ISP_CFG_F ||
(le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE &&
req_data_len == MAX_ELS_FRAME_PAYLOAD)) &&
elreq.options == EXTERNAL_LOOPBACK) {
((ha->current_topology == ISP_CFG_F && (elreq.options & 7) >= 2) ||
((IS_QLA81XX(ha) || IS_QLA8031(ha) || IS_QLA8044(ha)) &&
get_unaligned_le32(req_data) == ELS_OPCODE_BYTE &&
req_data_len == MAX_ELS_FRAME_PAYLOAD &&
elreq.options == EXTERNAL_LOOPBACK))) {
type = "FC_BSG_HST_VENDOR_ECHO_DIAG";
ql_dbg(ql_dbg_user, vha, 0x701e,
"BSG request type: %s.\n", type);
+1 -1
View File
@@ -4168,7 +4168,7 @@ struct qla_hw_data {
void *sfp_data;
dma_addr_t sfp_data_dma;
void *flt;
struct qla_flt_header *flt;
dma_addr_t flt_dma;
#define XGMAC_DATA_SIZE 4096
+12 -11
View File
@@ -1624,13 +1624,6 @@ struct qla_flt_location {
__le16 checksum;
};
struct qla_flt_header {
uint16_t version;
uint16_t length;
uint16_t checksum;
uint16_t unused;
};
#define FLT_REG_FW 0x01
#define FLT_REG_BOOT_CODE 0x07
#define FLT_REG_VPD_0 0x14
@@ -1683,12 +1676,20 @@ struct qla_flt_header {
#define FLT_REG_PEP_SEC_28XX 0xF1
struct qla_flt_region {
uint16_t code;
__le16 code;
uint8_t attribute;
uint8_t reserved;
uint32_t size;
uint32_t start;
uint32_t end;
__le32 size;
__le32 start;
__le32 end;
};
struct qla_flt_header {
__le16 version;
__le16 length;
__le16 checksum;
__le16 unused;
struct qla_flt_region region[0];
};
#define FLT_REGION_SIZE 16
+6 -6
View File
@@ -2416,12 +2416,12 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
* swab32 of the "data" field in the beginning of qla2x00_status_entry()
* would make guard field appear at offset 2
*/
a_guard = le16_to_cpu(*(uint16_t *)(ap + 2));
a_app_tag = le16_to_cpu(*(uint16_t *)(ap + 0));
a_ref_tag = le32_to_cpu(*(uint32_t *)(ap + 4));
e_guard = le16_to_cpu(*(uint16_t *)(ep + 2));
e_app_tag = le16_to_cpu(*(uint16_t *)(ep + 0));
e_ref_tag = le32_to_cpu(*(uint32_t *)(ep + 4));
a_guard = get_unaligned_le16(ap + 2);
a_app_tag = get_unaligned_le16(ap + 0);
a_ref_tag = get_unaligned_le32(ap + 4);
e_guard = get_unaligned_le16(ep + 2);
e_app_tag = get_unaligned_le16(ep + 0);
e_ref_tag = get_unaligned_le32(ep + 4);
ql_dbg(ql_dbg_io, vha, 0x3023,
"iocb(s) %p Returned STATUS.\n", sts24);
+4 -2
View File
@@ -787,7 +787,8 @@ qlafx00_iospace_config(struct qla_hw_data *ha)
goto iospace_error_exit;
}
ha->cregbase = ioremap(pci_resource_start(ha->pdev, 0), BAR0_LEN_FX00);
ha->cregbase =
ioremap(pci_resource_start(ha->pdev, 0), BAR0_LEN_FX00);
if (!ha->cregbase) {
ql_log_pci(ql_log_fatal, ha->pdev, 0x0128,
"cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
@@ -807,7 +808,8 @@ qlafx00_iospace_config(struct qla_hw_data *ha)
goto iospace_error_exit;
}
ha->iobase = ioremap(pci_resource_start(ha->pdev, 2), BAR2_LEN_FX00);
ha->iobase =
ioremap(pci_resource_start(ha->pdev, 2), BAR2_LEN_FX00);
if (!ha->iobase) {
ql_log_pci(ql_log_fatal, ha->pdev, 0x012b,
"cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
+6 -7
View File
@@ -1612,8 +1612,7 @@ qla82xx_get_bootld_offset(struct qla_hw_data *ha)
return (u8 *)&ha->hablob->fw->data[offset];
}
static __le32
qla82xx_get_fw_size(struct qla_hw_data *ha)
static u32 qla82xx_get_fw_size(struct qla_hw_data *ha)
{
struct qla82xx_uri_data_desc *uri_desc = NULL;
@@ -1624,7 +1623,7 @@ qla82xx_get_fw_size(struct qla_hw_data *ha)
return le32_to_cpu(uri_desc->size);
}
return cpu_to_le32(*(u32 *)&ha->hablob->fw->data[FW_SIZE_OFFSET]);
return get_unaligned_le32(&ha->hablob->fw->data[FW_SIZE_OFFSET]);
}
static u8 *
@@ -1816,7 +1815,7 @@ qla82xx_fw_load_from_blob(struct qla_hw_data *ha)
}
flashaddr = FLASH_ADDR_START;
size = (__force u32)qla82xx_get_fw_size(ha) / 8;
size = qla82xx_get_fw_size(ha) / 8;
ptr64 = (u64 *)qla82xx_get_fw_offs(ha);
for (i = 0; i < size; i++) {
@@ -1883,7 +1882,7 @@ qla82xx_set_product_offset(struct qla_hw_data *ha)
static int
qla82xx_validate_firmware_blob(scsi_qla_host_t *vha, uint8_t fw_type)
{
__le32 val;
uint32_t val;
uint32_t min_size;
struct qla_hw_data *ha = vha->hw;
const struct firmware *fw = ha->hablob->fw;
@@ -1896,8 +1895,8 @@ qla82xx_validate_firmware_blob(scsi_qla_host_t *vha, uint8_t fw_type)
min_size = QLA82XX_URI_FW_MIN_SIZE;
} else {
val = cpu_to_le32(*(u32 *)&fw->data[QLA82XX_FW_MAGIC_OFFSET]);
if ((__force u32)val != QLA82XX_BDINFO_MAGIC)
val = get_unaligned_le32(&fw->data[QLA82XX_FW_MAGIC_OFFSET]);
if (val != QLA82XX_BDINFO_MAGIC)
return -EINVAL;
min_size = QLA82XX_FW_MIN_SIZE;
+58 -3
View File
@@ -922,7 +922,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
goto qc24_fail_command;
}
if (atomic_read(&fcport->state) != FCS_ONLINE) {
if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) {
if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
ql_dbg(ql_dbg_io, vha, 0x3005,
@@ -1004,7 +1004,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,
goto qc24_fail_command;
}
if (atomic_read(&fcport->state) != FCS_ONLINE) {
if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) {
if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
ql_dbg(ql_dbg_io, vha, 0x3077,
@@ -6776,7 +6776,7 @@ qla2x00_do_dpc(void *data)
ha = (struct qla_hw_data *)data;
base_vha = pci_get_drvdata(ha->pdev);
set_user_nice(current, -20);
set_user_nice(current, MIN_NICE);
set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
@@ -7960,15 +7960,70 @@ qla2x00_module_init(void)
BUILD_BUG_ON(sizeof(struct cmd_type_7_fx00) != 64);
BUILD_BUG_ON(sizeof(struct cmd_type_crc_2) != 64);
BUILD_BUG_ON(sizeof(struct ct_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct ct_fdmi1_hba_attributes) != 2344);
BUILD_BUG_ON(sizeof(struct ct_fdmi2_hba_attributes) != 4424);
BUILD_BUG_ON(sizeof(struct ct_fdmi2_port_attributes) != 4164);
BUILD_BUG_ON(sizeof(struct ct_fdmi_hba_attr) != 260);
BUILD_BUG_ON(sizeof(struct ct_fdmi_port_attr) != 260);
BUILD_BUG_ON(sizeof(struct ct_rsp_hdr) != 16);
BUILD_BUG_ON(sizeof(struct ctio_crc2_to_fw) != 64);
BUILD_BUG_ON(sizeof(struct device_reg_24xx) != 256);
BUILD_BUG_ON(sizeof(struct device_reg_25xxmq) != 24);
BUILD_BUG_ON(sizeof(struct device_reg_2xxx) != 256);
BUILD_BUG_ON(sizeof(struct device_reg_82xx) != 1288);
BUILD_BUG_ON(sizeof(struct device_reg_fx00) != 216);
BUILD_BUG_ON(sizeof(struct els_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct els_sts_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct fxdisc_entry_fx00) != 64);
BUILD_BUG_ON(sizeof(struct imm_ntfy_from_isp) != 64);
BUILD_BUG_ON(sizeof(struct init_cb_24xx) != 128);
BUILD_BUG_ON(sizeof(struct init_cb_81xx) != 128);
BUILD_BUG_ON(sizeof(struct logio_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct mbx_entry) != 64);
BUILD_BUG_ON(sizeof(struct mid_init_cb_24xx) != 5252);
BUILD_BUG_ON(sizeof(struct mrk_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct nvram_24xx) != 512);
BUILD_BUG_ON(sizeof(struct nvram_81xx) != 512);
BUILD_BUG_ON(sizeof(struct pt_ls4_request) != 64);
BUILD_BUG_ON(sizeof(struct pt_ls4_rx_unsol) != 64);
BUILD_BUG_ON(sizeof(struct purex_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct qla2100_fw_dump) != 123634);
BUILD_BUG_ON(sizeof(struct qla2300_fw_dump) != 136100);
BUILD_BUG_ON(sizeof(struct qla24xx_fw_dump) != 37976);
BUILD_BUG_ON(sizeof(struct qla25xx_fw_dump) != 39228);
BUILD_BUG_ON(sizeof(struct qla2xxx_fce_chain) != 52);
BUILD_BUG_ON(sizeof(struct qla2xxx_fw_dump) != 136172);
BUILD_BUG_ON(sizeof(struct qla2xxx_mq_chain) != 524);
BUILD_BUG_ON(sizeof(struct qla2xxx_mqueue_chain) != 8);
BUILD_BUG_ON(sizeof(struct qla2xxx_mqueue_header) != 12);
BUILD_BUG_ON(sizeof(struct qla2xxx_offld_chain) != 24);
BUILD_BUG_ON(sizeof(struct qla81xx_fw_dump) != 39420);
BUILD_BUG_ON(sizeof(struct qla82xx_uri_data_desc) != 28);
BUILD_BUG_ON(sizeof(struct qla82xx_uri_table_desc) != 32);
BUILD_BUG_ON(sizeof(struct qla83xx_fw_dump) != 51196);
BUILD_BUG_ON(sizeof(struct qla_fcp_prio_cfg) != FCP_PRIO_CFG_SIZE);
BUILD_BUG_ON(sizeof(struct qla_fdt_layout) != 128);
BUILD_BUG_ON(sizeof(struct qla_flt_header) != 8);
BUILD_BUG_ON(sizeof(struct qla_flt_region) != 16);
BUILD_BUG_ON(sizeof(struct qla_npiv_entry) != 24);
BUILD_BUG_ON(sizeof(struct qla_npiv_header) != 16);
BUILD_BUG_ON(sizeof(struct rdp_rsp_payload) != 336);
BUILD_BUG_ON(sizeof(struct sns_cmd_pkt) != 2064);
BUILD_BUG_ON(sizeof(struct sts_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct tsk_mgmt_entry) != 64);
BUILD_BUG_ON(sizeof(struct tsk_mgmt_entry_fx00) != 64);
BUILD_BUG_ON(sizeof(struct verify_chip_entry_84xx) != 64);
BUILD_BUG_ON(sizeof(struct verify_chip_rsp_84xx) != 52);
BUILD_BUG_ON(sizeof(struct vf_evfp_entry_24xx) != 56);
BUILD_BUG_ON(sizeof(struct vp_config_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct vp_ctrl_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(struct vp_rpt_id_entry_24xx) != 64);
BUILD_BUG_ON(sizeof(sts21_entry_t) != 64);
BUILD_BUG_ON(sizeof(sts22_entry_t) != 64);
BUILD_BUG_ON(sizeof(sts_cont_entry_t) != 64);
BUILD_BUG_ON(sizeof(sts_entry_t) != 64);
BUILD_BUG_ON(sizeof(sw_info_t) != 32);
BUILD_BUG_ON(sizeof(target_id_t) != 2);
/* Allocate cache for SRBs. */
srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
+6 -8
View File
@@ -670,9 +670,10 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
struct qla_hw_data *ha = vha->hw;
uint32_t def = IS_QLA81XX(ha) ? 2 : IS_QLA25XX(ha) ? 1 : 0;
struct qla_flt_header *flt = (void *)ha->flt;
struct qla_flt_region *region = (void *)&flt[1];
uint16_t *wptr, cnt, chksum;
struct qla_flt_header *flt = ha->flt;
struct qla_flt_region *region = &flt->region[0];
__le16 *wptr;
uint16_t cnt, chksum;
uint32_t start;
/* Assign FCP prio region since older adapters may not have FLT, or
@@ -2653,18 +2654,15 @@ qla28xx_get_flash_region(struct scsi_qla_host *vha, uint32_t start,
struct qla_flt_region *region)
{
struct qla_hw_data *ha = vha->hw;
struct qla_flt_header *flt;
struct qla_flt_region *flt_reg;
struct qla_flt_header *flt = ha->flt;
struct qla_flt_region *flt_reg = &flt->region[0];
uint16_t cnt;
int rval = QLA_FUNCTION_FAILED;
if (!ha->flt)
return QLA_FUNCTION_FAILED;
flt = (struct qla_flt_header *)ha->flt;
flt_reg = (struct qla_flt_region *)&flt[1];
cnt = le16_to_cpu(flt->length) / sizeof(struct qla_flt_region);
for (; cnt; cnt--, flt_reg++) {
if (le32_to_cpu(flt_reg->start) == start) {
memcpy((uint8_t *)region, flt_reg,
+7 -7
View File
@@ -3501,13 +3501,13 @@ qlt_handle_dif_error(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd,
cmd->trc_flags |= TRC_DIF_ERR;
cmd->a_guard = be16_to_cpu(*(uint16_t *)(ap + 0));
cmd->a_app_tag = be16_to_cpu(*(uint16_t *)(ap + 2));
cmd->a_ref_tag = be32_to_cpu(*(uint32_t *)(ap + 4));
cmd->a_guard = get_unaligned_be16(ap + 0);
cmd->a_app_tag = get_unaligned_be16(ap + 2);
cmd->a_ref_tag = get_unaligned_be32(ap + 4);
cmd->e_guard = be16_to_cpu(*(uint16_t *)(ep + 0));
cmd->e_app_tag = be16_to_cpu(*(uint16_t *)(ep + 2));
cmd->e_ref_tag = be32_to_cpu(*(uint32_t *)(ep + 4));
cmd->e_guard = get_unaligned_be16(ep + 0);
cmd->e_app_tag = get_unaligned_be16(ep + 2);
cmd->e_ref_tag = get_unaligned_be32(ep + 4);
ql_dbg(ql_dbg_tgt_dif, vha, 0xf075,
"%s: aborted %d state %d\n", __func__, cmd->aborted, cmd->state);
@@ -4165,7 +4165,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd)
spin_lock_init(&cmd->cmd_lock);
cdb = &atio->u.isp24.fcp_cmnd.cdb[0];
se_cmd_tag(&cmd->se_cmd) = atio->u.isp24.exchange_addr;
se_cmd_tag(&cmd->se_cmd) = le32_to_cpu(atio->u.isp24.exchange_addr);
if (atio->u.isp24.fcp_cmnd.rddata &&
atio->u.isp24.fcp_cmnd.wrdata) {
+1 -2
View File
@@ -406,8 +406,7 @@ static inline int get_datalen_for_atio(struct atio_from_isp *atio)
{
int len = atio->u.isp24.fcp_cmnd.add_cdb_len;
return (be32_to_cpu(get_unaligned((uint32_t *)
&atio->u.isp24.fcp_cmnd.add_cdb[len * 4])));
return get_unaligned_be32(&atio->u.isp24.fcp_cmnd.add_cdb[len * 4]);
}
#define CTIO_TYPE7 0x12 /* Continue target I/O entry (for 24xx) */