pm8001_hwi.c (80c1c54a2aa3c5177f73fc5d505668df56fb28b6) pm8001_hwi.c (d377f415dddc18b33c88dcd41cfe4fe6d9db82fb)
1/*
2 * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver
3 *
4 * Copyright (c) 2008-2009 USI Co., Ltd.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 1916 unchanged lines hidden (view full) ---

1925 status, tag, t);
1926
1927 switch (status) {
1928 case IO_SUCCESS:
1929 pm8001_dbg(pm8001_ha, IO, "IO_SUCCESS,param = %d\n",
1930 param);
1931 if (param == 0) {
1932 ts->resp = SAS_TASK_COMPLETE;
1/*
2 * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver
3 *
4 * Copyright (c) 2008-2009 USI Co., Ltd.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 1916 unchanged lines hidden (view full) ---

1925 status, tag, t);
1926
1927 switch (status) {
1928 case IO_SUCCESS:
1929 pm8001_dbg(pm8001_ha, IO, "IO_SUCCESS,param = %d\n",
1930 param);
1931 if (param == 0) {
1932 ts->resp = SAS_TASK_COMPLETE;
1933 ts->stat = SAM_STAT_GOOD;
1933 ts->stat = SAS_SAM_STAT_GOOD;
1934 } else {
1935 ts->resp = SAS_TASK_COMPLETE;
1936 ts->stat = SAS_PROTO_RESPONSE;
1937 ts->residual = param;
1938 iu = &psspPayload->ssp_resp_iu;
1939 sas_ssp_task_response(pm8001_ha->dev, t, iu);
1940 }
1941 if (pm8001_dev)

--- 443 unchanged lines hidden (view full) ---

2385 SAS_ADDR(t->dev->sas_addr));
2386 }
2387 }
2388 switch (status) {
2389 case IO_SUCCESS:
2390 pm8001_dbg(pm8001_ha, IO, "IO_SUCCESS\n");
2391 if (param == 0) {
2392 ts->resp = SAS_TASK_COMPLETE;
1934 } else {
1935 ts->resp = SAS_TASK_COMPLETE;
1936 ts->stat = SAS_PROTO_RESPONSE;
1937 ts->residual = param;
1938 iu = &psspPayload->ssp_resp_iu;
1939 sas_ssp_task_response(pm8001_ha->dev, t, iu);
1940 }
1941 if (pm8001_dev)

--- 443 unchanged lines hidden (view full) ---

2385 SAS_ADDR(t->dev->sas_addr));
2386 }
2387 }
2388 switch (status) {
2389 case IO_SUCCESS:
2390 pm8001_dbg(pm8001_ha, IO, "IO_SUCCESS\n");
2391 if (param == 0) {
2392 ts->resp = SAS_TASK_COMPLETE;
2393 ts->stat = SAM_STAT_GOOD;
2393 ts->stat = SAS_SAM_STAT_GOOD;
2394 /* check if response is for SEND READ LOG */
2395 if (pm8001_dev &&
2396 (pm8001_dev->id & NCQ_READ_LOG_FLAG)) {
2397 /* set new bit for abort_all */
2398 pm8001_dev->id |= NCQ_ABORT_ALL_FLAG;
2399 /* clear bit for read log */
2400 pm8001_dev->id = pm8001_dev->id & 0x7FFFFFFF;
2401 pm8001_send_abort_all(pm8001_ha, pm8001_dev);

--- 505 unchanged lines hidden (view full) ---

2907 }
2908 if (unlikely(!t || !t->lldd_task || !t->dev))
2909 return;
2910
2911 switch (status) {
2912 case IO_SUCCESS:
2913 pm8001_dbg(pm8001_ha, IO, "IO_SUCCESS\n");
2914 ts->resp = SAS_TASK_COMPLETE;
2394 /* check if response is for SEND READ LOG */
2395 if (pm8001_dev &&
2396 (pm8001_dev->id & NCQ_READ_LOG_FLAG)) {
2397 /* set new bit for abort_all */
2398 pm8001_dev->id |= NCQ_ABORT_ALL_FLAG;
2399 /* clear bit for read log */
2400 pm8001_dev->id = pm8001_dev->id & 0x7FFFFFFF;
2401 pm8001_send_abort_all(pm8001_ha, pm8001_dev);

--- 505 unchanged lines hidden (view full) ---

2907 }
2908 if (unlikely(!t || !t->lldd_task || !t->dev))
2909 return;
2910
2911 switch (status) {
2912 case IO_SUCCESS:
2913 pm8001_dbg(pm8001_ha, IO, "IO_SUCCESS\n");
2914 ts->resp = SAS_TASK_COMPLETE;
2915 ts->stat = SAM_STAT_GOOD;
2915 ts->stat = SAS_SAM_STAT_GOOD;
2916 if (pm8001_dev)
2917 atomic_dec(&pm8001_dev->running_req);
2918 break;
2919 case IO_ABORTED:
2920 pm8001_dbg(pm8001_ha, IO, "IO_ABORTED IOMB\n");
2921 ts->resp = SAS_TASK_COMPLETE;
2922 ts->stat = SAS_ABORTED_TASK;
2923 if (pm8001_dev)

--- 10 unchanged lines hidden (view full) ---

2934 case IO_NO_DEVICE:
2935 pm8001_dbg(pm8001_ha, IO, "IO_NO_DEVICE\n");
2936 ts->resp = SAS_TASK_COMPLETE;
2937 ts->stat = SAS_PHY_DOWN;
2938 break;
2939 case IO_ERROR_HW_TIMEOUT:
2940 pm8001_dbg(pm8001_ha, IO, "IO_ERROR_HW_TIMEOUT\n");
2941 ts->resp = SAS_TASK_COMPLETE;
2916 if (pm8001_dev)
2917 atomic_dec(&pm8001_dev->running_req);
2918 break;
2919 case IO_ABORTED:
2920 pm8001_dbg(pm8001_ha, IO, "IO_ABORTED IOMB\n");
2921 ts->resp = SAS_TASK_COMPLETE;
2922 ts->stat = SAS_ABORTED_TASK;
2923 if (pm8001_dev)

--- 10 unchanged lines hidden (view full) ---

2934 case IO_NO_DEVICE:
2935 pm8001_dbg(pm8001_ha, IO, "IO_NO_DEVICE\n");
2936 ts->resp = SAS_TASK_COMPLETE;
2937 ts->stat = SAS_PHY_DOWN;
2938 break;
2939 case IO_ERROR_HW_TIMEOUT:
2940 pm8001_dbg(pm8001_ha, IO, "IO_ERROR_HW_TIMEOUT\n");
2941 ts->resp = SAS_TASK_COMPLETE;
2942 ts->stat = SAM_STAT_BUSY;
2942 ts->stat = SAS_SAM_STAT_BUSY;
2943 break;
2944 case IO_XFER_ERROR_BREAK:
2945 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_BREAK\n");
2946 ts->resp = SAS_TASK_COMPLETE;
2943 break;
2944 case IO_XFER_ERROR_BREAK:
2945 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_BREAK\n");
2946 ts->resp = SAS_TASK_COMPLETE;
2947 ts->stat = SAM_STAT_BUSY;
2947 ts->stat = SAS_SAM_STAT_BUSY;
2948 break;
2949 case IO_XFER_ERROR_PHY_NOT_READY:
2950 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_PHY_NOT_READY\n");
2951 ts->resp = SAS_TASK_COMPLETE;
2948 break;
2949 case IO_XFER_ERROR_PHY_NOT_READY:
2950 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_PHY_NOT_READY\n");
2951 ts->resp = SAS_TASK_COMPLETE;
2952 ts->stat = SAM_STAT_BUSY;
2952 ts->stat = SAS_SAM_STAT_BUSY;
2953 break;
2954 case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED:
2955 pm8001_dbg(pm8001_ha, IO,
2956 "IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED\n");
2957 ts->resp = SAS_TASK_COMPLETE;
2958 ts->stat = SAS_OPEN_REJECT;
2959 ts->open_rej_reason = SAS_OREJ_UNKNOWN;
2960 break;

--- 744 unchanged lines hidden (view full) ---

3705 ts = &t->task_status;
3706 if (status != 0)
3707 pm8001_dbg(pm8001_ha, FAIL, "task abort failed status 0x%x ,tag = 0x%x, scp= 0x%x\n",
3708 status, tag, scp);
3709 switch (status) {
3710 case IO_SUCCESS:
3711 pm8001_dbg(pm8001_ha, EH, "IO_SUCCESS\n");
3712 ts->resp = SAS_TASK_COMPLETE;
2953 break;
2954 case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED:
2955 pm8001_dbg(pm8001_ha, IO,
2956 "IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED\n");
2957 ts->resp = SAS_TASK_COMPLETE;
2958 ts->stat = SAS_OPEN_REJECT;
2959 ts->open_rej_reason = SAS_OREJ_UNKNOWN;
2960 break;

--- 744 unchanged lines hidden (view full) ---

3705 ts = &t->task_status;
3706 if (status != 0)
3707 pm8001_dbg(pm8001_ha, FAIL, "task abort failed status 0x%x ,tag = 0x%x, scp= 0x%x\n",
3708 status, tag, scp);
3709 switch (status) {
3710 case IO_SUCCESS:
3711 pm8001_dbg(pm8001_ha, EH, "IO_SUCCESS\n");
3712 ts->resp = SAS_TASK_COMPLETE;
3713 ts->stat = SAM_STAT_GOOD;
3713 ts->stat = SAS_SAM_STAT_GOOD;
3714 break;
3715 case IO_NOT_VALID:
3716 pm8001_dbg(pm8001_ha, EH, "IO_NOT_VALID\n");
3717 ts->resp = TMF_RESP_FUNC_FAILED;
3718 break;
3719 }
3720 spin_lock_irqsave(&t->task_state_lock, flags);
3721 t->task_state_flags &= ~SAS_TASK_STATE_PENDING;

--- 38 unchanged lines hidden (view full) ---

3760 struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id];
3761 pm8001_dbg(pm8001_ha, DEVIO,
3762 "SPC HW event for portid:%d, phyid:%d, event:%x, status:%x\n",
3763 port_id, phy_id, eventType, status);
3764 switch (eventType) {
3765 case HW_EVENT_PHY_START_STATUS:
3766 pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_START_STATUS status = %x\n",
3767 status);
3714 break;
3715 case IO_NOT_VALID:
3716 pm8001_dbg(pm8001_ha, EH, "IO_NOT_VALID\n");
3717 ts->resp = TMF_RESP_FUNC_FAILED;
3718 break;
3719 }
3720 spin_lock_irqsave(&t->task_state_lock, flags);
3721 t->task_state_flags &= ~SAS_TASK_STATE_PENDING;

--- 38 unchanged lines hidden (view full) ---

3760 struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id];
3761 pm8001_dbg(pm8001_ha, DEVIO,
3762 "SPC HW event for portid:%d, phyid:%d, event:%x, status:%x\n",
3763 port_id, phy_id, eventType, status);
3764 switch (eventType) {
3765 case HW_EVENT_PHY_START_STATUS:
3766 pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_START_STATUS status = %x\n",
3767 status);
3768 if (status == 0)
3768 if (status == 0) {
3769 phy->phy_state = 1;
3769 phy->phy_state = 1;
3770
3771 if (pm8001_ha->flags == PM8001F_RUN_TIME &&
3772 phy->enable_completion != NULL) {
3773 complete(phy->enable_completion);
3774 phy->enable_completion = NULL;
3770 if (pm8001_ha->flags == PM8001F_RUN_TIME &&
3771 phy->enable_completion != NULL)
3772 complete(phy->enable_completion);
3775 }
3776 break;
3777 case HW_EVENT_SAS_PHY_UP:
3778 pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_START_STATUS\n");
3779 hw_event_sas_phy_up(pm8001_ha, piomb);
3780 break;
3781 case HW_EVENT_SATA_PHY_UP:
3782 pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_PHY_UP\n");

--- 569 unchanged lines hidden (view full) ---

4352 (pm8001_ha_dev->id & NCQ_2ND_RLE_FLAG))) {
4353 struct task_status_struct *ts;
4354
4355 pm8001_ha_dev->id &= 0xDFFFFFFF;
4356 ts = &task->task_status;
4357
4358 spin_lock_irqsave(&task->task_state_lock, flags);
4359 ts->resp = SAS_TASK_COMPLETE;
3773 }
3774 break;
3775 case HW_EVENT_SAS_PHY_UP:
3776 pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_START_STATUS\n");
3777 hw_event_sas_phy_up(pm8001_ha, piomb);
3778 break;
3779 case HW_EVENT_SATA_PHY_UP:
3780 pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_PHY_UP\n");

