From: Sumant Patro <sumantp@lsil.com>
To: James.Bottomley@SteelEye.com, akpm@osdl.org, linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, neela.kolli@lsi.com,
bo.yang@lsi.com, sumant.patro@lsi.com
Subject: [PATCH 2/5] scsi: megaraid_sas - added bios_param in scsi_host_template
Date: Tue, 06 Feb 2007 13:57:23 -0800 [thread overview]
Message-ID: <1170799043.10482.20.camel@dumbo> (raw)
[-- Attachment #1: Type: text/plain, Size: 2056 bytes --]
Added bios_param in scsi_host_template to return disk geometry.
Signed-off-by: Sumant Patro <sumant.patro@lsi.com>
---
drivers/scsi/megaraid/megaraid_sas.c | 45 +++++++++++++++++++++++++
1 files changed, 45 insertions(+)
diff -uprN 2.6.new-p1/drivers/scsi/megaraid/megaraid_sas.c 2.6.new-p2/drivers/scsi/megaraid/megaraid_sas.c
--- 2.6.new-p1/drivers/scsi/megaraid/megaraid_sas.c 2007-02-06 06:54:07.000000000 -0800
+++ 2.6.new-p2/drivers/scsi/megaraid/megaraid_sas.c 2007-02-06 08:43:40.000000000 -0800
@@ -35,6 +35,7 @@
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/compat.h>
+#include <linux/blkdev.h>
#include <linux/mutex.h>
#include <scsi/scsi.h>
@@ -1015,6 +1016,49 @@ static int megasas_reset_bus_host(struct
}
/**
+ * megasas_bios_param - Returns disk geometry for a disk
+ * @sdev: device handle
+ * @bdev: block device
+ * @capacity: drive capacity
+ * @geom: geometry parameters
+ */
+static int
+megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev,
+ sector_t capacity, int geom[])
+{
+ int heads;
+ int sectors;
+ sector_t cylinders;
+ ulong dummy;
+ /* Default heads (64) & sectors (32) */
+ heads = 64;
+ sectors = 32;
+
+ dummy = heads * sectors;
+ cylinders = capacity;
+
+ sector_div(cylinders, dummy);
+
+ /*
+ * Handle extended translation size for logical drives > 1Gb
+ */
+
+ if ((ulong)capacity >= 0x200000) {
+ heads = 255;
+ sectors = 63;
+ dummy = heads*sectors;
+ cylinders = capacity;
+ sector_div(cylinders, dummy);
+ }
+
+ geom[0] = heads;
+ geom[1] = sectors;
+ geom[2] = cylinders;
+
+ return 0;
+}
+
+/**
* megasas_service_aen - Processes an event notification
* @instance: Adapter soft state
* @cmd: AEN command completed by the ISR
@@ -1054,6 +1098,7 @@ static struct scsi_host_template megasas
.eh_device_reset_handler = megasas_reset_device,
.eh_bus_reset_handler = megasas_reset_bus_host,
.eh_host_reset_handler = megasas_reset_bus_host,
+ .bios_param = megasas_bios_param,
.use_clustering = ENABLE_CLUSTERING,
};
[-- Attachment #2: p2-bios_param.patch --]
[-- Type: text/x-patch, Size: 1827 bytes --]
diff -uprN 2.6.new-p1/drivers/scsi/megaraid/megaraid_sas.c 2.6.new-p2/drivers/scsi/megaraid/megaraid_sas.c
--- 2.6.new-p1/drivers/scsi/megaraid/megaraid_sas.c 2007-02-06 06:54:07.000000000 -0800
+++ 2.6.new-p2/drivers/scsi/megaraid/megaraid_sas.c 2007-02-06 08:43:40.000000000 -0800
@@ -35,6 +35,7 @@
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/compat.h>
+#include <linux/blkdev.h>
#include <linux/mutex.h>
#include <scsi/scsi.h>
@@ -1015,6 +1016,49 @@ static int megasas_reset_bus_host(struct
}
/**
+ * megasas_bios_param - Returns disk geometry for a disk
+ * @sdev: device handle
+ * @bdev: block device
+ * @capacity: drive capacity
+ * @geom: geometry parameters
+ */
+static int
+megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev,
+ sector_t capacity, int geom[])
+{
+ int heads;
+ int sectors;
+ sector_t cylinders;
+ ulong dummy;
+ /* Default heads (64) & sectors (32) */
+ heads = 64;
+ sectors = 32;
+
+ dummy = heads * sectors;
+ cylinders = capacity;
+
+ sector_div(cylinders, dummy);
+
+ /*
+ * Handle extended translation size for logical drives > 1Gb
+ */
+
+ if ((ulong)capacity >= 0x200000) {
+ heads = 255;
+ sectors = 63;
+ dummy = heads*sectors;
+ cylinders = capacity;
+ sector_div(cylinders, dummy);
+ }
+
+ geom[0] = heads;
+ geom[1] = sectors;
+ geom[2] = cylinders;
+
+ return 0;
+}
+
+/**
* megasas_service_aen - Processes an event notification
* @instance: Adapter soft state
* @cmd: AEN command completed by the ISR
@@ -1054,6 +1098,7 @@ static struct scsi_host_template megasas
.eh_device_reset_handler = megasas_reset_device,
.eh_bus_reset_handler = megasas_reset_bus_host,
.eh_host_reset_handler = megasas_reset_bus_host,
+ .bios_param = megasas_bios_param,
.use_clustering = ENABLE_CLUSTERING,
};
next reply other threads:[~2007-02-07 3:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-06 21:57 Sumant Patro [this message]
2007-02-07 21:19 ` [PATCH 2/5] scsi: megaraid_sas - added bios_param in scsi_host_template Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1170799043.10482.20.camel@dumbo \
--to=sumantp@lsil.com \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@osdl.org \
--cc=bo.yang@lsi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=neela.kolli@lsi.com \
--cc=sumant.patro@lsi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.