Import 2.3.18pre1
[davej-history.git] / drivers / scsi / pci2000.c
blobf05afc979de999734c602c8ce5eda83b86ba3e53
1 /****************************************************************************
2 * Perceptive Solutions, Inc. PCI-2000 device driver for Linux.
4 * pci2000.c - Linux Host Driver for PCI-2000 IntelliCache SCSI Adapters
6 * Copyright (c) 1997-1999 Perceptive Solutions, Inc.
7 * All Rights Reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that redistributions of source
11 * code retain the above copyright notice and this comment without
12 * modification.
14 * Technical updates and product information at:
15 * http://www.psidisk.com
17 * Please send questions, comments, bug reports to:
18 * tech@psidisk.com Technical Support
21 * Revisions 1.10 Jan-21-1999
22 * - Fixed sign on message to reflect proper controller name.
23 * - Added support for RAID status monitoring and control.
25 * Revisions 1.11 Mar-22-1999
26 * - Fixed control timeout to not lock up the entire system if
27 * controller goes offline completely.
29 * Revisions 1.12 Mar-26-1999
30 * - Fixed spinlock and PCI configuration.
32 ****************************************************************************/
33 #define PCI2000_VERSION "1.12"
35 #include <linux/module.h>
37 #include <linux/kernel.h>
38 #include <linux/types.h>
39 #include <linux/string.h>
40 #include <linux/pci.h>
41 #include <linux/ioport.h>
42 #include <linux/delay.h>
43 #include <linux/sched.h>
44 #include <linux/proc_fs.h>
45 #include <asm/dma.h>
46 #include <asm/system.h>
47 #include <asm/io.h>
48 #include <linux/blk.h>
49 #include "scsi.h"
50 #include "hosts.h"
51 #include <linux/stat.h>
53 #include "pci2000.h"
54 #include "psi_roy.h"
56 #if LINUX_VERSION_CODE >= LINUXVERSION(2,1,95)
57 #include <linux/spinlock.h>
58 #endif
59 #if LINUX_VERSION_CODE < LINUXVERSION(2,1,93)
60 #include <linux/bios32.h>
61 #endif
63 struct proc_dir_entry Proc_Scsi_Pci2000 =
64 { PROC_SCSI_PCI2000, 7, "pci2000", S_IFDIR | S_IRUGO | S_IXUGO, 2 };
66 //#define DEBUG 1
68 #ifdef DEBUG
69 #define DEB(x) x
70 #define STOP_HERE {int st;for(st=0;st<100;st++){st=1;}}
71 #else
72 #define DEB(x)
73 #define STOP_HERE
74 #endif
76 typedef struct
78 ULONG address;
79 ULONG length;
80 } SCATGATH, *PSCATGATH;
82 typedef struct
84 Scsi_Cmnd *SCpnt;
85 SCATGATH scatGath[16];
86 UCHAR tag;
87 } DEV2000, *PDEV2000;
89 typedef struct
91 USHORT basePort;
92 USHORT mb0;
93 USHORT mb1;
94 USHORT mb2;
95 USHORT mb3;
96 USHORT mb4;
97 USHORT cmd;
98 USHORT tag;
99 ULONG irqOwned;
100 DEV2000 dev[MAX_BUS][MAX_UNITS];
101 } ADAPTER2000, *PADAPTER2000;
103 #define HOSTDATA(host) ((PADAPTER2000)&host->hostdata)
106 static struct Scsi_Host *PsiHost[MAXADAPTER] = {NULL,}; // One for each adapter
107 static int NumAdapters = 0;
108 /****************************************************************
109 * Name: WaitReady :LOCAL
111 * Description: Wait for controller ready.
113 * Parameters: padapter - Pointer adapter data structure.
115 * Returns: TRUE on not ready.
117 ****************************************************************/
118 static int WaitReady (PADAPTER2000 padapter)
120 ULONG z;
122 for ( z = 0; z < (TIMEOUT_COMMAND * 4); z++ )
124 if ( !inb_p (padapter->cmd) )
125 return FALSE;
126 udelay (250);
128 return TRUE;
130 /****************************************************************
131 * Name: OpDone :LOCAL
133 * Description: Clean up operation and issue done to caller.
135 * Parameters: SCpnt - Pointer to SCSI command structure.
136 * status - Caller status.
138 * Returns: Nothing.
140 ****************************************************************/
141 static void OpDone (Scsi_Cmnd *SCpnt, ULONG status)
143 SCpnt->result = status;
144 SCpnt->scsi_done (SCpnt);
146 /****************************************************************
147 * Name: Command :LOCAL
149 * Description: Issue queued command to the PCI-2000.
151 * Parameters: padapter - Pointer to adapter information structure.
152 * cmd - PCI-2000 command byte.
154 * Returns: Non-zero command tag if operation is accepted.
156 ****************************************************************/
157 static UCHAR Command (PADAPTER2000 padapter, UCHAR cmd)
159 outb_p (cmd, padapter->cmd);
160 if ( WaitReady (padapter) )
161 return 0;
163 if ( inw_p (padapter->mb0) )
164 return 0;
166 return inb_p (padapter->mb1);
168 /****************************************************************
169 * Name: BuildSgList :LOCAL
171 * Description: Build the scatter gather list for controller.
173 * Parameters: SCpnt - Pointer to SCSI command structure.
174 * padapter - Pointer to adapter information structure.
175 * pdev - Pointer to adapter device structure.
177 * Returns: Non-zero in not scatter gather.
179 ****************************************************************/
180 static int BuildSgList (Scsi_Cmnd *SCpnt, PADAPTER2000 padapter, PDEV2000 pdev)
182 int z;
184 if ( SCpnt->use_sg )
186 for ( z = 0; z < SCpnt->use_sg; z++ )
188 pdev->scatGath[z].address = virt_to_bus (((struct scatterlist *)SCpnt->request_buffer)[z].address);
189 pdev->scatGath[z].length = ((struct scatterlist *)SCpnt->request_buffer)[z].length;
191 outl (virt_to_bus (pdev->scatGath), padapter->mb2);
192 outl ((SCpnt->use_sg << 24) | SCpnt->request_bufflen, padapter->mb3);
193 return FALSE;
195 outl (virt_to_bus (SCpnt->request_buffer), padapter->mb2);
196 outl (SCpnt->request_bufflen, padapter->mb3);
197 return TRUE;
199 /*********************************************************************
200 * Name: PsiRaidCmd
202 * Description: Execute a simple command.
204 * Parameters: padapter - Pointer to adapter control structure.
205 * cmd - Roy command byte.
207 * Returns: Return error status.
209 ********************************************************************/
210 static int PsiRaidCmd (PADAPTER2000 padapter, char cmd)
212 if ( WaitReady (padapter) ) // test for command register ready
213 return DID_TIME_OUT;
214 outb_p (cmd, padapter->cmd); // issue command
215 if ( WaitReady (padapter) ) // wait for adapter ready
216 return DID_TIME_OUT;
217 return DID_OK;
219 /****************************************************************
220 * Name: Irq_Handler :LOCAL
222 * Description: Interrupt handler.
224 * Parameters: irq - Hardware IRQ number.
225 * dev_id -
226 * regs -
228 * Returns: TRUE if drive is not ready in time.
230 ****************************************************************/
231 static void Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
233 struct Scsi_Host *shost = NULL; // Pointer to host data block
234 PADAPTER2000 padapter; // Pointer to adapter control structure
235 PDEV2000 pdev;
236 Scsi_Cmnd *SCpnt;
237 UCHAR tag = 0;
238 UCHAR tag0;
239 ULONG error;
240 int pun;
241 int bus;
242 int z;
243 #if LINUX_VERSION_CODE < LINUXVERSION(2,1,95)
244 int flags;
245 #else /* version >= v2.1.95 */
246 unsigned long flags;
247 #endif /* version >= v2.1.95 */
249 #if LINUX_VERSION_CODE < LINUXVERSION(2,1,95)
250 /* Disable interrupts, if they aren't already disabled. */
251 save_flags (flags);
252 cli ();
253 #else /* version >= v2.1.95 */
255 * Disable interrupts, if they aren't already disabled and acquire
256 * the I/O spinlock.
258 spin_lock_irqsave (&io_request_lock, flags);
259 #endif /* version >= v2.1.95 */
261 DEB(printk ("\npci2000 recieved interrupt "));
262 for ( z = 0; z < NumAdapters; z++ ) // scan for interrupt to process
264 if ( PsiHost[z]->irq == (UCHAR)(irq & 0xFF) )
266 tag = inb_p (HOSTDATA(PsiHost[z])->tag);
267 if ( tag )
269 shost = PsiHost[z];
270 break;
275 if ( !shost )
277 DEB (printk ("\npci2000: not my interrupt"));
278 goto irq_return;
281 padapter = HOSTDATA(shost);
283 tag0 = tag & 0x7F; // mask off the error bit
284 for ( bus = 0; bus < MAX_BUS; bus++ ) // scan the busses
286 for ( pun = 0; pun < MAX_UNITS; pun++ ) // scan the targets
288 pdev = &padapter->dev[bus][pun];
289 if ( !pdev->tag )
290 continue;
291 if ( pdev->tag == tag0 ) // is this it?
293 pdev->tag = 0;
294 SCpnt = pdev->SCpnt;
295 goto irqProceed;
300 outb_p (0xFF, padapter->tag); // clear the op interrupt
301 outb_p (CMD_DONE, padapter->cmd); // complete the op
302 goto irq_return;; // done, but, with what?
304 irqProceed:;
305 if ( tag & ERR08_TAGGED ) // is there an error here?
307 if ( WaitReady (padapter) )
309 OpDone (SCpnt, DID_TIME_OUT << 16);
310 goto irq_return;;
313 outb_p (tag0, padapter->mb0); // get real error code
314 outb_p (CMD_ERROR, padapter->cmd);
315 if ( WaitReady (padapter) ) // wait for controller to suck up the op
317 OpDone (SCpnt, DID_TIME_OUT << 16);
318 goto irq_return;;
321 error = inl (padapter->mb0); // get error data
322 outb_p (0xFF, padapter->tag); // clear the op interrupt
323 outb_p (CMD_DONE, padapter->cmd); // complete the op
325 DEB (printk ("status: %lX ", error));
326 if ( error == 0x00020002 ) // is this error a check condition?
328 if ( bus ) // are we doint SCSI commands?
330 OpDone (SCpnt, (DID_OK << 16) | 2);
331 goto irq_return;;
333 if ( *SCpnt->cmnd == SCSIOP_TEST_UNIT_READY )
334 OpDone (SCpnt, (DRIVER_SENSE << 24) | (DID_OK << 16) | 2); // test caller we have sense data too
335 else
336 OpDone (SCpnt, DID_ERROR << 16);
337 goto irq_return;;
339 OpDone (SCpnt, DID_ERROR << 16);
340 goto irq_return;;
343 outb_p (0xFF, padapter->tag); // clear the op interrupt
344 outb_p (CMD_DONE, padapter->cmd); // complete the op
345 OpDone (SCpnt, DID_OK << 16);
347 irq_return:;
348 #if LINUX_VERSION_CODE < LINUXVERSION(2,1,95)
350 * Restore the original flags which will enable interrupts
351 * if and only if they were enabled on entry.
353 restore_flags (flags);
354 #else /* version >= v2.1.95 */
356 * Release the I/O spinlock and restore the original flags
357 * which will enable interrupts if and only if they were
358 * enabled on entry.
360 spin_unlock_irqrestore (&io_request_lock, flags);
361 #endif /* version >= v2.1.95 */
363 /****************************************************************
364 * Name: Pci2000_QueueCommand
366 * Description: Process a queued command from the SCSI manager.
368 * Parameters: SCpnt - Pointer to SCSI command structure.
369 * done - Pointer to done function to call.
371 * Returns: Status code.
373 ****************************************************************/
374 int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
376 UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB
377 PADAPTER2000 padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure
378 int rc = -1; // command return code
379 UCHAR bus = SCpnt->channel;
380 UCHAR pun = SCpnt->target;
381 UCHAR lun = SCpnt->lun;
382 UCHAR cmd;
383 PDEV2000 pdev = &padapter->dev[bus][pun];
385 if ( !done )
387 printk("pci2000_queuecommand: %02X: done can't be NULL\n", *cdb);
388 return 0;
391 SCpnt->scsi_done = done;
392 pdev->SCpnt = SCpnt; // Save this command data
394 if ( WaitReady (padapter) )
396 rc = DID_ERROR;
397 goto finished;
400 outw_p (pun | (lun << 8), padapter->mb0);
402 if ( bus )
404 DEB (if(*cdb) printk ("\nCDB: %X- %X %X %X %X %X %X %X %X %X %X ", SCpnt->cmd_len, cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]));
405 DEB (if(*cdb) printk ("\ntimeout_per_command: %d, timeout_total: %d, timeout: %d, internal_timout: %d", SCpnt->timeout_per_command,
406 SCpnt->timeout_total, SCpnt->timeout, SCpnt->internal_timeout));
407 outl (SCpnt->timeout_per_command, padapter->mb1);
408 outb_p (CMD_SCSI_TIMEOUT, padapter->cmd);
409 if ( WaitReady (padapter) )
411 rc = DID_ERROR;
412 goto finished;
415 outw_p (pun | (lun << 8), padapter->mb0);
416 outw_p (SCpnt->cmd_len << 8, padapter->mb0 + 2);
417 outl (virt_to_bus (cdb), padapter->mb1);
418 if ( BuildSgList (SCpnt, padapter, pdev) )
419 cmd = CMD_SCSI_THRU;
420 else
421 cmd = CMD_SCSI_THRU_SG;
422 if ( (pdev->tag = Command (padapter, cmd)) == 0 )
423 rc = DID_TIME_OUT;
424 goto finished;
426 else
428 if ( lun )
430 rc = DID_BAD_TARGET;
431 goto finished;
435 switch ( *cdb )
437 case SCSIOP_INQUIRY: // inquiry CDB
438 if ( cdb[2] == SC_MY_RAID )
440 switch ( cdb[3] )
442 case MY_SCSI_REBUILD:
443 OpDone (SCpnt, PsiRaidCmd (padapter, CMD_RAID_REBUILD) << 16);
444 return 0;
445 case MY_SCSI_ALARMMUTE:
446 OpDone (SCpnt, PsiRaidCmd (padapter, CMD_RAID_MUTE) << 16);
447 return 0;
448 case MY_SCSI_DEMOFAIL:
449 OpDone (SCpnt, PsiRaidCmd (padapter, CMD_RAID_FAIL) << 16);
450 return 0;
451 default:
452 if ( SCpnt->use_sg )
454 rc = DID_ERROR;
455 goto finished;
457 else
458 outl (virt_to_bus (SCpnt->request_buffer), padapter->mb2);
459 outl (cdb[5], padapter->mb0);
460 outl (cdb[3], padapter->mb3);
461 cmd = CMD_DASD_RAID_RQ;
462 break;
464 break;
467 if ( SCpnt->use_sg )
469 outl (virt_to_bus (((struct scatterlist *)(SCpnt->request_buffer))->address), padapter->mb2);
471 else
473 outl (virt_to_bus (SCpnt->request_buffer), padapter->mb2);
475 outl (SCpnt->request_bufflen, padapter->mb3);
476 cmd = CMD_DASD_SCSI_INQ;
477 break;
479 case SCSIOP_TEST_UNIT_READY: // test unit ready CDB
480 outl (virt_to_bus (SCpnt->sense_buffer), padapter->mb2);
481 outl (sizeof (SCpnt->sense_buffer), padapter->mb3);
482 cmd = CMD_TEST_READY;
483 break;
485 case SCSIOP_READ_CAPACITY: // read capctiy CDB
486 if ( SCpnt->use_sg )
488 outl (virt_to_bus (((struct scatterlist *)(SCpnt->request_buffer))->address), padapter->mb2);
490 else
492 outl (virt_to_bus (SCpnt->request_buffer), padapter->mb2);
494 outl (8, padapter->mb3);
495 cmd = CMD_DASD_CAP;
496 break;
497 case SCSIOP_VERIFY: // verify CDB
498 outw_p ((USHORT)cdb[8] | ((USHORT)cdb[7] << 8), padapter->mb0 + 2);
499 outl (XSCSI2LONG (&cdb[2]), padapter->mb1);
500 cmd = CMD_READ_SG;
501 break;
502 case SCSIOP_READ: // read10 CDB
503 outw_p ((USHORT)cdb[8] | ((USHORT)cdb[7] << 8), padapter->mb0 + 2);
504 outl (XSCSI2LONG (&cdb[2]), padapter->mb1);
505 if ( BuildSgList (SCpnt, padapter, pdev) )
506 cmd = CMD_READ;
507 else
508 cmd = CMD_READ_SG;
509 break;
510 case SCSIOP_READ6: // read6 CDB
511 outw_p (cdb[4], padapter->mb0 + 2);
512 outl ((SCSI2LONG (&cdb[1])) & 0x001FFFFF, padapter->mb1);
513 if ( BuildSgList (SCpnt, padapter, pdev) )
514 cmd = CMD_READ;
515 else
516 cmd = CMD_READ_SG;
517 break;
518 case SCSIOP_WRITE: // write10 CDB
519 outw_p ((USHORT)cdb[8] | ((USHORT)cdb[7] << 8), padapter->mb0 + 2);
520 outl (XSCSI2LONG (&cdb[2]), padapter->mb1);
521 if ( BuildSgList (SCpnt, padapter, pdev) )
522 cmd = CMD_WRITE;
523 else
524 cmd = CMD_WRITE_SG;
525 break;
526 case SCSIOP_WRITE6: // write6 CDB
527 outw_p (cdb[4], padapter->mb0 + 2);
528 outl ((SCSI2LONG (&cdb[1])) & 0x001FFFFF, padapter->mb1);
529 if ( BuildSgList (SCpnt, padapter, pdev) )
530 cmd = CMD_WRITE;
531 else
532 cmd = CMD_WRITE_SG;
533 break;
534 case SCSIOP_START_STOP_UNIT:
535 cmd = CMD_EJECT_MEDIA;
536 break;
537 case SCSIOP_MEDIUM_REMOVAL:
538 switch ( cdb[4] )
540 case 0:
541 cmd = CMD_UNLOCK_DOOR;
542 break;
543 case 1:
544 cmd = CMD_LOCK_DOOR;
545 break;
546 default:
547 cmd = 0;
548 break;
550 if ( cmd )
551 break;
552 default:
553 DEB (printk ("pci2000_queuecommand: Unsupported command %02X\n", *cdb));
554 OpDone (SCpnt, DID_ERROR << 16);
555 return 0;
558 if ( (pdev->tag = Command (padapter, cmd)) == 0 )
559 rc = DID_TIME_OUT;
560 finished:;
561 if ( rc != -1 )
562 OpDone (SCpnt, rc << 16);
563 return 0;
565 /****************************************************************
566 * Name: internal_done :LOCAL
568 * Description: Done handler for non-queued commands
570 * Parameters: SCpnt - Pointer to SCSI command structure.
572 * Returns: Nothing.
574 ****************************************************************/
575 static void internal_done (Scsi_Cmnd * SCpnt)
577 SCpnt->SCp.Status++;
579 /****************************************************************
580 * Name: Pci2000_Command
582 * Description: Process a command from the SCSI manager.
584 * Parameters: SCpnt - Pointer to SCSI command structure.
586 * Returns: Status code.
588 ****************************************************************/
589 int Pci2000_Command (Scsi_Cmnd *SCpnt)
591 DEB(printk("pci2000_command: ..calling pci2000_queuecommand\n"));
593 Pci2000_QueueCommand (SCpnt, internal_done);
595 SCpnt->SCp.Status = 0;
596 while (!SCpnt->SCp.Status)
597 barrier ();
598 return SCpnt->result;
600 /****************************************************************
601 * Name: Pci2000_Detect
603 * Description: Detect and initialize our boards.
605 * Parameters: tpnt - Pointer to SCSI host template structure.
607 * Returns: Number of adapters installed.
609 ****************************************************************/
610 int Pci2000_Detect (Scsi_Host_Template *tpnt)
612 int found = 0;
613 int installed = 0;
614 struct Scsi_Host *pshost;
615 PADAPTER2000 padapter;
616 int z, zz;
617 int setirq;
618 #if LINUX_VERSION_CODE > LINUXVERSION(2,1,92)
619 struct pci_dev *pdev = NULL;
620 #else
621 UCHAR pci_bus, pci_device_fn;
622 #endif
624 #if LINUX_VERSION_CODE > LINUXVERSION(2,1,92)
625 if ( !pci_present () )
626 #else
627 if ( !pcibios_present () )
628 #endif
630 printk ("pci2000: PCI BIOS not present\n");
631 return 0;
634 #if LINUX_VERSION_CODE > LINUXVERSION(2,1,92)
635 while ( (pdev = pci_find_device (VENDOR_PSI, DEVICE_ROY_1, pdev)) != NULL )
636 #else
637 while ( !pcibios_find_device (VENDOR_PSI, DEVICE_ROY_1, found, &pci_bus, &pci_device_fn) )
638 #endif
640 pshost = scsi_register (tpnt, sizeof(ADAPTER2000));
641 padapter = HOSTDATA(pshost);
643 padapter->basePort = pdev->resource[1].start;
645 DEB (printk ("\nBase Regs = %#04X", padapter->basePort)); // get the base I/O port address
646 padapter->mb0 = padapter->basePort + RTR_MAILBOX; // get the 32 bit mail boxes
647 padapter->mb1 = padapter->basePort + RTR_MAILBOX + 4;
648 padapter->mb2 = padapter->basePort + RTR_MAILBOX + 8;
649 padapter->mb3 = padapter->basePort + RTR_MAILBOX + 12;
650 padapter->mb4 = padapter->basePort + RTR_MAILBOX + 16;
651 padapter->cmd = padapter->basePort + RTR_LOCAL_DOORBELL; // command register
652 padapter->tag = padapter->basePort + RTR_PCI_DOORBELL; // tag/response register
654 if ( WaitReady (padapter) )
655 goto unregister;
656 outb_p (0x84, padapter->mb0);
657 outb_p (CMD_SPECIFY, padapter->cmd);
658 if ( WaitReady (padapter) )
659 goto unregister;
661 #if LINUX_VERSION_CODE > LINUXVERSION(2,1,92)
662 pshost->irq = pdev->irq;
663 #else
664 pcibios_read_config_byte (pci_bus, pci_device_fn, PCI_INTERRUPT_LINE, &pshost->irq);
665 #endif
666 setirq = 1;
667 padapter->irqOwned = 0;
668 for ( z = 0; z < installed; z++ ) // scan for shared interrupts
670 if ( PsiHost[z]->irq == pshost->irq ) // if shared then, don't posses
671 setirq = 0;
673 if ( setirq ) // if not shared, posses
675 if ( request_irq (pshost->irq, Irq_Handler, SA_SHIRQ, "pci2000", padapter) < 0 )
677 if ( request_irq (pshost->irq, Irq_Handler, SA_INTERRUPT | SA_SHIRQ, "pci2000", padapter) < 0 )
679 printk ("Unable to allocate IRQ for PCI-2000 controller.\n");
680 goto unregister;
683 padapter->irqOwned = pshost->irq; // set IRQ as owned
685 PsiHost[installed] = pshost; // save SCSI_HOST pointer
687 pshost->io_port = padapter->basePort;
688 pshost->n_io_port = 0xFF;
689 pshost->unique_id = padapter->basePort;
690 pshost->max_id = 16;
691 pshost->max_channel = 1;
693 for ( zz = 0; zz < MAX_BUS; zz++ )
694 for ( z = 0; z < MAX_UNITS; z++ )
695 padapter->dev[zz][z].tag = 0;
697 printk("\nPSI-2000 Intelligent Storage SCSI CONTROLLER: at I/O = %X IRQ = %d\n", padapter->basePort, pshost->irq);
698 printk("Version %s, Compiled %s %s\n\n", PCI2000_VERSION, __DATE__, __TIME__);
699 found++;
700 if ( ++installed < MAXADAPTER )
701 continue;
702 break;
703 unregister:;
704 scsi_unregister (pshost);
705 found++;
707 NumAdapters = installed;
708 return installed;
710 /****************************************************************
711 * Name: Pci2000_Abort
713 * Description: Process the Abort command from the SCSI manager.
715 * Parameters: SCpnt - Pointer to SCSI command structure.
717 * Returns: Allways snooze.
719 ****************************************************************/
720 int Pci2000_Abort (Scsi_Cmnd *SCpnt)
722 DEB (printk ("pci2000_abort\n"));
723 return SCSI_ABORT_SNOOZE;
725 /****************************************************************
726 * Name: Pci2000_Reset
728 * Description: Process the Reset command from the SCSI manager.
730 * Parameters: SCpnt - Pointer to SCSI command structure.
731 * flags - Flags about the reset command
733 * Returns: No active command at this time, so this means
734 * that each time we got some kind of response the
735 * last time through. Tell the mid-level code to
736 * request sense information in order to decide what
737 * to do next.
739 ****************************************************************/
740 int Pci2000_Reset (Scsi_Cmnd *SCpnt, unsigned int reset_flags)
742 return SCSI_RESET_PUNT;
744 /****************************************************************
745 * Name: Pci2000_Release
747 * Description: Release resources allocated for a single each adapter.
749 * Parameters: pshost - Pointer to SCSI command structure.
751 * Returns: zero.
753 ****************************************************************/
754 int Pci2000_Release (struct Scsi_Host *pshost)
756 PADAPTER2000 padapter = HOSTDATA (pshost);
758 if ( padapter->irqOwned )
759 #if LINUX_VERSION_CODE < LINUXVERSION(1,3,70)
760 free_irq (pshost->irq);
761 #else /* version >= v1.3.70 */
762 free_irq (pshost->irq, padapter);
763 #endif /* version >= v1.3.70 */
764 release_region (pshost->io_port, pshost->n_io_port);
765 scsi_unregister(pshost);
766 return 0;
769 #include "sd.h"
770 /****************************************************************
771 * Name: Pci2000_BiosParam
773 * Description: Process the biosparam request from the SCSI manager to
774 * return C/H/S data.
776 * Parameters: disk - Pointer to SCSI disk structure.
777 * dev - Major/minor number from kernel.
778 * geom - Pointer to integer array to place geometry data.
780 * Returns: zero.
782 ****************************************************************/
783 int Pci2000_BiosParam (Scsi_Disk *disk, kdev_t dev, int geom[])
785 PADAPTER2000 padapter;
787 padapter = HOSTDATA(disk->device->host);
789 if ( WaitReady (padapter) )
790 return 0;
791 outb_p (disk->device->id, padapter->mb0);
792 outb_p (CMD_GET_PARMS, padapter->cmd);
793 if ( WaitReady (padapter) )
794 return 0;
796 geom[0] = inb_p (padapter->mb2 + 3);
797 geom[1] = inb_p (padapter->mb2 + 2);
798 geom[2] = inw_p (padapter->mb2);
799 return 0;
803 #ifdef MODULE
804 /* Eventually this will go into an include file, but this will be later */
805 Scsi_Host_Template driver_template = PCI2000;
807 #include "scsi_module.c"
808 #endif