--- 569 unchanged lines hidden (view full) ---

4350 (pm8001_ha_dev->id & NCQ_2ND_RLE_FLAG))) {
4351 struct task_status_struct *ts;
4352
4353 pm8001_ha_dev->id &= 0xDFFFFFFF;
4354 ts = &task->task_status;
4355
4356 spin_lock_irqsave(&task->task_state_lock, flags);
4357 ts->resp = SAS_TASK_COMPLETE;
4360 ts->stat = SAM_STAT_GOOD;
4358 ts->stat = SAS_SAM_STAT_GOOD;
4361 task->task_state_flags &= ~SAS_TASK_STATE_PENDING;
4362 task->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
4363 task->task_state_flags |= SAS_TASK_STATE_DONE;
4364 if (unlikely((task->task_state_flags &
4365 SAS_TASK_STATE_ABORTED))) {
4366 spin_unlock_irqrestore(&task->task_state_lock,
4367 flags);
4368 pm8001_dbg(pm8001_ha, FAIL,

--- 710 unchanged lines hidden ---
4359 task->task_state_flags &= ~SAS_TASK_STATE_PENDING;
4360 task->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
4361 task->task_state_flags |= SAS_TASK_STATE_DONE;
4362 if (unlikely((task->task_state_flags &
4363 SAS_TASK_STATE_ABORTED))) {
4364 spin_unlock_irqrestore(&task->task_state_lock,
4365 flags);
4366 pm8001_dbg(pm8001_ha, FAIL,

--- 710 unchanged lines hidden ---