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.
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
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 * Revisions 1.20 Mar-27-2000
33 * - Added support for dynamic DMA
35 ****************************************************************************/
36 #define PCI2000_VERSION "1.20"
38 #include <linux/blkdev.h>
39 #include <linux/interrupt.h>
40 #include <linux/module.h>
41 #include <linux/kernel.h>
42 #include <linux/types.h>
43 #include <linux/string.h>
44 #include <linux/pci.h>
45 #include <linux/ioport.h>
46 #include <linux/delay.h>
47 #include <linux/sched.h>
48 #include <linux/proc_fs.h>
49 #include <linux/stat.h>
50 #include <linux/spinlock.h>
53 #include <asm/system.h>
57 #include <scsi/scsi_host.h>
66 #define STOP_HERE {int st;for(st=0;st<100;st++){st=1;}}
76 } SCATGATH
, *PSCATGATH
;
82 dma_addr_t scatGathDma
;
100 DEV2000 dev
[MAX_BUS
][MAX_UNITS
];
101 } ADAPTER2000
, *PADAPTER2000
;
103 #define HOSTDATA(host) ((PADAPTER2000)&host->hostdata)
104 #define consistentLen (MAX_BUS * MAX_UNITS * (16 * sizeof (SCATGATH) + MAX_COMMAND_SIZE))
107 static struct Scsi_Host
*PsiHost
[MAXADAPTER
] = {NULL
,}; // One for each adapter
108 static int NumAdapters
= 0;
109 /****************************************************************
110 * Name: WaitReady :LOCAL
112 * Description: Wait for controller ready.
114 * Parameters: padapter - Pointer adapter data structure.
116 * Returns: TRUE on not ready.
118 ****************************************************************/
119 static int WaitReady (PADAPTER2000 padapter
)
123 for ( z
= 0; z
< (TIMEOUT_COMMAND
* 4); z
++ )
125 if ( !inb_p (padapter
->cmd
) )
131 /****************************************************************
132 * Name: WaitReadyLong :LOCAL
134 * Description: Wait for controller ready.
136 * Parameters: padapter - Pointer adapter data structure.
138 * Returns: TRUE on not ready.
140 ****************************************************************/
141 static int WaitReadyLong (PADAPTER2000 padapter
)
145 for ( z
= 0; z
< (5000 * 4); z
++ )
147 if ( !inb_p (padapter
->cmd
) )
153 /****************************************************************
154 * Name: OpDone :LOCAL
156 * Description: Clean up operation and issue done to caller.
158 * Parameters: SCpnt - Pointer to SCSI command structure.
159 * status - Caller status.
163 ****************************************************************/
164 static void OpDone (Scsi_Cmnd
*SCpnt
, ULONG status
)
166 SCpnt
->result
= status
;
167 SCpnt
->scsi_done (SCpnt
);
169 /****************************************************************
170 * Name: Command :LOCAL
172 * Description: Issue queued command to the PCI-2000.
174 * Parameters: padapter - Pointer to adapter information structure.
175 * cmd - PCI-2000 command byte.
177 * Returns: Non-zero command tag if operation is accepted.
179 ****************************************************************/
180 static UCHAR
Command (PADAPTER2000 padapter
, UCHAR cmd
)
182 outb_p (cmd
, padapter
->cmd
);
183 if ( WaitReady (padapter
) )
186 if ( inw_p (padapter
->mb0
) )
189 return inb_p (padapter
->mb1
);
191 /****************************************************************
192 * Name: BuildSgList :LOCAL
194 * Description: Build the scatter gather list for controller.
196 * Parameters: SCpnt - Pointer to SCSI command structure.
197 * padapter - Pointer to adapter information structure.
198 * pdev - Pointer to adapter device structure.
200 * Returns: Non-zero in not scatter gather.
202 ****************************************************************/
203 static int BuildSgList (Scsi_Cmnd
*SCpnt
, PADAPTER2000 padapter
, PDEV2000 pdev
)
207 struct scatterlist
*sg
;
211 sg
= (struct scatterlist
*)SCpnt
->request_buffer
;
212 zc
= pci_map_sg (padapter
->pdev
, sg
, SCpnt
->use_sg
, SCpnt
->sc_data_direction
);
213 for ( z
= 0; z
< zc
; z
++ )
215 pdev
->scatGath
[z
].address
= cpu_to_le32 (sg_dma_address (sg
));
216 pdev
->scatGath
[z
].length
= cpu_to_le32 (sg_dma_len (sg
++));
218 outl (pdev
->scatGathDma
, padapter
->mb2
);
219 outl ((zc
<< 24) | SCpnt
->request_bufflen
, padapter
->mb3
);
222 if ( !SCpnt
->request_bufflen
)
224 outl (0, padapter
->mb2
);
225 outl (0, padapter
->mb3
);
228 SCpnt
->SCp
.have_data_in
= pci_map_single (padapter
->pdev
,
229 SCpnt
->request_buffer
, SCpnt
->request_bufflen
,
230 SCpnt
->sc_data_direction
);
231 outl (SCpnt
->SCp
.have_data_in
, padapter
->mb2
);
232 outl (SCpnt
->request_bufflen
, padapter
->mb3
);
235 /*********************************************************************
238 * Description: Execute a simple command.
240 * Parameters: padapter - Pointer to adapter control structure.
241 * cmd - Roy command byte.
243 * Returns: Return error status.
245 ********************************************************************/
246 static int PsiRaidCmd (PADAPTER2000 padapter
, char cmd
)
248 if ( WaitReady (padapter
) ) // test for command register ready
250 outb_p (cmd
, padapter
->cmd
); // issue command
251 if ( WaitReadyLong (padapter
) ) // wait for adapter ready
255 /****************************************************************
256 * Name: Irq_Handler :LOCAL
258 * Description: Interrupt handler.
260 * Parameters: irq - Hardware IRQ number.
264 * Returns: TRUE if drive is not ready in time.
266 ****************************************************************/
267 static irqreturn_t
Irq_Handler (int irq
, void *dev_id
, struct pt_regs
*regs
)
269 struct Scsi_Host
*shost
= NULL
; // Pointer to host data block
270 PADAPTER2000 padapter
; // Pointer to adapter control structure
282 DEB(printk ("\npci2000 received interrupt "));
283 for ( z
= 0; z
< NumAdapters
; z
++ ) // scan for interrupt to process
285 if ( PsiHost
[z
]->irq
== (UCHAR
)(irq
& 0xFF) )
287 tag
= inb_p (HOSTDATA(PsiHost
[z
])->tag
);
298 DEB (printk ("\npci2000: not my interrupt"));
303 spin_lock_irqsave(shost
->host_lock
, flags
);
304 padapter
= HOSTDATA(shost
);
306 tag0
= tag
& 0x7F; // mask off the error bit
307 for ( bus
= 0; bus
< MAX_BUS
; bus
++ ) // scan the busses
309 for ( pun
= 0; pun
< MAX_UNITS
; pun
++ ) // scan the targets
311 pdev
= &padapter
->dev
[bus
][pun
];
314 if ( pdev
->tag
== tag0
) // is this it?
323 outb_p (0xFF, padapter
->tag
); // clear the op interrupt
324 outb_p (CMD_DONE
, padapter
->cmd
); // complete the op
325 goto irq_return
; // done, but, with what?
330 switch ( SCpnt
->cmnd
[0] )
332 case SCSIOP_TEST_UNIT_READY
:
333 pci_unmap_single (padapter
->pdev
, SCpnt
->SCp
.have_data_in
, sizeof (SCpnt
->sense_buffer
), PCI_DMA_FROMDEVICE
);
335 case SCSIOP_READ_CAPACITY
:
336 pci_unmap_single (padapter
->pdev
, SCpnt
->SCp
.have_data_in
, 8, PCI_DMA_FROMDEVICE
);
339 case SCSIOP_START_STOP_UNIT
:
340 case SCSIOP_MEDIUM_REMOVAL
:
344 if ( SCpnt
->SCp
.have_data_in
)
345 pci_unmap_single (padapter
->pdev
, SCpnt
->SCp
.have_data_in
, SCpnt
->request_bufflen
, SCpnt
->sc_data_direction
);
349 pci_unmap_sg (padapter
->pdev
, (struct scatterlist
*)SCpnt
->request_buffer
, SCpnt
->use_sg
, SCpnt
->sc_data_direction
);
353 if ( tag
& ERR08_TAGGED
) // is there an error here?
355 if ( WaitReady (padapter
) )
357 OpDone (SCpnt
, DID_TIME_OUT
<< 16);
361 outb_p (tag0
, padapter
->mb0
); // get real error code
362 outb_p (CMD_ERROR
, padapter
->cmd
);
363 if ( WaitReady (padapter
) ) // wait for controller to suck up the op
365 OpDone (SCpnt
, DID_TIME_OUT
<< 16);
369 error
= inl (padapter
->mb0
); // get error data
370 outb_p (0xFF, padapter
->tag
); // clear the op interrupt
371 outb_p (CMD_DONE
, padapter
->cmd
); // complete the op
373 DEB (printk ("status: %lX ", error
));
374 if ( error
== 0x00020002 ) // is this error a check condition?
376 if ( bus
) // are we doint SCSI commands?
378 OpDone (SCpnt
, (DID_OK
<< 16) | 2);
381 if ( *SCpnt
->cmnd
== SCSIOP_TEST_UNIT_READY
)
382 OpDone (SCpnt
, (DRIVER_SENSE
<< 24) | (DID_OK
<< 16) | 2); // test caller we have sense data too
384 OpDone (SCpnt
, DID_ERROR
<< 16);
387 OpDone (SCpnt
, DID_ERROR
<< 16);
391 outb_p (0xFF, padapter
->tag
); // clear the op interrupt
392 outb_p (CMD_DONE
, padapter
->cmd
); // complete the op
393 OpDone (SCpnt
, DID_OK
<< 16);
396 spin_unlock_irqrestore(shost
->host_lock
, flags
);
398 return IRQ_RETVAL(handled
);
400 /****************************************************************
401 * Name: Pci2000_QueueCommand
403 * Description: Process a queued command from the SCSI manager.
405 * Parameters: SCpnt - Pointer to SCSI command structure.
406 * done - Pointer to done function to call.
408 * Returns: Status code.
410 ****************************************************************/
411 int Pci2000_QueueCommand (Scsi_Cmnd
*SCpnt
, void (*done
)(Scsi_Cmnd
*))
413 UCHAR
*cdb
= (UCHAR
*)SCpnt
->cmnd
; // Pointer to SCSI CDB
414 PADAPTER2000 padapter
= HOSTDATA(SCpnt
->device
->host
); // Pointer to adapter control structure
415 int rc
= -1; // command return code
416 UCHAR bus
= SCpnt
->device
->channel
;
417 UCHAR pun
= SCpnt
->device
->id
;
418 UCHAR lun
= SCpnt
->device
->lun
;
420 PDEV2000 pdev
= &padapter
->dev
[bus
][pun
];
424 printk("pci2000_queuecommand: %02X: done can't be NULL\n", *cdb
);
428 SCpnt
->scsi_done
= done
;
429 SCpnt
->SCp
.have_data_in
= 0;
430 pdev
->SCpnt
= SCpnt
; // Save this command data
432 if ( WaitReady (padapter
) )
438 outw_p (pun
| (lun
<< 8), padapter
->mb0
);
442 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]));
443 DEB (if(*cdb
) printk ("\ntimeout_per_command: %d, timeout_total: %d, timeout: %d", SCpnt
->timeout_per_command
,
444 SCpnt
->timeout_total
, SCpnt
->timeout
));
445 outl (SCpnt
->timeout_per_command
, padapter
->mb1
);
446 outb_p (CMD_SCSI_TIMEOUT
, padapter
->cmd
);
447 if ( WaitReady (padapter
) )
453 outw_p (pun
| (lun
<< 8), padapter
->mb0
);
454 outw_p (SCpnt
->cmd_len
<< 8, padapter
->mb0
+ 2);
455 memcpy (pdev
->cdb
, cdb
, MAX_COMMAND_SIZE
);
457 outl (pdev
->cdbDma
, padapter
->mb1
);
458 if ( BuildSgList (SCpnt
, padapter
, pdev
) )
461 cmd
= CMD_SCSI_THRU_SG
;
462 if ( (pdev
->tag
= Command (padapter
, cmd
)) == 0 )
477 case SCSIOP_INQUIRY
: // inquiry CDB
478 if ( cdb
[2] == SC_MY_RAID
)
482 case MY_SCSI_REBUILD
:
483 OpDone (SCpnt
, PsiRaidCmd (padapter
, CMD_RAID_REBUILD
) << 16);
485 case MY_SCSI_ALARMMUTE
:
486 OpDone (SCpnt
, PsiRaidCmd (padapter
, CMD_RAID_MUTE
) << 16);
488 case MY_SCSI_DEMOFAIL
:
489 OpDone (SCpnt
, PsiRaidCmd (padapter
, CMD_RAID_FAIL
) << 16);
499 SCpnt
->SCp
.have_data_in
= pci_map_single (padapter
->pdev
, SCpnt
->request_buffer
, SCpnt
->request_bufflen
,
500 SCpnt
->sc_data_direction
);
501 outl (SCpnt
->SCp
.have_data_in
, padapter
->mb2
);
503 outl (cdb
[5], padapter
->mb0
);
504 outl (cdb
[3], padapter
->mb3
);
505 cmd
= CMD_DASD_RAID_RQ
;
513 SCpnt
->SCp
.have_data_in
= pci_map_single (padapter
->pdev
,
514 ((struct scatterlist
*)SCpnt
->request_buffer
)->address
,
515 SCpnt
->request_bufflen
,
516 SCpnt
->sc_data_direction
);
520 SCpnt
->SCp
.have_data_in
= pci_map_single (padapter
->pdev
, SCpnt
->request_buffer
,
521 SCpnt
->request_bufflen
,
522 SCpnt
->sc_data_direction
);
524 outl (SCpnt
->SCp
.have_data_in
, padapter
->mb2
);
525 outl (SCpnt
->request_bufflen
, padapter
->mb3
);
526 cmd
= CMD_DASD_SCSI_INQ
;
529 case SCSIOP_TEST_UNIT_READY
: // test unit ready CDB
530 SCpnt
->SCp
.have_data_in
= pci_map_single (padapter
->pdev
, SCpnt
->sense_buffer
, sizeof (SCpnt
->sense_buffer
), PCI_DMA_FROMDEVICE
);
531 outl (SCpnt
->SCp
.have_data_in
, padapter
->mb2
);
532 outl (sizeof (SCpnt
->sense_buffer
), padapter
->mb3
);
533 cmd
= CMD_TEST_READY
;
536 case SCSIOP_READ_CAPACITY
: // read capacity CDB
539 SCpnt
->SCp
.have_data_in
= pci_map_single (padapter
->pdev
, ((struct scatterlist
*)(SCpnt
->request_buffer
))->address
,
540 8, PCI_DMA_FROMDEVICE
);
543 SCpnt
->SCp
.have_data_in
= pci_map_single (padapter
->pdev
, SCpnt
->request_buffer
, 8, PCI_DMA_FROMDEVICE
);
544 outl (SCpnt
->SCp
.have_data_in
, padapter
->mb2
);
545 outl (8, padapter
->mb3
);
548 case SCSIOP_VERIFY
: // verify CDB
549 outw_p ((USHORT
)cdb
[8] | ((USHORT
)cdb
[7] << 8), padapter
->mb0
+ 2);
550 outl (XSCSI2LONG (&cdb
[2]), padapter
->mb1
);
553 case SCSIOP_READ
: // read10 CDB
554 outw_p ((USHORT
)cdb
[8] | ((USHORT
)cdb
[7] << 8), padapter
->mb0
+ 2);
555 outl (XSCSI2LONG (&cdb
[2]), padapter
->mb1
);
556 if ( BuildSgList (SCpnt
, padapter
, pdev
) )
561 case SCSIOP_READ6
: // read6 CDB
562 outw_p (cdb
[4], padapter
->mb0
+ 2);
563 outl ((SCSI2LONG (&cdb
[1])) & 0x001FFFFF, padapter
->mb1
);
564 if ( BuildSgList (SCpnt
, padapter
, pdev
) )
569 case SCSIOP_WRITE
: // write10 CDB
570 outw_p ((USHORT
)cdb
[8] | ((USHORT
)cdb
[7] << 8), padapter
->mb0
+ 2);
571 outl (XSCSI2LONG (&cdb
[2]), padapter
->mb1
);
572 if ( BuildSgList (SCpnt
, padapter
, pdev
) )
577 case SCSIOP_WRITE6
: // write6 CDB
578 outw_p (cdb
[4], padapter
->mb0
+ 2);
579 outl ((SCSI2LONG (&cdb
[1])) & 0x001FFFFF, padapter
->mb1
);
580 if ( BuildSgList (SCpnt
, padapter
, pdev
) )
585 case SCSIOP_START_STOP_UNIT
:
586 cmd
= CMD_EJECT_MEDIA
;
588 case SCSIOP_MEDIUM_REMOVAL
:
592 cmd
= CMD_UNLOCK_DOOR
;
604 DEB (printk ("pci2000_queuecommand: Unsupported command %02X\n", *cdb
));
605 OpDone (SCpnt
, DID_ERROR
<< 16);
609 if ( (pdev
->tag
= Command (padapter
, cmd
)) == 0 )
613 OpDone (SCpnt
, rc
<< 16);
616 /****************************************************************
617 * Name: Pci2000_Detect
619 * Description: Detect and initialize our boards.
621 * Parameters: tpnt - Pointer to SCSI host template structure.
623 * Returns: Number of adapters installed.
625 ****************************************************************/
626 int Pci2000_Detect (Scsi_Host_Template
*tpnt
)
630 struct Scsi_Host
*pshost
;
631 PADAPTER2000 padapter
;
634 struct pci_dev
*pdev
= NULL
;
636 dma_addr_t consistentDma
;
638 while ( (pdev
= pci_find_device (VENDOR_PSI
, DEVICE_ROY_1
, pdev
)) != NULL
)
640 if (pci_enable_device(pdev
))
642 pshost
= scsi_register (tpnt
, sizeof(ADAPTER2000
));
645 padapter
= HOSTDATA(pshost
);
647 padapter
->basePort
= pci_resource_start (pdev
, 1);
648 DEB (printk ("\nBase Regs = %#04X", padapter
->basePort
)); // get the base I/O port address
649 padapter
->mb0
= padapter
->basePort
+ RTR_MAILBOX
; // get the 32 bit mail boxes
650 padapter
->mb1
= padapter
->basePort
+ RTR_MAILBOX
+ 4;
651 padapter
->mb2
= padapter
->basePort
+ RTR_MAILBOX
+ 8;
652 padapter
->mb3
= padapter
->basePort
+ RTR_MAILBOX
+ 12;
653 padapter
->mb4
= padapter
->basePort
+ RTR_MAILBOX
+ 16;
654 padapter
->cmd
= padapter
->basePort
+ RTR_LOCAL_DOORBELL
; // command register
655 padapter
->tag
= padapter
->basePort
+ RTR_PCI_DOORBELL
; // tag/response register
656 padapter
->pdev
= pdev
;
658 if ( WaitReady (padapter
) )
660 outb_p (0x84, padapter
->mb0
);
661 outb_p (CMD_SPECIFY
, padapter
->cmd
);
662 if ( WaitReady (padapter
) )
665 consistent
= pci_alloc_consistent (pdev
, consistentLen
, &consistentDma
);
668 printk ("Unable to allocate DMA memory for PCI-2000 controller.\n");
672 scsi_set_device(pshost
, &pdev
->dev
);
673 pshost
->irq
= pdev
->irq
;
675 padapter
->irqOwned
= 0;
676 for ( z
= 0; z
< installed
; z
++ ) // scan for shared interrupts
678 if ( PsiHost
[z
]->irq
== pshost
->irq
) // if shared then, don't posses
681 if ( setirq
) // if not shared, posses
683 if ( request_irq (pshost
->irq
, Irq_Handler
, SA_SHIRQ
, "pci2000", padapter
) < 0 )
685 if ( request_irq (pshost
->irq
, Irq_Handler
, SA_INTERRUPT
| SA_SHIRQ
, "pci2000", padapter
) < 0 )
687 printk ("Unable to allocate IRQ for PCI-2000 controller.\n");
688 pci_free_consistent (pdev
, consistentLen
, consistent
, consistentDma
);
692 padapter
->irqOwned
= pshost
->irq
; // set IRQ as owned
694 PsiHost
[installed
] = pshost
; // save SCSI_HOST pointer
696 pshost
->io_port
= padapter
->basePort
;
697 pshost
->n_io_port
= 0xFF;
698 pshost
->unique_id
= padapter
->basePort
;
700 pshost
->max_channel
= 1;
702 for ( zz
= 0; zz
< MAX_BUS
; zz
++ )
703 for ( z
= 0; z
< MAX_UNITS
; z
++ )
705 padapter
->dev
[zz
][z
].tag
= 0;
706 padapter
->dev
[zz
][z
].scatGath
= (PSCATGATH
)consistent
;
707 padapter
->dev
[zz
][z
].scatGathDma
= consistentDma
;
708 consistent
+= 16 * sizeof (SCATGATH
);
709 consistentDma
+= 16 * sizeof (SCATGATH
);
710 padapter
->dev
[zz
][z
].cdb
= (UCHAR
*)consistent
;
711 padapter
->dev
[zz
][z
].cdbDma
= consistentDma
;
712 consistent
+= MAX_COMMAND_SIZE
;
713 consistentDma
+= MAX_COMMAND_SIZE
;
716 printk("\nPSI-2000 Intelligent Storage SCSI CONTROLLER: at I/O = %lX IRQ = %d\n", padapter
->basePort
, pshost
->irq
);
717 printk("Version %s, Compiled %s %s\n\n", PCI2000_VERSION
, __DATE__
, __TIME__
);
719 if ( ++installed
< MAXADAPTER
)
723 scsi_unregister (pshost
);
726 NumAdapters
= installed
;
729 /****************************************************************
730 * Name: Pci2000_Abort
732 * Description: Process the Abort command from the SCSI manager.
734 * Parameters: SCpnt - Pointer to SCSI command structure.
736 * Returns: Allways snooze.
738 ****************************************************************/
739 int Pci2000_Abort (Scsi_Cmnd
*SCpnt
)
741 DEB (printk ("pci2000_abort\n"));
742 return SCSI_ABORT_SNOOZE
;
744 /****************************************************************
745 * Name: Pci2000_Reset
747 * Description: Process the Reset command from the SCSI manager.
749 * Parameters: SCpnt - Pointer to SCSI command structure.
750 * flags - Flags about the reset command
752 * Returns: No active command at this time, so this means
753 * that each time we got some kind of response the
754 * last time through. Tell the mid-level code to
755 * request sense information in order to decide what
758 ****************************************************************/
759 int Pci2000_Reset (Scsi_Cmnd
*SCpnt
, unsigned int reset_flags
)
761 return SCSI_RESET_PUNT
;
763 /****************************************************************
764 * Name: Pci2000_Release
766 * Description: Release resources allocated for a single each adapter.
768 * Parameters: pshost - Pointer to SCSI command structure.
772 ****************************************************************/
773 int Pci2000_Release (struct Scsi_Host
*pshost
)
775 PADAPTER2000 padapter
= HOSTDATA (pshost
);
777 if ( padapter
->irqOwned
)
778 free_irq (pshost
->irq
, padapter
);
779 pci_free_consistent (padapter
->pdev
, consistentLen
, padapter
->dev
[0][0].scatGath
, padapter
->dev
[0][0].scatGathDma
);
780 release_region (pshost
->io_port
, pshost
->n_io_port
);
781 scsi_unregister(pshost
);
785 /****************************************************************
786 * Name: Pci2000_BiosParam
788 * Description: Process the biosparam request from the SCSI manager to
791 * Parameters: disk - Pointer to SCSI disk structure.
792 * dev - Major/minor number from kernel.
793 * geom - Pointer to integer array to place geometry data.
797 ****************************************************************/
798 int Pci2000_BiosParam (struct scsi_device
*sdev
, struct block_device
*dev
,
799 sector_t capacity
, int geom
[])
801 PADAPTER2000 padapter
;
803 padapter
= HOSTDATA(sdev
->host
);
805 if ( WaitReady (padapter
) )
807 outb_p (sdev
->id
, padapter
->mb0
);
808 outb_p (CMD_GET_PARMS
, padapter
->cmd
);
809 if ( WaitReady (padapter
) )
812 geom
[0] = inb_p (padapter
->mb2
+ 3);
813 geom
[1] = inb_p (padapter
->mb2
+ 2);
814 geom
[2] = inw_p (padapter
->mb2
);
819 MODULE_LICENSE("Dual BSD/GPL");
821 static Scsi_Host_Template driver_template
= {
822 .proc_name
= "pci2000",
823 .name
= "PCI-2000 SCSI Intelligent Disk Controller",
824 .detect
= Pci2000_Detect
,
825 .release
= Pci2000_Release
,
826 .queuecommand
= Pci2000_QueueCommand
,
827 .abort
= Pci2000_Abort
,
828 .reset
= Pci2000_Reset
,
829 .bios_param
= Pci2000_BiosParam
,
834 .use_clustering
= DISABLE_CLUSTERING
,
836 #include "scsi_module.c"