xref: /freebsd-src/sys/dev/mpr/mpr_mapping.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1991554f2SKenneth D. Merry /*-
2a2c14879SStephen McConnell  * Copyright (c) 2011-2015 LSI Corp.
37a2a6a1aSStephen McConnell  * Copyright (c) 2013-2016 Avago Technologies
4*46b23587SKashyap D Desai  * Copyright 2000-2020 Broadcom Inc.
5991554f2SKenneth D. Merry  * All rights reserved.
6991554f2SKenneth D. Merry  *
7991554f2SKenneth D. Merry  * Redistribution and use in source and binary forms, with or without
8991554f2SKenneth D. Merry  * modification, are permitted provided that the following conditions
9991554f2SKenneth D. Merry  * are met:
10991554f2SKenneth D. Merry  * 1. Redistributions of source code must retain the above copyright
11991554f2SKenneth D. Merry  *    notice, this list of conditions and the following disclaimer.
12991554f2SKenneth D. Merry  * 2. Redistributions in binary form must reproduce the above copyright
13991554f2SKenneth D. Merry  *    notice, this list of conditions and the following disclaimer in the
14991554f2SKenneth D. Merry  *    documentation and/or other materials provided with the distribution.
15991554f2SKenneth D. Merry  *
16991554f2SKenneth D. Merry  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17991554f2SKenneth D. Merry  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18991554f2SKenneth D. Merry  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19991554f2SKenneth D. Merry  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20991554f2SKenneth D. Merry  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21991554f2SKenneth D. Merry  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22991554f2SKenneth D. Merry  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23991554f2SKenneth D. Merry  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24991554f2SKenneth D. Merry  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25991554f2SKenneth D. Merry  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26991554f2SKenneth D. Merry  * SUCH DAMAGE.
27991554f2SKenneth D. Merry  *
28*46b23587SKashyap D Desai  * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD
29991554f2SKenneth D. Merry  */
30991554f2SKenneth D. Merry 
31991554f2SKenneth D. Merry #ifndef _MPR_MAPPING_H
32991554f2SKenneth D. Merry #define _MPR_MAPPING_H
33991554f2SKenneth D. Merry 
34991554f2SKenneth D. Merry /**
35453130d9SPedro F. Giffuni  * struct _map_phy_change - PHY entries received in Topology change list
36991554f2SKenneth D. Merry  * @physical_id: SAS address of the device attached with the associate PHY
37991554f2SKenneth D. Merry  * @device_info: bitfield provides detailed info about the device
38991554f2SKenneth D. Merry  * @dev_handle: device handle for the device pointed by this entry
39991554f2SKenneth D. Merry  * @slot: slot ID
40991554f2SKenneth D. Merry  * @is_processed: Flag to indicate whether this entry is processed or not
41a2c14879SStephen McConnell  * @is_SATA_SSD: 1 if this is a SATA device AND an SSD, 0 otherwise
42991554f2SKenneth D. Merry  */
43991554f2SKenneth D. Merry struct _map_phy_change {
44991554f2SKenneth D. Merry 	uint64_t	physical_id;
45991554f2SKenneth D. Merry 	uint32_t	device_info;
46991554f2SKenneth D. Merry 	uint16_t	dev_handle;
47991554f2SKenneth D. Merry 	uint16_t	slot;
48991554f2SKenneth D. Merry 	uint8_t	reason;
49991554f2SKenneth D. Merry 	uint8_t	is_processed;
50a2c14879SStephen McConnell 	uint8_t	is_SATA_SSD;
51a2c14879SStephen McConnell 	uint8_t reserved;
52991554f2SKenneth D. Merry };
53991554f2SKenneth D. Merry 
54991554f2SKenneth D. Merry /**
5567feec50SStephen McConnell  * struct _map_port_change - PCIe Port entries received in PCIe Topology change
5667feec50SStephen McConnell  * list event
5767feec50SStephen McConnell  * @physical_id: WWID of the device attached to the associated port
5867feec50SStephen McConnell  * @device_info: bitfield provides detailed info about the device
5967feec50SStephen McConnell  * @MDTS: Maximum Data Transfer Size for the device
60991554f2SKenneth D. Merry  * @dev_handle: device handle for the device pointed by this entry
6167feec50SStephen McConnell  * @slot: slot ID
6267feec50SStephen McConnell  * @is_processed: Flag to indicate whether this entry is processed or not
6367feec50SStephen McConnell  */
6467feec50SStephen McConnell struct _map_port_change {
6567feec50SStephen McConnell 	uint64_t	physical_id;
6667feec50SStephen McConnell 	uint32_t	device_info;
6767feec50SStephen McConnell 	uint32_t	MDTS;
6867feec50SStephen McConnell 	uint16_t	dev_handle;
6967feec50SStephen McConnell 	uint16_t	slot;
7067feec50SStephen McConnell 	uint8_t		reason;
7167feec50SStephen McConnell 	uint8_t		is_processed;
7267feec50SStephen McConnell 	uint8_t		reserved[2];
7367feec50SStephen McConnell };
7467feec50SStephen McConnell 
7567feec50SStephen McConnell /**
7667feec50SStephen McConnell  * struct _map_topology_change - SAS/SATA entries to be removed from mapping
7767feec50SStephen McConnell  * table
7867feec50SStephen McConnell  * @enc_handle: enclosure handle where this device is located
7967feec50SStephen McConnell  * @exp_handle: expander handle where this device is located
8067feec50SStephen McConnell  * @num_entries: number of entries in the SAS Topology Change List event
8167feec50SStephen McConnell  * @start_phy_num: PHY number of the first PHY in the event data
8267feec50SStephen McConnell  * @num_phys: number of PHYs in the expander where this device is located
8367feec50SStephen McConnell  * @exp_status: status for the expander where this device is located
8467feec50SStephen McConnell  * @phy_details: more details about each PHY in the event data
85991554f2SKenneth D. Merry  */
86991554f2SKenneth D. Merry struct _map_topology_change {
87991554f2SKenneth D. Merry 	uint16_t	enc_handle;
88991554f2SKenneth D. Merry 	uint16_t	exp_handle;
89991554f2SKenneth D. Merry 	uint8_t	num_entries;
90991554f2SKenneth D. Merry 	uint8_t	start_phy_num;
91991554f2SKenneth D. Merry 	uint8_t	num_phys;
92991554f2SKenneth D. Merry 	uint8_t	exp_status;
93991554f2SKenneth D. Merry 	struct _map_phy_change *phy_details;
94991554f2SKenneth D. Merry };
95991554f2SKenneth D. Merry 
9667feec50SStephen McConnell /**
9767feec50SStephen McConnell  * struct _map_pcie_topology_change - PCIe entries to be removed from mapping
9867feec50SStephen McConnell  * table
9967feec50SStephen McConnell  * @enc_handle: enclosure handle where this device is located
10067feec50SStephen McConnell  * @switch_dev_handle:  PCIe switch device handle where this device is located
10167feec50SStephen McConnell  * @num_entries: number of entries in the PCIe Topology Change List event
10267feec50SStephen McConnell  * @start_port_num: port number of the first port in the event data
10367feec50SStephen McConnell  * @num_ports: number of ports in the PCIe switch device
10467feec50SStephen McConnell  * @switch_status: status for the PCIe switch where this device is located
10567feec50SStephen McConnell  * @port_details: more details about each Port in the event data
10667feec50SStephen McConnell  */
10767feec50SStephen McConnell struct _map_pcie_topology_change {
10867feec50SStephen McConnell 	uint16_t	enc_handle;
10967feec50SStephen McConnell 	uint16_t	switch_dev_handle;
11067feec50SStephen McConnell 	uint8_t	num_entries;
11167feec50SStephen McConnell 	uint8_t	start_port_num;
11267feec50SStephen McConnell 	uint8_t	num_ports;
11367feec50SStephen McConnell 	uint8_t switch_status;
11467feec50SStephen McConnell 	struct _map_port_change *port_details;
11567feec50SStephen McConnell };
116991554f2SKenneth D. Merry 
117991554f2SKenneth D. Merry extern int
118991554f2SKenneth D. Merry mprsas_get_sas_address_for_sata_disk(struct mpr_softc *ioc,
119a2c14879SStephen McConnell     u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD);
120991554f2SKenneth D. Merry 
121991554f2SKenneth D. Merry #endif
122