diff options
author | Kashyap Desai <kashyap.desai@broadcom.com> | 2021-05-20 20:55:33 +0530 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-06-02 00:56:16 -0400 |
commit | 8f9c6173ca464822b8877f75dc7ca20f645b0179 (patch) | |
tree | 9085207142eadc5a8191294e85d2b64da597fa05 /drivers/scsi/mpi3mr/mpi3mr_os.c | |
parent | ff9561e910fc590add00d7e0f2792a8ef988ed21 (diff) | |
download | linux-8f9c6173ca464822b8877f75dc7ca20f645b0179.tar.gz linux-8f9c6173ca464822b8877f75dc7ca20f645b0179.tar.bz2 linux-8f9c6173ca464822b8877f75dc7ca20f645b0179.zip |
scsi: mpi3mr: Add bios_param SCSI host template hook
Link: https://lore.kernel.org/r/20210520152545.2710479-13-kashyap.desai@broadcom.com
Cc: sathya.prakash@broadcom.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mpi3mr/mpi3mr_os.c')
-rw-r--r-- | drivers/scsi/mpi3mr/mpi3mr_os.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 21e2ac40e6d6..8d895e4a219f 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -2051,6 +2051,46 @@ static int mpi3mr_build_sg_scmd(struct mpi3mr_ioc *mrioc, } /** + * mpi3mr_bios_param - BIOS param callback + * @sdev: SCSI device reference + * @bdev: Block device reference + * @capacity: Capacity in logical sectors + * @params: Parameter array + * + * Just the parameters with heads/secots/cylinders. + * + * Return: 0 always + */ +static int mpi3mr_bios_param(struct scsi_device *sdev, + struct block_device *bdev, sector_t capacity, int params[]) +{ + int heads; + int sectors; + sector_t cylinders; + ulong dummy; + + heads = 64; + sectors = 32; + + dummy = heads * sectors; + cylinders = capacity; + sector_div(cylinders, dummy); + + if ((ulong)capacity >= 0x200000) { + heads = 255; + sectors = 63; + dummy = heads * sectors; + cylinders = capacity; + sector_div(cylinders, dummy); + } + + params[0] = heads; + params[1] = sectors; + params[2] = cylinders; + return 0; +} + +/** * mpi3mr_map_queues - Map queues callback handler * @shost: SCSI host reference * @@ -2493,6 +2533,7 @@ static struct scsi_host_template mpi3mr_driver_template = { .slave_destroy = mpi3mr_slave_destroy, .scan_finished = mpi3mr_scan_finished, .scan_start = mpi3mr_scan_start, + .bios_param = mpi3mr_bios_param, .map_queues = mpi3mr_map_queues, .no_write_same = 1, .can_queue = 1, |