18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * ipr.h -- driver for IBM Power Linux RAID adapters 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Written By: Brian King <brking@us.ibm.com>, IBM Corporation 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2003, 2004 IBM Corporation 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Alan Cox <alan@lxorguk.ukuu.org.uk> - Removed several careless u32/dma_addr_t errors 108c2ecf20Sopenharmony_ci * that broke 64bit platforms. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef _IPR_H 148c2ecf20Sopenharmony_ci#define _IPR_H 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <asm/unaligned.h> 178c2ecf20Sopenharmony_ci#include <linux/types.h> 188c2ecf20Sopenharmony_ci#include <linux/completion.h> 198c2ecf20Sopenharmony_ci#include <linux/libata.h> 208c2ecf20Sopenharmony_ci#include <linux/list.h> 218c2ecf20Sopenharmony_ci#include <linux/kref.h> 228c2ecf20Sopenharmony_ci#include <linux/irq_poll.h> 238c2ecf20Sopenharmony_ci#include <scsi/scsi.h> 248c2ecf20Sopenharmony_ci#include <scsi/scsi_cmnd.h> 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* 278c2ecf20Sopenharmony_ci * Literals 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_ci#define IPR_DRIVER_VERSION "2.6.4" 308c2ecf20Sopenharmony_ci#define IPR_DRIVER_DATE "(March 14, 2017)" 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* 338c2ecf20Sopenharmony_ci * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding 348c2ecf20Sopenharmony_ci * ops per device for devices not running tagged command queuing. 358c2ecf20Sopenharmony_ci * This can be adjusted at runtime through sysfs device attributes. 368c2ecf20Sopenharmony_ci */ 378c2ecf20Sopenharmony_ci#define IPR_MAX_CMD_PER_LUN 6 388c2ecf20Sopenharmony_ci#define IPR_MAX_CMD_PER_ATA_LUN 1 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/* 418c2ecf20Sopenharmony_ci * IPR_NUM_BASE_CMD_BLKS: This defines the maximum number of 428c2ecf20Sopenharmony_ci * ops the mid-layer can send to the adapter. 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci#define IPR_NUM_BASE_CMD_BLKS (ioa_cfg->max_cmds) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IBM_OBSIDIAN_E 0x0339 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IBM_CROC_FPGA_E2 0x033D 498c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IBM_CROCODILE 0x034A 508c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IBM_RATTLESNAKE 0x04DA 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_2780 0x0264 538c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_5702 0x0266 548c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_5703 0x0278 558c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_572E 0x028D 568c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_573E 0x02D3 578c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_573D 0x02D4 588c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_571A 0x02C0 598c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_571B 0x02BE 608c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_571E 0x02BF 618c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_571F 0x02D5 628c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_572A 0x02C1 638c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_572B 0x02C2 648c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_572F 0x02C3 658c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_574E 0x030A 668c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_575B 0x030D 678c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_575C 0x0338 688c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57B3 0x033A 698c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57B7 0x0360 708c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57B8 0x02C2 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57B4 0x033B 738c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57B2 0x035F 748c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57C0 0x0352 758c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57C3 0x0353 768c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57C4 0x0354 778c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57C6 0x0357 788c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57CC 0x035C 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57B5 0x033C 818c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57CE 0x035E 828c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57B1 0x0355 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_574D 0x0356 858c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57C8 0x035D 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57D5 0x03FB 888c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57D6 0x03FC 898c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57D7 0x03FF 908c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57D8 0x03FE 918c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57D9 0x046D 928c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57DA 0x04CA 938c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57EB 0x0474 948c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57EC 0x0475 958c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57ED 0x0499 968c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57EE 0x049A 978c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57EF 0x049B 988c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_57F0 0x049C 998c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_2CCA 0x04C7 1008c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_2CD2 0x04C8 1018c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_2CCD 0x04C9 1028c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_580A 0x04FC 1038c2ecf20Sopenharmony_ci#define IPR_SUBS_DEV_ID_580B 0x04FB 1048c2ecf20Sopenharmony_ci#define IPR_NAME "ipr" 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* 1078c2ecf20Sopenharmony_ci * Return codes 1088c2ecf20Sopenharmony_ci */ 1098c2ecf20Sopenharmony_ci#define IPR_RC_JOB_CONTINUE 1 1108c2ecf20Sopenharmony_ci#define IPR_RC_JOB_RETURN 2 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* 1138c2ecf20Sopenharmony_ci * IOASCs 1148c2ecf20Sopenharmony_ci */ 1158c2ecf20Sopenharmony_ci#define IPR_IOASC_NR_INIT_CMD_REQUIRED 0x02040200 1168c2ecf20Sopenharmony_ci#define IPR_IOASC_NR_IOA_RESET_REQUIRED 0x02048000 1178c2ecf20Sopenharmony_ci#define IPR_IOASC_SYNC_REQUIRED 0x023f0000 1188c2ecf20Sopenharmony_ci#define IPR_IOASC_MED_DO_NOT_REALLOC 0x03110C00 1198c2ecf20Sopenharmony_ci#define IPR_IOASC_HW_SEL_TIMEOUT 0x04050000 1208c2ecf20Sopenharmony_ci#define IPR_IOASC_HW_DEV_BUS_STATUS 0x04448500 1218c2ecf20Sopenharmony_ci#define IPR_IOASC_IOASC_MASK 0xFFFFFF00 1228c2ecf20Sopenharmony_ci#define IPR_IOASC_SCSI_STATUS_MASK 0x000000FF 1238c2ecf20Sopenharmony_ci#define IPR_IOASC_HW_CMD_FAILED 0x046E0000 1248c2ecf20Sopenharmony_ci#define IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT 0x05240000 1258c2ecf20Sopenharmony_ci#define IPR_IOASC_IR_RESOURCE_HANDLE 0x05250000 1268c2ecf20Sopenharmony_ci#define IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA 0x05258100 1278c2ecf20Sopenharmony_ci#define IPR_IOASA_IR_DUAL_IOA_DISABLED 0x052C8000 1288c2ecf20Sopenharmony_ci#define IPR_IOASC_BUS_WAS_RESET 0x06290000 1298c2ecf20Sopenharmony_ci#define IPR_IOASC_BUS_WAS_RESET_BY_OTHER 0x06298000 1308c2ecf20Sopenharmony_ci#define IPR_IOASC_ABORTED_CMD_TERM_BY_HOST 0x0B5A0000 1318c2ecf20Sopenharmony_ci#define IPR_IOASC_IR_NON_OPTIMIZED 0x05258200 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define IPR_FIRST_DRIVER_IOASC 0x10000000 1348c2ecf20Sopenharmony_ci#define IPR_IOASC_IOA_WAS_RESET 0x10000001 1358c2ecf20Sopenharmony_ci#define IPR_IOASC_PCI_ACCESS_ERROR 0x10000002 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci/* Driver data flags */ 1388c2ecf20Sopenharmony_ci#define IPR_USE_LONG_TRANSOP_TIMEOUT 0x00000001 1398c2ecf20Sopenharmony_ci#define IPR_USE_PCI_WARM_RESET 0x00000002 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#define IPR_DEFAULT_MAX_ERROR_DUMP 984 1428c2ecf20Sopenharmony_ci#define IPR_NUM_LOG_HCAMS 2 1438c2ecf20Sopenharmony_ci#define IPR_NUM_CFG_CHG_HCAMS 2 1448c2ecf20Sopenharmony_ci#define IPR_NUM_HCAM_QUEUE 12 1458c2ecf20Sopenharmony_ci#define IPR_NUM_HCAMS (IPR_NUM_LOG_HCAMS + IPR_NUM_CFG_CHG_HCAMS) 1468c2ecf20Sopenharmony_ci#define IPR_MAX_HCAMS (IPR_NUM_HCAMS + IPR_NUM_HCAM_QUEUE) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define IPR_MAX_SIS64_TARGETS_PER_BUS 1024 1498c2ecf20Sopenharmony_ci#define IPR_MAX_SIS64_LUNS_PER_TARGET 0xffffffff 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci#define IPR_MAX_NUM_TARGETS_PER_BUS 256 1528c2ecf20Sopenharmony_ci#define IPR_MAX_NUM_LUNS_PER_TARGET 256 1538c2ecf20Sopenharmony_ci#define IPR_VSET_BUS 0xff 1548c2ecf20Sopenharmony_ci#define IPR_IOA_BUS 0xff 1558c2ecf20Sopenharmony_ci#define IPR_IOA_TARGET 0xff 1568c2ecf20Sopenharmony_ci#define IPR_IOA_LUN 0xff 1578c2ecf20Sopenharmony_ci#define IPR_MAX_NUM_BUSES 16 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci#define IPR_NUM_RESET_RELOAD_RETRIES 3 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci/* We need resources for HCAMS, IOA reset, IOA bringdown, and ERP */ 1628c2ecf20Sopenharmony_ci#define IPR_NUM_INTERNAL_CMD_BLKS (IPR_NUM_HCAMS + \ 1638c2ecf20Sopenharmony_ci ((IPR_NUM_RESET_RELOAD_RETRIES + 1) * 2) + 4) 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci#define IPR_MAX_COMMANDS 100 1668c2ecf20Sopenharmony_ci#define IPR_NUM_CMD_BLKS (IPR_NUM_BASE_CMD_BLKS + \ 1678c2ecf20Sopenharmony_ci IPR_NUM_INTERNAL_CMD_BLKS) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci#define IPR_MAX_PHYSICAL_DEVS 192 1708c2ecf20Sopenharmony_ci#define IPR_DEFAULT_SIS64_DEVS 1024 1718c2ecf20Sopenharmony_ci#define IPR_MAX_SIS64_DEVS 4096 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci#define IPR_MAX_SGLIST 64 1748c2ecf20Sopenharmony_ci#define IPR_IOA_MAX_SECTORS 32767 1758c2ecf20Sopenharmony_ci#define IPR_VSET_MAX_SECTORS 512 1768c2ecf20Sopenharmony_ci#define IPR_MAX_CDB_LEN 16 1778c2ecf20Sopenharmony_ci#define IPR_MAX_HRRQ_RETRIES 3 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci#define IPR_DEFAULT_BUS_WIDTH 16 1808c2ecf20Sopenharmony_ci#define IPR_80MBs_SCSI_RATE ((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8)) 1818c2ecf20Sopenharmony_ci#define IPR_U160_SCSI_RATE ((160 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8)) 1828c2ecf20Sopenharmony_ci#define IPR_U320_SCSI_RATE ((320 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8)) 1838c2ecf20Sopenharmony_ci#define IPR_MAX_SCSI_RATE(width) ((320 * 10) / ((width) / 8)) 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define IPR_IOA_RES_HANDLE 0xffffffff 1868c2ecf20Sopenharmony_ci#define IPR_INVALID_RES_HANDLE 0 1878c2ecf20Sopenharmony_ci#define IPR_IOA_RES_ADDR 0x00ffffff 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci/* 1908c2ecf20Sopenharmony_ci * Adapter Commands 1918c2ecf20Sopenharmony_ci */ 1928c2ecf20Sopenharmony_ci#define IPR_CANCEL_REQUEST 0xC0 1938c2ecf20Sopenharmony_ci#define IPR_CANCEL_64BIT_IOARCB 0x01 1948c2ecf20Sopenharmony_ci#define IPR_QUERY_RSRC_STATE 0xC2 1958c2ecf20Sopenharmony_ci#define IPR_RESET_DEVICE 0xC3 1968c2ecf20Sopenharmony_ci#define IPR_RESET_TYPE_SELECT 0x80 1978c2ecf20Sopenharmony_ci#define IPR_LUN_RESET 0x40 1988c2ecf20Sopenharmony_ci#define IPR_TARGET_RESET 0x20 1998c2ecf20Sopenharmony_ci#define IPR_BUS_RESET 0x10 2008c2ecf20Sopenharmony_ci#define IPR_ATA_PHY_RESET 0x80 2018c2ecf20Sopenharmony_ci#define IPR_ID_HOST_RR_Q 0xC4 2028c2ecf20Sopenharmony_ci#define IPR_QUERY_IOA_CONFIG 0xC5 2038c2ecf20Sopenharmony_ci#define IPR_CANCEL_ALL_REQUESTS 0xCE 2048c2ecf20Sopenharmony_ci#define IPR_HOST_CONTROLLED_ASYNC 0xCF 2058c2ecf20Sopenharmony_ci#define IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE 0x01 2068c2ecf20Sopenharmony_ci#define IPR_HCAM_CDB_OP_CODE_LOG_DATA 0x02 2078c2ecf20Sopenharmony_ci#define IPR_SET_SUPPORTED_DEVICES 0xFB 2088c2ecf20Sopenharmony_ci#define IPR_SET_ALL_SUPPORTED_DEVICES 0x80 2098c2ecf20Sopenharmony_ci#define IPR_IOA_SHUTDOWN 0xF7 2108c2ecf20Sopenharmony_ci#define IPR_WR_BUF_DOWNLOAD_AND_SAVE 0x05 2118c2ecf20Sopenharmony_ci#define IPR_IOA_SERVICE_ACTION 0xD2 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci/* IOA Service Actions */ 2148c2ecf20Sopenharmony_ci#define IPR_IOA_SA_CHANGE_CACHE_PARAMS 0x14 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci/* 2178c2ecf20Sopenharmony_ci * Timeouts 2188c2ecf20Sopenharmony_ci */ 2198c2ecf20Sopenharmony_ci#define IPR_SHUTDOWN_TIMEOUT (ipr_fastfail ? 60 * HZ : 10 * 60 * HZ) 2208c2ecf20Sopenharmony_ci#define IPR_VSET_RW_TIMEOUT (ipr_fastfail ? 30 * HZ : 2 * 60 * HZ) 2218c2ecf20Sopenharmony_ci#define IPR_ABBREV_SHUTDOWN_TIMEOUT (10 * HZ) 2228c2ecf20Sopenharmony_ci#define IPR_DUAL_IOA_ABBR_SHUTDOWN_TO (2 * 60 * HZ) 2238c2ecf20Sopenharmony_ci#define IPR_DEVICE_RESET_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) 2248c2ecf20Sopenharmony_ci#define IPR_CANCEL_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) 2258c2ecf20Sopenharmony_ci#define IPR_CANCEL_ALL_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) 2268c2ecf20Sopenharmony_ci#define IPR_ABORT_TASK_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) 2278c2ecf20Sopenharmony_ci#define IPR_INTERNAL_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) 2288c2ecf20Sopenharmony_ci#define IPR_WRITE_BUFFER_TIMEOUT (30 * 60 * HZ) 2298c2ecf20Sopenharmony_ci#define IPR_SET_SUP_DEVICE_TIMEOUT (2 * 60 * HZ) 2308c2ecf20Sopenharmony_ci#define IPR_REQUEST_SENSE_TIMEOUT (10 * HZ) 2318c2ecf20Sopenharmony_ci#define IPR_OPERATIONAL_TIMEOUT (5 * 60) 2328c2ecf20Sopenharmony_ci#define IPR_LONG_OPERATIONAL_TIMEOUT (12 * 60) 2338c2ecf20Sopenharmony_ci#define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ) 2348c2ecf20Sopenharmony_ci#define IPR_CHECK_FOR_RESET_TIMEOUT (HZ / 10) 2358c2ecf20Sopenharmony_ci#define IPR_WAIT_FOR_BIST_TIMEOUT (2 * HZ) 2368c2ecf20Sopenharmony_ci#define IPR_PCI_ERROR_RECOVERY_TIMEOUT (120 * HZ) 2378c2ecf20Sopenharmony_ci#define IPR_PCI_RESET_TIMEOUT (HZ / 2) 2388c2ecf20Sopenharmony_ci#define IPR_SIS32_DUMP_TIMEOUT (15 * HZ) 2398c2ecf20Sopenharmony_ci#define IPR_SIS64_DUMP_TIMEOUT (40 * HZ) 2408c2ecf20Sopenharmony_ci#define IPR_DUMP_DELAY_SECONDS 4 2418c2ecf20Sopenharmony_ci#define IPR_DUMP_DELAY_TIMEOUT (IPR_DUMP_DELAY_SECONDS * HZ) 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci/* 2448c2ecf20Sopenharmony_ci * SCSI Literals 2458c2ecf20Sopenharmony_ci */ 2468c2ecf20Sopenharmony_ci#define IPR_VENDOR_ID_LEN 8 2478c2ecf20Sopenharmony_ci#define IPR_PROD_ID_LEN 16 2488c2ecf20Sopenharmony_ci#define IPR_SERIAL_NUM_LEN 8 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci/* 2518c2ecf20Sopenharmony_ci * Hardware literals 2528c2ecf20Sopenharmony_ci */ 2538c2ecf20Sopenharmony_ci#define IPR_FMT2_MBX_ADDR_MASK 0x0fffffff 2548c2ecf20Sopenharmony_ci#define IPR_FMT2_MBX_BAR_SEL_MASK 0xf0000000 2558c2ecf20Sopenharmony_ci#define IPR_FMT2_MKR_BAR_SEL_SHIFT 28 2568c2ecf20Sopenharmony_ci#define IPR_GET_FMT2_BAR_SEL(mbx) \ 2578c2ecf20Sopenharmony_ci(((mbx) & IPR_FMT2_MBX_BAR_SEL_MASK) >> IPR_FMT2_MKR_BAR_SEL_SHIFT) 2588c2ecf20Sopenharmony_ci#define IPR_SDT_FMT2_BAR0_SEL 0x0 2598c2ecf20Sopenharmony_ci#define IPR_SDT_FMT2_BAR1_SEL 0x1 2608c2ecf20Sopenharmony_ci#define IPR_SDT_FMT2_BAR2_SEL 0x2 2618c2ecf20Sopenharmony_ci#define IPR_SDT_FMT2_BAR3_SEL 0x3 2628c2ecf20Sopenharmony_ci#define IPR_SDT_FMT2_BAR4_SEL 0x4 2638c2ecf20Sopenharmony_ci#define IPR_SDT_FMT2_BAR5_SEL 0x5 2648c2ecf20Sopenharmony_ci#define IPR_SDT_FMT2_EXP_ROM_SEL 0x8 2658c2ecf20Sopenharmony_ci#define IPR_FMT2_SDT_READY_TO_USE 0xC4D4E3F2 2668c2ecf20Sopenharmony_ci#define IPR_FMT3_SDT_READY_TO_USE 0xC4D4E3F3 2678c2ecf20Sopenharmony_ci#define IPR_DOORBELL 0x82800000 2688c2ecf20Sopenharmony_ci#define IPR_RUNTIME_RESET 0x40000000 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci#define IPR_IPL_INIT_MIN_STAGE_TIME 5 2718c2ecf20Sopenharmony_ci#define IPR_IPL_INIT_DEFAULT_STAGE_TIME 30 2728c2ecf20Sopenharmony_ci#define IPR_IPL_INIT_STAGE_UNKNOWN 0x0 2738c2ecf20Sopenharmony_ci#define IPR_IPL_INIT_STAGE_TRANSOP 0xB0000000 2748c2ecf20Sopenharmony_ci#define IPR_IPL_INIT_STAGE_MASK 0xff000000 2758c2ecf20Sopenharmony_ci#define IPR_IPL_INIT_STAGE_TIME_MASK 0x0000ffff 2768c2ecf20Sopenharmony_ci#define IPR_PCII_IPL_STAGE_CHANGE (0x80000000 >> 0) 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci#define IPR_PCII_MAILBOX_STABLE (0x80000000 >> 4) 2798c2ecf20Sopenharmony_ci#define IPR_WAIT_FOR_MAILBOX (2 * HZ) 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci#define IPR_PCII_IOA_TRANS_TO_OPER (0x80000000 >> 0) 2828c2ecf20Sopenharmony_ci#define IPR_PCII_IOARCB_XFER_FAILED (0x80000000 >> 3) 2838c2ecf20Sopenharmony_ci#define IPR_PCII_IOA_UNIT_CHECKED (0x80000000 >> 4) 2848c2ecf20Sopenharmony_ci#define IPR_PCII_NO_HOST_RRQ (0x80000000 >> 5) 2858c2ecf20Sopenharmony_ci#define IPR_PCII_CRITICAL_OPERATION (0x80000000 >> 6) 2868c2ecf20Sopenharmony_ci#define IPR_PCII_IO_DEBUG_ACKNOWLEDGE (0x80000000 >> 7) 2878c2ecf20Sopenharmony_ci#define IPR_PCII_IOARRIN_LOST (0x80000000 >> 27) 2888c2ecf20Sopenharmony_ci#define IPR_PCII_MMIO_ERROR (0x80000000 >> 28) 2898c2ecf20Sopenharmony_ci#define IPR_PCII_PROC_ERR_STATE (0x80000000 >> 29) 2908c2ecf20Sopenharmony_ci#define IPR_PCII_HRRQ_UPDATED (0x80000000 >> 30) 2918c2ecf20Sopenharmony_ci#define IPR_PCII_CORE_ISSUED_RST_REQ (0x80000000 >> 31) 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci#define IPR_PCII_ERROR_INTERRUPTS \ 2948c2ecf20Sopenharmony_ci(IPR_PCII_IOARCB_XFER_FAILED | IPR_PCII_IOA_UNIT_CHECKED | \ 2958c2ecf20Sopenharmony_ciIPR_PCII_NO_HOST_RRQ | IPR_PCII_IOARRIN_LOST | IPR_PCII_MMIO_ERROR) 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci#define IPR_PCII_OPER_INTERRUPTS \ 2988c2ecf20Sopenharmony_ci(IPR_PCII_ERROR_INTERRUPTS | IPR_PCII_HRRQ_UPDATED | IPR_PCII_IOA_TRANS_TO_OPER) 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci#define IPR_UPROCI_RESET_ALERT (0x80000000 >> 7) 3018c2ecf20Sopenharmony_ci#define IPR_UPROCI_IO_DEBUG_ALERT (0x80000000 >> 9) 3028c2ecf20Sopenharmony_ci#define IPR_UPROCI_SIS64_START_BIST (0x80000000 >> 23) 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci#define IPR_LDUMP_MAX_LONG_ACK_DELAY_IN_USEC 200000 /* 200 ms */ 3058c2ecf20Sopenharmony_ci#define IPR_LDUMP_MAX_SHORT_ACK_DELAY_IN_USEC 200000 /* 200 ms */ 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci/* 3088c2ecf20Sopenharmony_ci * Dump literals 3098c2ecf20Sopenharmony_ci */ 3108c2ecf20Sopenharmony_ci#define IPR_FMT2_MAX_IOA_DUMP_SIZE (4 * 1024 * 1024) 3118c2ecf20Sopenharmony_ci#define IPR_FMT3_MAX_IOA_DUMP_SIZE (80 * 1024 * 1024) 3128c2ecf20Sopenharmony_ci#define IPR_FMT2_NUM_SDT_ENTRIES 511 3138c2ecf20Sopenharmony_ci#define IPR_FMT3_NUM_SDT_ENTRIES 0xFFF 3148c2ecf20Sopenharmony_ci#define IPR_FMT2_MAX_NUM_DUMP_PAGES ((IPR_FMT2_MAX_IOA_DUMP_SIZE / PAGE_SIZE) + 1) 3158c2ecf20Sopenharmony_ci#define IPR_FMT3_MAX_NUM_DUMP_PAGES ((IPR_FMT3_MAX_IOA_DUMP_SIZE / PAGE_SIZE) + 1) 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci/* 3188c2ecf20Sopenharmony_ci * Misc literals 3198c2ecf20Sopenharmony_ci */ 3208c2ecf20Sopenharmony_ci#define IPR_NUM_IOADL_ENTRIES IPR_MAX_SGLIST 3218c2ecf20Sopenharmony_ci#define IPR_MAX_MSIX_VECTORS 0x10 3228c2ecf20Sopenharmony_ci#define IPR_MAX_HRRQ_NUM 0x10 3238c2ecf20Sopenharmony_ci#define IPR_INIT_HRRQ 0x0 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci/* 3268c2ecf20Sopenharmony_ci * Adapter interface types 3278c2ecf20Sopenharmony_ci */ 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_cistruct ipr_res_addr { 3308c2ecf20Sopenharmony_ci u8 reserved; 3318c2ecf20Sopenharmony_ci u8 bus; 3328c2ecf20Sopenharmony_ci u8 target; 3338c2ecf20Sopenharmony_ci u8 lun; 3348c2ecf20Sopenharmony_ci#define IPR_GET_PHYS_LOC(res_addr) \ 3358c2ecf20Sopenharmony_ci (((res_addr).bus << 16) | ((res_addr).target << 8) | (res_addr).lun) 3368c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cistruct ipr_std_inq_vpids { 3398c2ecf20Sopenharmony_ci u8 vendor_id[IPR_VENDOR_ID_LEN]; 3408c2ecf20Sopenharmony_ci u8 product_id[IPR_PROD_ID_LEN]; 3418c2ecf20Sopenharmony_ci}__attribute__((packed)); 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_cistruct ipr_vpd { 3448c2ecf20Sopenharmony_ci struct ipr_std_inq_vpids vpids; 3458c2ecf20Sopenharmony_ci u8 sn[IPR_SERIAL_NUM_LEN]; 3468c2ecf20Sopenharmony_ci}__attribute__((packed)); 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistruct ipr_ext_vpd { 3498c2ecf20Sopenharmony_ci struct ipr_vpd vpd; 3508c2ecf20Sopenharmony_ci __be32 wwid[2]; 3518c2ecf20Sopenharmony_ci}__attribute__((packed)); 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_cistruct ipr_ext_vpd64 { 3548c2ecf20Sopenharmony_ci struct ipr_vpd vpd; 3558c2ecf20Sopenharmony_ci __be32 wwid[4]; 3568c2ecf20Sopenharmony_ci}__attribute__((packed)); 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_cistruct ipr_std_inq_data { 3598c2ecf20Sopenharmony_ci u8 peri_qual_dev_type; 3608c2ecf20Sopenharmony_ci#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5) 3618c2ecf20Sopenharmony_ci#define IPR_STD_INQ_PERI_DEV_TYPE(peri) ((peri) & 0x1F) 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci u8 removeable_medium_rsvd; 3648c2ecf20Sopenharmony_ci#define IPR_STD_INQ_REMOVEABLE_MEDIUM 0x80 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci#define IPR_IS_DASD_DEVICE(std_inq) \ 3678c2ecf20Sopenharmony_ci((IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_DISK) && \ 3688c2ecf20Sopenharmony_ci!(((std_inq).removeable_medium_rsvd) & IPR_STD_INQ_REMOVEABLE_MEDIUM)) 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci#define IPR_IS_SES_DEVICE(std_inq) \ 3718c2ecf20Sopenharmony_ci(IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_ENCLOSURE) 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci u8 version; 3748c2ecf20Sopenharmony_ci u8 aen_naca_fmt; 3758c2ecf20Sopenharmony_ci u8 additional_len; 3768c2ecf20Sopenharmony_ci u8 sccs_rsvd; 3778c2ecf20Sopenharmony_ci u8 bq_enc_multi; 3788c2ecf20Sopenharmony_ci u8 sync_cmdq_flags; 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci struct ipr_std_inq_vpids vpids; 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci u8 ros_rsvd_ram_rsvd[4]; 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci u8 serial_num[IPR_SERIAL_NUM_LEN]; 3858c2ecf20Sopenharmony_ci}__attribute__ ((packed)); 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci#define IPR_RES_TYPE_AF_DASD 0x00 3888c2ecf20Sopenharmony_ci#define IPR_RES_TYPE_GENERIC_SCSI 0x01 3898c2ecf20Sopenharmony_ci#define IPR_RES_TYPE_VOLUME_SET 0x02 3908c2ecf20Sopenharmony_ci#define IPR_RES_TYPE_REMOTE_AF_DASD 0x03 3918c2ecf20Sopenharmony_ci#define IPR_RES_TYPE_GENERIC_ATA 0x04 3928c2ecf20Sopenharmony_ci#define IPR_RES_TYPE_ARRAY 0x05 3938c2ecf20Sopenharmony_ci#define IPR_RES_TYPE_IOAFP 0xff 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_cistruct ipr_config_table_entry { 3968c2ecf20Sopenharmony_ci u8 proto; 3978c2ecf20Sopenharmony_ci#define IPR_PROTO_SATA 0x02 3988c2ecf20Sopenharmony_ci#define IPR_PROTO_SATA_ATAPI 0x03 3998c2ecf20Sopenharmony_ci#define IPR_PROTO_SAS_STP 0x06 4008c2ecf20Sopenharmony_ci#define IPR_PROTO_SAS_STP_ATAPI 0x07 4018c2ecf20Sopenharmony_ci u8 array_id; 4028c2ecf20Sopenharmony_ci u8 flags; 4038c2ecf20Sopenharmony_ci#define IPR_IS_IOA_RESOURCE 0x80 4048c2ecf20Sopenharmony_ci u8 rsvd_subtype; 4058c2ecf20Sopenharmony_ci 4068c2ecf20Sopenharmony_ci#define IPR_QUEUEING_MODEL(res) ((((res)->flags) & 0x70) >> 4) 4078c2ecf20Sopenharmony_ci#define IPR_QUEUE_FROZEN_MODEL 0 4088c2ecf20Sopenharmony_ci#define IPR_QUEUE_NACA_MODEL 1 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci struct ipr_res_addr res_addr; 4118c2ecf20Sopenharmony_ci __be32 res_handle; 4128c2ecf20Sopenharmony_ci __be32 lun_wwn[2]; 4138c2ecf20Sopenharmony_ci struct ipr_std_inq_data std_inq_data; 4148c2ecf20Sopenharmony_ci}__attribute__ ((packed, aligned (4))); 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_cistruct ipr_config_table_entry64 { 4178c2ecf20Sopenharmony_ci u8 res_type; 4188c2ecf20Sopenharmony_ci u8 proto; 4198c2ecf20Sopenharmony_ci u8 vset_num; 4208c2ecf20Sopenharmony_ci u8 array_id; 4218c2ecf20Sopenharmony_ci __be16 flags; 4228c2ecf20Sopenharmony_ci __be16 res_flags; 4238c2ecf20Sopenharmony_ci#define IPR_QUEUEING_MODEL64(res) ((((res)->res_flags) & 0x7000) >> 12) 4248c2ecf20Sopenharmony_ci __be32 res_handle; 4258c2ecf20Sopenharmony_ci u8 dev_id_type; 4268c2ecf20Sopenharmony_ci u8 reserved[3]; 4278c2ecf20Sopenharmony_ci __be64 dev_id; 4288c2ecf20Sopenharmony_ci __be64 lun; 4298c2ecf20Sopenharmony_ci __be64 lun_wwn[2]; 4308c2ecf20Sopenharmony_ci#define IPR_MAX_RES_PATH_LENGTH 48 4318c2ecf20Sopenharmony_ci __be64 res_path; 4328c2ecf20Sopenharmony_ci struct ipr_std_inq_data std_inq_data; 4338c2ecf20Sopenharmony_ci u8 reserved2[4]; 4348c2ecf20Sopenharmony_ci __be64 reserved3[2]; 4358c2ecf20Sopenharmony_ci u8 reserved4[8]; 4368c2ecf20Sopenharmony_ci}__attribute__ ((packed, aligned (8))); 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_cistruct ipr_config_table_hdr { 4398c2ecf20Sopenharmony_ci u8 num_entries; 4408c2ecf20Sopenharmony_ci u8 flags; 4418c2ecf20Sopenharmony_ci#define IPR_UCODE_DOWNLOAD_REQ 0x10 4428c2ecf20Sopenharmony_ci __be16 reserved; 4438c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_cistruct ipr_config_table_hdr64 { 4468c2ecf20Sopenharmony_ci __be16 num_entries; 4478c2ecf20Sopenharmony_ci __be16 reserved; 4488c2ecf20Sopenharmony_ci u8 flags; 4498c2ecf20Sopenharmony_ci u8 reserved2[11]; 4508c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_cistruct ipr_config_table { 4538c2ecf20Sopenharmony_ci struct ipr_config_table_hdr hdr; 4548c2ecf20Sopenharmony_ci struct ipr_config_table_entry dev[]; 4558c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_cistruct ipr_config_table64 { 4588c2ecf20Sopenharmony_ci struct ipr_config_table_hdr64 hdr64; 4598c2ecf20Sopenharmony_ci struct ipr_config_table_entry64 dev[]; 4608c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (8))); 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_cistruct ipr_config_table_entry_wrapper { 4638c2ecf20Sopenharmony_ci union { 4648c2ecf20Sopenharmony_ci struct ipr_config_table_entry *cfgte; 4658c2ecf20Sopenharmony_ci struct ipr_config_table_entry64 *cfgte64; 4668c2ecf20Sopenharmony_ci } u; 4678c2ecf20Sopenharmony_ci}; 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_cistruct ipr_hostrcb_cfg_ch_not { 4708c2ecf20Sopenharmony_ci union { 4718c2ecf20Sopenharmony_ci struct ipr_config_table_entry cfgte; 4728c2ecf20Sopenharmony_ci struct ipr_config_table_entry64 cfgte64; 4738c2ecf20Sopenharmony_ci } u; 4748c2ecf20Sopenharmony_ci u8 reserved[936]; 4758c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_cistruct ipr_supported_device { 4788c2ecf20Sopenharmony_ci __be16 data_length; 4798c2ecf20Sopenharmony_ci u8 reserved; 4808c2ecf20Sopenharmony_ci u8 num_records; 4818c2ecf20Sopenharmony_ci struct ipr_std_inq_vpids vpids; 4828c2ecf20Sopenharmony_ci u8 reserved2[16]; 4838c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_cistruct ipr_hrr_queue { 4868c2ecf20Sopenharmony_ci struct ipr_ioa_cfg *ioa_cfg; 4878c2ecf20Sopenharmony_ci __be32 *host_rrq; 4888c2ecf20Sopenharmony_ci dma_addr_t host_rrq_dma; 4898c2ecf20Sopenharmony_ci#define IPR_HRRQ_REQ_RESP_HANDLE_MASK 0xfffffffc 4908c2ecf20Sopenharmony_ci#define IPR_HRRQ_RESP_BIT_SET 0x00000002 4918c2ecf20Sopenharmony_ci#define IPR_HRRQ_TOGGLE_BIT 0x00000001 4928c2ecf20Sopenharmony_ci#define IPR_HRRQ_REQ_RESP_HANDLE_SHIFT 2 4938c2ecf20Sopenharmony_ci#define IPR_ID_HRRQ_SELE_ENABLE 0x02 4948c2ecf20Sopenharmony_ci volatile __be32 *hrrq_start; 4958c2ecf20Sopenharmony_ci volatile __be32 *hrrq_end; 4968c2ecf20Sopenharmony_ci volatile __be32 *hrrq_curr; 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci struct list_head hrrq_free_q; 4998c2ecf20Sopenharmony_ci struct list_head hrrq_pending_q; 5008c2ecf20Sopenharmony_ci spinlock_t _lock; 5018c2ecf20Sopenharmony_ci spinlock_t *lock; 5028c2ecf20Sopenharmony_ci 5038c2ecf20Sopenharmony_ci volatile u32 toggle_bit; 5048c2ecf20Sopenharmony_ci u32 size; 5058c2ecf20Sopenharmony_ci u32 min_cmd_id; 5068c2ecf20Sopenharmony_ci u32 max_cmd_id; 5078c2ecf20Sopenharmony_ci u8 allow_interrupts:1; 5088c2ecf20Sopenharmony_ci u8 ioa_is_dead:1; 5098c2ecf20Sopenharmony_ci u8 allow_cmds:1; 5108c2ecf20Sopenharmony_ci u8 removing_ioa:1; 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_ci struct irq_poll iopoll; 5138c2ecf20Sopenharmony_ci}; 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_ci/* Command packet structure */ 5168c2ecf20Sopenharmony_cistruct ipr_cmd_pkt { 5178c2ecf20Sopenharmony_ci u8 reserved; /* Reserved by IOA */ 5188c2ecf20Sopenharmony_ci u8 hrrq_id; 5198c2ecf20Sopenharmony_ci u8 request_type; 5208c2ecf20Sopenharmony_ci#define IPR_RQTYPE_SCSICDB 0x00 5218c2ecf20Sopenharmony_ci#define IPR_RQTYPE_IOACMD 0x01 5228c2ecf20Sopenharmony_ci#define IPR_RQTYPE_HCAM 0x02 5238c2ecf20Sopenharmony_ci#define IPR_RQTYPE_ATA_PASSTHRU 0x04 5248c2ecf20Sopenharmony_ci#define IPR_RQTYPE_PIPE 0x05 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci u8 reserved2; 5278c2ecf20Sopenharmony_ci 5288c2ecf20Sopenharmony_ci u8 flags_hi; 5298c2ecf20Sopenharmony_ci#define IPR_FLAGS_HI_WRITE_NOT_READ 0x80 5308c2ecf20Sopenharmony_ci#define IPR_FLAGS_HI_NO_ULEN_CHK 0x20 5318c2ecf20Sopenharmony_ci#define IPR_FLAGS_HI_SYNC_OVERRIDE 0x10 5328c2ecf20Sopenharmony_ci#define IPR_FLAGS_HI_SYNC_COMPLETE 0x08 5338c2ecf20Sopenharmony_ci#define IPR_FLAGS_HI_NO_LINK_DESC 0x04 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_ci u8 flags_lo; 5368c2ecf20Sopenharmony_ci#define IPR_FLAGS_LO_ALIGNED_BFR 0x20 5378c2ecf20Sopenharmony_ci#define IPR_FLAGS_LO_DELAY_AFTER_RST 0x10 5388c2ecf20Sopenharmony_ci#define IPR_FLAGS_LO_UNTAGGED_TASK 0x00 5398c2ecf20Sopenharmony_ci#define IPR_FLAGS_LO_SIMPLE_TASK 0x02 5408c2ecf20Sopenharmony_ci#define IPR_FLAGS_LO_ORDERED_TASK 0x04 5418c2ecf20Sopenharmony_ci#define IPR_FLAGS_LO_HEAD_OF_Q_TASK 0x06 5428c2ecf20Sopenharmony_ci#define IPR_FLAGS_LO_ACA_TASK 0x08 5438c2ecf20Sopenharmony_ci 5448c2ecf20Sopenharmony_ci u8 cdb[16]; 5458c2ecf20Sopenharmony_ci __be16 timeout; 5468c2ecf20Sopenharmony_ci}__attribute__ ((packed, aligned(4))); 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_cistruct ipr_ioarcb_ata_regs { /* 22 bytes */ 5498c2ecf20Sopenharmony_ci u8 flags; 5508c2ecf20Sopenharmony_ci#define IPR_ATA_FLAG_PACKET_CMD 0x80 5518c2ecf20Sopenharmony_ci#define IPR_ATA_FLAG_XFER_TYPE_DMA 0x40 5528c2ecf20Sopenharmony_ci#define IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION 0x20 5538c2ecf20Sopenharmony_ci u8 reserved[3]; 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci __be16 data; 5568c2ecf20Sopenharmony_ci u8 feature; 5578c2ecf20Sopenharmony_ci u8 nsect; 5588c2ecf20Sopenharmony_ci u8 lbal; 5598c2ecf20Sopenharmony_ci u8 lbam; 5608c2ecf20Sopenharmony_ci u8 lbah; 5618c2ecf20Sopenharmony_ci u8 device; 5628c2ecf20Sopenharmony_ci u8 command; 5638c2ecf20Sopenharmony_ci u8 reserved2[3]; 5648c2ecf20Sopenharmony_ci u8 hob_feature; 5658c2ecf20Sopenharmony_ci u8 hob_nsect; 5668c2ecf20Sopenharmony_ci u8 hob_lbal; 5678c2ecf20Sopenharmony_ci u8 hob_lbam; 5688c2ecf20Sopenharmony_ci u8 hob_lbah; 5698c2ecf20Sopenharmony_ci u8 ctl; 5708c2ecf20Sopenharmony_ci}__attribute__ ((packed, aligned(2))); 5718c2ecf20Sopenharmony_ci 5728c2ecf20Sopenharmony_cistruct ipr_ioadl_desc { 5738c2ecf20Sopenharmony_ci __be32 flags_and_data_len; 5748c2ecf20Sopenharmony_ci#define IPR_IOADL_FLAGS_MASK 0xff000000 5758c2ecf20Sopenharmony_ci#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK) 5768c2ecf20Sopenharmony_ci#define IPR_IOADL_DATA_LEN_MASK 0x00ffffff 5778c2ecf20Sopenharmony_ci#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK) 5788c2ecf20Sopenharmony_ci#define IPR_IOADL_FLAGS_READ 0x48000000 5798c2ecf20Sopenharmony_ci#define IPR_IOADL_FLAGS_READ_LAST 0x49000000 5808c2ecf20Sopenharmony_ci#define IPR_IOADL_FLAGS_WRITE 0x68000000 5818c2ecf20Sopenharmony_ci#define IPR_IOADL_FLAGS_WRITE_LAST 0x69000000 5828c2ecf20Sopenharmony_ci#define IPR_IOADL_FLAGS_LAST 0x01000000 5838c2ecf20Sopenharmony_ci 5848c2ecf20Sopenharmony_ci __be32 address; 5858c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (8))); 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_cistruct ipr_ioadl64_desc { 5888c2ecf20Sopenharmony_ci __be32 flags; 5898c2ecf20Sopenharmony_ci __be32 data_len; 5908c2ecf20Sopenharmony_ci __be64 address; 5918c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (16))); 5928c2ecf20Sopenharmony_ci 5938c2ecf20Sopenharmony_cistruct ipr_ata64_ioadl { 5948c2ecf20Sopenharmony_ci struct ipr_ioarcb_ata_regs regs; 5958c2ecf20Sopenharmony_ci u16 reserved[5]; 5968c2ecf20Sopenharmony_ci struct ipr_ioadl64_desc ioadl64[IPR_NUM_IOADL_ENTRIES]; 5978c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (16))); 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_cistruct ipr_ioarcb_add_data { 6008c2ecf20Sopenharmony_ci union { 6018c2ecf20Sopenharmony_ci struct ipr_ioarcb_ata_regs regs; 6028c2ecf20Sopenharmony_ci struct ipr_ioadl_desc ioadl[5]; 6038c2ecf20Sopenharmony_ci __be32 add_cmd_parms[10]; 6048c2ecf20Sopenharmony_ci } u; 6058c2ecf20Sopenharmony_ci}__attribute__ ((packed, aligned (4))); 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_cistruct ipr_ioarcb_sis64_add_addr_ecb { 6088c2ecf20Sopenharmony_ci __be64 ioasa_host_pci_addr; 6098c2ecf20Sopenharmony_ci __be64 data_ioadl_addr; 6108c2ecf20Sopenharmony_ci __be64 reserved; 6118c2ecf20Sopenharmony_ci __be32 ext_control_buf[4]; 6128c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (8))); 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_ci/* IOA Request Control Block 128 bytes */ 6158c2ecf20Sopenharmony_cistruct ipr_ioarcb { 6168c2ecf20Sopenharmony_ci union { 6178c2ecf20Sopenharmony_ci __be32 ioarcb_host_pci_addr; 6188c2ecf20Sopenharmony_ci __be64 ioarcb_host_pci_addr64; 6198c2ecf20Sopenharmony_ci } a; 6208c2ecf20Sopenharmony_ci __be32 res_handle; 6218c2ecf20Sopenharmony_ci __be32 host_response_handle; 6228c2ecf20Sopenharmony_ci __be32 reserved1; 6238c2ecf20Sopenharmony_ci __be32 reserved2; 6248c2ecf20Sopenharmony_ci __be32 reserved3; 6258c2ecf20Sopenharmony_ci 6268c2ecf20Sopenharmony_ci __be32 data_transfer_length; 6278c2ecf20Sopenharmony_ci __be32 read_data_transfer_length; 6288c2ecf20Sopenharmony_ci __be32 write_ioadl_addr; 6298c2ecf20Sopenharmony_ci __be32 ioadl_len; 6308c2ecf20Sopenharmony_ci __be32 read_ioadl_addr; 6318c2ecf20Sopenharmony_ci __be32 read_ioadl_len; 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci __be32 ioasa_host_pci_addr; 6348c2ecf20Sopenharmony_ci __be16 ioasa_len; 6358c2ecf20Sopenharmony_ci __be16 reserved4; 6368c2ecf20Sopenharmony_ci 6378c2ecf20Sopenharmony_ci struct ipr_cmd_pkt cmd_pkt; 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci __be16 add_cmd_parms_offset; 6408c2ecf20Sopenharmony_ci __be16 add_cmd_parms_len; 6418c2ecf20Sopenharmony_ci 6428c2ecf20Sopenharmony_ci union { 6438c2ecf20Sopenharmony_ci struct ipr_ioarcb_add_data add_data; 6448c2ecf20Sopenharmony_ci struct ipr_ioarcb_sis64_add_addr_ecb sis64_addr_data; 6458c2ecf20Sopenharmony_ci } u; 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_cistruct ipr_ioasa_vset { 6508c2ecf20Sopenharmony_ci __be32 failing_lba_hi; 6518c2ecf20Sopenharmony_ci __be32 failing_lba_lo; 6528c2ecf20Sopenharmony_ci __be32 reserved; 6538c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_cistruct ipr_ioasa_af_dasd { 6568c2ecf20Sopenharmony_ci __be32 failing_lba; 6578c2ecf20Sopenharmony_ci __be32 reserved[2]; 6588c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_cistruct ipr_ioasa_gpdd { 6618c2ecf20Sopenharmony_ci u8 end_state; 6628c2ecf20Sopenharmony_ci u8 bus_phase; 6638c2ecf20Sopenharmony_ci __be16 reserved; 6648c2ecf20Sopenharmony_ci __be32 ioa_data[2]; 6658c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 6668c2ecf20Sopenharmony_ci 6678c2ecf20Sopenharmony_cistruct ipr_ioasa_gata { 6688c2ecf20Sopenharmony_ci u8 error; 6698c2ecf20Sopenharmony_ci u8 nsect; /* Interrupt reason */ 6708c2ecf20Sopenharmony_ci u8 lbal; 6718c2ecf20Sopenharmony_ci u8 lbam; 6728c2ecf20Sopenharmony_ci u8 lbah; 6738c2ecf20Sopenharmony_ci u8 device; 6748c2ecf20Sopenharmony_ci u8 status; 6758c2ecf20Sopenharmony_ci u8 alt_status; /* ATA CTL */ 6768c2ecf20Sopenharmony_ci u8 hob_nsect; 6778c2ecf20Sopenharmony_ci u8 hob_lbal; 6788c2ecf20Sopenharmony_ci u8 hob_lbam; 6798c2ecf20Sopenharmony_ci u8 hob_lbah; 6808c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 6818c2ecf20Sopenharmony_ci 6828c2ecf20Sopenharmony_cistruct ipr_auto_sense { 6838c2ecf20Sopenharmony_ci __be16 auto_sense_len; 6848c2ecf20Sopenharmony_ci __be16 ioa_data_len; 6858c2ecf20Sopenharmony_ci __be32 data[SCSI_SENSE_BUFFERSIZE/sizeof(__be32)]; 6868c2ecf20Sopenharmony_ci}; 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_cistruct ipr_ioasa_hdr { 6898c2ecf20Sopenharmony_ci __be32 ioasc; 6908c2ecf20Sopenharmony_ci#define IPR_IOASC_SENSE_KEY(ioasc) ((ioasc) >> 24) 6918c2ecf20Sopenharmony_ci#define IPR_IOASC_SENSE_CODE(ioasc) (((ioasc) & 0x00ff0000) >> 16) 6928c2ecf20Sopenharmony_ci#define IPR_IOASC_SENSE_QUAL(ioasc) (((ioasc) & 0x0000ff00) >> 8) 6938c2ecf20Sopenharmony_ci#define IPR_IOASC_SENSE_STATUS(ioasc) ((ioasc) & 0x000000ff) 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_ci __be16 ret_stat_len; /* Length of the returned IOASA */ 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_ci __be16 avail_stat_len; /* Total Length of status available. */ 6988c2ecf20Sopenharmony_ci 6998c2ecf20Sopenharmony_ci __be32 residual_data_len; /* number of bytes in the host data */ 7008c2ecf20Sopenharmony_ci /* buffers that were not used by the IOARCB command. */ 7018c2ecf20Sopenharmony_ci 7028c2ecf20Sopenharmony_ci __be32 ilid; 7038c2ecf20Sopenharmony_ci#define IPR_NO_ILID 0 7048c2ecf20Sopenharmony_ci#define IPR_DRIVER_ILID 0xffffffff 7058c2ecf20Sopenharmony_ci 7068c2ecf20Sopenharmony_ci __be32 fd_ioasc; 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci __be32 fd_phys_locator; 7098c2ecf20Sopenharmony_ci 7108c2ecf20Sopenharmony_ci __be32 fd_res_handle; 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_ci __be32 ioasc_specific; /* status code specific field */ 7138c2ecf20Sopenharmony_ci#define IPR_ADDITIONAL_STATUS_FMT 0x80000000 7148c2ecf20Sopenharmony_ci#define IPR_AUTOSENSE_VALID 0x40000000 7158c2ecf20Sopenharmony_ci#define IPR_ATA_DEVICE_WAS_RESET 0x20000000 7168c2ecf20Sopenharmony_ci#define IPR_IOASC_SPECIFIC_MASK 0x00ffffff 7178c2ecf20Sopenharmony_ci#define IPR_FIELD_POINTER_VALID (0x80000000 >> 8) 7188c2ecf20Sopenharmony_ci#define IPR_FIELD_POINTER_MASK 0x0000ffff 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 7218c2ecf20Sopenharmony_ci 7228c2ecf20Sopenharmony_cistruct ipr_ioasa { 7238c2ecf20Sopenharmony_ci struct ipr_ioasa_hdr hdr; 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_ci union { 7268c2ecf20Sopenharmony_ci struct ipr_ioasa_vset vset; 7278c2ecf20Sopenharmony_ci struct ipr_ioasa_af_dasd dasd; 7288c2ecf20Sopenharmony_ci struct ipr_ioasa_gpdd gpdd; 7298c2ecf20Sopenharmony_ci struct ipr_ioasa_gata gata; 7308c2ecf20Sopenharmony_ci } u; 7318c2ecf20Sopenharmony_ci 7328c2ecf20Sopenharmony_ci struct ipr_auto_sense auto_sense; 7338c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 7348c2ecf20Sopenharmony_ci 7358c2ecf20Sopenharmony_cistruct ipr_ioasa64 { 7368c2ecf20Sopenharmony_ci struct ipr_ioasa_hdr hdr; 7378c2ecf20Sopenharmony_ci u8 fd_res_path[8]; 7388c2ecf20Sopenharmony_ci 7398c2ecf20Sopenharmony_ci union { 7408c2ecf20Sopenharmony_ci struct ipr_ioasa_vset vset; 7418c2ecf20Sopenharmony_ci struct ipr_ioasa_af_dasd dasd; 7428c2ecf20Sopenharmony_ci struct ipr_ioasa_gpdd gpdd; 7438c2ecf20Sopenharmony_ci struct ipr_ioasa_gata gata; 7448c2ecf20Sopenharmony_ci } u; 7458c2ecf20Sopenharmony_ci 7468c2ecf20Sopenharmony_ci struct ipr_auto_sense auto_sense; 7478c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_cistruct ipr_mode_parm_hdr { 7508c2ecf20Sopenharmony_ci u8 length; 7518c2ecf20Sopenharmony_ci u8 medium_type; 7528c2ecf20Sopenharmony_ci u8 device_spec_parms; 7538c2ecf20Sopenharmony_ci u8 block_desc_len; 7548c2ecf20Sopenharmony_ci}__attribute__((packed)); 7558c2ecf20Sopenharmony_ci 7568c2ecf20Sopenharmony_cistruct ipr_mode_pages { 7578c2ecf20Sopenharmony_ci struct ipr_mode_parm_hdr hdr; 7588c2ecf20Sopenharmony_ci u8 data[255 - sizeof(struct ipr_mode_parm_hdr)]; 7598c2ecf20Sopenharmony_ci}__attribute__((packed)); 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_cistruct ipr_mode_page_hdr { 7628c2ecf20Sopenharmony_ci u8 ps_page_code; 7638c2ecf20Sopenharmony_ci#define IPR_MODE_PAGE_PS 0x80 7648c2ecf20Sopenharmony_ci#define IPR_GET_MODE_PAGE_CODE(hdr) ((hdr)->ps_page_code & 0x3F) 7658c2ecf20Sopenharmony_ci u8 page_length; 7668c2ecf20Sopenharmony_ci}__attribute__ ((packed)); 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_cistruct ipr_dev_bus_entry { 7698c2ecf20Sopenharmony_ci struct ipr_res_addr res_addr; 7708c2ecf20Sopenharmony_ci u8 flags; 7718c2ecf20Sopenharmony_ci#define IPR_SCSI_ATTR_ENABLE_QAS 0x80 7728c2ecf20Sopenharmony_ci#define IPR_SCSI_ATTR_DISABLE_QAS 0x40 7738c2ecf20Sopenharmony_ci#define IPR_SCSI_ATTR_QAS_MASK 0xC0 7748c2ecf20Sopenharmony_ci#define IPR_SCSI_ATTR_ENABLE_TM 0x20 7758c2ecf20Sopenharmony_ci#define IPR_SCSI_ATTR_NO_TERM_PWR 0x10 7768c2ecf20Sopenharmony_ci#define IPR_SCSI_ATTR_TM_SUPPORTED 0x08 7778c2ecf20Sopenharmony_ci#define IPR_SCSI_ATTR_LVD_TO_SE_NOT_ALLOWED 0x04 7788c2ecf20Sopenharmony_ci 7798c2ecf20Sopenharmony_ci u8 scsi_id; 7808c2ecf20Sopenharmony_ci u8 bus_width; 7818c2ecf20Sopenharmony_ci u8 extended_reset_delay; 7828c2ecf20Sopenharmony_ci#define IPR_EXTENDED_RESET_DELAY 7 7838c2ecf20Sopenharmony_ci 7848c2ecf20Sopenharmony_ci __be32 max_xfer_rate; 7858c2ecf20Sopenharmony_ci 7868c2ecf20Sopenharmony_ci u8 spinup_delay; 7878c2ecf20Sopenharmony_ci u8 reserved3; 7888c2ecf20Sopenharmony_ci __be16 reserved4; 7898c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 7908c2ecf20Sopenharmony_ci 7918c2ecf20Sopenharmony_cistruct ipr_mode_page28 { 7928c2ecf20Sopenharmony_ci struct ipr_mode_page_hdr hdr; 7938c2ecf20Sopenharmony_ci u8 num_entries; 7948c2ecf20Sopenharmony_ci u8 entry_length; 7958c2ecf20Sopenharmony_ci struct ipr_dev_bus_entry bus[]; 7968c2ecf20Sopenharmony_ci}__attribute__((packed)); 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_cistruct ipr_mode_page24 { 7998c2ecf20Sopenharmony_ci struct ipr_mode_page_hdr hdr; 8008c2ecf20Sopenharmony_ci u8 flags; 8018c2ecf20Sopenharmony_ci#define IPR_ENABLE_DUAL_IOA_AF 0x80 8028c2ecf20Sopenharmony_ci}__attribute__((packed)); 8038c2ecf20Sopenharmony_ci 8048c2ecf20Sopenharmony_cistruct ipr_ioa_vpd { 8058c2ecf20Sopenharmony_ci struct ipr_std_inq_data std_inq_data; 8068c2ecf20Sopenharmony_ci u8 ascii_part_num[12]; 8078c2ecf20Sopenharmony_ci u8 reserved[40]; 8088c2ecf20Sopenharmony_ci u8 ascii_plant_code[4]; 8098c2ecf20Sopenharmony_ci}__attribute__((packed)); 8108c2ecf20Sopenharmony_ci 8118c2ecf20Sopenharmony_cistruct ipr_inquiry_page3 { 8128c2ecf20Sopenharmony_ci u8 peri_qual_dev_type; 8138c2ecf20Sopenharmony_ci u8 page_code; 8148c2ecf20Sopenharmony_ci u8 reserved1; 8158c2ecf20Sopenharmony_ci u8 page_length; 8168c2ecf20Sopenharmony_ci u8 ascii_len; 8178c2ecf20Sopenharmony_ci u8 reserved2[3]; 8188c2ecf20Sopenharmony_ci u8 load_id[4]; 8198c2ecf20Sopenharmony_ci u8 major_release; 8208c2ecf20Sopenharmony_ci u8 card_type; 8218c2ecf20Sopenharmony_ci u8 minor_release[2]; 8228c2ecf20Sopenharmony_ci u8 ptf_number[4]; 8238c2ecf20Sopenharmony_ci u8 patch_number[4]; 8248c2ecf20Sopenharmony_ci}__attribute__((packed)); 8258c2ecf20Sopenharmony_ci 8268c2ecf20Sopenharmony_cistruct ipr_inquiry_cap { 8278c2ecf20Sopenharmony_ci u8 peri_qual_dev_type; 8288c2ecf20Sopenharmony_ci u8 page_code; 8298c2ecf20Sopenharmony_ci u8 reserved1; 8308c2ecf20Sopenharmony_ci u8 page_length; 8318c2ecf20Sopenharmony_ci u8 ascii_len; 8328c2ecf20Sopenharmony_ci u8 reserved2; 8338c2ecf20Sopenharmony_ci u8 sis_version[2]; 8348c2ecf20Sopenharmony_ci u8 cap; 8358c2ecf20Sopenharmony_ci#define IPR_CAP_DUAL_IOA_RAID 0x80 8368c2ecf20Sopenharmony_ci u8 reserved3[15]; 8378c2ecf20Sopenharmony_ci}__attribute__((packed)); 8388c2ecf20Sopenharmony_ci 8398c2ecf20Sopenharmony_ci#define IPR_INQUIRY_PAGE0_ENTRIES 20 8408c2ecf20Sopenharmony_cistruct ipr_inquiry_page0 { 8418c2ecf20Sopenharmony_ci u8 peri_qual_dev_type; 8428c2ecf20Sopenharmony_ci u8 page_code; 8438c2ecf20Sopenharmony_ci u8 reserved1; 8448c2ecf20Sopenharmony_ci u8 len; 8458c2ecf20Sopenharmony_ci u8 page[IPR_INQUIRY_PAGE0_ENTRIES]; 8468c2ecf20Sopenharmony_ci}__attribute__((packed)); 8478c2ecf20Sopenharmony_ci 8488c2ecf20Sopenharmony_cistruct ipr_inquiry_pageC4 { 8498c2ecf20Sopenharmony_ci u8 peri_qual_dev_type; 8508c2ecf20Sopenharmony_ci u8 page_code; 8518c2ecf20Sopenharmony_ci u8 reserved1; 8528c2ecf20Sopenharmony_ci u8 len; 8538c2ecf20Sopenharmony_ci u8 cache_cap[4]; 8548c2ecf20Sopenharmony_ci#define IPR_CAP_SYNC_CACHE 0x08 8558c2ecf20Sopenharmony_ci u8 reserved2[20]; 8568c2ecf20Sopenharmony_ci} __packed; 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_cistruct ipr_hostrcb_device_data_entry { 8598c2ecf20Sopenharmony_ci struct ipr_vpd vpd; 8608c2ecf20Sopenharmony_ci struct ipr_res_addr dev_res_addr; 8618c2ecf20Sopenharmony_ci struct ipr_vpd new_vpd; 8628c2ecf20Sopenharmony_ci struct ipr_vpd ioa_last_with_dev_vpd; 8638c2ecf20Sopenharmony_ci struct ipr_vpd cfc_last_with_dev_vpd; 8648c2ecf20Sopenharmony_ci __be32 ioa_data[5]; 8658c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_cistruct ipr_hostrcb_device_data_entry_enhanced { 8688c2ecf20Sopenharmony_ci struct ipr_ext_vpd vpd; 8698c2ecf20Sopenharmony_ci u8 ccin[4]; 8708c2ecf20Sopenharmony_ci struct ipr_res_addr dev_res_addr; 8718c2ecf20Sopenharmony_ci struct ipr_ext_vpd new_vpd; 8728c2ecf20Sopenharmony_ci u8 new_ccin[4]; 8738c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_last_with_dev_vpd; 8748c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_last_with_dev_vpd; 8758c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_cistruct ipr_hostrcb64_device_data_entry_enhanced { 8788c2ecf20Sopenharmony_ci struct ipr_ext_vpd vpd; 8798c2ecf20Sopenharmony_ci u8 ccin[4]; 8808c2ecf20Sopenharmony_ci u8 res_path[8]; 8818c2ecf20Sopenharmony_ci struct ipr_ext_vpd new_vpd; 8828c2ecf20Sopenharmony_ci u8 new_ccin[4]; 8838c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_last_with_dev_vpd; 8848c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_last_with_dev_vpd; 8858c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 8868c2ecf20Sopenharmony_ci 8878c2ecf20Sopenharmony_cistruct ipr_hostrcb_array_data_entry { 8888c2ecf20Sopenharmony_ci struct ipr_vpd vpd; 8898c2ecf20Sopenharmony_ci struct ipr_res_addr expected_dev_res_addr; 8908c2ecf20Sopenharmony_ci struct ipr_res_addr dev_res_addr; 8918c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 8928c2ecf20Sopenharmony_ci 8938c2ecf20Sopenharmony_cistruct ipr_hostrcb64_array_data_entry { 8948c2ecf20Sopenharmony_ci struct ipr_ext_vpd vpd; 8958c2ecf20Sopenharmony_ci u8 ccin[4]; 8968c2ecf20Sopenharmony_ci u8 expected_res_path[8]; 8978c2ecf20Sopenharmony_ci u8 res_path[8]; 8988c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 8998c2ecf20Sopenharmony_ci 9008c2ecf20Sopenharmony_cistruct ipr_hostrcb_array_data_entry_enhanced { 9018c2ecf20Sopenharmony_ci struct ipr_ext_vpd vpd; 9028c2ecf20Sopenharmony_ci u8 ccin[4]; 9038c2ecf20Sopenharmony_ci struct ipr_res_addr expected_dev_res_addr; 9048c2ecf20Sopenharmony_ci struct ipr_res_addr dev_res_addr; 9058c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9068c2ecf20Sopenharmony_ci 9078c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_ff_error { 9088c2ecf20Sopenharmony_ci __be32 ioa_data[758]; 9098c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9108c2ecf20Sopenharmony_ci 9118c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_01_error { 9128c2ecf20Sopenharmony_ci __be32 seek_counter; 9138c2ecf20Sopenharmony_ci __be32 read_counter; 9148c2ecf20Sopenharmony_ci u8 sense_data[32]; 9158c2ecf20Sopenharmony_ci __be32 ioa_data[236]; 9168c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9178c2ecf20Sopenharmony_ci 9188c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_21_error { 9198c2ecf20Sopenharmony_ci __be32 wwn[4]; 9208c2ecf20Sopenharmony_ci u8 res_path[8]; 9218c2ecf20Sopenharmony_ci u8 primary_problem_desc[32]; 9228c2ecf20Sopenharmony_ci u8 second_problem_desc[32]; 9238c2ecf20Sopenharmony_ci __be32 sense_data[8]; 9248c2ecf20Sopenharmony_ci __be32 cdb[4]; 9258c2ecf20Sopenharmony_ci __be32 residual_trans_length; 9268c2ecf20Sopenharmony_ci __be32 length_of_error; 9278c2ecf20Sopenharmony_ci __be32 ioa_data[236]; 9288c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9298c2ecf20Sopenharmony_ci 9308c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_02_error { 9318c2ecf20Sopenharmony_ci struct ipr_vpd ioa_vpd; 9328c2ecf20Sopenharmony_ci struct ipr_vpd cfc_vpd; 9338c2ecf20Sopenharmony_ci struct ipr_vpd ioa_last_attached_to_cfc_vpd; 9348c2ecf20Sopenharmony_ci struct ipr_vpd cfc_last_attached_to_ioa_vpd; 9358c2ecf20Sopenharmony_ci __be32 ioa_data[3]; 9368c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_12_error { 9398c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_vpd; 9408c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_vpd; 9418c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_last_attached_to_cfc_vpd; 9428c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_last_attached_to_ioa_vpd; 9438c2ecf20Sopenharmony_ci __be32 ioa_data[3]; 9448c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9458c2ecf20Sopenharmony_ci 9468c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_03_error { 9478c2ecf20Sopenharmony_ci struct ipr_vpd ioa_vpd; 9488c2ecf20Sopenharmony_ci struct ipr_vpd cfc_vpd; 9498c2ecf20Sopenharmony_ci __be32 errors_detected; 9508c2ecf20Sopenharmony_ci __be32 errors_logged; 9518c2ecf20Sopenharmony_ci u8 ioa_data[12]; 9528c2ecf20Sopenharmony_ci struct ipr_hostrcb_device_data_entry dev[3]; 9538c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9548c2ecf20Sopenharmony_ci 9558c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_13_error { 9568c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_vpd; 9578c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_vpd; 9588c2ecf20Sopenharmony_ci __be32 errors_detected; 9598c2ecf20Sopenharmony_ci __be32 errors_logged; 9608c2ecf20Sopenharmony_ci struct ipr_hostrcb_device_data_entry_enhanced dev[3]; 9618c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9628c2ecf20Sopenharmony_ci 9638c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_23_error { 9648c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_vpd; 9658c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_vpd; 9668c2ecf20Sopenharmony_ci __be32 errors_detected; 9678c2ecf20Sopenharmony_ci __be32 errors_logged; 9688c2ecf20Sopenharmony_ci struct ipr_hostrcb64_device_data_entry_enhanced dev[3]; 9698c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9708c2ecf20Sopenharmony_ci 9718c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_04_error { 9728c2ecf20Sopenharmony_ci struct ipr_vpd ioa_vpd; 9738c2ecf20Sopenharmony_ci struct ipr_vpd cfc_vpd; 9748c2ecf20Sopenharmony_ci u8 ioa_data[12]; 9758c2ecf20Sopenharmony_ci struct ipr_hostrcb_array_data_entry array_member[10]; 9768c2ecf20Sopenharmony_ci __be32 exposed_mode_adn; 9778c2ecf20Sopenharmony_ci __be32 array_id; 9788c2ecf20Sopenharmony_ci struct ipr_vpd incomp_dev_vpd; 9798c2ecf20Sopenharmony_ci __be32 ioa_data2; 9808c2ecf20Sopenharmony_ci struct ipr_hostrcb_array_data_entry array_member2[8]; 9818c2ecf20Sopenharmony_ci struct ipr_res_addr last_func_vset_res_addr; 9828c2ecf20Sopenharmony_ci u8 vset_serial_num[IPR_SERIAL_NUM_LEN]; 9838c2ecf20Sopenharmony_ci u8 protection_level[8]; 9848c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9858c2ecf20Sopenharmony_ci 9868c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_14_error { 9878c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_vpd; 9888c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_vpd; 9898c2ecf20Sopenharmony_ci __be32 exposed_mode_adn; 9908c2ecf20Sopenharmony_ci __be32 array_id; 9918c2ecf20Sopenharmony_ci struct ipr_res_addr last_func_vset_res_addr; 9928c2ecf20Sopenharmony_ci u8 vset_serial_num[IPR_SERIAL_NUM_LEN]; 9938c2ecf20Sopenharmony_ci u8 protection_level[8]; 9948c2ecf20Sopenharmony_ci __be32 num_entries; 9958c2ecf20Sopenharmony_ci struct ipr_hostrcb_array_data_entry_enhanced array_member[18]; 9968c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 9978c2ecf20Sopenharmony_ci 9988c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_24_error { 9998c2ecf20Sopenharmony_ci struct ipr_ext_vpd ioa_vpd; 10008c2ecf20Sopenharmony_ci struct ipr_ext_vpd cfc_vpd; 10018c2ecf20Sopenharmony_ci u8 reserved[2]; 10028c2ecf20Sopenharmony_ci u8 exposed_mode_adn; 10038c2ecf20Sopenharmony_ci#define IPR_INVALID_ARRAY_DEV_NUM 0xff 10048c2ecf20Sopenharmony_ci u8 array_id; 10058c2ecf20Sopenharmony_ci u8 last_res_path[8]; 10068c2ecf20Sopenharmony_ci u8 protection_level[8]; 10078c2ecf20Sopenharmony_ci struct ipr_ext_vpd64 array_vpd; 10088c2ecf20Sopenharmony_ci u8 description[16]; 10098c2ecf20Sopenharmony_ci u8 reserved2[3]; 10108c2ecf20Sopenharmony_ci u8 num_entries; 10118c2ecf20Sopenharmony_ci struct ipr_hostrcb64_array_data_entry array_member[32]; 10128c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 10138c2ecf20Sopenharmony_ci 10148c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_07_error { 10158c2ecf20Sopenharmony_ci u8 failure_reason[64]; 10168c2ecf20Sopenharmony_ci struct ipr_vpd vpd; 10178c2ecf20Sopenharmony_ci __be32 data[222]; 10188c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 10198c2ecf20Sopenharmony_ci 10208c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_17_error { 10218c2ecf20Sopenharmony_ci u8 failure_reason[64]; 10228c2ecf20Sopenharmony_ci struct ipr_ext_vpd vpd; 10238c2ecf20Sopenharmony_ci __be32 data[476]; 10248c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 10258c2ecf20Sopenharmony_ci 10268c2ecf20Sopenharmony_cistruct ipr_hostrcb_config_element { 10278c2ecf20Sopenharmony_ci u8 type_status; 10288c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_TYPE_MASK 0xF0 10298c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_NOT_EXIST 0x00 10308c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_IOA_PORT 0x10 10318c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_EXP_PORT 0x20 10328c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_DEVICE_PORT 0x30 10338c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_DEVICE_LUN 0x40 10348c2ecf20Sopenharmony_ci 10358c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_STATUS_MASK 0x0F 10368c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_NO_PROB 0x00 10378c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_DEGRADED 0x01 10388c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_FAILED 0x02 10398c2ecf20Sopenharmony_ci#define IPR_PATH_CFG_SUSPECT 0x03 10408c2ecf20Sopenharmony_ci#define IPR_PATH_NOT_DETECTED 0x04 10418c2ecf20Sopenharmony_ci#define IPR_PATH_INCORRECT_CONN 0x05 10428c2ecf20Sopenharmony_ci 10438c2ecf20Sopenharmony_ci u8 cascaded_expander; 10448c2ecf20Sopenharmony_ci u8 phy; 10458c2ecf20Sopenharmony_ci u8 link_rate; 10468c2ecf20Sopenharmony_ci#define IPR_PHY_LINK_RATE_MASK 0x0F 10478c2ecf20Sopenharmony_ci 10488c2ecf20Sopenharmony_ci __be32 wwid[2]; 10498c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 10508c2ecf20Sopenharmony_ci 10518c2ecf20Sopenharmony_cistruct ipr_hostrcb64_config_element { 10528c2ecf20Sopenharmony_ci __be16 length; 10538c2ecf20Sopenharmony_ci u8 descriptor_id; 10548c2ecf20Sopenharmony_ci#define IPR_DESCRIPTOR_MASK 0xC0 10558c2ecf20Sopenharmony_ci#define IPR_DESCRIPTOR_SIS64 0x00 10568c2ecf20Sopenharmony_ci 10578c2ecf20Sopenharmony_ci u8 reserved; 10588c2ecf20Sopenharmony_ci u8 type_status; 10598c2ecf20Sopenharmony_ci 10608c2ecf20Sopenharmony_ci u8 reserved2[2]; 10618c2ecf20Sopenharmony_ci u8 link_rate; 10628c2ecf20Sopenharmony_ci 10638c2ecf20Sopenharmony_ci u8 res_path[8]; 10648c2ecf20Sopenharmony_ci __be32 wwid[2]; 10658c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (8))); 10668c2ecf20Sopenharmony_ci 10678c2ecf20Sopenharmony_cistruct ipr_hostrcb_fabric_desc { 10688c2ecf20Sopenharmony_ci __be16 length; 10698c2ecf20Sopenharmony_ci u8 ioa_port; 10708c2ecf20Sopenharmony_ci u8 cascaded_expander; 10718c2ecf20Sopenharmony_ci u8 phy; 10728c2ecf20Sopenharmony_ci u8 path_state; 10738c2ecf20Sopenharmony_ci#define IPR_PATH_ACTIVE_MASK 0xC0 10748c2ecf20Sopenharmony_ci#define IPR_PATH_NO_INFO 0x00 10758c2ecf20Sopenharmony_ci#define IPR_PATH_ACTIVE 0x40 10768c2ecf20Sopenharmony_ci#define IPR_PATH_NOT_ACTIVE 0x80 10778c2ecf20Sopenharmony_ci 10788c2ecf20Sopenharmony_ci#define IPR_PATH_STATE_MASK 0x0F 10798c2ecf20Sopenharmony_ci#define IPR_PATH_STATE_NO_INFO 0x00 10808c2ecf20Sopenharmony_ci#define IPR_PATH_HEALTHY 0x01 10818c2ecf20Sopenharmony_ci#define IPR_PATH_DEGRADED 0x02 10828c2ecf20Sopenharmony_ci#define IPR_PATH_FAILED 0x03 10838c2ecf20Sopenharmony_ci 10848c2ecf20Sopenharmony_ci __be16 num_entries; 10858c2ecf20Sopenharmony_ci struct ipr_hostrcb_config_element elem[1]; 10868c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 10878c2ecf20Sopenharmony_ci 10888c2ecf20Sopenharmony_cistruct ipr_hostrcb64_fabric_desc { 10898c2ecf20Sopenharmony_ci __be16 length; 10908c2ecf20Sopenharmony_ci u8 descriptor_id; 10918c2ecf20Sopenharmony_ci 10928c2ecf20Sopenharmony_ci u8 reserved[2]; 10938c2ecf20Sopenharmony_ci u8 path_state; 10948c2ecf20Sopenharmony_ci 10958c2ecf20Sopenharmony_ci u8 reserved2[2]; 10968c2ecf20Sopenharmony_ci u8 res_path[8]; 10978c2ecf20Sopenharmony_ci u8 reserved3[6]; 10988c2ecf20Sopenharmony_ci __be16 num_entries; 10998c2ecf20Sopenharmony_ci struct ipr_hostrcb64_config_element elem[1]; 11008c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (8))); 11018c2ecf20Sopenharmony_ci 11028c2ecf20Sopenharmony_ci#define for_each_hrrq(hrrq, ioa_cfg) \ 11038c2ecf20Sopenharmony_ci for (hrrq = (ioa_cfg)->hrrq; \ 11048c2ecf20Sopenharmony_ci hrrq < ((ioa_cfg)->hrrq + (ioa_cfg)->hrrq_num); hrrq++) 11058c2ecf20Sopenharmony_ci 11068c2ecf20Sopenharmony_ci#define for_each_fabric_cfg(fabric, cfg) \ 11078c2ecf20Sopenharmony_ci for (cfg = (fabric)->elem; \ 11088c2ecf20Sopenharmony_ci cfg < ((fabric)->elem + be16_to_cpu((fabric)->num_entries)); \ 11098c2ecf20Sopenharmony_ci cfg++) 11108c2ecf20Sopenharmony_ci 11118c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_20_error { 11128c2ecf20Sopenharmony_ci u8 failure_reason[64]; 11138c2ecf20Sopenharmony_ci u8 reserved[3]; 11148c2ecf20Sopenharmony_ci u8 num_entries; 11158c2ecf20Sopenharmony_ci struct ipr_hostrcb_fabric_desc desc[1]; 11168c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 11178c2ecf20Sopenharmony_ci 11188c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_30_error { 11198c2ecf20Sopenharmony_ci u8 failure_reason[64]; 11208c2ecf20Sopenharmony_ci u8 reserved[3]; 11218c2ecf20Sopenharmony_ci u8 num_entries; 11228c2ecf20Sopenharmony_ci struct ipr_hostrcb64_fabric_desc desc[1]; 11238c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 11248c2ecf20Sopenharmony_ci 11258c2ecf20Sopenharmony_cistruct ipr_hostrcb_type_41_error { 11268c2ecf20Sopenharmony_ci u8 failure_reason[64]; 11278c2ecf20Sopenharmony_ci __be32 data[200]; 11288c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 11298c2ecf20Sopenharmony_ci 11308c2ecf20Sopenharmony_cistruct ipr_hostrcb_error { 11318c2ecf20Sopenharmony_ci __be32 fd_ioasc; 11328c2ecf20Sopenharmony_ci struct ipr_res_addr fd_res_addr; 11338c2ecf20Sopenharmony_ci __be32 fd_res_handle; 11348c2ecf20Sopenharmony_ci __be32 prc; 11358c2ecf20Sopenharmony_ci union { 11368c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_ff_error type_ff_error; 11378c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_01_error type_01_error; 11388c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_02_error type_02_error; 11398c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_03_error type_03_error; 11408c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_04_error type_04_error; 11418c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_07_error type_07_error; 11428c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_12_error type_12_error; 11438c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_13_error type_13_error; 11448c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_14_error type_14_error; 11458c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_17_error type_17_error; 11468c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_20_error type_20_error; 11478c2ecf20Sopenharmony_ci } u; 11488c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 11498c2ecf20Sopenharmony_ci 11508c2ecf20Sopenharmony_cistruct ipr_hostrcb64_error { 11518c2ecf20Sopenharmony_ci __be32 fd_ioasc; 11528c2ecf20Sopenharmony_ci __be32 ioa_fw_level; 11538c2ecf20Sopenharmony_ci __be32 fd_res_handle; 11548c2ecf20Sopenharmony_ci __be32 prc; 11558c2ecf20Sopenharmony_ci __be64 fd_dev_id; 11568c2ecf20Sopenharmony_ci __be64 fd_lun; 11578c2ecf20Sopenharmony_ci u8 fd_res_path[8]; 11588c2ecf20Sopenharmony_ci __be64 time_stamp; 11598c2ecf20Sopenharmony_ci u8 reserved[16]; 11608c2ecf20Sopenharmony_ci union { 11618c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_ff_error type_ff_error; 11628c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_12_error type_12_error; 11638c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_17_error type_17_error; 11648c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_21_error type_21_error; 11658c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_23_error type_23_error; 11668c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_24_error type_24_error; 11678c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_30_error type_30_error; 11688c2ecf20Sopenharmony_ci struct ipr_hostrcb_type_41_error type_41_error; 11698c2ecf20Sopenharmony_ci } u; 11708c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (8))); 11718c2ecf20Sopenharmony_ci 11728c2ecf20Sopenharmony_cistruct ipr_hostrcb_raw { 11738c2ecf20Sopenharmony_ci __be32 data[sizeof(struct ipr_hostrcb_error)/sizeof(__be32)]; 11748c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 11758c2ecf20Sopenharmony_ci 11768c2ecf20Sopenharmony_cistruct ipr_hcam { 11778c2ecf20Sopenharmony_ci u8 op_code; 11788c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OP_CODE_CONFIG_CHANGE 0xE1 11798c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OP_CODE_LOG_DATA 0xE2 11808c2ecf20Sopenharmony_ci 11818c2ecf20Sopenharmony_ci u8 notify_type; 11828c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_NOTIF_TYPE_EXISTING_CHANGED 0x00 11838c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_NOTIF_TYPE_NEW_ENTRY 0x01 11848c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY 0x02 11858c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_NOTIF_TYPE_ERROR_LOG_ENTRY 0x10 11868c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_NOTIF_TYPE_INFORMATION_ENTRY 0x11 11878c2ecf20Sopenharmony_ci 11888c2ecf20Sopenharmony_ci u8 notifications_lost; 11898c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_NO_NOTIFICATIONS_LOST 0 11908c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_NOTIFICATIONS_LOST 0x80 11918c2ecf20Sopenharmony_ci 11928c2ecf20Sopenharmony_ci u8 flags; 11938c2ecf20Sopenharmony_ci#define IPR_HOSTRCB_INTERNAL_OPER 0x80 11948c2ecf20Sopenharmony_ci#define IPR_HOSTRCB_ERR_RESP_SENT 0x40 11958c2ecf20Sopenharmony_ci 11968c2ecf20Sopenharmony_ci u8 overlay_id; 11978c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_1 0x01 11988c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_2 0x02 11998c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_3 0x03 12008c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_4 0x04 12018c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_6 0x06 12028c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_7 0x07 12038c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_12 0x12 12048c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_13 0x13 12058c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_14 0x14 12068c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_16 0x16 12078c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_17 0x17 12088c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_20 0x20 12098c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_21 0x21 12108c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_23 0x23 12118c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_24 0x24 12128c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_26 0x26 12138c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_30 0x30 12148c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_41 0x41 12158c2ecf20Sopenharmony_ci#define IPR_HOST_RCB_OVERLAY_ID_DEFAULT 0xFF 12168c2ecf20Sopenharmony_ci 12178c2ecf20Sopenharmony_ci u8 reserved1[3]; 12188c2ecf20Sopenharmony_ci __be32 ilid; 12198c2ecf20Sopenharmony_ci __be32 time_since_last_ioa_reset; 12208c2ecf20Sopenharmony_ci __be32 reserved2; 12218c2ecf20Sopenharmony_ci __be32 length; 12228c2ecf20Sopenharmony_ci 12238c2ecf20Sopenharmony_ci union { 12248c2ecf20Sopenharmony_ci struct ipr_hostrcb_error error; 12258c2ecf20Sopenharmony_ci struct ipr_hostrcb64_error error64; 12268c2ecf20Sopenharmony_ci struct ipr_hostrcb_cfg_ch_not ccn; 12278c2ecf20Sopenharmony_ci struct ipr_hostrcb_raw raw; 12288c2ecf20Sopenharmony_ci } u; 12298c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 12308c2ecf20Sopenharmony_ci 12318c2ecf20Sopenharmony_cistruct ipr_hostrcb { 12328c2ecf20Sopenharmony_ci struct ipr_hcam hcam; 12338c2ecf20Sopenharmony_ci dma_addr_t hostrcb_dma; 12348c2ecf20Sopenharmony_ci struct list_head queue; 12358c2ecf20Sopenharmony_ci struct ipr_ioa_cfg *ioa_cfg; 12368c2ecf20Sopenharmony_ci char rp_buffer[IPR_MAX_RES_PATH_LENGTH]; 12378c2ecf20Sopenharmony_ci}; 12388c2ecf20Sopenharmony_ci 12398c2ecf20Sopenharmony_ci/* IPR smart dump table structures */ 12408c2ecf20Sopenharmony_cistruct ipr_sdt_entry { 12418c2ecf20Sopenharmony_ci __be32 start_token; 12428c2ecf20Sopenharmony_ci __be32 end_token; 12438c2ecf20Sopenharmony_ci u8 reserved[4]; 12448c2ecf20Sopenharmony_ci 12458c2ecf20Sopenharmony_ci u8 flags; 12468c2ecf20Sopenharmony_ci#define IPR_SDT_ENDIAN 0x80 12478c2ecf20Sopenharmony_ci#define IPR_SDT_VALID_ENTRY 0x20 12488c2ecf20Sopenharmony_ci 12498c2ecf20Sopenharmony_ci u8 resv; 12508c2ecf20Sopenharmony_ci __be16 priority; 12518c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 12528c2ecf20Sopenharmony_ci 12538c2ecf20Sopenharmony_cistruct ipr_sdt_header { 12548c2ecf20Sopenharmony_ci __be32 state; 12558c2ecf20Sopenharmony_ci __be32 num_entries; 12568c2ecf20Sopenharmony_ci __be32 num_entries_used; 12578c2ecf20Sopenharmony_ci __be32 dump_size; 12588c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 12598c2ecf20Sopenharmony_ci 12608c2ecf20Sopenharmony_cistruct ipr_sdt { 12618c2ecf20Sopenharmony_ci struct ipr_sdt_header hdr; 12628c2ecf20Sopenharmony_ci struct ipr_sdt_entry entry[IPR_FMT3_NUM_SDT_ENTRIES]; 12638c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 12648c2ecf20Sopenharmony_ci 12658c2ecf20Sopenharmony_cistruct ipr_uc_sdt { 12668c2ecf20Sopenharmony_ci struct ipr_sdt_header hdr; 12678c2ecf20Sopenharmony_ci struct ipr_sdt_entry entry[1]; 12688c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 12698c2ecf20Sopenharmony_ci 12708c2ecf20Sopenharmony_ci/* 12718c2ecf20Sopenharmony_ci * Driver types 12728c2ecf20Sopenharmony_ci */ 12738c2ecf20Sopenharmony_cistruct ipr_bus_attributes { 12748c2ecf20Sopenharmony_ci u8 bus; 12758c2ecf20Sopenharmony_ci u8 qas_enabled; 12768c2ecf20Sopenharmony_ci u8 bus_width; 12778c2ecf20Sopenharmony_ci u8 reserved; 12788c2ecf20Sopenharmony_ci u32 max_xfer_rate; 12798c2ecf20Sopenharmony_ci}; 12808c2ecf20Sopenharmony_ci 12818c2ecf20Sopenharmony_cistruct ipr_sata_port { 12828c2ecf20Sopenharmony_ci struct ipr_ioa_cfg *ioa_cfg; 12838c2ecf20Sopenharmony_ci struct ata_port *ap; 12848c2ecf20Sopenharmony_ci struct ipr_resource_entry *res; 12858c2ecf20Sopenharmony_ci struct ipr_ioasa_gata ioasa; 12868c2ecf20Sopenharmony_ci}; 12878c2ecf20Sopenharmony_ci 12888c2ecf20Sopenharmony_cistruct ipr_resource_entry { 12898c2ecf20Sopenharmony_ci u8 needs_sync_complete:1; 12908c2ecf20Sopenharmony_ci u8 in_erp:1; 12918c2ecf20Sopenharmony_ci u8 add_to_ml:1; 12928c2ecf20Sopenharmony_ci u8 del_from_ml:1; 12938c2ecf20Sopenharmony_ci u8 resetting_device:1; 12948c2ecf20Sopenharmony_ci u8 reset_occurred:1; 12958c2ecf20Sopenharmony_ci u8 raw_mode:1; 12968c2ecf20Sopenharmony_ci 12978c2ecf20Sopenharmony_ci u32 bus; /* AKA channel */ 12988c2ecf20Sopenharmony_ci u32 target; /* AKA id */ 12998c2ecf20Sopenharmony_ci u32 lun; 13008c2ecf20Sopenharmony_ci#define IPR_ARRAY_VIRTUAL_BUS 0x1 13018c2ecf20Sopenharmony_ci#define IPR_VSET_VIRTUAL_BUS 0x2 13028c2ecf20Sopenharmony_ci#define IPR_IOAFP_VIRTUAL_BUS 0x3 13038c2ecf20Sopenharmony_ci#define IPR_MAX_SIS64_BUSES 0x4 13048c2ecf20Sopenharmony_ci 13058c2ecf20Sopenharmony_ci#define IPR_GET_RES_PHYS_LOC(res) \ 13068c2ecf20Sopenharmony_ci (((res)->bus << 24) | ((res)->target << 8) | (res)->lun) 13078c2ecf20Sopenharmony_ci 13088c2ecf20Sopenharmony_ci u8 ata_class; 13098c2ecf20Sopenharmony_ci u8 type; 13108c2ecf20Sopenharmony_ci 13118c2ecf20Sopenharmony_ci u16 flags; 13128c2ecf20Sopenharmony_ci u16 res_flags; 13138c2ecf20Sopenharmony_ci 13148c2ecf20Sopenharmony_ci u8 qmodel; 13158c2ecf20Sopenharmony_ci struct ipr_std_inq_data std_inq_data; 13168c2ecf20Sopenharmony_ci 13178c2ecf20Sopenharmony_ci __be32 res_handle; 13188c2ecf20Sopenharmony_ci __be64 dev_id; 13198c2ecf20Sopenharmony_ci u64 lun_wwn; 13208c2ecf20Sopenharmony_ci struct scsi_lun dev_lun; 13218c2ecf20Sopenharmony_ci u8 res_path[8]; 13228c2ecf20Sopenharmony_ci 13238c2ecf20Sopenharmony_ci struct ipr_ioa_cfg *ioa_cfg; 13248c2ecf20Sopenharmony_ci struct scsi_device *sdev; 13258c2ecf20Sopenharmony_ci struct ipr_sata_port *sata_port; 13268c2ecf20Sopenharmony_ci struct list_head queue; 13278c2ecf20Sopenharmony_ci}; /* struct ipr_resource_entry */ 13288c2ecf20Sopenharmony_ci 13298c2ecf20Sopenharmony_cistruct ipr_resource_hdr { 13308c2ecf20Sopenharmony_ci u16 num_entries; 13318c2ecf20Sopenharmony_ci u16 reserved; 13328c2ecf20Sopenharmony_ci}; 13338c2ecf20Sopenharmony_ci 13348c2ecf20Sopenharmony_cistruct ipr_misc_cbs { 13358c2ecf20Sopenharmony_ci struct ipr_ioa_vpd ioa_vpd; 13368c2ecf20Sopenharmony_ci struct ipr_inquiry_page0 page0_data; 13378c2ecf20Sopenharmony_ci struct ipr_inquiry_page3 page3_data; 13388c2ecf20Sopenharmony_ci struct ipr_inquiry_cap cap; 13398c2ecf20Sopenharmony_ci struct ipr_inquiry_pageC4 pageC4_data; 13408c2ecf20Sopenharmony_ci struct ipr_mode_pages mode_pages; 13418c2ecf20Sopenharmony_ci struct ipr_supported_device supp_dev; 13428c2ecf20Sopenharmony_ci}; 13438c2ecf20Sopenharmony_ci 13448c2ecf20Sopenharmony_cistruct ipr_interrupt_offsets { 13458c2ecf20Sopenharmony_ci unsigned long set_interrupt_mask_reg; 13468c2ecf20Sopenharmony_ci unsigned long clr_interrupt_mask_reg; 13478c2ecf20Sopenharmony_ci unsigned long clr_interrupt_mask_reg32; 13488c2ecf20Sopenharmony_ci unsigned long sense_interrupt_mask_reg; 13498c2ecf20Sopenharmony_ci unsigned long sense_interrupt_mask_reg32; 13508c2ecf20Sopenharmony_ci unsigned long clr_interrupt_reg; 13518c2ecf20Sopenharmony_ci unsigned long clr_interrupt_reg32; 13528c2ecf20Sopenharmony_ci 13538c2ecf20Sopenharmony_ci unsigned long sense_interrupt_reg; 13548c2ecf20Sopenharmony_ci unsigned long sense_interrupt_reg32; 13558c2ecf20Sopenharmony_ci unsigned long ioarrin_reg; 13568c2ecf20Sopenharmony_ci unsigned long sense_uproc_interrupt_reg; 13578c2ecf20Sopenharmony_ci unsigned long sense_uproc_interrupt_reg32; 13588c2ecf20Sopenharmony_ci unsigned long set_uproc_interrupt_reg; 13598c2ecf20Sopenharmony_ci unsigned long set_uproc_interrupt_reg32; 13608c2ecf20Sopenharmony_ci unsigned long clr_uproc_interrupt_reg; 13618c2ecf20Sopenharmony_ci unsigned long clr_uproc_interrupt_reg32; 13628c2ecf20Sopenharmony_ci 13638c2ecf20Sopenharmony_ci unsigned long init_feedback_reg; 13648c2ecf20Sopenharmony_ci 13658c2ecf20Sopenharmony_ci unsigned long dump_addr_reg; 13668c2ecf20Sopenharmony_ci unsigned long dump_data_reg; 13678c2ecf20Sopenharmony_ci 13688c2ecf20Sopenharmony_ci#define IPR_ENDIAN_SWAP_KEY 0x00080800 13698c2ecf20Sopenharmony_ci unsigned long endian_swap_reg; 13708c2ecf20Sopenharmony_ci}; 13718c2ecf20Sopenharmony_ci 13728c2ecf20Sopenharmony_cistruct ipr_interrupts { 13738c2ecf20Sopenharmony_ci void __iomem *set_interrupt_mask_reg; 13748c2ecf20Sopenharmony_ci void __iomem *clr_interrupt_mask_reg; 13758c2ecf20Sopenharmony_ci void __iomem *clr_interrupt_mask_reg32; 13768c2ecf20Sopenharmony_ci void __iomem *sense_interrupt_mask_reg; 13778c2ecf20Sopenharmony_ci void __iomem *sense_interrupt_mask_reg32; 13788c2ecf20Sopenharmony_ci void __iomem *clr_interrupt_reg; 13798c2ecf20Sopenharmony_ci void __iomem *clr_interrupt_reg32; 13808c2ecf20Sopenharmony_ci 13818c2ecf20Sopenharmony_ci void __iomem *sense_interrupt_reg; 13828c2ecf20Sopenharmony_ci void __iomem *sense_interrupt_reg32; 13838c2ecf20Sopenharmony_ci void __iomem *ioarrin_reg; 13848c2ecf20Sopenharmony_ci void __iomem *sense_uproc_interrupt_reg; 13858c2ecf20Sopenharmony_ci void __iomem *sense_uproc_interrupt_reg32; 13868c2ecf20Sopenharmony_ci void __iomem *set_uproc_interrupt_reg; 13878c2ecf20Sopenharmony_ci void __iomem *set_uproc_interrupt_reg32; 13888c2ecf20Sopenharmony_ci void __iomem *clr_uproc_interrupt_reg; 13898c2ecf20Sopenharmony_ci void __iomem *clr_uproc_interrupt_reg32; 13908c2ecf20Sopenharmony_ci 13918c2ecf20Sopenharmony_ci void __iomem *init_feedback_reg; 13928c2ecf20Sopenharmony_ci 13938c2ecf20Sopenharmony_ci void __iomem *dump_addr_reg; 13948c2ecf20Sopenharmony_ci void __iomem *dump_data_reg; 13958c2ecf20Sopenharmony_ci 13968c2ecf20Sopenharmony_ci void __iomem *endian_swap_reg; 13978c2ecf20Sopenharmony_ci}; 13988c2ecf20Sopenharmony_ci 13998c2ecf20Sopenharmony_cistruct ipr_chip_cfg_t { 14008c2ecf20Sopenharmony_ci u32 mailbox; 14018c2ecf20Sopenharmony_ci u16 max_cmds; 14028c2ecf20Sopenharmony_ci u8 cache_line_size; 14038c2ecf20Sopenharmony_ci u8 clear_isr; 14048c2ecf20Sopenharmony_ci u32 iopoll_weight; 14058c2ecf20Sopenharmony_ci struct ipr_interrupt_offsets regs; 14068c2ecf20Sopenharmony_ci}; 14078c2ecf20Sopenharmony_ci 14088c2ecf20Sopenharmony_cistruct ipr_chip_t { 14098c2ecf20Sopenharmony_ci u16 vendor; 14108c2ecf20Sopenharmony_ci u16 device; 14118c2ecf20Sopenharmony_ci bool has_msi; 14128c2ecf20Sopenharmony_ci u16 sis_type; 14138c2ecf20Sopenharmony_ci#define IPR_SIS32 0x00 14148c2ecf20Sopenharmony_ci#define IPR_SIS64 0x01 14158c2ecf20Sopenharmony_ci u16 bist_method; 14168c2ecf20Sopenharmony_ci#define IPR_PCI_CFG 0x00 14178c2ecf20Sopenharmony_ci#define IPR_MMIO 0x01 14188c2ecf20Sopenharmony_ci const struct ipr_chip_cfg_t *cfg; 14198c2ecf20Sopenharmony_ci}; 14208c2ecf20Sopenharmony_ci 14218c2ecf20Sopenharmony_cienum ipr_shutdown_type { 14228c2ecf20Sopenharmony_ci IPR_SHUTDOWN_NORMAL = 0x00, 14238c2ecf20Sopenharmony_ci IPR_SHUTDOWN_PREPARE_FOR_NORMAL = 0x40, 14248c2ecf20Sopenharmony_ci IPR_SHUTDOWN_ABBREV = 0x80, 14258c2ecf20Sopenharmony_ci IPR_SHUTDOWN_NONE = 0x100, 14268c2ecf20Sopenharmony_ci IPR_SHUTDOWN_QUIESCE = 0x101, 14278c2ecf20Sopenharmony_ci}; 14288c2ecf20Sopenharmony_ci 14298c2ecf20Sopenharmony_cistruct ipr_trace_entry { 14308c2ecf20Sopenharmony_ci u32 time; 14318c2ecf20Sopenharmony_ci 14328c2ecf20Sopenharmony_ci u8 op_code; 14338c2ecf20Sopenharmony_ci u8 ata_op_code; 14348c2ecf20Sopenharmony_ci u8 type; 14358c2ecf20Sopenharmony_ci#define IPR_TRACE_START 0x00 14368c2ecf20Sopenharmony_ci#define IPR_TRACE_FINISH 0xff 14378c2ecf20Sopenharmony_ci u8 cmd_index; 14388c2ecf20Sopenharmony_ci 14398c2ecf20Sopenharmony_ci __be32 res_handle; 14408c2ecf20Sopenharmony_ci union { 14418c2ecf20Sopenharmony_ci u32 ioasc; 14428c2ecf20Sopenharmony_ci u32 add_data; 14438c2ecf20Sopenharmony_ci u32 res_addr; 14448c2ecf20Sopenharmony_ci } u; 14458c2ecf20Sopenharmony_ci}; 14468c2ecf20Sopenharmony_ci 14478c2ecf20Sopenharmony_cistruct ipr_sglist { 14488c2ecf20Sopenharmony_ci u32 order; 14498c2ecf20Sopenharmony_ci u32 num_sg; 14508c2ecf20Sopenharmony_ci u32 num_dma_sg; 14518c2ecf20Sopenharmony_ci u32 buffer_len; 14528c2ecf20Sopenharmony_ci struct scatterlist *scatterlist; 14538c2ecf20Sopenharmony_ci}; 14548c2ecf20Sopenharmony_ci 14558c2ecf20Sopenharmony_cienum ipr_sdt_state { 14568c2ecf20Sopenharmony_ci INACTIVE, 14578c2ecf20Sopenharmony_ci WAIT_FOR_DUMP, 14588c2ecf20Sopenharmony_ci GET_DUMP, 14598c2ecf20Sopenharmony_ci READ_DUMP, 14608c2ecf20Sopenharmony_ci ABORT_DUMP, 14618c2ecf20Sopenharmony_ci DUMP_OBTAINED 14628c2ecf20Sopenharmony_ci}; 14638c2ecf20Sopenharmony_ci 14648c2ecf20Sopenharmony_ci/* Per-controller data */ 14658c2ecf20Sopenharmony_cistruct ipr_ioa_cfg { 14668c2ecf20Sopenharmony_ci char eye_catcher[8]; 14678c2ecf20Sopenharmony_ci#define IPR_EYECATCHER "iprcfg" 14688c2ecf20Sopenharmony_ci 14698c2ecf20Sopenharmony_ci struct list_head queue; 14708c2ecf20Sopenharmony_ci 14718c2ecf20Sopenharmony_ci u8 in_reset_reload:1; 14728c2ecf20Sopenharmony_ci u8 in_ioa_bringdown:1; 14738c2ecf20Sopenharmony_ci u8 ioa_unit_checked:1; 14748c2ecf20Sopenharmony_ci u8 dump_taken:1; 14758c2ecf20Sopenharmony_ci u8 scan_enabled:1; 14768c2ecf20Sopenharmony_ci u8 scan_done:1; 14778c2ecf20Sopenharmony_ci u8 needs_hard_reset:1; 14788c2ecf20Sopenharmony_ci u8 dual_raid:1; 14798c2ecf20Sopenharmony_ci u8 needs_warm_reset:1; 14808c2ecf20Sopenharmony_ci u8 msi_received:1; 14818c2ecf20Sopenharmony_ci u8 sis64:1; 14828c2ecf20Sopenharmony_ci u8 dump_timeout:1; 14838c2ecf20Sopenharmony_ci u8 cfg_locked:1; 14848c2ecf20Sopenharmony_ci u8 clear_isr:1; 14858c2ecf20Sopenharmony_ci u8 probe_done:1; 14868c2ecf20Sopenharmony_ci u8 scsi_unblock:1; 14878c2ecf20Sopenharmony_ci u8 scsi_blocked:1; 14888c2ecf20Sopenharmony_ci 14898c2ecf20Sopenharmony_ci u8 revid; 14908c2ecf20Sopenharmony_ci 14918c2ecf20Sopenharmony_ci /* 14928c2ecf20Sopenharmony_ci * Bitmaps for SIS64 generated target values 14938c2ecf20Sopenharmony_ci */ 14948c2ecf20Sopenharmony_ci unsigned long target_ids[BITS_TO_LONGS(IPR_MAX_SIS64_DEVS)]; 14958c2ecf20Sopenharmony_ci unsigned long array_ids[BITS_TO_LONGS(IPR_MAX_SIS64_DEVS)]; 14968c2ecf20Sopenharmony_ci unsigned long vset_ids[BITS_TO_LONGS(IPR_MAX_SIS64_DEVS)]; 14978c2ecf20Sopenharmony_ci 14988c2ecf20Sopenharmony_ci u16 type; /* CCIN of the card */ 14998c2ecf20Sopenharmony_ci 15008c2ecf20Sopenharmony_ci u8 log_level; 15018c2ecf20Sopenharmony_ci#define IPR_MAX_LOG_LEVEL 4 15028c2ecf20Sopenharmony_ci#define IPR_DEFAULT_LOG_LEVEL 2 15038c2ecf20Sopenharmony_ci#define IPR_DEBUG_LOG_LEVEL 3 15048c2ecf20Sopenharmony_ci 15058c2ecf20Sopenharmony_ci#define IPR_NUM_TRACE_INDEX_BITS 8 15068c2ecf20Sopenharmony_ci#define IPR_NUM_TRACE_ENTRIES (1 << IPR_NUM_TRACE_INDEX_BITS) 15078c2ecf20Sopenharmony_ci#define IPR_TRACE_INDEX_MASK (IPR_NUM_TRACE_ENTRIES - 1) 15088c2ecf20Sopenharmony_ci#define IPR_TRACE_SIZE (sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES) 15098c2ecf20Sopenharmony_ci char trace_start[8]; 15108c2ecf20Sopenharmony_ci#define IPR_TRACE_START_LABEL "trace" 15118c2ecf20Sopenharmony_ci struct ipr_trace_entry *trace; 15128c2ecf20Sopenharmony_ci atomic_t trace_index; 15138c2ecf20Sopenharmony_ci 15148c2ecf20Sopenharmony_ci char cfg_table_start[8]; 15158c2ecf20Sopenharmony_ci#define IPR_CFG_TBL_START "cfg" 15168c2ecf20Sopenharmony_ci union { 15178c2ecf20Sopenharmony_ci struct ipr_config_table *cfg_table; 15188c2ecf20Sopenharmony_ci struct ipr_config_table64 *cfg_table64; 15198c2ecf20Sopenharmony_ci } u; 15208c2ecf20Sopenharmony_ci dma_addr_t cfg_table_dma; 15218c2ecf20Sopenharmony_ci u32 cfg_table_size; 15228c2ecf20Sopenharmony_ci u32 max_devs_supported; 15238c2ecf20Sopenharmony_ci 15248c2ecf20Sopenharmony_ci char resource_table_label[8]; 15258c2ecf20Sopenharmony_ci#define IPR_RES_TABLE_LABEL "res_tbl" 15268c2ecf20Sopenharmony_ci struct ipr_resource_entry *res_entries; 15278c2ecf20Sopenharmony_ci struct list_head free_res_q; 15288c2ecf20Sopenharmony_ci struct list_head used_res_q; 15298c2ecf20Sopenharmony_ci 15308c2ecf20Sopenharmony_ci char ipr_hcam_label[8]; 15318c2ecf20Sopenharmony_ci#define IPR_HCAM_LABEL "hcams" 15328c2ecf20Sopenharmony_ci struct ipr_hostrcb *hostrcb[IPR_MAX_HCAMS]; 15338c2ecf20Sopenharmony_ci dma_addr_t hostrcb_dma[IPR_MAX_HCAMS]; 15348c2ecf20Sopenharmony_ci struct list_head hostrcb_free_q; 15358c2ecf20Sopenharmony_ci struct list_head hostrcb_pending_q; 15368c2ecf20Sopenharmony_ci struct list_head hostrcb_report_q; 15378c2ecf20Sopenharmony_ci 15388c2ecf20Sopenharmony_ci struct ipr_hrr_queue hrrq[IPR_MAX_HRRQ_NUM]; 15398c2ecf20Sopenharmony_ci u32 hrrq_num; 15408c2ecf20Sopenharmony_ci atomic_t hrrq_index; 15418c2ecf20Sopenharmony_ci u16 identify_hrrq_index; 15428c2ecf20Sopenharmony_ci 15438c2ecf20Sopenharmony_ci struct ipr_bus_attributes bus_attr[IPR_MAX_NUM_BUSES]; 15448c2ecf20Sopenharmony_ci 15458c2ecf20Sopenharmony_ci unsigned int transop_timeout; 15468c2ecf20Sopenharmony_ci const struct ipr_chip_cfg_t *chip_cfg; 15478c2ecf20Sopenharmony_ci const struct ipr_chip_t *ipr_chip; 15488c2ecf20Sopenharmony_ci 15498c2ecf20Sopenharmony_ci void __iomem *hdw_dma_regs; /* iomapped PCI memory space */ 15508c2ecf20Sopenharmony_ci unsigned long hdw_dma_regs_pci; /* raw PCI memory space */ 15518c2ecf20Sopenharmony_ci void __iomem *ioa_mailbox; 15528c2ecf20Sopenharmony_ci struct ipr_interrupts regs; 15538c2ecf20Sopenharmony_ci 15548c2ecf20Sopenharmony_ci u16 saved_pcix_cmd_reg; 15558c2ecf20Sopenharmony_ci u16 reset_retries; 15568c2ecf20Sopenharmony_ci 15578c2ecf20Sopenharmony_ci u32 errors_logged; 15588c2ecf20Sopenharmony_ci u32 doorbell; 15598c2ecf20Sopenharmony_ci 15608c2ecf20Sopenharmony_ci struct Scsi_Host *host; 15618c2ecf20Sopenharmony_ci struct pci_dev *pdev; 15628c2ecf20Sopenharmony_ci struct ipr_sglist *ucode_sglist; 15638c2ecf20Sopenharmony_ci u8 saved_mode_page_len; 15648c2ecf20Sopenharmony_ci 15658c2ecf20Sopenharmony_ci struct work_struct work_q; 15668c2ecf20Sopenharmony_ci struct work_struct scsi_add_work_q; 15678c2ecf20Sopenharmony_ci struct workqueue_struct *reset_work_q; 15688c2ecf20Sopenharmony_ci 15698c2ecf20Sopenharmony_ci wait_queue_head_t reset_wait_q; 15708c2ecf20Sopenharmony_ci wait_queue_head_t msi_wait_q; 15718c2ecf20Sopenharmony_ci wait_queue_head_t eeh_wait_q; 15728c2ecf20Sopenharmony_ci 15738c2ecf20Sopenharmony_ci struct ipr_dump *dump; 15748c2ecf20Sopenharmony_ci enum ipr_sdt_state sdt_state; 15758c2ecf20Sopenharmony_ci 15768c2ecf20Sopenharmony_ci struct ipr_misc_cbs *vpd_cbs; 15778c2ecf20Sopenharmony_ci dma_addr_t vpd_cbs_dma; 15788c2ecf20Sopenharmony_ci 15798c2ecf20Sopenharmony_ci struct dma_pool *ipr_cmd_pool; 15808c2ecf20Sopenharmony_ci 15818c2ecf20Sopenharmony_ci struct ipr_cmnd *reset_cmd; 15828c2ecf20Sopenharmony_ci int (*reset) (struct ipr_cmnd *); 15838c2ecf20Sopenharmony_ci 15848c2ecf20Sopenharmony_ci struct ata_host ata_host; 15858c2ecf20Sopenharmony_ci char ipr_cmd_label[8]; 15868c2ecf20Sopenharmony_ci#define IPR_CMD_LABEL "ipr_cmd" 15878c2ecf20Sopenharmony_ci u32 max_cmds; 15888c2ecf20Sopenharmony_ci struct ipr_cmnd **ipr_cmnd_list; 15898c2ecf20Sopenharmony_ci dma_addr_t *ipr_cmnd_list_dma; 15908c2ecf20Sopenharmony_ci 15918c2ecf20Sopenharmony_ci unsigned int nvectors; 15928c2ecf20Sopenharmony_ci 15938c2ecf20Sopenharmony_ci struct { 15948c2ecf20Sopenharmony_ci char desc[22]; 15958c2ecf20Sopenharmony_ci } vectors_info[IPR_MAX_MSIX_VECTORS]; 15968c2ecf20Sopenharmony_ci 15978c2ecf20Sopenharmony_ci u32 iopoll_weight; 15988c2ecf20Sopenharmony_ci 15998c2ecf20Sopenharmony_ci}; /* struct ipr_ioa_cfg */ 16008c2ecf20Sopenharmony_ci 16018c2ecf20Sopenharmony_cistruct ipr_cmnd { 16028c2ecf20Sopenharmony_ci struct ipr_ioarcb ioarcb; 16038c2ecf20Sopenharmony_ci union { 16048c2ecf20Sopenharmony_ci struct ipr_ioadl_desc ioadl[IPR_NUM_IOADL_ENTRIES]; 16058c2ecf20Sopenharmony_ci struct ipr_ioadl64_desc ioadl64[IPR_NUM_IOADL_ENTRIES]; 16068c2ecf20Sopenharmony_ci struct ipr_ata64_ioadl ata_ioadl; 16078c2ecf20Sopenharmony_ci } i; 16088c2ecf20Sopenharmony_ci union { 16098c2ecf20Sopenharmony_ci struct ipr_ioasa ioasa; 16108c2ecf20Sopenharmony_ci struct ipr_ioasa64 ioasa64; 16118c2ecf20Sopenharmony_ci } s; 16128c2ecf20Sopenharmony_ci struct list_head queue; 16138c2ecf20Sopenharmony_ci struct scsi_cmnd *scsi_cmd; 16148c2ecf20Sopenharmony_ci struct ata_queued_cmd *qc; 16158c2ecf20Sopenharmony_ci struct completion completion; 16168c2ecf20Sopenharmony_ci struct timer_list timer; 16178c2ecf20Sopenharmony_ci struct work_struct work; 16188c2ecf20Sopenharmony_ci void (*fast_done) (struct ipr_cmnd *); 16198c2ecf20Sopenharmony_ci void (*done) (struct ipr_cmnd *); 16208c2ecf20Sopenharmony_ci int (*job_step) (struct ipr_cmnd *); 16218c2ecf20Sopenharmony_ci int (*job_step_failed) (struct ipr_cmnd *); 16228c2ecf20Sopenharmony_ci u16 cmd_index; 16238c2ecf20Sopenharmony_ci u8 sense_buffer[SCSI_SENSE_BUFFERSIZE]; 16248c2ecf20Sopenharmony_ci dma_addr_t sense_buffer_dma; 16258c2ecf20Sopenharmony_ci unsigned short dma_use_sg; 16268c2ecf20Sopenharmony_ci dma_addr_t dma_addr; 16278c2ecf20Sopenharmony_ci struct ipr_cmnd *sibling; 16288c2ecf20Sopenharmony_ci union { 16298c2ecf20Sopenharmony_ci enum ipr_shutdown_type shutdown_type; 16308c2ecf20Sopenharmony_ci struct ipr_hostrcb *hostrcb; 16318c2ecf20Sopenharmony_ci unsigned long time_left; 16328c2ecf20Sopenharmony_ci unsigned long scratch; 16338c2ecf20Sopenharmony_ci struct ipr_resource_entry *res; 16348c2ecf20Sopenharmony_ci struct scsi_device *sdev; 16358c2ecf20Sopenharmony_ci } u; 16368c2ecf20Sopenharmony_ci 16378c2ecf20Sopenharmony_ci struct completion *eh_comp; 16388c2ecf20Sopenharmony_ci struct ipr_hrr_queue *hrrq; 16398c2ecf20Sopenharmony_ci struct ipr_ioa_cfg *ioa_cfg; 16408c2ecf20Sopenharmony_ci}; 16418c2ecf20Sopenharmony_ci 16428c2ecf20Sopenharmony_cistruct ipr_ses_table_entry { 16438c2ecf20Sopenharmony_ci char product_id[17]; 16448c2ecf20Sopenharmony_ci char compare_product_id_byte[17]; 16458c2ecf20Sopenharmony_ci u32 max_bus_speed_limit; /* MB/sec limit for this backplane */ 16468c2ecf20Sopenharmony_ci}; 16478c2ecf20Sopenharmony_ci 16488c2ecf20Sopenharmony_cistruct ipr_dump_header { 16498c2ecf20Sopenharmony_ci u32 eye_catcher; 16508c2ecf20Sopenharmony_ci#define IPR_DUMP_EYE_CATCHER 0xC5D4E3F2 16518c2ecf20Sopenharmony_ci u32 len; 16528c2ecf20Sopenharmony_ci u32 num_entries; 16538c2ecf20Sopenharmony_ci u32 first_entry_offset; 16548c2ecf20Sopenharmony_ci u32 status; 16558c2ecf20Sopenharmony_ci#define IPR_DUMP_STATUS_SUCCESS 0 16568c2ecf20Sopenharmony_ci#define IPR_DUMP_STATUS_QUAL_SUCCESS 2 16578c2ecf20Sopenharmony_ci#define IPR_DUMP_STATUS_FAILED 0xffffffff 16588c2ecf20Sopenharmony_ci u32 os; 16598c2ecf20Sopenharmony_ci#define IPR_DUMP_OS_LINUX 0x4C4E5558 16608c2ecf20Sopenharmony_ci u32 driver_name; 16618c2ecf20Sopenharmony_ci#define IPR_DUMP_DRIVER_NAME 0x49505232 16628c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 16638c2ecf20Sopenharmony_ci 16648c2ecf20Sopenharmony_cistruct ipr_dump_entry_header { 16658c2ecf20Sopenharmony_ci u32 eye_catcher; 16668c2ecf20Sopenharmony_ci#define IPR_DUMP_EYE_CATCHER 0xC5D4E3F2 16678c2ecf20Sopenharmony_ci u32 len; 16688c2ecf20Sopenharmony_ci u32 num_elems; 16698c2ecf20Sopenharmony_ci u32 offset; 16708c2ecf20Sopenharmony_ci u32 data_type; 16718c2ecf20Sopenharmony_ci#define IPR_DUMP_DATA_TYPE_ASCII 0x41534349 16728c2ecf20Sopenharmony_ci#define IPR_DUMP_DATA_TYPE_BINARY 0x42494E41 16738c2ecf20Sopenharmony_ci u32 id; 16748c2ecf20Sopenharmony_ci#define IPR_DUMP_IOA_DUMP_ID 0x494F4131 16758c2ecf20Sopenharmony_ci#define IPR_DUMP_LOCATION_ID 0x4C4F4341 16768c2ecf20Sopenharmony_ci#define IPR_DUMP_TRACE_ID 0x54524143 16778c2ecf20Sopenharmony_ci#define IPR_DUMP_DRIVER_VERSION_ID 0x44525652 16788c2ecf20Sopenharmony_ci#define IPR_DUMP_DRIVER_TYPE_ID 0x54595045 16798c2ecf20Sopenharmony_ci#define IPR_DUMP_IOA_CTRL_BLK 0x494F4342 16808c2ecf20Sopenharmony_ci#define IPR_DUMP_PEND_OPS 0x414F5053 16818c2ecf20Sopenharmony_ci u32 status; 16828c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 16838c2ecf20Sopenharmony_ci 16848c2ecf20Sopenharmony_cistruct ipr_dump_location_entry { 16858c2ecf20Sopenharmony_ci struct ipr_dump_entry_header hdr; 16868c2ecf20Sopenharmony_ci u8 location[20]; 16878c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 16888c2ecf20Sopenharmony_ci 16898c2ecf20Sopenharmony_cistruct ipr_dump_trace_entry { 16908c2ecf20Sopenharmony_ci struct ipr_dump_entry_header hdr; 16918c2ecf20Sopenharmony_ci u32 trace[IPR_TRACE_SIZE / sizeof(u32)]; 16928c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 16938c2ecf20Sopenharmony_ci 16948c2ecf20Sopenharmony_cistruct ipr_dump_version_entry { 16958c2ecf20Sopenharmony_ci struct ipr_dump_entry_header hdr; 16968c2ecf20Sopenharmony_ci u8 version[sizeof(IPR_DRIVER_VERSION)]; 16978c2ecf20Sopenharmony_ci}; 16988c2ecf20Sopenharmony_ci 16998c2ecf20Sopenharmony_cistruct ipr_dump_ioa_type_entry { 17008c2ecf20Sopenharmony_ci struct ipr_dump_entry_header hdr; 17018c2ecf20Sopenharmony_ci u32 type; 17028c2ecf20Sopenharmony_ci u32 fw_version; 17038c2ecf20Sopenharmony_ci}; 17048c2ecf20Sopenharmony_ci 17058c2ecf20Sopenharmony_cistruct ipr_driver_dump { 17068c2ecf20Sopenharmony_ci struct ipr_dump_header hdr; 17078c2ecf20Sopenharmony_ci struct ipr_dump_version_entry version_entry; 17088c2ecf20Sopenharmony_ci struct ipr_dump_location_entry location_entry; 17098c2ecf20Sopenharmony_ci struct ipr_dump_ioa_type_entry ioa_type_entry; 17108c2ecf20Sopenharmony_ci struct ipr_dump_trace_entry trace_entry; 17118c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 17128c2ecf20Sopenharmony_ci 17138c2ecf20Sopenharmony_cistruct ipr_ioa_dump { 17148c2ecf20Sopenharmony_ci struct ipr_dump_entry_header hdr; 17158c2ecf20Sopenharmony_ci struct ipr_sdt sdt; 17168c2ecf20Sopenharmony_ci __be32 **ioa_data; 17178c2ecf20Sopenharmony_ci u32 reserved; 17188c2ecf20Sopenharmony_ci u32 next_page_index; 17198c2ecf20Sopenharmony_ci u32 page_offset; 17208c2ecf20Sopenharmony_ci u32 format; 17218c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 17228c2ecf20Sopenharmony_ci 17238c2ecf20Sopenharmony_cistruct ipr_dump { 17248c2ecf20Sopenharmony_ci struct kref kref; 17258c2ecf20Sopenharmony_ci struct ipr_ioa_cfg *ioa_cfg; 17268c2ecf20Sopenharmony_ci struct ipr_driver_dump driver_dump; 17278c2ecf20Sopenharmony_ci struct ipr_ioa_dump ioa_dump; 17288c2ecf20Sopenharmony_ci}; 17298c2ecf20Sopenharmony_ci 17308c2ecf20Sopenharmony_cistruct ipr_error_table_t { 17318c2ecf20Sopenharmony_ci u32 ioasc; 17328c2ecf20Sopenharmony_ci int log_ioasa; 17338c2ecf20Sopenharmony_ci int log_hcam; 17348c2ecf20Sopenharmony_ci char *error; 17358c2ecf20Sopenharmony_ci}; 17368c2ecf20Sopenharmony_ci 17378c2ecf20Sopenharmony_cistruct ipr_software_inq_lid_info { 17388c2ecf20Sopenharmony_ci __be32 load_id; 17398c2ecf20Sopenharmony_ci __be32 timestamp[3]; 17408c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 17418c2ecf20Sopenharmony_ci 17428c2ecf20Sopenharmony_cistruct ipr_ucode_image_header { 17438c2ecf20Sopenharmony_ci __be32 header_length; 17448c2ecf20Sopenharmony_ci __be32 lid_table_offset; 17458c2ecf20Sopenharmony_ci u8 major_release; 17468c2ecf20Sopenharmony_ci u8 card_type; 17478c2ecf20Sopenharmony_ci u8 minor_release[2]; 17488c2ecf20Sopenharmony_ci u8 reserved[20]; 17498c2ecf20Sopenharmony_ci char eyecatcher[16]; 17508c2ecf20Sopenharmony_ci __be32 num_lids; 17518c2ecf20Sopenharmony_ci struct ipr_software_inq_lid_info lid[1]; 17528c2ecf20Sopenharmony_ci}__attribute__((packed, aligned (4))); 17538c2ecf20Sopenharmony_ci 17548c2ecf20Sopenharmony_ci/* 17558c2ecf20Sopenharmony_ci * Macros 17568c2ecf20Sopenharmony_ci */ 17578c2ecf20Sopenharmony_ci#define IPR_DBG_CMD(CMD) if (ipr_debug) { CMD; } 17588c2ecf20Sopenharmony_ci 17598c2ecf20Sopenharmony_ci#ifdef CONFIG_SCSI_IPR_TRACE 17608c2ecf20Sopenharmony_ci#define ipr_create_trace_file(kobj, attr) sysfs_create_bin_file(kobj, attr) 17618c2ecf20Sopenharmony_ci#define ipr_remove_trace_file(kobj, attr) sysfs_remove_bin_file(kobj, attr) 17628c2ecf20Sopenharmony_ci#else 17638c2ecf20Sopenharmony_ci#define ipr_create_trace_file(kobj, attr) 0 17648c2ecf20Sopenharmony_ci#define ipr_remove_trace_file(kobj, attr) do { } while(0) 17658c2ecf20Sopenharmony_ci#endif 17668c2ecf20Sopenharmony_ci 17678c2ecf20Sopenharmony_ci#ifdef CONFIG_SCSI_IPR_DUMP 17688c2ecf20Sopenharmony_ci#define ipr_create_dump_file(kobj, attr) sysfs_create_bin_file(kobj, attr) 17698c2ecf20Sopenharmony_ci#define ipr_remove_dump_file(kobj, attr) sysfs_remove_bin_file(kobj, attr) 17708c2ecf20Sopenharmony_ci#else 17718c2ecf20Sopenharmony_ci#define ipr_create_dump_file(kobj, attr) 0 17728c2ecf20Sopenharmony_ci#define ipr_remove_dump_file(kobj, attr) do { } while(0) 17738c2ecf20Sopenharmony_ci#endif 17748c2ecf20Sopenharmony_ci 17758c2ecf20Sopenharmony_ci/* 17768c2ecf20Sopenharmony_ci * Error logging macros 17778c2ecf20Sopenharmony_ci */ 17788c2ecf20Sopenharmony_ci#define ipr_err(...) printk(KERN_ERR IPR_NAME ": "__VA_ARGS__) 17798c2ecf20Sopenharmony_ci#define ipr_info(...) printk(KERN_INFO IPR_NAME ": "__VA_ARGS__) 17808c2ecf20Sopenharmony_ci#define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__)) 17818c2ecf20Sopenharmony_ci 17828c2ecf20Sopenharmony_ci#define ipr_res_printk(level, ioa_cfg, bus, target, lun, fmt, ...) \ 17838c2ecf20Sopenharmony_ci printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, (ioa_cfg)->host->host_no, \ 17848c2ecf20Sopenharmony_ci bus, target, lun, ##__VA_ARGS__) 17858c2ecf20Sopenharmony_ci 17868c2ecf20Sopenharmony_ci#define ipr_res_err(ioa_cfg, res, fmt, ...) \ 17878c2ecf20Sopenharmony_ci ipr_res_printk(KERN_ERR, ioa_cfg, (res)->bus, (res)->target, (res)->lun, fmt, ##__VA_ARGS__) 17888c2ecf20Sopenharmony_ci 17898c2ecf20Sopenharmony_ci#define ipr_ra_printk(level, ioa_cfg, ra, fmt, ...) \ 17908c2ecf20Sopenharmony_ci printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, (ioa_cfg)->host->host_no, \ 17918c2ecf20Sopenharmony_ci (ra).bus, (ra).target, (ra).lun, ##__VA_ARGS__) 17928c2ecf20Sopenharmony_ci 17938c2ecf20Sopenharmony_ci#define ipr_ra_err(ioa_cfg, ra, fmt, ...) \ 17948c2ecf20Sopenharmony_ci ipr_ra_printk(KERN_ERR, ioa_cfg, ra, fmt, ##__VA_ARGS__) 17958c2ecf20Sopenharmony_ci 17968c2ecf20Sopenharmony_ci#define ipr_phys_res_err(ioa_cfg, res, fmt, ...) \ 17978c2ecf20Sopenharmony_ci{ \ 17988c2ecf20Sopenharmony_ci if ((res).bus >= IPR_MAX_NUM_BUSES) { \ 17998c2ecf20Sopenharmony_ci ipr_err(fmt": unknown\n", ##__VA_ARGS__); \ 18008c2ecf20Sopenharmony_ci } else { \ 18018c2ecf20Sopenharmony_ci ipr_err(fmt": %d:%d:%d:%d\n", \ 18028c2ecf20Sopenharmony_ci ##__VA_ARGS__, (ioa_cfg)->host->host_no, \ 18038c2ecf20Sopenharmony_ci (res).bus, (res).target, (res).lun); \ 18048c2ecf20Sopenharmony_ci } \ 18058c2ecf20Sopenharmony_ci} 18068c2ecf20Sopenharmony_ci 18078c2ecf20Sopenharmony_ci#define ipr_hcam_err(hostrcb, fmt, ...) \ 18088c2ecf20Sopenharmony_ci{ \ 18098c2ecf20Sopenharmony_ci if (ipr_is_device(hostrcb)) { \ 18108c2ecf20Sopenharmony_ci if ((hostrcb)->ioa_cfg->sis64) { \ 18118c2ecf20Sopenharmony_ci printk(KERN_ERR IPR_NAME ": %s: " fmt, \ 18128c2ecf20Sopenharmony_ci ipr_format_res_path(hostrcb->ioa_cfg, \ 18138c2ecf20Sopenharmony_ci hostrcb->hcam.u.error64.fd_res_path, \ 18148c2ecf20Sopenharmony_ci hostrcb->rp_buffer, \ 18158c2ecf20Sopenharmony_ci sizeof(hostrcb->rp_buffer)), \ 18168c2ecf20Sopenharmony_ci __VA_ARGS__); \ 18178c2ecf20Sopenharmony_ci } else { \ 18188c2ecf20Sopenharmony_ci ipr_ra_err((hostrcb)->ioa_cfg, \ 18198c2ecf20Sopenharmony_ci (hostrcb)->hcam.u.error.fd_res_addr, \ 18208c2ecf20Sopenharmony_ci fmt, __VA_ARGS__); \ 18218c2ecf20Sopenharmony_ci } \ 18228c2ecf20Sopenharmony_ci } else { \ 18238c2ecf20Sopenharmony_ci dev_err(&(hostrcb)->ioa_cfg->pdev->dev, fmt, __VA_ARGS__); \ 18248c2ecf20Sopenharmony_ci } \ 18258c2ecf20Sopenharmony_ci} 18268c2ecf20Sopenharmony_ci 18278c2ecf20Sopenharmony_ci#define ipr_trace ipr_dbg("%s: %s: Line: %d\n",\ 18288c2ecf20Sopenharmony_ci __FILE__, __func__, __LINE__) 18298c2ecf20Sopenharmony_ci 18308c2ecf20Sopenharmony_ci#define ENTER IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Entering %s\n", __func__)) 18318c2ecf20Sopenharmony_ci#define LEAVE IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Leaving %s\n", __func__)) 18328c2ecf20Sopenharmony_ci 18338c2ecf20Sopenharmony_ci#define ipr_err_separator \ 18348c2ecf20Sopenharmony_ciipr_err("----------------------------------------------------------\n") 18358c2ecf20Sopenharmony_ci 18368c2ecf20Sopenharmony_ci 18378c2ecf20Sopenharmony_ci/* 18388c2ecf20Sopenharmony_ci * Inlines 18398c2ecf20Sopenharmony_ci */ 18408c2ecf20Sopenharmony_ci 18418c2ecf20Sopenharmony_ci/** 18428c2ecf20Sopenharmony_ci * ipr_is_ioa_resource - Determine if a resource is the IOA 18438c2ecf20Sopenharmony_ci * @res: resource entry struct 18448c2ecf20Sopenharmony_ci * 18458c2ecf20Sopenharmony_ci * Return value: 18468c2ecf20Sopenharmony_ci * 1 if IOA / 0 if not IOA 18478c2ecf20Sopenharmony_ci **/ 18488c2ecf20Sopenharmony_cistatic inline int ipr_is_ioa_resource(struct ipr_resource_entry *res) 18498c2ecf20Sopenharmony_ci{ 18508c2ecf20Sopenharmony_ci return res->type == IPR_RES_TYPE_IOAFP; 18518c2ecf20Sopenharmony_ci} 18528c2ecf20Sopenharmony_ci 18538c2ecf20Sopenharmony_ci/** 18548c2ecf20Sopenharmony_ci * ipr_is_af_dasd_device - Determine if a resource is an AF DASD 18558c2ecf20Sopenharmony_ci * @res: resource entry struct 18568c2ecf20Sopenharmony_ci * 18578c2ecf20Sopenharmony_ci * Return value: 18588c2ecf20Sopenharmony_ci * 1 if AF DASD / 0 if not AF DASD 18598c2ecf20Sopenharmony_ci **/ 18608c2ecf20Sopenharmony_cistatic inline int ipr_is_af_dasd_device(struct ipr_resource_entry *res) 18618c2ecf20Sopenharmony_ci{ 18628c2ecf20Sopenharmony_ci return res->type == IPR_RES_TYPE_AF_DASD || 18638c2ecf20Sopenharmony_ci res->type == IPR_RES_TYPE_REMOTE_AF_DASD; 18648c2ecf20Sopenharmony_ci} 18658c2ecf20Sopenharmony_ci 18668c2ecf20Sopenharmony_ci/** 18678c2ecf20Sopenharmony_ci * ipr_is_vset_device - Determine if a resource is a VSET 18688c2ecf20Sopenharmony_ci * @res: resource entry struct 18698c2ecf20Sopenharmony_ci * 18708c2ecf20Sopenharmony_ci * Return value: 18718c2ecf20Sopenharmony_ci * 1 if VSET / 0 if not VSET 18728c2ecf20Sopenharmony_ci **/ 18738c2ecf20Sopenharmony_cistatic inline int ipr_is_vset_device(struct ipr_resource_entry *res) 18748c2ecf20Sopenharmony_ci{ 18758c2ecf20Sopenharmony_ci return res->type == IPR_RES_TYPE_VOLUME_SET; 18768c2ecf20Sopenharmony_ci} 18778c2ecf20Sopenharmony_ci 18788c2ecf20Sopenharmony_ci/** 18798c2ecf20Sopenharmony_ci * ipr_is_gscsi - Determine if a resource is a generic scsi resource 18808c2ecf20Sopenharmony_ci * @res: resource entry struct 18818c2ecf20Sopenharmony_ci * 18828c2ecf20Sopenharmony_ci * Return value: 18838c2ecf20Sopenharmony_ci * 1 if GSCSI / 0 if not GSCSI 18848c2ecf20Sopenharmony_ci **/ 18858c2ecf20Sopenharmony_cistatic inline int ipr_is_gscsi(struct ipr_resource_entry *res) 18868c2ecf20Sopenharmony_ci{ 18878c2ecf20Sopenharmony_ci return res->type == IPR_RES_TYPE_GENERIC_SCSI; 18888c2ecf20Sopenharmony_ci} 18898c2ecf20Sopenharmony_ci 18908c2ecf20Sopenharmony_ci/** 18918c2ecf20Sopenharmony_ci * ipr_is_scsi_disk - Determine if a resource is a SCSI disk 18928c2ecf20Sopenharmony_ci * @res: resource entry struct 18938c2ecf20Sopenharmony_ci * 18948c2ecf20Sopenharmony_ci * Return value: 18958c2ecf20Sopenharmony_ci * 1 if SCSI disk / 0 if not SCSI disk 18968c2ecf20Sopenharmony_ci **/ 18978c2ecf20Sopenharmony_cistatic inline int ipr_is_scsi_disk(struct ipr_resource_entry *res) 18988c2ecf20Sopenharmony_ci{ 18998c2ecf20Sopenharmony_ci if (ipr_is_af_dasd_device(res) || 19008c2ecf20Sopenharmony_ci (ipr_is_gscsi(res) && IPR_IS_DASD_DEVICE(res->std_inq_data))) 19018c2ecf20Sopenharmony_ci return 1; 19028c2ecf20Sopenharmony_ci else 19038c2ecf20Sopenharmony_ci return 0; 19048c2ecf20Sopenharmony_ci} 19058c2ecf20Sopenharmony_ci 19068c2ecf20Sopenharmony_ci/** 19078c2ecf20Sopenharmony_ci * ipr_is_gata - Determine if a resource is a generic ATA resource 19088c2ecf20Sopenharmony_ci * @res: resource entry struct 19098c2ecf20Sopenharmony_ci * 19108c2ecf20Sopenharmony_ci * Return value: 19118c2ecf20Sopenharmony_ci * 1 if GATA / 0 if not GATA 19128c2ecf20Sopenharmony_ci **/ 19138c2ecf20Sopenharmony_cistatic inline int ipr_is_gata(struct ipr_resource_entry *res) 19148c2ecf20Sopenharmony_ci{ 19158c2ecf20Sopenharmony_ci return res->type == IPR_RES_TYPE_GENERIC_ATA; 19168c2ecf20Sopenharmony_ci} 19178c2ecf20Sopenharmony_ci 19188c2ecf20Sopenharmony_ci/** 19198c2ecf20Sopenharmony_ci * ipr_is_naca_model - Determine if a resource is using NACA queueing model 19208c2ecf20Sopenharmony_ci * @res: resource entry struct 19218c2ecf20Sopenharmony_ci * 19228c2ecf20Sopenharmony_ci * Return value: 19238c2ecf20Sopenharmony_ci * 1 if NACA queueing model / 0 if not NACA queueing model 19248c2ecf20Sopenharmony_ci **/ 19258c2ecf20Sopenharmony_cistatic inline int ipr_is_naca_model(struct ipr_resource_entry *res) 19268c2ecf20Sopenharmony_ci{ 19278c2ecf20Sopenharmony_ci if (ipr_is_gscsi(res) && res->qmodel == IPR_QUEUE_NACA_MODEL) 19288c2ecf20Sopenharmony_ci return 1; 19298c2ecf20Sopenharmony_ci return 0; 19308c2ecf20Sopenharmony_ci} 19318c2ecf20Sopenharmony_ci 19328c2ecf20Sopenharmony_ci/** 19338c2ecf20Sopenharmony_ci * ipr_is_device - Determine if the hostrcb structure is related to a device 19348c2ecf20Sopenharmony_ci * @hostrcb: host resource control blocks struct 19358c2ecf20Sopenharmony_ci * 19368c2ecf20Sopenharmony_ci * Return value: 19378c2ecf20Sopenharmony_ci * 1 if AF / 0 if not AF 19388c2ecf20Sopenharmony_ci **/ 19398c2ecf20Sopenharmony_cistatic inline int ipr_is_device(struct ipr_hostrcb *hostrcb) 19408c2ecf20Sopenharmony_ci{ 19418c2ecf20Sopenharmony_ci struct ipr_res_addr *res_addr; 19428c2ecf20Sopenharmony_ci u8 *res_path; 19438c2ecf20Sopenharmony_ci 19448c2ecf20Sopenharmony_ci if (hostrcb->ioa_cfg->sis64) { 19458c2ecf20Sopenharmony_ci res_path = &hostrcb->hcam.u.error64.fd_res_path[0]; 19468c2ecf20Sopenharmony_ci if ((res_path[0] == 0x00 || res_path[0] == 0x80 || 19478c2ecf20Sopenharmony_ci res_path[0] == 0x81) && res_path[2] != 0xFF) 19488c2ecf20Sopenharmony_ci return 1; 19498c2ecf20Sopenharmony_ci } else { 19508c2ecf20Sopenharmony_ci res_addr = &hostrcb->hcam.u.error.fd_res_addr; 19518c2ecf20Sopenharmony_ci 19528c2ecf20Sopenharmony_ci if ((res_addr->bus < IPR_MAX_NUM_BUSES) && 19538c2ecf20Sopenharmony_ci (res_addr->target < (IPR_MAX_NUM_TARGETS_PER_BUS - 1))) 19548c2ecf20Sopenharmony_ci return 1; 19558c2ecf20Sopenharmony_ci } 19568c2ecf20Sopenharmony_ci return 0; 19578c2ecf20Sopenharmony_ci} 19588c2ecf20Sopenharmony_ci 19598c2ecf20Sopenharmony_ci/** 19608c2ecf20Sopenharmony_ci * ipr_sdt_is_fmt2 - Determine if a SDT address is in format 2 19618c2ecf20Sopenharmony_ci * @sdt_word: SDT address 19628c2ecf20Sopenharmony_ci * 19638c2ecf20Sopenharmony_ci * Return value: 19648c2ecf20Sopenharmony_ci * 1 if format 2 / 0 if not 19658c2ecf20Sopenharmony_ci **/ 19668c2ecf20Sopenharmony_cistatic inline int ipr_sdt_is_fmt2(u32 sdt_word) 19678c2ecf20Sopenharmony_ci{ 19688c2ecf20Sopenharmony_ci u32 bar_sel = IPR_GET_FMT2_BAR_SEL(sdt_word); 19698c2ecf20Sopenharmony_ci 19708c2ecf20Sopenharmony_ci switch (bar_sel) { 19718c2ecf20Sopenharmony_ci case IPR_SDT_FMT2_BAR0_SEL: 19728c2ecf20Sopenharmony_ci case IPR_SDT_FMT2_BAR1_SEL: 19738c2ecf20Sopenharmony_ci case IPR_SDT_FMT2_BAR2_SEL: 19748c2ecf20Sopenharmony_ci case IPR_SDT_FMT2_BAR3_SEL: 19758c2ecf20Sopenharmony_ci case IPR_SDT_FMT2_BAR4_SEL: 19768c2ecf20Sopenharmony_ci case IPR_SDT_FMT2_BAR5_SEL: 19778c2ecf20Sopenharmony_ci case IPR_SDT_FMT2_EXP_ROM_SEL: 19788c2ecf20Sopenharmony_ci return 1; 19798c2ecf20Sopenharmony_ci }; 19808c2ecf20Sopenharmony_ci 19818c2ecf20Sopenharmony_ci return 0; 19828c2ecf20Sopenharmony_ci} 19838c2ecf20Sopenharmony_ci 19848c2ecf20Sopenharmony_ci#ifndef writeq 19858c2ecf20Sopenharmony_cistatic inline void writeq(u64 val, void __iomem *addr) 19868c2ecf20Sopenharmony_ci{ 19878c2ecf20Sopenharmony_ci writel(((u32) (val >> 32)), addr); 19888c2ecf20Sopenharmony_ci writel(((u32) (val)), (addr + 4)); 19898c2ecf20Sopenharmony_ci} 19908c2ecf20Sopenharmony_ci#endif 19918c2ecf20Sopenharmony_ci 19928c2ecf20Sopenharmony_ci#endif /* _IPR_H */ 1993