1a9800beGarrett D'Amore/*
2a9800beGarrett D'Amore * CDDL HEADER START
3a9800beGarrett D'Amore *
4a9800beGarrett D'Amore * The contents of this file are subject to the terms of the
5a9800beGarrett D'Amore * Common Development and Distribution License (the "License").
6a9800beGarrett D'Amore * You may not use this file except in compliance with the License.
7a9800beGarrett D'Amore *
88f23e9fHans Rosenfeld * You can obtain a copy of the license at
98f23e9fHans Rosenfeld * http://www.opensource.org/licenses/cddl1.txt.
10a9800beGarrett D'Amore * See the License for the specific language governing permissions
11a9800beGarrett D'Amore * and limitations under the License.
12a9800beGarrett D'Amore *
13a9800beGarrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each
14a9800beGarrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15a9800beGarrett D'Amore * If applicable, add the following below this CDDL HEADER, with the
16a9800beGarrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying
17a9800beGarrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner]
18a9800beGarrett D'Amore *
19a9800beGarrett D'Amore * CDDL HEADER END
20a9800beGarrett D'Amore */
21a9800beGarrett D'Amore
22a9800beGarrett D'Amore/*
238f23e9fHans Rosenfeld * Copyright (c) 2004-2012 Emulex. All rights reserved.
24a9800beGarrett D'Amore * Use is subject to license terms.
25a9800beGarrett D'Amore */
26a9800beGarrett D'Amore
27a9800beGarrett D'Amore#include <emlxs.h>
28a9800beGarrett D'Amore
29a9800beGarrett D'Amore/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
30a9800beGarrett D'AmoreEMLXS_MSG_DEF(EMLXS_FCF_C);
31a9800beGarrett D'Amore
32a9800beGarrett D'Amore/*
33a9800beGarrett D'Amore * STATE MACHINE RULES:
34a9800beGarrett D'Amore *
35a9800beGarrett D'Amore * - State change requests to an XXXX object when operating within
36a9800beGarrett D'Amore * an emlxs_XXXX state management function must be made
37a9800beGarrett D'Amore * using the emlxs_XXXX_state() call.
38a9800beGarrett D'Amore *
39a9800beGarrett D'Amore * - State change requests to an XXXX object when operating outside
40a9800beGarrett D'Amore * an emlxs_XXXX state management function must be made
41a9800beGarrett D'Amore * using the emlxs_XXXX_alloc(), emlxs_XXXX_free(), emlxs_XXXX_event()
42a9800beGarrett D'Amore * or emlxs_XXXX_..._notify() calls.
43a9800beGarrett D'Amore *
44a9800beGarrett D'Amore * - emlxs_XXXX_..._notify() calls are used by routines outside
45a9800beGarrett D'Amore * this fcf module to enter the state machine.
46a9800beGarrett D'Amore *
47a9800beGarrett D'Amore * - It is forbidden to make direct calls to emlxs_XXXX_...._action()
48a9800beGarrett D'Amore * functions.  Only emlxs_XXXX_action() routines may make calls to
49a9800beGarrett D'Amore * emlxs_XXXX_...._action() functions.
50a9800beGarrett D'Amore *
51a9800beGarrett D'Amore * - Its is forbidden to make direct calls to emlxs_XXXX_action().
52a9800beGarrett D'Amore * Only emlxs_XXXX_state() and emlxs_XXXX_event() routines may make
53a9800beGarrett D'Amore * calls to emlxs_XXXX_action().
54a9800beGarrett D'Amore *
55a9800beGarrett D'Amore * - The EMLXS_FCF_LOCK must be held before calling:
56a9800beGarrett D'Amore * emlxs_XXXX_state(), emlxs_XXXX_event() and emlxs_XXXX_action().
57a9800beGarrett D'Amore *
588f23e9fHans Rosenfeld * - All other calls touching fcftab, fcfi, vfi, vpi, rpi objects
598f23e9fHans Rosenfeld * must hold the EMLXS_FCF_LOCK to protect these objects.
608f23e9fHans Rosenfeld */
618f23e9fHans Rosenfeld
628f23e9fHans Rosenfeld/*
638f23e9fHans Rosenfeld * DEBUG MESSAGE TERMINATION RULES:
648f23e9fHans Rosenfeld *
658f23e9fHans Rosenfeld * - A message should end in ">" if a thread operating outside the
668f23e9fHans Rosenfeld * XXXX state machine enters the XXXX state machine with a call to
678f23e9fHans Rosenfeld * emlxs_XXXX_event() or emlxs_XXXX_state().  This includes calls made
688f23e9fHans Rosenfeld * from emlxs_..._notify(), emlxs_..._mbcmpl() and emlxs_..._timer()
698f23e9fHans Rosenfeld * routines since they represent the beginnning of new threads.
708f23e9fHans Rosenfeld *
718f23e9fHans Rosenfeld * - A message should end in "<" if the thread is about exit
728f23e9fHans Rosenfeld * an emlxs_XXXX_..._action() without previously calling the
738f23e9fHans Rosenfeld * next emlxs_XXXX_state().  This includes the emlxs_XXXX_action()
748f23e9fHans Rosenfeld * and emlxs_XXXX_state() routines themselves since errors
758f23e9fHans Rosenfeld * in these routines represent the termination of state change
768f23e9fHans Rosenfeld * thread.
778f23e9fHans Rosenfeld *
788f23e9fHans Rosenfeld * - A message should end in "." if none of the previous
798f23e9fHans Rosenfeld * conditions apply.
80a9800beGarrett D'Amore */
81a9800beGarrett D'Amore
82a9800beGarrett D'Amore/* ************************************************************************** */
83a9800beGarrett D'Amore/* FCF Generic */
84a9800beGarrett D'Amore/* ************************************************************************** */
85a9800beGarrett D'Amore
86a9800beGarrett D'Amore/*
87a9800beGarrett D'Amore * EVENT			ARG1
88a9800beGarrett D'Amore * --------------------------------------------
89a9800beGarrett D'Amore * FCF_EVENT_STATE_ENTER	None
90a9800beGarrett D'Amore *
91a9800beGarrett D'Amore * FCF_EVENT_LINKUP		None
92a9800beGarrett D'Amore * FCF_EVENT_LINKDOWN		None
93a9800beGarrett D'Amore * FCF_EVENT_CVL		vpi
94a9800beGarrett D'Amore * FCF_EVENT_FCFTAB_FULL	None
95a9800beGarrett D'Amore * FCF_EVENT_FCF_FOUND		fcf_index
96a9800beGarrett D'Amore * FCF_EVENT_FCF_LOST		fcf_index
97a9800beGarrett D'Amore * FCF_EVENT_FCF_CHANGED	fcf_index
98a9800beGarrett D'Amore *
99a9800beGarrett D'Amore * FCF_EVENT_FCFI_ONLINE	FCFIobj_t*
100a9800beGarrett D'Amore * FCF_EVENT_FCFI_OFFLINE	FCFIobj_t*
101a9800beGarrett D'Amore * FCF_EVENT_FCFI_PAUSE		FCFIobj_t*
102a9800beGarrett D'Amore *
103a9800beGarrett D'Amore * FCF_EVENT_VFI_ONLINE		VFIobj_t*
104a9800beGarrett D'Amore * FCF_EVENT_VFI_OFFLINE	VFIobj_t*
105a9800beGarrett D'Amore * FCF_EVENT_VFI_PAUSE		VFIobj_t*
106a9800beGarrett D'Amore *
107a9800beGarrett D'Amore * FCF_EVENT_VPI_ONLINE		VPIobj_t*
108a9800beGarrett D'Amore * FCF_EVENT_VPI_OFFLINE	VPIobj_t*
109a9800beGarrett D'Amore * FCF_EVENT_VPI_PAUSE		VPIobj_t*
110a9800beGarrett D'Amore *
111a9800beGarrett D'Amore * FCF_EVENT_RPI_ONLINE		RPIobj_t*
112a9800beGarrett D'Amore * FCF_EVENT_RPI_OFFLINE	RPIobj_t*
113a9800beGarrett D'Amore * FCF_EVENT_RPI_PAUSE		RPIobj_t*
114a9800beGarrett D'Amore * FCF_EVENT_RPI_RESUME		RPIobj_t*
1158f23e9fHans Rosenfeld * FCF_EVENT_RPI_TIMEOUT	RPIobj_t*
116a9800beGarrett D'Amore */
117a9800beGarrett D'Amore
118a9800beGarrett D'Amore/* Order does not matter */
119a9800beGarrett D'Amoreemlxs_table_t emlxs_fcf_event_table[] =
120a9800beGarrett D'Amore{
1218f23e9fHans Rosenfeld	{FCF_EVENT_STATE_ENTER, "E_ENTER"},
122a9800beGarrett D'Amore
1238f23e9fHans Rosenfeld	{FCF_EVENT_SHUTDOWN, "E_SHUTDOWN"},
1248f23e9fHans Rosenfeld	{FCF_EVENT_LINKUP, "E_LINKUP"},
1258f23e9fHans Rosenfeld	{FCF_EVENT_LINKDOWN, "E_LINKDOWN"},
1268f23e9fHans Rosenfeld	{FCF_EVENT_CVL, "E_CVL"},
1278f23e9fHans Rosenfeld	{FCF_EVENT_FCFTAB_FULL, "E_TABLE_FULL"},
1288f23e9fHans Rosenfeld	{FCF_EVENT_FCF_FOUND, "E_FCF_FOUND"},
1298f23e9fHans Rosenfeld	{FCF_EVENT_FCF_LOST, "E_FCF_LOST"},
1308f23e9fHans Rosenfeld	{FCF_EVENT_FCF_CHANGED, "E_FCF_CHANGED"},
131a9800beGarrett D'Amore
1328f23e9fHans Rosenfeld	{FCF_EVENT_FCFI_ONLINE, "E_FCFI_ONLINE"},
1338f23e9fHans Rosenfeld	{FCF_EVENT_FCFI_OFFLINE, "E_FCFI_OFFLINE"},
1348f23e9fHans Rosenfeld	{FCF_EVENT_FCFI_PAUSE, "E_FCFI_PAUSE"},
135a9800beGarrett D'Amore
1368f23e9fHans Rosenfeld	{FCF_EVENT_VFI_ONLINE, "E_VFI_ONLINE"},
1378f23e9fHans Rosenfeld	{FCF_EVENT_VFI_OFFLINE, "E_VFI_OFFLINE"},
1388f23e9fHans Rosenfeld	{FCF_EVENT_VFI_PAUSE, "E_VFI_PAUSE"},
139a9800beGarrett D'Amore
1408f23e9fHans Rosenfeld	{FCF_EVENT_VPI_ONLINE, "E_VPI_ONLINE"},
1418f23e9fHans Rosenfeld	{FCF_EVENT_VPI_OFFLINE, "E_VPI_OFFLINE"},
1428f23e9fHans Rosenfeld	{FCF_EVENT_VPI_PAUSE, "E_VPI_PAUSE"},
143a9800beGarrett D'Amore
1448f23e9fHans Rosenfeld	{FCF_EVENT_RPI_ONLINE, "E_RPI_ONLINE"},
1458f23e9fHans Rosenfeld	{FCF_EVENT_RPI_OFFLINE, "E_RPI_OFFLINE"},
1468f23e9fHans Rosenfeld	{FCF_EVENT_RPI_PAUSE, "E_RPI_PAUSE"},
1478f23e9fHans Rosenfeld	{FCF_EVENT_RPI_RESUME, "E_RPI_RESUME"},
148a9800beGarrett D'Amore
149a9800beGarrett D'Amore}; /* emlxs_fcf_event_table */
150a9800beGarrett D'Amore
151a9800beGarrett D'Amore
152a9800beGarrett D'Amore/* Order does not matter */
153a9800beGarrett D'Amoreemlxs_table_t emlxs_fcf_reason_table[] =
154a9800beGarrett D'Amore{
1558f23e9fHans Rosenfeld	{FCF_REASON_NONE, "R_NONE"},
1568f23e9fHans Rosenfeld	{FCF_REASON_REENTER, "R_REENTER"},
1578f23e9fHans Rosenfeld	{FCF_REASON_EVENT, "R_EVENT"},
1588f23e9fHans Rosenfeld	{FCF_REASON_REQUESTED, "R_REQUESTED"},
1598f23e9fHans Rosenfeld	{FCF_REASON_NO_MBOX, "R_NO_MBOX"},
1608f23e9fHans Rosenfeld	{FCF_REASON_NO_BUFFER, "R_NO_BUFFER"},
1618f23e9fHans Rosenfeld	{FCF_REASON_SEND_FAILED, "R_SEND_FAILED"},
1628f23e9fHans Rosenfeld	{FCF_REASON_MBOX_FAILED, "R_MBOX_FAILED"},
1638f23e9fHans Rosenfeld	{FCF_REASON_MBOX_BUSY, "R_MBOX_BUSY"},
1648f23e9fHans Rosenfeld	{FCF_REASON_NO_FCFI, "R_NO_FCFI"},
1658f23e9fHans Rosenfeld	{FCF_REASON_NO_VFI, "R_NO_VFI"},
1668f23e9fHans Rosenfeld	{FCF_REASON_ONLINE_FAILED, "R_ONLINE_FAILED"},
1678f23e9fHans Rosenfeld	{FCF_REASON_OFFLINE_FAILED, "R_OFFLINE_FAILED"},
1688f23e9fHans Rosenfeld	{FCF_REASON_OP_FAILED, "R_OP_FAILED"},
1698f23e9fHans Rosenfeld	{FCF_REASON_NO_PKT, "R_NO_PKT"},
1708f23e9fHans Rosenfeld	{FCF_REASON_NO_NODE, "R_NO_NODE"},
1718f23e9fHans Rosenfeld	{FCF_REASON_NOT_ALLOWED, "R_NOT_ALLOWED"},
1728f23e9fHans Rosenfeld	{FCF_REASON_UNUSED, "R_UNUSED"},
1738f23e9fHans Rosenfeld	{FCF_REASON_INVALID, "R_INVALID"},
174a9800beGarrett D'Amore
175a9800beGarrett D'Amore}; /* emlxs_fcf_reason_table */
176a9800beGarrett D'Amore
177a9800beGarrett D'Amore
178a9800beGarrett D'Amore/* ********************************************************************** */
1798f23e9fHans Rosenfeld/* FCFTAB Generic */
1808f23e9fHans Rosenfeld/* ********************************************************************** */
1818f23e9fHans Rosenfeldstatic char 		*emlxs_fcftab_state_xlate(emlxs_port_t *port,
1828f23e9fHans Rosenfeld				uint32_t state);
1838f23e9fHans Rosenfeldstatic uint32_t		emlxs_fcftab_event(emlxs_port_t *port, uint32_t evt,
1848f23e9fHans Rosenfeld				void *arg1);
1858f23e9fHans Rosenfeldstatic uint32_t		emlxs_fcftab_shutdown_action(emlxs_port_t *port,
1868f23e9fHans Rosenfeld				uint32_t evt, void *arg1);
1878f23e9fHans Rosenfeld
1888f23e9fHans Rosenfeld/* ********************************************************************** */
1898f23e9fHans Rosenfeld/* FC FCFTAB */
190a9800beGarrett D'Amore/* ********************************************************************** */
191a9800beGarrett D'Amore
192a9800beGarrett D'Amore/* Order does not matter */
1938f23e9fHans Rosenfeldemlxs_table_t emlxs_fc_fcftab_state_table[] =
194a9800beGarrett D'Amore{
1958f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_SHUTDOWN, "FCFTAB_SHUTDOWN"},
1968f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_OFFLINE, "FCFTAB_OFFLINE"},
1978f23e9fHans Rosenfeld
1988f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_TOPO, "FCFTAB_TOPO"},
1998f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_TOPO_FAILED, "FCFTAB_TOPO_FAILED"},
2008f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_TOPO_CMPL, "FCFTAB_TOPO_CMPL"},
2018f23e9fHans Rosenfeld
2028f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_CFGLINK, "FCFTAB_CFGLINK"},
2038f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_CFGLINK_FAILED, "FCFTAB_CFGLINK_FAILED"},
2048f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_CFGLINK_CMPL, "FCFTAB_CFGLINK_CMPL"},
2058f23e9fHans Rosenfeld
2068f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_SPARM, "FCFTAB_SPARM"},
2078f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_SPARM_FAILED, "FCFTAB_SPARM_FAILED"},
2088f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_SPARM_CMPL, "FCFTAB_SPARM_CMPL"},
2098f23e9fHans Rosenfeld
2108f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL,
2118f23e9fHans Rosenfeld	    "FCFTAB_FCFI_OFFLINE_CMPL"},
2128f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_FCFI_OFFLINE, "FCFTAB_FCFI_OFFLINE"},
2138f23e9fHans Rosenfeld
2148f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_FCFI_ONLINE, "FCFTAB_FCFI_ONLINE"},
2158f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_FCFI_ONLINE_CMPL, "FCFTAB_FCFI_ONLINE_CMPL"},
2168f23e9fHans Rosenfeld
2178f23e9fHans Rosenfeld	{FC_FCFTAB_STATE_ONLINE, "FCFTAB_ONLINE"},
218a9800beGarrett D'Amore
2198f23e9fHans Rosenfeld}; /* emlxs_fc_fcftab_state_table */
220a9800beGarrett D'Amore
2218f23e9fHans Rosenfeldstatic void emlxs_fc_fcftab_online_timer(emlxs_hba_t *hba);
222a9800beGarrett D'Amore
2238f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_offline_action(emlxs_port_t *port,
2248f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2258f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_online_action(emlxs_port_t *port,
2268f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2278f23e9fHans Rosenfeld
2288f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_topo_cmpl_action(emlxs_port_t *port,
2298f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2308f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_topo_failed_action(emlxs_port_t *port,
2318f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2328f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_topo_action(emlxs_port_t *port,
2338f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2348f23e9fHans Rosenfeld
2358f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_cfglink_cmpl_action(emlxs_port_t *port,
2368f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2378f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_cfglink_failed_action(emlxs_port_t *port,
2388f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2398f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_cfglink_action(emlxs_port_t *port,
2408f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
241a9800beGarrett D'Amore
2428f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_sparm_cmpl_action(emlxs_port_t *port,
2438f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2448f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_sparm_failed_action(emlxs_port_t *port,
2458f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2468f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_sparm_action(emlxs_port_t *port,
2478f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
248a9800beGarrett D'Amore
2498f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_linkup_evt_action(emlxs_port_t *port,
2508f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2518f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_linkdown_evt_action(emlxs_port_t *port,
2528f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
253a9800beGarrett D'Amore
2548f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_fcfi_online_evt_action(emlxs_port_t *port,
2558f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2568f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_fcfi_offline_evt_action(emlxs_port_t *port,
2578f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
258a9800beGarrett D'Amore
2598f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_shutdown_evt_action(emlxs_port_t *port,
2608f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2618f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_fcfi_offline_action(emlxs_port_t *port,
2628f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2638f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port,
2648f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2658f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_fcfi_online_action(emlxs_port_t *port,
2668f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
2678f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port,
2688f23e9fHans Rosenfeld			uint32_t evt, void *arg1);
269a9800beGarrett D'Amore
2708f23e9fHans Rosenfeldstatic char *emlxs_fc_fcftab_state_xlate(uint32_t state);
2718f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_event(emlxs_port_t *port,
272a9800beGarrett D'Amore			uint32_t evt, void *arg1);
2738f23e9fHans Rosenfeldstatic uint32_t emlxs_fc_fcftab_req_handler(emlxs_port_t *port, void *arg1);
2748f23e9fHans Rosenfeld
2758f23e9fHans Rosenfeld/*
2768f23e9fHans Rosenfeld * - Online sequencing can start from FC_FCFTAB_STATE_OFFLINE state
2778f23e9fHans Rosenfeld *
2788f23e9fHans Rosenfeld * - Offline sequencing can interrupt the online sequencing at the
2798f23e9fHans Rosenfeld * entry of the next wait state.
2808f23e9fHans Rosenfeld *
2818f23e9fHans Rosenfeld * NORMAL ONLINE SEQ
2828f23e9fHans Rosenfeld * ---------------------------
2838f23e9fHans Rosenfeld * LINK_UP event <-- Adapter
2848f23e9fHans Rosenfeld * FC_FCFTAB_STATE_OFFLINE
2858f23e9fHans Rosenfeld * FC_FCFTAB_STATE_TOPO
2868f23e9fHans Rosenfeld *     FC_FCFTAB_STATE_TOPO_CMPL
2878f23e9fHans Rosenfeld * FC_FCFTAB_STATE_CFGLINK
2888f23e9fHans Rosenfeld *     FC_FCFTAB_STATE_CFGLINK_CMPL
2898f23e9fHans Rosenfeld * FC_FCFTAB_STATE_SPARM
2908f23e9fHans Rosenfeld *     FC_FCFTAB_STATE_SPARM_CMPL
2918f23e9fHans Rosenfeld * FC_FCFTAB_STATE_FCFI_ONLINE
2928f23e9fHans Rosenfeld *     FC_FCFTAB_STATE_FCFI_ONLINE_CMPL
2938f23e9fHans Rosenfeld * FC_FCFTAB_STATE_ONLINE
2948f23e9fHans Rosenfeld *
2958f23e9fHans Rosenfeld *
2968f23e9fHans Rosenfeld * NORMAL OFFLINE SEQ
2978f23e9fHans Rosenfeld * ---------------------------
2988f23e9fHans Rosenfeld * LINK_DOWN event <-- Adapter
2998f23e9fHans Rosenfeld * FC_FCFTAB_STATE_ONLINE
3008f23e9fHans Rosenfeld * FC_FCFTAB_STATE_FCFI_OFFLINE
3018f23e9fHans Rosenfeld *     FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL
3028f23e9fHans Rosenfeld * FC_FCFTAB_STATE_OFFLINE
3038f23e9fHans Rosenfeld *
3048f23e9fHans Rosenfeld */
3058f23e9fHans Rosenfeld/* Order does matter */
3068f23e9fHans Rosenfeldstatic void *emlxs_fc_fcftab_action_table[] =
3078f23e9fHans Rosenfeld{
3088f23e9fHans Rosenfeld	/* Action routine				Event */
3098f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_SHUTDOWN  0			(Requires adapter reset) */
3108f23e9fHans Rosenfeld	(void *) emlxs_fcftab_shutdown_action,		/* STATE_ENTER */
3118f23e9fHans Rosenfeld	(void *) NULL,					/* SHUTDOWN */
3128f23e9fHans Rosenfeld	(void *) NULL,					/* LINK_UP */
3138f23e9fHans Rosenfeld	(void *) NULL,					/* LINK_DOWN */
3148f23e9fHans Rosenfeld	(void *) NULL,					/* FCFI_ONLINE */
3158f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3168f23e9fHans Rosenfeld
3178f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_OFFLINE  1			(Wait for LINK_UP event) */
3188f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_offline_action,	/* STATE_ENTER */
3198f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3208f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3218f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3228f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3238f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3248f23e9fHans Rosenfeld
3258f23e9fHans Rosenfeld
3268f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_TOPO  2			(Wait for topo mbcmpl) */
3278f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_topo_action,		/* STATE_ENTER */
3288f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3298f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3308f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3318f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3328f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3338f23e9fHans Rosenfeld
3348f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_TOPO_FAILED  3		(Transitional) */
3358f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_topo_failed_action,	/* STATE_ENTER */
3368f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3378f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3388f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3398f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3408f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3418f23e9fHans Rosenfeld
3428f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_TOPO_CMPL  4			(Transitional) */
3438f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_topo_cmpl_action,	/* STATE_ENTER */
3448f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3458f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3468f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3478f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3488f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3498f23e9fHans Rosenfeld
3508f23e9fHans Rosenfeld
3518f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_CFGLINK  5			(Wait for cfglink mbcmpl) */
3528f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_cfglink_action,	/* STATE_ENTER */
3538f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3548f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3558f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3568f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3578f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3588f23e9fHans Rosenfeld
3598f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_CFGLINK_FAILED  6		(Transitional) */
3608f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_cfglink_failed_action,	/* STATE_ENTER */
3618f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3628f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3638f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3648f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3658f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3668f23e9fHans Rosenfeld
3678f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_CFGLINK_CMPL  7			(Transitional) */
3688f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_cfglink_cmpl_action,	/* STATE_ENTER */
3698f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3708f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3718f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3728f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3738f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3748f23e9fHans Rosenfeld
3758f23e9fHans Rosenfeld
3768f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_SPARM  8			(Wait for sparm mbcmpl) */
3778f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_sparm_action,		/* STATE_ENTER */
3788f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3798f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3808f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3818f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3828f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3838f23e9fHans Rosenfeld
3848f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_SPARM_FAILED  9		(Transitional) */
3858f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_sparm_failed_action,	/* STATE_ENTER */
3868f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3878f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3888f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3898f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3908f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3918f23e9fHans Rosenfeld
3928f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_SPARM_CMPL  10		(Transitional) */
3938f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_sparm_cmpl_action,	/* STATE_ENTER */
3948f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
3958f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
3968f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
3978f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
3988f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
3998f23e9fHans Rosenfeld
4008f23e9fHans Rosenfeld
4018f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL  11	(Transitional) */
4028f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_cmpl_action, /* STATE_ENTER */
4038f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
4048f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
4058f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
4068f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
4078f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
4088f23e9fHans Rosenfeld
4098f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_FCFI_OFFLINE  12		(Wait for FCFI_OFFLINE event) */
4108f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_action,	/* STATE_ENTER */
4118f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
4128f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
4138f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
4148f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
4158f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
4168f23e9fHans Rosenfeld
4178f23e9fHans Rosenfeld
4188f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_FCFI_ONLINE  13		(Wait for FCFI_ONLINE event) */
4198f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_action,	/* STATE_ENTER */
4208f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
4218f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
4228f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
4238f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
4248f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
4258f23e9fHans Rosenfeld
4268f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_FCFI_ONLINE_CMPL  14		(Transitional) */
4278f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_cmpl_action, /* STATE_ENTER */
4288f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
4298f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
4308f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
4318f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
4328f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
4338f23e9fHans Rosenfeld
4348f23e9fHans Rosenfeld
4358f23e9fHans Rosenfeld/* FC_FCFTAB_STATE_ONLINE  15			(Wait for LINK_DOWN evt) */
4368f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_online_action,		/* STATE_ENTER */
4378f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_shutdown_evt_action,	/* SHUTDOWN */
4388f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkup_evt_action,	/* LINK_UP */
4398f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_linkdown_evt_action,	/* LINK_DOWN */
4408f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
4418f23e9fHans Rosenfeld	(void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
4428f23e9fHans Rosenfeld
4438f23e9fHans Rosenfeld}; /* emlxs_fc_fcftab_action_table[] */
4448f23e9fHans Rosenfeld#define	FC_FCFTAB_ACTION_EVENTS			6
4458f23e9fHans Rosenfeld#define	FC_FCFTAB_ACTION_STATES			\
4468f23e9fHans Rosenfeld	(sizeof (emlxs_fc_fcftab_action_table)/ \
4478f23e9fHans Rosenfeld	(FC_FCFTAB_ACTION_EVENTS * sizeof (void *)))
4488f23e9fHans Rosenfeld
4498f23e9fHans Rosenfeld
4508f23e9fHans Rosenfeld/* ********************************************************************** */
4518f23e9fHans Rosenfeld/* FCOE FCFTAB */
4528f23e9fHans Rosenfeld/* ********************************************************************** */
4538f23e9fHans Rosenfeld
4548f23e9fHans Rosenfeld/* Order does not matter */
4558f23e9fHans Rosenfeldemlxs_table_t emlxs_fcoe_fcftab_state_table[] =
4568f23e9fHans Rosenfeld{
4578f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_SHUTDOWN, "FCFTAB_SHUTDOWN"},
4588f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_OFFLINE, "FCFTAB_OFFLINE"},
4598f23e9fHans Rosenfeld
4608f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_SOLICIT, "FCFTAB_SOLICIT"},
4618f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_SOLICIT_FAILED, "FCFTAB_SOLICIT_FAILED"},
4628f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_SOLICIT_CMPL, "FCFTAB_SOLICIT_CMPL"},
4638f23e9fHans Rosenfeld
4648f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_READ, "FCFTAB_READ"},
4658f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_READ_FAILED, "FCFTAB_READ_FAILED"},
4668f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_READ_CMPL, "FCFTAB_READ_CMPL"},
4678f23e9fHans Rosenfeld
4688f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL,
4698f23e9fHans Rosenfeld	    "FCFTAB_FCFI_OFFLINE_CMPL"},
4708f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_FCFI_OFFLINE, "FCFTAB_FCFI_OFFLINE"},
4718f23e9fHans Rosenfeld
4728f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_FCFI_ONLINE, "FCFTAB_FCFI_ONLINE"},
4738f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL,
4748f23e9fHans Rosenfeld	    "FCFTAB_FCFI_ONLINE_CMPL"},
4758f23e9fHans Rosenfeld
4768f23e9fHans Rosenfeld	{FCOE_FCFTAB_STATE_ONLINE, "FCFTAB_ONLINE"},
4778f23e9fHans Rosenfeld
4788f23e9fHans Rosenfeld}; /* emlxs_fcoe_fcftab_state_table */
4798f23e9fHans Rosenfeld
4808f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_sol_cmpl_action(emlxs_port_t *port,
481a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4828f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_sol_failed_action(emlxs_port_t *port,
483a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4848f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_sol_action(emlxs_port_t *port,
485a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4868f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_shutdown_evt_action(emlxs_port_t *port,
487a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4888f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_linkdown_evt_action(emlxs_port_t *port,
489a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4908f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_read_action(emlxs_port_t *port,
491a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4928f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_read_failed_action(emlxs_port_t *port,
493a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4948f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_read_cmpl_action(emlxs_port_t *port,
495a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4968f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_fcfi_online_action(emlxs_port_t *port,
497a9800beGarrett D'Amore			uint32_t evt, void *arg1);
4988f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port,
499a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5008f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_fcfi_offline_action(emlxs_port_t *port,
501a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5028f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port,
503a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5048f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_found_evt_action(emlxs_port_t *port,
505a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5068f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_lost_evt_action(emlxs_port_t *port,
507a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5088f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_changed_evt_action(emlxs_port_t *port,
509a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5108f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_full_evt_action(emlxs_port_t *port,
511a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5128f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_linkup_evt_action(emlxs_port_t *port,
513a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5148f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_cvl_evt_action(emlxs_port_t *port,
515a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5168f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_online_action(emlxs_port_t *port,
517a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5188f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_offline_action(emlxs_port_t *port,
519a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5208f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_fcfi_offline_evt_action(emlxs_port_t *port,
521a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5228f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_fcfi_online_evt_action(emlxs_port_t *port,
523a9800beGarrett D'Amore			uint32_t evt, void *arg1);
524a9800beGarrett D'Amore
5258f23e9fHans Rosenfeldstatic void emlxs_fcoe_fcftab_read_timer(emlxs_hba_t *hba);
5268f23e9fHans Rosenfeldstatic void emlxs_fcoe_fcftab_sol_timer(emlxs_hba_t *hba);
5278f23e9fHans Rosenfeldstatic void emlxs_fcoe_fcftab_offline_timer(emlxs_hba_t *hba);
5288f23e9fHans Rosenfeldstatic char *emlxs_fcoe_fcftab_state_xlate(uint32_t state);
5298f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_event(emlxs_port_t *port,
530a9800beGarrett D'Amore			uint32_t evt, void *arg1);
5318f23e9fHans Rosenfeldstatic uint32_t emlxs_fcoe_fcftab_state(emlxs_port_t *port, uint16_t state,
5328f23e9fHans Rosenfeld	uint16_t reason, uint32_t explain, void *arg1);
533a9800beGarrett D'Amore
534a9800beGarrett D'Amore/*
5358f23e9fHans Rosenfeld * - Online sequencing can start from FCOE_FCFTAB_STATE_OFFLINE state
536a9800beGarrett D'Amore *
537a9800beGarrett D'Amore * - Offline sequencing can interrupt the online sequencing at the
538a9800beGarrett D'Amore * entry of the next wait state.
539a9800beGarrett D'Amore *
540a9800beGarrett D'Amore * NORMAL ONLINE SEQ
541a9800beGarrett D'Amore * ---------------------------
542a9800beGarrett D'Amore * LINK_UP event <-- Adapter
5438f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_OFFLINE
5448f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_SOLICIT
5458f23e9fHans Rosenfeld *     FCOE_FCFTAB_STATE_SOLICIT_CMPL
5468f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_READ
5478f23e9fHans Rosenfeld *     FCOE_FCFTAB_STATE_READ_CMPL
5488f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_OFFLINE
5498f23e9fHans Rosenfeld *     FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL
5508f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_ONLINE
5518f23e9fHans Rosenfeld *     FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL
5528f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_ONLINE
553a9800beGarrett D'Amore *
554a9800beGarrett D'Amore *
555a9800beGarrett D'Amore * NORMAL OFFLINE SEQ
556a9800beGarrett D'Amore * ---------------------------
557a9800beGarrett D'Amore * LINK_DOWN event <-- Adapter
5588f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_ONLINE
5598f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_OFFLINE
5608f23e9fHans Rosenfeld *     FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL
5618f23e9fHans Rosenfeld * FCOE_FCFTAB_STATE_OFFLINE
562a9800beGarrett D'Amore *
563a9800beGarrett D'Amore */
564a9800beGarrett D'Amore/* Order does matter */
5658f23e9fHans Rosenfeldstatic void *emlxs_fcoe_fcftab_action_table[] =
566a9800beGarrett D'Amore{
567a9800beGarrett D'Amore	/* Action routine				Event */
5688f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_SHUTDOWN  0		(Requires adapter reset) */
569a9800beGarrett D'Amore	(void *) emlxs_fcftab_shutdown_action,		/* STATE_ENTER */
570a9800beGarrett D'Amore	(void *) NULL,					/* SHUTDOWN */
571a9800beGarrett D'Amore	(void *) NULL,					/* LINK_UP */
572a9800beGarrett D'Amore	(void *) NULL,					/* LINK_DOWN */
573a9800beGarrett D'Amore	(void *) NULL,					/* CVL_RECD */
574a9800beGarrett D'Amore	(void *) NULL,					/* FCF_FOUND */
575a9800beGarrett D'Amore	(void *) NULL,					/* FCF_LOST */
576a9800beGarrett D'Amore	(void *) NULL,					/* FCF_CHANGED */
577a9800beGarrett D'Amore	(void *) NULL,					/* TABLE_FULL */
578a9800beGarrett D'Amore	(void *) NULL,					/* FCFI_ONLINE */
5798f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
5808f23e9fHans Rosenfeld
5818f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_OFFLINE  1			(Wait for LINK_UP event) */
5828f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_offline_action,	/* STATE_ENTER */
5838f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
5848f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
5858f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
5868f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
5878f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
5888f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
5898f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
5908f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
5918f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
5928f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
5938f23e9fHans Rosenfeld
5948f23e9fHans Rosenfeld
5958f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_SOLICIT  2			(Wait on fcf_solicit cmpl) */
5968f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_sol_action,		/* STATE_ENTER */
5978f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
5988f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
5998f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6008f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6018f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6028f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6038f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6048f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6058f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6068f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
6078f23e9fHans Rosenfeld
6088f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_SOLICIT_FAILED  3		(Transitional) */
6098f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_sol_failed_action,	/* STATE_ENTER */
6108f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
6118f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
6128f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6138f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6148f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6158f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6168f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6178f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6188f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6198f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
6208f23e9fHans Rosenfeld
6218f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_SOLICIT_CMPL  4		(Wait on fcf timer cmpl) */
6228f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_sol_cmpl_action,	/* STATE_ENTER */
6238f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
6248f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
6258f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6268f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6278f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6288f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6298f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6308f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6318f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6328f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
6338f23e9fHans Rosenfeld
6348f23e9fHans Rosenfeld
6358f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_READ  5			(Wait on fcf_read cmpl) */
6368f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_read_action,		/* STATE_ENTER */
6378f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
6388f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
6398f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6408f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6418f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6428f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6438f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6448f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6458f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6468f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
6478f23e9fHans Rosenfeld
6488f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_READ_FAILED  6		(Transitional) */
6498f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_read_failed_action,	/* STATE_ENTER */
6508f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
6518f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
6528f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6538f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6548f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6558f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6568f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6578f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6588f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6598f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
6608f23e9fHans Rosenfeld
6618f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_READ_CMPL  7		(Transitional) */
6628f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_read_cmpl_action,	/* STATE_ENTER */
6638f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
6648f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
6658f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6668f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6678f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6688f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6698f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6708f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6718f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6728f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
6738f23e9fHans Rosenfeld
6748f23e9fHans Rosenfeld
6758f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL  8	(Transitional) */
6768f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_cmpl_action, /* STATE_ENTER */
6778f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
6788f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
6798f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6808f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6818f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6828f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6838f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6848f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6858f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6868f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
6878f23e9fHans Rosenfeld
6888f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_FCFI_OFFLINE  9		(Wait for FCFI_OFFLINE event) */
6898f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_action,	/* STATE_ENTER */
6908f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
6918f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
6928f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
6938f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
6948f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
6958f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
6968f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
6978f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
6988f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
6998f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
7008f23e9fHans Rosenfeld
7018f23e9fHans Rosenfeld
7028f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_FCFI_ONLINE  10		(Wait on FCFI_ONLINE event) */
7038f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_action,	/* STATE_ENTER */
7048f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
7058f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
7068f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
7078f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
7088f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
7098f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
7108f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
7118f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
7128f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
7138f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
7148f23e9fHans Rosenfeld
7158f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL  11	(Transitional) */
7168f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_cmpl_action, /* STATE_ENTER */
7178f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
7188f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
7198f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
7208f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
7218f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
7228f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
7238f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
7248f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
7258f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
7268f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
7278f23e9fHans Rosenfeld
7288f23e9fHans Rosenfeld
7298f23e9fHans Rosenfeld/* FCOE_FCFTAB_STATE_ONLINE  12			(Wait for LINK_DOWN event) */
7308f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_online_action,	/* STATE_ENTER */
7318f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_shutdown_evt_action,	/* SHUTDOWN */
7328f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkup_evt_action,	/* LINK_UP */
7338f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_linkdown_evt_action,	/* LINK_DOWN */
7348f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_cvl_evt_action,	/* CVL_RECD */
7358f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_found_evt_action,	/* FCF_FOUND */
7368f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_lost_evt_action,	/* FCF_LOST */
7378f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_changed_evt_action,	/* FCF_CHANGED */
7388f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_full_evt_action,	/* TABLE_FULL */
7398f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
7408f23e9fHans Rosenfeld	(void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
7418f23e9fHans Rosenfeld
7428f23e9fHans Rosenfeld}; /* emlxs_fcoe_fcftab_action_table[] */
7438f23e9fHans Rosenfeld#define	FCOE_FCFTAB_ACTION_EVENTS			11
7448f23e9fHans Rosenfeld#define	FCOE_FCFTAB_ACTION_STATES			\
7458f23e9fHans Rosenfeld	(sizeof (emlxs_fcoe_fcftab_action_table)/ \
7468f23e9fHans Rosenfeld	(FCOE_FCFTAB_ACTION_EVENTS * sizeof (void *)))
747a9800beGarrett D'Amore
748a9800beGarrett D'Amore
749a9800beGarrett D'Amore
750a9800beGarrett D'Amore
751a9800beGarrett D'Amore/* ********************************************************************** */
752a9800beGarrett D'Amore/* FCFI */
753a9800beGarrett D'Amore/* ********************************************************************** */
754a9800beGarrett D'Amore
755a9800beGarrett D'Amore/* Order does not matter */
756a9800beGarrett D'Amoreemlxs_table_t emlxs_fcfi_state_table[] =
757a9800beGarrett D'Amore{
7588f23e9fHans Rosenfeld	{FCFI_STATE_FREE, "FCFI_FREE"},
759a9800beGarrett D'Amore
7608f23e9fHans Rosenfeld	{FCFI_STATE_OFFLINE, "FCFI_OFFLINE"},
761a9800beGarrett D'Amore
7628f23e9fHans Rosenfeld	{FCFI_STATE_UNREG_CMPL, "FCFI_UNREG_CMPL"},
7638f23e9fHans Rosenfeld	{FCFI_STATE_UNREG_FAILED, "FCFI_UNREG_FAILED"},
7648f23e9fHans Rosenfeld	{FCFI_STATE_UNREG, "FCFI_UNREG"},
765a9800beGarrett D'Amore
7668f23e9fHans Rosenfeld	{FCFI_STATE_REG, "FCFI_REG"},
7678f23e9fHans Rosenfeld	{FCFI_STATE_REG_FAILED, "FCFI_REG_FAILED"},
7688f23e9fHans Rosenfeld	{FCFI_STATE_REG_CMPL, "FCFI_REG_CMPL"},
769a9800beGarrett D'Amore
7708f23e9fHans Rosenfeld	{FCFI_STATE_VFI_OFFLINE_CMPL, "FCFI_VFI_OFFLINE_CMPL"},
7718f23e9fHans Rosenfeld	{FCFI_STATE_VFI_OFFLINE, "FCFI_VFI_OFFLINE"},
772a9800beGarrett D'Amore
7738f23e9fHans Rosenfeld	{FCFI_STATE_VFI_ONLINE, "FCFI_VFI_ONLINE"},
7748f23e9fHans Rosenfeld	{FCFI_STATE_VFI_ONLINE_CMPL, "FCFI_VFI_ONLINE_CMPL"},
775a9800beGarrett D'Amore
7768f23e9fHans Rosenfeld	{FCFI_STATE_PAUSED, "FCFI_PAUSED"},
7778f23e9fHans Rosenfeld	{FCFI_STATE_ONLINE, "FCFI_ONLINE"},
778a9800beGarrett D'Amore
779a9800beGarrett D'Amore}; /* emlxs_fcfi_state_table */
780a9800beGarrett D'Amore
781a9800beGarrett D'Amore
782a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_free_action(emlxs_port_t *port,
783a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
784a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_online_evt_action(emlxs_port_t *port,
785a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
786a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_offline_evt_action(emlxs_port_t *port,
787a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
788a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_pause_evt_action(emlxs_port_t *port,
789a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
790a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_reg_action(emlxs_port_t *port,
791a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
792a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_unreg_action(emlxs_port_t *port,
793a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
794a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_reg_cmpl_action(emlxs_port_t *port,
795a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
796a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_unreg_cmpl_action(emlxs_port_t *port,
797a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
798a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_vfi_online_action(emlxs_port_t *port,
799a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
800a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_vfi_online_cmpl_action(emlxs_port_t *port,
801a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
802a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_reg_failed_action(emlxs_port_t *port,
803a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
804a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_unreg_failed_action(emlxs_port_t *port,
805a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
806a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_vfi_offline_action(emlxs_port_t *port,
807a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
808a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_vfi_offline_cmpl_action(emlxs_port_t *port,
809a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
810a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_online_action(emlxs_port_t *port,
811a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
812a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_paused_action(emlxs_port_t *port,
813a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
814a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_offline_action(emlxs_port_t *port,
815a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
816a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_vfi_online_evt_action(emlxs_port_t *port,
817a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
818a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_vfi_offline_evt_action(emlxs_port_t *port,
819a9800beGarrett D'Amore			FCFIobj_t *fcfp, uint32_t evt, void *arg1);
820a9800beGarrett D'Amore
821a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_event(emlxs_port_t *port,
822a9800beGarrett D'Amore			uint32_t evt, void *arg1);
823a9800beGarrett D'Amorestatic FCFIobj_t *emlxs_fcfi_find(emlxs_port_t *port, FCF_RECORD_t *fcfrec,
824a9800beGarrett D'Amore			uint32_t *fcf_index);
825a9800beGarrett D'Amorestatic FCFIobj_t *emlxs_fcfi_alloc(emlxs_port_t *port);
826a9800beGarrett D'Amorestatic uint32_t emlxs_fcfi_free(emlxs_port_t *port, FCFIobj_t *fcfp);
827a9800beGarrett D'Amorestatic void emlxs_fcfi_update(emlxs_port_t *port, FCFIobj_t *fcfp,
828a9800beGarrett D'Amore			FCF_RECORD_t *fcf_rec, uint32_t event_tag);
829a9800beGarrett D'Amorestatic char *emlxs_fcfi_state_xlate(uint32_t state);
830a9800beGarrett D'Amore
831a9800beGarrett D'Amore/*
832a9800beGarrett D'Amore * - Online sequencing can start from FCFI_STATE_OFFLINE state or
833a9800beGarrett D'Amore * the FCFI_STATE_VFI_OFFLINE state.
834a9800beGarrett D'Amore *
835a9800beGarrett D'Amore * - Offline sequencing can interrupt the online sequencing at the
836a9800beGarrett D'Amore * entry of the next wait state.
837a9800beGarrett D'Amore *
838a9800beGarrett D'Amore * NORMAL ONLINE SEQ
839a9800beGarrett D'Amore * ---------------------------
840a9800beGarrett D'Amore * FCFI_ONLINE event <-- FCFTAB
841a9800beGarrett D'Amore * FCFI_STATE_OFFLINE
842a9800beGarrett D'Amore * FCFI_STATE_REG
843a9800beGarrett D'Amore *     FCFI_STATE_REG_CMPL
844a9800beGarrett D'Amore * FCFI_STATE_VFI_ONLINE
845a9800beGarrett D'Amore *     FCFI_STATE_VFI_ONLINE_CMPL
846a9800beGarrett D'Amore * FCFI_STATE_ONLINE
847a9800beGarrett D'Amore * FCFI_ONLINE event-->FCFTAB
848a9800beGarrett D'Amore *
849a9800beGarrett D'Amore *
850a9800beGarrett D'Amore * NORMAL OFFLINE SEQ
851