Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
#include <cam/cam_sim.h> | #include <cam/cam_sim.h> | ||||
#include <cam/cam_xpt_sim.h> | #include <cam/cam_xpt_sim.h> | ||||
#include <cam/cam_xpt_internal.h> | #include <cam/cam_xpt_internal.h> | ||||
#include <cam/cam_debug.h> | #include <cam/cam_debug.h> | ||||
#include <cam/scsi/scsi_all.h> | #include <cam/scsi/scsi_all.h> | ||||
#include <cam/scsi/scsi_message.h> | #include <cam/scsi/scsi_message.h> | ||||
#include <dev/hyperv/include/hyperv.h> | #include <dev/hyperv/include/hyperv.h> | ||||
#include "hv_vstorage.h" | #include "hv_vstorage.h" | ||||
#include "vmbus_if.h" | |||||
#define STORVSC_RINGBUFFER_SIZE (20*PAGE_SIZE) | #define STORVSC_RINGBUFFER_SIZE (20*PAGE_SIZE) | ||||
#define STORVSC_MAX_LUNS_PER_TARGET (64) | #define STORVSC_MAX_LUNS_PER_TARGET (64) | ||||
#define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) | #define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) | ||||
#define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) | #define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) | ||||
#define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS | #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS | ||||
#define STORVSC_MAX_TARGETS (2) | #define STORVSC_MAX_TARGETS (2) | ||||
▲ Show 20 Lines • Show All 376 Lines • ▼ Show 20 Lines | |||||
hv_storvsc_channel_init(struct hv_device *dev) | hv_storvsc_channel_init(struct hv_device *dev) | ||||
{ | { | ||||
int ret = 0, i; | int ret = 0, i; | ||||
struct hv_storvsc_request *request; | struct hv_storvsc_request *request; | ||||
struct vstor_packet *vstor_packet; | struct vstor_packet *vstor_packet; | ||||
struct storvsc_softc *sc; | struct storvsc_softc *sc; | ||||
uint16_t max_chans = 0; | uint16_t max_chans = 0; | ||||
boolean_t support_multichannel = FALSE; | boolean_t support_multichannel = FALSE; | ||||
uint32_t version; | |||||
max_chans = 0; | max_chans = 0; | ||||
support_multichannel = FALSE; | support_multichannel = FALSE; | ||||
sc = get_stor_device(dev, TRUE); | sc = get_stor_device(dev, TRUE); | ||||
if (sc == NULL) | if (sc == NULL) | ||||
return (ENODEV); | return (ENODEV); | ||||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | hv_storvsc_channel_init(struct hv_device *dev) | ||||
/* TODO: Check returned version */ | /* TODO: Check returned version */ | ||||
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || | if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || | ||||
vstor_packet->status != 0) { | vstor_packet->status != 0) { | ||||
goto cleanup; | goto cleanup; | ||||
} | } | ||||
/* multi-channels feature is supported by WIN8 and above version */ | /* multi-channels feature is supported by WIN8 and above version */ | ||||
max_chans = vstor_packet->u.chan_props.max_channel_cnt; | max_chans = vstor_packet->u.chan_props.max_channel_cnt; | ||||
if ((hv_vmbus_protocal_version != HV_VMBUS_VERSION_WIN7) && | version = VMBUS_GET_VERSION(device_get_parent(dev->device), | ||||
(hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) && | dev->device); | ||||
if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 && | |||||
(vstor_packet->u.chan_props.flags & | (vstor_packet->u.chan_props.flags & | ||||
HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { | HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { | ||||
support_multichannel = TRUE; | support_multichannel = TRUE; | ||||
} | } | ||||
memset(vstor_packet, 0, sizeof(struct vstor_packet)); | memset(vstor_packet, 0, sizeof(struct vstor_packet)); | ||||
vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; | vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; | ||||
vstor_packet->flags = REQUEST_COMPLETION_FLAG; | vstor_packet->flags = REQUEST_COMPLETION_FLAG; | ||||
▲ Show 20 Lines • Show All 1,574 Lines • Show Last 20 Lines |