.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2015 Linaro Ltd. |
---|
3 | 4 | * Copyright (c) 2015 Hisilicon Limited. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License as published by |
---|
7 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
8 | | - * (at your option) any later version. |
---|
9 | | - * |
---|
10 | 5 | */ |
---|
11 | 6 | |
---|
12 | 7 | #include "hisi_sas.h" |
---|
.. | .. |
---|
406 | 401 | TRANS_RX_SMP_RESP_TIMEOUT_ERR, /* 0x31a */ |
---|
407 | 402 | }; |
---|
408 | 403 | |
---|
409 | | -#define HISI_SAS_COMMAND_ENTRIES_V1_HW 8192 |
---|
410 | | - |
---|
411 | 404 | #define HISI_SAS_PHY_MAX_INT_NR (HISI_SAS_PHY_INT_NR * HISI_SAS_MAX_PHYS) |
---|
412 | 405 | #define HISI_SAS_CQ_MAX_INT_NR (HISI_SAS_MAX_QUEUES) |
---|
413 | 406 | #define HISI_SAS_FATAL_INT_NR (2) |
---|
.. | .. |
---|
421 | 414 | void __iomem *regs = hisi_hba->regs + off; |
---|
422 | 415 | |
---|
423 | 416 | return readl(regs); |
---|
424 | | -} |
---|
425 | | - |
---|
426 | | -static u32 hisi_sas_read32_relaxed(struct hisi_hba *hisi_hba, u32 off) |
---|
427 | | -{ |
---|
428 | | - void __iomem *regs = hisi_hba->regs + off; |
---|
429 | | - |
---|
430 | | - return readl_relaxed(regs); |
---|
431 | 417 | } |
---|
432 | 418 | |
---|
433 | 419 | static void hisi_sas_write32(struct hisi_hba *hisi_hba, |
---|
.. | .. |
---|
510 | 496 | struct hisi_sas_itct *itct = &hisi_hba->itct[device_id]; |
---|
511 | 497 | struct asd_sas_port *sas_port = device->port; |
---|
512 | 498 | struct hisi_sas_port *port = to_hisi_sas_port(sas_port); |
---|
| 499 | + u64 sas_addr; |
---|
513 | 500 | |
---|
514 | 501 | memset(itct, 0, sizeof(*itct)); |
---|
515 | 502 | |
---|
.. | .. |
---|
534 | 521 | itct->qw0 = cpu_to_le64(qw0); |
---|
535 | 522 | |
---|
536 | 523 | /* qw1 */ |
---|
537 | | - memcpy(&itct->sas_addr, device->sas_addr, SAS_ADDR_SIZE); |
---|
538 | | - itct->sas_addr = __swab64(itct->sas_addr); |
---|
| 524 | + memcpy(&sas_addr, device->sas_addr, SAS_ADDR_SIZE); |
---|
| 525 | + itct->sas_addr = cpu_to_le64(__swab64(sas_addr)); |
---|
539 | 526 | |
---|
540 | 527 | /* qw2 */ |
---|
541 | 528 | itct->qw2 = cpu_to_le64((500ULL << ITCT_HDR_IT_NEXUS_LOSS_TL_OFF) | |
---|
.. | .. |
---|
544 | 531 | (0xff00ULL << ITCT_HDR_REJ_OPEN_TL_OFF)); |
---|
545 | 532 | } |
---|
546 | 533 | |
---|
547 | | -static void clear_itct_v1_hw(struct hisi_hba *hisi_hba, |
---|
548 | | - struct hisi_sas_device *sas_dev) |
---|
| 534 | +static int clear_itct_v1_hw(struct hisi_hba *hisi_hba, |
---|
| 535 | + struct hisi_sas_device *sas_dev) |
---|
549 | 536 | { |
---|
550 | 537 | u64 dev_id = sas_dev->device_id; |
---|
551 | 538 | struct hisi_sas_itct *itct = &hisi_hba->itct[dev_id]; |
---|
.. | .. |
---|
561 | 548 | reg_val &= ~CFG_AGING_TIME_ITCT_REL_MSK; |
---|
562 | 549 | hisi_sas_write32(hisi_hba, CFG_AGING_TIME, reg_val); |
---|
563 | 550 | |
---|
564 | | - qw0 = cpu_to_le64(itct->qw0); |
---|
| 551 | + qw0 = le64_to_cpu(itct->qw0); |
---|
565 | 552 | qw0 &= ~ITCT_HDR_VALID_MSK; |
---|
566 | 553 | itct->qw0 = cpu_to_le64(qw0); |
---|
| 554 | + |
---|
| 555 | + return 0; |
---|
567 | 556 | } |
---|
568 | 557 | |
---|
569 | 558 | static int reset_hw_v1_hw(struct hisi_hba *hisi_hba) |
---|
.. | .. |
---|
763 | 752 | |
---|
764 | 753 | rc = reset_hw_v1_hw(hisi_hba); |
---|
765 | 754 | if (rc) { |
---|
766 | | - dev_err(dev, "hisi_sas_reset_hw failed, rc=%d", rc); |
---|
| 755 | + dev_err(dev, "hisi_sas_reset_hw failed, rc=%d\n", rc); |
---|
767 | 756 | return rc; |
---|
768 | 757 | } |
---|
769 | 758 | |
---|
.. | .. |
---|
797 | 786 | enable_phy_v1_hw(hisi_hba, phy_no); |
---|
798 | 787 | } |
---|
799 | 788 | |
---|
800 | | -static void stop_phy_v1_hw(struct hisi_hba *hisi_hba, int phy_no) |
---|
801 | | -{ |
---|
802 | | - disable_phy_v1_hw(hisi_hba, phy_no); |
---|
803 | | -} |
---|
804 | | - |
---|
805 | 789 | static void phy_hard_reset_v1_hw(struct hisi_hba *hisi_hba, int phy_no) |
---|
806 | 790 | { |
---|
807 | | - stop_phy_v1_hw(hisi_hba, phy_no); |
---|
| 791 | + hisi_sas_phy_enable(hisi_hba, phy_no, 0); |
---|
808 | 792 | msleep(100); |
---|
809 | | - start_phy_v1_hw(hisi_hba, phy_no); |
---|
| 793 | + hisi_sas_phy_enable(hisi_hba, phy_no, 1); |
---|
810 | 794 | } |
---|
811 | 795 | |
---|
812 | 796 | static void start_phys_v1_hw(struct timer_list *t) |
---|
.. | .. |
---|
816 | 800 | |
---|
817 | 801 | for (i = 0; i < hisi_hba->n_phy; i++) { |
---|
818 | 802 | hisi_sas_phy_write32(hisi_hba, i, CHL_INT2_MSK, 0x12a); |
---|
819 | | - start_phy_v1_hw(hisi_hba, i); |
---|
| 803 | + hisi_sas_phy_enable(hisi_hba, i, 1); |
---|
820 | 804 | } |
---|
821 | 805 | } |
---|
822 | 806 | |
---|
.. | .. |
---|
873 | 857 | bitmap |= 1 << i; |
---|
874 | 858 | |
---|
875 | 859 | return bitmap; |
---|
876 | | -} |
---|
877 | | - |
---|
878 | | -/* |
---|
879 | | - * The callpath to this function and upto writing the write |
---|
880 | | - * queue pointer should be safe from interruption. |
---|
881 | | - */ |
---|
882 | | -static int |
---|
883 | | -get_free_slot_v1_hw(struct hisi_hba *hisi_hba, struct hisi_sas_dq *dq) |
---|
884 | | -{ |
---|
885 | | - struct device *dev = hisi_hba->dev; |
---|
886 | | - int queue = dq->id; |
---|
887 | | - u32 r, w; |
---|
888 | | - |
---|
889 | | - w = dq->wr_point; |
---|
890 | | - r = hisi_sas_read32_relaxed(hisi_hba, |
---|
891 | | - DLVRY_Q_0_RD_PTR + (queue * 0x14)); |
---|
892 | | - if (r == (w+1) % HISI_SAS_QUEUE_SLOTS) { |
---|
893 | | - dev_warn(dev, "could not find free slot\n"); |
---|
894 | | - return -EAGAIN; |
---|
895 | | - } |
---|
896 | | - |
---|
897 | | - dq->wr_point = (dq->wr_point + 1) % HISI_SAS_QUEUE_SLOTS; |
---|
898 | | - |
---|
899 | | - return w; |
---|
900 | 860 | } |
---|
901 | 861 | |
---|
902 | 862 | /* DQ lock must be taken here */ |
---|
.. | .. |
---|
1100 | 1060 | case SAS_PROTOCOL_SSP: |
---|
1101 | 1061 | { |
---|
1102 | 1062 | int error = -1; |
---|
1103 | | - u32 dma_err_type = cpu_to_le32(err_record->dma_err_type); |
---|
| 1063 | + u32 dma_err_type = le32_to_cpu(err_record->dma_err_type); |
---|
1104 | 1064 | u32 dma_tx_err_type = ((dma_err_type & |
---|
1105 | 1065 | ERR_HDR_DMA_TX_ERR_TYPE_MSK)) >> |
---|
1106 | 1066 | ERR_HDR_DMA_TX_ERR_TYPE_OFF; |
---|
.. | .. |
---|
1108 | 1068 | ERR_HDR_DMA_RX_ERR_TYPE_MSK)) >> |
---|
1109 | 1069 | ERR_HDR_DMA_RX_ERR_TYPE_OFF; |
---|
1110 | 1070 | u32 trans_tx_fail_type = |
---|
1111 | | - cpu_to_le32(err_record->trans_tx_fail_type); |
---|
| 1071 | + le32_to_cpu(err_record->trans_tx_fail_type); |
---|
1112 | 1072 | u32 trans_rx_fail_type = |
---|
1113 | | - cpu_to_le32(err_record->trans_rx_fail_type); |
---|
| 1073 | + le32_to_cpu(err_record->trans_rx_fail_type); |
---|
1114 | 1074 | |
---|
1115 | 1075 | if (dma_tx_err_type) { |
---|
1116 | 1076 | /* dma tx err */ |
---|
.. | .. |
---|
1192 | 1152 | } |
---|
1193 | 1153 | default: |
---|
1194 | 1154 | { |
---|
1195 | | - ts->stat = SAM_STAT_CHECK_CONDITION; |
---|
| 1155 | + ts->stat = SAS_SAM_STAT_CHECK_CONDITION; |
---|
1196 | 1156 | break; |
---|
1197 | 1157 | } |
---|
1198 | 1158 | } |
---|
1199 | 1159 | } |
---|
1200 | 1160 | break; |
---|
1201 | 1161 | case SAS_PROTOCOL_SMP: |
---|
1202 | | - ts->stat = SAM_STAT_CHECK_CONDITION; |
---|
| 1162 | + ts->stat = SAS_SAM_STAT_CHECK_CONDITION; |
---|
1203 | 1163 | break; |
---|
1204 | 1164 | |
---|
1205 | 1165 | case SAS_PROTOCOL_SATA: |
---|
1206 | 1166 | case SAS_PROTOCOL_STP: |
---|
1207 | 1167 | case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: |
---|
1208 | 1168 | { |
---|
1209 | | - dev_err(dev, "slot err: SATA/STP not supported"); |
---|
| 1169 | + dev_err(dev, "slot err: SATA/STP not supported\n"); |
---|
1210 | 1170 | } |
---|
1211 | 1171 | break; |
---|
1212 | 1172 | default: |
---|
.. | .. |
---|
1215 | 1175 | |
---|
1216 | 1176 | } |
---|
1217 | 1177 | |
---|
1218 | | -static int slot_complete_v1_hw(struct hisi_hba *hisi_hba, |
---|
1219 | | - struct hisi_sas_slot *slot) |
---|
| 1178 | +static void slot_complete_v1_hw(struct hisi_hba *hisi_hba, |
---|
| 1179 | + struct hisi_sas_slot *slot) |
---|
1220 | 1180 | { |
---|
1221 | 1181 | struct sas_task *task = slot->task; |
---|
1222 | 1182 | struct hisi_sas_device *sas_dev; |
---|
1223 | 1183 | struct device *dev = hisi_hba->dev; |
---|
1224 | 1184 | struct task_status_struct *ts; |
---|
1225 | 1185 | struct domain_device *device; |
---|
1226 | | - enum exec_status sts; |
---|
1227 | 1186 | struct hisi_sas_complete_v1_hdr *complete_queue = |
---|
1228 | 1187 | hisi_hba->complete_hdr[slot->cmplt_queue]; |
---|
1229 | 1188 | struct hisi_sas_complete_v1_hdr *complete_hdr; |
---|
.. | .. |
---|
1234 | 1193 | cmplt_hdr_data = le32_to_cpu(complete_hdr->data); |
---|
1235 | 1194 | |
---|
1236 | 1195 | if (unlikely(!task || !task->lldd_task || !task->dev)) |
---|
1237 | | - return -EINVAL; |
---|
| 1196 | + return; |
---|
1238 | 1197 | |
---|
1239 | 1198 | ts = &task->task_status; |
---|
1240 | 1199 | device = task->dev; |
---|
.. | .. |
---|
1259 | 1218 | u32 info_reg = hisi_sas_read32(hisi_hba, HGC_INVLD_DQE_INFO); |
---|
1260 | 1219 | |
---|
1261 | 1220 | if (info_reg & HGC_INVLD_DQE_INFO_DQ_MSK) |
---|
1262 | | - dev_err(dev, "slot complete: [%d:%d] has dq IPTT err", |
---|
| 1221 | + dev_err(dev, "slot complete: [%d:%d] has dq IPTT err\n", |
---|
1263 | 1222 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1264 | 1223 | |
---|
1265 | 1224 | if (info_reg & HGC_INVLD_DQE_INFO_TYPE_MSK) |
---|
1266 | | - dev_err(dev, "slot complete: [%d:%d] has dq type err", |
---|
| 1225 | + dev_err(dev, "slot complete: [%d:%d] has dq type err\n", |
---|
1267 | 1226 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1268 | 1227 | |
---|
1269 | 1228 | if (info_reg & HGC_INVLD_DQE_INFO_FORCE_MSK) |
---|
1270 | | - dev_err(dev, "slot complete: [%d:%d] has dq force phy err", |
---|
| 1229 | + dev_err(dev, "slot complete: [%d:%d] has dq force phy err\n", |
---|
1271 | 1230 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1272 | 1231 | |
---|
1273 | 1232 | if (info_reg & HGC_INVLD_DQE_INFO_PHY_MSK) |
---|
1274 | | - dev_err(dev, "slot complete: [%d:%d] has dq phy id err", |
---|
| 1233 | + dev_err(dev, "slot complete: [%d:%d] has dq phy id err\n", |
---|
1275 | 1234 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1276 | 1235 | |
---|
1277 | 1236 | if (info_reg & HGC_INVLD_DQE_INFO_ABORT_MSK) |
---|
1278 | | - dev_err(dev, "slot complete: [%d:%d] has dq abort flag err", |
---|
| 1237 | + dev_err(dev, "slot complete: [%d:%d] has dq abort flag err\n", |
---|
1279 | 1238 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1280 | 1239 | |
---|
1281 | 1240 | if (info_reg & HGC_INVLD_DQE_INFO_IPTT_OF_MSK) |
---|
1282 | | - dev_err(dev, "slot complete: [%d:%d] has dq IPTT or ICT err", |
---|
| 1241 | + dev_err(dev, "slot complete: [%d:%d] has dq IPTT or ICT err\n", |
---|
1283 | 1242 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1284 | 1243 | |
---|
1285 | 1244 | if (info_reg & HGC_INVLD_DQE_INFO_SSP_ERR_MSK) |
---|
1286 | | - dev_err(dev, "slot complete: [%d:%d] has dq SSP frame type err", |
---|
| 1245 | + dev_err(dev, "slot complete: [%d:%d] has dq SSP frame type err\n", |
---|
1287 | 1246 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1288 | 1247 | |
---|
1289 | 1248 | if (info_reg & HGC_INVLD_DQE_INFO_OFL_MSK) |
---|
1290 | | - dev_err(dev, "slot complete: [%d:%d] has dq order frame len err", |
---|
| 1249 | + dev_err(dev, "slot complete: [%d:%d] has dq order frame len err\n", |
---|
1291 | 1250 | slot->cmplt_queue, slot->cmplt_queue_slot); |
---|
1292 | 1251 | |
---|
1293 | 1252 | ts->stat = SAS_OPEN_REJECT; |
---|
.. | .. |
---|
1299 | 1258 | !(cmplt_hdr_data & CMPLT_HDR_RSPNS_XFRD_MSK)) { |
---|
1300 | 1259 | |
---|
1301 | 1260 | slot_err_v1_hw(hisi_hba, task, slot); |
---|
1302 | | - if (unlikely(slot->abort)) |
---|
1303 | | - return ts->stat; |
---|
| 1261 | + if (unlikely(slot->abort)) { |
---|
| 1262 | + sas_task_abort(task); |
---|
| 1263 | + return; |
---|
| 1264 | + } |
---|
1304 | 1265 | goto out; |
---|
1305 | 1266 | } |
---|
1306 | 1267 | |
---|
.. | .. |
---|
1317 | 1278 | } |
---|
1318 | 1279 | case SAS_PROTOCOL_SMP: |
---|
1319 | 1280 | { |
---|
1320 | | - void *to; |
---|
1321 | 1281 | struct scatterlist *sg_resp = &task->smp_task.smp_resp; |
---|
| 1282 | + void *to = page_address(sg_page(sg_resp)); |
---|
1322 | 1283 | |
---|
1323 | | - ts->stat = SAM_STAT_GOOD; |
---|
1324 | | - to = kmap_atomic(sg_page(sg_resp)); |
---|
| 1284 | + ts->stat = SAS_SAM_STAT_GOOD; |
---|
1325 | 1285 | |
---|
1326 | | - dma_unmap_sg(dev, &task->smp_task.smp_resp, 1, |
---|
1327 | | - DMA_FROM_DEVICE); |
---|
1328 | 1286 | dma_unmap_sg(dev, &task->smp_task.smp_req, 1, |
---|
1329 | 1287 | DMA_TO_DEVICE); |
---|
1330 | 1288 | memcpy(to + sg_resp->offset, |
---|
1331 | 1289 | hisi_sas_status_buf_addr_mem(slot) + |
---|
1332 | 1290 | sizeof(struct hisi_sas_err_record), |
---|
1333 | | - sg_dma_len(sg_resp)); |
---|
1334 | | - kunmap_atomic(to); |
---|
| 1291 | + sg_resp->length); |
---|
1335 | 1292 | break; |
---|
1336 | 1293 | } |
---|
1337 | 1294 | case SAS_PROTOCOL_SATA: |
---|
1338 | 1295 | case SAS_PROTOCOL_STP: |
---|
1339 | 1296 | case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: |
---|
1340 | | - dev_err(dev, "slot complete: SATA/STP not supported"); |
---|
| 1297 | + dev_err(dev, "slot complete: SATA/STP not supported\n"); |
---|
1341 | 1298 | break; |
---|
1342 | 1299 | |
---|
1343 | 1300 | default: |
---|
1344 | | - ts->stat = SAM_STAT_CHECK_CONDITION; |
---|
| 1301 | + ts->stat = SAS_SAM_STAT_CHECK_CONDITION; |
---|
1345 | 1302 | break; |
---|
1346 | 1303 | } |
---|
1347 | 1304 | |
---|
.. | .. |
---|
1353 | 1310 | |
---|
1354 | 1311 | out: |
---|
1355 | 1312 | hisi_sas_slot_task_free(hisi_hba, task, slot); |
---|
1356 | | - sts = ts->stat; |
---|
1357 | 1313 | |
---|
1358 | 1314 | if (task->task_done) |
---|
1359 | 1315 | task->task_done(task); |
---|
1360 | | - |
---|
1361 | | - return sts; |
---|
1362 | 1316 | } |
---|
1363 | 1317 | |
---|
1364 | 1318 | /* Interrupts */ |
---|
.. | .. |
---|
1454 | 1408 | struct hisi_sas_phy *phy = p; |
---|
1455 | 1409 | struct hisi_hba *hisi_hba = phy->hisi_hba; |
---|
1456 | 1410 | struct asd_sas_phy *sas_phy = &phy->sas_phy; |
---|
1457 | | - struct sas_ha_struct *sha = &hisi_hba->sha; |
---|
1458 | 1411 | struct device *dev = hisi_hba->dev; |
---|
1459 | 1412 | int phy_no = sas_phy->id; |
---|
1460 | 1413 | u32 irq_value; |
---|
.. | .. |
---|
1463 | 1416 | irq_value = hisi_sas_phy_read32(hisi_hba, phy_no, CHL_INT2); |
---|
1464 | 1417 | |
---|
1465 | 1418 | if (!(irq_value & CHL_INT2_SL_RX_BC_ACK_MSK)) { |
---|
1466 | | - dev_err(dev, "bcast: irq_value = %x not set enable bit", |
---|
| 1419 | + dev_err(dev, "bcast: irq_value = %x not set enable bit\n", |
---|
1467 | 1420 | irq_value); |
---|
1468 | 1421 | res = IRQ_NONE; |
---|
1469 | 1422 | goto end; |
---|
1470 | 1423 | } |
---|
1471 | 1424 | |
---|
1472 | 1425 | if (!test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) |
---|
1473 | | - sha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); |
---|
| 1426 | + sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); |
---|
1474 | 1427 | |
---|
1475 | 1428 | end: |
---|
1476 | 1429 | hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT2, |
---|
.. | .. |
---|
1543 | 1496 | struct hisi_sas_complete_v1_hdr *complete_queue = |
---|
1544 | 1497 | (struct hisi_sas_complete_v1_hdr *) |
---|
1545 | 1498 | hisi_hba->complete_hdr[queue]; |
---|
1546 | | - u32 irq_value, rd_point = cq->rd_point, wr_point; |
---|
| 1499 | + u32 rd_point = cq->rd_point, wr_point; |
---|
1547 | 1500 | |
---|
1548 | 1501 | spin_lock(&hisi_hba->lock); |
---|
1549 | | - irq_value = hisi_sas_read32(hisi_hba, OQ_INT_SRC); |
---|
1550 | | - |
---|
1551 | 1502 | hisi_sas_write32(hisi_hba, OQ_INT_SRC, 1 << queue); |
---|
1552 | 1503 | wr_point = hisi_sas_read32(hisi_hba, |
---|
1553 | 1504 | COMPL_Q_0_WR_PTR + (0x14 * queue)); |
---|
.. | .. |
---|
1558 | 1509 | u32 cmplt_hdr_data; |
---|
1559 | 1510 | |
---|
1560 | 1511 | complete_hdr = &complete_queue[rd_point]; |
---|
1561 | | - cmplt_hdr_data = cpu_to_le32(complete_hdr->data); |
---|
| 1512 | + cmplt_hdr_data = le32_to_cpu(complete_hdr->data); |
---|
1562 | 1513 | idx = (cmplt_hdr_data & CMPLT_HDR_IPTT_MSK) >> |
---|
1563 | 1514 | CMPLT_HDR_IPTT_OFF; |
---|
1564 | 1515 | slot = &hisi_hba->slot_info[idx]; |
---|
.. | .. |
---|
1693 | 1644 | idx = i * HISI_SAS_PHY_INT_NR; |
---|
1694 | 1645 | for (j = 0; j < HISI_SAS_PHY_INT_NR; j++, idx++) { |
---|
1695 | 1646 | irq = platform_get_irq(pdev, idx); |
---|
1696 | | - if (!irq) { |
---|
1697 | | - dev_err(dev, |
---|
1698 | | - "irq init: fail map phy interrupt %d\n", |
---|
| 1647 | + if (irq < 0) { |
---|
| 1648 | + dev_err(dev, "irq init: fail map phy interrupt %d\n", |
---|
1699 | 1649 | idx); |
---|
1700 | | - return -ENOENT; |
---|
| 1650 | + return irq; |
---|
1701 | 1651 | } |
---|
1702 | 1652 | |
---|
1703 | 1653 | rc = devm_request_irq(dev, irq, phy_interrupts[j], 0, |
---|
1704 | 1654 | DRV_NAME " phy", phy); |
---|
1705 | 1655 | if (rc) { |
---|
1706 | | - dev_err(dev, "irq init: could not request " |
---|
1707 | | - "phy interrupt %d, rc=%d\n", |
---|
| 1656 | + dev_err(dev, "irq init: could not request phy interrupt %d, rc=%d\n", |
---|
1708 | 1657 | irq, rc); |
---|
1709 | | - return -ENOENT; |
---|
| 1658 | + return rc; |
---|
1710 | 1659 | } |
---|
1711 | 1660 | } |
---|
1712 | 1661 | } |
---|
.. | .. |
---|
1714 | 1663 | idx = hisi_hba->n_phy * HISI_SAS_PHY_INT_NR; |
---|
1715 | 1664 | for (i = 0; i < hisi_hba->queue_count; i++, idx++) { |
---|
1716 | 1665 | irq = platform_get_irq(pdev, idx); |
---|
1717 | | - if (!irq) { |
---|
| 1666 | + if (irq < 0) { |
---|
1718 | 1667 | dev_err(dev, "irq init: could not map cq interrupt %d\n", |
---|
1719 | 1668 | idx); |
---|
1720 | | - return -ENOENT; |
---|
| 1669 | + return irq; |
---|
1721 | 1670 | } |
---|
1722 | 1671 | |
---|
1723 | 1672 | rc = devm_request_irq(dev, irq, cq_interrupt_v1_hw, 0, |
---|
.. | .. |
---|
1725 | 1674 | if (rc) { |
---|
1726 | 1675 | dev_err(dev, "irq init: could not request cq interrupt %d, rc=%d\n", |
---|
1727 | 1676 | irq, rc); |
---|
1728 | | - return -ENOENT; |
---|
| 1677 | + return rc; |
---|
1729 | 1678 | } |
---|
1730 | 1679 | } |
---|
1731 | 1680 | |
---|
1732 | 1681 | idx = (hisi_hba->n_phy * HISI_SAS_PHY_INT_NR) + hisi_hba->queue_count; |
---|
1733 | 1682 | for (i = 0; i < HISI_SAS_FATAL_INT_NR; i++, idx++) { |
---|
1734 | 1683 | irq = platform_get_irq(pdev, idx); |
---|
1735 | | - if (!irq) { |
---|
| 1684 | + if (irq < 0) { |
---|
1736 | 1685 | dev_err(dev, "irq init: could not map fatal interrupt %d\n", |
---|
1737 | 1686 | idx); |
---|
1738 | | - return -ENOENT; |
---|
| 1687 | + return irq; |
---|
1739 | 1688 | } |
---|
1740 | 1689 | |
---|
1741 | 1690 | rc = devm_request_irq(dev, irq, fatal_interrupts[i], 0, |
---|
1742 | 1691 | DRV_NAME " fatal", hisi_hba); |
---|
1743 | 1692 | if (rc) { |
---|
1744 | | - dev_err(dev, |
---|
1745 | | - "irq init: could not request fatal interrupt %d, rc=%d\n", |
---|
| 1693 | + dev_err(dev, "irq init: could not request fatal interrupt %d, rc=%d\n", |
---|
1746 | 1694 | irq, rc); |
---|
1747 | | - return -ENOENT; |
---|
| 1695 | + return rc; |
---|
1748 | 1696 | } |
---|
1749 | 1697 | } |
---|
| 1698 | + |
---|
| 1699 | + hisi_hba->cq_nvecs = hisi_hba->queue_count; |
---|
1750 | 1700 | |
---|
1751 | 1701 | return 0; |
---|
1752 | 1702 | } |
---|
.. | .. |
---|
1797 | 1747 | return 0; |
---|
1798 | 1748 | } |
---|
1799 | 1749 | |
---|
| 1750 | +static struct device_attribute *host_attrs_v1_hw[] = { |
---|
| 1751 | + &dev_attr_phy_event_threshold, |
---|
| 1752 | + NULL |
---|
| 1753 | +}; |
---|
| 1754 | + |
---|
1800 | 1755 | static struct scsi_host_template sht_v1_hw = { |
---|
1801 | 1756 | .name = DRV_NAME, |
---|
| 1757 | + .proc_name = DRV_NAME, |
---|
1802 | 1758 | .module = THIS_MODULE, |
---|
1803 | 1759 | .queuecommand = sas_queuecommand, |
---|
| 1760 | + .dma_need_drain = ata_scsi_dma_need_drain, |
---|
1804 | 1761 | .target_alloc = sas_target_alloc, |
---|
1805 | 1762 | .slave_configure = hisi_sas_slave_configure, |
---|
1806 | 1763 | .scan_finished = hisi_sas_scan_finished, |
---|
1807 | 1764 | .scan_start = hisi_sas_scan_start, |
---|
1808 | 1765 | .change_queue_depth = sas_change_queue_depth, |
---|
1809 | 1766 | .bios_param = sas_bios_param, |
---|
1810 | | - .can_queue = 1, |
---|
1811 | 1767 | .this_id = -1, |
---|
1812 | | - .sg_tablesize = SG_ALL, |
---|
| 1768 | + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, |
---|
1813 | 1769 | .max_sectors = SCSI_DEFAULT_MAX_SECTORS, |
---|
1814 | | - .use_clustering = ENABLE_CLUSTERING, |
---|
1815 | 1770 | .eh_device_reset_handler = sas_eh_device_reset_handler, |
---|
1816 | 1771 | .eh_target_reset_handler = sas_eh_target_reset_handler, |
---|
1817 | 1772 | .slave_alloc = sas_slave_alloc, |
---|
1818 | 1773 | .target_destroy = sas_target_destroy, |
---|
1819 | 1774 | .ioctl = sas_ioctl, |
---|
1820 | | - .shost_attrs = host_attrs, |
---|
| 1775 | +#ifdef CONFIG_COMPAT |
---|
| 1776 | + .compat_ioctl = sas_ioctl, |
---|
| 1777 | +#endif |
---|
| 1778 | + .shost_attrs = host_attrs_v1_hw, |
---|
| 1779 | + .host_reset = hisi_sas_host_reset, |
---|
1821 | 1780 | }; |
---|
1822 | 1781 | |
---|
1823 | 1782 | static const struct hisi_sas_hw hisi_sas_v1_hw = { |
---|
.. | .. |
---|
1827 | 1786 | .clear_itct = clear_itct_v1_hw, |
---|
1828 | 1787 | .prep_smp = prep_smp_v1_hw, |
---|
1829 | 1788 | .prep_ssp = prep_ssp_v1_hw, |
---|
1830 | | - .get_free_slot = get_free_slot_v1_hw, |
---|
1831 | 1789 | .start_delivery = start_delivery_v1_hw, |
---|
1832 | | - .slot_complete = slot_complete_v1_hw, |
---|
1833 | 1790 | .phys_init = phys_init_v1_hw, |
---|
1834 | 1791 | .phy_start = start_phy_v1_hw, |
---|
1835 | 1792 | .phy_disable = disable_phy_v1_hw, |
---|
.. | .. |
---|
1837 | 1794 | .phy_set_linkrate = phy_set_linkrate_v1_hw, |
---|
1838 | 1795 | .phy_get_max_linkrate = phy_get_max_linkrate_v1_hw, |
---|
1839 | 1796 | .get_wideport_bitmap = get_wideport_bitmap_v1_hw, |
---|
1840 | | - .max_command_entries = HISI_SAS_COMMAND_ENTRIES_V1_HW, |
---|
1841 | 1797 | .complete_hdr_size = sizeof(struct hisi_sas_complete_v1_hdr), |
---|
1842 | 1798 | .sht = &sht_v1_hw, |
---|
1843 | 1799 | }; |
---|