hv_storvsc_drv_freebsd.c (307467) | hv_storvsc_drv_freebsd.c (307471) |
---|---|
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 307467 2016-10-17 03:51:56Z sephe $"); | 36__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c 307471 2016-10-17 05:28:06Z 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/sysctl.h> 44#include <sys/sockio.h> --- 38 unchanged lines hidden (view full) --- 83#define STORVSC_MAX_LUNS_PER_TARGET (64) 84#define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) 85#define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) 86#define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS 87#define STORVSC_MAX_TARGETS (2) 88 89#define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) 90 | 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/sysctl.h> 44#include <sys/sockio.h> --- 38 unchanged lines hidden (view full) --- 83#define STORVSC_MAX_LUNS_PER_TARGET (64) 84#define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) 85#define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) 86#define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS 87#define STORVSC_MAX_TARGETS (2) 88 89#define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) 90 |
91#define STORVSC_DATA_SEGCNT_MAX VMBUS_CHAN_PRPLIST_MAX | 91/* 92 * 33 segments are needed to allow 128KB maxio, in case the data 93 * in the first page is _not_ PAGE_SIZE aligned, e.g. 94 * 95 * |<----------- 128KB ----------->| 96 * | | 97 * 0 2K 4K 8K 16K 124K 128K 130K 98 * | | | | | | | | 99 * +--+--+-----+-----+.......+-----+--+--+ 100 * | | | | | | | | | DATA 101 * | | | | | | | | | 102 * +--+--+-----+-----+.......------+--+--+ 103 * | | | | 104 * | 1| 31 | 1| ...... # of segments 105 */ 106#define STORVSC_DATA_SEGCNT_MAX 33 |
92#define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE 93#define STORVSC_DATA_SIZE_MAX \ | 107#define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE 108#define STORVSC_DATA_SIZE_MAX \ |
94 (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) | 109 ((STORVSC_DATA_SEGCNT_MAX - 1) * STORVSC_DATA_SEGSZ_MAX) |
95 96struct storvsc_softc; 97 98struct hv_sgl_node { 99 LIST_ENTRY(hv_sgl_node) link; 100 struct sglist *sgl_data; 101}; 102 --- 1280 unchanged lines hidden (view full) --- 1383 struct ccb_pathinq *cpi = &ccb->cpi; 1384 1385 cpi->version_num = 1; 1386 cpi->hba_inquiry = PI_TAG_ABLE|PI_SDTR_ABLE; 1387 cpi->target_sprt = 0; 1388 cpi->hba_misc = PIM_NOBUSRESET; 1389 if (hv_storvsc_use_pim_unmapped) 1390 cpi->hba_misc |= PIM_UNMAPPED; | 110 111struct storvsc_softc; 112 113struct hv_sgl_node { 114 LIST_ENTRY(hv_sgl_node) link; 115 struct sglist *sgl_data; 116}; 117 --- 1280 unchanged lines hidden (view full) --- 1398 struct ccb_pathinq *cpi = &ccb->cpi; 1399 1400 cpi->version_num = 1; 1401 cpi->hba_inquiry = PI_TAG_ABLE|PI_SDTR_ABLE; 1402 cpi->target_sprt = 0; 1403 cpi->hba_misc = PIM_NOBUSRESET; 1404 if (hv_storvsc_use_pim_unmapped) 1405 cpi->hba_misc |= PIM_UNMAPPED; |
1406 cpi->maxio = STORVSC_DATA_SIZE_MAX; |
|
1391 cpi->hba_eng_cnt = 0; 1392 cpi->max_target = STORVSC_MAX_TARGETS; 1393 cpi->max_lun = sc->hs_drv_props->drv_max_luns_per_target; 1394 cpi->initiator_id = cpi->max_target; 1395 cpi->bus_id = cam_sim_bus(sim); 1396 cpi->base_transfer_speed = 300000; 1397 cpi->transport = XPORT_SAS; 1398 cpi->transport_version = 0; --- 357 unchanged lines hidden (view full) --- 1756 struct storvsc_gpa_range *prplist; 1757 int i; 1758 1759 prplist = &reqp->prp_list; 1760 prplist->gpa_range.gpa_len = csio->dxfer_len; 1761 prplist->gpa_range.gpa_ofs = segs[0].ds_addr & PAGE_MASK; 1762 1763 for (i = 0; i < nsegs; i++) { | 1407 cpi->hba_eng_cnt = 0; 1408 cpi->max_target = STORVSC_MAX_TARGETS; 1409 cpi->max_lun = sc->hs_drv_props->drv_max_luns_per_target; 1410 cpi->initiator_id = cpi->max_target; 1411 cpi->bus_id = cam_sim_bus(sim); 1412 cpi->base_transfer_speed = 300000; 1413 cpi->transport = XPORT_SAS; 1414 cpi->transport_version = 0; --- 357 unchanged lines hidden (view full) --- 1772 struct storvsc_gpa_range *prplist; 1773 int i; 1774 1775 prplist = &reqp->prp_list; 1776 prplist->gpa_range.gpa_len = csio->dxfer_len; 1777 prplist->gpa_range.gpa_ofs = segs[0].ds_addr & PAGE_MASK; 1778 1779 for (i = 0; i < nsegs; i++) { |
1764 prplist->gpa_page[i] = atop(segs[i].ds_addr); | |
1765#ifdef INVARIANTS | 1780#ifdef INVARIANTS |
1766 if (i != 0 && i != nsegs - 1) { 1767 KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && 1768 segs[i].ds_len == PAGE_SIZE, ("not a full page")); | 1781 if (nsegs > 1) { 1782 if (i == 0) { 1783 KASSERT((segs[i].ds_addr & PAGE_MASK) + 1784 segs[i].ds_len == PAGE_SIZE, 1785 ("invalid 1st page, ofs 0x%jx, len %zu", 1786 (uintmax_t)segs[i].ds_addr, 1787 segs[i].ds_len)); 1788 } else if (i == nsegs - 1) { 1789 KASSERT((segs[i].ds_addr & PAGE_MASK) == 0, 1790 ("invalid last page, ofs 0x%jx", 1791 (uintmax_t)segs[i].ds_addr)); 1792 } else { 1793 KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && 1794 segs[i].ds_len == PAGE_SIZE, 1795 ("not a full page, ofs 0x%jx, len %zu", 1796 (uintmax_t)segs[i].ds_addr, 1797 segs[i].ds_len)); 1798 } |
1769 } 1770#endif | 1799 } 1800#endif |
1801 prplist->gpa_page[i] = atop(segs[i].ds_addr); |
|
1771 } 1772 reqp->prp_cnt = nsegs; 1773} 1774 1775/** 1776 * @brief Fill in a request structure based on a CAM control block 1777 * 1778 * Fills in a request structure based on the contents of a CAM control --- 406 unchanged lines hidden --- | 1802 } 1803 reqp->prp_cnt = nsegs; 1804} 1805 1806/** 1807 * @brief Fill in a request structure based on a CAM control block 1808 * 1809 * Fills in a request structure based on the contents of a CAM control --- 406 unchanged lines hidden --- |