| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * driver for Microsemi PQI-based storage controllers |
|---|
| 3 | | - * Copyright (c) 2016-2017 Microsemi Corporation |
|---|
| 4 | + * Copyright (c) 2019-2020 Microchip Technology Inc. and its subsidiaries |
|---|
| 5 | + * Copyright (c) 2016-2018 Microsemi Corporation |
|---|
| 4 | 6 | * Copyright (c) 2016 PMC-Sierra, Inc. |
|---|
| 5 | 7 | * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
|---|
| 13 | | - * NON INFRINGEMENT. See the GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * Questions/Comments/Bugfixes to esc.storagedev@microsemi.com |
|---|
| 8 | + * Questions/Comments/Bugfixes to storagedev@microchip.com |
|---|
| 16 | 9 | * |
|---|
| 17 | 10 | */ |
|---|
| 18 | 11 | |
|---|
| .. | .. |
|---|
| 20 | 13 | |
|---|
| 21 | 14 | #if !defined(_SMARTPQI_H) |
|---|
| 22 | 15 | #define _SMARTPQI_H |
|---|
| 16 | + |
|---|
| 17 | +#include <scsi/scsi_host.h> |
|---|
| 18 | +#include <linux/bsg-lib.h> |
|---|
| 23 | 19 | |
|---|
| 24 | 20 | #pragma pack(1) |
|---|
| 25 | 21 | |
|---|
| .. | .. |
|---|
| 96 | 92 | */ |
|---|
| 97 | 93 | struct pqi_device_registers pqi_registers; /* 4000h */ |
|---|
| 98 | 94 | }; |
|---|
| 95 | + |
|---|
| 96 | +#if ((HZ) < 1000) |
|---|
| 97 | +#define PQI_HZ 1000 |
|---|
| 98 | +#else |
|---|
| 99 | +#define PQI_HZ (HZ) |
|---|
| 100 | +#endif |
|---|
| 99 | 101 | |
|---|
| 100 | 102 | #define PQI_DEVICE_REGISTERS_OFFSET 0x4000 |
|---|
| 101 | 103 | |
|---|
| .. | .. |
|---|
| 274 | 276 | u8 reserved4 : 2; |
|---|
| 275 | 277 | u8 additional_cdb_bytes_usage : 3; |
|---|
| 276 | 278 | u8 reserved5 : 3; |
|---|
| 277 | | - u8 cdb[32]; |
|---|
| 279 | + u8 cdb[16]; |
|---|
| 280 | + u8 reserved6[12]; |
|---|
| 281 | + __le32 timeout; |
|---|
| 278 | 282 | struct pqi_sg_descriptor |
|---|
| 279 | 283 | sg_descriptors[PQI_MAX_EMBEDDED_SG_DESCRIPTORS]; |
|---|
| 280 | 284 | }; |
|---|
| .. | .. |
|---|
| 347 | 351 | |
|---|
| 348 | 352 | #define PQI_MAX_EVENT_DESCRIPTORS 255 |
|---|
| 349 | 353 | |
|---|
| 354 | +#define PQI_EVENT_OFA_MEMORY_ALLOCATION 0x0 |
|---|
| 355 | +#define PQI_EVENT_OFA_QUIESCE 0x1 |
|---|
| 356 | +#define PQI_EVENT_OFA_CANCELLED 0x2 |
|---|
| 357 | + |
|---|
| 350 | 358 | struct pqi_event_response { |
|---|
| 351 | 359 | struct pqi_iu_header header; |
|---|
| 352 | 360 | u8 event_type; |
|---|
| 353 | 361 | u8 reserved2 : 7; |
|---|
| 354 | | - u8 request_acknowlege : 1; |
|---|
| 362 | + u8 request_acknowledge : 1; |
|---|
| 355 | 363 | __le16 event_id; |
|---|
| 356 | 364 | __le32 additional_event_id; |
|---|
| 357 | | - u8 data[16]; |
|---|
| 365 | + union { |
|---|
| 366 | + struct { |
|---|
| 367 | + __le32 bytes_requested; |
|---|
| 368 | + u8 reserved[12]; |
|---|
| 369 | + } ofa_memory_allocation; |
|---|
| 370 | + |
|---|
| 371 | + struct { |
|---|
| 372 | + __le16 reason; /* reason for cancellation */ |
|---|
| 373 | + u8 reserved[14]; |
|---|
| 374 | + } ofa_cancelled; |
|---|
| 375 | + } data; |
|---|
| 358 | 376 | }; |
|---|
| 359 | 377 | |
|---|
| 360 | 378 | struct pqi_event_acknowledge_request { |
|---|
| .. | .. |
|---|
| 369 | 387 | struct pqi_iu_header header; |
|---|
| 370 | 388 | __le16 request_id; |
|---|
| 371 | 389 | __le16 nexus_id; |
|---|
| 372 | | - u8 reserved[4]; |
|---|
| 390 | + u8 reserved[2]; |
|---|
| 391 | + __le16 timeout; |
|---|
| 373 | 392 | u8 lun_number[8]; |
|---|
| 374 | 393 | __le16 protocol_specific; |
|---|
| 375 | 394 | __le16 outbound_queue_id_to_manage; |
|---|
| .. | .. |
|---|
| 387 | 406 | __le16 nexus_id; |
|---|
| 388 | 407 | u8 additional_response_info[3]; |
|---|
| 389 | 408 | u8 response_code; |
|---|
| 409 | +}; |
|---|
| 410 | + |
|---|
| 411 | +struct pqi_vendor_general_request { |
|---|
| 412 | + struct pqi_iu_header header; |
|---|
| 413 | + __le16 request_id; |
|---|
| 414 | + __le16 function_code; |
|---|
| 415 | + union { |
|---|
| 416 | + struct { |
|---|
| 417 | + __le16 first_section; |
|---|
| 418 | + __le16 last_section; |
|---|
| 419 | + u8 reserved[48]; |
|---|
| 420 | + } config_table_update; |
|---|
| 421 | + |
|---|
| 422 | + struct { |
|---|
| 423 | + __le64 buffer_address; |
|---|
| 424 | + __le32 buffer_length; |
|---|
| 425 | + u8 reserved[40]; |
|---|
| 426 | + } ofa_memory_allocation; |
|---|
| 427 | + } data; |
|---|
| 428 | +}; |
|---|
| 429 | + |
|---|
| 430 | +struct pqi_vendor_general_response { |
|---|
| 431 | + struct pqi_iu_header header; |
|---|
| 432 | + __le16 request_id; |
|---|
| 433 | + __le16 function_code; |
|---|
| 434 | + __le16 status; |
|---|
| 435 | + u8 reserved[2]; |
|---|
| 436 | +}; |
|---|
| 437 | + |
|---|
| 438 | +#define PQI_VENDOR_GENERAL_CONFIG_TABLE_UPDATE 0 |
|---|
| 439 | +#define PQI_VENDOR_GENERAL_HOST_MEMORY_UPDATE 1 |
|---|
| 440 | + |
|---|
| 441 | +#define PQI_OFA_VERSION 1 |
|---|
| 442 | +#define PQI_OFA_SIGNATURE "OFA_QRM" |
|---|
| 443 | +#define PQI_OFA_MAX_SG_DESCRIPTORS 64 |
|---|
| 444 | + |
|---|
| 445 | +#define PQI_OFA_MEMORY_DESCRIPTOR_LENGTH \ |
|---|
| 446 | + (offsetof(struct pqi_ofa_memory, sg_descriptor) + \ |
|---|
| 447 | + (PQI_OFA_MAX_SG_DESCRIPTORS * sizeof(struct pqi_sg_descriptor))) |
|---|
| 448 | + |
|---|
| 449 | +struct pqi_ofa_memory { |
|---|
| 450 | + __le64 signature; /* "OFA_QRM" */ |
|---|
| 451 | + __le16 version; /* version of this struct (1 = 1st version) */ |
|---|
| 452 | + u8 reserved[62]; |
|---|
| 453 | + __le32 bytes_allocated; /* total allocated memory in bytes */ |
|---|
| 454 | + __le16 num_memory_descriptors; |
|---|
| 455 | + u8 reserved1[2]; |
|---|
| 456 | + struct pqi_sg_descriptor sg_descriptor[1]; |
|---|
| 390 | 457 | }; |
|---|
| 391 | 458 | |
|---|
| 392 | 459 | struct pqi_aio_error_info { |
|---|
| .. | .. |
|---|
| 419 | 486 | #define PQI_REQUEST_IU_GENERAL_ADMIN 0x60 |
|---|
| 420 | 487 | #define PQI_REQUEST_IU_REPORT_VENDOR_EVENT_CONFIG 0x72 |
|---|
| 421 | 488 | #define PQI_REQUEST_IU_SET_VENDOR_EVENT_CONFIG 0x73 |
|---|
| 489 | +#define PQI_REQUEST_IU_VENDOR_GENERAL 0x75 |
|---|
| 422 | 490 | #define PQI_REQUEST_IU_ACKNOWLEDGE_VENDOR_EVENT 0xf6 |
|---|
| 423 | 491 | |
|---|
| 424 | 492 | #define PQI_RESPONSE_IU_GENERAL_MANAGEMENT 0x81 |
|---|
| .. | .. |
|---|
| 430 | 498 | #define PQI_RESPONSE_IU_AIO_PATH_IO_ERROR 0xf3 |
|---|
| 431 | 499 | #define PQI_RESPONSE_IU_AIO_PATH_DISABLED 0xf4 |
|---|
| 432 | 500 | #define PQI_RESPONSE_IU_VENDOR_EVENT 0xf5 |
|---|
| 501 | +#define PQI_RESPONSE_IU_VENDOR_GENERAL 0xf7 |
|---|
| 433 | 502 | |
|---|
| 434 | 503 | #define PQI_GENERAL_ADMIN_FUNCTION_REPORT_DEVICE_CAPABILITY 0x0 |
|---|
| 435 | 504 | #define PQI_GENERAL_ADMIN_FUNCTION_CREATE_IQ 0x10 |
|---|
| .. | .. |
|---|
| 492 | 561 | #define PQI_EVENT_TYPE_HARDWARE 0x2 |
|---|
| 493 | 562 | #define PQI_EVENT_TYPE_PHYSICAL_DEVICE 0x4 |
|---|
| 494 | 563 | #define PQI_EVENT_TYPE_LOGICAL_DEVICE 0x5 |
|---|
| 564 | +#define PQI_EVENT_TYPE_OFA 0xfb |
|---|
| 495 | 565 | #define PQI_EVENT_TYPE_AIO_STATE_CHANGE 0xfd |
|---|
| 496 | 566 | #define PQI_EVENT_TYPE_AIO_CONFIG_CHANGE 0xfe |
|---|
| 497 | 567 | |
|---|
| .. | .. |
|---|
| 556 | 626 | #define SOP_TASK_ATTRIBUTE_ACA 4 |
|---|
| 557 | 627 | |
|---|
| 558 | 628 | #define SOP_TMF_COMPLETE 0x0 |
|---|
| 629 | +#define SOP_TMF_REJECTED 0x4 |
|---|
| 559 | 630 | #define SOP_TMF_FUNCTION_SUCCEEDED 0x8 |
|---|
| 560 | 631 | |
|---|
| 561 | 632 | /* additional CDB bytes usage field codes */ |
|---|
| .. | .. |
|---|
| 644 | 715 | #define PQI_CONFIG_TABLE_MAX_LENGTH ((u16)~0) |
|---|
| 645 | 716 | |
|---|
| 646 | 717 | /* configuration table section IDs */ |
|---|
| 718 | +#define PQI_CONFIG_TABLE_ALL_SECTIONS (-1) |
|---|
| 647 | 719 | #define PQI_CONFIG_TABLE_SECTION_GENERAL_INFO 0 |
|---|
| 648 | 720 | #define PQI_CONFIG_TABLE_SECTION_FIRMWARE_FEATURES 1 |
|---|
| 649 | 721 | #define PQI_CONFIG_TABLE_SECTION_FIRMWARE_ERRATA 2 |
|---|
| 650 | 722 | #define PQI_CONFIG_TABLE_SECTION_DEBUG 3 |
|---|
| 651 | 723 | #define PQI_CONFIG_TABLE_SECTION_HEARTBEAT 4 |
|---|
| 724 | +#define PQI_CONFIG_TABLE_SECTION_SOFT_RESET 5 |
|---|
| 652 | 725 | |
|---|
| 653 | 726 | struct pqi_config_table { |
|---|
| 654 | 727 | u8 signature[8]; /* "CFGTABLE" */ |
|---|
| .. | .. |
|---|
| 680 | 753 | /* command */ |
|---|
| 681 | 754 | }; |
|---|
| 682 | 755 | |
|---|
| 756 | +struct pqi_config_table_firmware_features { |
|---|
| 757 | + struct pqi_config_table_section_header header; |
|---|
| 758 | + __le16 num_elements; |
|---|
| 759 | + u8 features_supported[]; |
|---|
| 760 | +/* u8 features_requested_by_host[]; */ |
|---|
| 761 | +/* u8 features_enabled[]; */ |
|---|
| 762 | +}; |
|---|
| 763 | + |
|---|
| 764 | +#define PQI_FIRMWARE_FEATURE_OFA 0 |
|---|
| 765 | +#define PQI_FIRMWARE_FEATURE_SMP 1 |
|---|
| 766 | +#define PQI_FIRMWARE_FEATURE_SOFT_RESET_HANDSHAKE 11 |
|---|
| 767 | +#define PQI_FIRMWARE_FEATURE_RAID_IU_TIMEOUT 13 |
|---|
| 768 | +#define PQI_FIRMWARE_FEATURE_TMF_IU_TIMEOUT 14 |
|---|
| 769 | + |
|---|
| 683 | 770 | struct pqi_config_table_debug { |
|---|
| 684 | 771 | struct pqi_config_table_section_header header; |
|---|
| 685 | 772 | __le32 scratchpad; |
|---|
| .. | .. |
|---|
| 688 | 775 | struct pqi_config_table_heartbeat { |
|---|
| 689 | 776 | struct pqi_config_table_section_header header; |
|---|
| 690 | 777 | __le32 heartbeat_counter; |
|---|
| 778 | +}; |
|---|
| 779 | + |
|---|
| 780 | +struct pqi_config_table_soft_reset { |
|---|
| 781 | + struct pqi_config_table_section_header header; |
|---|
| 782 | + u8 soft_reset_status; |
|---|
| 783 | +}; |
|---|
| 784 | + |
|---|
| 785 | +#define PQI_SOFT_RESET_INITIATE 0x1 |
|---|
| 786 | +#define PQI_SOFT_RESET_ABORT 0x2 |
|---|
| 787 | + |
|---|
| 788 | +enum pqi_soft_reset_status { |
|---|
| 789 | + RESET_INITIATE_FIRMWARE, |
|---|
| 790 | + RESET_INITIATE_DRIVER, |
|---|
| 791 | + RESET_ABORT, |
|---|
| 792 | + RESET_NORESPONSE, |
|---|
| 793 | + RESET_TIMEDOUT |
|---|
| 691 | 794 | }; |
|---|
| 692 | 795 | |
|---|
| 693 | 796 | union pqi_reset_register { |
|---|
| .. | .. |
|---|
| 724 | 827 | #define PQI_HBA_BUS 2 |
|---|
| 725 | 828 | #define PQI_EXTERNAL_RAID_VOLUME_BUS 3 |
|---|
| 726 | 829 | #define PQI_MAX_BUS PQI_EXTERNAL_RAID_VOLUME_BUS |
|---|
| 830 | +#define PQI_VSEP_CISS_BTL 379 |
|---|
| 727 | 831 | |
|---|
| 728 | 832 | struct report_lun_header { |
|---|
| 729 | 833 | __be32 list_length; |
|---|
| 730 | | - u8 extended_response; |
|---|
| 834 | + u8 flags; |
|---|
| 731 | 835 | u8 reserved[3]; |
|---|
| 732 | 836 | }; |
|---|
| 837 | + |
|---|
| 838 | +/* for flags field of struct report_lun_header */ |
|---|
| 839 | +#define CISS_REPORT_LOG_FLAG_UNIQUE_LUN_ID (1 << 0) |
|---|
| 840 | +#define CISS_REPORT_LOG_FLAG_QUEUE_DEPTH (1 << 5) |
|---|
| 841 | +#define CISS_REPORT_LOG_FLAG_DRIVE_TYPE_MIX (1 << 6) |
|---|
| 842 | + |
|---|
| 843 | +#define CISS_REPORT_PHYS_FLAG_OTHER (1 << 1) |
|---|
| 733 | 844 | |
|---|
| 734 | 845 | struct report_log_lun_extended_entry { |
|---|
| 735 | 846 | u8 lunid[8]; |
|---|
| .. | .. |
|---|
| 752 | 863 | }; |
|---|
| 753 | 864 | |
|---|
| 754 | 865 | /* for device_flags field of struct report_phys_lun_extended_entry */ |
|---|
| 755 | | -#define REPORT_PHYS_LUN_DEV_FLAG_AIO_ENABLED 0x8 |
|---|
| 866 | +#define CISS_REPORT_PHYS_DEV_FLAG_AIO_ENABLED 0x8 |
|---|
| 756 | 867 | |
|---|
| 757 | 868 | struct report_phys_lun_extended { |
|---|
| 758 | 869 | struct report_lun_header header; |
|---|
| .. | .. |
|---|
| 765 | 876 | u8 reserved[2]; |
|---|
| 766 | 877 | }; |
|---|
| 767 | 878 | |
|---|
| 768 | | -/* constants for flags field of RAID map */ |
|---|
| 879 | +/* for flags field of RAID map */ |
|---|
| 769 | 880 | #define RAID_MAP_ENCRYPTION_ENABLED 0x1 |
|---|
| 770 | 881 | |
|---|
| 771 | 882 | struct raid_map { |
|---|
| .. | .. |
|---|
| 810 | 921 | u8 volume_id[16]; |
|---|
| 811 | 922 | u8 is_physical_device : 1; |
|---|
| 812 | 923 | u8 is_external_raid_device : 1; |
|---|
| 924 | + u8 is_expander_smp_device : 1; |
|---|
| 813 | 925 | u8 target_lun_valid : 1; |
|---|
| 814 | 926 | u8 device_gone : 1; |
|---|
| 815 | 927 | u8 new_device : 1; |
|---|
| 816 | 928 | u8 keep_device : 1; |
|---|
| 817 | 929 | u8 volume_offline : 1; |
|---|
| 930 | + u8 rescan : 1; |
|---|
| 818 | 931 | bool aio_enabled; /* only valid for physical disks */ |
|---|
| 819 | 932 | bool in_reset; |
|---|
| 933 | + bool in_remove; |
|---|
| 820 | 934 | bool device_offline; |
|---|
| 821 | 935 | u8 vendor[8]; /* bytes 8-15 of inquiry data */ |
|---|
| 822 | 936 | u8 model[16]; /* bytes 16-31 of inquiry data */ |
|---|
| .. | .. |
|---|
| 829 | 943 | u8 active_path_index; |
|---|
| 830 | 944 | u8 path_map; |
|---|
| 831 | 945 | u8 bay; |
|---|
| 946 | + u8 box_index; |
|---|
| 947 | + u8 phys_box_on_bus; |
|---|
| 948 | + u8 phy_connected_dev_type; |
|---|
| 832 | 949 | u8 box[8]; |
|---|
| 833 | 950 | u16 phys_connector[8]; |
|---|
| 834 | 951 | bool raid_bypass_configured; /* RAID bypass configured */ |
|---|
| .. | .. |
|---|
| 846 | 963 | struct list_head delete_list_entry; |
|---|
| 847 | 964 | |
|---|
| 848 | 965 | atomic_t scsi_cmds_outstanding; |
|---|
| 966 | + atomic_t raid_bypass_cnt; |
|---|
| 849 | 967 | }; |
|---|
| 850 | 968 | |
|---|
| 851 | 969 | /* VPD inquiry pages */ |
|---|
| 852 | | -#define SCSI_VPD_SUPPORTED_PAGES 0x0 /* standard page */ |
|---|
| 853 | | -#define SCSI_VPD_DEVICE_ID 0x83 /* standard page */ |
|---|
| 854 | 970 | #define CISS_VPD_LV_DEVICE_GEOMETRY 0xc1 /* vendor-specific page */ |
|---|
| 855 | 971 | #define CISS_VPD_LV_BYPASS_STATUS 0xc2 /* vendor-specific page */ |
|---|
| 856 | 972 | #define CISS_VPD_LV_STATUS 0xc3 /* vendor-specific page */ |
|---|
| .. | .. |
|---|
| 916 | 1032 | struct pqi_sas_port { |
|---|
| 917 | 1033 | struct list_head port_list_entry; |
|---|
| 918 | 1034 | u64 sas_address; |
|---|
| 1035 | + struct pqi_scsi_dev *device; |
|---|
| 919 | 1036 | struct sas_port *port; |
|---|
| 920 | 1037 | int next_phy_index; |
|---|
| 921 | 1038 | struct list_head phy_list_head; |
|---|
| .. | .. |
|---|
| 947 | 1064 | struct list_head request_list_entry; |
|---|
| 948 | 1065 | }; |
|---|
| 949 | 1066 | |
|---|
| 950 | | -#define PQI_NUM_SUPPORTED_EVENTS 6 |
|---|
| 1067 | +#define PQI_NUM_SUPPORTED_EVENTS 7 |
|---|
| 951 | 1068 | |
|---|
| 952 | 1069 | struct pqi_event { |
|---|
| 953 | 1070 | bool pending; |
|---|
| 954 | 1071 | u8 event_type; |
|---|
| 955 | 1072 | __le16 event_id; |
|---|
| 956 | 1073 | __le32 additional_event_id; |
|---|
| 1074 | + __le32 ofa_bytes_requested; |
|---|
| 1075 | + __le16 ofa_cancel_reason; |
|---|
| 957 | 1076 | }; |
|---|
| 958 | 1077 | |
|---|
| 959 | 1078 | #define PQI_RESERVED_IO_SLOTS_LUN_RESET 1 |
|---|
| .. | .. |
|---|
| 967 | 1086 | unsigned int ctrl_id; |
|---|
| 968 | 1087 | struct pci_dev *pci_dev; |
|---|
| 969 | 1088 | char firmware_version[11]; |
|---|
| 1089 | + char serial_number[17]; |
|---|
| 1090 | + char model[17]; |
|---|
| 1091 | + char vendor[9]; |
|---|
| 970 | 1092 | void __iomem *iomem_base; |
|---|
| 971 | 1093 | struct pqi_ctrl_registers __iomem *registers; |
|---|
| 972 | 1094 | struct pqi_device_registers __iomem *pqi_registers; |
|---|
| .. | .. |
|---|
| 1014 | 1136 | |
|---|
| 1015 | 1137 | struct mutex scan_mutex; |
|---|
| 1016 | 1138 | struct mutex lun_reset_mutex; |
|---|
| 1139 | + struct mutex ofa_mutex; /* serialize ofa */ |
|---|
| 1017 | 1140 | bool controller_online; |
|---|
| 1018 | 1141 | bool block_requests; |
|---|
| 1142 | + bool block_device_reset; |
|---|
| 1143 | + bool in_ofa; |
|---|
| 1144 | + bool in_shutdown; |
|---|
| 1019 | 1145 | u8 inbound_spanning_supported : 1; |
|---|
| 1020 | 1146 | u8 outbound_spanning_supported : 1; |
|---|
| 1021 | 1147 | u8 pqi_mode_enabled : 1; |
|---|
| 1022 | 1148 | u8 pqi_reset_quiesce_supported : 1; |
|---|
| 1149 | + u8 soft_reset_handshake_supported : 1; |
|---|
| 1150 | + u8 raid_iu_timeout_supported: 1; |
|---|
| 1151 | + u8 tmf_iu_timeout_supported: 1; |
|---|
| 1023 | 1152 | |
|---|
| 1024 | 1153 | struct list_head scsi_device_list; |
|---|
| 1025 | 1154 | spinlock_t scsi_device_list_lock; |
|---|
| .. | .. |
|---|
| 1040 | 1169 | int previous_num_interrupts; |
|---|
| 1041 | 1170 | u32 previous_heartbeat_count; |
|---|
| 1042 | 1171 | __le32 __iomem *heartbeat_counter; |
|---|
| 1172 | + u8 __iomem *soft_reset_status; |
|---|
| 1043 | 1173 | struct timer_list heartbeat_timer; |
|---|
| 1044 | 1174 | struct work_struct ctrl_offline_work; |
|---|
| 1045 | 1175 | |
|---|
| .. | .. |
|---|
| 1051 | 1181 | struct list_head raid_bypass_retry_list; |
|---|
| 1052 | 1182 | spinlock_t raid_bypass_retry_list_lock; |
|---|
| 1053 | 1183 | struct work_struct raid_bypass_retry_work; |
|---|
| 1184 | + |
|---|
| 1185 | + struct pqi_ofa_memory *pqi_ofa_mem_virt_addr; |
|---|
| 1186 | + dma_addr_t pqi_ofa_mem_dma_handle; |
|---|
| 1187 | + void **pqi_ofa_chunk_virt_addr; |
|---|
| 1188 | + atomic_t sync_cmds_outstanding; |
|---|
| 1054 | 1189 | }; |
|---|
| 1055 | 1190 | |
|---|
| 1056 | 1191 | enum pqi_ctrl_mode { |
|---|
| .. | .. |
|---|
| 1069 | 1204 | #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ |
|---|
| 1070 | 1205 | #define CISS_GET_RAID_MAP 0xc8 |
|---|
| 1071 | 1206 | |
|---|
| 1072 | | -/* constants for CISS_REPORT_LOG/CISS_REPORT_PHYS commands */ |
|---|
| 1073 | | -#define CISS_REPORT_LOG_EXTENDED 0x1 |
|---|
| 1074 | | -#define CISS_REPORT_PHYS_EXTENDED 0x2 |
|---|
| 1075 | | - |
|---|
| 1076 | 1207 | /* BMIC commands */ |
|---|
| 1077 | 1208 | #define BMIC_IDENTIFY_CONTROLLER 0x11 |
|---|
| 1078 | 1209 | #define BMIC_IDENTIFY_PHYSICAL_DEVICE 0x15 |
|---|
| .. | .. |
|---|
| 1080 | 1211 | #define BMIC_WRITE 0x27 |
|---|
| 1081 | 1212 | #define BMIC_SENSE_CONTROLLER_PARAMETERS 0x64 |
|---|
| 1082 | 1213 | #define BMIC_SENSE_SUBSYSTEM_INFORMATION 0x66 |
|---|
| 1214 | +#define BMIC_CSMI_PASSTHRU 0x68 |
|---|
| 1083 | 1215 | #define BMIC_WRITE_HOST_WELLNESS 0xa5 |
|---|
| 1084 | 1216 | #define BMIC_FLUSH_CACHE 0xc2 |
|---|
| 1217 | +#define BMIC_SET_DIAG_OPTIONS 0xf4 |
|---|
| 1218 | +#define BMIC_SENSE_DIAG_OPTIONS 0xf5 |
|---|
| 1219 | + |
|---|
| 1220 | +#define CSMI_CC_SAS_SMP_PASSTHRU 0x17 |
|---|
| 1085 | 1221 | |
|---|
| 1086 | 1222 | #define SA_FLUSH_CACHE 0x1 |
|---|
| 1087 | 1223 | |
|---|
| .. | .. |
|---|
| 1104 | 1240 | __le16 extended_logical_unit_count; |
|---|
| 1105 | 1241 | u8 reserved1[34]; |
|---|
| 1106 | 1242 | __le16 firmware_build_number; |
|---|
| 1107 | | - u8 reserved2[100]; |
|---|
| 1243 | + u8 reserved2[8]; |
|---|
| 1244 | + u8 vendor_id[8]; |
|---|
| 1245 | + u8 product_id[16]; |
|---|
| 1246 | + u8 reserved3[68]; |
|---|
| 1108 | 1247 | u8 controller_mode; |
|---|
| 1109 | | - u8 reserved3[32]; |
|---|
| 1248 | + u8 reserved4[32]; |
|---|
| 1110 | 1249 | }; |
|---|
| 1250 | + |
|---|
| 1251 | +struct bmic_sense_subsystem_info { |
|---|
| 1252 | + u8 reserved[44]; |
|---|
| 1253 | + u8 ctrl_serial_number[16]; |
|---|
| 1254 | +}; |
|---|
| 1255 | + |
|---|
| 1256 | +/* constants for device_type field */ |
|---|
| 1257 | +#define SA_DEVICE_TYPE_SATA 0x1 |
|---|
| 1258 | +#define SA_DEVICE_TYPE_SAS 0x2 |
|---|
| 1259 | +#define SA_DEVICE_TYPE_EXPANDER_SMP 0x5 |
|---|
| 1260 | +#define SA_DEVICE_TYPE_SES 0x6 |
|---|
| 1261 | +#define SA_DEVICE_TYPE_CONTROLLER 0x7 |
|---|
| 1262 | +#define SA_DEVICE_TYPE_NVME 0x9 |
|---|
| 1111 | 1263 | |
|---|
| 1112 | 1264 | struct bmic_identify_physical_device { |
|---|
| 1113 | 1265 | u8 scsi_bus; /* SCSI Bus number on controller */ |
|---|
| .. | .. |
|---|
| 1133 | 1285 | __le32 rpm; /* drive rotational speed in RPM */ |
|---|
| 1134 | 1286 | u8 device_type; /* type of drive */ |
|---|
| 1135 | 1287 | u8 sata_version; /* only valid when device_type = */ |
|---|
| 1136 | | - /* BMIC_DEVICE_TYPE_SATA */ |
|---|
| 1288 | + /* SA_DEVICE_TYPE_SATA */ |
|---|
| 1137 | 1289 | __le64 big_total_block_count; |
|---|
| 1138 | 1290 | __le64 ris_starting_lba; |
|---|
| 1139 | 1291 | __le32 ris_size; |
|---|
| .. | .. |
|---|
| 1189 | 1341 | u8 padding_to_multiple_of_512[9]; |
|---|
| 1190 | 1342 | }; |
|---|
| 1191 | 1343 | |
|---|
| 1344 | +struct bmic_smp_request { |
|---|
| 1345 | + u8 frame_type; |
|---|
| 1346 | + u8 function; |
|---|
| 1347 | + u8 allocated_response_length; |
|---|
| 1348 | + u8 request_length; |
|---|
| 1349 | + u8 additional_request_bytes[1016]; |
|---|
| 1350 | +}; |
|---|
| 1351 | + |
|---|
| 1352 | +struct bmic_smp_response { |
|---|
| 1353 | + u8 frame_type; |
|---|
| 1354 | + u8 function; |
|---|
| 1355 | + u8 function_result; |
|---|
| 1356 | + u8 response_length; |
|---|
| 1357 | + u8 additional_response_bytes[1016]; |
|---|
| 1358 | +}; |
|---|
| 1359 | + |
|---|
| 1360 | +struct bmic_csmi_ioctl_header { |
|---|
| 1361 | + __le32 header_length; |
|---|
| 1362 | + u8 signature[8]; |
|---|
| 1363 | + __le32 timeout; |
|---|
| 1364 | + __le32 control_code; |
|---|
| 1365 | + __le32 return_code; |
|---|
| 1366 | + __le32 length; |
|---|
| 1367 | +}; |
|---|
| 1368 | + |
|---|
| 1369 | +struct bmic_csmi_smp_passthru { |
|---|
| 1370 | + u8 phy_identifier; |
|---|
| 1371 | + u8 port_identifier; |
|---|
| 1372 | + u8 connection_rate; |
|---|
| 1373 | + u8 reserved; |
|---|
| 1374 | + __be64 destination_sas_address; |
|---|
| 1375 | + __le32 request_length; |
|---|
| 1376 | + struct bmic_smp_request request; |
|---|
| 1377 | + u8 connection_status; |
|---|
| 1378 | + u8 reserved1[3]; |
|---|
| 1379 | + __le32 response_length; |
|---|
| 1380 | + struct bmic_smp_response response; |
|---|
| 1381 | +}; |
|---|
| 1382 | + |
|---|
| 1383 | +struct bmic_csmi_smp_passthru_buffer { |
|---|
| 1384 | + struct bmic_csmi_ioctl_header ioctl_header; |
|---|
| 1385 | + struct bmic_csmi_smp_passthru parameters; |
|---|
| 1386 | +}; |
|---|
| 1387 | + |
|---|
| 1192 | 1388 | struct bmic_flush_cache { |
|---|
| 1193 | 1389 | u8 disable_flag; |
|---|
| 1194 | 1390 | u8 system_power_action; |
|---|
| .. | .. |
|---|
| 1206 | 1402 | RESTART = 4 |
|---|
| 1207 | 1403 | }; |
|---|
| 1208 | 1404 | |
|---|
| 1405 | +struct bmic_diag_options { |
|---|
| 1406 | + __le32 options; |
|---|
| 1407 | +}; |
|---|
| 1408 | + |
|---|
| 1209 | 1409 | #pragma pack() |
|---|
| 1410 | + |
|---|
| 1411 | +static inline void pqi_ctrl_busy(struct pqi_ctrl_info *ctrl_info) |
|---|
| 1412 | +{ |
|---|
| 1413 | + atomic_inc(&ctrl_info->num_busy_threads); |
|---|
| 1414 | +} |
|---|
| 1415 | + |
|---|
| 1416 | +static inline void pqi_ctrl_unbusy(struct pqi_ctrl_info *ctrl_info) |
|---|
| 1417 | +{ |
|---|
| 1418 | + atomic_dec(&ctrl_info->num_busy_threads); |
|---|
| 1419 | +} |
|---|
| 1420 | + |
|---|
| 1421 | +static inline struct pqi_ctrl_info *shost_to_hba(struct Scsi_Host *shost) |
|---|
| 1422 | +{ |
|---|
| 1423 | + void *hostdata = shost_priv(shost); |
|---|
| 1424 | + |
|---|
| 1425 | + return *((struct pqi_ctrl_info **)hostdata); |
|---|
| 1426 | +} |
|---|
| 1427 | + |
|---|
| 1428 | +void pqi_sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, |
|---|
| 1429 | + struct sas_rphy *rphy); |
|---|
| 1210 | 1430 | |
|---|
| 1211 | 1431 | int pqi_add_sas_host(struct Scsi_Host *shost, struct pqi_ctrl_info *ctrl_info); |
|---|
| 1212 | 1432 | void pqi_delete_sas_host(struct pqi_ctrl_info *ctrl_info); |
|---|
| .. | .. |
|---|
| 1216 | 1436 | struct pqi_scsi_dev *pqi_find_device_by_sas_rphy( |
|---|
| 1217 | 1437 | struct pqi_ctrl_info *ctrl_info, struct sas_rphy *rphy); |
|---|
| 1218 | 1438 | void pqi_prep_for_scsi_done(struct scsi_cmnd *scmd); |
|---|
| 1439 | +int pqi_csmi_smp_passthru(struct pqi_ctrl_info *ctrl_info, |
|---|
| 1440 | + struct bmic_csmi_smp_passthru_buffer *buffer, size_t buffer_length, |
|---|
| 1441 | + struct pqi_raid_error_info *error_info); |
|---|
| 1219 | 1442 | |
|---|
| 1220 | 1443 | extern struct sas_function_template pqi_sas_transport_functions; |
|---|
| 1221 | 1444 | |
|---|