diff options
author | Sumant Patro <sumantp@lsil.com> | 2007-02-14 15:41:55 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-02-16 11:19:53 -0500 |
commit | cf62a0a543fbab15286509d2e04e3dcf5549e966 (patch) | |
tree | 9ed2070713deb33db6557031923be7cfe3ef1e68 /drivers/scsi/megaraid/megaraid_sas.c | |
parent | af37acfb63d8e924550e67b884dbd1c478e26c96 (diff) |
[SCSI] megaraid_sas: add bios_param in scsi_host_template
Signed-off-by: Sumant Patro <sumant.patro@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas.c')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 6ff540140807..9c5e4da5a132 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/compat.h> | 37 | #include <linux/compat.h> |
38 | #include <linux/blkdev.h> | ||
38 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
39 | 40 | ||
40 | #include <scsi/scsi.h> | 41 | #include <scsi/scsi.h> |
@@ -1015,6 +1016,49 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd) | |||
1015 | } | 1016 | } |
1016 | 1017 | ||
1017 | /** | 1018 | /** |
1019 | * megasas_bios_param - Returns disk geometry for a disk | ||
1020 | * @sdev: device handle | ||
1021 | * @bdev: block device | ||
1022 | * @capacity: drive capacity | ||
1023 | * @geom: geometry parameters | ||
1024 | */ | ||
1025 | static int | ||
1026 | megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev, | ||
1027 | sector_t capacity, int geom[]) | ||
1028 | { | ||
1029 | int heads; | ||
1030 | int sectors; | ||
1031 | sector_t cylinders; | ||
1032 | unsigned long tmp; | ||
1033 | /* Default heads (64) & sectors (32) */ | ||
1034 | heads = 64; | ||
1035 | sectors = 32; | ||
1036 | |||
1037 | tmp = heads * sectors; | ||
1038 | cylinders = capacity; | ||
1039 | |||
1040 | sector_div(cylinders, tmp); | ||
1041 | |||
1042 | /* | ||
1043 | * Handle extended translation size for logical drives > 1Gb | ||
1044 | */ | ||
1045 | |||
1046 | if (capacity >= 0x200000) { | ||
1047 | heads = 255; | ||
1048 | sectors = 63; | ||
1049 | tmp = heads*sectors; | ||
1050 | cylinders = capacity; | ||
1051 | sector_div(cylinders, tmp); | ||
1052 | } | ||
1053 | |||
1054 | geom[0] = heads; | ||
1055 | geom[1] = sectors; | ||
1056 | geom[2] = cylinders; | ||
1057 | |||
1058 | return 0; | ||
1059 | } | ||
1060 | |||
1061 | /** | ||
1018 | * megasas_service_aen - Processes an event notification | 1062 | * megasas_service_aen - Processes an event notification |
1019 | * @instance: Adapter soft state | 1063 | * @instance: Adapter soft state |
1020 | * @cmd: AEN command completed by the ISR | 1064 | * @cmd: AEN command completed by the ISR |
@@ -1054,6 +1098,7 @@ static struct scsi_host_template megasas_template = { | |||
1054 | .eh_device_reset_handler = megasas_reset_device, | 1098 | .eh_device_reset_handler = megasas_reset_device, |
1055 | .eh_bus_reset_handler = megasas_reset_bus_host, | 1099 | .eh_bus_reset_handler = megasas_reset_bus_host, |
1056 | .eh_host_reset_handler = megasas_reset_bus_host, | 1100 | .eh_host_reset_handler = megasas_reset_bus_host, |
1101 | .bios_param = megasas_bios_param, | ||
1057 | .use_clustering = ENABLE_CLUSTERING, | 1102 | .use_clustering = ENABLE_CLUSTERING, |
1058 | }; | 1103 | }; |
1059 | 1104 | ||