[PATCH 26/40] Staging: hv: storvsc: Handle probing IDE devices

From: K. Y. Srinivasan
Date: Wed Jun 29 2011 - 10:27:52 EST


Add code is storvsc_probe() to handle IDE devices. We currently boot
off of the first IDE disk. The emulated HBA assigned to manage the IDE
disks will be owned by this (boot) device. Subsequent IDE devices that
may be discovered will be managed by this HBA.

Signed-off-by: K. Y. Srinivasan <kys@xxxxxxxxxxxxx>
Signed-off-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
Signed-off-by: Abhishek Kane <v-abkane@xxxxxxxxxxxxx>
Signed-off-by: Hank Janssen <hjanssen@xxxxxxxxxxxxx>
---
drivers/staging/hv/storvsc_drv.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 898a311..c0d6e16 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -79,7 +79,7 @@ static void storvsc_get_ide_info(struct hv_device *dev, int *target, int *path)
dev->dev_instance.data[1] << 8 | dev->dev_instance.data[0];
}

-int storvsc_ide_probe(struct hv_device *dev)
+static int storvsc_ide_probe(struct hv_device *dev)
{
struct storvsc_device_info dev_info;
int target, path, channel;
@@ -713,6 +713,15 @@ static int storvsc_probe(struct hv_device *device)
struct Scsi_Host *host;
struct hv_host_device *host_dev;
struct storvsc_device_info device_info;
+ bool dev_is_ide;
+ int path, target;
+
+ if (!strcmp(device->device_type, "hv_block")) {
+ dev_is_ide = true;
+ if (storvsc_host)
+ return storvsc_ide_probe(device);
+ } else
+ dev_is_ide = false;

host = scsi_host_alloc(&scsi_driver,
sizeof(struct hv_host_device));
@@ -751,8 +760,15 @@ static int storvsc_probe(struct hv_device *device)
* This stor device owns the HBA; capture that state.
*/
((struct storvsc_device *)device->ext)->hba_owner = true;
- host_dev->path = device_info.path_id;
- host_dev->target = device_info.target_id;
+
+ if (dev_is_ide) {
+ storvsc_get_ide_info(device, &target, &path);
+ host_dev->path = path;
+ host_dev->target = target;
+ } else {
+ host_dev->path = device_info.path_id;
+ host_dev->target = device_info.target_id;
+ }

/* max # of devices per target */
host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
@@ -772,6 +788,7 @@ static int storvsc_probe(struct hv_device *device)
return -ENODEV;
}
scsi_scan_host(host);
+ storvsc_host = host;
return ret;
}

--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/