1 /*- 2 * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26 27 /* 28 * Driver for the Microsemi Smart storage controllers 29 */ 30 31 #include "smartpqi_includes.h" 32 33 CTASSERT(BSD_SUCCESS == PQI_STATUS_SUCCESS); 34 35 /* 36 * Supported devices 37 */ 38 struct pqi_ident 39 { 40 u_int16_t vendor; 41 u_int16_t device; 42 u_int16_t subvendor; 43 u_int16_t subdevice; 44 int hwif; 45 char *desc; 46 } pqi_identifiers[] = { 47 /* (MSCC PM8205 8x12G based) */ 48 {0x9005, 0x028f, 0x103c, 0x600, PQI_HWIF_SRCV, "P408i-p SR Gen10"}, 49 {0x9005, 0x028f, 0x103c, 0x601, PQI_HWIF_SRCV, "P408e-p SR Gen10"}, 50 {0x9005, 0x028f, 0x103c, 0x602, PQI_HWIF_SRCV, "P408i-a SR Gen10"}, 51 {0x9005, 0x028f, 0x103c, 0x603, PQI_HWIF_SRCV, "P408i-c SR Gen10"}, 52 {0x9005, 0x028f, 0x1028, 0x1FE0, PQI_HWIF_SRCV, "SmartRAID 3162-8i/eDell"}, 53 {0x9005, 0x028f, 0x9005, 0x608, PQI_HWIF_SRCV, "SmartRAID 3162-8i/e"}, 54 {0x9005, 0x028f, 0x103c, 0x609, PQI_HWIF_SRCV, "P408i-sb SR G10"}, 55 56 /* (MSCC PM8225 8x12G based) */ 57 {0x9005, 0x028f, 0x103c, 0x650, PQI_HWIF_SRCV, "E208i-p SR Gen10"}, 58 {0x9005, 0x028f, 0x103c, 0x651, PQI_HWIF_SRCV, "E208e-p SR Gen10"}, 59 {0x9005, 0x028f, 0x103c, 0x652, PQI_HWIF_SRCV, "E208i-c SR Gen10"}, 60 {0x9005, 0x028f, 0x103c, 0x654, PQI_HWIF_SRCV, "E208i-a SR Gen10"}, 61 {0x9005, 0x028f, 0x103c, 0x655, PQI_HWIF_SRCV, "P408e-m SR Gen10"}, 62 {0x9005, 0x028f, 0x9005, 0x659, PQI_HWIF_SRCV, "2100C8iOXS"}, 63 64 /* (MSCC PM8221 8x12G based) */ 65 {0x9005, 0x028f, 0x103c, 0x700, PQI_HWIF_SRCV, "P204i-c SR Gen10"}, 66 {0x9005, 0x028f, 0x103c, 0x701, PQI_HWIF_SRCV, "P204i-b SR Gen10"}, 67 {0x9005, 0x028f, 0x193d, 0x1104, PQI_HWIF_SRCV, "UN RAID P2404-Mf-4i-2GB"}, 68 {0x9005, 0x028f, 0x193d, 0x1106, PQI_HWIF_SRCV, "UN RAID P2404-Mf-4i-1GB"}, 69 {0x9005, 0x028f, 0x193d, 0x1108, PQI_HWIF_SRCV, "UN RAID P4408-Ma-8i-2GB"}, 70 {0x9005, 0x028f, 0x193d, 0x1109, PQI_HWIF_SRCV, "UN RAID P4408-Mr-8i-2GB"}, 71 72 /* (MSCC PM8204 8x12G based) */ 73 {0x9005, 0x028f, 0x9005, 0x800, PQI_HWIF_SRCV, "SmartRAID 3154-8i"}, 74 {0x9005, 0x028f, 0x9005, 0x801, PQI_HWIF_SRCV, "SmartRAID 3152-8i"}, 75 {0x9005, 0x028f, 0x9005, 0x802, PQI_HWIF_SRCV, "SmartRAID 3151-4i"}, 76 {0x9005, 0x028f, 0x9005, 0x803, PQI_HWIF_SRCV, "SmartRAID 3101-4i"}, 77 {0x9005, 0x028f, 0x9005, 0x804, PQI_HWIF_SRCV, "SmartRAID 3154-8e"}, 78 {0x9005, 0x028f, 0x9005, 0x805, PQI_HWIF_SRCV, "SmartRAID 3102-8i"}, 79 {0x9005, 0x028f, 0x9005, 0x806, PQI_HWIF_SRCV, "SmartRAID 3100"}, 80 {0x9005, 0x028f, 0x9005, 0x807, PQI_HWIF_SRCV, "SmartRAID 3162-8i"}, 81 {0x9005, 0x028f, 0x152d, 0x8a22, PQI_HWIF_SRCV, "QS-8204-8i"}, 82 {0x9005, 0x028f, 0x193d, 0xf460, PQI_HWIF_SRCV, "UN RAID P460-M4"}, 83 {0x9005, 0x028f, 0x193d, 0xf461, PQI_HWIF_SRCV, "UN RAID P460-B4"}, 84 {0x9005, 0x028f, 0x1bd4, 0x004b, PQI_HWIF_SRCV, "PM8204-2GB"}, 85 {0x9005, 0x028f, 0x1bd4, 0x004c, PQI_HWIF_SRCV, "PM8204-4GB"}, 86 {0x9005, 0x028f, 0x193d, 0x1105, PQI_HWIF_SRCV, "UN RAID P4408-Mf-8i-2GB"}, 87 {0x9005, 0x028f, 0x193d, 0x1107, PQI_HWIF_SRCV, "UN RAID P4408-Mf-8i-4GB"}, 88 {0x9005, 0x028f, 0x1d8d, 0x800, PQI_HWIF_SRCV, "Fiberhome SmartRAID AIS-8204-8i"}, 89 {0x9005, 0x028f, 0x9005, 0x0808, PQI_HWIF_SRCV, "SmartRAID 3101E-4i"}, 90 {0x9005, 0x028f, 0x9005, 0x0809, PQI_HWIF_SRCV, "SmartRAID 3102E-8i"}, 91 {0x9005, 0x028f, 0x9005, 0x080a, PQI_HWIF_SRCV, "SmartRAID 3152-8i/N"}, 92 {0x9005, 0x028f, 0x1cc4, 0x0101, PQI_HWIF_SRCV, "Ramaxel FBGF-RAD PM8204"}, 93 94 /* (MSCC PM8222 8x12G based) */ 95 {0x9005, 0x028f, 0x9005, 0x900, PQI_HWIF_SRCV, "SmartHBA 2100-8i"}, 96 {0x9005, 0x028f, 0x9005, 0x901, PQI_HWIF_SRCV, "SmartHBA 2100-4i"}, 97 {0x9005, 0x028f, 0x9005, 0x902, PQI_HWIF_SRCV, "HBA 1100-8i"}, 98 {0x9005, 0x028f, 0x9005, 0x903, PQI_HWIF_SRCV, "HBA 1100-4i"}, 99 {0x9005, 0x028f, 0x9005, 0x904, PQI_HWIF_SRCV, "SmartHBA 2100-8e"}, 100 {0x9005, 0x028f, 0x9005, 0x905, PQI_HWIF_SRCV, "HBA 1100-8e"}, 101 {0x9005, 0x028f, 0x9005, 0x906, PQI_HWIF_SRCV, "SmartHBA 2100-4i4e"}, 102 {0x9005, 0x028f, 0x9005, 0x907, PQI_HWIF_SRCV, "HBA 1100"}, 103 {0x9005, 0x028f, 0x9005, 0x908, PQI_HWIF_SRCV, "SmartHBA 2100"}, 104 {0x9005, 0x028f, 0x9005, 0x90a, PQI_HWIF_SRCV, "SmartHBA 2100A-8i"}, 105 {0x9005, 0x028f, 0x193d, 0x8460, PQI_HWIF_SRCV, "UN HBA H460-M1"}, 106 {0x9005, 0x028f, 0x193d, 0x8461, PQI_HWIF_SRCV, "UN HBA H460-B1"}, 107 {0x9005, 0x028f, 0x193d, 0xc460, PQI_HWIF_SRCV, "UN RAID P460-M2"}, 108 {0x9005, 0x028f, 0x193d, 0xc461, PQI_HWIF_SRCV, "UN RAID P460-B2"}, 109 {0x9005, 0x028f, 0x1bd4, 0x004a, PQI_HWIF_SRCV, "PM8222-SHBA"}, 110 {0x9005, 0x028f, 0x13fe, 0x8312, PQI_HWIF_SRCV, "MIC-8312BridgeB"}, 111 {0x9005, 0x028f, 0x1bd4, 0x004f, PQI_HWIF_SRCV, "PM8222-HBA"}, 112 {0x9005, 0x028f, 0x1d8d, 0x908, PQI_HWIF_SRCV, "Fiberhome SmartHBA AIS-8222-8i"}, 113 {0x9005, 0x028f, 0x1bd4, 0x006C, PQI_HWIF_SRCV, "RS0800M5E8i"}, 114 {0x9005, 0x028f, 0x1bd4, 0x006D, PQI_HWIF_SRCV, "RS0800M5H8i"}, 115 {0x9005, 0x028f, 0x1cc4, 0x0201, PQI_HWIF_SRCV, "Ramaxel FBGF-RAD PM8222"}, 116 117 /* (SRCx MSCC FVB 24x12G based) */ 118 {0x9005, 0x028f, 0x103c, 0x1001, PQI_HWIF_SRCV, "MSCC FVB"}, 119 120 /* (MSCC PM8241 24x12G based) */ 121 122 /* (MSCC PM8242 24x12G based) */ 123 {0x9005, 0x028f, 0x152d, 0x8a37, PQI_HWIF_SRCV, "QS-8242-24i"}, 124 {0x9005, 0x028f, 0x9005, 0x1300, PQI_HWIF_SRCV, "HBA 1100-8i8e"}, 125 {0x9005, 0x028f, 0x9005, 0x1301, PQI_HWIF_SRCV, "HBA 1100-24i"}, 126 {0x9005, 0x028f, 0x9005, 0x1302, PQI_HWIF_SRCV, "SmartHBA 2100-8i8e"}, 127 {0x9005, 0x028f, 0x9005, 0x1303, PQI_HWIF_SRCV, "SmartHBA 2100-24i"}, 128 {0x9005, 0x028f, 0x105b, 0x1321, PQI_HWIF_SRCV, "8242-24i"}, 129 {0x9005, 0x028f, 0x1bd4, 0x0045, PQI_HWIF_SRCV, "SMART-HBA 8242-24i"}, 130 {0x9005, 0x028f, 0x1bd4, 0x006B, PQI_HWIF_SRCV, "RS0800M5H24i"}, 131 {0x9005, 0x028f, 0x1bd4, 0x0070, PQI_HWIF_SRCV, "RS0800M5E24i"}, 132 133 /* (MSCC PM8236 16x12G based) */ 134 {0x9005, 0x028f, 0x152d, 0x8a24, PQI_HWIF_SRCV, "QS-8236-16i"}, 135 {0x9005, 0x028f, 0x9005, 0x1380, PQI_HWIF_SRCV, "SmartRAID 3154-16i"}, 136 {0x9005, 0x028f, 0x1bd4, 0x0046, PQI_HWIF_SRCV, "RAID 8236-16i"}, 137 {0x9005, 0x028f, 0x1d8d, 0x806, PQI_HWIF_SRCV, "Fiberhome SmartRAID AIS-8236-16i"}, 138 {0x9005, 0x028f, 0x1cf2, 0x0B27, PQI_HWIF_SRCV, "ZTE SmartROC3100 SDPSA/B-18i 4G"}, 139 {0x9005, 0x028f, 0x1cf2, 0x0B45, PQI_HWIF_SRCV, "ZTE SmartROC3100 SDPSA/B_L-18i 2G"}, 140 {0x9005, 0x028f, 0x1cf2, 0x5445, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM241-18i 2G"}, 141 {0x9005, 0x028f, 0x1cf2, 0x5446, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM242-18i 4G"}, 142 {0x9005, 0x028f, 0x1cf2, 0x5449, PQI_HWIF_SRCV, "ZTE SmartROC3100 RS241-18i 2G"}, 143 {0x9005, 0x028f, 0x1cf2, 0x544A, PQI_HWIF_SRCV, "ZTE SmartROC3100 RS242-18i 4G"}, 144 {0x9005, 0x028f, 0x1cf2, 0x544D, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM241B-18i 2G"}, 145 {0x9005, 0x028f, 0x1cf2, 0x544E, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM242B-18i 4G"}, 146 {0x9005, 0x028f, 0x1bd4, 0x006F, PQI_HWIF_SRCV, "RS0804M5R16i"}, 147 148 149 150 /* (MSCC PM8237 24x12G based) */ 151 {0x9005, 0x028f, 0x103c, 0x1100, PQI_HWIF_SRCV, "P816i-a SR Gen10"}, 152 {0x9005, 0x028f, 0x103c, 0x1101, PQI_HWIF_SRCV, "P416ie-m SR G10"}, 153 154 /* (MSCC PM8238 16x12G based) */ 155 {0x9005, 0x028f, 0x152d, 0x8a23, PQI_HWIF_SRCV, "QS-8238-16i"}, 156 {0x9005, 0x028f, 0x9005, 0x1280, PQI_HWIF_SRCV, "HBA 1100-16i"}, 157 {0x9005, 0x028f, 0x9005, 0x1281, PQI_HWIF_SRCV, "HBA 1100-16e"}, 158 {0x9005, 0x028f, 0x105b, 0x1211, PQI_HWIF_SRCV, "8238-16i"}, 159 {0x9005, 0x028f, 0x1bd4, 0x0048, PQI_HWIF_SRCV, "SMART-HBA 8238-16i"}, 160 {0x9005, 0x028f, 0x9005, 0x1282, PQI_HWIF_SRCV, "SmartHBA 2100-16i"}, 161 {0x9005, 0x028f, 0x1d8d, 0x916, PQI_HWIF_SRCV, "Fiberhome SmartHBA AIS-8238-16i"}, 162 {0x9005, 0x028f, 0x1458, 0x1000, PQI_HWIF_SRCV, "GIGABYTE SmartHBA CLN1832"}, 163 {0x9005, 0x028f, 0x1cf2, 0x0B29, PQI_HWIF_SRCV, "ZTE SmartIOC2100 SDPSA/B_I-18i"}, 164 {0x9005, 0x028f, 0x1cf2, 0x5447, PQI_HWIF_SRCV, "ZTE SmartIOC2100 RM243-18i"}, 165 {0x9005, 0x028f, 0x1cf2, 0x544B, PQI_HWIF_SRCV, "ZTE SmartIOC2100 RS243-18i"}, 166 {0x9005, 0x028f, 0x1cf2, 0x544F, PQI_HWIF_SRCV, "ZTE SmartIOC2100 RM243B-18i"}, 167 {0x9005, 0x028f, 0x1bd4, 0x0071, PQI_HWIF_SRCV, "RS0800M5H16i"}, 168 {0x9005, 0x028f, 0x1bd4, 0x0072, PQI_HWIF_SRCV, "RS0800M5E16i"}, 169 170 /* (MSCC PM8240 24x12G based) */ 171 {0x9005, 0x028f, 0x152d, 0x8a36, PQI_HWIF_SRCV, "QS-8240-24i"}, 172 {0x9005, 0x028f, 0x9005, 0x1200, PQI_HWIF_SRCV, "SmartRAID 3154-24i"}, 173 {0x9005, 0x028f, 0x9005, 0x1201, PQI_HWIF_SRCV, "SmartRAID 3154-8i16e"}, 174 {0x9005, 0x028f, 0x9005, 0x1202, PQI_HWIF_SRCV, "SmartRAID 3154-8i8e"}, 175 {0x9005, 0x028f, 0x1bd4, 0x0047, PQI_HWIF_SRCV, "RAID 8240-24i"}, 176 {0x9005, 0x028f, 0x1dfc, 0x3161, PQI_HWIF_SRCV, "NTCOM SAS3 RAID-24i"}, 177 {0x9005, 0x028f, 0x1F0C, 0x3161, PQI_HWIF_SRCV, "NT RAID 3100-24i"}, 178 179 /* Huawei ID's */ 180 {0x9005, 0x028f, 0x19e5, 0xd227, PQI_HWIF_SRCV, "SR465C-M 4G"}, 181 {0x9005, 0x028f, 0x19e5, 0xd22a, PQI_HWIF_SRCV, "SR765-M"}, 182 {0x9005, 0x028f, 0x19e5, 0xd228, PQI_HWIF_SRCV, "SR455C-M 2G"}, 183 {0x9005, 0x028f, 0x19e5, 0xd22c, PQI_HWIF_SRCV, "SR455C-M 4G"}, 184 {0x9005, 0x028f, 0x19e5, 0xd229, PQI_HWIF_SRCV, "SR155-M"}, 185 {0x9005, 0x028f, 0x19e5, 0xd22b, PQI_HWIF_SRCV, "SR455C-ME 4G"}, 186 187 /* (MSCC PM8252 8x12G based) */ 188 {0x9005, 0x028f, 0x193d, 0x110b, PQI_HWIF_SRCV, "UN HBA H4508-Mf-8i"}, 189 {0x9005, 0x028f, 0x1bd4, 0x0052, PQI_HWIF_SRCV, "MT0801M6E"}, 190 {0x9005, 0x028f, 0x1bd4, 0x0054, PQI_HWIF_SRCV, "MT0800M6H"}, 191 {0x9005, 0x028f, 0x1bd4, 0x0086, PQI_HWIF_SRCV, "RT0800M7E"}, 192 {0x9005, 0x028f, 0x1bd4, 0x0087, PQI_HWIF_SRCV, "RT0800M7H"}, 193 {0x9005, 0x028f, 0x1f51, 0x1001, PQI_HWIF_SRCV, "SmartHBA P6600-8i"}, 194 {0x9005, 0x028f, 0x1f51, 0x1003, PQI_HWIF_SRCV, "SmartHBA P6600-8e"}, 195 {0x9005, 0x028f, 0x9005, 0x1460, PQI_HWIF_SRCV, "HBA 1200"}, 196 {0x9005, 0x028f, 0x9005, 0x1461, PQI_HWIF_SRCV, "SmartHBA 2200"}, 197 {0x9005, 0x028f, 0x9005, 0x1462, PQI_HWIF_SRCV, "HBA 1200-8i"}, 198 199 /* (MSCC PM8254 32x12G based) */ 200 {0x9005, 0x028f, 0x1bd4, 0x0051, PQI_HWIF_SRCV, "MT0804M6R"}, 201 {0x9005, 0x028f, 0x1bd4, 0x0053, PQI_HWIF_SRCV, "MT0808M6R"}, 202 {0x9005, 0x028f, 0x1bd4, 0x0088, PQI_HWIF_SRCV, "RT0804M7R"}, 203 {0x9005, 0x028f, 0x1bd4, 0x0089, PQI_HWIF_SRCV, "RT0808M7R"}, 204 {0x9005, 0x028f, 0x1f51, 0x1002, PQI_HWIF_SRCV, "SmartRAID P7604-8i"}, 205 {0x9005, 0x028f, 0x1f51, 0x1004, PQI_HWIF_SRCV, "SmartRAID P7604-8e"}, 206 {0x9005, 0x028f, 0x9005, 0x14a0, PQI_HWIF_SRCV, "SmartRAID 3254-8i"}, 207 {0x9005, 0x028f, 0x9005, 0x14a1, PQI_HWIF_SRCV, "SmartRAID 3204-8i"}, 208 {0x9005, 0x028f, 0x9005, 0x14a2, PQI_HWIF_SRCV, "SmartRAID 3252-8i"}, 209 {0x9005, 0x028f, 0x9005, 0x14a4, PQI_HWIF_SRCV, "SmartRAID 3254-8i /e"}, 210 {0x9005, 0x028f, 0x9005, 0x14a5, PQI_HWIF_SRCV, "SmartRAID 3252-8i /e"}, 211 {0x9005, 0x028f, 0x9005, 0x14a6, PQI_HWIF_SRCV, "SmartRAID 3204-8i /e"}, 212 213 /* (MSCC PM8262 16x12G based) */ 214 {0x9005, 0x028f, 0x9005, 0x14c0, PQI_HWIF_SRCV, "SmartHBA 2200-16i"}, 215 {0x9005, 0x028f, 0x9005, 0x14c1, PQI_HWIF_SRCV, "HBA 1200-16i"}, 216 {0x9005, 0x028f, 0x9005, 0x14c3, PQI_HWIF_SRCV, "HBA 1200-16e"}, 217 {0x9005, 0x028f, 0x9005, 0x14c4, PQI_HWIF_SRCV, "HBA 1200-8e"}, 218 {0x9005, 0x028f, 0x1f51, 0x1005, PQI_HWIF_SRCV, "SmartHBA P6600-16i"}, 219 {0x9005, 0x028f, 0x1f51, 0x1007, PQI_HWIF_SRCV, "SmartHBA P6600-8i8e"}, 220 {0x9005, 0x028f, 0x1f51, 0x1009, PQI_HWIF_SRCV, "SmartHBA P6600-16e"}, 221 {0x9005, 0x028f, 0x1cf2, 0x54dc, PQI_HWIF_SRCV, "ZTE SmartIOC2200 RM346-16i"}, 222 {0x9005, 0x028f, 0x1cf2, 0x0806, PQI_HWIF_SRCV, "ZTE SmartIOC2200 RS346-16i"}, 223 224 /* (MSCC PM8264 16x12G based) */ 225 {0x9005, 0x028f, 0x9005, 0x14b0, PQI_HWIF_SRCV, "SmartRAID 3254-16i"}, 226 {0x9005, 0x028f, 0x9005, 0x14b1, PQI_HWIF_SRCV, "SmartRAID 3258-16i"}, 227 {0x9005, 0x028f, 0x1f51, 0x1006, PQI_HWIF_SRCV, "SmartRAID P7608-16i"}, 228 {0x9005, 0x028f, 0x1f51, 0x1008, PQI_HWIF_SRCV, "SmartRAID P7608-8i8e"}, 229 {0x9005, 0x028f, 0x1f51, 0x100a, PQI_HWIF_SRCV, "SmartRAID P7608-16e"}, 230 {0x9005, 0x028f, 0x1cf2, 0x54da, PQI_HWIF_SRCV, "ZTE SmartROC3200 RM344-16i 4G"}, 231 {0x9005, 0x028f, 0x1cf2, 0x54db, PQI_HWIF_SRCV, "ZTE SmartROC3200 RM345-16i 8G"}, 232 {0x9005, 0x028f, 0x1cf2, 0x0804, PQI_HWIF_SRCV, "ZTE SmartROC3200 RS344-16i 4G"}, 233 {0x9005, 0x028f, 0x1cf2, 0x0805, PQI_HWIF_SRCV, "ZTE SmartROC3200 RS345-16i 8G"}, 234 235 /* (MSCC PM8265 16x12G based) */ 236 {0x9005, 0x028f, 0x1590, 0x02dc, PQI_HWIF_SRCV, "SR416i-a Gen10+"}, 237 {0x9005, 0x028f, 0x9005, 0x1470, PQI_HWIF_SRCV, "SmartRAID 3200"}, 238 {0x9005, 0x028f, 0x9005, 0x1471, PQI_HWIF_SRCV, "SmartRAID 3254-16i /e"}, 239 {0x9005, 0x028f, 0x9005, 0x1472, PQI_HWIF_SRCV, "SmartRAID 3258-16i /e"}, 240 {0x9005, 0x028f, 0x9005, 0x1473, PQI_HWIF_SRCV, "SmartRAID 3284-16io /e/uC"}, 241 {0x9005, 0x028f, 0x9005, 0x1474, PQI_HWIF_SRCV, "SmartRAID 3254-16io /e"}, 242 {0x9005, 0x028f, 0x9005, 0x1475, PQI_HWIF_SRCV, "SmartRAID 3254-16e /e"}, 243 244 /* (MSCC PM8266 16x12G based) */ 245 {0x9005, 0x028f, 0x1014, 0x0718, PQI_HWIF_SRCV, "IBM 4-Port 24G SAS"}, 246 {0x9005, 0x028f, 0x9005, 0x1490, PQI_HWIF_SRCV, "HBA 1200p Ultra"}, 247 {0x9005, 0x028f, 0x9005, 0x1491, PQI_HWIF_SRCV, "SmartHBA 2200p Ultra"}, 248 {0x9005, 0x028f, 0x9005, 0x1402, PQI_HWIF_SRCV, "HBA Ultra 1200P-16i"}, 249 {0x9005, 0x028f, 0x9005, 0x1441, PQI_HWIF_SRCV, "HBA Ultra 1200P-32i"}, 250 251 /* (MSCC PM8268 16x12G based) */ 252 {0x9005, 0x028f, 0x9005, 0x14d0, PQI_HWIF_SRCV, "SmartRAID Ultra 3258P-16i"}, 253 254 /* (MSCC PM8269 16x12G based) */ 255 {0x9005, 0x028f, 0x9005, 0x1400, PQI_HWIF_SRCV, "SmartRAID Ultra 3258P-16i /e"}, 256 257 /* (MSCC PM8270 16x12G based) */ 258 {0x9005, 0x028f, 0x9005, 0x1410, PQI_HWIF_SRCV, "HBA Ultra 1200P-16e"}, 259 {0x9005, 0x028f, 0x9005, 0x1411, PQI_HWIF_SRCV, "HBA 1200 Ultra"}, 260 {0x9005, 0x028f, 0x9005, 0x1412, PQI_HWIF_SRCV, "SmartHBA 2200 Ultra"}, 261 {0x9005, 0x028f, 0x9005, 0x1463, PQI_HWIF_SRCV, "SmartHBA 2200-8io /e"}, 262 {0x9005, 0x028f, 0x9005, 0x14c2, PQI_HWIF_SRCV, "SmartHBA 2200-16io /e"}, 263 264 /* (MSCC PM8271 16x12G based) */ 265 {0x9005, 0x028f, 0x9005, 0x14e0, PQI_HWIF_SRCV, "SmartIOC PM8271"}, 266 267 /* (MSCC PM8272 16x12G based) */ 268 {0x9005, 0x028f, 0x9005, 0x1420, PQI_HWIF_SRCV, "SmartRAID Ultra 3254-16e"}, 269 270 /* (MSCC PM8273 16x12G based) */ 271 {0x9005, 0x028f, 0x9005, 0x1430, PQI_HWIF_SRCV, "SmartRAID Ultra 3254-16e /e"}, 272 273 /* (MSCC PM8274 16x12G based) */ 274 {0x9005, 0x028f, 0x1e93, 0x1000, PQI_HWIF_SRCV, "ByteHBA JGH43024-8"}, 275 {0x9005, 0x028f, 0x1e93, 0x1001, PQI_HWIF_SRCV, "ByteHBA JGH43034-8"}, 276 {0x9005, 0x028f, 0x1e93, 0x1005, PQI_HWIF_SRCV, "ByteHBA JGH43014-8"}, 277 278 /* (MSCC PM8275 16x12G based) */ 279 {0x9005, 0x028f, 0x9005, 0x14f0, PQI_HWIF_SRCV, "SmartIOC PM8275"}, 280 281 /* (MSCC PM8276 16x12G based) */ 282 {0x9005, 0x028f, 0x9005, 0x1480, PQI_HWIF_SRCV, "SmartRAID 3200 Ultra"}, 283 {0x9005, 0x028f, 0x1e93, 0x1002, PQI_HWIF_SRCV, "ByteHBA JGH44014-8"}, 284 285 /* (MSCC PM8278 16x12G based) */ 286 {0x9005, 0x028f, 0x9005, 0x1440, PQI_HWIF_SRCV, "SmartRAID Ultra 3258P-32i"}, 287 288 /* (MSCC PM8279 32x12G based) */ 289 {0x9005, 0x028f, 0x9005, 0x1450, PQI_HWIF_SRCV, "SmartRAID Ultra 3258P-32i /e"}, 290 {0x9005, 0x028f, 0x1590, 0x0294, PQI_HWIF_SRCV, "SR932i-p Gen10+"}, 291 {0x9005, 0x028f, 0x1590, 0x0381, PQI_HWIF_SRCV, "SR932i-p Gen11"}, 292 {0x9005, 0x028f, 0x1590, 0x0382, PQI_HWIF_SRCV, "SR308i-p Gen11"}, 293 {0x9005, 0x028f, 0x1590, 0x0383, PQI_HWIF_SRCV, "SR308i-o Gen11"}, 294 {0x9005, 0x028f, 0x1590, 0x02db, PQI_HWIF_SRCV, "SR416ie-m Gen11"}, 295 {0x9005, 0x028f, 0x1590, 0x032e, PQI_HWIF_SRCV, "SR416i-o Gen11"}, 296 {0x9005, 0x028f, 0x9005, 0x1452, PQI_HWIF_SRCV, "SmartRAID 3200p Ultra"}, 297 298 /* (MSCC HBA/SMARTHBA/CFF SmartRAID - Lenovo 8X12G 16X12G based) */ 299 {0x9005, 0x028f, 0x1d49, 0x0220, PQI_HWIF_SRCV, "4350-8i SAS/SATA HBA"}, 300 {0x9005, 0x028f, 0x1d49, 0x0221, PQI_HWIF_SRCV, "4350-16i SAS/SATA HBA"}, 301 {0x9005, 0x028f, 0x1d49, 0x0520, PQI_HWIF_SRCV, "5350-8i"}, 302 {0x9005, 0x028f, 0x1d49, 0x0522, PQI_HWIF_SRCV, "5350-8i INTR"}, 303 {0x9005, 0x028f, 0x1d49, 0x0620, PQI_HWIF_SRCV, "9350-8i 2GB Flash"}, 304 {0x9005, 0x028f, 0x1d49, 0x0621, PQI_HWIF_SRCV, "9350-8i 2GB Flash INTR"}, 305 {0x9005, 0x028f, 0x1d49, 0x0622, PQI_HWIF_SRCV, "9350-16i 4GB Flash"}, 306 {0x9005, 0x028f, 0x1d49, 0x0623, PQI_HWIF_SRCV, "9350-16i 4GB Flash INTR"}, 307 308 {0, 0, 0, 0, 0, 0} 309 }; 310 311 struct pqi_ident 312 pqi_family_identifiers[] = { 313 {0x9005, 0x028f, 0, 0, PQI_HWIF_SRCV, "Smart Array Storage Controller"}, 314 {0, 0, 0, 0, 0, 0} 315 }; 316 317 /* 318 * Function to identify the installed adapter. 319 */ 320 static struct pqi_ident * 321 pqi_find_ident(device_t dev) 322 { 323 struct pqi_ident *m; 324 u_int16_t vendid, devid, sub_vendid, sub_devid; 325 static long AllowWildcards = 0xffffffff; 326 int result; 327 328 #ifdef DEVICE_HINT 329 if (AllowWildcards == 0xffffffff) 330 { 331 result = resource_long_value("smartpqi", 0, "allow_wildcards", &AllowWildcards); 332 333 /* the default case if the hint is not found is to allow wildcards */ 334 if (result != DEVICE_HINT_SUCCESS) { 335 AllowWildcards = 1; 336 } 337 } 338 339 #endif 340 341 vendid = pci_get_vendor(dev); 342 devid = pci_get_device(dev); 343 sub_vendid = pci_get_subvendor(dev); 344 sub_devid = pci_get_subdevice(dev); 345 346 for (m = pqi_identifiers; m->vendor != 0; m++) { 347 if ((m->vendor == vendid) && (m->device == devid) && 348 (m->subvendor == sub_vendid) && 349 (m->subdevice == sub_devid)) { 350 return (m); 351 } 352 } 353 354 for (m = pqi_family_identifiers; m->vendor != 0; m++) { 355 if ((m->vendor == vendid) && (m->device == devid)) { 356 if (AllowWildcards != 0) 357 { 358 DBG_NOTE("Controller device ID matched using wildcards\n"); 359 return (m); 360 } 361 else 362 { 363 DBG_NOTE("Controller not probed because device ID wildcards are disabled\n") 364 return (NULL); 365 } 366 } 367 } 368 369 return (NULL); 370 } 371 372 /* 373 * Determine whether this is one of our supported adapters. 374 */ 375 static int 376 smartpqi_probe(device_t dev) 377 { 378 struct pqi_ident *id; 379 380 if ((id = pqi_find_ident(dev)) != NULL) { 381 device_set_desc(dev, id->desc); 382 return(BUS_PROBE_VENDOR); 383 } 384 385 return(ENXIO); 386 } 387 388 /* 389 * Store Bus/Device/Function in softs 390 */ 391 void 392 pqisrc_save_controller_info(struct pqisrc_softstate *softs) 393 { 394 device_t dev = softs->os_specific.pqi_dev; 395 396 softs->bus_id = (uint32_t)pci_get_bus(dev); 397 softs->device_id = (uint32_t)pci_get_device(dev); 398 softs->func_id = (uint32_t)pci_get_function(dev); 399 } 400 401 402 static void read_device_hint_resource(struct pqisrc_softstate *softs, 403 char *keyword, uint32_t *value) 404 { 405 DBG_FUNC("IN\n"); 406 407 device_t dev = softs->os_specific.pqi_dev; 408 409 if (resource_long_value("smartpqi", device_get_unit(dev), keyword, (long *)value) == DEVICE_HINT_SUCCESS) { 410 if (*value) { 411 /* set resource to 1 for disabling the 412 * firmware feature in device hint file. */ 413 *value = 0; 414 415 } 416 else { 417 /* set resource to 0 for enabling the 418 * firmware feature in device hint file. */ 419 *value = 1; 420 } 421 } 422 else { 423 /* Enabled by default */ 424 *value = 1; 425 } 426 427 DBG_NOTE("SmartPQI Device Hint: %s, Is it enabled = %u\n", keyword, *value); 428 429 DBG_FUNC("OUT\n"); 430 } 431 432 static void read_device_hint_decimal_value(struct pqisrc_softstate *softs, 433 char *keyword, uint32_t *value) 434 { 435 DBG_FUNC("IN\n"); 436 437 device_t dev = softs->os_specific.pqi_dev; 438 439 if (resource_long_value("smartpqi", device_get_unit(dev), keyword, (long *)value) == DEVICE_HINT_SUCCESS) { 440 /* Nothing to do here. Value reads 441 * directly from Device.Hint file */ 442 } 443 else { 444 /* Set to max to determine the value */ 445 *value = 0XFFFF; 446 } 447 448 DBG_FUNC("OUT\n"); 449 } 450 451 static void smartpqi_read_all_device_hint_file_entries(struct pqisrc_softstate *softs) 452 { 453 uint32_t value = 0; 454 455 DBG_FUNC("IN\n"); 456 457 /* hint.smartpqi.0.stream_disable = "0" */ 458 read_device_hint_resource(softs, STREAM_DETECTION, &value); 459 softs->hint.stream_status = value; 460 461 /* hint.smartpqi.0.sata_unique_wwn_disable = "0" */ 462 read_device_hint_resource(softs, SATA_UNIQUE_WWN, &value); 463 softs->hint.sata_unique_wwn_status = value; 464 465 /* hint.smartpqi.0.aio_raid1_write_disable = "0" */ 466 read_device_hint_resource(softs, AIO_RAID1_WRITE_BYPASS, &value); 467 softs->hint.aio_raid1_write_status = value; 468 469 /* hint.smartpqi.0.aio_raid5_write_disable = "0" */ 470 read_device_hint_resource(softs, AIO_RAID5_WRITE_BYPASS, &value); 471 softs->hint.aio_raid5_write_status = value; 472 473 /* hint.smartpqi.0.aio_raid6_write_disable = "0" */ 474 read_device_hint_resource(softs, AIO_RAID6_WRITE_BYPASS, &value); 475 softs->hint.aio_raid6_write_status = value; 476 477 /* hint.smartpqi.0.queue_depth = "0" */ 478 read_device_hint_decimal_value(softs, ADAPTER_QUEUE_DEPTH, &value); 479 softs->hint.queue_depth = value; 480 481 /* hint.smartpqi.0.sg_count = "0" */ 482 read_device_hint_decimal_value(softs, SCATTER_GATHER_COUNT, &value); 483 softs->hint.sg_segments = value; 484 485 /* hint.smartpqi.0.queue_count = "0" */ 486 read_device_hint_decimal_value(softs, QUEUE_COUNT, &value); 487 softs->hint.cpu_count = value; 488 489 DBG_FUNC("IN\n"); 490 } 491 492 493 /* 494 * Allocate resources for our device, set up the bus interface. 495 * Initialize the PQI related functionality, scan devices, register sim to 496 * upper layer, create management interface device node etc. 497 */ 498 static int 499 smartpqi_attach(device_t dev) 500 { 501 struct pqisrc_softstate *softs; 502 struct pqi_ident *id = NULL; 503 int error = BSD_SUCCESS; 504 u_int32_t command = 0, i = 0; 505 int card_index = device_get_unit(dev); 506 rcb_t *rcbp = NULL; 507 508 /* 509 * Initialise softc. 510 */ 511 softs = device_get_softc(dev); 512 513 if (!softs) { 514 printf("Could not get softc\n"); 515 error = EINVAL; 516 goto out; 517 } 518 memset(softs, 0, sizeof(*softs)); 519 softs->os_specific.pqi_dev = dev; 520 521 DBG_FUNC("IN\n"); 522 523 /* assume failure is 'not configured' */ 524 error = ENXIO; 525 526 /* 527 * Verify that the adapter is correctly set up in PCI space. 528 */ 529 pci_enable_busmaster(softs->os_specific.pqi_dev); 530 command = pci_read_config(softs->os_specific.pqi_dev, PCIR_COMMAND, 2); 531 if ((command & PCIM_CMD_MEMEN) == 0) { 532 DBG_ERR("memory window not available command = %d\n", command); 533 error = ENXIO; 534 goto out; 535 } 536 537 /* 538 * Detect the hardware interface version, set up the bus interface 539 * indirection. 540 */ 541 id = pqi_find_ident(dev); 542 if (!id) { 543 DBG_ERR("NULL return value from pqi_find_ident\n"); 544 goto out; 545 } 546 547 softs->os_specific.pqi_hwif = id->hwif; 548 549 switch(softs->os_specific.pqi_hwif) { 550 case PQI_HWIF_SRCV: 551 DBG_INFO("set hardware up for PMC SRCv for %p\n", softs); 552 break; 553 default: 554 softs->os_specific.pqi_hwif = PQI_HWIF_UNKNOWN; 555 DBG_ERR("unknown hardware type\n"); 556 error = ENXIO; 557 goto out; 558 } 559 560 pqisrc_save_controller_info(softs); 561 562 /* 563 * Allocate the PCI register window. 564 */ 565 softs->os_specific.pqi_regs_rid0 = PCIR_BAR(0); 566 if ((softs->os_specific.pqi_regs_res0 = 567 bus_alloc_resource_any(softs->os_specific.pqi_dev, SYS_RES_MEMORY, 568 &softs->os_specific.pqi_regs_rid0, RF_ACTIVE)) == NULL) { 569 DBG_ERR("couldn't allocate register window 0\n"); 570 /* assume failure is 'out of memory' */ 571 error = ENOMEM; 572 goto out; 573 } 574 575 bus_get_resource_start(softs->os_specific.pqi_dev, SYS_RES_MEMORY, 576 softs->os_specific.pqi_regs_rid0); 577 578 softs->pci_mem_handle.pqi_btag = rman_get_bustag(softs->os_specific.pqi_regs_res0); 579 softs->pci_mem_handle.pqi_bhandle = rman_get_bushandle(softs->os_specific.pqi_regs_res0); 580 /* softs->pci_mem_base_vaddr = (uintptr_t)rman_get_virtual(softs->os_specific.pqi_regs_res0); */ 581 softs->pci_mem_base_vaddr = (char *)rman_get_virtual(softs->os_specific.pqi_regs_res0); 582 583 /* 584 * Allocate the parent bus DMA tag appropriate for our PCI interface. 585 * 586 * Note that some of these controllers are 64-bit capable. 587 */ 588 if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 589 PAGE_SIZE, 0, /* algnmnt, boundary */ 590 BUS_SPACE_MAXADDR,/* lowaddr */ 591 BUS_SPACE_MAXADDR, /* highaddr */ 592 NULL, NULL, /* filter, filterarg */ 593 BUS_SPACE_MAXSIZE, /* maxsize */ 594 BUS_SPACE_UNRESTRICTED, /* nsegments */ 595 BUS_SPACE_MAXSIZE, /* maxsegsize */ 596 0, /* flags */ 597 NULL, NULL, /* No locking needed */ 598 &softs->os_specific.pqi_parent_dmat)) { 599 DBG_ERR("can't allocate parent DMA tag\n"); 600 /* assume failure is 'out of memory' */ 601 error = ENOMEM; 602 goto dma_out; 603 } 604 605 softs->os_specific.sim_registered = FALSE; 606 softs->os_name = "FreeBSD "; 607 608 smartpqi_read_all_device_hint_file_entries(softs); 609 610 /* Initialize the PQI library */ 611 error = pqisrc_init(softs); 612 if (error != PQI_STATUS_SUCCESS) { 613 DBG_ERR("Failed to initialize pqi lib error = %d\n", error); 614 error = ENXIO; 615 goto out; 616 } 617 else { 618 error = BSD_SUCCESS; 619 } 620 621 mtx_init(&softs->os_specific.cam_lock, "cam_lock", NULL, MTX_DEF); 622 softs->os_specific.mtx_init = TRUE; 623 mtx_init(&softs->os_specific.map_lock, "map_lock", NULL, MTX_DEF); 624 625 callout_init(&softs->os_specific.wellness_periodic, 1); 626 callout_init(&softs->os_specific.heartbeat_timeout_id, 1); 627 628 /* 629 * Create DMA tag for mapping buffers into controller-addressable space. 630 */ 631 if (bus_dma_tag_create(softs->os_specific.pqi_parent_dmat,/* parent */ 632 PAGE_SIZE, 0, /* algnmnt, boundary */ 633 BUS_SPACE_MAXADDR,/* lowaddr */ 634 BUS_SPACE_MAXADDR, /* highaddr */ 635 NULL, NULL, /* filter, filterarg */ 636 (bus_size_t)softs->pqi_cap.max_sg_elem*PAGE_SIZE,/* maxsize */ 637 softs->pqi_cap.max_sg_elem, /* nsegments */ 638 BUS_SPACE_MAXSIZE, /* maxsegsize */ 639 BUS_DMA_ALLOCNOW, /* flags */ 640 busdma_lock_mutex, /* lockfunc */ 641 &softs->os_specific.map_lock, /* lockfuncarg*/ 642 &softs->os_specific.pqi_buffer_dmat)) { 643 DBG_ERR("can't allocate buffer DMA tag for pqi_buffer_dmat\n"); 644 return (ENOMEM); 645 } 646 647 rcbp = &softs->rcb[1]; 648 for( i = 1; i <= softs->pqi_cap.max_outstanding_io; i++, rcbp++ ) { 649 if ((error = bus_dmamap_create(softs->os_specific.pqi_buffer_dmat, 0, &rcbp->cm_datamap)) != 0) { 650 DBG_ERR("Cant create datamap for buf @" 651 "rcbp = %p maxio = %u error = %d\n", 652 rcbp, softs->pqi_cap.max_outstanding_io, error); 653 goto dma_out; 654 } 655 } 656 657 os_start_heartbeat_timer((void *)softs); /* Start the heart-beat timer */ 658 callout_reset(&softs->os_specific.wellness_periodic, 120 * hz, 659 os_wellness_periodic, softs); 660 661 error = pqisrc_scan_devices(softs); 662 if (error != PQI_STATUS_SUCCESS) { 663 DBG_ERR("Failed to scan lib error = %d\n", error); 664 error = ENXIO; 665 goto out; 666 } 667 else { 668 error = BSD_SUCCESS; 669 } 670 671 error = register_sim(softs, card_index); 672 if (error) { 673 DBG_ERR("Failed to register sim index = %d error = %d\n", 674 card_index, error); 675 goto out; 676 } 677 678 smartpqi_target_rescan(softs); 679 680 TASK_INIT(&softs->os_specific.event_task, 0, pqisrc_event_worker,softs); 681 682 error = create_char_dev(softs, card_index); 683 if (error) { 684 DBG_ERR("Failed to register character device index=%d r=%d\n", 685 card_index, error); 686 goto out; 687 } 688 689 goto out; 690 691 dma_out: 692 if (softs->os_specific.pqi_regs_res0 != NULL) 693 bus_release_resource(softs->os_specific.pqi_dev, SYS_RES_MEMORY, 694 softs->os_specific.pqi_regs_rid0, 695 softs->os_specific.pqi_regs_res0); 696 out: 697 DBG_FUNC("OUT error = %d\n", error); 698 699 return(error); 700 } 701 702 /* 703 * Deallocate resources for our device. 704 */ 705 static int 706 smartpqi_detach(device_t dev) 707 { 708 struct pqisrc_softstate *softs = device_get_softc(dev); 709 int rval = BSD_SUCCESS; 710 711 DBG_FUNC("IN\n"); 712 713 if (softs == NULL) 714 return ENXIO; 715 716 /* kill the periodic event */ 717 callout_drain(&softs->os_specific.wellness_periodic); 718 /* Kill the heart beat event */ 719 callout_drain(&softs->os_specific.heartbeat_timeout_id); 720 721 if (!pqisrc_ctrl_offline(softs)) { 722 rval = pqisrc_flush_cache(softs, PQISRC_NONE_CACHE_FLUSH_ONLY); 723 if (rval != PQI_STATUS_SUCCESS) { 724 DBG_ERR("Unable to flush adapter cache! rval = %d\n", rval); 725 rval = EIO; 726 } else { 727 rval = BSD_SUCCESS; 728 } 729 } 730 731 destroy_char_dev(softs); 732 pqisrc_uninit(softs); 733 deregister_sim(softs); 734 pci_release_msi(dev); 735 736 DBG_FUNC("OUT\n"); 737 738 return rval; 739 } 740 741 /* 742 * Bring the controller to a quiescent state, ready for system suspend. 743 */ 744 static int 745 smartpqi_suspend(device_t dev) 746 { 747 struct pqisrc_softstate *softs = device_get_softc(dev); 748 749 DBG_FUNC("IN\n"); 750 751 if (softs == NULL) 752 return ENXIO; 753 754 DBG_INFO("Suspending the device %p\n", softs); 755 softs->os_specific.pqi_state |= SMART_STATE_SUSPEND; 756 757 DBG_FUNC("OUT\n"); 758 759 return BSD_SUCCESS; 760 } 761 762 /* 763 * Bring the controller back to a state ready for operation. 764 */ 765 static int 766 smartpqi_resume(device_t dev) 767 { 768 struct pqisrc_softstate *softs = device_get_softc(dev); 769 770 DBG_FUNC("IN\n"); 771 772 if (softs == NULL) 773 return ENXIO; 774 775 softs->os_specific.pqi_state &= ~SMART_STATE_SUSPEND; 776 777 DBG_FUNC("OUT\n"); 778 779 return BSD_SUCCESS; 780 } 781 782 /* 783 * Do whatever is needed during a system shutdown. 784 */ 785 static int 786 smartpqi_shutdown(device_t dev) 787 { 788 struct pqisrc_softstate *softs = device_get_softc(dev); 789 int bsd_status = BSD_SUCCESS; 790 int pqi_status; 791 792 DBG_FUNC("IN\n"); 793 794 if (softs == NULL) 795 return ENXIO; 796 797 if (pqisrc_ctrl_offline(softs)) 798 return BSD_SUCCESS; 799 800 pqi_status = pqisrc_flush_cache(softs, PQISRC_SHUTDOWN); 801 if (pqi_status != PQI_STATUS_SUCCESS) { 802 DBG_ERR("Unable to flush adapter cache! rval = %d\n", pqi_status); 803 bsd_status = EIO; 804 } 805 806 DBG_FUNC("OUT\n"); 807 808 return bsd_status; 809 } 810 811 812 /* 813 * PCI bus interface. 814 */ 815 static device_method_t pqi_methods[] = { 816 /* Device interface */ 817 DEVMETHOD(device_probe, smartpqi_probe), 818 DEVMETHOD(device_attach, smartpqi_attach), 819 DEVMETHOD(device_detach, smartpqi_detach), 820 DEVMETHOD(device_suspend, smartpqi_suspend), 821 DEVMETHOD(device_resume, smartpqi_resume), 822 DEVMETHOD(device_shutdown, smartpqi_shutdown), 823 { 0, 0 } 824 }; 825 826 static driver_t smartpqi_pci_driver = { 827 "smartpqi", 828 pqi_methods, 829 sizeof(struct pqisrc_softstate) 830 }; 831 832 DRIVER_MODULE(smartpqi, pci, smartpqi_pci_driver, 0, 0); 833 MODULE_DEPEND(smartpqi, pci, 1, 1, 1); 834