| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2004 - 2010 Vladislav Bolkhovitin <vst@vlnb.net> |
|---|
| 3 | 4 | * Copyright (C) 2004 - 2005 Leonid Stoljar |
|---|
| .. | .. |
|---|
| 9 | 10 | * Copyright (C) 2010-2011 Nicholas A. Bellinger <nab@kernel.org> |
|---|
| 10 | 11 | * |
|---|
| 11 | 12 | * Additional file for the target driver support. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or |
|---|
| 14 | | - * modify it under the terms of the GNU General Public License |
|---|
| 15 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 16 | | - * of the License, or (at your option) any later version. |
|---|
| 17 | | - * |
|---|
| 18 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 19 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 20 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 21 | | - * GNU General Public License for more details. |
|---|
| 22 | 13 | */ |
|---|
| 23 | 14 | /* |
|---|
| 24 | 15 | * This is the global def file that is useful for including from the |
|---|
| .. | .. |
|---|
| 29 | 20 | #define __QLA_TARGET_H |
|---|
| 30 | 21 | |
|---|
| 31 | 22 | #include "qla_def.h" |
|---|
| 23 | +#include "qla_dsd.h" |
|---|
| 32 | 24 | |
|---|
| 33 | 25 | /* |
|---|
| 34 | 26 | * Must be changed on any change in any initiator visible interfaces or |
|---|
| .. | .. |
|---|
| 142 | 134 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 143 | 135 | union { |
|---|
| 144 | 136 | struct { |
|---|
| 145 | | - uint32_t sys_define_2; /* System defined. */ |
|---|
| 137 | + __le32 sys_define_2; /* System defined. */ |
|---|
| 146 | 138 | target_id_t target; |
|---|
| 147 | 139 | uint8_t target_id; |
|---|
| 148 | 140 | uint8_t reserved_1; |
|---|
| 149 | | - uint16_t flags; |
|---|
| 150 | | - uint16_t resp_code; |
|---|
| 151 | | - uint16_t status; |
|---|
| 152 | | - uint16_t task_flags; |
|---|
| 153 | | - uint16_t seq_id; |
|---|
| 154 | | - uint16_t srr_rx_id; |
|---|
| 155 | | - uint32_t srr_rel_offs; |
|---|
| 156 | | - uint16_t srr_ui; |
|---|
| 157 | | - uint16_t srr_flags; |
|---|
| 158 | | - uint16_t srr_reject_code; |
|---|
| 141 | + __le16 flags; |
|---|
| 142 | + __le16 resp_code; |
|---|
| 143 | + __le16 status; |
|---|
| 144 | + __le16 task_flags; |
|---|
| 145 | + __le16 seq_id; |
|---|
| 146 | + __le16 srr_rx_id; |
|---|
| 147 | + __le32 srr_rel_offs; |
|---|
| 148 | + __le16 srr_ui; |
|---|
| 149 | + __le16 srr_flags; |
|---|
| 150 | + __le16 srr_reject_code; |
|---|
| 159 | 151 | uint8_t srr_reject_vendor_uniq; |
|---|
| 160 | 152 | uint8_t srr_reject_code_expl; |
|---|
| 161 | 153 | uint8_t reserved_2[24]; |
|---|
| 162 | 154 | } isp2x; |
|---|
| 163 | 155 | struct { |
|---|
| 164 | 156 | uint32_t handle; |
|---|
| 165 | | - uint16_t nport_handle; |
|---|
| 157 | + __le16 nport_handle; |
|---|
| 166 | 158 | uint16_t reserved_1; |
|---|
| 167 | | - uint16_t flags; |
|---|
| 168 | | - uint16_t srr_rx_id; |
|---|
| 169 | | - uint16_t status; |
|---|
| 159 | + __le16 flags; |
|---|
| 160 | + __le16 srr_rx_id; |
|---|
| 161 | + __le16 status; |
|---|
| 170 | 162 | uint8_t status_subcode; |
|---|
| 171 | 163 | uint8_t fw_handle; |
|---|
| 172 | | - uint32_t exchange_address; |
|---|
| 173 | | - uint32_t srr_rel_offs; |
|---|
| 174 | | - uint16_t srr_ui; |
|---|
| 175 | | - uint16_t srr_flags; |
|---|
| 164 | + __le32 exchange_address; |
|---|
| 165 | + __le32 srr_rel_offs; |
|---|
| 166 | + __le16 srr_ui; |
|---|
| 167 | + __le16 srr_flags; |
|---|
| 176 | 168 | uint8_t reserved_4[19]; |
|---|
| 177 | 169 | uint8_t vp_index; |
|---|
| 178 | 170 | uint8_t srr_reject_vendor_uniq; |
|---|
| .. | .. |
|---|
| 182 | 174 | } isp24; |
|---|
| 183 | 175 | } u; |
|---|
| 184 | 176 | uint8_t reserved[2]; |
|---|
| 185 | | - uint16_t ox_id; |
|---|
| 177 | + __le16 ox_id; |
|---|
| 186 | 178 | } __packed; |
|---|
| 187 | 179 | #define NOTIFY_ACK_FLAGS_TERMINATE BIT_3 |
|---|
| 188 | 180 | #define NOTIFY_ACK_SRR_FLAGS_ACCEPT 0 |
|---|
| .. | .. |
|---|
| 213 | 205 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 214 | 206 | uint32_t handle; /* System defined handle */ |
|---|
| 215 | 207 | target_id_t target; |
|---|
| 216 | | - uint16_t rx_id; |
|---|
| 217 | | - uint16_t flags; |
|---|
| 218 | | - uint16_t status; |
|---|
| 219 | | - uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */ |
|---|
| 220 | | - uint16_t dseg_count; /* Data segment count. */ |
|---|
| 221 | | - uint32_t relative_offset; |
|---|
| 222 | | - uint32_t residual; |
|---|
| 223 | | - uint16_t reserved_1[3]; |
|---|
| 224 | | - uint16_t scsi_status; |
|---|
| 225 | | - uint32_t transfer_length; |
|---|
| 226 | | - uint32_t dseg_0_address; /* Data segment 0 address. */ |
|---|
| 227 | | - uint32_t dseg_0_length; /* Data segment 0 length. */ |
|---|
| 228 | | - uint32_t dseg_1_address; /* Data segment 1 address. */ |
|---|
| 229 | | - uint32_t dseg_1_length; /* Data segment 1 length. */ |
|---|
| 230 | | - uint32_t dseg_2_address; /* Data segment 2 address. */ |
|---|
| 231 | | - uint32_t dseg_2_length; /* Data segment 2 length. */ |
|---|
| 208 | + __le16 rx_id; |
|---|
| 209 | + __le16 flags; |
|---|
| 210 | + __le16 status; |
|---|
| 211 | + __le16 timeout; /* 0 = 30 seconds, 0xFFFF = disable */ |
|---|
| 212 | + __le16 dseg_count; /* Data segment count. */ |
|---|
| 213 | + __le32 relative_offset; |
|---|
| 214 | + __le32 residual; |
|---|
| 215 | + __le16 reserved_1[3]; |
|---|
| 216 | + __le16 scsi_status; |
|---|
| 217 | + __le32 transfer_length; |
|---|
| 218 | + struct dsd32 dsd[3]; |
|---|
| 232 | 219 | } __packed; |
|---|
| 233 | 220 | #define ATIO_PATH_INVALID 0x07 |
|---|
| 234 | 221 | #define ATIO_CANT_PROV_CAP 0x16 |
|---|
| .. | .. |
|---|
| 260 | 247 | |
|---|
| 261 | 248 | struct fcp_hdr { |
|---|
| 262 | 249 | uint8_t r_ctl; |
|---|
| 263 | | - uint8_t d_id[3]; |
|---|
| 250 | + be_id_t d_id; |
|---|
| 264 | 251 | uint8_t cs_ctl; |
|---|
| 265 | | - uint8_t s_id[3]; |
|---|
| 252 | + be_id_t s_id; |
|---|
| 266 | 253 | uint8_t type; |
|---|
| 267 | 254 | uint8_t f_ctl[3]; |
|---|
| 268 | 255 | uint8_t seq_id; |
|---|
| .. | .. |
|---|
| 270 | 257 | uint16_t seq_cnt; |
|---|
| 271 | 258 | __be16 ox_id; |
|---|
| 272 | 259 | uint16_t rx_id; |
|---|
| 273 | | - uint32_t parameter; |
|---|
| 274 | | -} __packed; |
|---|
| 260 | + __le32 parameter; |
|---|
| 261 | +}; |
|---|
| 275 | 262 | |
|---|
| 276 | 263 | struct fcp_hdr_le { |
|---|
| 277 | | - uint8_t d_id[3]; |
|---|
| 264 | + le_id_t d_id; |
|---|
| 278 | 265 | uint8_t r_ctl; |
|---|
| 279 | | - uint8_t s_id[3]; |
|---|
| 266 | + le_id_t s_id; |
|---|
| 280 | 267 | uint8_t cs_ctl; |
|---|
| 281 | 268 | uint8_t f_ctl[3]; |
|---|
| 282 | 269 | uint8_t type; |
|---|
| 283 | | - uint16_t seq_cnt; |
|---|
| 270 | + __le16 seq_cnt; |
|---|
| 284 | 271 | uint8_t df_ctl; |
|---|
| 285 | 272 | uint8_t seq_id; |
|---|
| 286 | | - uint16_t rx_id; |
|---|
| 287 | | - uint16_t ox_id; |
|---|
| 288 | | - uint32_t parameter; |
|---|
| 289 | | -} __packed; |
|---|
| 273 | + __le16 rx_id; |
|---|
| 274 | + __le16 ox_id; |
|---|
| 275 | + __le32 parameter; |
|---|
| 276 | +}; |
|---|
| 290 | 277 | |
|---|
| 291 | 278 | #define F_CTL_EXCH_CONTEXT_RESP BIT_23 |
|---|
| 292 | 279 | #define F_CTL_SEQ_CONTEXT_RESIP BIT_22 |
|---|
| .. | .. |
|---|
| 319 | 306 | * BUILD_BUG_ON in qlt_init(). |
|---|
| 320 | 307 | */ |
|---|
| 321 | 308 | uint8_t add_cdb[4]; |
|---|
| 322 | | - /* uint32_t data_length; */ |
|---|
| 309 | + /* __le32 data_length; */ |
|---|
| 323 | 310 | } __packed; |
|---|
| 324 | 311 | |
|---|
| 325 | 312 | /* |
|---|
| .. | .. |
|---|
| 329 | 316 | struct atio_from_isp { |
|---|
| 330 | 317 | union { |
|---|
| 331 | 318 | struct { |
|---|
| 332 | | - uint16_t entry_hdr; |
|---|
| 319 | + __le16 entry_hdr; |
|---|
| 333 | 320 | uint8_t sys_define; /* System defined. */ |
|---|
| 334 | 321 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 335 | | - uint32_t sys_define_2; /* System defined. */ |
|---|
| 322 | + __le32 sys_define_2; /* System defined. */ |
|---|
| 336 | 323 | target_id_t target; |
|---|
| 337 | | - uint16_t rx_id; |
|---|
| 338 | | - uint16_t flags; |
|---|
| 339 | | - uint16_t status; |
|---|
| 324 | + __le16 rx_id; |
|---|
| 325 | + __le16 flags; |
|---|
| 326 | + __le16 status; |
|---|
| 340 | 327 | uint8_t command_ref; |
|---|
| 341 | 328 | uint8_t task_codes; |
|---|
| 342 | 329 | uint8_t task_flags; |
|---|
| 343 | 330 | uint8_t execution_codes; |
|---|
| 344 | 331 | uint8_t cdb[MAX_CMDSZ]; |
|---|
| 345 | | - uint32_t data_length; |
|---|
| 346 | | - uint16_t lun; |
|---|
| 332 | + __le32 data_length; |
|---|
| 333 | + __le16 lun; |
|---|
| 347 | 334 | uint8_t initiator_port_name[WWN_SIZE]; /* on qla23xx */ |
|---|
| 348 | | - uint16_t reserved_32[6]; |
|---|
| 349 | | - uint16_t ox_id; |
|---|
| 335 | + __le16 reserved_32[6]; |
|---|
| 336 | + __le16 ox_id; |
|---|
| 350 | 337 | } isp2x; |
|---|
| 351 | 338 | struct { |
|---|
| 352 | | - uint16_t entry_hdr; |
|---|
| 339 | + __le16 entry_hdr; |
|---|
| 353 | 340 | uint8_t fcp_cmnd_len_low; |
|---|
| 354 | 341 | uint8_t fcp_cmnd_len_high:4; |
|---|
| 355 | 342 | uint8_t attr:4; |
|---|
| 356 | | - uint32_t exchange_addr; |
|---|
| 343 | + __le32 exchange_addr; |
|---|
| 357 | 344 | #define ATIO_EXCHANGE_ADDRESS_UNKNOWN 0xFFFFFFFF |
|---|
| 358 | 345 | struct fcp_hdr fcp_hdr; |
|---|
| 359 | 346 | struct atio7_fcp_cmnd fcp_cmnd; |
|---|
| .. | .. |
|---|
| 365 | 352 | #define FCP_CMD_LENGTH_MASK 0x0fff |
|---|
| 366 | 353 | #define FCP_CMD_LENGTH_MIN 0x38 |
|---|
| 367 | 354 | uint8_t data[56]; |
|---|
| 368 | | - uint32_t signature; |
|---|
| 355 | + __le32 signature; |
|---|
| 369 | 356 | #define ATIO_PROCESSED 0xDEADDEAD /* Signature */ |
|---|
| 370 | 357 | } raw; |
|---|
| 371 | 358 | } u; |
|---|
| .. | .. |
|---|
| 392 | 379 | { |
|---|
| 393 | 380 | int len = atio->u.isp24.fcp_cmnd.add_cdb_len; |
|---|
| 394 | 381 | |
|---|
| 395 | | - return (be32_to_cpu(get_unaligned((uint32_t *) |
|---|
| 396 | | - &atio->u.isp24.fcp_cmnd.add_cdb[len * 4]))); |
|---|
| 382 | + return get_unaligned_be32(&atio->u.isp24.fcp_cmnd.add_cdb[len * 4]); |
|---|
| 397 | 383 | } |
|---|
| 398 | 384 | |
|---|
| 399 | 385 | #define CTIO_TYPE7 0x12 /* Continue target I/O entry (for 24xx) */ |
|---|
| .. | .. |
|---|
| 409 | 395 | uint8_t sys_define; /* System defined. */ |
|---|
| 410 | 396 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 411 | 397 | uint32_t handle; /* System defined handle */ |
|---|
| 412 | | - uint16_t nport_handle; |
|---|
| 398 | + __le16 nport_handle; |
|---|
| 413 | 399 | #define CTIO7_NHANDLE_UNRECOGNIZED 0xFFFF |
|---|
| 414 | | - uint16_t timeout; |
|---|
| 415 | | - uint16_t dseg_count; /* Data segment count. */ |
|---|
| 400 | + __le16 timeout; |
|---|
| 401 | + __le16 dseg_count; /* Data segment count. */ |
|---|
| 416 | 402 | uint8_t vp_index; |
|---|
| 417 | 403 | uint8_t add_flags; |
|---|
| 418 | | - uint8_t initiator_id[3]; |
|---|
| 404 | + le_id_t initiator_id; |
|---|
| 419 | 405 | uint8_t reserved; |
|---|
| 420 | | - uint32_t exchange_addr; |
|---|
| 406 | + __le32 exchange_addr; |
|---|
| 421 | 407 | union { |
|---|
| 422 | 408 | struct { |
|---|
| 423 | | - uint16_t reserved1; |
|---|
| 409 | + __le16 reserved1; |
|---|
| 424 | 410 | __le16 flags; |
|---|
| 425 | | - uint32_t residual; |
|---|
| 411 | + __le32 residual; |
|---|
| 426 | 412 | __le16 ox_id; |
|---|
| 427 | | - uint16_t scsi_status; |
|---|
| 428 | | - uint32_t relative_offset; |
|---|
| 429 | | - uint32_t reserved2; |
|---|
| 430 | | - uint32_t transfer_length; |
|---|
| 431 | | - uint32_t reserved3; |
|---|
| 432 | | - /* Data segment 0 address. */ |
|---|
| 433 | | - uint32_t dseg_0_address[2]; |
|---|
| 434 | | - /* Data segment 0 length. */ |
|---|
| 435 | | - uint32_t dseg_0_length; |
|---|
| 413 | + __le16 scsi_status; |
|---|
| 414 | + __le32 relative_offset; |
|---|
| 415 | + __le32 reserved2; |
|---|
| 416 | + __le32 transfer_length; |
|---|
| 417 | + __le32 reserved3; |
|---|
| 418 | + struct dsd64 dsd; |
|---|
| 436 | 419 | } status0; |
|---|
| 437 | 420 | struct { |
|---|
| 438 | | - uint16_t sense_length; |
|---|
| 421 | + __le16 sense_length; |
|---|
| 439 | 422 | __le16 flags; |
|---|
| 440 | | - uint32_t residual; |
|---|
| 423 | + __le32 residual; |
|---|
| 441 | 424 | __le16 ox_id; |
|---|
| 442 | | - uint16_t scsi_status; |
|---|
| 443 | | - uint16_t response_len; |
|---|
| 444 | | - uint16_t reserved; |
|---|
| 425 | + __le16 scsi_status; |
|---|
| 426 | + __le16 response_len; |
|---|
| 427 | + __le16 reserved; |
|---|
| 445 | 428 | uint8_t sense_data[24]; |
|---|
| 446 | 429 | } status1; |
|---|
| 447 | 430 | } u; |
|---|
| .. | .. |
|---|
| 457 | 440 | uint8_t sys_define; /* System defined. */ |
|---|
| 458 | 441 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 459 | 442 | uint32_t handle; /* System defined handle */ |
|---|
| 460 | | - uint16_t status; |
|---|
| 461 | | - uint16_t timeout; |
|---|
| 462 | | - uint16_t dseg_count; /* Data segment count. */ |
|---|
| 443 | + __le16 status; |
|---|
| 444 | + __le16 timeout; |
|---|
| 445 | + __le16 dseg_count; /* Data segment count. */ |
|---|
| 463 | 446 | uint8_t vp_index; |
|---|
| 464 | 447 | uint8_t reserved1[5]; |
|---|
| 465 | | - uint32_t exchange_address; |
|---|
| 466 | | - uint16_t reserved2; |
|---|
| 467 | | - uint16_t flags; |
|---|
| 468 | | - uint32_t residual; |
|---|
| 469 | | - uint16_t ox_id; |
|---|
| 470 | | - uint16_t reserved3; |
|---|
| 471 | | - uint32_t relative_offset; |
|---|
| 448 | + __le32 exchange_address; |
|---|
| 449 | + __le16 reserved2; |
|---|
| 450 | + __le16 flags; |
|---|
| 451 | + __le32 residual; |
|---|
| 452 | + __le16 ox_id; |
|---|
| 453 | + __le16 reserved3; |
|---|
| 454 | + __le32 relative_offset; |
|---|
| 472 | 455 | uint8_t reserved4[24]; |
|---|
| 473 | 456 | } __packed; |
|---|
| 474 | 457 | |
|---|
| .. | .. |
|---|
| 506 | 489 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 507 | 490 | |
|---|
| 508 | 491 | uint32_t handle; /* System handle. */ |
|---|
| 509 | | - uint16_t nport_handle; /* N_PORT handle. */ |
|---|
| 492 | + __le16 nport_handle; /* N_PORT handle. */ |
|---|
| 510 | 493 | __le16 timeout; /* Command timeout. */ |
|---|
| 511 | 494 | |
|---|
| 512 | | - uint16_t dseg_count; /* Data segment count. */ |
|---|
| 495 | + __le16 dseg_count; /* Data segment count. */ |
|---|
| 513 | 496 | uint8_t vp_index; |
|---|
| 514 | 497 | uint8_t add_flags; /* additional flags */ |
|---|
| 515 | 498 | #define CTIO_CRC2_AF_DIF_DSD_ENA BIT_3 |
|---|
| 516 | 499 | |
|---|
| 517 | | - uint8_t initiator_id[3]; /* initiator ID */ |
|---|
| 500 | + le_id_t initiator_id; /* initiator ID */ |
|---|
| 518 | 501 | uint8_t reserved1; |
|---|
| 519 | | - uint32_t exchange_addr; /* rcv exchange address */ |
|---|
| 520 | | - uint16_t reserved2; |
|---|
| 502 | + __le32 exchange_addr; /* rcv exchange address */ |
|---|
| 503 | + __le16 reserved2; |
|---|
| 521 | 504 | __le16 flags; /* refer to CTIO7 flags values */ |
|---|
| 522 | | - uint32_t residual; |
|---|
| 505 | + __le32 residual; |
|---|
| 523 | 506 | __le16 ox_id; |
|---|
| 524 | | - uint16_t scsi_status; |
|---|
| 507 | + __le16 scsi_status; |
|---|
| 525 | 508 | __le32 relative_offset; |
|---|
| 526 | | - uint32_t reserved5; |
|---|
| 509 | + __le32 reserved5; |
|---|
| 527 | 510 | __le32 transfer_length; /* total fc transfer length */ |
|---|
| 528 | | - uint32_t reserved6; |
|---|
| 529 | | - __le32 crc_context_address[2];/* Data segment address. */ |
|---|
| 530 | | - uint16_t crc_context_len; /* Data segment length. */ |
|---|
| 531 | | - uint16_t reserved_1; /* MUST be set to 0. */ |
|---|
| 532 | | -} __packed; |
|---|
| 511 | + __le32 reserved6; |
|---|
| 512 | + __le64 crc_context_address __packed; /* Data segment address. */ |
|---|
| 513 | + __le16 crc_context_len; /* Data segment length. */ |
|---|
| 514 | + __le16 reserved_1; /* MUST be set to 0. */ |
|---|
| 515 | +}; |
|---|
| 533 | 516 | |
|---|
| 534 | 517 | /* CTIO Type CRC_x Status IOCB */ |
|---|
| 535 | 518 | struct ctio_crc_from_fw { |
|---|
| .. | .. |
|---|
| 539 | 522 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 540 | 523 | |
|---|
| 541 | 524 | uint32_t handle; /* System handle. */ |
|---|
| 542 | | - uint16_t status; |
|---|
| 543 | | - uint16_t timeout; /* Command timeout. */ |
|---|
| 544 | | - uint16_t dseg_count; /* Data segment count. */ |
|---|
| 545 | | - uint32_t reserved1; |
|---|
| 546 | | - uint16_t state_flags; |
|---|
| 525 | + __le16 status; |
|---|
| 526 | + __le16 timeout; /* Command timeout. */ |
|---|
| 527 | + __le16 dseg_count; /* Data segment count. */ |
|---|
| 528 | + __le32 reserved1; |
|---|
| 529 | + __le16 state_flags; |
|---|
| 547 | 530 | #define CTIO_CRC_SF_DIF_CHOPPED BIT_4 |
|---|
| 548 | 531 | |
|---|
| 549 | | - uint32_t exchange_address; /* rcv exchange address */ |
|---|
| 550 | | - uint16_t reserved2; |
|---|
| 551 | | - uint16_t flags; |
|---|
| 552 | | - uint32_t resid_xfer_length; |
|---|
| 553 | | - uint16_t ox_id; |
|---|
| 532 | + __le32 exchange_address; /* rcv exchange address */ |
|---|
| 533 | + __le16 reserved2; |
|---|
| 534 | + __le16 flags; |
|---|
| 535 | + __le32 resid_xfer_length; |
|---|
| 536 | + __le16 ox_id; |
|---|
| 554 | 537 | uint8_t reserved3[12]; |
|---|
| 555 | | - uint16_t runt_guard; /* reported runt blk guard */ |
|---|
| 538 | + __le16 runt_guard; /* reported runt blk guard */ |
|---|
| 556 | 539 | uint8_t actual_dif[8]; |
|---|
| 557 | 540 | uint8_t expected_dif[8]; |
|---|
| 558 | 541 | } __packed; |
|---|
| .. | .. |
|---|
| 575 | 558 | uint8_t sys_define; /* System defined. */ |
|---|
| 576 | 559 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 577 | 560 | uint8_t reserved_1[6]; |
|---|
| 578 | | - uint16_t nport_handle; |
|---|
| 561 | + __le16 nport_handle; |
|---|
| 579 | 562 | uint8_t reserved_2[2]; |
|---|
| 580 | 563 | uint8_t vp_index; |
|---|
| 581 | 564 | uint8_t reserved_3:4; |
|---|
| 582 | 565 | uint8_t sof_type:4; |
|---|
| 583 | | - uint32_t exchange_address; |
|---|
| 566 | + __le32 exchange_address; |
|---|
| 584 | 567 | struct fcp_hdr_le fcp_hdr_le; |
|---|
| 585 | 568 | uint8_t reserved_4[16]; |
|---|
| 586 | | - uint32_t exchange_addr_to_abort; |
|---|
| 569 | + __le32 exchange_addr_to_abort; |
|---|
| 587 | 570 | } __packed; |
|---|
| 588 | 571 | |
|---|
| 589 | 572 | #define ABTS_PARAM_ABORT_SEQ BIT_0 |
|---|
| 590 | 573 | |
|---|
| 591 | 574 | struct ba_acc_le { |
|---|
| 592 | | - uint16_t reserved; |
|---|
| 575 | + __le16 reserved; |
|---|
| 593 | 576 | uint8_t seq_id_last; |
|---|
| 594 | 577 | uint8_t seq_id_valid; |
|---|
| 595 | 578 | #define SEQ_ID_VALID 0x80 |
|---|
| 596 | 579 | #define SEQ_ID_INVALID 0x00 |
|---|
| 597 | | - uint16_t rx_id; |
|---|
| 598 | | - uint16_t ox_id; |
|---|
| 599 | | - uint16_t high_seq_cnt; |
|---|
| 600 | | - uint16_t low_seq_cnt; |
|---|
| 580 | + __le16 rx_id; |
|---|
| 581 | + __le16 ox_id; |
|---|
| 582 | + __le16 high_seq_cnt; |
|---|
| 583 | + __le16 low_seq_cnt; |
|---|
| 601 | 584 | } __packed; |
|---|
| 602 | 585 | |
|---|
| 603 | 586 | struct ba_rjt_le { |
|---|
| .. | .. |
|---|
| 621 | 604 | uint8_t sys_define; /* System defined. */ |
|---|
| 622 | 605 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 623 | 606 | uint32_t handle; |
|---|
| 624 | | - uint16_t reserved_1; |
|---|
| 625 | | - uint16_t nport_handle; |
|---|
| 626 | | - uint16_t control_flags; |
|---|
| 607 | + __le16 reserved_1; |
|---|
| 608 | + __le16 nport_handle; |
|---|
| 609 | + __le16 control_flags; |
|---|
| 627 | 610 | #define ABTS_CONTR_FLG_TERM_EXCHG BIT_0 |
|---|
| 628 | 611 | uint8_t vp_index; |
|---|
| 629 | 612 | uint8_t reserved_3:4; |
|---|
| 630 | 613 | uint8_t sof_type:4; |
|---|
| 631 | | - uint32_t exchange_address; |
|---|
| 614 | + __le32 exchange_address; |
|---|
| 632 | 615 | struct fcp_hdr_le fcp_hdr_le; |
|---|
| 633 | 616 | union { |
|---|
| 634 | 617 | struct ba_acc_le ba_acct; |
|---|
| 635 | 618 | struct ba_rjt_le ba_rjt; |
|---|
| 636 | 619 | } __packed payload; |
|---|
| 637 | | - uint32_t reserved_4; |
|---|
| 638 | | - uint32_t exchange_addr_to_abort; |
|---|
| 620 | + __le32 reserved_4; |
|---|
| 621 | + __le32 exchange_addr_to_abort; |
|---|
| 639 | 622 | } __packed; |
|---|
| 640 | 623 | |
|---|
| 641 | 624 | /* |
|---|
| .. | .. |
|---|
| 651 | 634 | uint8_t sys_define; /* System defined. */ |
|---|
| 652 | 635 | uint8_t entry_status; /* Entry Status. */ |
|---|
| 653 | 636 | uint32_t handle; |
|---|
| 654 | | - uint16_t compl_status; |
|---|
| 637 | + __le16 compl_status; |
|---|
| 655 | 638 | #define ABTS_RESP_COMPL_SUCCESS 0 |
|---|
| 656 | 639 | #define ABTS_RESP_COMPL_SUBCODE_ERROR 0x31 |
|---|
| 657 | | - uint16_t nport_handle; |
|---|
| 658 | | - uint16_t reserved_1; |
|---|
| 640 | + __le16 nport_handle; |
|---|
| 641 | + __le16 reserved_1; |
|---|
| 659 | 642 | uint8_t reserved_2; |
|---|
| 660 | 643 | uint8_t reserved_3:4; |
|---|
| 661 | 644 | uint8_t sof_type:4; |
|---|
| 662 | | - uint32_t exchange_address; |
|---|
| 645 | + __le32 exchange_address; |
|---|
| 663 | 646 | struct fcp_hdr_le fcp_hdr_le; |
|---|
| 664 | 647 | uint8_t reserved_4[8]; |
|---|
| 665 | | - uint32_t error_subcode1; |
|---|
| 648 | + __le32 error_subcode1; |
|---|
| 666 | 649 | #define ABTS_RESP_SUBCODE_ERR_ABORTED_EXCH_NOT_TERM 0x1E |
|---|
| 667 | | - uint32_t error_subcode2; |
|---|
| 668 | | - uint32_t exchange_addr_to_abort; |
|---|
| 650 | + __le32 error_subcode2; |
|---|
| 651 | + __le32 exchange_addr_to_abort; |
|---|
| 669 | 652 | } __packed; |
|---|
| 670 | 653 | |
|---|
| 671 | 654 | /********************************************************************\ |
|---|
| .. | .. |
|---|
| 688 | 671 | void (*handle_data)(struct qla_tgt_cmd *); |
|---|
| 689 | 672 | int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, u64, uint16_t, |
|---|
| 690 | 673 | uint32_t); |
|---|
| 674 | + struct qla_tgt_cmd *(*get_cmd)(struct fc_port *); |
|---|
| 675 | + void (*rel_cmd)(struct qla_tgt_cmd *); |
|---|
| 691 | 676 | void (*free_cmd)(struct qla_tgt_cmd *); |
|---|
| 692 | 677 | void (*free_mcmd)(struct qla_tgt_mgmt_cmd *); |
|---|
| 693 | 678 | void (*free_session)(struct fc_port *); |
|---|
| .. | .. |
|---|
| 698 | 683 | struct fc_port *(*find_sess_by_loop_id)(struct scsi_qla_host *, |
|---|
| 699 | 684 | const uint16_t); |
|---|
| 700 | 685 | struct fc_port *(*find_sess_by_s_id)(struct scsi_qla_host *, |
|---|
| 701 | | - const uint8_t *); |
|---|
| 686 | + const be_id_t); |
|---|
| 702 | 687 | void (*clear_nacl_from_fcport_map)(struct fc_port *); |
|---|
| 703 | 688 | void (*put_sess)(struct fc_port *); |
|---|
| 704 | 689 | void (*shutdown_sess)(struct fc_port *); |
|---|
| .. | .. |
|---|
| 770 | 755 | #define FC_TM_FCP_DATA_MISMATCH 3 |
|---|
| 771 | 756 | #define FC_TM_REJECT 4 |
|---|
| 772 | 757 | #define FC_TM_FAILED 5 |
|---|
| 773 | | - |
|---|
| 774 | | -#if (BITS_PER_LONG > 32) || defined(CONFIG_HIGHMEM64G) |
|---|
| 775 | | -#define pci_dma_lo32(a) (a & 0xffffffff) |
|---|
| 776 | | -#define pci_dma_hi32(a) ((((a) >> 16)>>16) & 0xffffffff) |
|---|
| 777 | | -#else |
|---|
| 778 | | -#define pci_dma_lo32(a) (a & 0xffffffff) |
|---|
| 779 | | -#define pci_dma_hi32(a) 0 |
|---|
| 780 | | -#endif |
|---|
| 781 | 758 | |
|---|
| 782 | 759 | #define QLA_TGT_SENSE_VALID(sense) ((sense != NULL) && \ |
|---|
| 783 | 760 | (((const uint8_t *)(sense))[0] & 0x70) == 0x70) |
|---|
| .. | .. |
|---|
| 863 | 840 | TRC_CTIO_ERR = BIT_11, |
|---|
| 864 | 841 | TRC_CTIO_DONE = BIT_12, |
|---|
| 865 | 842 | TRC_CTIO_ABORTED = BIT_13, |
|---|
| 866 | | - TRC_CTIO_STRANGE= BIT_14, |
|---|
| 843 | + TRC_CTIO_STRANGE = BIT_14, |
|---|
| 867 | 844 | TRC_CMD_DONE = BIT_15, |
|---|
| 868 | 845 | TRC_CMD_CHK_STOP = BIT_16, |
|---|
| 869 | 846 | TRC_CMD_FREE = BIT_17, |
|---|
| .. | .. |
|---|
| 897 | 874 | unsigned int term_exchg:1; |
|---|
| 898 | 875 | unsigned int cmd_sent_to_fw:1; |
|---|
| 899 | 876 | unsigned int cmd_in_wq:1; |
|---|
| 900 | | - unsigned int aborted:1; |
|---|
| 901 | | - unsigned int data_work:1; |
|---|
| 902 | | - unsigned int data_work_free:1; |
|---|
| 877 | + |
|---|
| 878 | + /* |
|---|
| 879 | + * This variable may be set from outside the LIO and I/O completion |
|---|
| 880 | + * callback functions. Do not declare this member variable as a |
|---|
| 881 | + * bitfield to avoid a read-modify-write operation when this variable |
|---|
| 882 | + * is set. |
|---|
| 883 | + */ |
|---|
| 884 | + unsigned int aborted; |
|---|
| 903 | 885 | |
|---|
| 904 | 886 | struct scatterlist *sg; /* cmd data buffer SG vector */ |
|---|
| 905 | 887 | int sg_cnt; /* SG segments count */ |
|---|
| .. | .. |
|---|
| 908 | 890 | u64 unpacked_lun; |
|---|
| 909 | 891 | enum dma_data_direction dma_data_direction; |
|---|
| 910 | 892 | |
|---|
| 893 | + uint16_t ctio_flags; |
|---|
| 911 | 894 | uint16_t vp_idx; |
|---|
| 912 | 895 | uint16_t loop_id; /* to save extra sess dereferences */ |
|---|
| 913 | 896 | struct qla_tgt *tgt; /* to save extra sess dereferences */ |
|---|
| .. | .. |
|---|
| 930 | 913 | uint8_t scsi_status, sense_key, asc, ascq; |
|---|
| 931 | 914 | |
|---|
| 932 | 915 | struct crc_context *ctx; |
|---|
| 933 | | - uint8_t *cdb; |
|---|
| 916 | + const uint8_t *cdb; |
|---|
| 934 | 917 | uint64_t lba; |
|---|
| 935 | 918 | uint16_t a_guard, e_guard, a_app_tag, e_app_tag; |
|---|
| 936 | 919 | uint32_t a_ref_tag, e_ref_tag; |
|---|
| 920 | +#define DIF_BUNDL_DMA_VALID 1 |
|---|
| 921 | + uint16_t prot_flags; |
|---|
| 937 | 922 | |
|---|
| 938 | 923 | uint64_t jiffies_at_alloc; |
|---|
| 939 | 924 | uint64_t jiffies_at_free; |
|---|
| .. | .. |
|---|
| 956 | 941 | }; |
|---|
| 957 | 942 | |
|---|
| 958 | 943 | struct qla_tgt_mgmt_cmd { |
|---|
| 944 | + uint8_t cmd_type; |
|---|
| 945 | + uint8_t pad[3]; |
|---|
| 959 | 946 | uint16_t tmr_func; |
|---|
| 960 | 947 | uint8_t fc_tm_rsp; |
|---|
| 948 | + uint8_t abort_io_attr; |
|---|
| 961 | 949 | struct fc_port *sess; |
|---|
| 962 | 950 | struct qla_qpair *qpair; |
|---|
| 963 | 951 | struct scsi_qla_host *vha; |
|---|
| 964 | 952 | struct se_cmd se_cmd; |
|---|
| 965 | 953 | struct work_struct free_work; |
|---|
| 966 | 954 | unsigned int flags; |
|---|
| 955 | +#define QLA24XX_MGMT_SEND_NACK BIT_0 |
|---|
| 956 | +#define QLA24XX_MGMT_ABORT_IO_ATTR_VALID BIT_1 |
|---|
| 967 | 957 | uint32_t reset_count; |
|---|
| 968 | | -#define QLA24XX_MGMT_SEND_NACK 1 |
|---|
| 969 | 958 | struct work_struct work; |
|---|
| 970 | 959 | uint64_t unpacked_lun; |
|---|
| 971 | 960 | union { |
|---|
| .. | .. |
|---|
| 1042 | 1031 | return (ha->host->active_mode == MODE_DUAL); |
|---|
| 1043 | 1032 | } |
|---|
| 1044 | 1033 | |
|---|
| 1045 | | -static inline uint32_t sid_to_key(const uint8_t *s_id) |
|---|
| 1034 | +static inline uint32_t sid_to_key(const be_id_t s_id) |
|---|
| 1046 | 1035 | { |
|---|
| 1047 | | - uint32_t key; |
|---|
| 1048 | | - |
|---|
| 1049 | | - key = (((unsigned long)s_id[0] << 16) | |
|---|
| 1050 | | - ((unsigned long)s_id[1] << 8) | |
|---|
| 1051 | | - (unsigned long)s_id[2]); |
|---|
| 1052 | | - return key; |
|---|
| 1053 | | -} |
|---|
| 1054 | | - |
|---|
| 1055 | | -static inline void sid_to_portid(const uint8_t *s_id, port_id_t *p) |
|---|
| 1056 | | -{ |
|---|
| 1057 | | - memset(p, 0, sizeof(*p)); |
|---|
| 1058 | | - p->b.domain = s_id[0]; |
|---|
| 1059 | | - p->b.area = s_id[1]; |
|---|
| 1060 | | - p->b.al_pa = s_id[2]; |
|---|
| 1036 | + return s_id.domain << 16 | |
|---|
| 1037 | + s_id.area << 8 | |
|---|
| 1038 | + s_id.al_pa; |
|---|
| 1061 | 1039 | } |
|---|
| 1062 | 1040 | |
|---|
| 1063 | 1041 | /* |
|---|
| .. | .. |
|---|
| 1103 | 1081 | |
|---|
| 1104 | 1082 | void qlt_send_resp_ctio(struct qla_qpair *, struct qla_tgt_cmd *, uint8_t, |
|---|
| 1105 | 1083 | uint8_t, uint8_t, uint8_t); |
|---|
| 1106 | | -extern void qlt_abort_cmd_on_host_reset(struct scsi_qla_host *, |
|---|
| 1107 | | - struct qla_tgt_cmd *); |
|---|
| 1108 | 1084 | |
|---|
| 1109 | 1085 | #endif /* __QLA_TARGET_H */ |
|---|