diff options
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/sbp2.c | 75 |
1 files changed, 4 insertions, 71 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 875eadd5e8f5..ce86ff226a28 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -1489,69 +1489,6 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb, | |||
1489 | } | 1489 | } |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | static void sbp2_prep_command_orb_no_sg(struct sbp2_command_orb *orb, | ||
1493 | struct sbp2_fwhost_info *hi, | ||
1494 | struct sbp2_command_info *cmd, | ||
1495 | struct scatterlist *sgpnt, | ||
1496 | u32 orb_direction, | ||
1497 | unsigned int scsi_request_bufflen, | ||
1498 | void *scsi_request_buffer, | ||
1499 | enum dma_data_direction dma_dir) | ||
1500 | { | ||
1501 | cmd->dma_dir = dma_dir; | ||
1502 | cmd->dma_size = scsi_request_bufflen; | ||
1503 | cmd->dma_type = CMD_DMA_SINGLE; | ||
1504 | cmd->cmd_dma = dma_map_single(hi->host->device.parent, | ||
1505 | scsi_request_buffer, | ||
1506 | cmd->dma_size, cmd->dma_dir); | ||
1507 | orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id); | ||
1508 | orb->misc |= ORB_SET_DIRECTION(orb_direction); | ||
1509 | |||
1510 | /* handle case where we get a command w/o s/g enabled | ||
1511 | * (but check for transfers larger than 64K) */ | ||
1512 | if (scsi_request_bufflen <= SBP2_MAX_SG_ELEMENT_LENGTH) { | ||
1513 | |||
1514 | orb->data_descriptor_lo = cmd->cmd_dma; | ||
1515 | orb->misc |= ORB_SET_DATA_SIZE(scsi_request_bufflen); | ||
1516 | |||
1517 | } else { | ||
1518 | /* The buffer is too large. Turn this into page tables. */ | ||
1519 | |||
1520 | struct sbp2_unrestricted_page_table *sg_element = | ||
1521 | &cmd->scatter_gather_element[0]; | ||
1522 | u32 sg_count, sg_len; | ||
1523 | dma_addr_t sg_addr; | ||
1524 | |||
1525 | orb->data_descriptor_lo = cmd->sge_dma; | ||
1526 | orb->misc |= ORB_SET_PAGE_TABLE_PRESENT(0x1); | ||
1527 | |||
1528 | /* fill out our SBP-2 page tables; split up the large buffer */ | ||
1529 | sg_count = 0; | ||
1530 | sg_len = scsi_request_bufflen; | ||
1531 | sg_addr = cmd->cmd_dma; | ||
1532 | while (sg_len) { | ||
1533 | sg_element[sg_count].segment_base_lo = sg_addr; | ||
1534 | if (sg_len > SBP2_MAX_SG_ELEMENT_LENGTH) { | ||
1535 | sg_element[sg_count].length_segment_base_hi = | ||
1536 | PAGE_TABLE_SET_SEGMENT_LENGTH(SBP2_MAX_SG_ELEMENT_LENGTH); | ||
1537 | sg_addr += SBP2_MAX_SG_ELEMENT_LENGTH; | ||
1538 | sg_len -= SBP2_MAX_SG_ELEMENT_LENGTH; | ||
1539 | } else { | ||
1540 | sg_element[sg_count].length_segment_base_hi = | ||
1541 | PAGE_TABLE_SET_SEGMENT_LENGTH(sg_len); | ||
1542 | sg_len = 0; | ||
1543 | } | ||
1544 | sg_count++; | ||
1545 | } | ||
1546 | |||
1547 | orb->misc |= ORB_SET_DATA_SIZE(sg_count); | ||
1548 | |||
1549 | sbp2util_cpu_to_be32_buffer(sg_element, | ||
1550 | (sizeof(struct sbp2_unrestricted_page_table)) * | ||
1551 | sg_count); | ||
1552 | } | ||
1553 | } | ||
1554 | |||
1555 | static void sbp2_create_command_orb(struct sbp2_lu *lu, | 1492 | static void sbp2_create_command_orb(struct sbp2_lu *lu, |
1556 | struct sbp2_command_info *cmd, | 1493 | struct sbp2_command_info *cmd, |
1557 | unchar *scsi_cmd, | 1494 | unchar *scsi_cmd, |
@@ -1595,13 +1532,9 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu, | |||
1595 | orb->data_descriptor_hi = 0x0; | 1532 | orb->data_descriptor_hi = 0x0; |
1596 | orb->data_descriptor_lo = 0x0; | 1533 | orb->data_descriptor_lo = 0x0; |
1597 | orb->misc |= ORB_SET_DIRECTION(1); | 1534 | orb->misc |= ORB_SET_DIRECTION(1); |
1598 | } else if (scsi_use_sg) | 1535 | } else |
1599 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sgpnt, | 1536 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sgpnt, |
1600 | orb_direction, dma_dir); | 1537 | orb_direction, dma_dir); |
1601 | else | ||
1602 | sbp2_prep_command_orb_no_sg(orb, hi, cmd, sgpnt, orb_direction, | ||
1603 | scsi_request_bufflen, | ||
1604 | scsi_request_buffer, dma_dir); | ||
1605 | 1538 | ||
1606 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); | 1539 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); |
1607 | 1540 | ||
@@ -1690,15 +1623,15 @@ static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, | |||
1690 | void (*done)(struct scsi_cmnd *)) | 1623 | void (*done)(struct scsi_cmnd *)) |
1691 | { | 1624 | { |
1692 | unchar *scsi_cmd = (unchar *)SCpnt->cmnd; | 1625 | unchar *scsi_cmd = (unchar *)SCpnt->cmnd; |
1693 | unsigned int request_bufflen = SCpnt->request_bufflen; | 1626 | unsigned int request_bufflen = scsi_bufflen(SCpnt); |
1694 | struct sbp2_command_info *cmd; | 1627 | struct sbp2_command_info *cmd; |
1695 | 1628 | ||
1696 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); | 1629 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); |
1697 | if (!cmd) | 1630 | if (!cmd) |
1698 | return -EIO; | 1631 | return -EIO; |
1699 | 1632 | ||
1700 | sbp2_create_command_orb(lu, cmd, scsi_cmd, SCpnt->use_sg, | 1633 | sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt), |
1701 | request_bufflen, SCpnt->request_buffer, | 1634 | request_bufflen, scsi_sglist(SCpnt), |
1702 | SCpnt->sc_data_direction); | 1635 | SCpnt->sc_data_direction); |
1703 | sbp2_link_orb_command(lu, cmd); | 1636 | sbp2_link_orb_command(lu, cmd); |
1704 | 1637 | ||