aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sym53c8xx_2
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2005-11-29 23:08:33 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-12-13 20:11:39 -0500
commit44f30b0f59d628eb6f57cfa9d8ab06da670e5306 (patch)
tree2d272ce9c67c8b18685eb3828f10734b6a372f7d /drivers/scsi/sym53c8xx_2
parent84e203a279d3de1c8a41a73ab45e55a89bc19345 (diff)
[SCSI] sym2: Remove code to handle DMA_BIDIRECTION requests
The upper layer doesn't send these down since 2.4.x (or 2.6 in practice), so no need to handle it. Inline sym_setup_data_pointers into its only caller so we can fail gracefully in the case we'd get one neverless. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/sym53c8xx_2')
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_fw.c6
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_fw.h6
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_fw1.h48
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_fw2.h52
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c39
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.h1
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c8
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.h84
8 files changed, 40 insertions, 204 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.c b/drivers/scsi/sym53c8xx_2/sym_fw.c
index a7528a8331b5..9916a2a22558 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.c
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.c
@@ -62,9 +62,6 @@ static struct sym_fwa_ofs sym_fw1a_ofs = {
62}; 62};
63static struct sym_fwb_ofs sym_fw1b_ofs = { 63static struct sym_fwb_ofs sym_fw1b_ofs = {
64 SYM_GEN_FW_B(struct SYM_FWB_SCR) 64 SYM_GEN_FW_B(struct SYM_FWB_SCR)
65#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
66 SYM_GEN_B(struct SYM_FWB_SCR, data_io)
67#endif
68}; 65};
69static struct sym_fwz_ofs sym_fw1z_ofs = { 66static struct sym_fwz_ofs sym_fw1z_ofs = {
70 SYM_GEN_FW_Z(struct SYM_FWZ_SCR) 67 SYM_GEN_FW_Z(struct SYM_FWZ_SCR)
@@ -86,9 +83,6 @@ static struct sym_fwa_ofs sym_fw2a_ofs = {
86}; 83};
87static struct sym_fwb_ofs sym_fw2b_ofs = { 84static struct sym_fwb_ofs sym_fw2b_ofs = {
88 SYM_GEN_FW_B(struct SYM_FWB_SCR) 85 SYM_GEN_FW_B(struct SYM_FWB_SCR)
89#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
90 SYM_GEN_B(struct SYM_FWB_SCR, data_io)
91#endif
92 SYM_GEN_B(struct SYM_FWB_SCR, start64) 86 SYM_GEN_B(struct SYM_FWB_SCR, start64)
93 SYM_GEN_B(struct SYM_FWB_SCR, pm_handle) 87 SYM_GEN_B(struct SYM_FWB_SCR, pm_handle)
94}; 88};
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.h b/drivers/scsi/sym53c8xx_2/sym_fw.h
index 43f6810a4045..66ec35beab5b 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.h
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.h
@@ -92,9 +92,6 @@ struct sym_fwa_ofs {
92}; 92};
93struct sym_fwb_ofs { 93struct sym_fwb_ofs {
94 SYM_GEN_FW_B(u_short) 94 SYM_GEN_FW_B(u_short)
95#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
96 SYM_GEN_B(u_short, data_io)
97#endif
98 SYM_GEN_B(u_short, start64) 95 SYM_GEN_B(u_short, start64)
99 SYM_GEN_B(u_short, pm_handle) 96 SYM_GEN_B(u_short, pm_handle)
100}; 97};
@@ -111,9 +108,6 @@ struct sym_fwa_ba {
111}; 108};
112struct sym_fwb_ba { 109struct sym_fwb_ba {
113 SYM_GEN_FW_B(u32) 110 SYM_GEN_FW_B(u32)
114#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
115 SYM_GEN_B(u32, data_io)
116#endif
117 SYM_GEN_B(u32, start64); 111 SYM_GEN_B(u32, start64);
118 SYM_GEN_B(u32, pm_handle); 112 SYM_GEN_B(u32, pm_handle);
119}; 113};
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw1.h b/drivers/scsi/sym53c8xx_2/sym_fw1.h
index cdd92d82f4b2..7b39f4a35e98 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw1.h
+++ b/drivers/scsi/sym53c8xx_2/sym_fw1.h
@@ -197,12 +197,6 @@ struct SYM_FWB_SCR {
197 u32 bad_status [ 7]; 197 u32 bad_status [ 7];
198 u32 wsr_ma_helper [ 4]; 198 u32 wsr_ma_helper [ 4];
199 199
200#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
201 /* Unknown direction handling */
202 u32 data_io [ 2];
203 u32 data_io_com [ 8];
204 u32 data_io_out [ 7];
205#endif
206 /* Data area */ 200 /* Data area */
207 u32 zero [ 1]; 201 u32 zero [ 1];
208 u32 scratch [ 1]; 202 u32 scratch [ 1];
@@ -1747,48 +1741,6 @@ static struct SYM_FWB_SCR SYM_FWB_SCR = {
1747 SCR_JUMP, 1741 SCR_JUMP,
1748 PADDR_A (dispatch), 1742 PADDR_A (dispatch),
1749 1743
1750#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
1751}/*-------------------------< DATA_IO >--------------------------*/,{
1752 /*
1753 * We jump here if the data direction was unknown at the
1754 * time we had to queue the command to the scripts processor.
1755 * Pointers had been set as follow in this situation:
1756 * savep --> DATA_IO
1757 * lastp --> start pointer when DATA_IN
1758 * wlastp --> start pointer when DATA_OUT
1759 * This script sets savep and lastp according to the
1760 * direction chosen by the target.
1761 */
1762 SCR_JUMP ^ IFTRUE (WHEN (SCR_DATA_OUT)),
1763 PADDR_B (data_io_out),
1764}/*-------------------------< DATA_IO_COM >----------------------*/,{
1765 /*
1766 * Direction is DATA IN.
1767 */
1768 SCR_COPY (4),
1769 HADDR_1 (ccb_head.lastp),
1770 HADDR_1 (ccb_head.savep),
1771 /*
1772 * Jump to the SCRIPTS according to actual direction.
1773 */
1774 SCR_COPY (4),
1775 HADDR_1 (ccb_head.savep),
1776 RADDR_1 (temp),
1777 SCR_RETURN,
1778 0,
1779}/*-------------------------< DATA_IO_OUT >----------------------*/,{
1780 /*
1781 * Direction is DATA OUT.
1782 */
1783 SCR_REG_REG (HF_REG, SCR_AND, (~HF_DATA_IN)),
1784 0,
1785 SCR_COPY (4),
1786 HADDR_1 (ccb_head.wlastp),
1787 HADDR_1 (ccb_head.lastp),
1788 SCR_JUMP,
1789 PADDR_B(data_io_com),
1790#endif /* SYM_OPT_HANDLE_DIR_UNKNOWN */
1791
1792}/*-------------------------< ZERO >-----------------------------*/,{ 1744}/*-------------------------< ZERO >-----------------------------*/,{
1793 SCR_DATA_ZERO, 1745 SCR_DATA_ZERO,
1794}/*-------------------------< SCRATCH >--------------------------*/,{ 1746}/*-------------------------< SCRATCH >--------------------------*/,{
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw2.h b/drivers/scsi/sym53c8xx_2/sym_fw2.h
index 7ea7151f5d1d..851f2706f220 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw2.h
+++ b/drivers/scsi/sym53c8xx_2/sym_fw2.h
@@ -191,13 +191,6 @@ struct SYM_FWB_SCR {
191 u32 pm_wsr_handle [ 38]; 191 u32 pm_wsr_handle [ 38];
192 u32 wsr_ma_helper [ 4]; 192 u32 wsr_ma_helper [ 4];
193 193
194#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
195 /* Unknown direction handling */
196 u32 data_io [ 2];
197 u32 data_io_in [ 2];
198 u32 data_io_com [ 6];
199 u32 data_io_out [ 8];
200#endif
201 /* Data area */ 194 /* Data area */
202 u32 zero [ 1]; 195 u32 zero [ 1];
203 u32 scratch [ 1]; 196 u32 scratch [ 1];
@@ -1838,51 +1831,6 @@ static struct SYM_FWB_SCR SYM_FWB_SCR = {
1838 SCR_JUMP, 1831 SCR_JUMP,
1839 PADDR_A (dispatch), 1832 PADDR_A (dispatch),
1840 1833
1841#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
1842}/*-------------------------< DATA_IO >--------------------------*/,{
1843 /*
1844 * We jump here if the data direction was unknown at the
1845 * time we had to queue the command to the scripts processor.
1846 * Pointers had been set as follow in this situation:
1847 * savep --> DATA_IO
1848 * lastp --> start pointer when DATA_IN
1849 * wlastp --> start pointer when DATA_OUT
1850 * This script sets savep and lastp according to the
1851 * direction chosen by the target.
1852 */
1853 SCR_JUMP ^ IFTRUE (WHEN (SCR_DATA_OUT)),
1854 PADDR_B (data_io_out),
1855}/*-------------------------< DATA_IO_IN >-----------------------*/,{
1856 /*
1857 * Direction is DATA IN.
1858 */
1859 SCR_LOAD_REL (scratcha, 4),
1860 offsetof (struct sym_ccb, phys.head.lastp),
1861}/*-------------------------< DATA_IO_COM >----------------------*/,{
1862 SCR_STORE_REL (scratcha, 4),
1863 offsetof (struct sym_ccb, phys.head.savep),
1864
1865 /*
1866 * Jump to the SCRIPTS according to actual direction.
1867 */
1868 SCR_LOAD_REL (temp, 4),
1869 offsetof (struct sym_ccb, phys.head.savep),
1870 SCR_RETURN,
1871 0,
1872}/*-------------------------< DATA_IO_OUT >----------------------*/,{
1873 /*
1874 * Direction is DATA OUT.
1875 */
1876 SCR_REG_REG (HF_REG, SCR_AND, (~HF_DATA_IN)),
1877 0,
1878 SCR_LOAD_REL (scratcha, 4),
1879 offsetof (struct sym_ccb, phys.head.wlastp),
1880 SCR_STORE_REL (scratcha, 4),
1881 offsetof (struct sym_ccb, phys.head.lastp),
1882 SCR_JUMP,
1883 PADDR_B(data_io_com),
1884#endif /* SYM_OPT_HANDLE_DIR_UNKNOWN */
1885
1886}/*-------------------------< ZERO >-----------------------------*/,{ 1834}/*-------------------------< ZERO >-----------------------------*/,{
1887 SCR_DATA_ZERO, 1835 SCR_DATA_ZERO,
1888}/*-------------------------< SCRATCH >--------------------------*/,{ 1836}/*-------------------------< SCRATCH >--------------------------*/,{
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index a2bfdf8417a2..d924997db48b 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -514,9 +514,10 @@ static inline int sym_setup_cdb(struct sym_hcb *np, struct scsi_cmnd *cmd, struc
514 */ 514 */
515int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) 515int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp)
516{ 516{
517 int dir;
518 struct sym_tcb *tp = &np->target[cp->target]; 517 struct sym_tcb *tp = &np->target[cp->target];
519 struct sym_lcb *lp = sym_lp(tp, cp->lun); 518 struct sym_lcb *lp = sym_lp(tp, cp->lun);
519 u32 lastp, goalp;
520 int dir;
520 521
521 /* 522 /*
522 * Build the CDB. 523 * Build the CDB.
@@ -534,15 +535,47 @@ int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct s
534 sym_set_cam_status(cmd, DID_ERROR); 535 sym_set_cam_status(cmd, DID_ERROR);
535 goto out_abort; 536 goto out_abort;
536 } 537 }
538
539 /*
540 * No segments means no data.
541 */
542 if (!cp->segments)
543 dir = DMA_NONE;
537 } else { 544 } else {
538 cp->data_len = 0; 545 cp->data_len = 0;
539 cp->segments = 0; 546 cp->segments = 0;
540 } 547 }
541 548
542 /* 549 /*
543 * Set data pointers. 550 * Set the data pointer.
551 */
552 switch (dir) {
553 case DMA_BIDIRECTIONAL:
554 printk("%s: got DMA_BIDIRECTIONAL command", sym_name(np));
555 sym_set_cam_status(cmd, DID_ERROR);
556 goto out_abort;
557 case DMA_TO_DEVICE:
558 goalp = SCRIPTA_BA(np, data_out2) + 8;
559 lastp = goalp - 8 - (cp->segments * (2*4));
560 break;
561 case DMA_FROM_DEVICE:
562 cp->host_flags |= HF_DATA_IN;
563 goalp = SCRIPTA_BA(np, data_in2) + 8;
564 lastp = goalp - 8 - (cp->segments * (2*4));
565 break;
566 case DMA_NONE:
567 default:
568 lastp = goalp = SCRIPTB_BA(np, no_data);
569 break;
570 }
571
572 /*
573 * Set all pointers values needed by SCRIPTS.
544 */ 574 */
545 sym_setup_data_pointers(np, cp, dir); 575 cp->phys.head.lastp = cpu_to_scr(lastp);
576 cp->phys.head.savep = cpu_to_scr(lastp);
577 cp->startp = cp->phys.head.savep;
578 cp->goalp = cpu_to_scr(goalp);
546 579
547 /* 580 /*
548 * When `#ifed 1', the code below makes the driver 581 * When `#ifed 1', the code below makes the driver
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h
index c61c23fcce56..cc92d0c70cd7 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -68,7 +68,6 @@
68 */ 68 */
69#define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2) 69#define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2)
70 70
71#define SYM_OPT_HANDLE_DIR_UNKNOWN
72#define SYM_OPT_HANDLE_DEVICE_QUEUEING 71#define SYM_OPT_HANDLE_DEVICE_QUEUEING
73#define SYM_OPT_LIMIT_COMMAND_REORDERING 72#define SYM_OPT_LIMIT_COMMAND_REORDERING
74 73
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index bec644850d3b..b4f0d9a4a55a 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -3654,7 +3654,7 @@ static int sym_evaluate_dp(struct sym_hcb *np, struct sym_ccb *cp, u32 scr, int
3654 * If result is dp_sg = SYM_CONF_MAX_SG, then we are at the 3654 * If result is dp_sg = SYM_CONF_MAX_SG, then we are at the
3655 * end of the data. 3655 * end of the data.
3656 */ 3656 */
3657 tmp = scr_to_cpu(sym_goalp(cp)); 3657 tmp = scr_to_cpu(cp->goalp);
3658 dp_sg = SYM_CONF_MAX_SG; 3658 dp_sg = SYM_CONF_MAX_SG;
3659 if (dp_scr != tmp) 3659 if (dp_scr != tmp)
3660 dp_sg -= (tmp - 8 - (int)dp_scr) / (2*4); 3660 dp_sg -= (tmp - 8 - (int)dp_scr) / (2*4);
@@ -3761,7 +3761,7 @@ static void sym_modify_dp(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb
3761 * And our alchemy:) allows to easily calculate the data 3761 * And our alchemy:) allows to easily calculate the data
3762 * script address we want to return for the next data phase. 3762 * script address we want to return for the next data phase.
3763 */ 3763 */
3764 dp_ret = cpu_to_scr(sym_goalp(cp)); 3764 dp_ret = cpu_to_scr(cp->goalp);
3765 dp_ret = dp_ret - 8 - (SYM_CONF_MAX_SG - dp_sg) * (2*4); 3765 dp_ret = dp_ret - 8 - (SYM_CONF_MAX_SG - dp_sg) * (2*4);
3766 3766
3767 /* 3767 /*
@@ -3857,7 +3857,7 @@ int sym_compute_residual(struct sym_hcb *np, struct sym_ccb *cp)
3857 * If all data has been transferred, 3857 * If all data has been transferred,
3858 * there is no residual. 3858 * there is no residual.
3859 */ 3859 */
3860 if (cp->phys.head.lastp == sym_goalp(cp)) 3860 if (cp->phys.head.lastp == cp->goalp)
3861 return resid; 3861 return resid;
3862 3862
3863 /* 3863 /*
@@ -5470,7 +5470,7 @@ void sym_complete_ok (struct sym_hcb *np, struct sym_ccb *cp)
5470 * extended error did occur, there is no residual. 5470 * extended error did occur, there is no residual.
5471 */ 5471 */
5472 resid = 0; 5472 resid = 0;
5473 if (cp->phys.head.lastp != sym_goalp(cp)) 5473 if (cp->phys.head.lastp != cp->goalp)
5474 resid = sym_compute_residual(np, cp); 5474 resid = sym_compute_residual(np, cp);
5475 5475
5476 /* 5476 /*
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index 756008812aa1..17181101f6c8 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -48,12 +48,6 @@
48 * They may be defined in platform specific headers, if they 48 * They may be defined in platform specific headers, if they
49 * are useful. 49 * are useful.
50 * 50 *
51 * SYM_OPT_HANDLE_DIR_UNKNOWN
52 * When this option is set, the SCRIPTS used by the driver
53 * are able to handle SCSI transfers with direction not
54 * supplied by user.
55 * (set for Linux-2.0.X)
56 *
57 * SYM_OPT_HANDLE_DEVICE_QUEUEING 51 * SYM_OPT_HANDLE_DEVICE_QUEUEING
58 * When this option is set, the driver will use a queue per 52 * When this option is set, the driver will use a queue per
59 * device and handle QUEUE FULL status requeuing internally. 53 * device and handle QUEUE FULL status requeuing internally.
@@ -64,7 +58,6 @@
64 * (set for Linux) 58 * (set for Linux)
65 */ 59 */
66#if 0 60#if 0
67#define SYM_OPT_HANDLE_DIR_UNKNOWN
68#define SYM_OPT_HANDLE_DEVICE_QUEUEING 61#define SYM_OPT_HANDLE_DEVICE_QUEUEING
69#define SYM_OPT_LIMIT_COMMAND_REORDERING 62#define SYM_OPT_LIMIT_COMMAND_REORDERING
70#endif 63#endif
@@ -659,9 +652,6 @@ struct sym_ccbh {
659 */ 652 */
660 u32 savep; /* Jump address to saved data pointer */ 653 u32 savep; /* Jump address to saved data pointer */
661 u32 lastp; /* SCRIPTS address at end of data */ 654 u32 lastp; /* SCRIPTS address at end of data */
662#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
663 u32 wlastp;
664#endif
665 655
666 /* 656 /*
667 * Status fields. 657 * Status fields.
@@ -791,9 +781,6 @@ struct sym_ccb {
791 SYM_QUEHEAD link_ccbq; /* Link to free/busy CCB queue */ 781 SYM_QUEHEAD link_ccbq; /* Link to free/busy CCB queue */
792 u32 startp; /* Initial data pointer */ 782 u32 startp; /* Initial data pointer */
793 u32 goalp; /* Expected last data pointer */ 783 u32 goalp; /* Expected last data pointer */
794#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
795 u32 wgoalp;
796#endif
797 int ext_sg; /* Extreme data pointer, used */ 784 int ext_sg; /* Extreme data pointer, used */
798 int ext_ofs; /* to calculate the residual. */ 785 int ext_ofs; /* to calculate the residual. */
799#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING 786#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING
@@ -808,12 +795,6 @@ struct sym_ccb {
808 795
809#define CCB_BA(cp,lbl) cpu_to_scr(cp->ccb_ba + offsetof(struct sym_ccb, lbl)) 796#define CCB_BA(cp,lbl) cpu_to_scr(cp->ccb_ba + offsetof(struct sym_ccb, lbl))
810 797
811#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
812#define sym_goalp(cp) ((cp->host_flags & HF_DATA_IN) ? cp->goalp : cp->wgoalp)
813#else
814#define sym_goalp(cp) (cp->goalp)
815#endif
816
817typedef struct device *m_pool_ident_t; 798typedef struct device *m_pool_ident_t;
818 799
819/* 800/*
@@ -1122,71 +1103,6 @@ bad:
1122#endif 1103#endif
1123 1104
1124/* 1105/*
1125 * Set up data pointers used by SCRIPTS.
1126 * Called from O/S specific code.
1127 */
1128static inline void sym_setup_data_pointers(struct sym_hcb *np,
1129 struct sym_ccb *cp, int dir)
1130{
1131 u32 lastp, goalp;
1132
1133 /*
1134 * No segments means no data.
1135 */
1136 if (!cp->segments)
1137 dir = DMA_NONE;
1138
1139 /*
1140 * Set the data pointer.
1141 */
1142 switch(dir) {
1143#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
1144 case DMA_BIDIRECTIONAL:
1145#endif
1146 case DMA_TO_DEVICE:
1147 goalp = SCRIPTA_BA(np, data_out2) + 8;
1148 lastp = goalp - 8 - (cp->segments * (2*4));
1149#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
1150 cp->wgoalp = cpu_to_scr(goalp);
1151 if (dir != DMA_BIDIRECTIONAL)
1152 break;
1153 cp->phys.head.wlastp = cpu_to_scr(lastp);
1154 /* fall through */
1155#else
1156 break;
1157#endif
1158 case DMA_FROM_DEVICE:
1159 cp->host_flags |= HF_DATA_IN;
1160 goalp = SCRIPTA_BA(np, data_in2) + 8;
1161 lastp = goalp - 8 - (cp->segments * (2*4));
1162 break;
1163 case DMA_NONE:
1164 default:
1165#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
1166 cp->host_flags |= HF_DATA_IN;
1167#endif
1168 lastp = goalp = SCRIPTB_BA(np, no_data);
1169 break;
1170 }
1171
1172 /*
1173 * Set all pointers values needed by SCRIPTS.
1174 */
1175 cp->phys.head.lastp = cpu_to_scr(lastp);
1176 cp->phys.head.savep = cpu_to_scr(lastp);
1177 cp->startp = cp->phys.head.savep;
1178 cp->goalp = cpu_to_scr(goalp);
1179
1180#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
1181 /*
1182 * If direction is unknown, start at data_io.
1183 */
1184 if (dir == DMA_BIDIRECTIONAL)
1185 cp->phys.head.savep = cpu_to_scr(SCRIPTB_BA(np, data_io));
1186#endif
1187}
1188
1189/*
1190 * MEMORY ALLOCATOR. 1106 * MEMORY ALLOCATOR.
1191 */ 1107 */
1192 1108