aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/hp/sim/simscsi.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index 7661bb065fa5..3a078ad3aa44 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -201,22 +201,6 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
201 simscsi_sg_readwrite(sc, mode, offset); 201 simscsi_sg_readwrite(sc, mode, offset);
202} 202}
203 203
204static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len)
205{
206
207 int i;
208 unsigned thislen;
209 struct scatterlist *slp;
210
211 scsi_for_each_sg(sc, slp, scsi_sg_count(sc), i) {
212 if (!len)
213 break;
214 thislen = min(len, slp->length);
215 memcpy(sg_virt(slp), buf, thislen);
216 len -= thislen;
217 }
218}
219
220static int 204static int
221simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) 205simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
222{ 206{
@@ -258,7 +242,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
258 buf[6] = 0; /* reserved */ 242 buf[6] = 0; /* reserved */
259 buf[7] = 0; /* various flags */ 243 buf[7] = 0; /* various flags */
260 memcpy(buf + 8, "HP SIMULATED DISK 0.00", 28); 244 memcpy(buf + 8, "HP SIMULATED DISK 0.00", 28);
261 simscsi_fillresult(sc, buf, 36); 245 scsi_sg_copy_from_buffer(sc, buf, 36);
262 sc->result = GOOD; 246 sc->result = GOOD;
263 break; 247 break;
264 248
@@ -306,14 +290,15 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
306 buf[5] = 0; 290 buf[5] = 0;
307 buf[6] = 2; 291 buf[6] = 2;
308 buf[7] = 0; 292 buf[7] = 0;
309 simscsi_fillresult(sc, buf, 8); 293 scsi_sg_copy_from_buffer(sc, buf, 8);
310 sc->result = GOOD; 294 sc->result = GOOD;
311 break; 295 break;
312 296
313 case MODE_SENSE: 297 case MODE_SENSE:
314 case MODE_SENSE_10: 298 case MODE_SENSE_10:
315 /* sd.c uses this to determine whether disk does write-caching. */ 299 /* sd.c uses this to determine whether disk does write-caching. */
316 simscsi_fillresult(sc, (char *)empty_zero_page, scsi_bufflen(sc)); 300 scsi_sg_copy_from_buffer(sc, (char *)empty_zero_page,
301 PAGE_SIZE);
317 sc->result = GOOD; 302 sc->result = GOOD;
318 break; 303 break;
319 304