Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * VMware PVSCSI header file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (C) 2008-2014, VMware, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * This program is free software; you can redistribute it and/or modify it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * under the terms of the GNU General Public License as published by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Free Software Foundation; version 2 of the License and no later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * This program is distributed in the hope that it will be useful, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * NON INFRINGEMENT.  See the GNU General Public License for more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * You should have received a copy of the GNU General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * along with this program; if not, write to the Free Software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * Maintained by: Jim Gill <jgill@vmware.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #ifndef _VMW_PVSCSI_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define _VMW_PVSCSI_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define PVSCSI_DRIVER_VERSION_STRING   "1.0.7.0-k"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define MASK(n)        ((1 << (n)) - 1)        /* make an n-bit mask */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define PCI_DEVICE_ID_VMWARE_PVSCSI	0x07C0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * host adapter status/error codes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) enum HostBusAdapterStatus {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	BTSTAT_SUCCESS       = 0x00,  /* CCB complete normally with no errors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	BTSTAT_LINKED_COMMAND_COMPLETED           = 0x0a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG = 0x0b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	BTSTAT_DATA_UNDERRUN = 0x0c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	BTSTAT_SELTIMEO      = 0x11,  /* SCSI selection timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	BTSTAT_DATARUN       = 0x12,  /* data overrun/underrun */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	BTSTAT_BUSFREE       = 0x13,  /* unexpected bus free */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	BTSTAT_INVPHASE      = 0x14,  /* invalid bus phase or sequence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 				       * requested by target */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	BTSTAT_LUNMISMATCH   = 0x17,  /* linked CCB has different LUN from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 				       * first CCB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	BTSTAT_INVPARAM      = 0x1a,  /* invalid parameter in CCB or segment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 				       * list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	BTSTAT_SENSFAILED    = 0x1b,  /* auto request sense failed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	BTSTAT_TAGREJECT     = 0x1c,  /* SCSI II tagged queueing message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 				       * rejected by target */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	BTSTAT_BADMSG        = 0x1d,  /* unsupported message received by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 				       * host adapter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	BTSTAT_HAHARDWARE    = 0x20,  /* host adapter hardware failed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	BTSTAT_NORESPONSE    = 0x21,  /* target did not respond to SCSI ATN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 				       * sent a SCSI RST */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	BTSTAT_SENTRST       = 0x22,  /* host adapter asserted a SCSI RST */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	BTSTAT_RECVRST       = 0x23,  /* other SCSI devices asserted a SCSI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 				       * RST */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	BTSTAT_DISCONNECT    = 0x24,  /* target device reconnected improperly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 				       * (w/o tag) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	BTSTAT_BUSRESET      = 0x25,  /* host adapter issued BUS device reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	BTSTAT_ABORTQUEUE    = 0x26,  /* abort queue generated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	BTSTAT_HASOFTWARE    = 0x27,  /* host adapter software error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	BTSTAT_HATIMEOUT     = 0x30,  /* host adapter hardware timeout error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	BTSTAT_SCSIPARITY    = 0x34,  /* SCSI parity error detected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * SCSI device status values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) enum ScsiDeviceStatus {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	SDSTAT_GOOD  = 0x00, /* No errors. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	SDSTAT_CHECK = 0x02, /* Check condition. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * Register offsets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * These registers are accessible both via i/o space and mm i/o.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) enum PVSCSIRegOffset {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	PVSCSI_REG_OFFSET_COMMAND        =    0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	PVSCSI_REG_OFFSET_COMMAND_DATA   =    0x4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	PVSCSI_REG_OFFSET_COMMAND_STATUS =    0x8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	PVSCSI_REG_OFFSET_LAST_STS_0     =  0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	PVSCSI_REG_OFFSET_LAST_STS_1     =  0x104,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	PVSCSI_REG_OFFSET_LAST_STS_2     =  0x108,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	PVSCSI_REG_OFFSET_LAST_STS_3     =  0x10c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	PVSCSI_REG_OFFSET_INTR_STATUS    = 0x100c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	PVSCSI_REG_OFFSET_INTR_MASK      = 0x2010,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	PVSCSI_REG_OFFSET_KICK_NON_RW_IO = 0x3014,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	PVSCSI_REG_OFFSET_DEBUG          = 0x3018,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	PVSCSI_REG_OFFSET_KICK_RW_IO     = 0x4018,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  * Virtual h/w commands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) enum PVSCSICommands {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	PVSCSI_CMD_FIRST             = 0, /* has to be first */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	PVSCSI_CMD_ADAPTER_RESET     = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	PVSCSI_CMD_ISSUE_SCSI        = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	PVSCSI_CMD_SETUP_RINGS       = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	PVSCSI_CMD_RESET_BUS         = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	PVSCSI_CMD_RESET_DEVICE      = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	PVSCSI_CMD_ABORT_CMD         = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	PVSCSI_CMD_CONFIG            = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	PVSCSI_CMD_SETUP_MSG_RING    = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	PVSCSI_CMD_DEVICE_UNPLUG     = 9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	PVSCSI_CMD_SETUP_REQCALLTHRESHOLD     = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	PVSCSI_CMD_LAST              = 11  /* has to be last */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * Command descriptor for PVSCSI_CMD_RESET_DEVICE --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct PVSCSICmdDescResetDevice {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	u32	target;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	u8	lun[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * Command descriptor for PVSCSI_CMD_CONFIG --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct PVSCSICmdDescConfigCmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	u64 cmpAddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	u64 configPageAddress;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	u32 configPageNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	u32 _pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * Command descriptor for PVSCSI_CMD_SETUP_REQCALLTHRESHOLD --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct PVSCSICmdDescSetupReqCall {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	u32 enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) enum PVSCSIConfigPageType {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	PVSCSI_CONFIG_PAGE_CONTROLLER = 0x1958,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	PVSCSI_CONFIG_PAGE_PHY        = 0x1959,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	PVSCSI_CONFIG_PAGE_DEVICE     = 0x195a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) enum PVSCSIConfigPageAddressType {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	PVSCSI_CONFIG_CONTROLLER_ADDRESS = 0x2120,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	PVSCSI_CONFIG_BUSTARGET_ADDRESS  = 0x2121,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	PVSCSI_CONFIG_PHY_ADDRESS        = 0x2122,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * Command descriptor for PVSCSI_CMD_ABORT_CMD --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  * - currently does not support specifying the LUN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * - _pad should be 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) struct PVSCSICmdDescAbortCmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	u64	context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	u32	target;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	u32	_pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * Command descriptor for PVSCSI_CMD_SETUP_RINGS --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  * Notes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * - reqRingNumPages and cmpRingNumPages need to be power of two.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  * - reqRingNumPages and cmpRingNumPages need to be different from 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * - reqRingNumPages and cmpRingNumPages need to be inferior to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  *   PVSCSI_SETUP_RINGS_MAX_NUM_PAGES.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) #define PVSCSI_SETUP_RINGS_MAX_NUM_PAGES        32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) struct PVSCSICmdDescSetupRings {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	u32	reqRingNumPages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	u32	cmpRingNumPages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	u64	ringsStatePPN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	u64	reqRingPPNs[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	u64	cmpRingPPNs[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * Command descriptor for PVSCSI_CMD_SETUP_MSG_RING --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  * Notes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * - this command was not supported in the initial revision of the h/w
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  *   interface. Before using it, you need to check that it is supported by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  *   writing PVSCSI_CMD_SETUP_MSG_RING to the 'command' register, then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  *   immediately after read the 'command status' register:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  *       * a value of -1 means that the cmd is NOT supported,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  *       * a value != -1 means that the cmd IS supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  *   If it's supported the 'command status' register should return:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  *      sizeof(PVSCSICmdDescSetupMsgRing) / sizeof(u32).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * - this command should be issued _after_ the usual SETUP_RINGS so that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  *   RingsState page is already setup. If not, the command is a nop.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * - numPages needs to be a power of two,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * - numPages needs to be different from 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * - _pad should be zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) #define PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES  16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) struct PVSCSICmdDescSetupMsgRing {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	u32	numPages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	u32	_pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	u64	ringPPNs[PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) enum PVSCSIMsgType {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	PVSCSI_MSG_DEV_ADDED          = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	PVSCSI_MSG_DEV_REMOVED        = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	PVSCSI_MSG_LAST               = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  * Msg descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * sizeof(struct PVSCSIRingMsgDesc) == 128.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * - type is of type enum PVSCSIMsgType.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  * - the content of args depend on the type of event being delivered.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) struct PVSCSIRingMsgDesc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	u32	type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	u32	args[31];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) struct PVSCSIMsgDescDevStatusChanged {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	u32	type;  /* PVSCSI_MSG_DEV _ADDED / _REMOVED */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	u32	bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	u32	target;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	u8	lun[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	u32	pad[27];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  * Rings state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  * - the fields:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)  *    . msgProdIdx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  *    . msgConsIdx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  *    . msgNumEntriesLog2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  *   .. are only used once the SETUP_MSG_RING cmd has been issued.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  * - '_pad' helps to ensure that the msg related fields are on their own
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  *   cache-line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) struct PVSCSIRingsState {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	u32	reqProdIdx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	u32	reqConsIdx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	u32	reqNumEntriesLog2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	u32	cmpProdIdx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	u32	cmpConsIdx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	u32	cmpNumEntriesLog2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	u32	reqCallThreshold;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	u8	_pad[100];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	u32	msgProdIdx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	u32	msgConsIdx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	u32	msgNumEntriesLog2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  * Request descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * sizeof(RingReqDesc) = 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  * - context: is a unique identifier of a command. It could normally be any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  *   64bit value, however we currently store it in the serialNumber variable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  *   of struct SCSI_Command, so we have the following restrictions due to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  *   way this field is handled in the vmkernel storage stack:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)  *    * this value can't be 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)  *    * the upper 32bit need to be 0 since serialNumber is as a u32.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)  *   Currently tracked as PR 292060.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * - dataLen: contains the total number of bytes that need to be transferred.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * - dataAddr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  *   * if PVSCSI_FLAG_CMD_WITH_SG_LIST is set: dataAddr is the PA of the first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  *     s/g table segment, each s/g segment is entirely contained on a single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  *     page of physical memory,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  *   * if PVSCSI_FLAG_CMD_WITH_SG_LIST is NOT set, then dataAddr is the PA of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  *     the buffer used for the DMA transfer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)  * - flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  *   * PVSCSI_FLAG_CMD_WITH_SG_LIST: see dataAddr above,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  *   * PVSCSI_FLAG_CMD_DIR_NONE: no DMA involved,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  *   * PVSCSI_FLAG_CMD_DIR_TOHOST: transfer from device to main memory,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  *   * PVSCSI_FLAG_CMD_DIR_TODEVICE: transfer from main memory to device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)  *   * PVSCSI_FLAG_CMD_OUT_OF_BAND_CDB: reserved to handle CDBs larger than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  *     16bytes. To be specified.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  * - vcpuHint: vcpuId of the processor that will be most likely waiting for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  *   completion of the i/o. For guest OSes that use lowest priority message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  *   delivery mode (such as windows), we use this "hint" to deliver the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  *   completion action to the proper vcpu. For now, we can use the vcpuId of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  *   the processor that initiated the i/o as a likely candidate for the vcpu
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  *   that will be waiting for the completion..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  * - bus should be 0: we currently only support bus 0 for now.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  * - unused should be zero'd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) #define PVSCSI_FLAG_CMD_WITH_SG_LIST        (1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) #define PVSCSI_FLAG_CMD_OUT_OF_BAND_CDB     (1 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) #define PVSCSI_FLAG_CMD_DIR_NONE            (1 << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) #define PVSCSI_FLAG_CMD_DIR_TOHOST          (1 << 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) #define PVSCSI_FLAG_CMD_DIR_TODEVICE        (1 << 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) struct PVSCSIRingReqDesc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	u64	context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	u64	dataAddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	u64	dataLen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	u64	senseAddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	u32	senseLen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	u32	flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	u8	cdb[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	u8	cdbLen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	u8	lun[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	u8	tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	u8	bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	u8	target;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	u8	vcpuHint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	u8	unused[59];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)  * Scatter-gather list management.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  * As described above, when PVSCSI_FLAG_CMD_WITH_SG_LIST is set in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  * RingReqDesc.flags, then RingReqDesc.dataAddr is the PA of the first s/g
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  * table segment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)  * - each segment of the s/g table contain a succession of struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)  *   PVSCSISGElement.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)  * - each segment is entirely contained on a single physical page of memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)  * - a "chain" s/g element has the flag PVSCSI_SGE_FLAG_CHAIN_ELEMENT set in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)  *   PVSCSISGElement.flags and in this case:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)  *     * addr is the PA of the next s/g segment,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)  *     * length is undefined, assumed to be 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) struct PVSCSISGElement {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	u64	addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	u32	length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	u32	flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  * Completion descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)  * sizeof(RingCmpDesc) = 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  * - context: identifier of the command. The same thing that was specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  *   under "context" as part of struct RingReqDesc at initiation time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  * - dataLen: number of bytes transferred for the actual i/o operation,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  * - senseLen: number of bytes written into the sense buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * - hostStatus: adapter status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  * - scsiStatus: device status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  * - _pad should be zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) struct PVSCSIRingCmpDesc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	u64	context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	u64	dataLen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	u32	senseLen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	u16	hostStatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	u16	scsiStatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	u32	_pad[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) struct PVSCSIConfigPageHeader {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	u32 pageNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	u16 numDwords;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	u16 hostStatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	u16 scsiStatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	u16 reserved[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) struct PVSCSIConfigPageController {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	struct PVSCSIConfigPageHeader header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	u64 nodeWWN; /* Device name as defined in the SAS spec. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	u16 manufacturer[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	u16 serialNumber[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	u16 opromVersion[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	u16 hwVersion[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	u16 firmwareVersion[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	u32 numPhys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	u8  useConsecutivePhyWWNs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	u8  reserved[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)  * Interrupt status / IRQ bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) #define PVSCSI_INTR_CMPL_0                 (1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) #define PVSCSI_INTR_CMPL_1                 (1 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) #define PVSCSI_INTR_CMPL_MASK              MASK(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) #define PVSCSI_INTR_MSG_0                  (1 << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) #define PVSCSI_INTR_MSG_1                  (1 << 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) #define PVSCSI_INTR_MSG_MASK               (MASK(2) << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) #define PVSCSI_INTR_ALL_SUPPORTED          MASK(4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)  * Number of MSI-X vectors supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) #define PVSCSI_MAX_INTRS        24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)  * Misc constants for the rings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) #define PVSCSI_MAX_NUM_PAGES_REQ_RING   PVSCSI_SETUP_RINGS_MAX_NUM_PAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) #define PVSCSI_MAX_NUM_PAGES_CMP_RING   PVSCSI_SETUP_RINGS_MAX_NUM_PAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) #define PVSCSI_MAX_NUM_PAGES_MSG_RING   PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) #define PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 				(PAGE_SIZE / sizeof(struct PVSCSIRingReqDesc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) #define PVSCSI_MAX_REQ_QUEUE_DEPTH \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 	(PVSCSI_MAX_NUM_PAGES_REQ_RING * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) #define PVSCSI_MEM_SPACE_COMMAND_NUM_PAGES     1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) #define PVSCSI_MEM_SPACE_INTR_STATUS_NUM_PAGES 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) #define PVSCSI_MEM_SPACE_MISC_NUM_PAGES        2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) #define PVSCSI_MEM_SPACE_KICK_IO_NUM_PAGES     2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) #define PVSCSI_MEM_SPACE_MSIX_NUM_PAGES        2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) enum PVSCSIMemSpace {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	PVSCSI_MEM_SPACE_COMMAND_PAGE		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	PVSCSI_MEM_SPACE_INTR_STATUS_PAGE	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	PVSCSI_MEM_SPACE_MISC_PAGE		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	PVSCSI_MEM_SPACE_KICK_IO_PAGE		= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	PVSCSI_MEM_SPACE_MSIX_TABLE_PAGE	= 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	PVSCSI_MEM_SPACE_MSIX_PBA_PAGE		= 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) #define PVSCSI_MEM_SPACE_NUM_PAGES \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	(PVSCSI_MEM_SPACE_COMMAND_NUM_PAGES +       \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	 PVSCSI_MEM_SPACE_INTR_STATUS_NUM_PAGES +   \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	 PVSCSI_MEM_SPACE_MISC_NUM_PAGES +          \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 	 PVSCSI_MEM_SPACE_KICK_IO_NUM_PAGES +       \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	 PVSCSI_MEM_SPACE_MSIX_NUM_PAGES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) #define PVSCSI_MEM_SPACE_SIZE        (PVSCSI_MEM_SPACE_NUM_PAGES * PAGE_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) #endif /* _VMW_PVSCSI_H_ */