From patchwork Tue Feb 6 20:30:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10204073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 71AF8601A1 for ; Tue, 6 Feb 2018 20:48:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5755620499 for ; Tue, 6 Feb 2018 20:48:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B51225F31; Tue, 6 Feb 2018 20:48:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6573C20499 for ; Tue, 6 Feb 2018 20:48:44 +0000 (UTC) Received: from localhost ([::1]:60307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejAAV-0001ZW-WE for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Feb 2018 15:48:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9uF-0001GT-P3 for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej9uC-0003KG-Er for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:55 -0500 Received: from mail-db5eur01on0132.outbound.protection.outlook.com ([104.47.2.132]:58540 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej9uC-0003JV-4b for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qALjUu/oshzsrN8wfHqz8Es7WVaXBTFY8yySmDSyiIA=; b=I1XC3YQSec4tvD5B8xbb2jiMuW20NRRkwTrraSLEGuuFR479BAKWbiy2rmI7Fximr5RtyPWRWROe1sAIUlC2PfRvJvzekXAD+oBF4ptvKEi0hAWF9kuerfY2F12jkPa8fwp/cr5i1oIUud4Zqaf+fGLZEgX3vOoxm1pfsrrwJtE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Tue, 6 Feb 2018 20:31:48 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 23:30:38 +0300 Message-Id: <20180206203048.11096-25-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206203048.11096-1-rkagan@virtuozzo.com> References: <20180206203048.11096-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0301CA0008.eurprd03.prod.outlook.com (2603:10a6:3:76::18) To VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f5619c0-e174-4173-28d0-08d56da0a66d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB1983; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 3:WfpQp8vVY+uop1iXILo6OpbuK5DGZSSsTTBR5YO/zuHTpntiVnPHqgMwoAFbP4R3YKWtwye3RjypWNKebKxejai7hASwza/AeTPe7O6ctS6Gkhi5X7Xv+7sJk5hNlULlKHiOR9D4ITjBqFnMoZv18NKrXble1km6sibN68HdSerTb/WVwGqfbSQcLErLVqOThqv4HazU1CvZD6BP6kJNn0w3BxC3zLgXAVEfdQuTZNCQRYJ6VN3+LeUyhy1Q6/++; 25:q3g8gQ8xldcQIDGV5zlnv2dDdu8jJvM1yO6A/krWfalrG4YHo3jZpKVDYAhYyFURamaseMPXSdTTCB9pzYJgshJHERhxubxY2pbyvN6DM0vU9fzBLU7jjFrfoZm4wpECX0XarIyUUHgcXPVA7B51XwqAc0T5JF6UwHbutOosvKzIhzM5jsaJ7gTyod5Ow61bt5PtyBW2ZYfPgEgCflikUy4uHfudOiNwpn90vz0T5EQJkHKNgPi8YJRZdfhoMZdxVaqsoScZWBIMy50c6vQU1F85cGStExun76DlRNBSbcuWqnmDct4fm93PxZYB7znoP6kPhTqckbwE5zacshs+XA==; 31:Urayt2VAlcSO0dHj9mpSVE98eVhzNDPYiWhr2UjWRP4JZHu/8ADkkCO+D2kQ6kXoQNbGeHk+XNVX7PdaQ4wh9LwjAA3tZrmypXCZsaVC9Y5Nx3SfKLc65xhUHL0vp44ldgj0AfaovmJ9hGOpzzFS63FAxsOBojEBaF0c4GSCTIlhsRwayG5cbp0FXpOgtYUwTUV9UeopkfD9AH+iD+joyjLQEzk2Ltx1a6ekZW9Kvg4= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1983: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:TQfd5PlcXqbUWFDkCfU8HcyvJK8ZmdeXm9m25zH79kKgeEL1AZCYBTTKQWuwO1cz0WnTOo/Glo+rQ2cUEEGFr7hr4TD8NYqw1VQc9CspxtTUyT2qSIed1GDJKtIH3rrfR498KKSTp8FXZG7lYr2DocyOH2pZOp7CSTsA0kEIzGOn8l4+eg2RYxkAapf7CpenyWOqLwUveMgr4xBr3gCe7wT3rFKrYQjrfKGttITr9fLqKAJT6/8q05qxaUJiDoQbrfsMicB/ly2avkvu9wGE+4nC1WhUyBUZ4QUg5FaDzecEqqIvzIuwzWeCpeO5405Drtq3L2cB974CjXcb/IJtL2Jofr3xR+hhfwk4E/CJ1rY3ZLFTVKNGw1U+/vOHnpSGqnHck9UoFRHlrSrgJ6pzaApQyywLNSb0JgOa4zGZOlI=; 4:XAnDyfS93sEuHM4iI6QQGBW8pqA5acWDMnUGtznFjXGVBWDsq+uLDS3DEInERqRYrRH91rZM58vpM45NgfWAt5+UZ9bWRqwVi8wvLTWAoViq5odF3NtjPIorJ/5oW0L5iZ6J73nrsHWam8/gmX88mvkS19Uo2OBFf15nOaDbCOBVYs7AB6XVUJKeaNAy5WFA4EStNAFr9A4PKFr6Dv8OUO0TvDriTQBK5ueIa5Hfv9NqvmXefBYb/dwSRmV3TIWQx+T19LfHyOSmXoM1eVGI0w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231101)(2400082)(944501161)(10201501046)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0801MB1983; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1983; X-Forefront-PRVS: 0575F81B58 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(1496009)(396003)(366004)(376002)(39380400002)(39850400004)(346002)(189003)(199004)(16586007)(53936002)(305945005)(54906003)(7736002)(3846002)(316002)(105586002)(2361001)(106356001)(2351001)(6116002)(1076002)(50226002)(8936002)(81156014)(5660300001)(8676002)(81166006)(7416002)(2950100002)(6666003)(6916009)(76176011)(575784001)(86362001)(68736007)(66066001)(45080400002)(16526019)(47776003)(50466002)(4326008)(97736004)(26005)(6512007)(51416003)(2906002)(52116002)(386003)(6506007)(59450400001)(48376002)(55236004)(36756003)(53416004)(69596002)(6486002)(478600001)(186003)(25786009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1983; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1983; 23:f3QlhRGIR8AR4+Qsrexym/BEY+A58UECpO5MxS4?= =?us-ascii?Q?RO13nI3nwMJGYB/nn4OlTDGrRkRK+Tb9Bq11wpoVCtv8wQXOfwb06as9lnPC?= =?us-ascii?Q?uKhlNTqd72QrTrfjOS+AjRUTzfL1IaV5Jmd55CXU+vJFZLq41KM4tiOEEy5U?= =?us-ascii?Q?ieWd6RR8aaoCm8KMPXMJaV6e81HxHjq9TYA1fdt8Z1FJrryihBqW8RPTZReP?= =?us-ascii?Q?feVt3myBJb9vOsNrXX/I+viILXUG6fjn5U5AvOVH34N/HomgVVQ7lZY/nka7?= =?us-ascii?Q?g1WWXNDXGXhIBXVf+LJe7SCJr34c1cHdf0+9K4cE8esQUvjQqKGMn7Q1rvKR?= =?us-ascii?Q?TobNKjqdmuzllI/SiOfSdetDO+o0EY31LAClXMlw5lkMXv2HYGU5C7EG0cu7?= =?us-ascii?Q?xFBA/4VSNm1j3s6U/7EQHR/83IPbn+PudZbPCq72F+oLyk6hZaE3/X5UvsUh?= =?us-ascii?Q?4ZhjoSL2VLb2mmQMu0U6BWKaNZd7ww6Zm0hAzNmO0PotbJQYhsbPwLNToqXZ?= =?us-ascii?Q?Wx7Odg9cex/atnfa3pJD7qvoxJhOSsxiBMiaGqqZxsWlc5W+xvN4VO7n8qQt?= =?us-ascii?Q?C1DYi1OmboTMZonSwjQQWIue6bVGwtcwBAs/0A72JGdPuEaVFzMLWjX6BvtP?= =?us-ascii?Q?+wKtDWhPCjaVFwugb6GW32cl2d8QxOZl8N9ebMMO/TVnt7tXe2hOm6RTC3nB?= =?us-ascii?Q?USUzJh3QgiB1qsFcLKeqfH/K2G9l4J2dfBVTWYYdeVdwIAZwnoabB0pYjNq1?= =?us-ascii?Q?Xbze91coVrqdE9zJ7PV2kkdMFbwG5ZpdYEaygw8J/Tq/T8S+CGMMQ1StF4EJ?= =?us-ascii?Q?8BnbnaphvrWGXWz+0eTt7FP+zRbbBL9PV80Bt1NsAMCvvH5kIV0ecBfpSLOn?= =?us-ascii?Q?gfO16HuLGg72GrrtW1y/kdDfSdpCVAu0JctnLfvvmb4xWTV7LKkrX44Op9dC?= =?us-ascii?Q?M/UuRJN2S/48CawHGS0qRXBNyO9AELFHQfeNpQKarQoImUPxGcYGhPs2lk2k?= =?us-ascii?Q?41Em5ARTVav1UdOTUCAnJGCuxRIdBD7vbp24lhBXPC8P+5bESPjASvcSVabD?= =?us-ascii?Q?fkYcuDndnsr2lh+S4u5kYCsAusiYxSxiwaviSzwjLoc7pTkk0fzXFd2HWdju?= =?us-ascii?Q?DMpdZEna1e2jhl+snhE2tmLFmQ9Z8M3OQKwKd+H2hAx3Y7rgYZXg53UblMbc?= =?us-ascii?Q?qOSErM8IUR6cwSPRcTfciS/HrCcp04BwwLQP75QIk9XMemM9FzI7BK144cjT?= =?us-ascii?Q?DdWhU99KctYg7mQQx7LE0ElNuy1ZM1O86Ix/qz7DSXwYT8MUMkvflsS684Rd?= =?us-ascii?Q?CVHQFpwhoFBcA4jrM4jfv1oHkt+Wv/VGSHWdFMxAr3wor4x2yVov1Lrt1cSs?= =?us-ascii?Q?Zc8TQ/tnFwArnLdez23/NqoFr1o0=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 6:QuqSwG+9AGBwh1CZN7iVC+5SzTKDW/wOT3UxyAHq2z6OReHIHdlM0GPKSSjSTya86TUBAjASAlYW0wUwDq/e6WodUQI603QMICQdSMlwpW7AcLhI+7lEPd8TVpxSo4M2hJRb5UN6dtkcd7jQjGqVTOZQICef3qYi01zQRvVn36N9mEvs0mQkkZ6R2fHH+ISzwrU95rBxA7hnnmebk+/ohY3xKdSKWQvt1iMtnyV35squchrtJLq4BDpx79voDShVvqu9khulpjW2jZIcLA2iaUYKpGQwSBp1v49HubmlLGqONo/CnxmBYCqztNIlJltCu2+qloYZ/pMnBfKpa0ZuxlTIy9TYF/ijdpAS/Mko/RU=; 5:F9C8x9PDF/LmR/zsIECs0lY+Zdx4msi+/d/jU+bjTG2qm0VQ5dfbwZgNlbpJaWZnjCzqkHgugo+/U8TgN5wbXtgz6+xutcAzNfsKHPEdkKxa6aHQTv25HmfHqMySvv0zk3mGpz2YcqfNgWejyhwcokp4d2vxTohWfppJxgEE92o=; 24:X0I0CAcFw6vnTWHXJcjPExas0KrzTtJiZo0Wz/0/UfdJOS7zfUfzOloAWmuJclgV1XVwIUaGzmqQiH0jwNQZKSn9JBc9Gye1dso4H9a6GjU=; 7:CDWsSHk0GkNEpLsiCb4ps8bh0ZBJPh2T89WnY+hdumA8jaeZGhlaU385Ib+gt70QEX/+4hNShkArqwtKO04+dUq4Ch0Ynwen7c56V5IX9koyLWreJmOZUN9dMLTNKGqB7FY8nCGFUX+a6TYjkGb7N+jWeqDHtZ/soUPzoipEzBc5NSYKUQ/alxKjVBPU88S4fg0O+kRnR6XTSOKsWdQrWonphew/78J8xY71WWxQNqmzhU/ovKKtP/aLvLvocw1c SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:0UPUPh0GPkw1NQblE3PRmid8MliE2lTaXZcG5jTMUXHrziCy4RLNm7tUcWcYIci3iPghCOLxGD+DYr1hieUFxDK7ZYQfcuG5j9muke+oBjW53XtKuyXQY0QK5lWXF8jAmncP8a5zx2NesToEc+9N5pln0BMuUFZpwh+7/oO/ZZY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2018 20:31:48.4815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f5619c0-e174-4173-28d0-08d56da0a66d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1983 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.132 Subject: [Qemu-devel] [RFC PATCH 24/34] scsi: add Hyper-V/VMBus SCSI protocol definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Warren , Konrad Rzeszutek Wilk , Krish Sadhukhan , "Marcos E. Matsunaga" , Jan Dakinevich , Vadim Rozenfeld , "Denis V. Lunev" , si-wei liu , Paolo Bonzini , Vitaly Kuznetsov , Cathy Avery Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a header with data structures and constants defining the protocol between the guest and the hypervisor implementing the Hyper-V VMBus SCSI controller. Mostly taken from the corresponding definitions in the Linux kernel. Signed-off-by: Roman Kagan --- hw/scsi/hvscsi-proto.h | 150 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 hw/scsi/hvscsi-proto.h diff --git a/hw/scsi/hvscsi-proto.h b/hw/scsi/hvscsi-proto.h new file mode 100644 index 0000000000..9dd20c9bfa --- /dev/null +++ b/hw/scsi/hvscsi-proto.h @@ -0,0 +1,150 @@ +/* + * Hyper-V storage device protocol definitions + * + * Copyright (c) 2009, Microsoft Corporation. + * Copyright (c) 2017-2018 Virtuozzo International GmbH. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef _HVSCSI_PROTO_H_ +#define _HVSCSI_PROTO_H_ + +#define HV_STOR_PROTO_VERSION(MAJOR_, MINOR_) \ + ((((MAJOR_) & 0xff) << 8) | (((MINOR_) & 0xff))) + +#define HV_STOR_PROTO_VERSION_WIN6 HV_STOR_PROTO_VERSION(2, 0) +#define HV_STOR_PROTO_VERSION_WIN7 HV_STOR_PROTO_VERSION(4, 2) +#define HV_STOR_PROTO_VERSION_WIN8 HV_STOR_PROTO_VERSION(5, 1) +#define HV_STOR_PROTO_VERSION_WIN8_1 HV_STOR_PROTO_VERSION(6, 0) +#define HV_STOR_PROTO_VERSION_WIN10 HV_STOR_PROTO_VERSION(6, 2) +#define HV_STOR_PROTO_VERSION_CURRENT HV_STOR_PROTO_VERSION_WIN8 + +#define HV_STOR_OPERATION_COMPLETE_IO 1 +#define HV_STOR_OPERATION_REMOVE_DEVICE 2 +#define HV_STOR_OPERATION_EXECUTE_SRB 3 +#define HV_STOR_OPERATION_RESET_LUN 4 +#define HV_STOR_OPERATION_RESET_ADAPTER 5 +#define HV_STOR_OPERATION_RESET_BUS 6 +#define HV_STOR_OPERATION_BEGIN_INITIALIZATION 7 +#define HV_STOR_OPERATION_END_INITIALIZATION 8 +#define HV_STOR_OPERATION_QUERY_PROTOCOL_VERSION 9 +#define HV_STOR_OPERATION_QUERY_PROPERTIES 10 +#define HV_STOR_OPERATION_ENUMERATE_BUS 11 +#define HV_STOR_OPERATION_FCHBA_DATA 12 +#define HV_STOR_OPERATION_CREATE_SUB_CHANNELS 13 + +#define HV_STOR_REQUEST_COMPLETION_FLAG 0x1 + +#define HV_STOR_PROPERTIES_MULTI_CHANNEL_FLAG 0x1 + +#define HV_SRB_MAX_CDB_SIZE 16 +#define HV_SRB_SENSE_BUFFER_SIZE 20 + +#define HV_SRB_REQUEST_TYPE_WRITE 0 +#define HV_SRB_REQUEST_TYPE_READ 1 +#define HV_SRB_REQUEST_TYPE_UNKNOWN 2 + +#define HV_SRB_MAX_LUNS_PER_TARGET 255 +#define HV_SRB_MAX_TARGETS 2 +#define HV_SRB_MAX_CHANNELS 8 + +#define HV_SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 +#define HV_SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 +#define HV_SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 +#define HV_SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 +#define HV_SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 +#define HV_SRB_FLAGS_DATA_IN 0x00000040 +#define HV_SRB_FLAGS_DATA_OUT 0x00000080 +#define HV_SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 +#define HV_SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) +#define HV_SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 +#define HV_SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 +#define HV_SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 +#define HV_SRB_FLAGS_D3_PROCESSING 0x00000800 +#define HV_SRB_FLAGS_IS_ACTIVE 0x00010000 +#define HV_SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000 +#define HV_SRB_FLAGS_SGLIST_FROM_POOL 0x00040000 +#define HV_SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000 +#define HV_SRB_FLAGS_NO_KEEP_AWAKE 0x00100000 +#define HV_SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000 +#define HV_SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000 +#define HV_SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000 +#define HV_SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000 +#define HV_SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000 + +#define HV_SRB_STATUS_AUTOSENSE_VALID 0x80 +#define HV_SRB_STATUS_INVALID_LUN 0x20 +#define HV_SRB_STATUS_SUCCESS 0x01 +#define HV_SRB_STATUS_ABORTED 0x02 +#define HV_SRB_STATUS_ERROR 0x04 + +#define HV_STOR_PACKET_MAX_LENGTH sizeof(struct hv_stor_packet) +#define HV_STOR_PACKET_MIN_LENGTH \ + (sizeof(struct hv_stor_packet) - sizeof(struct hv_srb_win8_extentions)) + +typedef struct hv_stor_properties { + uint32_t _reserved1; + uint16_t max_channel_count; + uint16_t _reserved2; + uint32_t flags; + uint32_t max_transfer_bytes; + uint32_t _reserved3[2]; +} hv_stor_properties; + +typedef struct hv_srb_win8_extentions { + uint16_t _reserved; + uint8_t queue_tag; + uint8_t queue_action; + uint32_t srb_flags; + uint32_t timeout; + uint32_t queue_sort; +} hv_srb_win8_extentions; + +typedef struct hv_srb_packet { + uint16_t length; + uint8_t srb_status; + uint8_t scsi_status; + + uint8_t port; + uint8_t channel; + uint8_t target; + uint8_t lun; + + uint8_t cdb_length; + uint8_t sense_length; + uint8_t data_in; + uint8_t _reserved; + + uint32_t transfer_length; + + union { + uint8_t cdb[HV_SRB_MAX_CDB_SIZE]; + uint8_t sense_data[HV_SRB_SENSE_BUFFER_SIZE]; + }; + + hv_srb_win8_extentions win8_ext; +} hv_srb_packet; + +typedef struct hv_stor_protocol_version { + uint16_t major_minor; + uint16_t revision; +} hv_stor_protocol_version; + +typedef struct hv_stor_packet { + uint32_t operation; /* HV_STOR_OPERATION_* */ + uint32_t flags; // HV_STOR_FLAG_* */ + uint32_t status; + + union { + hv_srb_packet srb; + hv_stor_properties properties; + hv_stor_protocol_version version; + uint16_t sub_channel_count; + + uint8_t _reserved[0x34]; + }; +} hv_stor_packet; + +#endif