|
35 | 35 | #include <asm/uaccess.h>
|
36 | 36 | #include <linux/fs.h>
|
37 | 37 | #include <linux/compat.h>
|
| 38 | +#include <linux/blkdev.h> |
38 | 39 | #include <linux/mutex.h>
|
39 | 40 |
|
40 | 41 | #include <scsi/scsi.h>
|
@@ -1014,6 +1015,49 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
|
1014 | 1015 | return ret;
|
1015 | 1016 | }
|
1016 | 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 | + |
1017 | 1061 | /**
|
1018 | 1062 | * megasas_service_aen - Processes an event notification
|
1019 | 1063 | * @instance: Adapter soft state
|
@@ -1054,6 +1098,7 @@ static struct scsi_host_template megasas_template = {
|
1054 | 1098 | .eh_device_reset_handler = megasas_reset_device,
|
1055 | 1099 | .eh_bus_reset_handler = megasas_reset_bus_host,
|
1056 | 1100 | .eh_host_reset_handler = megasas_reset_bus_host,
|
| 1101 | + .bios_param = megasas_bios_param, |
1057 | 1102 | .use_clustering = ENABLE_CLUSTERING,
|
1058 | 1103 | };
|
1059 | 1104 |
|
|
0 commit comments