aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/aha152x.c85
-rw-r--r--drivers/scsi/aha152x.h2
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c4
3 files changed, 54 insertions, 37 deletions
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index cb2ee25f213f..531a1f9ceb51 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -1260,16 +1260,15 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
1260 * Reset the bus 1260 * Reset the bus
1261 * 1261 *
1262 */ 1262 */
1263static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) 1263static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)
1264{ 1264{
1265 struct Scsi_Host *shpnt = SCpnt->device->host;
1266 unsigned long flags; 1265 unsigned long flags;
1267 1266
1268 DO_LOCK(flags); 1267 DO_LOCK(flags);
1269 1268
1270#if defined(AHA152X_DEBUG) 1269#if defined(AHA152X_DEBUG)
1271 if(HOSTDATA(shpnt)->debug & debug_eh) { 1270 if(HOSTDATA(shpnt)->debug & debug_eh) {
1272 printk(DEBUG_LEAD "aha152x_bus_reset(%p)", CMDINFO(SCpnt), SCpnt); 1271 printk(KERN_DEBUG "scsi%d: bus reset", shpnt->host_no);
1273 show_queues(shpnt); 1272 show_queues(shpnt);
1274 } 1273 }
1275#endif 1274#endif
@@ -1277,14 +1276,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1277 free_hard_reset_SCs(shpnt, &ISSUE_SC); 1276 free_hard_reset_SCs(shpnt, &ISSUE_SC);
1278 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC); 1277 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC);
1279 1278
1280 DPRINTK(debug_eh, DEBUG_LEAD "resetting bus\n", CMDINFO(SCpnt)); 1279 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting bus\n", shpnt->host_no);
1281 1280
1282 SETPORT(SCSISEQ, SCSIRSTO); 1281 SETPORT(SCSISEQ, SCSIRSTO);
1283 mdelay(256); 1282 mdelay(256);
1284 SETPORT(SCSISEQ, 0); 1283 SETPORT(SCSISEQ, 0);
1285 mdelay(DELAY); 1284 mdelay(DELAY);
1286 1285
1287 DPRINTK(debug_eh, DEBUG_LEAD "bus resetted\n", CMDINFO(SCpnt)); 1286 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: bus resetted\n", shpnt->host_no);
1288 1287
1289 setup_expected_interrupts(shpnt); 1288 setup_expected_interrupts(shpnt);
1290 if(HOSTDATA(shpnt)->commands==0) 1289 if(HOSTDATA(shpnt)->commands==0)
@@ -1295,6 +1294,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1295 return SUCCESS; 1294 return SUCCESS;
1296} 1295}
1297 1296
1297/*
1298 * Reset the bus
1299 *
1300 */
1301static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1302{
1303 return aha152x_bus_reset_host(SCpnt->device->host);
1304}
1298 1305
1299/* 1306/*
1300 * Restore default values to the AIC-6260 registers and reset the fifos 1307 * Restore default values to the AIC-6260 registers and reset the fifos
@@ -1337,23 +1344,28 @@ static void reset_ports(struct Scsi_Host *shpnt)
1337 * Reset the host (bus and controller) 1344 * Reset the host (bus and controller)
1338 * 1345 *
1339 */ 1346 */
1340int aha152x_host_reset(Scsi_Cmnd * SCpnt) 1347int aha152x_host_reset_host(struct Scsi_Host *shpnt)
1341{ 1348{
1342#if defined(AHA152X_DEBUG) 1349 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
1343 struct Scsi_Host *shpnt = SCpnt->device->host;
1344#endif
1345
1346 DPRINTK(debug_eh, DEBUG_LEAD "aha152x_host_reset(%p)\n", CMDINFO(SCpnt), SCpnt);
1347 1350
1348 aha152x_bus_reset(SCpnt); 1351 aha152x_bus_reset_host(shpnt);
1349 1352
1350 DPRINTK(debug_eh, DEBUG_LEAD "resetting ports\n", CMDINFO(SCpnt)); 1353 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting ports\n", shpnt->host_no);
1351 reset_ports(SCpnt->device->host); 1354 reset_ports(shpnt);
1352 1355
1353 return SUCCESS; 1356 return SUCCESS;
1354} 1357}
1355 1358
1356/* 1359/*
1360 * Reset the host (bus and controller)
1361 *
1362 */
1363static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
1364{
1365 return aha152x_host_reset_host(SCpnt->device->host);
1366}
1367
1368/*
1357 * Return the "logical geometry" 1369 * Return the "logical geometry"
1358 * 1370 *
1359 */ 1371 */
@@ -1431,22 +1443,18 @@ static void run(void)
1431{ 1443{
1432 int i; 1444 int i;
1433 for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) { 1445 for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) {
1434 struct Scsi_Host *shpnt = aha152x_host[i]; 1446 is_complete(aha152x_host[i]);
1435 if (shpnt && HOSTDATA(shpnt)->service) {
1436 HOSTDATA(shpnt)->service=0;
1437 is_complete(shpnt);
1438 }
1439 } 1447 }
1440} 1448}
1441 1449
1442/* 1450/*
1443 * Interrupts handler 1451 * Interrupt handler
1444 * 1452 *
1445 */ 1453 */
1446
1447static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs) 1454static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
1448{ 1455{
1449 struct Scsi_Host *shpnt = lookup_irq(irqno); 1456 struct Scsi_Host *shpnt = lookup_irq(irqno);
1457 unsigned long flags;
1450 unsigned char rev, dmacntrl0; 1458 unsigned char rev, dmacntrl0;
1451 1459
1452 if (!shpnt) { 1460 if (!shpnt) {
@@ -1472,23 +1480,23 @@ static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
1472 if ((rev == 0xFF) && (dmacntrl0 == 0xFF)) 1480 if ((rev == 0xFF) && (dmacntrl0 == 0xFF))
1473 return IRQ_NONE; 1481 return IRQ_NONE;
1474 1482
1483 if( TESTLO(DMASTAT, INTSTAT) )
1484 return IRQ_NONE;
1485
1475 /* no more interrupts from the controller, while we're busy. 1486 /* no more interrupts from the controller, while we're busy.
1476 INTEN is restored by the BH handler */ 1487 INTEN is restored by the BH handler */
1477 CLRBITS(DMACNTRL0, INTEN); 1488 CLRBITS(DMACNTRL0, INTEN);
1478 1489
1479#if 0 1490 DO_LOCK(flags);
1480 /* check if there is already something to be 1491 if( HOSTDATA(shpnt)->service==0 ) {
1481 serviced; should not happen */ 1492 HOSTDATA(shpnt)->service=1;
1482 if(HOSTDATA(shpnt)->service) { 1493
1483 printk(KERN_ERR "aha152x%d: lost interrupt (%d)\n", HOSTNO, HOSTDATA(shpnt)->service); 1494 /* Poke the BH handler */
1484 show_queues(shpnt); 1495 INIT_WORK(&aha152x_tq, (void *) run, NULL);
1496 schedule_work(&aha152x_tq);
1485 } 1497 }
1486#endif 1498 DO_UNLOCK(flags);
1487 1499
1488 /* Poke the BH handler */
1489 HOSTDATA(shpnt)->service++;
1490 INIT_WORK(&aha152x_tq, (void *) run, NULL);
1491 schedule_work(&aha152x_tq);
1492 return IRQ_HANDLED; 1500 return IRQ_HANDLED;
1493} 1501}
1494 1502
@@ -2527,7 +2535,18 @@ static void is_complete(struct Scsi_Host *shpnt)
2527 unsigned long flags; 2535 unsigned long flags;
2528 int pending; 2536 int pending;
2529 2537
2538 if(!shpnt)
2539 return;
2540
2530 DO_LOCK(flags); 2541 DO_LOCK(flags);
2542
2543 if( HOSTDATA(shpnt)->service==0 ) {
2544 DO_UNLOCK(flags);
2545 return;
2546 }
2547
2548 HOSTDATA(shpnt)->service = 0;
2549
2531 if(HOSTDATA(shpnt)->in_intr) { 2550 if(HOSTDATA(shpnt)->in_intr) {
2532 DO_UNLOCK(flags); 2551 DO_UNLOCK(flags);
2533 /* aha152x_error never returns.. */ 2552 /* aha152x_error never returns.. */
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
index d277613af29b..d2add24d02a3 100644
--- a/drivers/scsi/aha152x.h
+++ b/drivers/scsi/aha152x.h
@@ -332,6 +332,6 @@ struct aha152x_setup {
332 332
333struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *); 333struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
334void aha152x_release(struct Scsi_Host *); 334void aha152x_release(struct Scsi_Host *);
335int aha152x_host_reset(Scsi_Cmnd *); 335int aha152x_host_reset_host(struct Scsi_Host *);
336 336
337#endif /* _AHA152X_H */ 337#endif /* _AHA152X_H */
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 0c9edb7051f4..5609847e254a 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -275,10 +275,8 @@ static int aha152x_resume(struct pcmcia_device *dev)
275 275
276 link->state &= ~DEV_SUSPEND; 276 link->state &= ~DEV_SUSPEND;
277 if (link->state & DEV_CONFIG) { 277 if (link->state & DEV_CONFIG) {
278 Scsi_Cmnd tmp;
279 pcmcia_request_configuration(link->handle, &link->conf); 278 pcmcia_request_configuration(link->handle, &link->conf);
280 tmp.device->host = info->host; 279 aha152x_host_reset_host(info->host);
281 aha152x_host_reset(&tmp);
282 } 280 }
283 281
284 return 0; 282 return 0;