Commit e564e72b authored by Alan Cox's avatar Alan Cox Committed by Dave Jones

[PATCH] fd_mcs finish up I hope

parent 6fc80776
......@@ -1325,13 +1325,13 @@ static int fd_mcs_host_reset(Scsi_Cmnd * SCpnt)
return FAILED;
}
static int fd_mcs_device_reset(Scsi_Cmnd * SCpnt) {
static int fd_mcs_device_reset(Scsi_Cmnd * SCpnt)
{
return FAILED;
}
}
static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) {
static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) {
struct Scsi_Host *shpnt = SCpnt->host;
unsigned long flags;
#if DEBUG_RESET
static int called_once = 0;
......@@ -1348,8 +1348,6 @@ static int fd_mcs_device_reset(Scsi_Cmnd * SCpnt) {
called_once = 1;
#endif
spin_lock_irqsave(shpnt->host_lock, flags);
outb(1, SCSI_Cntl_port);
do_pause(2);
outb(0, SCSI_Cntl_port);
......@@ -1360,15 +1358,14 @@ static int fd_mcs_device_reset(Scsi_Cmnd * SCpnt) {
/* Unless this is the very first call (i.e., SCPnt == NULL), everything
is probably hosed at this point. We will, however, try to keep
things going by informing the high-level code that we need help. */
spin_unlock_irqrestore(shpnt->host_lock, flags);
return SUCCESS;
}
}
#include <scsi/scsi_ioctl.h>
static int fd_mcs_biosparam(Scsi_Disk * disk, struct block_device *bdev,
sector_t capacity, int *info_array) {
static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev,
sector_t capacity, int *info_array)
{
unsigned char buf[512 + sizeof(int) * 2];
int size = capacity;
int *sizes = (int *) buf;
......@@ -1382,11 +1379,10 @@ static int fd_mcs_device_reset(Scsi_Cmnd * SCpnt) {
sizes[0] = 0; /* zero bytes out */
sizes[1] = 512; /* one sector in */
memcpy(data, do_read, sizeof(do_read));
retcode = kernel_scsi_ioctl(disk->device, SCSI_IOCTL_SEND_COMMAND, (void *) buf);
retcode = kernel_scsi_ioctl(disk, SCSI_IOCTL_SEND_COMMAND, (void *) buf);
if (!retcode /* SCSI command ok */
&& data[511] == 0xaa && data[510] == 0x55 /* Partition table valid */
&& data[0x1c2]) { /* Partition type */
/* The partition table layout is as follows:
Start: 0x1b3h
......@@ -1419,12 +1415,11 @@ static int fd_mcs_device_reset(Scsi_Cmnd * SCpnt) {
info_array[0] = data[0x1c3] + 1; /* heads */
info_array[1] = data[0x1c4] & 0x3f; /* sectors */
} else {
/* Note that this new method guarantees that there will always be
less than 1024 cylinders on a platter. This is good for drives
up to approximately 7.85GB (where 1GB = 1024 * 1024 kB). */
if ((unsigned int) size >= 0x7e0000U) {
if ((unsigned int) size >= 0x7e0000U)
{
info_array[0] = 0xff; /* heads = 255 */
info_array[1] = 0x3f; /* sectors = 63 */
} else if ((unsigned int) size >= 0x200000U) {
......@@ -1437,6 +1432,8 @@ static int fd_mcs_device_reset(Scsi_Cmnd * SCpnt) {
}
/* For both methods, compute the cylinders */
info_array[2] = (unsigned int) size / (info_array[0] * info_array[1]);
return 0;
}
/* Eventually this will go into an include file, but this will be later */
static Scsi_Host_Template driver_template = FD_MCS;
......
......@@ -30,7 +30,7 @@ static int fd_mcs_bus_reset(Scsi_Cmnd *);
static int fd_mcs_device_reset(Scsi_Cmnd *);
static int fd_mcs_host_reset(Scsi_Cmnd *);
static int fd_mcs_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
static int fd_mcs_biosparam(Disk *, struct block_device *,
static int fd_mcs_biosparam(struct scsi_device *, struct block_device *,
sector_t, int *);
static int fd_mcs_proc_info(char *, char **, off_t, int, int, int);
static const char *fd_mcs_info(struct Scsi_Host *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment