forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/scsi/qla2xxx/qla_fw.h
....@@ -1,14 +1,15 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * QLogic Fibre Channel HBA Driver
34 * Copyright (c) 2003-2014 QLogic Corporation
4
- *
5
- * See LICENSE.qla2xxx for copyright and licensing details.
65 */
76 #ifndef __QLA_FW_H
87 #define __QLA_FW_H
98
109 #include <linux/nvme.h>
1110 #include <linux/nvme-fc.h>
11
+
12
+#include "qla_dsd.h"
1213
1314 #define MBS_CHECKSUM_ERROR 0x4010
1415 #define MBS_INVALID_PRODUCT_KEY 0x4020
....@@ -29,6 +30,9 @@
2930 #define PDO_FORCE_ADISC BIT_1
3031 #define PDO_FORCE_PLOGI BIT_0
3132
33
+struct buffer_credit_24xx {
34
+ u32 parameter[28];
35
+};
3236
3337 #define PORT_DATABASE_24XX_SIZE 64
3438 struct port_database_24xx {
....@@ -129,28 +133,28 @@
129133 struct nvram_24xx {
130134 /* NVRAM header. */
131135 uint8_t id[4];
132
- uint16_t nvram_version;
136
+ __le16 nvram_version;
133137 uint16_t reserved_0;
134138
135139 /* Firmware Initialization Control Block. */
136
- uint16_t version;
140
+ __le16 version;
137141 uint16_t reserved_1;
138
- __le16 frame_payload_size;
139
- uint16_t execution_throttle;
140
- uint16_t exchange_count;
141
- uint16_t hard_address;
142
+ __le16 frame_payload_size;
143
+ __le16 execution_throttle;
144
+ __le16 exchange_count;
145
+ __le16 hard_address;
142146
143147 uint8_t port_name[WWN_SIZE];
144148 uint8_t node_name[WWN_SIZE];
145149
146
- uint16_t login_retry_count;
147
- uint16_t link_down_on_nos;
148
- uint16_t interrupt_delay_timer;
149
- uint16_t login_timeout;
150
+ __le16 login_retry_count;
151
+ __le16 link_down_on_nos;
152
+ __le16 interrupt_delay_timer;
153
+ __le16 login_timeout;
150154
151
- uint32_t firmware_options_1;
152
- uint32_t firmware_options_2;
153
- uint32_t firmware_options_3;
155
+ __le32 firmware_options_1;
156
+ __le32 firmware_options_2;
157
+ __le32 firmware_options_3;
154158
155159 /* Offset 56. */
156160
....@@ -173,7 +177,7 @@
173177 * BIT 11-13 = Output Emphasis 4G
174178 * BIT 14-15 = Reserved
175179 */
176
- uint16_t seriallink_options[4];
180
+ __le16 seriallink_options[4];
177181
178182 uint16_t reserved_2[16];
179183
....@@ -213,25 +217,25 @@
213217 *
214218 * BIT 16-31 =
215219 */
216
- uint32_t host_p;
220
+ __le32 host_p;
217221
218222 uint8_t alternate_port_name[WWN_SIZE];
219223 uint8_t alternate_node_name[WWN_SIZE];
220224
221225 uint8_t boot_port_name[WWN_SIZE];
222
- uint16_t boot_lun_number;
226
+ __le16 boot_lun_number;
223227 uint16_t reserved_8;
224228
225229 uint8_t alt1_boot_port_name[WWN_SIZE];
226
- uint16_t alt1_boot_lun_number;
230
+ __le16 alt1_boot_lun_number;
227231 uint16_t reserved_9;
228232
229233 uint8_t alt2_boot_port_name[WWN_SIZE];
230
- uint16_t alt2_boot_lun_number;
234
+ __le16 alt2_boot_lun_number;
231235 uint16_t reserved_10;
232236
233237 uint8_t alt3_boot_port_name[WWN_SIZE];
234
- uint16_t alt3_boot_lun_number;
238
+ __le16 alt3_boot_lun_number;
235239 uint16_t reserved_11;
236240
237241 /*
....@@ -244,23 +248,23 @@
244248 * BIT 6 = Reserved
245249 * BIT 7-31 =
246250 */
247
- uint32_t efi_parameters;
251
+ __le32 efi_parameters;
248252
249253 uint8_t reset_delay;
250254 uint8_t reserved_12;
251255 uint16_t reserved_13;
252256
253
- uint16_t boot_id_number;
257
+ __le16 boot_id_number;
254258 uint16_t reserved_14;
255259
256
- uint16_t max_luns_per_target;
260
+ __le16 max_luns_per_target;
257261 uint16_t reserved_15;
258262
259
- uint16_t port_down_retry_count;
260
- uint16_t link_down_timeout;
263
+ __le16 port_down_retry_count;
264
+ __le16 link_down_timeout;
261265
262266 /* FCode parameters. */
263
- uint16_t fcode_parameter;
267
+ __le16 fcode_parameter;
264268
265269 uint16_t reserved_16[3];
266270
....@@ -270,13 +274,13 @@
270274 uint8_t prev_drv_ver_minor;
271275 uint8_t prev_drv_ver_subminor;
272276
273
- uint16_t prev_bios_ver_major;
274
- uint16_t prev_bios_ver_minor;
277
+ __le16 prev_bios_ver_major;
278
+ __le16 prev_bios_ver_minor;
275279
276
- uint16_t prev_efi_ver_major;
277
- uint16_t prev_efi_ver_minor;
280
+ __le16 prev_efi_ver_major;
281
+ __le16 prev_efi_ver_minor;
278282
279
- uint16_t prev_fw_ver_major;
283
+ __le16 prev_fw_ver_major;
280284 uint8_t prev_fw_ver_minor;
281285 uint8_t prev_fw_ver_subminor;
282286
....@@ -304,7 +308,7 @@
304308 uint16_t subsystem_vendor_id;
305309 uint16_t subsystem_device_id;
306310
307
- uint32_t checksum;
311
+ __le32 checksum;
308312 };
309313
310314 /*
....@@ -313,46 +317,46 @@
313317 */
314318 #define ICB_VERSION 1
315319 struct init_cb_24xx {
316
- uint16_t version;
320
+ __le16 version;
317321 uint16_t reserved_1;
318322
319
- uint16_t frame_payload_size;
320
- uint16_t execution_throttle;
321
- uint16_t exchange_count;
323
+ __le16 frame_payload_size;
324
+ __le16 execution_throttle;
325
+ __le16 exchange_count;
322326
323
- uint16_t hard_address;
327
+ __le16 hard_address;
324328
325329 uint8_t port_name[WWN_SIZE]; /* Big endian. */
326330 uint8_t node_name[WWN_SIZE]; /* Big endian. */
327331
328
- uint16_t response_q_inpointer;
329
- uint16_t request_q_outpointer;
332
+ __le16 response_q_inpointer;
333
+ __le16 request_q_outpointer;
330334
331
- uint16_t login_retry_count;
335
+ __le16 login_retry_count;
332336
333
- uint16_t prio_request_q_outpointer;
337
+ __le16 prio_request_q_outpointer;
334338
335
- uint16_t response_q_length;
336
- uint16_t request_q_length;
339
+ __le16 response_q_length;
340
+ __le16 request_q_length;
337341
338
- uint16_t link_down_on_nos; /* Milliseconds. */
342
+ __le16 link_down_on_nos; /* Milliseconds. */
339343
340
- uint16_t prio_request_q_length;
344
+ __le16 prio_request_q_length;
341345
342
- uint32_t request_q_address[2];
343
- uint32_t response_q_address[2];
344
- uint32_t prio_request_q_address[2];
346
+ __le64 request_q_address __packed;
347
+ __le64 response_q_address __packed;
348
+ __le64 prio_request_q_address __packed;
345349
346
- uint16_t msix;
347
- uint16_t msix_atio;
350
+ __le16 msix;
351
+ __le16 msix_atio;
348352 uint8_t reserved_2[4];
349353
350
- uint16_t atio_q_inpointer;
351
- uint16_t atio_q_length;
352
- uint32_t atio_q_address[2];
354
+ __le16 atio_q_inpointer;
355
+ __le16 atio_q_length;
356
+ __le64 atio_q_address __packed;
353357
354
- uint16_t interrupt_delay_timer; /* 100us increments. */
355
- uint16_t login_timeout;
358
+ __le16 interrupt_delay_timer; /* 100us increments. */
359
+ __le16 login_timeout;
356360
357361 /*
358362 * BIT 0 = Enable Hard Loop Id
....@@ -373,7 +377,7 @@
373377 * BIT 14 = Node Name Option
374378 * BIT 15-31 = Reserved
375379 */
376
- uint32_t firmware_options_1;
380
+ __le32 firmware_options_1;
377381
378382 /*
379383 * BIT 0 = Operation Mode bit 0
....@@ -394,7 +398,7 @@
394398 * BIT 14 = Enable Target PRLI Control
395399 * BIT 15-31 = Reserved
396400 */
397
- uint32_t firmware_options_2;
401
+ __le32 firmware_options_2;
398402
399403 /*
400404 * BIT 0 = Reserved
....@@ -420,9 +424,9 @@
420424 * BIT 30 = Enable request queue 0 out index shadowing
421425 * BIT 31 = Reserved
422426 */
423
- uint32_t firmware_options_3;
424
- uint16_t qos;
425
- uint16_t rid;
427
+ __le32 firmware_options_3;
428
+ __le16 qos;
429
+ __le16 rid;
426430 uint8_t reserved_3[20];
427431 };
428432
....@@ -438,33 +442,32 @@
438442
439443 uint32_t handle; /* System handle. */
440444
441
- uint16_t nport_handle; /* N_PORT hanlde. */
445
+ __le16 nport_handle; /* N_PORT handle. */
442446
443
- uint16_t timeout; /* Commnad timeout. */
447
+ __le16 timeout; /* Command timeout. */
444448
445
- uint16_t wr_dseg_count; /* Write Data segment count. */
446
- uint16_t rd_dseg_count; /* Read Data segment count. */
449
+ __le16 wr_dseg_count; /* Write Data segment count. */
450
+ __le16 rd_dseg_count; /* Read Data segment count. */
447451
448452 struct scsi_lun lun; /* FCP LUN (BE). */
449453
450
- uint16_t control_flags; /* Control flags. */
454
+ __le16 control_flags; /* Control flags. */
451455 #define BD_WRAP_BACK BIT_3
452456 #define BD_READ_DATA BIT_1
453457 #define BD_WRITE_DATA BIT_0
454458
455
- uint16_t fcp_cmnd_dseg_len; /* Data segment length. */
456
- uint32_t fcp_cmnd_dseg_address[2]; /* Data segment address. */
459
+ __le16 fcp_cmnd_dseg_len; /* Data segment length. */
460
+ __le64 fcp_cmnd_dseg_address __packed;/* Data segment address. */
457461
458462 uint16_t reserved[2]; /* Reserved */
459463
460
- uint32_t rd_byte_count; /* Total Byte count Read. */
461
- uint32_t wr_byte_count; /* Total Byte count write. */
464
+ __le32 rd_byte_count; /* Total Byte count Read. */
465
+ __le32 wr_byte_count; /* Total Byte count write. */
462466
463467 uint8_t port_id[3]; /* PortID of destination port.*/
464468 uint8_t vp_index;
465469
466
- uint32_t fcp_data_dseg_address[2]; /* Data segment address. */
467
- uint16_t fcp_data_dseg_len; /* Data segment length. */
470
+ struct dsd64 fcp_dsd;
468471 };
469472
470473 #define COMMAND_TYPE_6 0x48 /* Command Type 6 entry */
....@@ -476,33 +479,33 @@
476479
477480 uint32_t handle; /* System handle. */
478481
479
- uint16_t nport_handle; /* N_PORT handle. */
480
- uint16_t timeout; /* Command timeout. */
482
+ __le16 nport_handle; /* N_PORT handle. */
483
+ __le16 timeout; /* Command timeout. */
481484
482
- uint16_t dseg_count; /* Data segment count. */
485
+ __le16 dseg_count; /* Data segment count. */
483486
484
- uint16_t fcp_rsp_dsd_len; /* FCP_RSP DSD length. */
487
+ __le16 fcp_rsp_dsd_len; /* FCP_RSP DSD length. */
485488
486489 struct scsi_lun lun; /* FCP LUN (BE). */
487490
488
- uint16_t control_flags; /* Control flags. */
491
+ __le16 control_flags; /* Control flags. */
489492 #define CF_DIF_SEG_DESCR_ENABLE BIT_3
490493 #define CF_DATA_SEG_DESCR_ENABLE BIT_2
491494 #define CF_READ_DATA BIT_1
492495 #define CF_WRITE_DATA BIT_0
493496
494
- uint16_t fcp_cmnd_dseg_len; /* Data segment length. */
495
- uint32_t fcp_cmnd_dseg_address[2]; /* Data segment address. */
497
+ __le16 fcp_cmnd_dseg_len; /* Data segment length. */
498
+ /* Data segment address. */
499
+ __le64 fcp_cmnd_dseg_address __packed;
500
+ /* Data segment address. */
501
+ __le64 fcp_rsp_dseg_address __packed;
496502
497
- uint32_t fcp_rsp_dseg_address[2]; /* Data segment address. */
498
-
499
- uint32_t byte_count; /* Total byte count. */
503
+ __le32 byte_count; /* Total byte count. */
500504
501505 uint8_t port_id[3]; /* PortID of destination port. */
502506 uint8_t vp_index;
503507
504
- uint32_t fcp_data_dseg_address[2]; /* Data segment address. */
505
- uint32_t fcp_data_dseg_len; /* Data segment length. */
508
+ struct dsd64 fcp_dsd;
506509 };
507510
508511 #define COMMAND_TYPE_7 0x18 /* Command Type 7 entry */
....@@ -514,16 +517,16 @@
514517
515518 uint32_t handle; /* System handle. */
516519
517
- uint16_t nport_handle; /* N_PORT handle. */
518
- uint16_t timeout; /* Command timeout. */
520
+ __le16 nport_handle; /* N_PORT handle. */
521
+ __le16 timeout; /* Command timeout. */
519522 #define FW_MAX_TIMEOUT 0x1999
520523
521
- uint16_t dseg_count; /* Data segment count. */
524
+ __le16 dseg_count; /* Data segment count. */
522525 uint16_t reserved_1;
523526
524527 struct scsi_lun lun; /* FCP LUN (BE). */
525528
526
- uint16_t task_mgmt_flags; /* Task management flags. */
529
+ __le16 task_mgmt_flags; /* Task management flags. */
527530 #define TMF_CLEAR_ACA BIT_14
528531 #define TMF_TARGET_RESET BIT_13
529532 #define TMF_LUN_RESET BIT_12
....@@ -543,13 +546,12 @@
543546 uint8_t crn;
544547
545548 uint8_t fcp_cdb[MAX_CMDSZ]; /* SCSI command words. */
546
- uint32_t byte_count; /* Total byte count. */
549
+ __le32 byte_count; /* Total byte count. */
547550
548551 uint8_t port_id[3]; /* PortID of destination port. */
549552 uint8_t vp_index;
550553
551
- uint32_t dseg_0_address[2]; /* Data segment 0 address. */
552
- uint32_t dseg_0_len; /* Data segment 0 length. */
554
+ struct dsd64 dsd;
553555 };
554556
555557 #define COMMAND_TYPE_CRC_2 0x6A /* Command Type CRC_2 (Type 6)
....@@ -562,29 +564,29 @@
562564
563565 uint32_t handle; /* System handle. */
564566
565
- uint16_t nport_handle; /* N_PORT handle. */
566
- uint16_t timeout; /* Command timeout. */
567
+ __le16 nport_handle; /* N_PORT handle. */
568
+ __le16 timeout; /* Command timeout. */
567569
568
- uint16_t dseg_count; /* Data segment count. */
570
+ __le16 dseg_count; /* Data segment count. */
569571
570
- uint16_t fcp_rsp_dseg_len; /* FCP_RSP DSD length. */
572
+ __le16 fcp_rsp_dseg_len; /* FCP_RSP DSD length. */
571573
572574 struct scsi_lun lun; /* FCP LUN (BE). */
573575
574
- uint16_t control_flags; /* Control flags. */
576
+ __le16 control_flags; /* Control flags. */
575577
576
- uint16_t fcp_cmnd_dseg_len; /* Data segment length. */
577
- uint32_t fcp_cmnd_dseg_address[2]; /* Data segment address. */
578
+ __le16 fcp_cmnd_dseg_len; /* Data segment length. */
579
+ __le64 fcp_cmnd_dseg_address __packed;
580
+ /* Data segment address. */
581
+ __le64 fcp_rsp_dseg_address __packed;
578582
579
- uint32_t fcp_rsp_dseg_address[2]; /* Data segment address. */
580
-
581
- uint32_t byte_count; /* Total byte count. */
583
+ __le32 byte_count; /* Total byte count. */
582584
583585 uint8_t port_id[3]; /* PortID of destination port. */
584586 uint8_t vp_index;
585587
586
- uint32_t crc_context_address[2]; /* Data segment address. */
587
- uint16_t crc_context_len; /* Data segment length. */
588
+ __le64 crc_context_address __packed; /* Data segment address. */
589
+ __le16 crc_context_len; /* Data segment length. */
588590 uint16_t reserved_1; /* MUST be set to 0. */
589591 };
590592
....@@ -601,32 +603,32 @@
601603
602604 uint32_t handle; /* System handle. */
603605
604
- uint16_t comp_status; /* Completion status. */
605
- uint16_t ox_id; /* OX_ID used by the firmware. */
606
+ __le16 comp_status; /* Completion status. */
607
+ __le16 ox_id; /* OX_ID used by the firmware. */
606608
607
- uint32_t residual_len; /* FW calc residual transfer length. */
609
+ __le32 residual_len; /* FW calc residual transfer length. */
608610
609611 union {
610
- uint16_t reserved_1;
611
- uint16_t nvme_rsp_pyld_len;
612
+ __le16 reserved_1;
613
+ __le16 nvme_rsp_pyld_len;
612614 };
613615
614
- uint16_t state_flags; /* State flags. */
616
+ __le16 state_flags; /* State flags. */
615617 #define SF_TRANSFERRED_DATA BIT_11
616618 #define SF_NVME_ERSP BIT_6
617619 #define SF_FCP_RSP_DMA BIT_0
618620
619
- uint16_t retry_delay;
620
- uint16_t scsi_status; /* SCSI status. */
621
+ __le16 status_qualifier;
622
+ __le16 scsi_status; /* SCSI status. */
621623 #define SS_CONFIRMATION_REQ BIT_12
622624
623
- uint32_t rsp_residual_count; /* FCP RSP residual count. */
625
+ __le32 rsp_residual_count; /* FCP RSP residual count. */
624626
625
- uint32_t sense_len; /* FCP SENSE length. */
627
+ __le32 sense_len; /* FCP SENSE length. */
626628
627629 union {
628630 struct {
629
- uint32_t rsp_data_len; /* FCP response data length */
631
+ __le32 rsp_data_len; /* FCP response data length */
630632 uint8_t data[28]; /* FCP rsp/sense information */
631633 };
632634 struct nvme_fc_ersp_iu nvme_ersp;
....@@ -669,7 +671,7 @@
669671
670672 uint32_t handle; /* System handle. */
671673
672
- uint16_t nport_handle; /* N_PORT handle. */
674
+ __le16 nport_handle; /* N_PORT handle. */
673675
674676 uint8_t modifier; /* Modifier (7-0). */
675677 #define MK_SYNC_ID_LUN 0 /* Synchronize ID/LUN */
....@@ -698,29 +700,70 @@
698700
699701 uint32_t handle; /* System handle. */
700702
701
- uint16_t comp_status; /* Completion status. */
703
+ __le16 comp_status; /* Completion status. */
702704
703
- uint16_t nport_handle; /* N_PORT handle. */
705
+ __le16 nport_handle; /* N_PORT handle. */
704706
705
- uint16_t cmd_dsd_count;
707
+ __le16 cmd_dsd_count;
706708
707709 uint8_t vp_index;
708710 uint8_t reserved_1;
709711
710
- uint16_t timeout; /* Command timeout. */
712
+ __le16 timeout; /* Command timeout. */
711713 uint16_t reserved_2;
712714
713
- uint16_t rsp_dsd_count;
715
+ __le16 rsp_dsd_count;
714716
715717 uint8_t reserved_3[10];
716718
717
- uint32_t rsp_byte_count;
718
- uint32_t cmd_byte_count;
719
+ __le32 rsp_byte_count;
720
+ __le32 cmd_byte_count;
719721
720
- uint32_t dseg_0_address[2]; /* Data segment 0 address. */
721
- uint32_t dseg_0_len; /* Data segment 0 length. */
722
- uint32_t dseg_1_address[2]; /* Data segment 1 address. */
723
- uint32_t dseg_1_len; /* Data segment 1 length. */
722
+ struct dsd64 dsd[2];
723
+};
724
+
725
+#define PURX_ELS_HEADER_SIZE 0x18
726
+
727
+/*
728
+ * ISP queue - PUREX IOCB entry structure definition
729
+ */
730
+#define PUREX_IOCB_TYPE 0x51 /* CT Pass Through IOCB entry */
731
+struct purex_entry_24xx {
732
+ uint8_t entry_type; /* Entry type. */
733
+ uint8_t entry_count; /* Entry count. */
734
+ uint8_t sys_define; /* System defined. */
735
+ uint8_t entry_status; /* Entry Status. */
736
+
737
+ __le16 reserved1;
738
+ uint8_t vp_idx;
739
+ uint8_t reserved2;
740
+
741
+ __le16 status_flags;
742
+ __le16 nport_handle;
743
+
744
+ __le16 frame_size;
745
+ __le16 trunc_frame_size;
746
+
747
+ __le32 rx_xchg_addr;
748
+
749
+ uint8_t d_id[3];
750
+ uint8_t r_ctl;
751
+
752
+ uint8_t s_id[3];
753
+ uint8_t cs_ctl;
754
+
755
+ uint8_t f_ctl[3];
756
+ uint8_t type;
757
+
758
+ __le16 seq_cnt;
759
+ uint8_t df_ctl;
760
+ uint8_t seq_id;
761
+
762
+ __le16 rx_id;
763
+ __le16 ox_id;
764
+ __le32 param;
765
+
766
+ uint8_t els_frame_payload[20];
724767 };
725768
726769 /*
....@@ -735,27 +778,26 @@
735778
736779 uint32_t handle; /* System handle. */
737780
738
- uint16_t reserved_1;
781
+ __le16 comp_status; /* response only */
782
+ __le16 nport_handle;
739783
740
- uint16_t nport_handle; /* N_PORT handle. */
741
-
742
- uint16_t tx_dsd_count;
784
+ __le16 tx_dsd_count;
743785
744786 uint8_t vp_index;
745787 uint8_t sof_type;
746788 #define EST_SOFI3 (1 << 4)
747789 #define EST_SOFI2 (3 << 4)
748790
749
- uint32_t rx_xchg_address; /* Receive exchange address. */
750
- uint16_t rx_dsd_count;
791
+ __le32 rx_xchg_address; /* Receive exchange address. */
792
+ __le16 rx_dsd_count;
751793
752794 uint8_t opcode;
753795 uint8_t reserved_2;
754796
755
- uint8_t port_id[3];
797
+ uint8_t d_id[3];
756798 uint8_t s_id[3];
757799
758
- uint16_t control_flags; /* Control flags. */
800
+ __le16 control_flags; /* Control flags. */
759801 #define ECF_PAYLOAD_DESCR_MASK (BIT_15|BIT_14|BIT_13)
760802 #define EPD_ELS_COMMAND (0 << 13)
761803 #define EPD_ELS_ACC (1 << 13)
....@@ -764,13 +806,24 @@
764806 #define ECF_CLR_PASSTHRU_PEND BIT_12
765807 #define ECF_INCL_FRAME_HDR BIT_11
766808
767
- uint32_t rx_byte_count;
768
- uint32_t tx_byte_count;
809
+ union {
810
+ struct {
811
+ __le32 rx_byte_count;
812
+ __le32 tx_byte_count;
769813
770
- uint32_t tx_address[2]; /* Data segment 0 address. */
771
- uint32_t tx_len; /* Data segment 0 length. */
772
- uint32_t rx_address[2]; /* Data segment 1 address. */
773
- uint32_t rx_len; /* Data segment 1 length. */
814
+ __le64 tx_address __packed; /* DSD 0 address. */
815
+ __le32 tx_len; /* DSD 0 length. */
816
+
817
+ __le64 rx_address __packed; /* DSD 1 address. */
818
+ __le32 rx_len; /* DSD 1 length. */
819
+ };
820
+ struct {
821
+ __le32 total_byte_count;
822
+ __le32 error_subcode_1;
823
+ __le32 error_subcode_2;
824
+ __le32 error_subcode_3;
825
+ };
826
+ };
774827 };
775828
776829 struct els_sts_entry_24xx {
....@@ -779,32 +832,33 @@
779832 uint8_t sys_define; /* System Defined. */
780833 uint8_t entry_status; /* Entry Status. */
781834
782
- uint32_t handle; /* System handle. */
835
+ __le32 handle; /* System handle. */
783836
784
- uint16_t comp_status;
837
+ __le16 comp_status;
785838
786
- uint16_t nport_handle; /* N_PORT handle. */
839
+ __le16 nport_handle; /* N_PORT handle. */
787840
788
- uint16_t reserved_1;
841
+ __le16 reserved_1;
789842
790843 uint8_t vp_index;
791844 uint8_t sof_type;
792845
793
- uint32_t rx_xchg_address; /* Receive exchange address. */
794
- uint16_t reserved_2;
846
+ __le32 rx_xchg_address; /* Receive exchange address. */
847
+ __le16 reserved_2;
795848
796849 uint8_t opcode;
797850 uint8_t reserved_3;
798851
799
- uint8_t port_id[3];
800
- uint8_t reserved_4;
852
+ uint8_t d_id[3];
853
+ uint8_t s_id[3];
801854
802
- uint16_t reserved_5;
855
+ __le16 control_flags; /* Control flags. */
856
+ __le32 total_byte_count;
857
+ __le32 error_subcode_1;
858
+ __le32 error_subcode_2;
859
+ __le32 error_subcode_3;
803860
804
- uint16_t control_flags; /* Control flags. */
805
- uint32_t total_byte_count;
806
- uint32_t error_subcode_1;
807
- uint32_t error_subcode_2;
861
+ __le32 reserved_4[4];
808862 };
809863 /*
810864 * ISP queue - Mailbox Command entry structure definition.
....@@ -831,12 +885,12 @@
831885
832886 uint32_t handle; /* System handle. */
833887
834
- uint16_t comp_status; /* Completion status. */
888
+ __le16 comp_status; /* Completion status. */
835889 #define CS_LOGIO_ERROR 0x31 /* Login/Logout IOCB error. */
836890
837
- uint16_t nport_handle; /* N_PORT handle. */
891
+ __le16 nport_handle; /* N_PORT handle. */
838892
839
- uint16_t control_flags; /* Control flags. */
893
+ __le16 control_flags; /* Control flags. */
840894 /* Modifiers. */
841895 #define LCF_INCLUDE_SNS BIT_10 /* Include SNS (FFFFFC) during LOGO. */
842896 #define LCF_FCP2_OVERRIDE BIT_9 /* Set/Reset word 3 of PRLI. */
....@@ -865,7 +919,7 @@
865919
866920 uint8_t rsp_size; /* Response size in 32bit words. */
867921
868
- uint32_t io_parameter[11]; /* General I/O parameters. */
922
+ __le32 io_parameter[11]; /* General I/O parameters. */
869923 #define LSC_SCODE_NOLINK 0x01
870924 #define LSC_SCODE_NOIOCB 0x02
871925 #define LSC_SCODE_NOXCB 0x03
....@@ -893,17 +947,17 @@
893947
894948 uint32_t handle; /* System handle. */
895949
896
- uint16_t nport_handle; /* N_PORT handle. */
950
+ __le16 nport_handle; /* N_PORT handle. */
897951
898952 uint16_t reserved_1;
899953
900
- uint16_t delay; /* Activity delay in seconds. */
954
+ __le16 delay; /* Activity delay in seconds. */
901955
902
- uint16_t timeout; /* Command timeout. */
956
+ __le16 timeout; /* Command timeout. */
903957
904958 struct scsi_lun lun; /* FCP LUN (BE). */
905959
906
- uint32_t control_flags; /* Control Flags. */
960
+ __le32 control_flags; /* Control Flags. */
907961 #define TCF_NOTMCMD_TO_TARGET BIT_31
908962 #define TCF_LUN_RESET BIT_4
909963 #define TCF_ABORT_TASK_SET BIT_3
....@@ -928,15 +982,15 @@
928982
929983 uint32_t handle; /* System handle. */
930984
931
- uint16_t nport_handle; /* N_PORT handle. */
985
+ __le16 nport_handle; /* N_PORT handle. */
932986 /* or Completion status. */
933987
934
- uint16_t options; /* Options. */
988
+ __le16 options; /* Options. */
935989 #define AOF_NO_ABTS BIT_0 /* Do not send any ABTS. */
936990
937991 uint32_t handle_to_abort; /* System handle to abort. */
938992
939
- uint16_t req_que_no;
993
+ __le16 req_que_no;
940994 uint8_t reserved_1[30];
941995
942996 uint8_t port_id[3]; /* PortID of destination port. */
....@@ -945,11 +999,96 @@
945999 uint8_t reserved_2[12];
9461000 };
9471001
1002
+#define ABTS_RCV_TYPE 0x54
1003
+#define ABTS_RSP_TYPE 0x55
1004
+struct abts_entry_24xx {
1005
+ uint8_t entry_type;
1006
+ uint8_t entry_count;
1007
+ uint8_t handle_count;
1008
+ uint8_t entry_status;
1009
+
1010
+ __le32 handle; /* type 0x55 only */
1011
+
1012
+ __le16 comp_status; /* type 0x55 only */
1013
+ __le16 nport_handle; /* type 0x54 only */
1014
+
1015
+ __le16 control_flags; /* type 0x55 only */
1016
+ uint8_t vp_idx;
1017
+ uint8_t sof_type; /* sof_type is upper nibble */
1018
+
1019
+ __le32 rx_xch_addr;
1020
+
1021
+ uint8_t d_id[3];
1022
+ uint8_t r_ctl;
1023
+
1024
+ uint8_t s_id[3];
1025
+ uint8_t cs_ctl;
1026
+
1027
+ uint8_t f_ctl[3];
1028
+ uint8_t type;
1029
+
1030
+ __le16 seq_cnt;
1031
+ uint8_t df_ctl;
1032
+ uint8_t seq_id;
1033
+
1034
+ __le16 rx_id;
1035
+ __le16 ox_id;
1036
+
1037
+ __le32 param;
1038
+
1039
+ union {
1040
+ struct {
1041
+ __le32 subcode3;
1042
+ __le32 rsvd;
1043
+ __le32 subcode1;
1044
+ __le32 subcode2;
1045
+ } error;
1046
+ struct {
1047
+ __le16 rsrvd1;
1048
+ uint8_t last_seq_id;
1049
+ uint8_t seq_id_valid;
1050
+ __le16 aborted_rx_id;
1051
+ __le16 aborted_ox_id;
1052
+ __le16 high_seq_cnt;
1053
+ __le16 low_seq_cnt;
1054
+ } ba_acc;
1055
+ struct {
1056
+ uint8_t vendor_unique;
1057
+ uint8_t explanation;
1058
+ uint8_t reason;
1059
+ } ba_rjt;
1060
+ } payload;
1061
+
1062
+ __le32 rx_xch_addr_to_abort;
1063
+} __packed;
1064
+
1065
+/* ABTS payload explanation values */
1066
+#define BA_RJT_EXP_NO_ADDITIONAL 0
1067
+#define BA_RJT_EXP_INV_OX_RX_ID 3
1068
+#define BA_RJT_EXP_SEQ_ABORTED 5
1069
+
1070
+/* ABTS payload reason values */
1071
+#define BA_RJT_RSN_INV_CMD_CODE 1
1072
+#define BA_RJT_RSN_LOGICAL_ERROR 3
1073
+#define BA_RJT_RSN_LOGICAL_BUSY 5
1074
+#define BA_RJT_RSN_PROTOCOL_ERROR 7
1075
+#define BA_RJT_RSN_UNABLE_TO_PERFORM 9
1076
+#define BA_RJT_RSN_VENDOR_SPECIFIC 0xff
1077
+
1078
+/* FC_F values */
1079
+#define FC_TYPE_BLD 0x000 /* Basic link data */
1080
+#define FC_F_CTL_RSP_CNTXT 0x800000 /* Responder of exchange */
1081
+#define FC_F_CTL_LAST_SEQ 0x100000 /* Last sequence */
1082
+#define FC_F_CTL_END_SEQ 0x80000 /* Last sequence */
1083
+#define FC_F_CTL_SEQ_INIT 0x010000 /* Sequence initiative */
1084
+#define FC_ROUTING_BLD 0x80 /* Basic link data frame */
1085
+#define FC_R_CTL_BLD_BA_ACC 0x04 /* BA_ACC (basic accept) */
1086
+
9481087 /*
9491088 * ISP I/O Register Set structure definitions.
9501089 */
9511090 struct device_reg_24xx {
952
- uint32_t flash_addr; /* Flash/NVRAM BIOS address. */
1091
+ __le32 flash_addr; /* Flash/NVRAM BIOS address. */
9531092 #define FARX_DATA_FLAG BIT_31
9541093 #define FARX_ACCESS_FLASH_CONF 0x7FFD0000
9551094 #define FARX_ACCESS_FLASH_DATA 0x7FF00000
....@@ -1000,9 +1139,9 @@
10001139 #define HW_EVENT_NVRAM_CHKSUM_ERR 0xF023
10011140 #define HW_EVENT_FLASH_FW_ERR 0xF024
10021141
1003
- uint32_t flash_data; /* Flash/NVRAM BIOS data. */
1142
+ __le32 flash_data; /* Flash/NVRAM BIOS data. */
10041143
1005
- uint32_t ctrl_status; /* Control/Status. */
1144
+ __le32 ctrl_status; /* Control/Status. */
10061145 #define CSRX_FLASH_ACCESS_ERROR BIT_18 /* Flash/NVRAM Access Error. */
10071146 #define CSRX_DMA_ACTIVE BIT_17 /* DMA Active status. */
10081147 #define CSRX_DMA_SHUTDOWN BIT_16 /* DMA Shutdown control status. */
....@@ -1028,35 +1167,35 @@
10281167 #define CSRX_FLASH_ENABLE BIT_1 /* Flash BIOS Read/Write enable. */
10291168 #define CSRX_ISP_SOFT_RESET BIT_0 /* ISP soft reset. */
10301169
1031
- uint32_t ictrl; /* Interrupt control. */
1170
+ __le32 ictrl; /* Interrupt control. */
10321171 #define ICRX_EN_RISC_INT BIT_3 /* Enable RISC interrupts on PCI. */
10331172
1034
- uint32_t istatus; /* Interrupt status. */
1173
+ __le32 istatus; /* Interrupt status. */
10351174 #define ISRX_RISC_INT BIT_3 /* RISC interrupt. */
10361175
1037
- uint32_t unused_1[2]; /* Gap. */
1176
+ __le32 unused_1[2]; /* Gap. */
10381177
10391178 /* Request Queue. */
1040
- uint32_t req_q_in; /* In-Pointer. */
1041
- uint32_t req_q_out; /* Out-Pointer. */
1179
+ __le32 req_q_in; /* In-Pointer. */
1180
+ __le32 req_q_out; /* Out-Pointer. */
10421181 /* Response Queue. */
1043
- uint32_t rsp_q_in; /* In-Pointer. */
1044
- uint32_t rsp_q_out; /* Out-Pointer. */
1182
+ __le32 rsp_q_in; /* In-Pointer. */
1183
+ __le32 rsp_q_out; /* Out-Pointer. */
10451184 /* Priority Request Queue. */
1046
- uint32_t preq_q_in; /* In-Pointer. */
1047
- uint32_t preq_q_out; /* Out-Pointer. */
1185
+ __le32 preq_q_in; /* In-Pointer. */
1186
+ __le32 preq_q_out; /* Out-Pointer. */
10481187
1049
- uint32_t unused_2[2]; /* Gap. */
1188
+ __le32 unused_2[2]; /* Gap. */
10501189
10511190 /* ATIO Queue. */
1052
- uint32_t atio_q_in; /* In-Pointer. */
1053
- uint32_t atio_q_out; /* Out-Pointer. */
1191
+ __le32 atio_q_in; /* In-Pointer. */
1192
+ __le32 atio_q_out; /* Out-Pointer. */
10541193
1055
- uint32_t host_status;
1194
+ __le32 host_status;
10561195 #define HSRX_RISC_INT BIT_15 /* RISC to Host interrupt. */
10571196 #define HSRX_RISC_PAUSED BIT_8 /* RISC Paused. */
10581197
1059
- uint32_t hccr; /* Host command & control register. */
1198
+ __le32 hccr; /* Host command & control register. */
10601199 /* HCCR statuses. */
10611200 #define HCCRX_HOST_INT BIT_6 /* Host to RISC interrupt bit. */
10621201 #define HCCRX_RISC_RESET BIT_5 /* RISC Reset mode bit. */
....@@ -1078,7 +1217,7 @@
10781217 /* Clear RISC to PCI interrupt. */
10791218 #define HCCRX_CLR_RISC_INT 0xA0000000
10801219
1081
- uint32_t gpiod; /* GPIO Data register. */
1220
+ __le32 gpiod; /* GPIO Data register. */
10821221
10831222 /* LED update mask. */
10841223 #define GPDX_LED_UPDATE_MASK (BIT_20|BIT_19|BIT_18)
....@@ -1097,7 +1236,7 @@
10971236 /* Data in/out. */
10981237 #define GPDX_DATA_INOUT (BIT_1|BIT_0)
10991238
1100
- uint32_t gpioe; /* GPIO Enable register. */
1239
+ __le32 gpioe; /* GPIO Enable register. */
11011240 /* Enable update mask. */
11021241 #define GPEX_ENABLE_UPDATE_MASK (BIT_17|BIT_16)
11031242 /* Enable update mask. */
....@@ -1105,56 +1244,56 @@
11051244 /* Enable. */
11061245 #define GPEX_ENABLE (BIT_1|BIT_0)
11071246
1108
- uint32_t iobase_addr; /* I/O Bus Base Address register. */
1247
+ __le32 iobase_addr; /* I/O Bus Base Address register. */
11091248
1110
- uint32_t unused_3[10]; /* Gap. */
1249
+ __le32 unused_3[10]; /* Gap. */
11111250
1112
- uint16_t mailbox0;
1113
- uint16_t mailbox1;
1114
- uint16_t mailbox2;
1115
- uint16_t mailbox3;
1116
- uint16_t mailbox4;
1117
- uint16_t mailbox5;
1118
- uint16_t mailbox6;
1119
- uint16_t mailbox7;
1120
- uint16_t mailbox8;
1121
- uint16_t mailbox9;
1122
- uint16_t mailbox10;
1123
- uint16_t mailbox11;
1124
- uint16_t mailbox12;
1125
- uint16_t mailbox13;
1126
- uint16_t mailbox14;
1127
- uint16_t mailbox15;
1128
- uint16_t mailbox16;
1129
- uint16_t mailbox17;
1130
- uint16_t mailbox18;
1131
- uint16_t mailbox19;
1132
- uint16_t mailbox20;
1133
- uint16_t mailbox21;
1134
- uint16_t mailbox22;
1135
- uint16_t mailbox23;
1136
- uint16_t mailbox24;
1137
- uint16_t mailbox25;
1138
- uint16_t mailbox26;
1139
- uint16_t mailbox27;
1140
- uint16_t mailbox28;
1141
- uint16_t mailbox29;
1142
- uint16_t mailbox30;
1143
- uint16_t mailbox31;
1251
+ __le16 mailbox0;
1252
+ __le16 mailbox1;
1253
+ __le16 mailbox2;
1254
+ __le16 mailbox3;
1255
+ __le16 mailbox4;
1256
+ __le16 mailbox5;
1257
+ __le16 mailbox6;
1258
+ __le16 mailbox7;
1259
+ __le16 mailbox8;
1260
+ __le16 mailbox9;
1261
+ __le16 mailbox10;
1262
+ __le16 mailbox11;
1263
+ __le16 mailbox12;
1264
+ __le16 mailbox13;
1265
+ __le16 mailbox14;
1266
+ __le16 mailbox15;
1267
+ __le16 mailbox16;
1268
+ __le16 mailbox17;
1269
+ __le16 mailbox18;
1270
+ __le16 mailbox19;
1271
+ __le16 mailbox20;
1272
+ __le16 mailbox21;
1273
+ __le16 mailbox22;
1274
+ __le16 mailbox23;
1275
+ __le16 mailbox24;
1276
+ __le16 mailbox25;
1277
+ __le16 mailbox26;
1278
+ __le16 mailbox27;
1279
+ __le16 mailbox28;
1280
+ __le16 mailbox29;
1281
+ __le16 mailbox30;
1282
+ __le16 mailbox31;
11441283
1145
- uint32_t iobase_window;
1146
- uint32_t iobase_c4;
1147
- uint32_t iobase_c8;
1148
- uint32_t unused_4_1[6]; /* Gap. */
1149
- uint32_t iobase_q;
1150
- uint32_t unused_5[2]; /* Gap. */
1151
- uint32_t iobase_select;
1152
- uint32_t unused_6[2]; /* Gap. */
1153
- uint32_t iobase_sdata;
1284
+ __le32 iobase_window;
1285
+ __le32 iobase_c4;
1286
+ __le32 iobase_c8;
1287
+ __le32 unused_4_1[6]; /* Gap. */
1288
+ __le32 iobase_q;
1289
+ __le32 unused_5[2]; /* Gap. */
1290
+ __le32 iobase_select;
1291
+ __le32 unused_6[2]; /* Gap. */
1292
+ __le32 iobase_sdata;
11541293 };
11551294 /* RISC-RISC semaphore register PCI offet */
11561295 #define RISC_REGISTER_BASE_OFFSET 0x7010
1157
-#define RISC_REGISTER_WINDOW_OFFET 0x6
1296
+#define RISC_REGISTER_WINDOW_OFFSET 0x6
11581297
11591298 /* RISC-RISC semaphore/flag register (risc address 0x7016) */
11601299
....@@ -1216,8 +1355,8 @@
12161355 struct mid_init_cb_24xx {
12171356 struct init_cb_24xx init_cb;
12181357
1219
- uint16_t count;
1220
- uint16_t options;
1358
+ __le16 count;
1359
+ __le16 options;
12211360
12221361 struct mid_conf_entry_24xx entries[MAX_MULTI_ID_FABRIC];
12231362 };
....@@ -1251,27 +1390,27 @@
12511390
12521391 uint32_t handle; /* System handle. */
12531392
1254
- uint16_t vp_idx_failed;
1393
+ __le16 vp_idx_failed;
12551394
1256
- uint16_t comp_status; /* Completion status. */
1395
+ __le16 comp_status; /* Completion status. */
12571396 #define CS_VCE_IOCB_ERROR 0x01 /* Error processing IOCB */
12581397 #define CS_VCE_ACQ_ID_ERROR 0x02 /* Error while acquireing ID. */
12591398 #define CS_VCE_BUSY 0x05 /* Firmware not ready to accept cmd. */
12601399
1261
- uint16_t command;
1400
+ __le16 command;
12621401 #define VCE_COMMAND_ENABLE_VPS 0x00 /* Enable VPs. */
12631402 #define VCE_COMMAND_DISABLE_VPS 0x08 /* Disable VPs. */
12641403 #define VCE_COMMAND_DISABLE_VPS_REINIT 0x09 /* Disable VPs and reinit link. */
12651404 #define VCE_COMMAND_DISABLE_VPS_LOGO 0x0a /* Disable VPs and LOGO ports. */
12661405 #define VCE_COMMAND_DISABLE_VPS_LOGO_ALL 0x0b /* Disable VPs and LOGO ports. */
12671406
1268
- uint16_t vp_count;
1407
+ __le16 vp_count;
12691408
12701409 uint8_t vp_idx_map[16];
1271
- uint16_t flags;
1272
- uint16_t id;
1410
+ __le16 flags;
1411
+ __le16 id;
12731412 uint16_t reserved_4;
1274
- uint16_t hopct;
1413
+ __le16 hopct;
12751414 uint8_t reserved_5[24];
12761415 };
12771416
....@@ -1287,12 +1426,12 @@
12871426
12881427 uint32_t handle; /* System handle. */
12891428
1290
- uint16_t flags;
1429
+ __le16 flags;
12911430 #define CS_VF_BIND_VPORTS_TO_VF BIT_0
12921431 #define CS_VF_SET_QOS_OF_VPORTS BIT_1
12931432 #define CS_VF_SET_HOPS_OF_VPORTS BIT_2
12941433
1295
- uint16_t comp_status; /* Completion status. */
1434
+ __le16 comp_status; /* Completion status. */
12961435 #define CS_VCT_STS_ERROR 0x01 /* Specified VPs were not disabled. */
12971436 #define CS_VCT_CNT_ERROR 0x02 /* Invalid VP count. */
12981437 #define CS_VCT_ERROR 0x03 /* Unknown error. */
....@@ -1319,9 +1458,9 @@
13191458 uint16_t reserved_vp2;
13201459 uint8_t port_name_idx2[WWN_SIZE];
13211460 uint8_t node_name_idx2[WWN_SIZE];
1322
- uint16_t id;
1461
+ __le16 id;
13231462 uint16_t reserved_4;
1324
- uint16_t hopct;
1463
+ __le16 hopct;
13251464 uint8_t reserved_5[2];
13261465 };
13271466
....@@ -1348,7 +1487,7 @@
13481487 uint8_t entry_count; /* Entry count. */
13491488 uint8_t sys_define; /* System defined. */
13501489 uint8_t entry_status; /* Entry Status. */
1351
- uint32_t resv1;
1490
+ __le32 resv1;
13521491 uint8_t vp_acquired;
13531492 uint8_t vp_setup;
13541493 uint8_t vp_idx; /* Format 0=reserved */
....@@ -1357,12 +1496,12 @@
13571496 uint8_t port_id[3];
13581497 uint8_t format;
13591498 union {
1360
- struct {
1499
+ struct _f0 {
13611500 /* format 0 loop */
13621501 uint8_t vp_idx_map[16];
13631502 uint8_t reserved_4[32];
13641503 } f0;
1365
- struct {
1504
+ struct _f1 {
13661505 /* format 1 fabric */
13671506 uint8_t vpstat1_subcode; /* vp_status=1 subcode */
13681507 uint8_t flags;
....@@ -1384,21 +1523,22 @@
13841523 uint16_t bbcr;
13851524 uint8_t reserved_5[6];
13861525 } f1;
1387
- struct { /* format 2: N2N direct connect */
1388
- uint8_t vpstat1_subcode;
1389
- uint8_t flags;
1390
- uint16_t rsv6;
1391
- uint8_t rsv2[12];
1526
+ struct _f2 { /* format 2: N2N direct connect */
1527
+ uint8_t vpstat1_subcode;
1528
+ uint8_t flags;
1529
+ uint16_t fip_flags;
1530
+ uint8_t rsv2[12];
13921531
1393
- uint8_t ls_rjt_vendor;
1394
- uint8_t ls_rjt_explanation;
1395
- uint8_t ls_rjt_reason;
1396
- uint8_t rsv3[5];
1532
+ uint8_t ls_rjt_vendor;
1533
+ uint8_t ls_rjt_explanation;
1534
+ uint8_t ls_rjt_reason;
1535
+ uint8_t rsv3[5];
13971536
1398
- uint8_t port_name[8];
1399
- uint8_t node_name[8];
1400
- uint8_t remote_nport_id[4];
1401
- uint32_t reserved_5;
1537
+ uint8_t port_name[8];
1538
+ uint8_t node_name[8];
1539
+ uint16_t bbcr;
1540
+ uint8_t reserved_5[2];
1541
+ uint8_t remote_nport_id[4];
14021542 } f2;
14031543 } u;
14041544 };
....@@ -1411,20 +1551,20 @@
14111551 uint8_t entry_status; /* Entry Status. */
14121552
14131553 uint32_t handle; /* System handle. */
1414
- uint16_t comp_status; /* Completion status. */
1415
- uint16_t timeout; /* timeout */
1416
- uint16_t adim_tagging_mode;
1554
+ __le16 comp_status; /* Completion status. */
1555
+ __le16 timeout; /* timeout */
1556
+ __le16 adim_tagging_mode;
14171557
1418
- uint16_t vfport_id;
1558
+ __le16 vfport_id;
14191559 uint32_t exch_addr;
14201560
1421
- uint16_t nport_handle; /* N_PORT handle. */
1422
- uint16_t control_flags;
1561
+ __le16 nport_handle; /* N_PORT handle. */
1562
+ __le16 control_flags;
14231563 uint32_t io_parameter_0;
14241564 uint32_t io_parameter_1;
1425
- uint32_t tx_address[2]; /* Data segment 0 address. */
1565
+ __le64 tx_address __packed; /* Data segment 0 address. */
14261566 uint32_t tx_len; /* Data segment 0 length. */
1427
- uint32_t rx_address[2]; /* Data segment 1 address. */
1567
+ __le64 rx_address __packed; /* Data segment 1 address. */
14281568 uint32_t rx_len; /* Data segment 1 length. */
14291569 };
14301570
....@@ -1434,13 +1574,13 @@
14341574
14351575 struct qla_fdt_layout {
14361576 uint8_t sig[4];
1437
- uint16_t version;
1438
- uint16_t len;
1439
- uint16_t checksum;
1577
+ __le16 version;
1578
+ __le16 len;
1579
+ __le16 checksum;
14401580 uint8_t unused1[2];
14411581 uint8_t model[16];
1442
- uint16_t man_id;
1443
- uint16_t id;
1582
+ __le16 man_id;
1583
+ __le16 id;
14441584 uint8_t flags;
14451585 uint8_t erase_cmd;
14461586 uint8_t alt_erase_cmd;
....@@ -1449,15 +1589,15 @@
14491589 uint8_t wrt_sts_reg_cmd;
14501590 uint8_t unprotect_sec_cmd;
14511591 uint8_t read_man_id_cmd;
1452
- uint32_t block_size;
1453
- uint32_t alt_block_size;
1454
- uint32_t flash_size;
1455
- uint32_t wrt_enable_data;
1592
+ __le32 block_size;
1593
+ __le32 alt_block_size;
1594
+ __le32 flash_size;
1595
+ __le32 wrt_enable_data;
14561596 uint8_t read_id_addr_len;
14571597 uint8_t wrt_disable_bits;
14581598 uint8_t read_dev_id_len;
14591599 uint8_t chip_erase_cmd;
1460
- uint16_t read_timeout;
1600
+ __le16 read_timeout;
14611601 uint8_t protect_sec_cmd;
14621602 uint8_t unused2[65];
14631603 };
....@@ -1466,18 +1606,11 @@
14661606
14671607 struct qla_flt_location {
14681608 uint8_t sig[4];
1469
- uint16_t start_lo;
1470
- uint16_t start_hi;
1609
+ __le16 start_lo;
1610
+ __le16 start_hi;
14711611 uint8_t version;
14721612 uint8_t unused[5];
1473
- uint16_t checksum;
1474
-};
1475
-
1476
-struct qla_flt_header {
1477
- uint16_t version;
1478
- uint16_t length;
1479
- uint16_t checksum;
1480
- uint16_t unused;
1613
+ __le16 checksum;
14811614 };
14821615
14831616 #define FLT_REG_FW 0x01
....@@ -1515,29 +1648,59 @@
15151648 #define FLT_REG_VPD_SEC_27XX_2 0xD8
15161649 #define FLT_REG_VPD_SEC_27XX_3 0xDA
15171650
1651
+/* 28xx */
1652
+#define FLT_REG_AUX_IMG_PRI_28XX 0x125
1653
+#define FLT_REG_AUX_IMG_SEC_28XX 0x126
1654
+#define FLT_REG_VPD_SEC_28XX_0 0x10C
1655
+#define FLT_REG_VPD_SEC_28XX_1 0x10E
1656
+#define FLT_REG_VPD_SEC_28XX_2 0x110
1657
+#define FLT_REG_VPD_SEC_28XX_3 0x112
1658
+#define FLT_REG_NVRAM_SEC_28XX_0 0x10D
1659
+#define FLT_REG_NVRAM_SEC_28XX_1 0x10F
1660
+#define FLT_REG_NVRAM_SEC_28XX_2 0x111
1661
+#define FLT_REG_NVRAM_SEC_28XX_3 0x113
1662
+#define FLT_REG_MPI_PRI_28XX 0xD3
1663
+#define FLT_REG_MPI_SEC_28XX 0xF0
1664
+#define FLT_REG_PEP_PRI_28XX 0xD1
1665
+#define FLT_REG_PEP_SEC_28XX 0xF1
1666
+
15181667 struct qla_flt_region {
1519
- uint32_t code;
1520
- uint32_t size;
1521
- uint32_t start;
1522
- uint32_t end;
1668
+ __le16 code;
1669
+ uint8_t attribute;
1670
+ uint8_t reserved;
1671
+ __le32 size;
1672
+ __le32 start;
1673
+ __le32 end;
15231674 };
1675
+
1676
+struct qla_flt_header {
1677
+ __le16 version;
1678
+ __le16 length;
1679
+ __le16 checksum;
1680
+ __le16 unused;
1681
+ struct qla_flt_region region[0];
1682
+};
1683
+
1684
+#define FLT_REGION_SIZE 16
1685
+#define FLT_MAX_REGIONS 0xFF
1686
+#define FLT_REGIONS_SIZE (FLT_REGION_SIZE * FLT_MAX_REGIONS)
15241687
15251688 /* Flash NPIV Configuration Table ********************************************/
15261689
15271690 struct qla_npiv_header {
15281691 uint8_t sig[2];
1529
- uint16_t version;
1530
- uint16_t entries;
1531
- uint16_t unused[4];
1532
- uint16_t checksum;
1692
+ __le16 version;
1693
+ __le16 entries;
1694
+ __le16 unused[4];
1695
+ __le16 checksum;
15331696 };
15341697
15351698 struct qla_npiv_entry {
1536
- uint16_t flags;
1537
- uint16_t vf_id;
1699
+ __le16 flags;
1700
+ __le16 vf_id;
15381701 uint8_t q_qos;
15391702 uint8_t f_qos;
1540
- uint16_t unused1;
1703
+ __le16 unused1;
15411704 uint8_t port_name[WWN_SIZE];
15421705 uint8_t node_name[WWN_SIZE];
15431706 };
....@@ -1567,7 +1730,7 @@
15671730
15681731 uint32_t handle;
15691732
1570
- uint16_t options;
1733
+ __le16 options;
15711734 #define VCO_DONT_UPDATE_FW BIT_0
15721735 #define VCO_FORCE_UPDATE BIT_1
15731736 #define VCO_DONT_RESET_UPDATE BIT_2
....@@ -1575,21 +1738,20 @@
15751738 #define VCO_END_OF_DATA BIT_14
15761739 #define VCO_ENABLE_DSD BIT_15
15771740
1578
- uint16_t reserved_1;
1741
+ __le16 reserved_1;
15791742
1580
- uint16_t data_seg_cnt;
1581
- uint16_t reserved_2[3];
1743
+ __le16 data_seg_cnt;
1744
+ __le16 reserved_2[3];
15821745
1583
- uint32_t fw_ver;
1584
- uint32_t exchange_address;
1746
+ __le32 fw_ver;
1747
+ __le32 exchange_address;
15851748
1586
- uint32_t reserved_3[3];
1587
- uint32_t fw_size;
1588
- uint32_t fw_seq_size;
1589
- uint32_t relative_offset;
1749
+ __le32 reserved_3[3];
1750
+ __le32 fw_size;
1751
+ __le32 fw_seq_size;
1752
+ __le32 relative_offset;
15901753
1591
- uint32_t dseg_address[2];
1592
- uint32_t dseg_length;
1754
+ struct dsd64 dsd;
15931755 };
15941756
15951757 struct verify_chip_rsp_84xx {
....@@ -1600,22 +1762,22 @@
16001762
16011763 uint32_t handle;
16021764
1603
- uint16_t comp_status;
1765
+ __le16 comp_status;
16041766 #define CS_VCS_CHIP_FAILURE 0x3
16051767 #define CS_VCS_BAD_EXCHANGE 0x8
16061768 #define CS_VCS_SEQ_COMPLETEi 0x40
16071769
1608
- uint16_t failure_code;
1770
+ __le16 failure_code;
16091771 #define VFC_CHECKSUM_ERROR 0x1
16101772 #define VFC_INVALID_LEN 0x2
16111773 #define VFC_ALREADY_IN_PROGRESS 0x8
16121774
1613
- uint16_t reserved_1[4];
1775
+ __le16 reserved_1[4];
16141776
1615
- uint32_t fw_ver;
1616
- uint32_t exchange_address;
1777
+ __le32 fw_ver;
1778
+ __le32 exchange_address;
16171779
1618
- uint32_t reserved_2[6];
1780
+ __le32 reserved_2[6];
16191781 };
16201782
16211783 #define ACCESS_CHIP_IOCB_TYPE 0x2B
....@@ -1627,27 +1789,26 @@
16271789
16281790 uint32_t handle;
16291791
1630
- uint16_t options;
1792
+ __le16 options;
16311793 #define ACO_DUMP_MEMORY 0x0
16321794 #define ACO_LOAD_MEMORY 0x1
16331795 #define ACO_CHANGE_CONFIG_PARAM 0x2
16341796 #define ACO_REQUEST_INFO 0x3
16351797
1636
- uint16_t reserved1;
1798
+ __le16 reserved1;
16371799
1638
- uint16_t dseg_count;
1639
- uint16_t reserved2[3];
1800
+ __le16 dseg_count;
1801
+ __le16 reserved2[3];
16401802
1641
- uint32_t parameter1;
1642
- uint32_t parameter2;
1643
- uint32_t parameter3;
1803
+ __le32 parameter1;
1804
+ __le32 parameter2;
1805
+ __le32 parameter3;
16441806
1645
- uint32_t reserved3[3];
1646
- uint32_t total_byte_cnt;
1647
- uint32_t reserved4;
1807
+ __le32 reserved3[3];
1808
+ __le32 total_byte_cnt;
1809
+ __le32 reserved4;
16481810
1649
- uint32_t dseg_address[2];
1650
- uint32_t dseg_length;
1811
+ struct dsd64 dsd;
16511812 };
16521813
16531814 struct access_chip_rsp_84xx {
....@@ -1658,11 +1819,11 @@
16581819
16591820 uint32_t handle;
16601821
1661
- uint16_t comp_status;
1662
- uint16_t failure_code;
1663
- uint32_t residual_count;
1822
+ __le16 comp_status;
1823
+ __le16 failure_code;
1824
+ __le32 residual_count;
16641825
1665
- uint32_t reserved[12];
1826
+ __le32 reserved[12];
16661827 };
16671828
16681829 /* 81XX Support **************************************************************/
....@@ -1707,59 +1868,62 @@
17071868
17081869 /* LR Distance bit positions */
17091870 #define LR_DIST_NV_POS 2
1871
+#define LR_DIST_NV_MASK 0xf
17101872 #define LR_DIST_FW_POS 12
1711
-#define LR_DIST_FW_SHIFT (LR_DIST_FW_POS - LR_DIST_NV_POS)
1712
-#define LR_DIST_FW_FIELD(x) ((x) << LR_DIST_FW_SHIFT & 0xf000)
1873
+
1874
+/* FAC semaphore defines */
1875
+#define FAC_SEMAPHORE_UNLOCK 0
1876
+#define FAC_SEMAPHORE_LOCK 1
17131877
17141878 struct nvram_81xx {
17151879 /* NVRAM header. */
17161880 uint8_t id[4];
1717
- uint16_t nvram_version;
1718
- uint16_t reserved_0;
1881
+ __le16 nvram_version;
1882
+ __le16 reserved_0;
17191883
17201884 /* Firmware Initialization Control Block. */
1721
- uint16_t version;
1722
- uint16_t reserved_1;
1723
- uint16_t frame_payload_size;
1724
- uint16_t execution_throttle;
1725
- uint16_t exchange_count;
1726
- uint16_t reserved_2;
1885
+ __le16 version;
1886
+ __le16 reserved_1;
1887
+ __le16 frame_payload_size;
1888
+ __le16 execution_throttle;
1889
+ __le16 exchange_count;
1890
+ __le16 reserved_2;
17271891
17281892 uint8_t port_name[WWN_SIZE];
17291893 uint8_t node_name[WWN_SIZE];
17301894
1731
- uint16_t login_retry_count;
1732
- uint16_t reserved_3;
1733
- uint16_t interrupt_delay_timer;
1734
- uint16_t login_timeout;
1895
+ __le16 login_retry_count;
1896
+ __le16 reserved_3;
1897
+ __le16 interrupt_delay_timer;
1898
+ __le16 login_timeout;
17351899
1736
- uint32_t firmware_options_1;
1737
- uint32_t firmware_options_2;
1738
- uint32_t firmware_options_3;
1900
+ __le32 firmware_options_1;
1901
+ __le32 firmware_options_2;
1902
+ __le32 firmware_options_3;
17391903
1740
- uint16_t reserved_4[4];
1904
+ __le16 reserved_4[4];
17411905
17421906 /* Offset 64. */
17431907 uint8_t enode_mac[6];
1744
- uint16_t reserved_5[5];
1908
+ __le16 reserved_5[5];
17451909
17461910 /* Offset 80. */
1747
- uint16_t reserved_6[24];
1911
+ __le16 reserved_6[24];
17481912
17491913 /* Offset 128. */
1750
- uint16_t ex_version;
1914
+ __le16 ex_version;
17511915 uint8_t prio_fcf_matching_flags;
17521916 uint8_t reserved_6_1[3];
1753
- uint16_t pri_fcf_vlan_id;
1917
+ __le16 pri_fcf_vlan_id;
17541918 uint8_t pri_fcf_fabric_name[8];
1755
- uint16_t reserved_6_2[7];
1919
+ __le16 reserved_6_2[7];
17561920 uint8_t spma_mac_addr[6];
1757
- uint16_t reserved_6_3[14];
1921
+ __le16 reserved_6_3[14];
17581922
17591923 /* Offset 192. */
1760
- uint8_t min_link_speed;
1924
+ uint8_t min_supported_speed;
17611925 uint8_t reserved_7_0;
1762
- uint16_t reserved_7[31];
1926
+ __le16 reserved_7[31];
17631927
17641928 /*
17651929 * BIT 0 = Enable spinup delay
....@@ -1792,26 +1956,26 @@
17921956 * BIT 25 = Temp WWPN
17931957 * BIT 26-31 =
17941958 */
1795
- uint32_t host_p;
1959
+ __le32 host_p;
17961960
17971961 uint8_t alternate_port_name[WWN_SIZE];
17981962 uint8_t alternate_node_name[WWN_SIZE];
17991963
18001964 uint8_t boot_port_name[WWN_SIZE];
1801
- uint16_t boot_lun_number;
1802
- uint16_t reserved_8;
1965
+ __le16 boot_lun_number;
1966
+ __le16 reserved_8;
18031967
18041968 uint8_t alt1_boot_port_name[WWN_SIZE];
1805
- uint16_t alt1_boot_lun_number;
1806
- uint16_t reserved_9;
1969
+ __le16 alt1_boot_lun_number;
1970
+ __le16 reserved_9;
18071971
18081972 uint8_t alt2_boot_port_name[WWN_SIZE];
1809
- uint16_t alt2_boot_lun_number;
1810
- uint16_t reserved_10;
1973
+ __le16 alt2_boot_lun_number;
1974
+ __le16 reserved_10;
18111975
18121976 uint8_t alt3_boot_port_name[WWN_SIZE];
1813
- uint16_t alt3_boot_lun_number;
1814
- uint16_t reserved_11;
1977
+ __le16 alt3_boot_lun_number;
1978
+ __le16 reserved_11;
18151979
18161980 /*
18171981 * BIT 0 = Selective Login
....@@ -1823,60 +1987,63 @@
18231987 * BIT 6 = Reserved
18241988 * BIT 7-31 =
18251989 */
1826
- uint32_t efi_parameters;
1990
+ __le32 efi_parameters;
18271991
18281992 uint8_t reset_delay;
18291993 uint8_t reserved_12;
1830
- uint16_t reserved_13;
1994
+ __le16 reserved_13;
18311995
1832
- uint16_t boot_id_number;
1833
- uint16_t reserved_14;
1996
+ __le16 boot_id_number;
1997
+ __le16 reserved_14;
18341998
1835
- uint16_t max_luns_per_target;
1836
- uint16_t reserved_15;
1999
+ __le16 max_luns_per_target;
2000
+ __le16 reserved_15;
18372001
1838
- uint16_t port_down_retry_count;
1839
- uint16_t link_down_timeout;
2002
+ __le16 port_down_retry_count;
2003
+ __le16 link_down_timeout;
18402004
18412005 /* FCode parameters. */
1842
- uint16_t fcode_parameter;
2006
+ __le16 fcode_parameter;
18432007
1844
- uint16_t reserved_16[3];
2008
+ __le16 reserved_16[3];
18452009
18462010 /* Offset 352. */
18472011 uint8_t reserved_17[4];
1848
- uint16_t reserved_18[5];
2012
+ __le16 reserved_18[5];
18492013 uint8_t reserved_19[2];
1850
- uint16_t reserved_20[8];
2014
+ __le16 reserved_20[8];
18512015
18522016 /* Offset 384. */
18532017 uint8_t reserved_21[16];
1854
- uint16_t reserved_22[3];
2018
+ __le16 reserved_22[3];
18552019
18562020 /* Offset 406 (0x196) Enhanced Features
18572021 * BIT 0 = Extended BB credits for LR
18582022 * BIT 1 = Virtual Fabric Enable
18592023 * BIT 2-5 = Distance Support if BIT 0 is on
1860
- * BIT 6-15 = Unused
2024
+ * BIT 6 = Prefer FCP
2025
+ * BIT 7 = SCM Disabled if BIT is set (1)
2026
+ * BIT 8-15 = Unused
18612027 */
18622028 uint16_t enhanced_features;
2029
+
18632030 uint16_t reserved_24[4];
18642031
18652032 /* Offset 416. */
1866
- uint16_t reserved_25[32];
2033
+ __le16 reserved_25[32];
18672034
18682035 /* Offset 480. */
18692036 uint8_t model_name[16];
18702037
18712038 /* Offset 496. */
1872
- uint16_t feature_mask_l;
1873
- uint16_t feature_mask_h;
1874
- uint16_t reserved_26[2];
2039
+ __le16 feature_mask_l;
2040
+ __le16 feature_mask_h;
2041
+ __le16 reserved_26[2];
18752042
1876
- uint16_t subsystem_vendor_id;
1877
- uint16_t subsystem_device_id;
2043
+ __le16 subsystem_vendor_id;
2044
+ __le16 subsystem_device_id;
18782045
1879
- uint32_t checksum;
2046
+ __le32 checksum;
18802047 };
18812048
18822049 /*
....@@ -1885,44 +2052,44 @@
18852052 */
18862053 #define ICB_VERSION 1
18872054 struct init_cb_81xx {
1888
- uint16_t version;
1889
- uint16_t reserved_1;
2055
+ __le16 version;
2056
+ __le16 reserved_1;
18902057
1891
- uint16_t frame_payload_size;
1892
- uint16_t execution_throttle;
1893
- uint16_t exchange_count;
2058
+ __le16 frame_payload_size;
2059
+ __le16 execution_throttle;
2060
+ __le16 exchange_count;
18942061
1895
- uint16_t reserved_2;
2062
+ __le16 reserved_2;
18962063
18972064 uint8_t port_name[WWN_SIZE]; /* Big endian. */
18982065 uint8_t node_name[WWN_SIZE]; /* Big endian. */
18992066
1900
- uint16_t response_q_inpointer;
1901
- uint16_t request_q_outpointer;
2067
+ __le16 response_q_inpointer;
2068
+ __le16 request_q_outpointer;
19022069
1903
- uint16_t login_retry_count;
2070
+ __le16 login_retry_count;
19042071
1905
- uint16_t prio_request_q_outpointer;
2072
+ __le16 prio_request_q_outpointer;
19062073
1907
- uint16_t response_q_length;
1908
- uint16_t request_q_length;
2074
+ __le16 response_q_length;
2075
+ __le16 request_q_length;
19092076
1910
- uint16_t reserved_3;
2077
+ __le16 reserved_3;
19112078
1912
- uint16_t prio_request_q_length;
2079
+ __le16 prio_request_q_length;
19132080
1914
- uint32_t request_q_address[2];
1915
- uint32_t response_q_address[2];
1916
- uint32_t prio_request_q_address[2];
2081
+ __le64 request_q_address __packed;
2082
+ __le64 response_q_address __packed;
2083
+ __le64 prio_request_q_address __packed;
19172084
19182085 uint8_t reserved_4[8];
19192086
1920
- uint16_t atio_q_inpointer;
1921
- uint16_t atio_q_length;
1922
- uint32_t atio_q_address[2];
2087
+ __le16 atio_q_inpointer;
2088
+ __le16 atio_q_length;
2089
+ __le64 atio_q_address __packed;
19232090
1924
- uint16_t interrupt_delay_timer; /* 100us increments. */
1925
- uint16_t login_timeout;
2091
+ __le16 interrupt_delay_timer; /* 100us increments. */
2092
+ __le16 login_timeout;
19262093
19272094 /*
19282095 * BIT 0-3 = Reserved
....@@ -1935,7 +2102,7 @@
19352102 * BIT 14 = Node Name Option
19362103 * BIT 15-31 = Reserved
19372104 */
1938
- uint32_t firmware_options_1;
2105
+ __le32 firmware_options_1;
19392106
19402107 /*
19412108 * BIT 0 = Operation Mode bit 0
....@@ -1953,7 +2120,7 @@
19532120 * BIT 14 = Enable Target PRLI Control
19542121 * BIT 15-31 = Reserved
19552122 */
1956
- uint32_t firmware_options_2;
2123
+ __le32 firmware_options_2;
19572124
19582125 /*
19592126 * BIT 0-3 = Reserved
....@@ -1974,7 +2141,7 @@
19742141 * BIT 28 = SPMA selection bit 1
19752142 * BIT 30-31 = Reserved
19762143 */
1977
- uint32_t firmware_options_3;
2144
+ __le32 firmware_options_3;
19782145
19792146 uint8_t reserved_5[8];
19802147
....@@ -2005,6 +2172,8 @@
20052172
20062173 #define FARX_ACCESS_FLASH_CONF_81XX 0x7FFD0000
20072174 #define FARX_ACCESS_FLASH_DATA_81XX 0x7F800000
2175
+#define FARX_ACCESS_FLASH_CONF_28XX 0x7FFD0000
2176
+#define FARX_ACCESS_FLASH_DATA_28XX 0x7F7D0000
20082177
20092178 /* FCP priority config defines *************************************/
20102179 /* operations */
....@@ -2050,9 +2219,9 @@
20502219 #define FCP_PRIO_ATTR_ENABLE 0x1
20512220 #define FCP_PRIO_ATTR_PERSIST 0x2
20522221 uint8_t reserved; /* Reserved for future use */
2053
-#define FCP_PRIO_CFG_HDR_SIZE 0x10
2054
- struct qla_fcp_prio_entry entry[1]; /* fcp priority entries */
2055
-#define FCP_PRIO_CFG_ENTRY_SIZE 0x20
2222
+#define FCP_PRIO_CFG_HDR_SIZE offsetof(struct qla_fcp_prio_cfg, entry)
2223
+ struct qla_fcp_prio_entry entry[1023]; /* fcp priority entries */
2224
+ uint8_t reserved2[16];
20562225 };
20572226
20582227 #define FCP_PRIO_CFG_SIZE (32*1024) /* fcp prio data per port*/
....@@ -2079,6 +2248,9 @@
20792248 #define FA_NPIV_CONF1_ADDR_81 0xD2000
20802249
20812250 /* 83XX Flash locations -- occupies second 8MB region. */
2082
-#define FA_FLASH_LAYOUT_ADDR_83 0xFC400
2251
+#define FA_FLASH_LAYOUT_ADDR_83 (0x3F1000/4)
2252
+#define FA_FLASH_LAYOUT_ADDR_28 (0x11000/4)
2253
+
2254
+#define NVRAM_DUAL_FCP_NVME_FLAG_OFFSET 0x196
20832255
20842256 #endif