From 55634341b692b91a72f5d7e9d85fea33de5fc4c2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 28 Aug 2009 16:25:21 -0700 Subject: [PATCH] --- yaml --- r: 162255 b: refs/heads/master c: 44c67577b3e98ee89aabf021bdae1cacee362660 h: refs/heads/master i: 162253: bdc8bd841882e8036f0da17524454542eefa1096 162251: da77b5edef0f09523c2411c6a6f9f34f2a8d44de 162247: 9c3c752f24117798c1b10bae8ddf1d4d8c72e55a 162239: 25bb782e557bc6200d0ff130ec0e89447c18a06d v: v3 --- [refs] | 2 +- trunk/drivers/staging/hv/BlkVsc.c | 106 ++++++++++++++---------------- 2 files changed, 52 insertions(+), 56 deletions(-) diff --git a/[refs] b/[refs] index 5a80904a5597..e50dc07b4a87 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 216260d8b8225249a114494581ab387290102c1b +refs/heads/master: 44c67577b3e98ee89aabf021bdae1cacee362660 diff --git a/trunk/drivers/staging/hv/BlkVsc.c b/trunk/drivers/staging/hv/BlkVsc.c index d433d8c444f7..2f54a93f90b6 100644 --- a/trunk/drivers/staging/hv/BlkVsc.c +++ b/trunk/drivers/staging/hv/BlkVsc.c @@ -19,95 +19,91 @@ * Hank Janssen * */ - #include #include #include "osd.h" #include "StorVsc.c" -static const char* gBlkDriverName="blkvsc"; +static const char *gBlkDriverName = "blkvsc"; /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ -static const struct hv_guid gBlkVscDeviceType={ +static const struct hv_guid gBlkVscDeviceType = { .data = { 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 } }; -/* Static routines */ -static int -BlkVscOnDeviceAdd( - struct hv_device *Device, - void *AdditionalInfo - ); - - -int -BlkVscInitialize( - struct hv_driver *Driver - ) +static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) { - struct storvsc_driver_object *storDriver = (struct storvsc_driver_object *)Driver; - int ret=0; + struct storvsc_device_info *deviceInfo; + int ret = 0; DPRINT_ENTER(BLKVSC); - /* Make sure we are at least 2 pages since 1 page is used for control */ - ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); - - Driver->name = gBlkDriverName; - memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid)); - - storDriver->RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION); - /* Divide the ring buffer data size (which is 1 page less than the ring buffer size since that page is reserved for the ring buffer indices) */ - /* by the max request size (which is VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + struct vstor_packet + u64) */ - storDriver->MaxOutstandingRequestsPerChannel = - ((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct vstor_packet) + sizeof(u64),sizeof(u64))); + deviceInfo = (struct storvsc_device_info *)AdditionalInfo; - DPRINT_INFO(BLKVSC, "max io outstd %u", storDriver->MaxOutstandingRequestsPerChannel); + ret = StorVscOnDeviceAdd(Device, AdditionalInfo); + if (ret != 0) { + DPRINT_EXIT(BLKVSC); + return ret; + } - /* Setup the dispatch table */ - storDriver->Base.OnDeviceAdd = BlkVscOnDeviceAdd; - storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove; - storDriver->Base.OnCleanup = StorVscOnCleanup; + /* + * We need to use the device instance guid to set the path and target + * id. For IDE devices, the device instance id is formatted as + * * - - 8899 - 000000000000. + */ + deviceInfo->PathId = Device->deviceInstance.data[3] << 24 | + Device->deviceInstance.data[2] << 16 | + Device->deviceInstance.data[1] << 8 | + Device->deviceInstance.data[0]; - storDriver->OnIORequest = StorVscOnIORequest; + deviceInfo->TargetId = Device->deviceInstance.data[5] << 8 | + Device->deviceInstance.data[4]; DPRINT_EXIT(BLKVSC); return ret; } -static int -BlkVscOnDeviceAdd( - struct hv_device *Device, - void *AdditionalInfo - ) +int BlkVscInitialize(struct hv_driver *Driver) { - int ret=0; - struct storvsc_device_info *deviceInfo = (struct storvsc_device_info *)AdditionalInfo; + struct storvsc_driver_object *storDriver; + int ret = 0; DPRINT_ENTER(BLKVSC); - ret = StorVscOnDeviceAdd(Device, AdditionalInfo); + storDriver = (struct storvsc_driver_object *)Driver; - if (ret != 0) - { - DPRINT_EXIT(BLKVSC); + /* Make sure we are at least 2 pages since 1 page is used for control */ + ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); - return ret; - } + Driver->name = gBlkDriverName; + memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid)); - /* We need to use the device instance guid to set the path and target id. For IDE devices, the */ - /* device instance id is formatted as - - 8899 - 000000000000. */ - deviceInfo->PathId = Device->deviceInstance.data[3] << 24 | - Device->deviceInstance.data[2] << 16 | - Device->deviceInstance.data[1] << 8 | - Device->deviceInstance.data[0]; + storDriver->RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION); - deviceInfo->TargetId = Device->deviceInstance.data[5] << 8 | - Device->deviceInstance.data[4]; + /* + * Divide the ring buffer data size (which is 1 page less than the ring + * buffer size since that page is reserved for the ring buffer indices) + * by the max request size (which is + * VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + struct vstor_packet + u64) + */ + storDriver->MaxOutstandingRequestsPerChannel = + ((storDriver->RingBufferSize - PAGE_SIZE) / + ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + + sizeof(struct vstor_packet) + sizeof(u64), + sizeof(u64))); + + DPRINT_INFO(BLKVSC, "max io outstd %u", + storDriver->MaxOutstandingRequestsPerChannel); + + /* Setup the dispatch table */ + storDriver->Base.OnDeviceAdd = BlkVscOnDeviceAdd; + storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove; + storDriver->Base.OnCleanup = StorVscOnCleanup; + storDriver->OnIORequest = StorVscOnIORequest; DPRINT_EXIT(BLKVSC);