hv_storvsc_drv_freebsd.c (306223) | hv_storvsc_drv_freebsd.c (307302) |
---|---|
1/*- 2 * Copyright (c) 2009-2012,2016 Microsoft Corp. 3 * Copyright (c) 2012 NetApp Inc. 4 * Copyright (c) 2012 Citrix Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 29/** 30 * StorVSC driver for Hyper-V. This driver presents a SCSI HBA interface 31 * to the Comman Access Method (CAM) layer. CAM control blocks (CCBs) are 32 * converted into VSCSI protocol messages which are delivered to the parent 33 * partition StorVSP driver over the Hyper-V VMBUS. 34 */ 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2012,2016 Microsoft Corp. 3 * Copyright (c) 2012 NetApp Inc. 4 * Copyright (c) 2012 Citrix Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 29/** 30 * StorVSC driver for Hyper-V. This driver presents a SCSI HBA interface 31 * to the Comman Access Method (CAM) layer. CAM control blocks (CCBs) are 32 * converted into VSCSI protocol messages which are delivered to the parent 33 * partition StorVSP driver over the Hyper-V VMBUS. 34 */ 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c 306223 2016-09-23 03:21:40Z sephe $"); | 36__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c 307302 2016-10-14 08:02:37Z sephe $"); |
37 38#include <sys/param.h> 39#include <sys/proc.h> 40#include <sys/condvar.h> 41#include <sys/time.h> 42#include <sys/systm.h> 43#include <sys/sockio.h> 44#include <sys/mbuf.h> --- 22 unchanged lines hidden (view full) --- 67#include <cam/cam_sim.h> 68#include <cam/cam_xpt_sim.h> 69#include <cam/cam_xpt_internal.h> 70#include <cam/cam_debug.h> 71#include <cam/scsi/scsi_all.h> 72#include <cam/scsi/scsi_message.h> 73 74#include <dev/hyperv/include/hyperv.h> | 37 38#include <sys/param.h> 39#include <sys/proc.h> 40#include <sys/condvar.h> 41#include <sys/time.h> 42#include <sys/systm.h> 43#include <sys/sockio.h> 44#include <sys/mbuf.h> --- 22 unchanged lines hidden (view full) --- 67#include <cam/cam_sim.h> 68#include <cam/cam_xpt_sim.h> 69#include <cam/cam_xpt_internal.h> 70#include <cam/cam_debug.h> 71#include <cam/scsi/scsi_all.h> 72#include <cam/scsi/scsi_message.h> 73 74#include <dev/hyperv/include/hyperv.h> |
75 |
|
75#include "hv_vstorage.h" | 76#include "hv_vstorage.h" |
77#include "vmbus_if.h" |
|
76 77#define STORVSC_RINGBUFFER_SIZE (20*PAGE_SIZE) 78#define STORVSC_MAX_LUNS_PER_TARGET (64) 79#define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) 80#define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) 81#define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS 82#define STORVSC_MAX_TARGETS (2) 83 --- 272 unchanged lines hidden (view full) --- 356 357 device = new_channel->device; 358 sc = get_stor_device(device, TRUE); 359 if (sc == NULL) 360 return; 361 362 memset(&props, 0, sizeof(props)); 363 | 78 79#define STORVSC_RINGBUFFER_SIZE (20*PAGE_SIZE) 80#define STORVSC_MAX_LUNS_PER_TARGET (64) 81#define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) 82#define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) 83#define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS 84#define STORVSC_MAX_TARGETS (2) 85 --- 272 unchanged lines hidden (view full) --- 358 359 device = new_channel->device; 360 sc = get_stor_device(device, TRUE); 361 if (sc == NULL) 362 return; 363 364 memset(&props, 0, sizeof(props)); 365 |
366 vmbus_channel_cpu_rr(new_channel); |
|
364 ret = hv_vmbus_channel_open(new_channel, 365 sc->hs_drv_props->drv_ringbuffer_size, 366 sc->hs_drv_props->drv_ringbuffer_size, 367 (void *)&props, 368 sizeof(struct vmstor_chan_props), 369 hv_storvsc_on_channel_callback, 370 new_channel); 371 --- 87 unchanged lines hidden (view full) --- 459hv_storvsc_channel_init(struct hv_device *dev) 460{ 461 int ret = 0, i; 462 struct hv_storvsc_request *request; 463 struct vstor_packet *vstor_packet; 464 struct storvsc_softc *sc; 465 uint16_t max_chans = 0; 466 boolean_t support_multichannel = FALSE; | 367 ret = hv_vmbus_channel_open(new_channel, 368 sc->hs_drv_props->drv_ringbuffer_size, 369 sc->hs_drv_props->drv_ringbuffer_size, 370 (void *)&props, 371 sizeof(struct vmstor_chan_props), 372 hv_storvsc_on_channel_callback, 373 new_channel); 374 --- 87 unchanged lines hidden (view full) --- 462hv_storvsc_channel_init(struct hv_device *dev) 463{ 464 int ret = 0, i; 465 struct hv_storvsc_request *request; 466 struct vstor_packet *vstor_packet; 467 struct storvsc_softc *sc; 468 uint16_t max_chans = 0; 469 boolean_t support_multichannel = FALSE; |
470 uint32_t version; |
|
467 468 max_chans = 0; 469 support_multichannel = FALSE; 470 471 sc = get_stor_device(dev, TRUE); 472 if (sc == NULL) 473 return (ENODEV); 474 --- 108 unchanged lines hidden (view full) --- 583 /* TODO: Check returned version */ 584 if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || 585 vstor_packet->status != 0) { 586 goto cleanup; 587 } 588 589 /* multi-channels feature is supported by WIN8 and above version */ 590 max_chans = vstor_packet->u.chan_props.max_channel_cnt; | 471 472 max_chans = 0; 473 support_multichannel = FALSE; 474 475 sc = get_stor_device(dev, TRUE); 476 if (sc == NULL) 477 return (ENODEV); 478 --- 108 unchanged lines hidden (view full) --- 587 /* TODO: Check returned version */ 588 if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || 589 vstor_packet->status != 0) { 590 goto cleanup; 591 } 592 593 /* multi-channels feature is supported by WIN8 and above version */ 594 max_chans = vstor_packet->u.chan_props.max_channel_cnt; |
591 if ((hv_vmbus_protocal_version != HV_VMBUS_VERSION_WIN7) && 592 (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) && | 595 version = VMBUS_GET_VERSION(device_get_parent(dev->device), 596 dev->device); 597 if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 && |
593 (vstor_packet->u.chan_props.flags & 594 HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { 595 support_multichannel = TRUE; 596 } 597 598 memset(vstor_packet, 0, sizeof(struct vstor_packet)); 599 vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; 600 vstor_packet->flags = REQUEST_COMPLETION_FLAG; --- 49 unchanged lines hidden (view full) --- 650 651 sc = device_get_softc(dev->device); 652 653 memset(&props, 0, sizeof(struct vmstor_chan_props)); 654 655 /* 656 * Open the channel 657 */ | 598 (vstor_packet->u.chan_props.flags & 599 HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { 600 support_multichannel = TRUE; 601 } 602 603 memset(vstor_packet, 0, sizeof(struct vstor_packet)); 604 vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; 605 vstor_packet->flags = REQUEST_COMPLETION_FLAG; --- 49 unchanged lines hidden (view full) --- 655 656 sc = device_get_softc(dev->device); 657 658 memset(&props, 0, sizeof(struct vmstor_chan_props)); 659 660 /* 661 * Open the channel 662 */ |
658 | 663 vmbus_channel_cpu_rr(dev->channel); |
659 ret = hv_vmbus_channel_open( 660 dev->channel, 661 sc->hs_drv_props->drv_ringbuffer_size, 662 sc->hs_drv_props->drv_ringbuffer_size, 663 (void *)&props, 664 sizeof(struct vmstor_chan_props), 665 hv_storvsc_on_channel_callback, 666 dev->channel); --- 1489 unchanged lines hidden --- | 664 ret = hv_vmbus_channel_open( 665 dev->channel, 666 sc->hs_drv_props->drv_ringbuffer_size, 667 sc->hs_drv_props->drv_ringbuffer_size, 668 (void *)&props, 669 sizeof(struct vmstor_chan_props), 670 hv_storvsc_on_channel_callback, 671 dev->channel); --- 1489 unchanged lines hidden --- |