Commit fb62897b authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by James Bottomley

[PATCH] tmscsim: remove unused / redundant bios_param

Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b7ba569e
...@@ -999,140 +999,6 @@ static int DC390_queue_command(struct scsi_cmnd *cmd, ...@@ -999,140 +999,6 @@ static int DC390_queue_command(struct scsi_cmnd *cmd,
return 1; return 1;
} }
/* We ignore mapping problems, as we expect everybody to respect
* valid partition tables. Waiting for complaints ;-) */
#ifdef CONFIG_SCSI_DC390T_TRADMAP
/*
* The next function, partsize(), is copied from scsicam.c.
*
* This is ugly code duplication, but I didn't find another way to solve it:
* We want to respect the partition table and if it fails, we apply the
* DC390 BIOS heuristic. Too bad, just calling scsicam_bios_param() doesn't do
* the job, because we don't know, whether the values returned are from
* the part. table or determined by setsize(). Unfortunately the setsize()
* values differ from the ones chosen by the DC390 BIOS.
*
* Looking forward to seeing suggestions for a better solution! KG, 98/10/14
*/
#include <asm/unaligned.h>
/*
* Function : static int partsize(unsigned char *buf, unsigned long
* capacity,unsigned int *cyls, unsigned int *hds, unsigned int *secs);
*
* Purpose : to determine the BIOS mapping used to create the partition
* table, storing the results in *cyls, *hds, and *secs
*
* Returns : -1 on failure, 0 on success.
*
*/
static int partsize(unsigned char *buf, unsigned long capacity,
unsigned int *cyls, unsigned int *hds, unsigned int *secs) {
struct partition *p, *largest = NULL;
int i, largest_cyl;
int cyl, ext_cyl, end_head, end_cyl, end_sector;
unsigned int logical_end, physical_end, ext_physical_end;
if (*(unsigned short *) (buf+64) == 0xAA55) {
for (largest_cyl = -1, p = (struct partition *) buf,
i = 0; i < 4; ++i, ++p) {
if (!p->sys_ind)
continue;
cyl = p->cyl + ((p->sector & 0xc0) << 2);
if (cyl > largest_cyl) {
largest_cyl = cyl;
largest = p;
}
}
}
if (largest) {
end_cyl = largest->end_cyl + ((largest->end_sector & 0xc0) << 2);
end_head = largest->end_head;
end_sector = largest->end_sector & 0x3f;
physical_end = end_cyl * (end_head + 1) * end_sector +
end_head * end_sector + end_sector;
/* This is the actual _sector_ number at the end */
logical_end = get_unaligned(&largest->start_sect)
+ get_unaligned(&largest->nr_sects);
/* This is for >1023 cylinders */
ext_cyl= (logical_end-(end_head * end_sector + end_sector))
/(end_head + 1) / end_sector;
ext_physical_end = ext_cyl * (end_head + 1) * end_sector +
end_head * end_sector + end_sector;
if ((logical_end == physical_end) ||
(end_cyl==1023 && ext_physical_end==logical_end)) {
*secs = end_sector;
*hds = end_head + 1;
*cyls = capacity / ((end_head + 1) * end_sector);
return 0;
}
}
return -1;
}
/***********************************************************************
* Function:
* DC390_bios_param
*
* Description:
* Return the disk geometry for the given SCSI device.
* Respect the partition table, otherwise try own heuristic
*
* Note:
* In contrary to other externally callable funcs (DC390_), we don't lock
***********************************************************************/
static int DC390_bios_param (struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int geom[])
{
int heads, sectors, cylinders;
struct dc390_acb* pACB = (struct dc390_acb*) sdev->host->hostdata;
int ret_code = -1;
int size = capacity;
unsigned char *buf;
if ((buf = scsi_bios_ptable(bdev)))
{
/* try to infer mapping from partition table */
ret_code = partsize (buf, (unsigned long) size, (unsigned int *) geom + 2,
(unsigned int *) geom + 0, (unsigned int *) geom + 1);
kfree (buf);
}
if (ret_code == -1)
{
heads = 64;
sectors = 32;
cylinders = size / (heads * sectors);
if ( (pACB->Gmode2 & GREATER_1G) && (cylinders > 1024) )
{
heads = 255;
sectors = 63;
cylinders = size / (heads * sectors);
}
geom[0] = heads;
geom[1] = sectors;
geom[2] = cylinders;
}
return (0);
}
#else
static int DC390_bios_param (struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int geom[])
{
return scsicam_bios_param (bdev, capacity, geom);
}
#endif
static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB) static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
...@@ -1632,7 +1498,6 @@ static struct scsi_host_template driver_template = { ...@@ -1632,7 +1498,6 @@ static struct scsi_host_template driver_template = {
.queuecommand = DC390_queue_command, .queuecommand = DC390_queue_command,
.eh_abort_handler = DC390_abort, .eh_abort_handler = DC390_abort,
.eh_bus_reset_handler = DC390_bus_reset, .eh_bus_reset_handler = DC390_bus_reset,
.bios_param = DC390_bios_param,
.can_queue = 42, .can_queue = 42,
.this_id = 7, .this_id = 7,
.sg_tablesize = SG_ALL, .sg_tablesize = SG_ALL,
......
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