patch-2.1.4 linux/drivers/scsi/seagate.c
Next file: linux/drivers/scsi/sg.c
Previous file: linux/drivers/scsi/scsi_ioctl.c
Back to the patch index
Back to the overall index
- Lines: 201
- Date:
Mon Oct 14 09:07:15 1996
- Orig file:
v2.1.3/linux/drivers/scsi/seagate.c
- Orig date:
Mon May 27 13:37:18 1996
diff -u --recursive --new-file v2.1.3/linux/drivers/scsi/seagate.c linux/drivers/scsi/seagate.c
@@ -99,7 +99,7 @@
in some command phase.
*/
-static const void *base_address = NULL; /*
+static unsigned int base_address = 0; /*
Where the card ROM starts,
used to calculate memory mapped
register location.
@@ -108,7 +108,7 @@
static volatile int abort_confirm = 0;
#endif
-static volatile void *st0x_cr_sr; /*
+static unsigned int st0x_cr_sr; /*
control register write,
status register read.
256 bytes in length.
@@ -119,7 +119,7 @@
*/
-static volatile void *st0x_dr; /*
+static unsigned int st0x_dr; /*
data register, read write
256 bytes in length.
*/
@@ -133,31 +133,31 @@
static unsigned char irq = IRQ;
#define retcode(result) (((result) << 16) | (message << 8) | status)
-#define STATUS (*(volatile unsigned char *) st0x_cr_sr)
+#define STATUS (readb(st0x_cr_sr))
#define CONTROL STATUS
-#define DATA (*(volatile unsigned char *) st0x_dr)
+#define DATA (readb(st0x_dr))
void st0x_setup (char *str, int *ints) {
controller_type = SEAGATE;
- base_address = (void *) ints[1];
+ base_address = ints[1];
irq = ints[2];
}
void tmc8xx_setup (char *str, int *ints) {
controller_type = FD;
- base_address = (void *) ints[1];
+ base_address = ints[1];
irq = ints[2];
}
#ifndef OVERRIDE
-static const char * seagate_bases[] = {
- (char *) 0xc8000, (char *) 0xca000, (char *) 0xcc000,
- (char *) 0xce000, (char *) 0xdc000, (char *) 0xde000
+static unsigned int seagate_bases[] = {
+ 0xc8000, 0xca000, 0xcc000,
+ 0xce000, 0xdc000, 0xde000
};
typedef struct {
- const char *signature ;
+ const unsigned char *signature ;
unsigned offset;
unsigned length;
unsigned char type;
@@ -307,7 +307,7 @@
if (!controller_type) {
#ifdef OVERRIDE
- base_address = (void *) OVERRIDE;
+ base_address = OVERRIDE;
/* CONTROLLER is used to override controller (SEAGATE or FD). PM: 07/01/93 */
#ifdef CONTROLLER
@@ -330,12 +330,11 @@
* space for the on-board RAM instead.
*/
- for (i = 0; i < (sizeof (seagate_bases) / sizeof (char * )); ++i)
+ for (i = 0; i < (sizeof (seagate_bases) / sizeof (unsigned int)); ++i)
for (j = 0; !base_address && j < NUM_SIGNATURES; ++j)
- if (!memcmp ((const void *) (seagate_bases[i] +
- signatures[j].offset), (const void *) signatures[j].signature,
- signatures[j].length)) {
- base_address = (const void *) seagate_bases[i];
+ if (check_signature(seagate_bases[i] + signatures[j].offset,
+ signatures[j].signature, signatures[j].length)) {
+ base_address = seagate_bases[i];
controller_type = signatures[j].type;
}
#endif /* OVERRIDE */
@@ -346,8 +345,8 @@
if (base_address)
{
- st0x_cr_sr =(void *) (((const unsigned char *) base_address) + (controller_type == SEAGATE ? 0x1a00 : 0x1c00));
- st0x_dr = (void *) (((const unsigned char *) base_address ) + (controller_type == SEAGATE ? 0x1c00 : 0x1e00));
+ st0x_cr_sr = base_address + (controller_type == SEAGATE ? 0x1a00 : 0x1c00));
+ st0x_dr = st0x_cr_sr + 0x200;
#ifdef DEBUG
printk("%s detected. Base address = %x, cr = %x, dr = %x\n", tpnt->name, base_address, st0x_cr_sr, st0x_dr);
#endif
@@ -364,7 +363,7 @@
return 0;
}
instance->irq = irq;
- instance->io_port = (unsigned int) base_address;
+ instance->io_port = base_address;
#ifdef SLOW_HANDSHAKE
borken_init();
#endif
@@ -402,7 +401,7 @@
static char buffer[64];
sprintf(buffer, "%s at irq %d, address 0x%05X",
(controller_type == SEAGATE) ? ST0X_ID_STR : FD_ID_STR,
- irq, (unsigned int)base_address);
+ irq, base_address);
return buffer;
}
@@ -1091,6 +1090,7 @@
SCint->transfersize, len, data);
#endif
+#warning This no longer works: rewrite in C and use readbwl/writebwl
__asm__("
cld;
"
@@ -1127,6 +1127,7 @@
* We loop as long as we are in a data out phase, there is data to send,
* and BSY is still active.
*/
+#warning This no longer works: rewrite in C and use readbwl/writebwl
__asm__ (
/*
@@ -1217,6 +1218,7 @@
" len = %d, data = %08x\n", hostno, SCint->underflow,
SCint->transfersize, len, data);
#endif
+#warning This no longer works: rewrite in C and use readbwl/writebwl
__asm__("
cld;
"
@@ -1265,6 +1267,7 @@
* and BSY is still active
*/
+#warning This no longer works: rewrite in C and use readbwl/writebwl
__asm__ (
/*
Local variables :
@@ -1635,8 +1638,9 @@
#include <scsi/scsi_ioctl.h>
int seagate_st0x_biosparam(Disk * disk, kdev_t dev, int* ip) {
- unsigned char buf[256 + sizeof(int) * 2], cmd[6], *data, *page;
- int *sizes, result, formatted_sectors, total_sectors;
+ unsigned char buf[256 + sizeof (Scsi_Ioctl_Command)], cmd[6], *data, *page;
+ Scsi_Ioctl_Command *sic = (Scsi_Ioctl_Command *) buf;
+ int result, formatted_sectors, total_sectors;
int cylinders, heads, sectors;
int capacity;
@@ -1648,8 +1652,7 @@
if (disk->device->scsi_level < 2)
return -1;
- sizes = (int *) buf;
- data = (unsigned char *) (sizes + 2);
+ data = sic->data;
cmd[0] = MODE_SENSE;
cmd[1] = (disk->device->lun << 5) & 0xe5;
@@ -1663,12 +1666,12 @@
* 24 bytes for each mode page.
*/
- sizes[0] = 0;
- sizes[1] = 256;
+ sic->inlen = 0;
+ sic->outlen = 256;
memcpy (data, cmd, 6);
- if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, (void *) buf))) {
+ if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, sic))) {
/*
* The mode page lies beyond the MODE SENSE header, with length 4, and
* the BLOCK DESCRIPTOR, with length header[3].
@@ -1681,7 +1684,7 @@
cmd[2] = 0x03; /* Read page 3, format page current values */
memcpy (data, cmd, 6);
- if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, (void *) buf))) {
+ if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, sic))) {
page = data + 4 + data[3];
sectors = (page[10] << 8) | page[11];
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov