aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2007-05-14 07:00:04 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-05-27 14:10:08 -0400
commitd7dea2cf80f0c9eea795b4012e4c86205dda9882 (patch)
tree385769ae8370e4c931ad968c2d7d731d235b5d97
parent6cad75a61d802c5f4f4299103b8f95aeb3ee9876 (diff)
[SCSI] sbp2: convert to use the data buffer accessors
- remove the unnecessary map_single path. - convert to use the new accessors for the sg lists and the parameters. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/ieee1394/sbp2.c75
1 files changed, 4 insertions, 71 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 4cb6fa2bcfb7..d0db6f8b5206 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -1488,69 +1488,6 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1488 } 1488 }
1489} 1489}
1490 1490
1491static void sbp2_prep_command_orb_no_sg(struct sbp2_command_orb *orb,
1492 struct sbp2_fwhost_info *hi,
1493 struct sbp2_command_info *cmd,
1494 struct scatterlist *sgpnt,
1495 u32 orb_direction,
1496 unsigned int scsi_request_bufflen,
1497 void *scsi_request_buffer,
1498 enum dma_data_direction dma_dir)
1499{
1500 cmd->dma_dir = dma_dir;
1501 cmd->dma_size = scsi_request_bufflen;
1502 cmd->dma_type = CMD_DMA_SINGLE;
1503 cmd->cmd_dma = dma_map_single(hi->host->device.parent,
1504 scsi_request_buffer,
1505 cmd->dma_size, cmd->dma_dir);
1506 orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id);
1507 orb->misc |= ORB_SET_DIRECTION(orb_direction);
1508
1509 /* handle case where we get a command w/o s/g enabled
1510 * (but check for transfers larger than 64K) */
1511 if (scsi_request_bufflen <= SBP2_MAX_SG_ELEMENT_LENGTH) {
1512
1513 orb->data_descriptor_lo = cmd->cmd_dma;
1514 orb->misc |= ORB_SET_DATA_SIZE(scsi_request_bufflen);
1515
1516 } else {
1517 /* The buffer is too large. Turn this into page tables. */
1518
1519 struct sbp2_unrestricted_page_table *sg_element =
1520 &cmd->scatter_gather_element[0];
1521 u32 sg_count, sg_len;
1522 dma_addr_t sg_addr;
1523
1524 orb->data_descriptor_lo = cmd->sge_dma;
1525 orb->misc |= ORB_SET_PAGE_TABLE_PRESENT(0x1);
1526
1527 /* fill out our SBP-2 page tables; split up the large buffer */
1528 sg_count = 0;
1529 sg_len = scsi_request_bufflen;
1530 sg_addr = cmd->cmd_dma;
1531 while (sg_len) {
1532 sg_element[sg_count].segment_base_lo = sg_addr;
1533 if (sg_len > SBP2_MAX_SG_ELEMENT_LENGTH) {
1534 sg_element[sg_count].length_segment_base_hi =
1535 PAGE_TABLE_SET_SEGMENT_LENGTH(SBP2_MAX_SG_ELEMENT_LENGTH);
1536 sg_addr += SBP2_MAX_SG_ELEMENT_LENGTH;
1537 sg_len -= SBP2_MAX_SG_ELEMENT_LENGTH;
1538 } else {
1539 sg_element[sg_count].length_segment_base_hi =
1540 PAGE_TABLE_SET_SEGMENT_LENGTH(sg_len);
1541 sg_len = 0;
1542 }
1543 sg_count++;
1544 }
1545
1546 orb->misc |= ORB_SET_DATA_SIZE(sg_count);
1547
1548 sbp2util_cpu_to_be32_buffer(sg_element,
1549 (sizeof(struct sbp2_unrestricted_page_table)) *
1550 sg_count);
1551 }
1552}
1553
1554static void sbp2_create_command_orb(struct sbp2_lu *lu, 1491static void sbp2_create_command_orb(struct sbp2_lu *lu,
1555 struct sbp2_command_info *cmd, 1492 struct sbp2_command_info *cmd,
1556 unchar *scsi_cmd, 1493 unchar *scsi_cmd,
@@ -1594,13 +1531,9 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu,
1594 orb->data_descriptor_hi = 0x0; 1531 orb->data_descriptor_hi = 0x0;
1595 orb->data_descriptor_lo = 0x0; 1532 orb->data_descriptor_lo = 0x0;
1596 orb->misc |= ORB_SET_DIRECTION(1); 1533 orb->misc |= ORB_SET_DIRECTION(1);
1597 } else if (scsi_use_sg) 1534 } else
1598 sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sgpnt, 1535 sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sgpnt,
1599 orb_direction, dma_dir); 1536 orb_direction, dma_dir);
1600 else
1601 sbp2_prep_command_orb_no_sg(orb, hi, cmd, sgpnt, orb_direction,
1602 scsi_request_bufflen,
1603 scsi_request_buffer, dma_dir);
1604 1537
1605 sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); 1538 sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb));
1606 1539
@@ -1689,15 +1622,15 @@ static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt,
1689 void (*done)(struct scsi_cmnd *)) 1622 void (*done)(struct scsi_cmnd *))
1690{ 1623{
1691 unchar *scsi_cmd = (unchar *)SCpnt->cmnd; 1624 unchar *scsi_cmd = (unchar *)SCpnt->cmnd;
1692 unsigned int request_bufflen = SCpnt->request_bufflen; 1625 unsigned int request_bufflen = scsi_bufflen(SCpnt);
1693 struct sbp2_command_info *cmd; 1626 struct sbp2_command_info *cmd;
1694 1627
1695 cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); 1628 cmd = sbp2util_allocate_command_orb(lu, SCpnt, done);
1696 if (!cmd) 1629 if (!cmd)
1697 return -EIO; 1630 return -EIO;
1698 1631
1699 sbp2_create_command_orb(lu, cmd, scsi_cmd, SCpnt->use_sg, 1632 sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt),
1700 request_bufflen, SCpnt->request_buffer, 1633 request_bufflen, scsi_sglist(SCpnt),
1701 SCpnt->sc_data_direction); 1634 SCpnt->sc_data_direction);
1702 sbp2_link_orb_command(lu, cmd); 1635 sbp2_link_orb_command(lu, cmd);
1703 1636