aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pm8001
diff options
context:
space:
mode:
authorSakthivel K <Sakthivel.SaravananKamalRaju@pmcs.com>2013-02-27 09:57:43 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-05-10 10:47:46 -0400
commitf74cf271e692848833b3845b4036a87e5b683fa8 (patch)
tree8dd2b125d56a5d0e3d188ddea4fe1276cad6fb38 /drivers/scsi/pm8001
parente590adfd2b35aecb3ea5e7cf3fe4e322b75f348d (diff)
[SCSI] pm80xx: Updated common functions common for SPC and SPCv/ve
Update of function prototype for common function to SPC and SPCv/ve. Multiple queues implementation for IO. Signed-off-by: Sakthivel K <Sakthivel.SaravananKamalRaju@pmcs.com> Signed-off-by: Anand Kumar S <AnandKumar.Santhanam@pmcs.com> Acked-by: Jack Wang <jack_wang@usish.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/pm8001')
-rw-r--r--drivers/scsi/pm8001/pm8001_hwi.c193
-rw-r--r--drivers/scsi/pm8001/pm8001_init.c20
-rw-r--r--drivers/scsi/pm8001/pm8001_sas.h60
3 files changed, 168 insertions, 105 deletions
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 83f9ff46c123..3cdd03ae9430 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1158,7 +1158,7 @@ static void pm8001_hw_chip_rst(struct pm8001_hba_info *pm8001_ha)
1158 * pm8001_chip_iounmap - which maped when initialized. 1158 * pm8001_chip_iounmap - which maped when initialized.
1159 * @pm8001_ha: our hba card information 1159 * @pm8001_ha: our hba card information
1160 */ 1160 */
1161static void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha) 1161void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
1162{ 1162{
1163 s8 bar, logical = 0; 1163 s8 bar, logical = 0;
1164 for (bar = 0; bar < 6; bar++) { 1164 for (bar = 0; bar < 6; bar++) {
@@ -1237,7 +1237,7 @@ pm8001_chip_msix_interrupt_disable(struct pm8001_hba_info *pm8001_ha,
1237 * @pm8001_ha: our hba card information 1237 * @pm8001_ha: our hba card information
1238 */ 1238 */
1239static void 1239static void
1240pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha) 1240pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec)
1241{ 1241{
1242#ifdef PM8001_USE_MSIX 1242#ifdef PM8001_USE_MSIX
1243 pm8001_chip_msix_interrupt_enable(pm8001_ha, 0); 1243 pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
@@ -1252,7 +1252,7 @@ pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha)
1252 * @pm8001_ha: our hba card information 1252 * @pm8001_ha: our hba card information
1253 */ 1253 */
1254static void 1254static void
1255pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha) 1255pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec)
1256{ 1256{
1257#ifdef PM8001_USE_MSIX 1257#ifdef PM8001_USE_MSIX
1258 pm8001_chip_msix_interrupt_disable(pm8001_ha, 0); 1258 pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
@@ -1263,12 +1263,13 @@ pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
1263} 1263}
1264 1264
1265/** 1265/**
1266 * mpi_msg_free_get- get the free message buffer for transfer inbound queue. 1266 * pm8001_mpi_msg_free_get - get the free message buffer for transfer
1267 * inbound queue.
1267 * @circularQ: the inbound queue we want to transfer to HBA. 1268 * @circularQ: the inbound queue we want to transfer to HBA.
1268 * @messageSize: the message size of this transfer, normally it is 64 bytes 1269 * @messageSize: the message size of this transfer, normally it is 64 bytes
1269 * @messagePtr: the pointer to message. 1270 * @messagePtr: the pointer to message.
1270 */ 1271 */
1271static int mpi_msg_free_get(struct inbound_queue_table *circularQ, 1272int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ,
1272 u16 messageSize, void **messagePtr) 1273 u16 messageSize, void **messagePtr)
1273{ 1274{
1274 u32 offset, consumer_index; 1275 u32 offset, consumer_index;
@@ -1276,7 +1277,7 @@ static int mpi_msg_free_get(struct inbound_queue_table *circularQ,
1276 u8 bcCount = 1; /* only support single buffer */ 1277 u8 bcCount = 1; /* only support single buffer */
1277 1278
1278 /* Checks is the requested message size can be allocated in this queue*/ 1279 /* Checks is the requested message size can be allocated in this queue*/
1279 if (messageSize > 64) { 1280 if (messageSize > IOMB_SIZE_SPCV) {
1280 *messagePtr = NULL; 1281 *messagePtr = NULL;
1281 return -1; 1282 return -1;
1282 } 1283 }
@@ -1290,7 +1291,7 @@ static int mpi_msg_free_get(struct inbound_queue_table *circularQ,
1290 return -1; 1291 return -1;
1291 } 1292 }
1292 /* get memory IOMB buffer address */ 1293 /* get memory IOMB buffer address */
1293 offset = circularQ->producer_idx * 64; 1294 offset = circularQ->producer_idx * messageSize;
1294 /* increment to next bcCount element */ 1295 /* increment to next bcCount element */
1295 circularQ->producer_idx = (circularQ->producer_idx + bcCount) 1296 circularQ->producer_idx = (circularQ->producer_idx + bcCount)
1296 % PM8001_MPI_QUEUE; 1297 % PM8001_MPI_QUEUE;
@@ -1302,29 +1303,30 @@ static int mpi_msg_free_get(struct inbound_queue_table *circularQ,
1302} 1303}
1303 1304
1304/** 1305/**
1305 * mpi_build_cmd- build the message queue for transfer, update the PI to FW 1306 * pm8001_mpi_build_cmd- build the message queue for transfer, update the PI to
1306 * to tell the fw to get this message from IOMB. 1307 * FW to tell the fw to get this message from IOMB.
1307 * @pm8001_ha: our hba card information 1308 * @pm8001_ha: our hba card information
1308 * @circularQ: the inbound queue we want to transfer to HBA. 1309 * @circularQ: the inbound queue we want to transfer to HBA.
1309 * @opCode: the operation code represents commands which LLDD and fw recognized. 1310 * @opCode: the operation code represents commands which LLDD and fw recognized.
1310 * @payload: the command payload of each operation command. 1311 * @payload: the command payload of each operation command.
1311 */ 1312 */
1312static int mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, 1313int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
1313 struct inbound_queue_table *circularQ, 1314 struct inbound_queue_table *circularQ,
1314 u32 opCode, void *payload) 1315 u32 opCode, void *payload, u32 responseQueue)
1315{ 1316{
1316 u32 Header = 0, hpriority = 0, bc = 1, category = 0x02; 1317 u32 Header = 0, hpriority = 0, bc = 1, category = 0x02;
1317 u32 responseQueue = 0;
1318 void *pMessage; 1318 void *pMessage;
1319 1319
1320 if (mpi_msg_free_get(circularQ, 64, &pMessage) < 0) { 1320 if (pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size,
1321 &pMessage) < 0) {
1321 PM8001_IO_DBG(pm8001_ha, 1322 PM8001_IO_DBG(pm8001_ha,
1322 pm8001_printk("No free mpi buffer\n")); 1323 pm8001_printk("No free mpi buffer\n"));
1323 return -1; 1324 return -1;
1324 } 1325 }
1325 BUG_ON(!payload); 1326 BUG_ON(!payload);
1326 /*Copy to the payload*/ 1327 /*Copy to the payload*/
1327 memcpy(pMessage, payload, (64 - sizeof(struct mpi_msg_hdr))); 1328 memcpy(pMessage, payload, (pm8001_ha->iomb_size -
1329 sizeof(struct mpi_msg_hdr)));
1328 1330
1329 /*Build the header*/ 1331 /*Build the header*/
1330 Header = ((1 << 31) | (hpriority << 30) | ((bc & 0x1f) << 24) 1332 Header = ((1 << 31) | (hpriority << 30) | ((bc & 0x1f) << 24)
@@ -1336,12 +1338,13 @@ static int mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
1336 pm8001_cw32(pm8001_ha, circularQ->pi_pci_bar, 1338 pm8001_cw32(pm8001_ha, circularQ->pi_pci_bar,
1337 circularQ->pi_offset, circularQ->producer_idx); 1339 circularQ->pi_offset, circularQ->producer_idx);
1338 PM8001_IO_DBG(pm8001_ha, 1340 PM8001_IO_DBG(pm8001_ha,
1339 pm8001_printk("after PI= %d CI= %d\n", circularQ->producer_idx, 1341 pm8001_printk("INB Q %x OPCODE:%x , UPDATED PI=%d CI=%d\n",
1340 circularQ->consumer_index)); 1342 responseQueue, opCode, circularQ->producer_idx,
1343 circularQ->consumer_index));
1341 return 0; 1344 return 0;
1342} 1345}
1343 1346
1344static u32 mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg, 1347u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,
1345 struct outbound_queue_table *circularQ, u8 bc) 1348 struct outbound_queue_table *circularQ, u8 bc)
1346{ 1349{
1347 u32 producer_index; 1350 u32 producer_index;
@@ -1350,7 +1353,7 @@ static u32 mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,
1350 1353
1351 msgHeader = (struct mpi_msg_hdr *)(pMsg - sizeof(struct mpi_msg_hdr)); 1354 msgHeader = (struct mpi_msg_hdr *)(pMsg - sizeof(struct mpi_msg_hdr));
1352 pOutBoundMsgHeader = (struct mpi_msg_hdr *)(circularQ->base_virt + 1355 pOutBoundMsgHeader = (struct mpi_msg_hdr *)(circularQ->base_virt +
1353 circularQ->consumer_idx * 64); 1356 circularQ->consumer_idx * pm8001_ha->iomb_size);
1354 if (pOutBoundMsgHeader != msgHeader) { 1357 if (pOutBoundMsgHeader != msgHeader) {
1355 PM8001_FAIL_DBG(pm8001_ha, 1358 PM8001_FAIL_DBG(pm8001_ha,
1356 pm8001_printk("consumer_idx = %d msgHeader = %p\n", 1359 pm8001_printk("consumer_idx = %d msgHeader = %p\n",
@@ -1381,13 +1384,14 @@ static u32 mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,
1381} 1384}
1382 1385
1383/** 1386/**
1384 * mpi_msg_consume- get the MPI message from outbound queue message table. 1387 * pm8001_mpi_msg_consume- get the MPI message from outbound queue
1388 * message table.
1385 * @pm8001_ha: our hba card information 1389 * @pm8001_ha: our hba card information
1386 * @circularQ: the outbound queue table. 1390 * @circularQ: the outbound queue table.
1387 * @messagePtr1: the message contents of this outbound message. 1391 * @messagePtr1: the message contents of this outbound message.
1388 * @pBC: the message size. 1392 * @pBC: the message size.
1389 */ 1393 */
1390static u32 mpi_msg_consume(struct pm8001_hba_info *pm8001_ha, 1394u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha,
1391 struct outbound_queue_table *circularQ, 1395 struct outbound_queue_table *circularQ,
1392 void **messagePtr1, u8 *pBC) 1396 void **messagePtr1, u8 *pBC)
1393{ 1397{
@@ -1401,7 +1405,7 @@ static u32 mpi_msg_consume(struct pm8001_hba_info *pm8001_ha,
1401 /*Get the pointer to the circular queue buffer element*/ 1405 /*Get the pointer to the circular queue buffer element*/
1402 msgHeader = (struct mpi_msg_hdr *) 1406 msgHeader = (struct mpi_msg_hdr *)
1403 (circularQ->base_virt + 1407 (circularQ->base_virt +
1404 circularQ->consumer_idx * 64); 1408 circularQ->consumer_idx * pm8001_ha->iomb_size);
1405 /* read header */ 1409 /* read header */
1406 header_tmp = pm8001_read_32(msgHeader); 1410 header_tmp = pm8001_read_32(msgHeader);
1407 msgHeader_tmp = cpu_to_le32(header_tmp); 1411 msgHeader_tmp = cpu_to_le32(header_tmp);
@@ -1461,7 +1465,7 @@ static u32 mpi_msg_consume(struct pm8001_hba_info *pm8001_ha,
1461 return MPI_IO_STATUS_BUSY; 1465 return MPI_IO_STATUS_BUSY;
1462} 1466}
1463 1467
1464static void pm8001_work_fn(struct work_struct *work) 1468void pm8001_work_fn(struct work_struct *work)
1465{ 1469{
1466 struct pm8001_work *pw = container_of(work, struct pm8001_work, work); 1470 struct pm8001_work *pw = container_of(work, struct pm8001_work, work);
1467 struct pm8001_device *pm8001_dev; 1471 struct pm8001_device *pm8001_dev;
@@ -1659,7 +1663,7 @@ static void pm8001_work_fn(struct work_struct *work)
1659 kfree(pw); 1663 kfree(pw);
1660} 1664}
1661 1665
1662static int pm8001_handle_event(struct pm8001_hba_info *pm8001_ha, void *data, 1666int pm8001_handle_event(struct pm8001_hba_info *pm8001_ha, void *data,
1663 int handler) 1667 int handler)
1664{ 1668{
1665 struct pm8001_work *pw; 1669 struct pm8001_work *pw;
@@ -2867,8 +2871,8 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2867 } 2871 }
2868} 2872}
2869 2873
2870static void 2874void pm8001_mpi_set_dev_state_resp(struct pm8001_hba_info *pm8001_ha,
2871mpi_set_dev_state_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) 2875 void *piomb)
2872{ 2876{
2873 struct set_dev_state_resp *pPayload = 2877 struct set_dev_state_resp *pPayload =
2874 (struct set_dev_state_resp *)(piomb + 4); 2878 (struct set_dev_state_resp *)(piomb + 4);
@@ -2888,8 +2892,7 @@ mpi_set_dev_state_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
2888 pm8001_ccb_free(pm8001_ha, tag); 2892 pm8001_ccb_free(pm8001_ha, tag);
2889} 2893}
2890 2894
2891static void 2895void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
2892mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
2893{ 2896{
2894 struct get_nvm_data_resp *pPayload = 2897 struct get_nvm_data_resp *pPayload =
2895 (struct get_nvm_data_resp *)(piomb + 4); 2898 (struct get_nvm_data_resp *)(piomb + 4);
@@ -2908,8 +2911,8 @@ mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
2908 pm8001_ccb_free(pm8001_ha, tag); 2911 pm8001_ccb_free(pm8001_ha, tag);
2909} 2912}
2910 2913
2911static void 2914void
2912mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) 2915pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
2913{ 2916{
2914 struct fw_control_ex *fw_control_context; 2917 struct fw_control_ex *fw_control_context;
2915 struct get_nvm_data_resp *pPayload = 2918 struct get_nvm_data_resp *pPayload =
@@ -2970,7 +2973,7 @@ mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
2970 pm8001_ccb_free(pm8001_ha, tag); 2973 pm8001_ccb_free(pm8001_ha, tag);
2971} 2974}
2972 2975
2973static int mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha, void *piomb) 2976int pm8001_mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha, void *piomb)
2974{ 2977{
2975 struct local_phy_ctl_resp *pPayload = 2978 struct local_phy_ctl_resp *pPayload =
2976 (struct local_phy_ctl_resp *)(piomb + 4); 2979 (struct local_phy_ctl_resp *)(piomb + 4);
@@ -2999,7 +3002,7 @@ static int mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha, void *piomb)
2999 * while receive a broadcast(change) primitive just tell the sas 3002 * while receive a broadcast(change) primitive just tell the sas
3000 * layer to discover the changed domain rather than the whole domain. 3003 * layer to discover the changed domain rather than the whole domain.
3001 */ 3004 */
3002static void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i) 3005void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i)
3003{ 3006{
3004 struct pm8001_phy *phy = &pm8001_ha->phy[i]; 3007 struct pm8001_phy *phy = &pm8001_ha->phy[i];
3005 struct asd_sas_phy *sas_phy = &phy->sas_phy; 3008 struct asd_sas_phy *sas_phy = &phy->sas_phy;
@@ -3033,7 +3036,7 @@ static void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i)
3033} 3036}
3034 3037
3035/* Get the link rate speed */ 3038/* Get the link rate speed */
3036static void get_lrate_mode(struct pm8001_phy *phy, u8 link_rate) 3039void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate)
3037{ 3040{
3038 struct sas_phy *sas_phy = phy->sas_phy.phy; 3041 struct sas_phy *sas_phy = phy->sas_phy.phy;
3039 3042
@@ -3070,7 +3073,7 @@ static void get_lrate_mode(struct pm8001_phy *phy, u8 link_rate)
3070 * LOCKING: the frame_rcvd_lock needs to be held since this parses the frame 3073 * LOCKING: the frame_rcvd_lock needs to be held since this parses the frame
3071 * buffer. 3074 * buffer.
3072 */ 3075 */
3073static void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, 3076void pm8001_get_attached_sas_addr(struct pm8001_phy *phy,
3074 u8 *sas_addr) 3077 u8 *sas_addr)
3075{ 3078{
3076 if (phy->sas_phy.frame_rcvd[0] == 0x34 3079 if (phy->sas_phy.frame_rcvd[0] == 0x34
@@ -3112,7 +3115,7 @@ static void pm8001_hw_event_ack_req(struct pm8001_hba_info *pm8001_ha,
3112 ((phyId & 0x0F) << 4) | (port_id & 0x0F)); 3115 ((phyId & 0x0F) << 4) | (port_id & 0x0F));
3113 payload.param0 = cpu_to_le32(param0); 3116 payload.param0 = cpu_to_le32(param0);
3114 payload.param1 = cpu_to_le32(param1); 3117 payload.param1 = cpu_to_le32(param1);
3115 mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 3118 pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
3116} 3119}
3117 3120
3118static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha, 3121static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
@@ -3157,19 +3160,19 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
3157 pm8001_chip_phy_ctl_req(pm8001_ha, phy_id, 3160 pm8001_chip_phy_ctl_req(pm8001_ha, phy_id,
3158 PHY_NOTIFY_ENABLE_SPINUP); 3161 PHY_NOTIFY_ENABLE_SPINUP);
3159 port->port_attached = 1; 3162 port->port_attached = 1;
3160 get_lrate_mode(phy, link_rate); 3163 pm8001_get_lrate_mode(phy, link_rate);
3161 break; 3164 break;
3162 case SAS_EDGE_EXPANDER_DEVICE: 3165 case SAS_EDGE_EXPANDER_DEVICE:
3163 PM8001_MSG_DBG(pm8001_ha, 3166 PM8001_MSG_DBG(pm8001_ha,
3164 pm8001_printk("expander device.\n")); 3167 pm8001_printk("expander device.\n"));
3165 port->port_attached = 1; 3168 port->port_attached = 1;
3166 get_lrate_mode(phy, link_rate); 3169 pm8001_get_lrate_mode(phy, link_rate);
3167 break; 3170 break;
3168 case SAS_FANOUT_EXPANDER_DEVICE: 3171 case SAS_FANOUT_EXPANDER_DEVICE:
3169 PM8001_MSG_DBG(pm8001_ha, 3172 PM8001_MSG_DBG(pm8001_ha,
3170 pm8001_printk("fanout expander device.\n")); 3173 pm8001_printk("fanout expander device.\n"));
3171 port->port_attached = 1; 3174 port->port_attached = 1;
3172 get_lrate_mode(phy, link_rate); 3175 pm8001_get_lrate_mode(phy, link_rate);
3173 break; 3176 break;
3174 default: 3177 default:
3175 PM8001_MSG_DBG(pm8001_ha, 3178 PM8001_MSG_DBG(pm8001_ha,
@@ -3224,7 +3227,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
3224 " phy id = %d\n", port_id, phy_id)); 3227 " phy id = %d\n", port_id, phy_id));
3225 port->port_state = portstate; 3228 port->port_state = portstate;
3226 port->port_attached = 1; 3229 port->port_attached = 1;
3227 get_lrate_mode(phy, link_rate); 3230 pm8001_get_lrate_mode(phy, link_rate);
3228 phy->phy_type |= PORT_TYPE_SATA; 3231 phy->phy_type |= PORT_TYPE_SATA;
3229 phy->phy_attached = 1; 3232 phy->phy_attached = 1;
3230 phy->sas_phy.oob_mode = SATA_OOB_MODE; 3233 phy->sas_phy.oob_mode = SATA_OOB_MODE;
@@ -3305,7 +3308,7 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
3305} 3308}
3306 3309
3307/** 3310/**
3308 * mpi_reg_resp -process register device ID response. 3311 * pm8001_mpi_reg_resp -process register device ID response.
3309 * @pm8001_ha: our hba card information 3312 * @pm8001_ha: our hba card information
3310 * @piomb: IO message buffer 3313 * @piomb: IO message buffer
3311 * 3314 *
@@ -3314,7 +3317,7 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
3314 * has assigned, from now,inter-communication with FW is no longer using the 3317 * has assigned, from now,inter-communication with FW is no longer using the
3315 * SAS address, use device ID which FW assigned. 3318 * SAS address, use device ID which FW assigned.
3316 */ 3319 */
3317static int mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) 3320int pm8001_mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3318{ 3321{
3319 u32 status; 3322 u32 status;
3320 u32 device_id; 3323 u32 device_id;
@@ -3376,7 +3379,7 @@ static int mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3376 return 0; 3379 return 0;
3377} 3380}
3378 3381
3379static int mpi_dereg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) 3382int pm8001_mpi_dereg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3380{ 3383{
3381 u32 status; 3384 u32 status;
3382 u32 device_id; 3385 u32 device_id;
@@ -3392,8 +3395,13 @@ static int mpi_dereg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3392 return 0; 3395 return 0;
3393} 3396}
3394 3397
3395static int 3398/**
3396mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) 3399 * fw_flash_update_resp - Response from FW for flash update command.
3400 * @pm8001_ha: our hba card information
3401 * @piomb: IO message buffer
3402 */
3403int pm8001_mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha,
3404 void *piomb)
3397{ 3405{
3398 u32 status; 3406 u32 status;
3399 struct fw_control_ex fw_control_context; 3407 struct fw_control_ex fw_control_context;
@@ -3459,8 +3467,7 @@ mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3459 return 0; 3467 return 0;
3460} 3468}
3461 3469
3462static int 3470int pm8001_mpi_general_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
3463mpi_general_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
3464{ 3471{
3465 u32 status; 3472 u32 status;
3466 int i; 3473 int i;
@@ -3476,8 +3483,7 @@ mpi_general_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
3476 return 0; 3483 return 0;
3477} 3484}
3478 3485
3479static int 3486int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3480mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3481{ 3487{
3482 struct sas_task *t; 3488 struct sas_task *t;
3483 struct pm8001_ccb_info *ccb; 3489 struct pm8001_ccb_info *ccb;
@@ -3772,17 +3778,17 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
3772 case OPC_OUB_LOCAL_PHY_CNTRL: 3778 case OPC_OUB_LOCAL_PHY_CNTRL:
3773 PM8001_MSG_DBG(pm8001_ha, 3779 PM8001_MSG_DBG(pm8001_ha,
3774 pm8001_printk("OPC_OUB_LOCAL_PHY_CNTRL\n")); 3780 pm8001_printk("OPC_OUB_LOCAL_PHY_CNTRL\n"));
3775 mpi_local_phy_ctl(pm8001_ha, piomb); 3781 pm8001_mpi_local_phy_ctl(pm8001_ha, piomb);
3776 break; 3782 break;
3777 case OPC_OUB_DEV_REGIST: 3783 case OPC_OUB_DEV_REGIST:
3778 PM8001_MSG_DBG(pm8001_ha, 3784 PM8001_MSG_DBG(pm8001_ha,
3779 pm8001_printk("OPC_OUB_DEV_REGIST\n")); 3785 pm8001_printk("OPC_OUB_DEV_REGIST\n"));
3780 mpi_reg_resp(pm8001_ha, piomb); 3786 pm8001_mpi_reg_resp(pm8001_ha, piomb);
3781 break; 3787 break;
3782 case OPC_OUB_DEREG_DEV: 3788 case OPC_OUB_DEREG_DEV:
3783 PM8001_MSG_DBG(pm8001_ha, 3789 PM8001_MSG_DBG(pm8001_ha,
3784 pm8001_printk("unregister the device\n")); 3790 pm8001_printk("unregister the device\n"));
3785 mpi_dereg_resp(pm8001_ha, piomb); 3791 pm8001_mpi_dereg_resp(pm8001_ha, piomb);
3786 break; 3792 break;
3787 case OPC_OUB_GET_DEV_HANDLE: 3793 case OPC_OUB_GET_DEV_HANDLE:
3788 PM8001_MSG_DBG(pm8001_ha, 3794 PM8001_MSG_DBG(pm8001_ha,
@@ -3820,7 +3826,7 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
3820 case OPC_OUB_FW_FLASH_UPDATE: 3826 case OPC_OUB_FW_FLASH_UPDATE:
3821 PM8001_MSG_DBG(pm8001_ha, 3827 PM8001_MSG_DBG(pm8001_ha,
3822 pm8001_printk("OPC_OUB_FW_FLASH_UPDATE\n")); 3828 pm8001_printk("OPC_OUB_FW_FLASH_UPDATE\n"));
3823 mpi_fw_flash_update_resp(pm8001_ha, piomb); 3829 pm8001_mpi_fw_flash_update_resp(pm8001_ha, piomb);
3824 break; 3830 break;
3825 case OPC_OUB_GPIO_RESPONSE: 3831 case OPC_OUB_GPIO_RESPONSE:
3826 PM8001_MSG_DBG(pm8001_ha, 3832 PM8001_MSG_DBG(pm8001_ha,
@@ -3833,17 +3839,17 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
3833 case OPC_OUB_GENERAL_EVENT: 3839 case OPC_OUB_GENERAL_EVENT:
3834 PM8001_MSG_DBG(pm8001_ha, 3840 PM8001_MSG_DBG(pm8001_ha,
3835 pm8001_printk("OPC_OUB_GENERAL_EVENT\n")); 3841 pm8001_printk("OPC_OUB_GENERAL_EVENT\n"));
3836 mpi_general_event(pm8001_ha, piomb); 3842 pm8001_mpi_general_event(pm8001_ha, piomb);
3837 break; 3843 break;
3838 case OPC_OUB_SSP_ABORT_RSP: 3844 case OPC_OUB_SSP_ABORT_RSP:
3839 PM8001_MSG_DBG(pm8001_ha, 3845 PM8001_MSG_DBG(pm8001_ha,
3840 pm8001_printk("OPC_OUB_SSP_ABORT_RSP\n")); 3846 pm8001_printk("OPC_OUB_SSP_ABORT_RSP\n"));
3841 mpi_task_abort_resp(pm8001_ha, piomb); 3847 pm8001_mpi_task_abort_resp(pm8001_ha, piomb);
3842 break; 3848 break;
3843 case OPC_OUB_SATA_ABORT_RSP: 3849 case OPC_OUB_SATA_ABORT_RSP:
3844 PM8001_MSG_DBG(pm8001_ha, 3850 PM8001_MSG_DBG(pm8001_ha,
3845 pm8001_printk("OPC_OUB_SATA_ABORT_RSP\n")); 3851 pm8001_printk("OPC_OUB_SATA_ABORT_RSP\n"));
3846 mpi_task_abort_resp(pm8001_ha, piomb); 3852 pm8001_mpi_task_abort_resp(pm8001_ha, piomb);
3847 break; 3853 break;
3848 case OPC_OUB_SAS_DIAG_MODE_START_END: 3854 case OPC_OUB_SAS_DIAG_MODE_START_END:
3849 PM8001_MSG_DBG(pm8001_ha, 3855 PM8001_MSG_DBG(pm8001_ha,
@@ -3868,17 +3874,17 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
3868 case OPC_OUB_SMP_ABORT_RSP: 3874 case OPC_OUB_SMP_ABORT_RSP:
3869 PM8001_MSG_DBG(pm8001_ha, 3875 PM8001_MSG_DBG(pm8001_ha,
3870 pm8001_printk("OPC_OUB_SMP_ABORT_RSP\n")); 3876 pm8001_printk("OPC_OUB_SMP_ABORT_RSP\n"));
3871 mpi_task_abort_resp(pm8001_ha, piomb); 3877 pm8001_mpi_task_abort_resp(pm8001_ha, piomb);
3872 break; 3878 break;
3873 case OPC_OUB_GET_NVMD_DATA: 3879 case OPC_OUB_GET_NVMD_DATA:
3874 PM8001_MSG_DBG(pm8001_ha, 3880 PM8001_MSG_DBG(pm8001_ha,
3875 pm8001_printk("OPC_OUB_GET_NVMD_DATA\n")); 3881 pm8001_printk("OPC_OUB_GET_NVMD_DATA\n"));
3876 mpi_get_nvmd_resp(pm8001_ha, piomb); 3882 pm8001_mpi_get_nvmd_resp(pm8001_ha, piomb);
3877 break; 3883 break;
3878 case OPC_OUB_SET_NVMD_DATA: 3884 case OPC_OUB_SET_NVMD_DATA:
3879 PM8001_MSG_DBG(pm8001_ha, 3885 PM8001_MSG_DBG(pm8001_ha,
3880 pm8001_printk("OPC_OUB_SET_NVMD_DATA\n")); 3886 pm8001_printk("OPC_OUB_SET_NVMD_DATA\n"));
3881 mpi_set_nvmd_resp(pm8001_ha, piomb); 3887 pm8001_mpi_set_nvmd_resp(pm8001_ha, piomb);
3882 break; 3888 break;
3883 case OPC_OUB_DEVICE_HANDLE_REMOVAL: 3889 case OPC_OUB_DEVICE_HANDLE_REMOVAL:
3884 PM8001_MSG_DBG(pm8001_ha, 3890 PM8001_MSG_DBG(pm8001_ha,
@@ -3887,7 +3893,7 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
3887 case OPC_OUB_SET_DEVICE_STATE: 3893 case OPC_OUB_SET_DEVICE_STATE:
3888 PM8001_MSG_DBG(pm8001_ha, 3894 PM8001_MSG_DBG(pm8001_ha,
3889 pm8001_printk("OPC_OUB_SET_DEVICE_STATE\n")); 3895 pm8001_printk("OPC_OUB_SET_DEVICE_STATE\n"));
3890 mpi_set_dev_state_resp(pm8001_ha, piomb); 3896 pm8001_mpi_set_dev_state_resp(pm8001_ha, piomb);
3891 break; 3897 break;
3892 case OPC_OUB_GET_DEVICE_STATE: 3898 case OPC_OUB_GET_DEVICE_STATE:
3893 PM8001_MSG_DBG(pm8001_ha, 3899 PM8001_MSG_DBG(pm8001_ha,
@@ -3909,7 +3915,7 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
3909 } 3915 }
3910} 3916}
3911 3917
3912static int process_oq(struct pm8001_hba_info *pm8001_ha) 3918static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)
3913{ 3919{
3914 struct outbound_queue_table *circularQ; 3920 struct outbound_queue_table *circularQ;
3915 void *pMsg1 = NULL; 3921 void *pMsg1 = NULL;
@@ -3918,14 +3924,15 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha)
3918 unsigned long flags; 3924 unsigned long flags;
3919 3925
3920 spin_lock_irqsave(&pm8001_ha->lock, flags); 3926 spin_lock_irqsave(&pm8001_ha->lock, flags);
3921 circularQ = &pm8001_ha->outbnd_q_tbl[0]; 3927 circularQ = &pm8001_ha->outbnd_q_tbl[vec];
3922 do { 3928 do {
3923 ret = mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc); 3929 ret = pm8001_mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc);
3924 if (MPI_IO_STATUS_SUCCESS == ret) { 3930 if (MPI_IO_STATUS_SUCCESS == ret) {
3925 /* process the outbound message */ 3931 /* process the outbound message */
3926 process_one_iomb(pm8001_ha, (void *)(pMsg1 - 4)); 3932 process_one_iomb(pm8001_ha, (void *)(pMsg1 - 4));
3927 /* free the message from the outbound circular buffer */ 3933 /* free the message from the outbound circular buffer */
3928 mpi_msg_free_set(pm8001_ha, pMsg1, circularQ, bc); 3934 pm8001_mpi_msg_free_set(pm8001_ha, pMsg1,
3935 circularQ, bc);
3929 } 3936 }
3930 if (MPI_IO_STATUS_BUSY == ret) { 3937 if (MPI_IO_STATUS_BUSY == ret) {
3931 /* Update the producer index from SPC */ 3938 /* Update the producer index from SPC */
@@ -3948,7 +3955,7 @@ static const u8 data_dir_flags[] = {
3948 [PCI_DMA_FROMDEVICE] = DATA_DIR_IN,/* INBOUND */ 3955 [PCI_DMA_FROMDEVICE] = DATA_DIR_IN,/* INBOUND */
3949 [PCI_DMA_NONE] = DATA_DIR_NONE,/* NO TRANSFER */ 3956 [PCI_DMA_NONE] = DATA_DIR_NONE,/* NO TRANSFER */
3950}; 3957};
3951static void 3958void
3952pm8001_chip_make_sg(struct scatterlist *scatter, int nr, void *prd) 3959pm8001_chip_make_sg(struct scatterlist *scatter, int nr, void *prd)
3953{ 3960{
3954 int i; 3961 int i;
@@ -4023,7 +4030,7 @@ static int pm8001_chip_smp_req(struct pm8001_hba_info *pm8001_ha,
4023 smp_cmd.long_smp_req.long_resp_size = 4030 smp_cmd.long_smp_req.long_resp_size =
4024 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4); 4031 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4);
4025 build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, &smp_cmd); 4032 build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, &smp_cmd);
4026 mpi_build_cmd(pm8001_ha, circularQ, opc, (u32 *)&smp_cmd); 4033 pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, (u32 *)&smp_cmd, 0);
4027 return 0; 4034 return 0;
4028 4035
4029err_out_2: 4036err_out_2:
@@ -4087,7 +4094,7 @@ static int pm8001_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
4087 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); 4094 ssp_cmd.len = cpu_to_le32(task->total_xfer_len);
4088 ssp_cmd.esgl = 0; 4095 ssp_cmd.esgl = 0;
4089 } 4096 }
4090 ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd); 4097 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd, 0);
4091 return ret; 4098 return ret;
4092} 4099}
4093 4100
@@ -4157,7 +4164,7 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
4157 sata_cmd.len = cpu_to_le32(task->total_xfer_len); 4164 sata_cmd.len = cpu_to_le32(task->total_xfer_len);
4158 sata_cmd.esgl = 0; 4165 sata_cmd.esgl = 0;
4159 } 4166 }
4160 ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd); 4167 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 0);
4161 return ret; 4168 return ret;
4162} 4169}
4163 4170
@@ -4192,7 +4199,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
4192 memcpy(payload.sas_identify.sas_addr, 4199 memcpy(payload.sas_identify.sas_addr,
4193 pm8001_ha->sas_addr, SAS_ADDR_SIZE); 4200 pm8001_ha->sas_addr, SAS_ADDR_SIZE);
4194 payload.sas_identify.phy_id = phy_id; 4201 payload.sas_identify.phy_id = phy_id;
4195 ret = mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload); 4202 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 0);
4196 return ret; 4203 return ret;
4197} 4204}
4198 4205
@@ -4202,7 +4209,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
4202 * @num: the inbound queue number 4209 * @num: the inbound queue number
4203 * @phy_id: the phy id which we wanted to start up. 4210 * @phy_id: the phy id which we wanted to start up.
4204 */ 4211 */
4205static int pm8001_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha, 4212int pm8001_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha,
4206 u8 phy_id) 4213 u8 phy_id)
4207{ 4214{
4208 struct phy_stop_req payload; 4215 struct phy_stop_req payload;
@@ -4214,12 +4221,12 @@ static int pm8001_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha,
4214 memset(&payload, 0, sizeof(payload)); 4221 memset(&payload, 0, sizeof(payload));
4215 payload.tag = cpu_to_le32(tag); 4222 payload.tag = cpu_to_le32(tag);
4216 payload.phy_id = cpu_to_le32(phy_id); 4223 payload.phy_id = cpu_to_le32(phy_id);
4217 ret = mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload); 4224 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 0);
4218 return ret; 4225 return ret;
4219} 4226}
4220 4227
4221/** 4228/**
4222 * see comments on mpi_reg_resp. 4229 * see comments on pm8001_mpi_reg_resp.
4223 */ 4230 */
4224static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha, 4231static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
4225 struct pm8001_device *pm8001_dev, u32 flag) 4232 struct pm8001_device *pm8001_dev, u32 flag)
@@ -4273,14 +4280,14 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
4273 cpu_to_le32(ITNT | (firstBurstSize * 0x10000)); 4280 cpu_to_le32(ITNT | (firstBurstSize * 0x10000));
4274 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr, 4281 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr,
4275 SAS_ADDR_SIZE); 4282 SAS_ADDR_SIZE);
4276 rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 4283 rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4277 return rc; 4284 return rc;
4278} 4285}
4279 4286
4280/** 4287/**
4281 * see comments on mpi_reg_resp. 4288 * see comments on pm8001_mpi_reg_resp.
4282 */ 4289 */
4283static int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha, 4290int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha,
4284 u32 device_id) 4291 u32 device_id)
4285{ 4292{
4286 struct dereg_dev_req payload; 4293 struct dereg_dev_req payload;
@@ -4294,7 +4301,7 @@ static int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha,
4294 payload.device_id = cpu_to_le32(device_id); 4301 payload.device_id = cpu_to_le32(device_id);
4295 PM8001_MSG_DBG(pm8001_ha, 4302 PM8001_MSG_DBG(pm8001_ha,
4296 pm8001_printk("unregister device device_id = %d\n", device_id)); 4303 pm8001_printk("unregister device device_id = %d\n", device_id));
4297 ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 4304 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4298 return ret; 4305 return ret;
4299} 4306}
4300 4307
@@ -4317,7 +4324,7 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
4317 payload.tag = cpu_to_le32(1); 4324 payload.tag = cpu_to_le32(1);
4318 payload.phyop_phyid = 4325 payload.phyop_phyid =
4319 cpu_to_le32(((phy_op & 0xff) << 8) | (phyId & 0x0F)); 4326 cpu_to_le32(((phy_op & 0xff) << 8) | (phyId & 0x0F));
4320 ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 4327 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4321 return ret; 4328 return ret;
4322} 4329}
4323 4330
@@ -4341,11 +4348,11 @@ static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
4341 * @stat: stat. 4348 * @stat: stat.
4342 */ 4349 */
4343static irqreturn_t 4350static irqreturn_t
4344pm8001_chip_isr(struct pm8001_hba_info *pm8001_ha) 4351pm8001_chip_isr(struct pm8001_hba_info *pm8001_ha, u8 vec)
4345{ 4352{
4346 pm8001_chip_interrupt_disable(pm8001_ha); 4353 pm8001_chip_interrupt_disable(pm8001_ha, vec);
4347 process_oq(pm8001_ha); 4354 process_oq(pm8001_ha, vec);
4348 pm8001_chip_interrupt_enable(pm8001_ha); 4355 pm8001_chip_interrupt_enable(pm8001_ha, vec);
4349 return IRQ_HANDLED; 4356 return IRQ_HANDLED;
4350} 4357}
4351 4358
@@ -4367,7 +4374,7 @@ static int send_task_abort(struct pm8001_hba_info *pm8001_ha, u32 opc,
4367 task_abort.device_id = cpu_to_le32(dev_id); 4374 task_abort.device_id = cpu_to_le32(dev_id);
4368 task_abort.tag = cpu_to_le32(cmd_tag); 4375 task_abort.tag = cpu_to_le32(cmd_tag);
4369 } 4376 }
4370 ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort); 4377 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 0);
4371 return ret; 4378 return ret;
4372} 4379}
4373 4380
@@ -4376,7 +4383,7 @@ static int send_task_abort(struct pm8001_hba_info *pm8001_ha, u32 opc,
4376 * @task: the task we wanted to aborted. 4383 * @task: the task we wanted to aborted.
4377 * @flag: the abort flag. 4384 * @flag: the abort flag.
4378 */ 4385 */
4379static int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha, 4386int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha,
4380 struct pm8001_device *pm8001_dev, u8 flag, u32 task_tag, u32 cmd_tag) 4387 struct pm8001_device *pm8001_dev, u8 flag, u32 task_tag, u32 cmd_tag)
4381{ 4388{
4382 u32 opc, device_id; 4389 u32 opc, device_id;
@@ -4403,7 +4410,7 @@ static int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha,
4403 * @ccb: the ccb information. 4410 * @ccb: the ccb information.
4404 * @tmf: task management function. 4411 * @tmf: task management function.
4405 */ 4412 */
4406static int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha, 4413int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,
4407 struct pm8001_ccb_info *ccb, struct pm8001_tmf_task *tmf) 4414 struct pm8001_ccb_info *ccb, struct pm8001_tmf_task *tmf)
4408{ 4415{
4409 struct sas_task *task = ccb->task; 4416 struct sas_task *task = ccb->task;
@@ -4421,11 +4428,11 @@ static int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,
4421 memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); 4428 memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8);
4422 sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); 4429 sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag);
4423 circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4430 circularQ = &pm8001_ha->inbnd_q_tbl[0];
4424 ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd); 4431 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd, 0);
4425 return ret; 4432 return ret;
4426} 4433}
4427 4434
4428static int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, 4435int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha,
4429 void *payload) 4436 void *payload)
4430{ 4437{
4431 u32 opc = OPC_INB_GET_NVMD_DATA; 4438 u32 opc = OPC_INB_GET_NVMD_DATA;
@@ -4501,11 +4508,11 @@ static int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha,
4501 default: 4508 default:
4502 break; 4509 break;
4503 } 4510 }
4504 rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req); 4511 rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req, 0);
4505 return rc; 4512 return rc;
4506} 4513}
4507 4514
4508static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, 4515int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha,
4509 void *payload) 4516 void *payload)
4510{ 4517{
4511 u32 opc = OPC_INB_SET_NVMD_DATA; 4518 u32 opc = OPC_INB_SET_NVMD_DATA;
@@ -4581,7 +4588,7 @@ static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha,
4581 default: 4588 default:
4582 break; 4589 break;
4583 } 4590 }
4584 rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req); 4591 rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req, 0);
4585 return rc; 4592 return rc;
4586} 4593}
4587 4594
@@ -4590,7 +4597,7 @@ static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha,
4590 * @pm8001_ha: our hba card information. 4597 * @pm8001_ha: our hba card information.
4591 * @fw_flash_updata_info: firmware flash update param 4598 * @fw_flash_updata_info: firmware flash update param
4592 */ 4599 */
4593static int 4600int
4594pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha, 4601pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha,
4595 void *fw_flash_updata_info, u32 tag) 4602 void *fw_flash_updata_info, u32 tag)
4596{ 4603{
@@ -4612,11 +4619,11 @@ pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha,
4612 cpu_to_le32(lower_32_bits(le64_to_cpu(info->sgl.addr))); 4619 cpu_to_le32(lower_32_bits(le64_to_cpu(info->sgl.addr)));
4613 payload.sgl_addr_hi = 4620 payload.sgl_addr_hi =
4614 cpu_to_le32(upper_32_bits(le64_to_cpu(info->sgl.addr))); 4621 cpu_to_le32(upper_32_bits(le64_to_cpu(info->sgl.addr)));
4615 ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 4622 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4616 return ret; 4623 return ret;
4617} 4624}
4618 4625
4619static int 4626int
4620pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha, 4627pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
4621 void *payload) 4628 void *payload)
4622{ 4629{
@@ -4672,7 +4679,7 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
4672 return rc; 4679 return rc;
4673} 4680}
4674 4681
4675static int 4682int
4676pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha, 4683pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha,
4677 struct pm8001_device *pm8001_dev, u32 state) 4684 struct pm8001_device *pm8001_dev, u32 state)
4678{ 4685{
@@ -4693,7 +4700,7 @@ pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha,
4693 payload.tag = cpu_to_le32(tag); 4700 payload.tag = cpu_to_le32(tag);
4694 payload.device_id = cpu_to_le32(pm8001_dev->device_id); 4701 payload.device_id = cpu_to_le32(pm8001_dev->device_id);
4695 payload.nds = cpu_to_le32(state); 4702 payload.nds = cpu_to_le32(state);
4696 rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 4703 rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4697 return rc; 4704 return rc;
4698 4705
4699} 4706}
@@ -4718,7 +4725,7 @@ pm8001_chip_sas_re_initialization(struct pm8001_hba_info *pm8001_ha)
4718 payload.SSAHOLT = cpu_to_le32(0xd << 25); 4725 payload.SSAHOLT = cpu_to_le32(0xd << 25);
4719 payload.sata_hol_tmo = cpu_to_le32(80); 4726 payload.sata_hol_tmo = cpu_to_le32(80);
4720 payload.open_reject_cmdretries_data_retries = cpu_to_le32(0xff00ff); 4727 payload.open_reject_cmdretries_data_retries = cpu_to_le32(0xff00ff);
4721 rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 4728 rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4722 return rc; 4729 return rc;
4723 4730
4724} 4731}
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 98686b982302..19fbd03b4190 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -165,7 +165,7 @@ static void pm8001_tasklet(unsigned long opaque)
165 pm8001_ha = (struct pm8001_hba_info *)opaque; 165 pm8001_ha = (struct pm8001_hba_info *)opaque;
166 if (unlikely(!pm8001_ha)) 166 if (unlikely(!pm8001_ha))
167 BUG_ON(1); 167 BUG_ON(1);
168 PM8001_CHIP_DISP->isr(pm8001_ha); 168 PM8001_CHIP_DISP->isr(pm8001_ha, 0);
169} 169}
170#endif 170#endif
171 171
@@ -189,7 +189,7 @@ static irqreturn_t pm8001_interrupt(int irq, void *opaque)
189#ifdef PM8001_USE_TASKLET 189#ifdef PM8001_USE_TASKLET
190 tasklet_schedule(&pm8001_ha->tasklet); 190 tasklet_schedule(&pm8001_ha->tasklet);
191#else 191#else
192 ret = PM8001_CHIP_DISP->isr(pm8001_ha); 192 ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0);
193#endif 193#endif
194 return ret; 194 return ret;
195} 195}
@@ -420,6 +420,12 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev,
420 pm8001_ha->id = pm8001_id++; 420 pm8001_ha->id = pm8001_id++;
421 pm8001_ha->logging_level = 0x01; 421 pm8001_ha->logging_level = 0x01;
422 sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id); 422 sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id);
423 /* IOMB size is 128 for 8088/89 controllers */
424 if (pm8001_ha->chip_id != chip_8001)
425 pm8001_ha->iomb_size = IOMB_SIZE_SPCV;
426 else
427 pm8001_ha->iomb_size = IOMB_SIZE_SPC;
428
423#ifdef PM8001_USE_TASKLET 429#ifdef PM8001_USE_TASKLET
424 tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet, 430 tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet,
425 (unsigned long)pm8001_ha); 431 (unsigned long)pm8001_ha);
@@ -722,7 +728,7 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
722 if (rc) 728 if (rc)
723 goto err_out_shost; 729 goto err_out_shost;
724 730
725 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha); 731 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0);
726 pm8001_init_sas_add(pm8001_ha); 732 pm8001_init_sas_add(pm8001_ha);
727 pm8001_post_sas_ha_init(shost, chip); 733 pm8001_post_sas_ha_init(shost, chip);
728 rc = sas_register_ha(SHOST_TO_SAS_HA(shost)); 734 rc = sas_register_ha(SHOST_TO_SAS_HA(shost));
@@ -758,7 +764,7 @@ static void pm8001_pci_remove(struct pci_dev *pdev)
758 sas_remove_host(pm8001_ha->shost); 764 sas_remove_host(pm8001_ha->shost);
759 list_del(&pm8001_ha->list); 765 list_del(&pm8001_ha->list);
760 scsi_remove_host(pm8001_ha->shost); 766 scsi_remove_host(pm8001_ha->shost);
761 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha); 767 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0);
762 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha, 0x252acbcd); 768 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha, 0x252acbcd);
763 769
764#ifdef PM8001_USE_MSIX 770#ifdef PM8001_USE_MSIX
@@ -802,7 +808,7 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state)
802 printk(KERN_ERR " PCI PM not supported\n"); 808 printk(KERN_ERR " PCI PM not supported\n");
803 return -ENODEV; 809 return -ENODEV;
804 } 810 }
805 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha); 811 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0);
806 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha, 0x252acbcd); 812 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha, 0x252acbcd);
807#ifdef PM8001_USE_MSIX 813#ifdef PM8001_USE_MSIX
808 for (i = 0; i < pm8001_ha->number_of_intr; i++) 814 for (i = 0; i < pm8001_ha->number_of_intr; i++)
@@ -863,7 +869,7 @@ static int pm8001_pci_resume(struct pci_dev *pdev)
863 rc = PM8001_CHIP_DISP->chip_init(pm8001_ha); 869 rc = PM8001_CHIP_DISP->chip_init(pm8001_ha);
864 if (rc) 870 if (rc)
865 goto err_out_disable; 871 goto err_out_disable;
866 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha); 872 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0);
867 rc = pm8001_request_irq(pm8001_ha); 873 rc = pm8001_request_irq(pm8001_ha);
868 if (rc) 874 if (rc)
869 goto err_out_disable; 875 goto err_out_disable;
@@ -871,7 +877,7 @@ static int pm8001_pci_resume(struct pci_dev *pdev)
871 tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet, 877 tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet,
872 (unsigned long)pm8001_ha); 878 (unsigned long)pm8001_ha);
873 #endif 879 #endif
874 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha); 880 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0);
875 scsi_unblock_requests(pm8001_ha->shost); 881 scsi_unblock_requests(pm8001_ha->shost);
876 return 0; 882 return 0;
877 883
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index 37a339e6a3a4..e0faa9597c26 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver 2 * PMC-Sierra 8001/8081/8088/8089 SAS/SATA based host adapters driver
3 * 3 *
4 * Copyright (c) 2008-2009 USI Co., Ltd. 4 * Copyright (c) 2008-2009 USI Co., Ltd.
5 * All rights reserved. 5 * All rights reserved.
@@ -135,11 +135,11 @@ struct pm8001_dispatch {
135 void (*chip_rst)(struct pm8001_hba_info *pm8001_ha); 135 void (*chip_rst)(struct pm8001_hba_info *pm8001_ha);
136 int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha); 136 int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha);
137 void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha); 137 void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha);
138 irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha); 138 irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha, u8 vec);
139 u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha); 139 u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha);
140 int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha); 140 int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha, u8 vec);
141 void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha); 141 void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha, u8 vec);
142 void (*interrupt_disable)(struct pm8001_hba_info *pm8001_ha); 142 void (*interrupt_disable)(struct pm8001_hba_info *pm8001_ha, u8 vec);
143 void (*make_prd)(struct scatterlist *scatter, int nr, void *prd); 143 void (*make_prd)(struct scatterlist *scatter, int nr, void *prd);
144 int (*smp_req)(struct pm8001_hba_info *pm8001_ha, 144 int (*smp_req)(struct pm8001_hba_info *pm8001_ha,
145 struct pm8001_ccb_info *ccb); 145 struct pm8001_ccb_info *ccb);
@@ -563,6 +563,56 @@ int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
563 dma_addr_t *pphys_addr, u32 *pphys_addr_hi, u32 *pphys_addr_lo, 563 dma_addr_t *pphys_addr, u32 *pphys_addr_hi, u32 *pphys_addr_lo,
564 u32 mem_size, u32 align); 564 u32 mem_size, u32 align);
565 565
566/********** functions common to spc & spcv - begins ************/
567void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha);
568int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
569 struct inbound_queue_table *circularQ,
570 u32 opCode, void *payload, u32 responseQueue);
571int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ,
572 u16 messageSize, void **messagePtr);
573u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,
574 struct outbound_queue_table *circularQ, u8 bc);
575u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha,
576 struct outbound_queue_table *circularQ,
577 void **messagePtr1, u8 *pBC);
578int pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha,
579 struct pm8001_device *pm8001_dev, u32 state);
580int pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
581 void *payload);
582int pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha,
583 void *fw_flash_updata_info, u32 tag);
584int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload);
585int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload);
586int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,
587 struct pm8001_ccb_info *ccb,
588 struct pm8001_tmf_task *tmf);
589int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha,
590 struct pm8001_device *pm8001_dev,
591 u8 flag, u32 task_tag, u32 cmd_tag);
592int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha, u32 device_id);
593void pm8001_chip_make_sg(struct scatterlist *scatter, int nr, void *prd);
594void pm8001_work_fn(struct work_struct *work);
595int pm8001_handle_event(struct pm8001_hba_info *pm8001_ha,
596 void *data, int handler);
597void pm8001_mpi_set_dev_state_resp(struct pm8001_hba_info *pm8001_ha,
598 void *piomb);
599void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha,
600 void *piomb);
601void pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha,
602 void *piomb);
603int pm8001_mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha,
604 void *piomb);
605void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate);
606void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, u8 *sas_addr);
607void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i);
608int pm8001_mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
609int pm8001_mpi_dereg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
610int pm8001_mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha,
611 void *piomb);
612int pm8001_mpi_general_event(struct pm8001_hba_info *pm8001_ha , void *piomb);
613int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
614/*********** functions common to spc & spcv - ends ************/
615
566int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue); 616int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue);
567 617
568/* ctl shared API */ 618/* ctl shared API */