aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/Kconfig11
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/psi240i.c689
-rw-r--r--drivers/scsi/psi240i.h315
-rw-r--r--drivers/scsi/psi_chip.h195
5 files changed, 0 insertions, 1211 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a6676be87843..ad44557fe204 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1288,17 +1288,6 @@ config SCSI_PAS16
1288 To compile this driver as a module, choose M here: the 1288 To compile this driver as a module, choose M here: the
1289 module will be called pas16. 1289 module will be called pas16.
1290 1290
1291config SCSI_PSI240I
1292 tristate "PSI240i support"
1293 depends on ISA && SCSI
1294 help
1295 This is support for the PSI240i EIDE interface card which acts as a
1296 SCSI host adapter. Please read the SCSI-HOWTO, available from
1297 <http://www.tldp.org/docs.html#howto>.
1298
1299 To compile this driver as a module, choose M here: the
1300 module will be called psi240i.
1301
1302config SCSI_QLOGIC_FAS 1291config SCSI_QLOGIC_FAS
1303 tristate "Qlogic FAS SCSI support" 1292 tristate "Qlogic FAS SCSI support"
1304 depends on ISA && SCSI 1293 depends on ISA && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 2e6129f13d38..2cd739c0ac33 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -59,7 +59,6 @@ obj-$(CONFIG_MVME16x_SCSI) += 53c700.o mvme16x_scsi.o
59obj-$(CONFIG_BVME6000_SCSI) += 53c700.o bvme6000_scsi.o 59obj-$(CONFIG_BVME6000_SCSI) += 53c700.o bvme6000_scsi.o
60obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o 60obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o
61obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o 61obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o
62obj-$(CONFIG_SCSI_PSI240I) += psi240i.o
63obj-$(CONFIG_SCSI_BUSLOGIC) += BusLogic.o 62obj-$(CONFIG_SCSI_BUSLOGIC) += BusLogic.o
64obj-$(CONFIG_SCSI_DPT_I2O) += dpt_i2o.o 63obj-$(CONFIG_SCSI_DPT_I2O) += dpt_i2o.o
65obj-$(CONFIG_SCSI_U14_34F) += u14-34f.o 64obj-$(CONFIG_SCSI_U14_34F) += u14-34f.o
diff --git a/drivers/scsi/psi240i.c b/drivers/scsi/psi240i.c
deleted file mode 100644
index 899e89d6fe67..000000000000
--- a/drivers/scsi/psi240i.c
+++ /dev/null
@@ -1,689 +0,0 @@
1/*+M*************************************************************************
2 * Perceptive Solutions, Inc. PSI-240I device driver proc support for Linux.
3 *
4 * Copyright (c) 1997 Perceptive Solutions, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 *
21 * File Name: psi240i.c
22 *
23 * Description: SCSI driver for the PSI240I EIDE interface card.
24 *
25 *-M*************************************************************************/
26
27#include <linux/module.h>
28
29#include <linux/blkdev.h>
30#include <linux/kernel.h>
31#include <linux/types.h>
32#include <linux/string.h>
33#include <linux/ioport.h>
34#include <linux/delay.h>
35#include <linux/interrupt.h>
36#include <linux/proc_fs.h>
37#include <linux/spinlock.h>
38#include <linux/stat.h>
39
40#include <asm/dma.h>
41#include <asm/system.h>
42#include <asm/io.h>
43#include "scsi.h"
44#include <scsi/scsi_host.h>
45
46#include "psi240i.h"
47#include "psi_chip.h"
48
49//#define DEBUG 1
50
51#ifdef DEBUG
52#define DEB(x) x
53#else
54#define DEB(x)
55#endif
56
57#define MAXBOARDS 6 /* Increase this and the sizes of the arrays below, if you need more. */
58
59#define PORT_DATA 0
60#define PORT_ERROR 1
61#define PORT_SECTOR_COUNT 2
62#define PORT_LBA_0 3
63#define PORT_LBA_8 4
64#define PORT_LBA_16 5
65#define PORT_LBA_24 6
66#define PORT_STAT_CMD 7
67#define PORT_SEL_FAIL 8
68#define PORT_IRQ_STATUS 9
69#define PORT_ADDRESS 10
70#define PORT_FAIL 11
71#define PORT_ALT_STAT 12
72
73typedef struct
74 {
75 UCHAR device; // device code
76 UCHAR byte6; // device select register image
77 UCHAR spigot; // spigot number
78 UCHAR expectingIRQ; // flag for expecting and interrupt
79 USHORT sectors; // number of sectors per track
80 USHORT heads; // number of heads
81 USHORT cylinders; // number of cylinders for this device
82 USHORT spareword; // placeholder
83 ULONG blocks; // number of blocks on device
84 } OUR_DEVICE, *POUR_DEVICE;
85
86typedef struct
87 {
88 USHORT ports[13];
89 OUR_DEVICE device[8];
90 struct scsi_cmnd *pSCmnd;
91 IDE_STRUCT ide;
92 ULONG startSector;
93 USHORT sectorCount;
94 struct scsi_cmnd *SCpnt;
95 VOID *buffer;
96 USHORT expectingIRQ;
97 } ADAPTER240I, *PADAPTER240I;
98
99#define HOSTDATA(host) ((PADAPTER240I)&host->hostdata)
100
101static struct Scsi_Host *PsiHost[6] = {NULL,}; /* One for each IRQ level (10-15) */
102static IDENTIFY_DATA identifyData;
103static SETUP ChipSetup;
104
105static USHORT portAddr[6] = {CHIP_ADRS_0, CHIP_ADRS_1, CHIP_ADRS_2, CHIP_ADRS_3, CHIP_ADRS_4, CHIP_ADRS_5};
106
107/****************************************************************
108 * Name: WriteData :LOCAL
109 *
110 * Description: Write data to device.
111 *
112 * Parameters: padapter - Pointer adapter data structure.
113 *
114 * Returns: TRUE if drive does not assert DRQ in time.
115 *
116 ****************************************************************/
117static int WriteData (PADAPTER240I padapter)
118 {
119 ULONG timer;
120 USHORT *pports = padapter->ports;
121
122 timer = jiffies + TIMEOUT_DRQ; // calculate the timeout value
123 do {
124 if ( inb_p (pports[PORT_STAT_CMD]) & IDE_STATUS_DRQ )
125 {
126 outsw (pports[PORT_DATA], padapter->buffer, (USHORT)padapter->ide.ide.ide[2] * 256);
127 return 0;
128 }
129 } while ( time_after(timer, jiffies) ); // test for timeout
130
131 padapter->ide.ide.ides.cmd = 0; // null out the command byte
132 return 1;
133 }
134/****************************************************************
135 * Name: IdeCmd :LOCAL
136 *
137 * Description: Process a queued command from the SCSI manager.
138 *
139 * Parameters: padapter - Pointer adapter data structure.
140 *
141 * Returns: Zero if no error or status register contents on error.
142 *
143 ****************************************************************/
144static UCHAR IdeCmd (PADAPTER240I padapter)
145 {
146 ULONG timer;
147 USHORT *pports = padapter->ports;
148 UCHAR status;
149
150 outb_p (padapter->ide.ide.ides.spigot, pports[PORT_SEL_FAIL]); // select the spigot
151 outb_p (padapter->ide.ide.ide[6], pports[PORT_LBA_24]); // select the drive
152 timer = jiffies + TIMEOUT_READY; // calculate the timeout value
153 do {
154 status = inb_p (padapter->ports[PORT_STAT_CMD]);
155 if ( status & IDE_STATUS_DRDY )
156 {
157 outb_p (padapter->ide.ide.ide[2], pports[PORT_SECTOR_COUNT]);
158 outb_p (padapter->ide.ide.ide[3], pports[PORT_LBA_0]);
159 outb_p (padapter->ide.ide.ide[4], pports[PORT_LBA_8]);
160 outb_p (padapter->ide.ide.ide[5], pports[PORT_LBA_16]);
161 padapter->expectingIRQ = 1;
162 outb_p (padapter->ide.ide.ide[7], pports[PORT_STAT_CMD]);
163
164 if ( padapter->ide.ide.ides.cmd == IDE_CMD_WRITE_MULTIPLE )
165 return (WriteData (padapter));
166
167 return 0;
168 }
169 } while ( time_after(timer, jiffies) ); // test for timeout
170
171 padapter->ide.ide.ides.cmd = 0; // null out the command byte
172 return status;
173 }
174/****************************************************************
175 * Name: SetupTransfer :LOCAL
176 *
177 * Description: Setup a data transfer command.
178 *
179 * Parameters: padapter - Pointer adapter data structure.
180 * drive - Drive/head register upper nibble only.
181 *
182 * Returns: TRUE if no data to transfer.
183 *
184 ****************************************************************/
185static int SetupTransfer (PADAPTER240I padapter, UCHAR drive)
186 {
187 if ( padapter->sectorCount )
188 {
189 *(ULONG *)padapter->ide.ide.ides.lba = padapter->startSector;
190 padapter->ide.ide.ide[6] |= drive;
191 padapter->ide.ide.ides.sectors = ( padapter->sectorCount > SECTORSXFER ) ? SECTORSXFER : padapter->sectorCount;
192 padapter->sectorCount -= padapter->ide.ide.ides.sectors; // bump the start and count for next xfer
193 padapter->startSector += padapter->ide.ide.ides.sectors;
194 return 0;
195 }
196 else
197 {
198 padapter->ide.ide.ides.cmd = 0; // null out the command byte
199 padapter->SCpnt = NULL;
200 return 1;
201 }
202 }
203/****************************************************************
204 * Name: DecodeError :LOCAL
205 *
206 * Description: Decode and process device errors.
207 *
208 * Parameters: pshost - Pointer to host data block.
209 * status - Status register code.
210 *
211 * Returns: The driver status code.
212 *
213 ****************************************************************/
214static ULONG DecodeError (struct Scsi_Host *pshost, UCHAR status)
215 {
216 PADAPTER240I padapter = HOSTDATA(pshost);
217 UCHAR error;
218
219 padapter->expectingIRQ = 0;
220 padapter->SCpnt = NULL;
221 if ( status & IDE_STATUS_WRITE_FAULT )
222 {
223 return DID_PARITY << 16;
224 }
225 if ( status & IDE_STATUS_BUSY )
226 return DID_BUS_BUSY << 16;
227
228 error = inb_p (padapter->ports[PORT_ERROR]);
229 DEB(printk ("\npsi240i error register: %x", error));
230 switch ( error )
231 {
232 case IDE_ERROR_AMNF:
233 case IDE_ERROR_TKONF:
234 case IDE_ERROR_ABRT:
235 case IDE_ERROR_IDFN:
236 case IDE_ERROR_UNC:
237 case IDE_ERROR_BBK:
238 default:
239 return DID_ERROR << 16;
240 }
241 return DID_ERROR << 16;
242 }
243/****************************************************************
244 * Name: Irq_Handler :LOCAL
245 *
246 * Description: Interrupt handler.
247 *
248 * Parameters: irq - Hardware IRQ number.
249 * dev_id -
250 *
251 * Returns: TRUE if drive is not ready in time.
252 *
253 ****************************************************************/
254static void Irq_Handler (int irq, void *dev_id)
255 {
256 struct Scsi_Host *shost; // Pointer to host data block
257 PADAPTER240I padapter; // Pointer to adapter control structure
258 USHORT *pports; // I/O port array
259 struct scsi_cmnd *SCpnt;
260 UCHAR status;
261 int z;
262
263 DEB(printk ("\npsi240i received interrupt\n"));
264
265 shost = PsiHost[irq - 10];
266 if ( !shost )
267 panic ("Splunge!");
268
269 padapter = HOSTDATA(shost);
270 pports = padapter->ports;
271 SCpnt = padapter->SCpnt;
272
273 if ( !padapter->expectingIRQ )
274 {
275 DEB(printk ("\npsi240i Unsolicited interrupt\n"));
276 return;
277 }
278 padapter->expectingIRQ = 0;
279
280 status = inb_p (padapter->ports[PORT_STAT_CMD]); // read the device status
281 if ( status & (IDE_STATUS_ERROR | IDE_STATUS_WRITE_FAULT) )
282 goto irqerror;
283
284 DEB(printk ("\npsi240i processing interrupt"));
285 switch ( padapter->ide.ide.ides.cmd ) // decide how to handle the interrupt
286 {
287 case IDE_CMD_READ_MULTIPLE:
288 if ( status & IDE_STATUS_DRQ )
289 {
290 insw (pports[PORT_DATA], padapter->buffer, (USHORT)padapter->ide.ide.ides.sectors * 256);
291 padapter->buffer += padapter->ide.ide.ides.sectors * 512;
292 if ( SetupTransfer (padapter, padapter->ide.ide.ide[6] & 0xF0) )
293 {
294 SCpnt->result = DID_OK << 16;
295 padapter->SCpnt = NULL;
296 SCpnt->scsi_done (SCpnt);
297 return;
298 }
299 if ( !(status = IdeCmd (padapter)) )
300 return;
301 }
302 break;
303
304 case IDE_CMD_WRITE_MULTIPLE:
305 padapter->buffer += padapter->ide.ide.ides.sectors * 512;
306 if ( SetupTransfer (padapter, padapter->ide.ide.ide[6] & 0xF0) )
307 {
308 SCpnt->result = DID_OK << 16;
309 padapter->SCpnt = NULL;
310 SCpnt->scsi_done (SCpnt);
311 return;
312 }
313 if ( !(status = IdeCmd (padapter)) )
314 return;
315 break;
316
317 case IDE_COMMAND_IDENTIFY:
318 {
319 PINQUIRYDATA pinquiryData = SCpnt->request_buffer;
320
321 if ( status & IDE_STATUS_DRQ )
322 {
323 insw (pports[PORT_DATA], &identifyData, sizeof (identifyData) >> 1);
324
325 memset (pinquiryData, 0, SCpnt->request_bufflen); // Zero INQUIRY data structure.
326 pinquiryData->DeviceType = 0;
327 pinquiryData->Versions = 2;
328 pinquiryData->AdditionalLength = 35 - 4;
329
330 // Fill in vendor identification fields.
331 for ( z = 0; z < 8; z += 2 )
332 {
333 pinquiryData->VendorId[z] = ((UCHAR *)identifyData.ModelNumber)[z + 1];
334 pinquiryData->VendorId[z + 1] = ((UCHAR *)identifyData.ModelNumber)[z];
335 }
336
337 // Initialize unused portion of product id.
338 for ( z = 0; z < 4; z++ )
339 pinquiryData->ProductId[12 + z] = ' ';
340
341 // Move firmware revision from IDENTIFY data to
342 // product revision in INQUIRY data.
343 for ( z = 0; z < 4; z += 2 )
344 {
345 pinquiryData->ProductRevisionLevel[z] = ((UCHAR *)identifyData.FirmwareRevision)[z + 1];
346 pinquiryData->ProductRevisionLevel[z + 1] = ((UCHAR *)identifyData.FirmwareRevision)[z];
347 }
348
349 SCpnt->result = DID_OK << 16;
350 padapter->SCpnt = NULL;
351 SCpnt->scsi_done (SCpnt);
352 return;
353 }
354 break;
355 }
356
357 default:
358 SCpnt->result = DID_OK << 16;
359 padapter->SCpnt = NULL;
360 SCpnt->scsi_done (SCpnt);
361 return;
362 }
363
364irqerror:;
365 DEB(printk ("\npsi240i error Device Status: %X\n", status));
366 SCpnt->result = DecodeError (shost, status);
367 SCpnt->scsi_done (SCpnt);
368 }
369
370static irqreturn_t do_Irq_Handler (int irq, void *dev_id)
371{
372 unsigned long flags;
373 struct Scsi_Host *dev = dev_id;
374
375 spin_lock_irqsave(dev->host_lock, flags);
376 Irq_Handler(irq, dev_id);
377 spin_unlock_irqrestore(dev->host_lock, flags);
378 return IRQ_HANDLED;
379}
380
381/****************************************************************
382 * Name: Psi240i_QueueCommand
383 *
384 * Description: Process a queued command from the SCSI manager.
385 *
386 * Parameters: SCpnt - Pointer to SCSI command structure.
387 * done - Pointer to done function to call.
388 *
389 * Returns: Status code.
390 *
391 ****************************************************************/
392static int Psi240i_QueueCommand(struct scsi_cmnd *SCpnt,
393 void (*done)(struct scsi_cmnd *))
394 {
395 UCHAR *cdb = (UCHAR *)SCpnt->cmnd;
396 // Pointer to SCSI CDB
397 PADAPTER240I padapter = HOSTDATA (SCpnt->device->host);
398 // Pointer to adapter control structure
399 POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];
400 // Pointer to device information
401 UCHAR rc;
402 // command return code
403
404 SCpnt->scsi_done = done;
405 padapter->ide.ide.ides.spigot = pdev->spigot;
406 padapter->buffer = SCpnt->request_buffer;
407 if (done)
408 {
409 if ( !pdev->device )
410 {
411 SCpnt->result = DID_BAD_TARGET << 16;
412 done (SCpnt);
413 return 0;
414 }
415 }
416 else
417 {
418 printk("psi240i_queuecommand: %02X: done can't be NULL\n", *cdb);
419 return 0;
420 }
421
422 switch ( *cdb )
423 {
424 case SCSIOP_INQUIRY: // inquiry CDB
425 {
426 padapter->ide.ide.ide[6] = pdev->byte6;
427 padapter->ide.ide.ides.cmd = IDE_COMMAND_IDENTIFY;
428 break;
429 }
430
431 case SCSIOP_TEST_UNIT_READY: // test unit ready CDB
432 SCpnt->result = DID_OK << 16;
433 done (SCpnt);
434 return 0;
435
436 case SCSIOP_READ_CAPACITY: // read capctiy CDB
437 {
438 PREAD_CAPACITY_DATA pdata = (PREAD_CAPACITY_DATA)SCpnt->request_buffer;
439
440 pdata->blksiz = 0x20000;
441 XANY2SCSI ((UCHAR *)&pdata->blks, pdev->blocks);
442 SCpnt->result = DID_OK << 16;
443 done (SCpnt);
444 return 0;
445 }
446
447 case SCSIOP_VERIFY: // verify CDB
448 *(ULONG *)padapter->ide.ide.ides.lba = XSCSI2LONG (&cdb[2]);
449 padapter->ide.ide.ide[6] |= pdev->byte6;
450 padapter->ide.ide.ide[2] = (UCHAR)((USHORT)cdb[8] | ((USHORT)cdb[7] << 8));
451 padapter->ide.ide.ides.cmd = IDE_COMMAND_VERIFY;
452 break;
453
454 case SCSIOP_READ: // read10 CDB
455 padapter->startSector = XSCSI2LONG (&cdb[2]);
456 padapter->sectorCount = (USHORT)cdb[8] | ((USHORT)cdb[7] << 8);
457 SetupTransfer (padapter, pdev->byte6);
458 padapter->ide.ide.ides.cmd = IDE_CMD_READ_MULTIPLE;
459 break;
460
461 case SCSIOP_READ6: // read6 CDB
462 padapter->startSector = SCSI2LONG (&cdb[1]);
463 padapter->sectorCount = cdb[4];
464 SetupTransfer (padapter, pdev->byte6);
465 padapter->ide.ide.ides.cmd = IDE_CMD_READ_MULTIPLE;
466 break;
467
468 case SCSIOP_WRITE: // write10 CDB
469 padapter->startSector = XSCSI2LONG (&cdb[2]);
470 padapter->sectorCount = (USHORT)cdb[8] | ((USHORT)cdb[7] << 8);
471 SetupTransfer (padapter, pdev->byte6);
472 padapter->ide.ide.ides.cmd = IDE_CMD_WRITE_MULTIPLE;
473 break;
474 case SCSIOP_WRITE6: // write6 CDB
475 padapter->startSector = SCSI2LONG (&cdb[1]);
476 padapter->sectorCount = cdb[4];
477 SetupTransfer (padapter, pdev->byte6);
478 padapter->ide.ide.ides.cmd = IDE_CMD_WRITE_MULTIPLE;
479 break;
480
481 default:
482 DEB (printk ("psi240i_queuecommand: Unsupported command %02X\n", *cdb));
483 SCpnt->result = DID_ERROR << 16;
484 done (SCpnt);
485 return 0;
486 }
487
488 padapter->SCpnt = SCpnt; // Save this command data
489
490 rc = IdeCmd (padapter);
491 if ( rc )
492 {
493 padapter->expectingIRQ = 0;
494 DEB (printk ("psi240i_queuecommand: %02X, %02X: Device failed to respond for command\n", *cdb, padapter->ide.ide.ides.cmd));
495 SCpnt->result = DID_ERROR << 16;
496 done (SCpnt);
497 return 0;
498 }
499 DEB (printk("psi240i_queuecommand: %02X, %02X now waiting for interrupt ", *cdb, padapter->ide.ide.ides.cmd));
500 return 0;
501 }
502
503/***************************************************************************
504 * Name: ReadChipMemory
505 *
506 * Description: Read information from controller memory.
507 *
508 * Parameters: psetup - Pointer to memory image of setup information.
509 * base - base address of memory.
510 * length - lenght of data space in bytes.
511 * port - I/O address of data port.
512 *
513 * Returns: Nothing.
514 *
515 **************************************************************************/
516static void ReadChipMemory (void *pdata, USHORT base, USHORT length, USHORT port)
517 {
518 USHORT z, zz;
519 UCHAR *pd = (UCHAR *)pdata;
520 outb_p (SEL_NONE, port + REG_SEL_FAIL); // setup data port
521 zz = 0;
522 while ( zz < length )
523 {
524 outw_p (base, port + REG_ADDRESS); // setup address
525
526 for ( z = 0; z < 8; z++ )
527 {
528 if ( (zz + z) < length )
529 *pd++ = inb_p (port + z); // read data byte
530 }
531 zz += 8;
532 base += 8;
533 }
534 }
535/****************************************************************
536 * Name: Psi240i_Detect
537 *
538 * Description: Detect and initialize our boards.
539 *
540 * Parameters: tpnt - Pointer to SCSI host template structure.
541 *
542 * Returns: Number of adapters found.
543 *
544 ****************************************************************/
545static int Psi240i_Detect (struct scsi_host_template *tpnt)
546 {
547 int board;
548 int count = 0;
549 int unit;
550 int z;
551 USHORT port, port_range = 16;
552 CHIP_CONFIG_N chipConfig;
553 CHIP_DEVICE_N chipDevice[8];
554 struct Scsi_Host *pshost;
555
556 for ( board = 0; board < MAXBOARDS; board++ ) // scan for I/O ports
557 {
558 pshost = NULL;
559 port = portAddr[board]; // get base address to test
560 if ( !request_region (port, port_range, "psi240i") )
561 continue;
562 if ( inb_p (port + REG_FAIL) != CHIP_ID ) // do the first test for likley hood that it is us
563 goto host_init_failure;
564 outb_p (SEL_NONE, port + REG_SEL_FAIL); // setup EEPROM/RAM access
565 outw (0, port + REG_ADDRESS); // setup EEPROM address zero
566 if ( inb_p (port) != 0x55 ) // test 1st byte
567 goto host_init_failure; // nope
568 if ( inb_p (port + 1) != 0xAA ) // test 2nd byte
569 goto host_init_failure; // nope
570
571 // at this point our board is found and can be accessed. Now we need to initialize
572 // our informatation and register with the kernel.
573
574
575 ReadChipMemory (&chipConfig, CHIP_CONFIG, sizeof (chipConfig), port);
576 ReadChipMemory (&chipDevice, CHIP_DEVICE, sizeof (chipDevice), port);
577 ReadChipMemory (&ChipSetup, CHIP_EEPROM_DATA, sizeof (ChipSetup), port);
578
579 if ( !chipConfig.numDrives ) // if no devices on this board
580 goto host_init_failure;
581
582 pshost = scsi_register (tpnt, sizeof(ADAPTER240I));
583 if(pshost == NULL)
584 goto host_init_failure;
585
586 PsiHost[chipConfig.irq - 10] = pshost;
587 pshost->unique_id = port;
588 pshost->io_port = port;
589 pshost->n_io_port = 16; /* Number of bytes of I/O space used */
590 pshost->irq = chipConfig.irq;
591
592 for ( z = 0; z < 11; z++ ) // build regester address array
593 HOSTDATA(pshost)->ports[z] = port + z;
594 HOSTDATA(pshost)->ports[11] = port + REG_FAIL;
595 HOSTDATA(pshost)->ports[12] = port + REG_ALT_STAT;
596 DEB (printk ("\nPorts ="));
597 DEB (for (z=0;z<13;z++) printk(" %#04X",HOSTDATA(pshost)->ports[z]););
598
599 for ( z = 0; z < chipConfig.numDrives; ++z )
600 {
601 unit = chipDevice[z].channel & 0x0F;
602 HOSTDATA(pshost)->device[unit].device = ChipSetup.setupDevice[unit].device;
603 HOSTDATA(pshost)->device[unit].byte6 = (UCHAR)(((unit & 1) << 4) | 0xE0);
604 HOSTDATA(pshost)->device[unit].spigot = (UCHAR)(1 << (unit >> 1));
605 HOSTDATA(pshost)->device[unit].sectors = ChipSetup.setupDevice[unit].sectors;
606 HOSTDATA(pshost)->device[unit].heads = ChipSetup.setupDevice[unit].heads;
607 HOSTDATA(pshost)->device[unit].cylinders = ChipSetup.setupDevice[unit].cylinders;
608 HOSTDATA(pshost)->device[unit].blocks = ChipSetup.setupDevice[unit].blocks;
609 DEB (printk ("\nHOSTDATA->device = %X", HOSTDATA(pshost)->device[unit].device));
610 DEB (printk ("\n byte6 = %X", HOSTDATA(pshost)->device[unit].byte6));
611 DEB (printk ("\n spigot = %X", HOSTDATA(pshost)->device[unit].spigot));
612 DEB (printk ("\n sectors = %X", HOSTDATA(pshost)->device[unit].sectors));
613 DEB (printk ("\n heads = %X", HOSTDATA(pshost)->device[unit].heads));
614 DEB (printk ("\n cylinders = %X", HOSTDATA(pshost)->device[unit].cylinders));
615 DEB (printk ("\n blocks = %lX", HOSTDATA(pshost)->device[unit].blocks));
616 }
617
618 if ( request_irq (chipConfig.irq, do_Irq_Handler, 0, "psi240i", pshost) == 0 )
619 {
620 printk("\nPSI-240I EIDE CONTROLLER: at I/O = %x IRQ = %d\n", port, chipConfig.irq);
621 printk("(C) 1997 Perceptive Solutions, Inc. All rights reserved\n\n");
622 count++;
623 continue;
624 }
625
626 printk ("Unable to allocate IRQ for PSI-240I controller.\n");
627
628host_init_failure:
629
630 release_region (port, port_range);
631 if (pshost)
632 scsi_unregister (pshost);
633
634 }
635 return count;
636 }
637
638static int Psi240i_Release(struct Scsi_Host *shost)
639{
640 if (shost->irq)
641 free_irq(shost->irq, NULL);
642 if (shost->io_port && shost->n_io_port)
643 release_region(shost->io_port, shost->n_io_port);
644 scsi_unregister(shost);
645 return 0;
646}
647
648/****************************************************************
649 * Name: Psi240i_BiosParam
650 *
651 * Description: Process the biosparam request from the SCSI manager to
652 * return C/H/S data.
653 *
654 * Parameters: disk - Pointer to SCSI disk structure.
655 * dev - Major/minor number from kernel.
656 * geom - Pointer to integer array to place geometry data.
657 *
658 * Returns: zero.
659 *
660 ****************************************************************/
661static int Psi240i_BiosParam (struct scsi_device *sdev, struct block_device *dev,
662 sector_t capacity, int geom[])
663 {
664 POUR_DEVICE pdev;
665
666 pdev = &(HOSTDATA(sdev->host)->device[sdev_id(sdev)]);
667
668 geom[0] = pdev->heads;
669 geom[1] = pdev->sectors;
670 geom[2] = pdev->cylinders;
671 return 0;
672 }
673
674MODULE_LICENSE("GPL");
675
676static struct scsi_host_template driver_template = {
677 .proc_name = "psi240i",
678 .name = "PSI-240I EIDE Disk Controller",
679 .detect = Psi240i_Detect,
680 .release = Psi240i_Release,
681 .queuecommand = Psi240i_QueueCommand,
682 .bios_param = Psi240i_BiosParam,
683 .can_queue = 1,
684 .this_id = -1,
685 .sg_tablesize = SG_NONE,
686 .cmd_per_lun = 1,
687 .use_clustering = DISABLE_CLUSTERING,
688};
689#include "scsi_module.c"
diff --git a/drivers/scsi/psi240i.h b/drivers/scsi/psi240i.h
deleted file mode 100644
index 21ebb9214004..000000000000
--- a/drivers/scsi/psi240i.h
+++ /dev/null
@@ -1,315 +0,0 @@
1/*+M*************************************************************************
2 * Perceptive Solutions, Inc. PSI-240I device driver proc support for Linux.
3 *
4 * Copyright (c) 1997 Perceptive Solutions, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 *
21 * File Name: psi240i.h
22 *
23 * Description: Header file for the SCSI driver for the PSI240I
24 * EIDE interface card.
25 *
26 *-M*************************************************************************/
27#ifndef _PSI240I_H
28#define _PSI240I_H
29
30#include <linux/types.h>
31
32#ifndef PSI_EIDE_SCSIOP
33#define PSI_EIDE_SCSIOP 1
34
35/************************************************/
36/* Some defines that we like */
37/************************************************/
38#define CHAR char
39#define UCHAR unsigned char
40#define SHORT short
41#define USHORT unsigned short
42#define BOOL unsigned short
43#define LONG long
44#define ULONG unsigned long
45#define VOID void
46
47/************************************************/
48/* Timeout konstants */
49/************************************************/
50#define TIMEOUT_READY 10 // 100 mSec
51#define TIMEOUT_DRQ 40 // 400 mSec
52
53/************************************************/
54/* Misc. macros */
55/************************************************/
56#define ANY2SCSI(up, p) \
57((UCHAR *)up)[0] = (((ULONG)(p)) >> 8); \
58((UCHAR *)up)[1] = ((ULONG)(p));
59
60#define SCSI2LONG(up) \
61( (((long)*(((UCHAR *)up))) << 16) \
62+ (((long)(((UCHAR *)up)[1])) << 8) \
63+ ((long)(((UCHAR *)up)[2])) )
64
65#define XANY2SCSI(up, p) \
66((UCHAR *)up)[0] = ((long)(p)) >> 24; \
67((UCHAR *)up)[1] = ((long)(p)) >> 16; \
68((UCHAR *)up)[2] = ((long)(p)) >> 8; \
69((UCHAR *)up)[3] = ((long)(p));
70
71#define XSCSI2LONG(up) \
72( (((long)(((UCHAR *)up)[0])) << 24) \
73+ (((long)(((UCHAR *)up)[1])) << 16) \
74+ (((long)(((UCHAR *)up)[2])) << 8) \
75+ ((long)(((UCHAR *)up)[3])) )
76
77/************************************************/
78/* SCSI CDB operation codes */
79/************************************************/
80#define SCSIOP_TEST_UNIT_READY 0x00
81#define SCSIOP_REZERO_UNIT 0x01
82#define SCSIOP_REWIND 0x01
83#define SCSIOP_REQUEST_BLOCK_ADDR 0x02
84#define SCSIOP_REQUEST_SENSE 0x03
85#define SCSIOP_FORMAT_UNIT 0x04
86#define SCSIOP_READ_BLOCK_LIMITS 0x05
87#define SCSIOP_REASSIGN_BLOCKS 0x07
88#define SCSIOP_READ6 0x08
89#define SCSIOP_RECEIVE 0x08
90#define SCSIOP_WRITE6 0x0A
91#define SCSIOP_PRINT 0x0A
92#define SCSIOP_SEND 0x0A
93#define SCSIOP_SEEK6 0x0B
94#define SCSIOP_TRACK_SELECT 0x0B
95#define SCSIOP_SLEW_PRINT 0x0B
96#define SCSIOP_SEEK_BLOCK 0x0C
97#define SCSIOP_PARTITION 0x0D
98#define SCSIOP_READ_REVERSE 0x0F
99#define SCSIOP_WRITE_FILEMARKS 0x10
100#define SCSIOP_FLUSH_BUFFER 0x10
101#define SCSIOP_SPACE 0x11
102#define SCSIOP_INQUIRY 0x12
103#define SCSIOP_VERIFY6 0x13
104#define SCSIOP_RECOVER_BUF_DATA 0x14
105#define SCSIOP_MODE_SELECT 0x15
106#define SCSIOP_RESERVE_UNIT 0x16
107#define SCSIOP_RELEASE_UNIT 0x17
108#define SCSIOP_COPY 0x18
109#define SCSIOP_ERASE 0x19
110#define SCSIOP_MODE_SENSE 0x1A
111#define SCSIOP_START_STOP_UNIT 0x1B
112#define SCSIOP_STOP_PRINT 0x1B
113#define SCSIOP_LOAD_UNLOAD 0x1B
114#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
115#define SCSIOP_SEND_DIAGNOSTIC 0x1D
116#define SCSIOP_MEDIUM_REMOVAL 0x1E
117#define SCSIOP_READ_CAPACITY 0x25
118#define SCSIOP_READ 0x28
119#define SCSIOP_WRITE 0x2A
120#define SCSIOP_SEEK 0x2B
121#define SCSIOP_LOCATE 0x2B
122#define SCSIOP_WRITE_VERIFY 0x2E
123#define SCSIOP_VERIFY 0x2F
124#define SCSIOP_SEARCH_DATA_HIGH 0x30
125#define SCSIOP_SEARCH_DATA_EQUAL 0x31
126#define SCSIOP_SEARCH_DATA_LOW 0x32
127#define SCSIOP_SET_LIMITS 0x33
128#define SCSIOP_READ_POSITION 0x34
129#define SCSIOP_SYNCHRONIZE_CACHE 0x35
130#define SCSIOP_COMPARE 0x39
131#define SCSIOP_COPY_COMPARE 0x3A
132#define SCSIOP_WRITE_DATA_BUFF 0x3B
133#define SCSIOP_READ_DATA_BUFF 0x3C
134#define SCSIOP_CHANGE_DEFINITION 0x40
135#define SCSIOP_READ_SUB_CHANNEL 0x42
136#define SCSIOP_READ_TOC 0x43
137#define SCSIOP_READ_HEADER 0x44
138#define SCSIOP_PLAY_AUDIO 0x45
139#define SCSIOP_PLAY_AUDIO_MSF 0x47
140#define SCSIOP_PLAY_TRACK_INDEX 0x48
141#define SCSIOP_PLAY_TRACK_RELATIVE 0x49
142#define SCSIOP_PAUSE_RESUME 0x4B
143#define SCSIOP_LOG_SELECT 0x4C
144#define SCSIOP_LOG_SENSE 0x4D
145#define SCSIOP_MODE_SELECT10 0x55
146#define SCSIOP_MODE_SENSE10 0x5A
147#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
148#define SCSIOP_MECHANISM_STATUS 0xBD
149#define SCSIOP_READ_CD 0xBE
150
151// IDE command definitions
152#define IDE_COMMAND_ATAPI_RESET 0x08
153#define IDE_COMMAND_READ 0x20
154#define IDE_COMMAND_WRITE 0x30
155#define IDE_COMMAND_RECALIBRATE 0x10
156#define IDE_COMMAND_SEEK 0x70
157#define IDE_COMMAND_SET_PARAMETERS 0x91
158#define IDE_COMMAND_VERIFY 0x40
159#define IDE_COMMAND_ATAPI_PACKET 0xA0
160#define IDE_COMMAND_ATAPI_IDENTIFY 0xA1
161#define IDE_CMD_READ_MULTIPLE 0xC4
162#define IDE_CMD_WRITE_MULTIPLE 0xC5
163#define IDE_CMD_SET_MULTIPLE 0xC6
164#define IDE_COMMAND_WRITE_DMA 0xCA
165#define IDE_COMMAND_READ_DMA 0xC8
166#define IDE_COMMAND_IDENTIFY 0xEC
167
168// IDE status definitions
169#define IDE_STATUS_ERROR 0x01
170#define IDE_STATUS_INDEX 0x02
171#define IDE_STATUS_CORRECTED_ERROR 0x04
172#define IDE_STATUS_DRQ 0x08
173#define IDE_STATUS_DSC 0x10
174#define IDE_STATUS_WRITE_FAULT 0x20
175#define IDE_STATUS_DRDY 0x40
176#define IDE_STATUS_BUSY 0x80
177
178// IDE error definitions
179#define IDE_ERROR_AMNF 0x01
180#define IDE_ERROR_TKONF 0x02
181#define IDE_ERROR_ABRT 0x04
182#define IDE_ERROR_MCR 0x08
183#define IDE_ERROR_IDFN 0x10
184#define IDE_ERROR_MC 0x20
185#define IDE_ERROR_UNC 0x40
186#define IDE_ERROR_BBK 0x80
187
188// IDE interface structure
189typedef struct _IDE_STRUCT
190 {
191 union
192 {
193 UCHAR ide[9];
194 struct
195 {
196 USHORT data;
197 UCHAR sectors;
198 UCHAR lba[4];
199 UCHAR cmd;
200 UCHAR spigot;
201 } ides;
202 } ide;
203 } IDE_STRUCT;
204
205// SCSI read capacity structure
206typedef struct _READ_CAPACITY_DATA
207 {
208 ULONG blks; /* total blocks (converted to little endian) */
209 ULONG blksiz; /* size of each (converted to little endian) */
210 } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
211
212// SCSI inquiry data
213#ifndef HOSTS_C
214
215typedef struct _INQUIRYDATA
216 {
217 UCHAR DeviceType :5;
218 UCHAR DeviceTypeQualifier :3;
219 UCHAR DeviceTypeModifier :7;
220 UCHAR RemovableMedia :1;
221 UCHAR Versions;
222 UCHAR ResponseDataFormat;
223 UCHAR AdditionalLength;
224 UCHAR Reserved[2];
225 UCHAR SoftReset :1;
226 UCHAR CommandQueue :1;
227 UCHAR Reserved2 :1;
228 UCHAR LinkedCommands :1;
229 UCHAR Synchronous :1;
230 UCHAR Wide16Bit :1;
231 UCHAR Wide32Bit :1;
232 UCHAR RelativeAddressing :1;
233 UCHAR VendorId[8];
234 UCHAR ProductId[16];
235 UCHAR ProductRevisionLevel[4];
236 UCHAR VendorSpecific[20];
237 UCHAR Reserved3[40];
238 } INQUIRYDATA, *PINQUIRYDATA;
239#endif
240
241// IDE IDENTIFY data
242typedef struct _IDENTIFY_DATA
243 {
244 USHORT GeneralConfiguration; // 00
245 USHORT NumberOfCylinders; // 02
246 USHORT Reserved1; // 04
247 USHORT NumberOfHeads; // 06
248 USHORT UnformattedBytesPerTrack; // 08
249 USHORT UnformattedBytesPerSector; // 0A
250 USHORT SectorsPerTrack; // 0C
251 USHORT VendorUnique1[3]; // 0E
252 USHORT SerialNumber[10]; // 14
253 USHORT BufferType; // 28
254 USHORT BufferSectorSize; // 2A
255 USHORT NumberOfEccBytes; // 2C
256 USHORT FirmwareRevision[4]; // 2E
257 USHORT ModelNumber[20]; // 36
258 UCHAR MaximumBlockTransfer; // 5E
259 UCHAR VendorUnique2; // 5F
260 USHORT DoubleWordIo; // 60
261 USHORT Capabilities; // 62
262 USHORT Reserved2; // 64
263 UCHAR VendorUnique3; // 66
264 UCHAR PioCycleTimingMode; // 67
265 UCHAR VendorUnique4; // 68
266 UCHAR DmaCycleTimingMode; // 69
267 USHORT TranslationFieldsValid:1; // 6A
268 USHORT Reserved3:15;
269 USHORT NumberOfCurrentCylinders; // 6C
270 USHORT NumberOfCurrentHeads; // 6E
271 USHORT CurrentSectorsPerTrack; // 70
272 ULONG CurrentSectorCapacity; // 72
273 USHORT Reserved4[197]; // 76
274 } IDENTIFY_DATA, *PIDENTIFY_DATA;
275
276// Identify data without the Reserved4.
277typedef struct _IDENTIFY_DATA2 {
278 USHORT GeneralConfiguration; // 00
279 USHORT NumberOfCylinders; // 02
280 USHORT Reserved1; // 04
281 USHORT NumberOfHeads; // 06
282 USHORT UnformattedBytesPerTrack; // 08
283 USHORT UnformattedBytesPerSector; // 0A
284 USHORT SectorsPerTrack; // 0C
285 USHORT VendorUnique1[3]; // 0E
286 USHORT SerialNumber[10]; // 14
287 USHORT BufferType; // 28
288 USHORT BufferSectorSize; // 2A
289 USHORT NumberOfEccBytes; // 2C
290 USHORT FirmwareRevision[4]; // 2E
291 USHORT ModelNumber[20]; // 36
292 UCHAR MaximumBlockTransfer; // 5E
293 UCHAR VendorUnique2; // 5F
294 USHORT DoubleWordIo; // 60
295 USHORT Capabilities; // 62
296 USHORT Reserved2; // 64
297 UCHAR VendorUnique3; // 66
298 UCHAR PioCycleTimingMode; // 67
299 UCHAR VendorUnique4; // 68
300 UCHAR DmaCycleTimingMode; // 69
301 USHORT TranslationFieldsValid:1; // 6A
302 USHORT Reserved3:15;
303 USHORT NumberOfCurrentCylinders; // 6C
304 USHORT NumberOfCurrentHeads; // 6E
305 USHORT CurrentSectorsPerTrack; // 70
306 ULONG CurrentSectorCapacity; // 72
307 } IDENTIFY_DATA2, *PIDENTIFY_DATA2;
308
309#endif // PSI_EIDE_SCSIOP
310
311// function prototypes
312int Psi240i_Command(struct scsi_cmnd *SCpnt);
313int Psi240i_Abort(struct scsi_cmnd *SCpnt);
314int Psi240i_Reset(struct scsi_cmnd *SCpnt, unsigned int flags);
315#endif
diff --git a/drivers/scsi/psi_chip.h b/drivers/scsi/psi_chip.h
deleted file mode 100644
index 224cf8f64c97..000000000000
--- a/drivers/scsi/psi_chip.h
+++ /dev/null
@@ -1,195 +0,0 @@
1/*+M*************************************************************************
2 * Perceptive Solutions, Inc. PSI-240I device driver proc support for Linux.
3 *
4 * Copyright (c) 1997 Perceptive Solutions, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 *
21 * File Name: psi_chip.h
22 *
23 * Description: This file contains the interface defines and
24 * error codes.
25 *
26 *-M*************************************************************************/
27#ifndef PSI_CHIP
28#define PSI_CHIP
29
30/************************************************/
31/* Misc konstants */
32/************************************************/
33#define CHIP_MAXDRIVES 8
34
35/************************************************/
36/* Chip I/O addresses */
37/************************************************/
38#define CHIP_ADRS_0 0x0130
39#define CHIP_ADRS_1 0x0150
40#define CHIP_ADRS_2 0x0190
41#define CHIP_ADRS_3 0x0210
42#define CHIP_ADRS_4 0x0230
43#define CHIP_ADRS_5 0x0250
44
45/************************************************/
46/* EEPROM locations */
47/************************************************/
48#define CHIP_EEPROM_BIOS 0x0000 // BIOS base address
49#define CHIP_EEPROM_DATA 0x2000 // SETUP data base address
50#define CHIP_EEPROM_FACTORY 0x2400 // FACTORY data base address
51#define CHIP_EEPROM_SETUP 0x3000 // SETUP PROGRAM base address
52
53#define CHIP_EEPROM_SIZE 32768U // size of the entire EEPROM
54#define CHIP_EEPROM_BIOS_SIZE 8192 // size of the BIOS in bytes
55#define CHIP_EEPROM_DATA_SIZE 4096 // size of factory, setup, log data block in bytes
56#define CHIP_EEPROM_SETUP_SIZE 20480U // size of the setup program in bytes
57
58/************************************************/
59/* Chip Interrupts */
60/************************************************/
61#define CHIP_IRQ_10 0x72
62#define CHIP_IRQ_11 0x73
63#define CHIP_IRQ_12 0x74
64
65/************************************************/
66/* Chip Setup addresses */
67/************************************************/
68#define CHIP_SETUP_BASE 0x0000C000L
69
70/************************************************/
71/* Chip Register address offsets */
72/************************************************/
73#define REG_DATA 0x00
74#define REG_ERROR 0x01
75#define REG_SECTOR_COUNT 0x02
76#define REG_LBA_0 0x03
77#define REG_LBA_8 0x04
78#define REG_LBA_16 0x05
79#define REG_LBA_24 0x06
80#define REG_STAT_CMD 0x07
81#define REG_SEL_FAIL 0x08
82#define REG_IRQ_STATUS 0x09
83#define REG_ADDRESS 0x0A
84#define REG_FAIL 0x0C
85#define REG_ALT_STAT 0x0E
86#define REG_DRIVE_ADRS 0x0F
87
88/************************************************/
89/* Chip RAM locations */
90/************************************************/
91#define CHIP_DEVICE 0x8000
92#define CHIP_DEVICE_0 0x8000
93#define CHIP_DEVICE_1 0x8008
94#define CHIP_DEVICE_2 0x8010
95#define CHIP_DEVICE_3 0x8018
96#define CHIP_DEVICE_4 0x8020
97#define CHIP_DEVICE_5 0x8028
98#define CHIP_DEVICE_6 0x8030
99#define CHIP_DEVICE_7 0x8038
100typedef struct
101 {
102 UCHAR channel; // channel of this device (0-8).
103 UCHAR spt; // Sectors Per Track.
104 ULONG spc; // Sectors Per Cylinder.
105 } CHIP_DEVICE_N;
106
107#define CHIP_CONFIG 0x8100 // address of boards configuration.
108typedef struct
109 {
110 UCHAR irq; // interrupt request channel number
111 UCHAR numDrives; // Number of accessible drives
112 UCHAR fastFormat; // Boolean for fast format enable
113 } CHIP_CONFIG_N;
114
115#define CHIP_MAP 0x8108 // eight byte device type map.
116
117
118#define CHIP_RAID 0x8120 // array of RAID signature structures and LBA
119#define CHIP_RAID_1 0x8120
120#define CHIP_RAID_2 0x8130
121#define CHIP_RAID_3 0x8140
122#define CHIP_RAID_4 0x8150
123
124/************************************************/
125/* Chip Register Masks */
126/************************************************/
127#define CHIP_ID 0x7B
128#define SEL_RAM 0x8000
129#define MASK_FAIL 0x80
130
131/************************************************/
132/* Chip cable select bits */
133/************************************************/
134#define SECTORSXFER 8
135
136/************************************************/
137/* Chip cable select bits */
138/************************************************/
139#define SEL_NONE 0x00
140#define SEL_1 0x01
141#define SEL_2 0x02
142#define SEL_3 0x04
143#define SEL_4 0x08
144
145/************************************************/
146/* Programmable Interrupt Controller*/
147/************************************************/
148#define PIC1 0x20 // first 8259 base port address
149#define PIC2 0xA0 // second 8259 base port address
150#define INT_OCW1 1 // Operation Control Word 1: IRQ mask
151#define EOI 0x20 // non-specific end-of-interrupt
152
153/************************************************/
154/* Device/Geometry controls */
155/************************************************/
156#define GEOMETRY_NONE 0x0 // No device
157#define GEOMETRY_AUTO 0x1 // Geometry set automatically
158#define GEOMETRY_USER 0x2 // User supplied geometry
159
160#define DEVICE_NONE 0x0 // No device present
161#define DEVICE_INACTIVE 0x1 // device present but not registered active
162#define DEVICE_ATAPI 0x2 // ATAPI device (CD_ROM, Tape, Etc...)
163#define DEVICE_DASD_NONLBA 0x3 // Non LBA incompatible device
164#define DEVICE_DASD_LBA 0x4 // LBA compatible device
165
166/************************************************/
167/* Setup Structure Definitions */
168/************************************************/
169typedef struct // device setup parameters
170 {
171 UCHAR geometryControl; // geometry control flags
172 UCHAR device; // device code
173 USHORT sectors; // number of sectors per track
174 USHORT heads; // number of heads
175 USHORT cylinders; // number of cylinders for this device
176 ULONG blocks; // number of blocks on device
177 USHORT spare1;
178 USHORT spare2;
179 } SETUP_DEVICE, *PSETUP_DEVICE;
180
181typedef struct // master setup structure
182 {
183 USHORT startupDelay;
184 USHORT promptBIOS;
185 USHORT fastFormat;
186 USHORT spare2;
187 USHORT spare3;
188 USHORT spare4;
189 USHORT spare5;
190 USHORT spare6;
191 SETUP_DEVICE setupDevice[8];
192 } SETUP, *PSETUP;
193
194#endif
195