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)  *  linux/drivers/message/fusion/mptsas.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *      High performance SCSI + LAN / Fibre Channel device drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *      For use with PCI chip/adapter(s):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *          LSIFC9xx/LSI409xx Fibre Channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *      running LSI MPT (Message Passing Technology) firmware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *  Copyright (c) 1999-2008 LSI Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *  (mailto:DL-MPTFusionLinux@lsi.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)     This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)     it under the terms of the GNU General Public License as published by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)     the Free Software Foundation; version 2 of the License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)     This program is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)     but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)     GNU General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)     NO WARRANTY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)     THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)     CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)     LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)     MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)     solely responsible for determining the appropriateness of using and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)     distributing the Program and assumes all risks associated with its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)     exercise of rights under this Agreement, including but not limited to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)     the risks and costs of program errors, damage to or loss of data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)     programs or equipment, and unavailability or interruption of operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)     DISCLAIMER OF LIABILITY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)     NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)     DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)     TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)     USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)     HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)     You should have received a copy of the GNU General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)     along with this program; if not, write to the Free Software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #ifndef MPTSAS_H_INCLUDED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define MPTSAS_H_INCLUDED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) /*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) struct mptsas_target_reset_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	struct list_head 	list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	u8	target_reset_issued;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	unsigned long	 time_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) enum mptsas_hotplug_action {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	MPTSAS_ADD_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	MPTSAS_DEL_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	MPTSAS_ADD_RAID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	MPTSAS_DEL_RAID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	MPTSAS_ADD_PHYSDISK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	MPTSAS_ADD_PHYSDISK_REPROBE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	MPTSAS_DEL_PHYSDISK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	MPTSAS_DEL_PHYSDISK_REPROBE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	MPTSAS_ADD_INACTIVE_VOLUME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	MPTSAS_IGNORE_EVENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) struct mptsas_mapping{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	u8			id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	u8			channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) struct mptsas_device_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	struct list_head 	list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct mptsas_mapping	os;	/* operating system mapping*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct mptsas_mapping	fw;	/* firmware mapping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	u64			sas_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	u32			device_info; /* specific bits for devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	u16			slot;		/* enclosure slot id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	u64			enclosure_logical_id; /*enclosure address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	u8			is_logical_volume; /* is this logical volume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	/* this belongs to volume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	u8			is_hidden_raid_component;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	/* this valid when is_hidden_raid_component set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	u8			volume_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	/* cached data for a removed device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	u8			is_cached;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) struct mptsas_hotplug_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	MPT_ADAPTER		*ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	enum mptsas_hotplug_action event_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	u64			sas_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	u8			channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	u8			id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	u32			device_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	u16			handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	u8			phy_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	u8			phys_disk_num;		/* hrc - unique index*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	struct scsi_device	*sdev;
^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) struct fw_event_work {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	struct list_head 	list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	struct delayed_work	 work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	MPT_ADAPTER	*ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	u32			event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	u8			retries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	char			event_data[] __aligned(4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct mptsas_discovery_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	struct work_struct	work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	MPT_ADAPTER		*ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * SAS topology structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * The MPT Fusion firmware interface spreads information about the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * SAS topology over many manufacture pages, thus we need some data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * structure to collect it and process it for the SAS transport class.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct mptsas_devinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	u16	handle;		/* unique id to address this device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	u16	handle_parent;	/* unique id to address parent device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	u16	handle_enclosure; /* enclosure identifier of the enclosure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	u16	slot;		/* physical slot in enclosure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	u8	phy_id;		/* phy number of parent device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	u8	port_id;	/* sas physical port this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 				   is assoc'd with */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	u8	id;		/* logical target id of this device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	u32	phys_disk_num;	/* phys disk id, for csmi-ioctls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	u8	channel;	/* logical bus number of this device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	u64	sas_address;    /* WWN of this device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 				   SATA is assigned by HBA,expander */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	u32	device_info;	/* bitfield detailed info about this device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	u16	flags;		/* sas device pg0 flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * Specific details on ports, wide/narrow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct mptsas_portinfo_details{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	u16	num_phys;	/* number of phys belong to this port */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	u64	phy_bitmask; 	/* TODO, extend support for 255 phys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	struct sas_rphy *rphy;	/* transport layer rphy object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	struct sas_port *port;	/* transport layer port object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	struct scsi_target *starget;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct mptsas_portinfo *port_info;
^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) struct mptsas_phyinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	u16	handle;			/* unique id to address this */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	u8	phy_id; 		/* phy index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	u8	port_id; 		/* firmware port identifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	u8	negotiated_link_rate;	/* nego'd link rate for this phy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	u8	hw_link_rate; 		/* hardware max/min phys link rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	u8	programmed_link_rate;	/* programmed max/min phy link rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	u8	sas_port_add_phy;	/* flag to request sas_port_add_phy*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	struct mptsas_devinfo identify;	/* point to phy device info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	struct mptsas_devinfo attached;	/* point to attached device info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	struct sas_phy *phy;		/* transport layer phy object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	struct mptsas_portinfo *portinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	struct mptsas_portinfo_details * port_details;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct mptsas_portinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	u16		num_phys;	/* number of phys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct mptsas_phyinfo *phy_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct mptsas_enclosure {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	u64	enclosure_logical_id;	/* The WWN for the enclosure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	u16	enclosure_handle;	/* unique id to address this */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	u16	flags;			/* details enclosure management */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	u16	num_slot;		/* num slots */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	u16	start_slot;		/* first slot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	u8	start_id;		/* starting logical target id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	u8	start_channel;		/* starting logical channel id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	u8	sep_id;			/* SEP device logical target id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	u8	sep_channel;		/* SEP channel logical channel id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #endif