fcp.c revision 1787f50304cd7e85910a3e14f639ac892c0d76b7
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * CDDL HEADER START
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * The contents of this file are subject to the terms of the
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Common Development and Distribution License (the "License").
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * You may not use this file except in compliance with the License.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * See the License for the specific language governing permissions
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * and limitations under the License.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * When distributing Covered Code, include this CDDL HEADER in each
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * If applicable, add the following below this CDDL HEADER, with the
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * fields enclosed by brackets "[]" replaced with your own identifying
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * information: Portions Copyright [yyyy] [name of copyright owner]
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * CDDL HEADER END
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Use is subject to license terms.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Fibre Channel SCSI ULP Mapping driver
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Discovery Process
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * =================
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * The discovery process is a major function of FCP. In order to help
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * understand that function a flow diagram is given here. This diagram
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * doesn't claim to cover all the cases and the events that can occur during
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * the discovery process nor the subtleties of the code. The code paths shown
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * are simplified. Its purpose is to help the reader (and potentially bug
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * fixer) have an overall view of the logic of the code. For that reason the
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * diagram covers the simple case of the line coming up cleanly or of a new
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * port attaching to FCP the link being up. The reader must keep in mind
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * - There are special cases where bringing devices online and offline
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * is driven by Ioctl.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * - The behavior of the discovery process can be modified through the
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * .conf file.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * - The line can go down and come back up at any time during the
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * discovery process which explains some of the complexity of the code.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * ............................................................................
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * STEP 1: The line comes up or a new Fibre Channel port attaches to FCP.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * fp/fctl module --->| fcp_port_attach |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | | fcp_handle_port_attach |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_statec_callback |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_handle_devices |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_handle_mapflags |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_send_els |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | PLOGI or PRLI To all the|
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | reachable devices. |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * ............................................................................
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * STEP 2: The callback functions of the PLOGI and/or PRLI requests sent during
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * STEP 1 are called (it is actually the same function).
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_icmd_callback |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * fp/fctl module --->| |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | callback for PLOGI and |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | PRLI. |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Received PLOGI Accept /-\ Received PRLI Accept
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * _ _ _ _ _ _ / \_ _ _ _ _ _
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+ +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_send_els | | fcp_send_scsi |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | PRLI | | REPORT_LUN |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+ +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * ............................................................................
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * STEP 3: The callback functions of the SCSI commands issued by FCP are called
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * (It is actually the same function).
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * fp/fctl module ------->| fcp_scsi_callback |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Receive REPORT_LUN reply /-\ Receive INQUIRY PAGE83 reply
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * _ _ _ _ _ _ _ _ _ _ / \_ _ _ _ _ _ _ _ _ _ _ _
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | Receive INQUIRY reply| |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +------------------------+ +----------------------+ +----------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_handle_reportlun | | fcp_handle_inquiry | | fcp_handle_page83 |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * |(Called for each Target)| | (Called for each LUN)| |(Called for each LUN) |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +------------------------+ +----------------------+ +----------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-----------------+ +-----------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_send_scsi | | fcp_send_scsi | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | | | | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | INQUIRY | | INQUIRY PAGE83 | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | (To each LUN) | +-----------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-----------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_call_finish_init |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-----------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_call_finish_init_held |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-----------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * All LUNs scanned /-\
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ / \
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_finish_tgt | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | Target Not Offline and |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Target Not Offline and | not marked and tgt_node_state |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * marked /-\ not FCP_TGT_NODE_ON_DEMAND |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * _ _ _ _ _ _ / \_ _ _ _ _ _ _ _ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | \ / | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | \-/ | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +----------------------------+ +-------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_offline_target | | fcp_create_luns | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | | +-------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | A structure fcp_tgt_elem | | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | is created and queued in | v |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | the FCP port list | +-------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | port_offline_tgts. It | | fcp_pass_to_hp | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | will be unqueued by the | | | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | watchdog timer. | | Called for each | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +----------------------------+ | LUN. Dispatches | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | | fcp_hp_task | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | +-------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | +---------------->|
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +---------------------------------------------->|
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * All the targets (devices) have been scanned /-\
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ / \
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_finish_init | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | Signal broadcasts the condition | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | variable port_config_cv of the FCP | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | port. One potential code sequence | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | waiting on the condition variable | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | the code sequence handling | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | BUS_CONFIG_ALL and BUS_CONFIG_DRIVER| |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | The other is in the function | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_reconfig_wait which is called | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | in the transmit path preventing IOs | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | from going through till the disco- | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | very process is over. | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------------------+ |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------------->|
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * ............................................................................
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * STEP 4: The hot plug task is called (for each fcp_hp_elem).
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_hp_task |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_trigger_lun |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Bring offline /-\ Bring online
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * _ _ _ _ _ _ _ _ _/ \_ _ _ _ _ _ _ _ _ _
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +---------------------+ +-----------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_offline_child | | fcp_get_cip |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +---------------------+ | |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | Creates a dev_info_t |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | or a mdi_pathinfo_t |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | depending on whether |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | mpxio is on or off. |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-----------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-----------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_online_child |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | Set device online |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | using NDI or MDI. |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +-----------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * ............................................................................
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * STEP 5: The watchdog timer expires. The watch dog timer does much more that
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * what is described here. We only show the target offline path.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_watch |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_scan_offline_tgts |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_offline_target_now |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_offline_tgt_luns |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_offline_lun |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +--------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +----------------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | fcp_offline_lun_now |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | A request (or two if mpxio) is |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | sent to the hot plug task using |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * | a fcp_hp_elem structure. |
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * +----------------------------------+
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Functions registered with DDI framework
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_attach(dev_info_t *devi, ddi_attach_cmd_t cmd);
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_detach(dev_info_t *devi, ddi_detach_cmd_t cmd);
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_open(dev_t *devp, int flag, int otype, cred_t *credp);
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_close(dev_t dev, int flag, int otype, cred_t *credp);
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_ioctl(dev_t dev, int cmd, intptr_t data, int mode,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Functions registered with FC Transport framework
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_port_attach(opaque_t ulph, fc_ulp_port_info_t *pinfo,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_port_detach(opaque_t ulph, fc_ulp_port_info_t *info,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_port_ioctl(opaque_t ulph, opaque_t port_handle, dev_t dev,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson int cmd, intptr_t data, int mode, cred_t *credp, int *rval,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_els_callback(opaque_t ulph, opaque_t port_handle,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_data_callback(opaque_t ulph, opaque_t port_handle,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic void fcp_statec_callback(opaque_t ulph, opaque_t port_handle,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson uint32_t port_state, uint32_t port_top, fc_portmap_t *devlist,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Functions registered with SCSA framework
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelsonstatic int fcp_phys_tgt_init(dev_info_t *hba_dip, dev_info_t *tgt_dip,
int whom);
int cause);
int tgt_cnt);
int internal);
int instance);
int flags);
int sleep);
int tgt_cnt);
int *rval);
int *rval);
int tcount);
int what);
* This variable is defined in modctl.c and set to '1' after the root driver
extern int modrootloaded;
extern char *sense_keys[];
#define FCP_MAX(a, b) ((a) > (b) ? (a) : (b))
#define FCP_N_NDI_EVENTS \
#define FCP_LINK_STATE_CHANGED(p, c) \
#define FCP_TGT_STATE_CHANGED(t, c) \
#define FCP_STATE_CHANGED(p, t, c) \
(FCP_TGT_STATE_CHANGED(t, c))
#ifdef DEBUG
#define FCP_DTRACE
&modldrv,
#ifdef DEBUG
int fcp_bus_config_debug = 0;
* through the property MANUAL_CFG_ONLY in the fcp.conf file.
static int fcp_watchdog_init = 0;
static int fcp_watchdog_time = 0;
static int fcp_watchdog_tick;
* specified in FCP4 Chapter 11 (see www.t10.org).
#if !defined(lint)
char *fcp_symmetric_disk_table[] = {
sizeof (fcp_symmetric_disk_table)/sizeof (char *);
_init(void)
int rval;
return (EINVAL);
return (ENODEV);
return (rval);
_fini(void)
int rval;
return (rval);
return (rval);
return (rval);
(void *) fcp_port_head);
return (res);
return (EINVAL);
return (EPERM);
return (EBUSY);
return (EBUSY);
return (EINVAL);
return (ENODEV);
int *rval)
int ret = 0;
return (ENXIO);
switch (cmd) {
case FCP_TGT_INQUIRY:
case FCP_TGT_CREATE:
case FCP_TGT_DELETE:
case FCP_TGT_SEND_SCSI:
case FCP_STATE_COUNT:
case FCP_GET_TARGET_MAPPINGS:
return (ret);
* ioctl for FCP. See "fcp_util.h" for data structure
int *rval)
int i, error;
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
return (EFAULT);
case DDI_MODEL_NONE:
return (EFAULT);
return (EFAULT);
while (pptr) {
return (ENXIO);
return (ENOMEM);
return (EFAULT);
mode)) {
return (EFAULT);
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
(void *)data,
return (EFAULT);
case DDI_MODEL_NONE:
return (EFAULT);
return (EFAULT);
return (ENXIO);
FCP_TGT_BUSY)) {
switch (cmd) {
case FCP_TGT_INQUIRY:
case FCP_TGT_CREATE:
if (dev_data) {
sizeof (*dev_data) *
return (EBUSY);
for (i = 0; i < FC_WWN_SIZE; i++) {
case FCP_TGT_DELETE:
return (EFAULT);
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
return (EFAULT);
case DDI_MODEL_NONE:
return (EFAULT);
return (EFAULT);
int listlen;
char *path;
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
return (EFAULT);
case DDI_MODEL_NONE:
return (EFAULT);
return (EFAULT);
while (pptr) {
return (ENXIO);
- sizeof (fc_hba_target_mappings_t);
if (listlen <= 0) {
return (ENXIO);
return (ENOMEM);
mapIndex = 0;
for (i = 0; i < FCP_NUM_HASH; i++) {
mapIndex ++;
return (EFAULT);
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
return (EFAULT);
case DDI_MODEL_NONE:
return (EFAULT);
return (EFAULT);
* ioctl for FCP. See "fcp_util.h" for data structure
* EAGAIN = See errno.h
* EBUSY = See errno.h
* EFAULT = See errno.h
* EINTR = See errno.h
* EINVAL = See errno.h
* EIO = See errno.h
* ENOMEM = See errno.h
* ENXIO = See errno.h
int ret = 0;
int temp_ret;
return (ret);
return (EINVAL);
if (ret == 0) {
if (ret == 0) {
mode)) {
mode)) {
mode)) {
if (ret == 0) {
if (ret == 0) {
mode)) {
mode)) {
mode)) {
if (temp_ret != 0) {
return (ret);
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32:
&f32scsi,
sizeof (struct fcp32_scsi_cmd),
mode)) {
return (EFAULT);
case DDI_MODEL_NONE:
sizeof (struct fcp_scsi_cmd),
mode)) {
return (EFAULT);
sizeof (struct fcp_scsi_cmd),
mode)) {
return (EFAULT);
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32:
(void *)base_addr,
sizeof (struct fcp32_scsi_cmd),
mode)) {
return (EFAULT);
case DDI_MODEL_NONE:
(void *)base_addr,
sizeof (struct fcp_scsi_cmd),
mode)) {
return (EFAULT);
(void *)base_addr,
sizeof (struct fcp_scsi_cmd),
mode)) {
return (EFAULT);
* EAGAIN = See errno.h
* EBUSY = See errno.h
* EINTR = See errno.h
* EINVAL = See errno.h
* EIO = See errno.h
* ENOMEM = See errno.h
* ENXIO = See errno.h
int nodma;
int buf_len;
int info_len;
int sense_len;
int rsp_len;
int cmd_index;
int fc_status;
int pkt_state;
int pkt_action;
int pkt_reason;
int lcount;
int tcount;
int reconfig_status;
for (cmd_index = 0;
ret != 0;
cmd_index++) {
ret = 0;
if (ret == 0) {
while (pptr) {
if (ret == 0) {
&pkt_reason);
} else if (ret == 0) {
if (ret == 0) {
(FCP_TGT_MARK |
FCP_TGT_BUSY)) {
if (ret == 0) {
if (ret == 0) {
sizeof (struct fcp_cmd),
if (ret == 0) {
if (nodma) {
if (!nodma) {
if (ret == 0) {
fpkt);
sense_len = 0;
info_len = 0;
if (ret == 0) {
if (buf_len) {
buf_len);
if (port_busy) {
if (target_created) {
return (ret);
int num_luns;
int actual_luns;
int num_masked_luns;
int lun_buflen;
num_masked_luns = 0;
for (i = 0; i < actual_luns; i++) {
case FCP_LUN_ADDRESSING:
case FCP_PD_ADDRESSING:
case FCP_VOLUME_ADDRESSING:
return (TRUE);
for (i = 0; i < actual_luns; i++) {
case FCP_LUN_ADDRESSING:
case FCP_PD_ADDRESSING:
case FCP_VOLUME_ADDRESSING:
return (reconfig_needed);
char *devidptr;
int i, len;
for (i = 0; i < fcp_symmetric_disk_table_size; i++) {
int ret;
&pptr)) != 0) {
return (ret);
return (EINVAL);
return (ENXIO);
return (ENXIO);
return (EFAULT);
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
return (EFAULT);
case DDI_MODEL_NONE:
return (EFAULT);
return (EFAULT);
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
return (EFAULT);
case DDI_MODEL_NONE:
return (EFAULT);
return (EFAULT);
while (t_pptr) {
return (ENXIO);
static struct fcp_tgt *
int lcount;
int error;
*ret_val = 0;
if (*ret_val == 0) {
if (*ret_val == 0) {
if (*ret_val == 0) {
return (ptgt);
int tcount;
int lcount;
ret = 0;
return (ret);
int ret;
case FC_PKT_SUCCESS:
ret = 0;
case FC_PKT_LOCAL_RJT:
case FC_REASON_SEQ_TIMEOUT:
case FC_REASON_RX_BUF_TIMEOUT:
case FC_REASON_PKT_BUSY:
case FC_PKT_TIMEOUT:
case FC_PKT_LOCAL_BSY:
case FC_PKT_TRAN_BSY:
case FC_PKT_NPORT_BSY:
case FC_PKT_FABRIC_BSY:
case FC_PKT_LS_RJT:
case FC_PKT_BA_RJT:
case FC_REASON_LOGICAL_BSY:
case FC_PKT_FS_RJT:
return (ret);
int instance;
switch (cmd) {
case FC_CMD_ATTACH:
case FC_CMD_RESUME:
case FC_CMD_POWER_UP:
return (res);
int flag;
int instance;
switch (cmd) {
case FC_CMD_SUSPEND:
case FC_CMD_POWER_DOWN:
case FC_CMD_DETACH:
return (FC_FAILURE);
int devi_entered = 0;
if (claimed) {
return (retval);
return (retval);
switch (cmd) {
case DEVCTL_BUS_GETSTATE:
case DEVCTL_BUS_QUIESCE:
case DEVCTL_BUS_UNQUIESCE:
case DEVCTL_BUS_RESET:
case DEVCTL_BUS_RESETALL:
case DEVCTL_BUS_DEV_CREATE:
return (retval);
case DEVCTL_DEVICE_GETSTATE:
case DEVCTL_DEVICE_OFFLINE:
case DEVCTL_DEVICE_ONLINE:
case DEVCTL_DEVICE_REMOVE:
case DEVCTL_DEVICE_RESET:
return (retval);
return (retval);
if (is_mpxio) {
goto out;
return (retval);
*rval = 0;
switch (cmd) {
case DEVCTL_DEVICE_GETSTATE:
case DEVCTL_DEVICE_REMOVE:
case DEVCTL_DEVICE_OFFLINE: {
int flag = 0;
int lcount;
int tcount;
if (is_mpxio) {
devi_entered = 0;
all = 0;
if (all) {
* The user is unconfiguring/offlining the device.
case DEVCTL_DEVICE_ONLINE: {
int lcount;
int tcount;
if (is_mpxio) {
devi_entered = 0;
case DEVCTL_BUS_DEV_CREATE: {
if (*rval == 0) {
if (ptgt) {
while (plun &&
* reboot/reset-recovery times to become available
& FCP_LUN_OFFLINE)) {
if (!plun) {
if (plun) {
int nmlen;
for (i = 0; i < FC_WWN_SIZE; i++) {
case DEVCTL_DEVICE_RESET: {
case DEVCTL_BUS_GETSTATE:
NDI_SUCCESS) {
case DEVCTL_BUS_QUIESCE:
case DEVCTL_BUS_UNQUIESCE:
case DEVCTL_BUS_RESET:
case DEVCTL_BUS_RESETALL:
if (is_mpxio) {
return (retval);
return (FC_UNCLAIMED);
return (FC_UNCLAIMED);
case R_CTL_EXTENDED_SVC:
switch (ls_code) {
case LA_ELS_PRLI:
return (FC_SUCCESS);
return (FC_UNCLAIMED);
return (FC_UNCLAIMED);
return (FC_UNCLAIMED);
int map_len = 0;
if (dev_cnt) {
port_sid);
case FC_STATE_OFFLINE:
case FC_STATE_RESET_REQUESTED:
case FC_STATE_ONLINE:
case FC_STATE_LIP:
case FC_STATE_LIP_LBIT_SET:
if (!dev_cnt) {
switch (port_top) {
case FC_TOP_FABRIC:
case FC_TOP_PUBLIC_LOOP:
case FC_TOP_PRIVATE_LOOP:
case FC_TOP_PT_PT:
case FC_STATE_RESET:
case FC_STATE_DEVICE_CHANGE:
FCP_STATE_INIT)) {
if (map_tag) {
int check_finish_init = 0;
if (dev_cnt) {
if (ptgt) {
for (i = 0; i < FCP_NUM_HASH; i++) {
if (check_finish_init) {
ASSERT(i > 0);
check_finish_init = 0;
if (ptgt) {
case PORT_DEVICE_NOCHANGE:
case PORT_DEVICE_USER_CREATE:
case PORT_DEVICE_USER_LOGIN:
case PORT_DEVICE_NEW:
case PORT_DEVICE_OLD:
== FC_SUCCESS) {
case PORT_DEVICE_USER_DELETE:
case PORT_DEVICE_USER_LOGOUT:
case PORT_DEVICE_CHANGED:
ASSERT(i > 0);
int rscn_count;
int lun0_newalloc;
lun0_newalloc = 0;
return (ret);
return (ret);
int lcount;
int tcount;
int alloc;
return (ret);
return (ret);
return (ret);
case FCP_TGT_NODE_NONE:
case FCP_TGT_NODE_ON_DEMAND:
case FCP_TGT_NODE_PRESENT:
return (FALSE);
return (ret);
int internal = 0;
int alloc;
int cmd_len;
int resp_len;
sizeof (la_els_prli_t));
return (res);
internal++;
switch (opcode) {
case LA_ELS_PLOGI: {
case LA_ELS_PRLI: {
if (internal) {
return (res);
for (i = 0; i < FCP_NUM_HASH; i++) {
int ndevs;
ndevs++;
if (ndevs == 0) {
for (i = 0; i < FCP_NUM_HASH; i++) {
static struct fcp_port *
return (pptr);
int tcount = 0;
int lcount;
NULL) {
return (FC_FAILURE);
int rval;
FC_SUCCESS) {
return (FC_SUCCESS);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_SUCCESS);
static struct fcp_ipkt *
int dma_setup = 0;
return (NULL);
sizeof (struct fcp_ipkt));
goto fail;
dma_setup++;
!= FC_SUCCESS) {
goto fail;
!= FC_SUCCESS) {
goto fail;
int rval;
goto fail;
return (icmd);
fail:
sizeof (fc_ulp_rscn_info_t));
if (dma_setup) {
return (NULL);
sizeof (fc_ulp_rscn_info_t));
if (ptgt) {
int rval;
int bound = 0;
int cmd_resp = 0;
if (nodma) {
goto fail;
goto fail;
goto fail;
cmd_resp++;
goto fail;
goto fail;
goto fail;
goto fail;
bound++;
goto fail;
cp++;
return (FC_SUCCESS);
fail:
if (bound) {
if (nodma) {
if (cmd_resp) {
return (FC_NOMEM);
static struct fcp_tgt *
int hash;
return (ptgt);
static struct fcp_tgt *
return (ptgt);
int rval;
int lun0_newalloc;
sizeof (prli_s));
case LA_ELS_PLOGI:
goto fail;
case LA_ELS_PRLI:
sizeof (prli_s));
goto fail;
goto fail;
lun0_newalloc = 0;
goto fail;
sizeof (struct fcp_reportlun_resp),
FCP_BUF_LEVEL_5, 0,
goto fail;
free_pkt = 0;
goto fail;
fpkt);
fail:
if (free_pkt) {
int nodma;
return (DDI_FAILURE);
if (nodma) {
switch (opcode) {
case SCMD_INQUIRY_PAGE83:
case SCMD_INQUIRY:
case SCMD_REPORT_LUN: {
if (!nodma) {
FC_SUCCESS) {
return (DDI_FAILURE);
return (DDI_SUCCESS);
return (DDI_FAILURE);
return (DDI_SUCCESS);
return (rval);
sizeof (struct scsi_extended_sense));
return (rval);
sizeof (struct scsi_extended_sense));
return (DDI_SUCCESS);
return (DDI_SUCCESS);
return (rval);
sizeof (struct fcp_rsp));
sizeof (struct fcp_rsp));
sizeof (struct fcp_rsp));
case SCMD_INQUIRY:
case SCMD_REPORT_LUN:
case SCMD_INQUIRY_PAGE83:
int ignore_page83_data)
int fail = 0;
int ret;
&devid);
if (guid) {
unsigned int len;
if (!fail) {
ret);
if (ignore_page83_data) {
fail = 0;
sizeof (struct scsi_inquiry));
if (pqual != 0) {
* This code is setting/initializing the throttling in the FCA
int nluns_claimed;
int nluns_bufmax;
int len;
int offline;
int exists = 0;
case FCP_LUN_ADDRESSING:
case FCP_PD_ADDRESSING:
case FCP_VOLUME_ADDRESSING:
exists++;
} else if (exists) {
for (i = 0; i < nluns_claimed; i++) {
lun_string[0]);
case FCP_LUN_ADDRESSING:
case FCP_PD_ADDRESSING:
case FCP_VOLUME_ADDRESSING:
FCP_BUF_LEVEL_5, 0,
static struct fcp_lun *
return (plun);
return (NULL);
tgt_cnt, 0, 0);
cause);
return (rval);
#ifdef DEBUG
plun);
int circ;
char *devname;
return (rval);
return (rval);
if (cdip) {
return (NDI_FAILURE);
return (NDI_FAILURE);
if (is_mpxio) {
goto fail;
goto fail;
&circ);
&circ);
if (is_mpxio) {
return (rval);
if (nowait == 0) {
int flags)
if (nowait) {
if (nowait == 0) {
int flags)
while (elem) {
changed = 0;
if (!changed &&
if (prev) {
while (elem) {
changed = 0;
FCP_TGT_OFFLINE)) {
if (prev) {
if (cdip) {
(void) ndi_event_retrieve_cookie(
(void) ndi_event_run_callbacks(
static struct fcp_pkt *
int cmds_found = 0;
cmds_found++;
if (pcmd) {
return (head);
(void *)cmd);
#ifdef DEBUG
int error = 0;
#ifdef DEBUG
sizeof (struct fcp_rsp));
error++;
sizeof (struct fcp_rsp));
FC_SUCCESS) {
sizeof (struct fcp_rsp_info));
sizeof (struct scsi_extended_sense));
FC_SUCCESS) {
case FC_PKT_TRAN_ERROR:
case FC_REASON_OVERRUN:
case FC_REASON_XCHG_BSY: {
if (ptr) {
case FC_REASON_ABORTED:
case FC_REASON_ABORT_FAILED:
case FC_REASON_NO_SEQ_INIT:
case FC_REASON_CRC_ERROR:
case FC_PKT_PORT_OFFLINE: {
if (cdip) {
(void) ndi_event_retrieve_cookie(
(void) ndi_event_run_callbacks(
if (ptr) {
case FC_PKT_TRAN_BSY:
case FC_PKT_TIMEOUT:
case FC_PKT_LOCAL_RJT:
case FC_REASON_OFFLINE: {
if (cdip) {
(void) ndi_event_retrieve_cookie(
(void) ndi_event_run_callbacks(
case FC_REASON_NOMEM:
case FC_REASON_QFULL: {
if (ptr) {
case FC_REASON_DMA_ERROR:
case FC_REASON_CRC_ERROR:
case FC_REASON_UNDERRUN: {
sizeof (struct fcp_rsp));
case FC_REASON_NO_CONNECTION:
case FC_REASON_UNSUPPORTED:
case FC_REASON_ILLEGAL_REQ:
case FC_REASON_BAD_SID:
case FC_REASON_DIAG_BUSY:
case FC_REASON_FCAL_OPN_FAIL:
case FC_REASON_BAD_XID:
case FC_PKT_NPORT_RJT:
case FC_PKT_FABRIC_RJT:
case FC_PKT_NPORT_BSY:
case FC_PKT_FABRIC_BSY:
FCP_BUF_LEVEL_5, 0,
return (FC_FAILURE);
sizeof (struct fcp_rsp))) {
return (FC_FAILURE);
return (FC_SUCCESS);
static struct fcp_lun *
return (plun);
static struct fcp_tgt *
int hash;
return (ptgt);
int rval;
return (rval);
if (internal) {
char *op;
case SCMD_REPORT_LUN:
case SCMD_INQUIRY:
case SCMD_INQUIRY_PAGE83:
return (rval);
int rval;
if (rval == 0) {
int manual_cfg;
instance);
return (res);
return (res);
char *pathname;
"%s (%s%d) %s is enabled via %s.conf.",
sizeof (ddi_dma_cookie_t));
goto fail;
sizeof (fcp_ndi_event_defs));
goto fail;
!= DDI_SUCCESS) {
goto fail;
MDI_SUCCESS) {
if (fcp_watchdog_init++ == 0) {
if (boot_wwn) {
case FC_STATE_OFFLINE:
case FC_STATE_ONLINE: {
instance);
goto fail;
FC_SUCCESS) {
return (res);
fail:
if (soft_state_linked) {
if (event_bind) {
sizeof (fcp_ndi_event_defs));
if (hba_attached) {
if (soft_state_linked) {
if (--fcp_watchdog_init == 0) {
if (mutex_initted) {
return (DDI_FAILURE);
int count = 0;
return (FC_SUCCESS);
return (FC_FAILURE);
return (FC_FAILURE);
if (--fcp_watchdog_init == 0) {
return (FC_SUCCESS);
sizeof (fcp_ndi_event_defs));
#ifdef KSTATS_CODE
* Return Value: 0 Allocation/Initialization was successful.
int kmflags)
sizeof (struct fcp_pkt));
int rval;
int cmd_len;
int resp_len;
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
cp++;
&pkt_cookie);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
return (FC_FAILURE);
cp++;
&pkt_cookie);
return (FC_SUCCESS);
FCP_BUF_LEVEL_8, 0,
FCP_BUF_LEVEL_8, 0,
nbytes);
return (DDI_NOT_WELL_FORMED);
FCP_BUF_LEVEL_8, 0,
return (DDI_NOT_WELL_FORMED);
FCP_BUF_LEVEL_8, 0,
return (DDI_FAILURE);
FC_WWN_SIZE) == 0);
return (DDI_SUCCESS);
return (DDI_NOT_WELL_FORMED);
if (bytes) {
return (DDI_NOT_WELL_FORMED);
return (DDI_NOT_WELL_FORMED);
return (DDI_FAILURE);
FC_WWN_SIZE) == 0);
return (DDI_SUCCESS);
int rval;
return (rval);
int rval;
return (TRAN_FATAL_ERROR);
return (TRAN_BUSY);
return (TRAN_BUSY);
#ifdef DEBUG
return (TRAN_ACCEPT);
#ifdef DEBUG
return (TRAN_ACCEPT);
#ifdef DEBUG
pkt);
return (rval);
int tgt_cnt;
if (ptgt) {
return (TRUE);
return (FALSE);
int rval = 0;
return (rval);
int kf;
!= FC_SUCCESS) {
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_FAILURE);
struct fcp_reset_elem *p;
int bval;
return (rval);
return (rval);
return (rval);
return (rval);
sizeof (struct fcp_rsp));
FC_SUCCESS) {
sizeof (struct fcp_rsp_info));
error = 0;
switch (error) {
return (rval);
return (rval);
int cidx;
if (cap == (char *)0) {
return (rval);
return (UNDEFINED);
if (doset) {
switch (cidx) {
case SCSI_CAP_ARQ:
if (val == 0) {
case SCSI_CAP_LUN_RESET:
if (val) {
case SCSI_CAP_SECTOR_SIZE:
switch (cidx) {
case SCSI_CAP_DMA_MAX:
case SCSI_CAP_INITIATOR_ID:
case SCSI_CAP_ARQ:
case SCSI_CAP_TAGGED_QING:
case SCSI_CAP_SCSI_VERSION:
case SCSI_CAP_LUN_RESET:
return (rval);
int *lun;
int numChars;
char **conf_wwn;
if (nlun == 0) {
for (i = 0; i < FC_WWN_SIZE; i++) {
int numChars;
return (FC_FAILURE);
return (FC_SUCCESS);
instance);
return (res);
switch (cmd) {
case FC_CMD_RESUME:
case FC_CMD_POWER_UP:
return (DDI_SUCCESS);
if (fcp_watchdog_init++ == 0) {
case FC_STATE_OFFLINE:
case FC_STATE_ONLINE:
if (!alloc_cnt) {
instance);
FC_SUCCESS) {
res);
return (res);
int result;
static child_info_t *
int tcount)
int circular;
return (rval);
while (dip) {
return (rval);
return (rval);
static dev_info_t *
int failure = 0;
int ncompatible;
char *scsi_binding_set;
if (scsi_binding_set) {
#ifdef DEBUG
*compatible);
failure++;
goto end_of_fcp_create_dip;
#ifdef DEBUG
cdip);
failure++;
goto end_of_fcp_create_dip;
failure++;
goto end_of_fcp_create_dip;
failure++;
goto end_of_fcp_create_dip;
failure++;
goto end_of_fcp_create_dip;
!= DDI_PROP_SUCCESS) {
failure++;
goto end_of_fcp_create_dip;
failure++;
goto end_of_fcp_create_dip;
failure++;
goto end_of_fcp_create_dip;
failure++;
goto end_of_fcp_create_dip;
return (cdip);
static mdi_pathinfo_t *
int failure = 0;
int ncompatible;
char *scsi_binding_set;
#ifdef DEBUG
*compatible);
failure++;
goto end_of_fcp_create_pip;
NDI_DEVI_REMOVE, 0);
old_pip);
for (i = 0; i < FC_WWN_SIZE; i++) {
failure++;
goto end_of_fcp_create_pip;
!= DDI_PROP_SUCCESS) {
failure++;
goto end_of_fcp_create_pip;
!= DDI_PROP_SUCCESS) {
failure++;
goto end_of_fcp_create_pip;
!= DDI_PROP_SUCCESS) {
failure++;
goto end_of_fcp_create_pip;
!= DDI_PROP_SUCCESS) {
failure++;
goto end_of_fcp_create_pip;
!= DDI_PROP_SUCCESS) {
failure++;
goto end_of_fcp_create_pip;
!= DDI_PROP_SUCCESS) {
failure++;
goto end_of_fcp_create_pip;
return (pip);
static dev_info_t *
int *words;
int circular;
tgt_id =
return (cdip);
return (rval);
return (rval);
static mdi_pathinfo_t *
return (pip);
int rval;
return (NDI_FAILURE);
goto again;
if (cdip) {
if (cdip) {
(void) ndi_event_retrieve_cookie(
return (rval);
int rval;
return (NDI_FAILURE);
if (cdip) {
return (rval);
goto end_of_watchdog;
goto end_of_loop;
if (pcmd) {
NULL;
int rval;
case LA_ELS_PLOGI:
FC_SUCCESS) {
case LA_ELS_PRLI:
FC_SUCCESS) {
FC_SUCCESS) {
if (fcp_watchdog_init > 0) {
int level;
if (ptgt) {
if (prev) {
int rval;
int restart = 0;
msg);
!= NULL);
= cmd;
== NULL);
= cmd;
struct fcp_port *
return (hptr);
static struct fcp_lun *
int hash;
return (plun);
return (NULL);
return (NULL);
#ifndef __lock_lint
int rval;
#ifdef DEBUG
#ifdef DEBUG
switch (rval) {
case FC_SUCCESS:
case FC_TRAN_BUSY:
case FC_BADPACKET:
return (rval);
static struct fcp_port *
int instance;
struct fcp_lun *
for (i = 0; i < FCP_NUM_HASH; i++) {
int rval;
return (NDI_FAILURE);
return (rval);
static struct fcp_hp_elem *
== NULL) {
return (NULL);
return (elem);
int rval;
while (count--) {
int rval;
return (rval);
int finish_init = 0;
int finish_tgt = 0;
int do_finish_init = 0;
FCP_BUF_LEVEL_2, 0,
if (do_finish_init) {
FCP_BUF_LEVEL_2, 0,
if (do_finish_init) {
if (finish_tgt) {
#ifdef DEBUG
return (rval);
for (i = 0; i < FCP_NUM_HASH; i++) {
int wait_ms;
int tcount;
int lcount;
int ret;
int error;
int ntries;
int old_manual = 0;
return (rval);
return (rval);
return (ENOMEM);
FCP_BUF_LEVEL_3, 0,
return (rval);
FCP_BUF_LEVEL_3, 0,
rval = 0;
FCP_BUF_LEVEL_3, 0,
if (rval) {
FCP_BUF_LEVEL_3, 0,
return (rval);
while (plun) {
FCP_BUF_LEVEL_3, 0,
if (rval == 0) {
return (rval);
int count;
count = 0;
while (*string) {
for (i = 0; i < FC_WWN_SIZE; i++) {
int scsi_cmd = 0;
case SCMD_REPORT_LUN:
scsi_cmd++;
case SCMD_INQUIRY_PAGE83:
scsi_cmd++;
case SCMD_INQUIRY:
scsi_cmd++;
case LA_ELS_PLOGI:
case LA_ELS_PRLI:
sizeof (struct fcp_rsp));
sizeof (struct fcp_rsp));
sizeof (struct fcp_rsp_info));
sizeof (struct fcp_rsp) +
sizeof (struct fcp_rsp) +
sizeof (struct scsi_extended_sense));
if (scsi_cmd) {
char *error;
switch (rval) {
case FC_DEVICE_BUSY_NEW_RSCN:
* forth, see fp.c
FCP_BUF_LEVEL_3, 0,
case FC_STATEC_BUSY:
case FC_DEVICE_BUSY:
case FC_PBUSY:
case FC_FBUSY:
case FC_TRAN_BUSY:
case FC_OFFLINE:
FCP_BUF_LEVEL_3, 0,
case FC_LOGINREQ:
FCP_BUF_LEVEL_3, 0,
return (ret);
return (FC_SUCCESS);
return (FC_FAILURE);
static fc_portmap_t *
++*dev_cnt;
return (devptr);
for (i = 0; i < FCP_NUM_HASH; i++) {
int ret;
devlist);
devlist++;
devlist++;
return (devptr);
for (i = 0; i < FCP_NUM_HASH; i++) {
FCP_BUF_LEVEL_2, 0,
plun);
return (NDI_FAILURE);
return (NDI_SUCCESS);
return (NULL);
return (NULL);
return (NULL);
return (NULL);
return (path);
if (reset_delay < 0) {
reset_delay = 0;
if (fcp_bus_config_debug) {
switch (op) {
case BUS_CONFIG_ONE:
if (rval == 0) {
return (rval);
case BUS_CONFIG_DRIVER:
case BUS_CONFIG_ALL: {
return (NDI_FAILURE);
if (fcp_bus_config_debug) {
int retval = 0;
return (retval);
* Wait for a rediscovery/reconfiguration to complete before continuing.
* Read masking info from fp.conf and construct the global fcp_lun_blacklist.
int idx = 0;
int len = 0;
curr_pwwn++;
int idx = 0;
unsigned long lun_id = 0;
int illegal_digit = 0;
idx++;
if (illegal_digit > 0) {
idx = 0;
illegal_digit = 0;
offset++;
idx = 0;
while (tmp_entry) {
return (TRUE);
return (FALSE);
while (tmp_entry) {