1118611Snjl/*-
2118611Snjl * Copyright (c) 2011-2015 LSI Corp.
3118611Snjl * Copyright (c) 2013-2016 Avago Technologies
4118611Snjl * All rights reserved.
5118611Snjl *
6118611Snjl * Redistribution and use in source and binary forms, with or without
7217365Sjkim * modification, are permitted provided that the following conditions
8245582Sjkim * are met:
9118611Snjl * 1. Redistributions of source code must retain the above copyright
10118611Snjl *    notice, this list of conditions and the following disclaimer.
11217365Sjkim * 2. Redistributions in binary form must reproduce the above copyright
12217365Sjkim *    notice, this list of conditions and the following disclaimer in the
13217365Sjkim *    documentation and/or other materials provided with the distribution.
14217365Sjkim *
15217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16217365Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17217365Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18217365Sjkim * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19217365Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23217365Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24217365Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25118611Snjl * SUCH DAMAGE.
26217365Sjkim *
27217365Sjkim * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD
28217365Sjkim *
29118611Snjl * $FreeBSD: stable/10/sys/dev/mpr/mpr_mapping.h 319436 2017-06-01 15:43:24Z slm $
30217365Sjkim */
31217365Sjkim
32217365Sjkim#ifndef _MPR_MAPPING_H
33217365Sjkim#define _MPR_MAPPING_H
34217365Sjkim
35217365Sjkim/**
36217365Sjkim * struct _map_phy_change - PHY entries recieved in Topology change list
37217365Sjkim * @physical_id: SAS address of the device attached with the associate PHY
38217365Sjkim * @device_info: bitfield provides detailed info about the device
39217365Sjkim * @dev_handle: device handle for the device pointed by this entry
40217365Sjkim * @slot: slot ID
41217365Sjkim * @is_processed: Flag to indicate whether this entry is processed or not
42217365Sjkim * @is_SATA_SSD: 1 if this is a SATA device AND an SSD, 0 otherwise
43118611Snjl */
44118611Snjlstruct _map_phy_change {
45118611Snjl	uint64_t	physical_id;
46151937Sjkim	uint32_t	device_info;
47193529Sjkim	uint16_t	dev_handle;
48210976Sjkim	uint16_t	slot;
49240716Sjkim	uint8_t	reason;
50118611Snjl	uint8_t	is_processed;
51118611Snjl	uint8_t	is_SATA_SSD;
52118611Snjl	uint8_t reserved;
53118611Snjl};
54250838Sjkim
55151937Sjkim/**
56118611Snjl * struct _map_port_change - PCIe Port entries received in PCIe Topology change
57240716Sjkim * list event
58240716Sjkim * @physical_id: WWID of the device attached to the associated port
59240716Sjkim * @device_info: bitfield provides detailed info about the device
60240716Sjkim * @MDTS: Maximum Data Transfer Size for the device
61151937Sjkim * @dev_handle: device handle for the device pointed by this entry
62151937Sjkim * @slot: slot ID
63151937Sjkim * @is_processed: Flag to indicate whether this entry is processed or not
64151937Sjkim */
65151937Sjkimstruct _map_port_change {
66118611Snjl	uint64_t	physical_id;
67118611Snjl	uint32_t	device_info;
68250838Sjkim	uint32_t	MDTS;
69118611Snjl	uint16_t	dev_handle;
70118611Snjl	uint16_t	slot;
71118611Snjl	uint8_t		reason;
72118611Snjl	uint8_t		is_processed;
73118611Snjl	uint8_t		reserved[2];
74246849Sjkim};
75246849Sjkim
76118611Snjl/**
77118611Snjl * struct _map_topology_change - SAS/SATA entries to be removed from mapping
78118611Snjl * table
79250838Sjkim * @enc_handle: enclosure handle where this device is located
80250838Sjkim * @exp_handle: expander handle where this device is located
81118611Snjl * @num_entries: number of entries in the SAS Topology Change List event
82118611Snjl * @start_phy_num: PHY number of the first PHY in the event data
83250838Sjkim * @num_phys: number of PHYs in the expander where this device is located
84250838Sjkim * @exp_status: status for the expander where this device is located
85118611Snjl * @phy_details: more details about each PHY in the event data
86228110Sjkim */
87228110Sjkimstruct _map_topology_change {
88228110Sjkim	uint16_t	enc_handle;
89241973Sjkim	uint16_t	exp_handle;
90238381Sjkim	uint8_t	num_entries;
91197104Sjkim	uint8_t	start_phy_num;
92233250Sjkim	uint8_t	num_phys;
93233250Sjkim	uint8_t	exp_status;
94233250Sjkim	struct _map_phy_change *phy_details;
95233250Sjkim};
96234623Sjkim
97233250Sjkim/**
98246849Sjkim * struct _map_pcie_topology_change - PCIe entries to be removed from mapping
99228110Sjkim * table
100228110Sjkim * @enc_handle: enclosure handle where this device is located
101228110Sjkim * @switch_dev_handle:  PCIe switch device handle where this device is located
102228110Sjkim * @num_entries: number of entries in the PCIe Topology Change List event
103228110Sjkim * @start_port_num: port number of the first port in the event data
104228110Sjkim * @num_ports: number of ports in the PCIe switch device
105250838Sjkim * @switch_status: status for the PCIe switch where this device is located
106233250Sjkim * @port_details: more details about each Port in the event data
107234623Sjkim */
108118611Snjlstruct _map_pcie_topology_change {
109246849Sjkim	uint16_t	enc_handle;
110228110Sjkim	uint16_t	switch_dev_handle;
111228110Sjkim	uint8_t	num_entries;
112228110Sjkim	uint8_t	start_port_num;
113228110Sjkim	uint8_t	num_ports;
114228110Sjkim	uint8_t switch_status;
115245582Sjkim	struct _map_port_change *port_details;
116228110Sjkim};
117118611Snjl
118246849Sjkimextern int
119246849Sjkimmprsas_get_sas_address_for_sata_disk(struct mpr_softc *ioc,
120246849Sjkim    u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD);
121246849Sjkim
122249112Sjkim#endif
123246849Sjkim