2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A/* Structure for walking the tree */ 2N/A/* The TYPE field is parseable and should not contain spaces */ 2N/A/* Indicates no plag passing */ 2N/A/* defines for retry algorithm */ 2N/A/* define for fcp scsi passthru wait */ 2N/A/* define for fcp pseudo node */ 2N/A/* Function prototypes */ 2N/A * This has to be the LAST entry for DTYPE_UNKNOWN_INDEX. 2N/A * Add entries before this. 2N/A * Main routine for list operation. 2N/A * It calls various routines to consturct ldata list and 2N/A * postprocess the list data. 2N/A * Overall algorithm: 2N/A * Get the device list on input hba port and construct ldata list for 2N/A * accesible devices. 2N/A * Stat hba port and devices through walking the device tree. 2N/A * Verify the validity of the list data. 2N/A /* Create the hba logid (also base component of logical ap_id) */ 2N/A * If stating a specific device, we will do limited stat on fca port. 2N/A * otherwise full stat on fca part is required. 2N/A * If stating a specific device we don't know if it exists or is 2N/A * configured yet. larg.ret is set to apid noexist for do_stat_dev. 2N/A * otherwise larg.ret is set to ok initially. 2N/A /* For all list commands, the fca port needs to be stat'ed */ 2N/A * If stat'ing a FCA port or ALL, we have the bus stat data at 2N/A * Assume that the bus has no configured children. 2N/A /* la_wwn_t has uchar_t raw_wwn[8] thus no need to free. */ 2N/A * if the dyncomp exists on disco ports construct list_data 2N/A * otherwise return FPCFGA_APID_NOEXIST. 2N/A /* get Port Attributes again after refresh. */ 2N/A break;
/* either okay or some other error */ 2N/A * if dyncomp found in disco ports 2N/A * construct ldata_list and return. 2N/A * otherwise continue to stat on dev tree with 2N/A * larg.ret set to access_ok which informs stat_fc_dev 2N/A * the existence of device on disco ports. 2N/A * if path is null that guatantees the node is not 2N/A * configured. if node is detached the path 2N/A * is incomplete and not usable for further 2N/A * operations like uscsi_inq so take care of it here. 2N/A * path indicates if the node exists in dev tree. 2N/A * if not found in dev tree return apid no exist. 2N/A * otherwise continue to stat with larg.ret set to 2N/A }
else {
/* any error */ 2N/A * path indicates if the node exists in dev tree. 2N/A * if not found in dev tree return lib error. 2N/A * otherwise continue to stat with larg.ret set to 2N/A * for each dev in disco ports, create a ldata_list element. 2N/A * if if no disco ports found, continue to stat on devinfo tree 2N/A * to see if any node exist on the fca port. 2N/A /* Move on to the next target */ 2N/A /* we need to stat at least 1 device for all commands */ 2N/A * Subtree is ALWAYS rooted at the HBA (not at the device) as 2N/A * otherwise deadlock may occur if bus is disconnected. 2N/A * DINFOPROP was sufficient on apidp->xport_phys prior to the support 2N/A * on scsi_vhci child node. In order to get the link between 2N/A * scsi_vhci node and path info node the snap shot of the 2N/A * the whole device tree is required with DINFOCPYALL | DINFOPATH flag. 2N/A * ret from walk_tree is either FPCFGA_OK or FPCFGA_ERR. 2N/A * larg.ret is used to detect other errors. Make sure larg.ret 2N/A * is set to a correct error. 2N/A /* if larg.ret = FPCFGA_APID_NOEXIST; */ 2N/A * Main routine for list operation when show_FCP_dev option is given. 2N/A * It calls various routines to consturct ldata list and 2N/A * postprocess the list data. 2N/A * The difference between do_list() and do_list_FCP_dev() is to 2N/A * process FCP SCSI LUN data list via uscsi report lun operation and 2N/A * stat lun level instead of port WWN based target level. 2N/A * The rest of logic is same. 2N/A * Overall algorithm: 2N/A * Get the device list on input hba port and construct ldata list for 2N/A * accesible devices. 2N/A * For each configured device, USCSI report lun is issued and ldata list 2N/A * with FCP device level(LUN) information is created. 2N/A * Stat hba port and LUN devices through walking the device tree. 2N/A * Verify the validity of the list data. 2N/A /* Extract the base(hba) and dynamic(device) component if any */ 2N/A /* Remove the dynamic component from the base. */ 2N/A /* if lun dyncomp exists delete it */ 2N/A /* Create the hba logid (also base component of logical ap_id) */ 2N/A * If stating a specific device, we will do limited stat on fca port. 2N/A * otherwise full stat on fca part is required. 2N/A * If stating a specific device we don't know if it exists or is 2N/A * configured yet. larg.ret is set to apid noexist for do_stat_dev. 2N/A * otherwise larg.ret is set to ok initially. 2N/A /* For all list commands, the fca port needs to be stat'ed */ 2N/A * If stat'ing a FCA port or ALL, we have the bus stat data at 2N/A * Assume that the bus has no configured children. 2N/A /* la_wwn_t has uchar_t raw_wwn[8] thus no need to free. */ 2N/A * if the dyncomp exists on disco ports construct list_data 2N/A * otherwise return FPCFGA_APID_NOEXIST. 2N/A /* get Port Attributes again after refresh. */ 2N/A break;
/* either okay or some other error */ 2N/A * if dyncomp exists only in dev list 2N/A * construct ldata_list and return. 2N/A * otherwise continue to stat on dev tree with 2N/A * larg.ret set to access_ok which informs stat_fc_dev 2N/A * the existence of device on dev_list. 2N/A * if path is null that guatantees the node is not 2N/A * configured. if node is detached the path 2N/A * is incomplete and not usable for further 2N/A * operations like uscsi_inq so take care of it here. 2N/A /* continue to stat dev with access okay. */ 2N/A * path indicates if the node exists in dev tree. 2N/A * if not found in dev tree return apid no exist. 2N/A * otherwise continue to stat with larg.ret set to 2N/A }
else {
/* not found or any error */ 2N/A * continue to stat dev with larg.ret set to 2N/A * for each dev in disco ports, create a ldata_list element. 2N/A * if if no disco ports found, continue to stat on devinfo tree 2N/A * to see if any node exist on the fca port. 2N/A /* Move on to the next target */ 2N/A /* default: continue */ 2N/A /* we need to stat at least 1 device for all commands */ 2N/A * Subtree is ALWAYS rooted at the HBA (not at the device) as 2N/A * otherwise deadlock may occur if bus is disconnected. 2N/A * DINFOPROP was sufficient on apidp->xport_phys prior to the support 2N/A * on scsi_vhci child node. In order to get the link between 2N/A * scsi_vhci node and path info node the snap shot of the 2N/A * the whole device tree is required with DINFOCPYALL | DINFOPATH flag. 2N/A * ret from walk_tree is either FPCFGA_OK or FPCFGA_ERR. 2N/A * larg.ret is used to detect other errors. Make sure larg.ret 2N/A * is set to a correct error. 2N/A /* if larg.ret = FPCFGA_APID_NOEXIST return. */ 2N/A * This routine returns initialize struct fcp_ioctl. 2N/A * This routine returns issues FCP_TGT_SEND_SCSI 2N/A * This routine returns standard inq data for 2N/A * a target represented by dyncomp. 2N/A * Calls FCP passthru ioctl FCP_TGT_SEND_SCSI to get inquiry data. 2N/A * Caller should free the *inq_buf. 2N/A * This routine returns report lun data and number of luns found 2N/A * on a target represented by dyncomp. 2N/A * Calls FCP passthru ioctl FCP_TGT_SEND_SCSI to get report lun data. 2N/A * Caller should free the *resp_buf when FPCFGA_OK is returned. 2N/A /* sending to LUN 0 so initializing lun_data buffer to be 0 */ 2N/A /* num_lun represent number of luns * 8. */ 2N/A * Routine for consturct ldata list for each FCP SCSI LUN device 2N/A * for a discovered target device. 2N/A * It calls get_report_lun_data to get report lun data and 2N/A * construct ldata list per each lun. 2N/A * It is called only when show_FCP_dev option is given. 2N/A * Overall algorithm: 2N/A * Get the report lun data thru FCP passthru ioctl. 2N/A * Call init_ldata_for_accessible_FCP_dev to process the report LUN data. 2N/A * For each LUN found standard inquiry is issued to get device type. 2N/A * when report lun data fails then return FPCFGA_OK thus 2N/A * keep the ldata for the target which is acquired previously. 2N/A * For remote hba node this will be normal. 2N/A * For a target error may already be detected through 2N/A * proceed with to stat if no lun found. 2N/A * This will make the target apid will be kept. 2N/A * Routine for checking validity of ldata list based on input argumemnt. 2N/A * Set the occupant state of hba port if the list is valid. 2N/A /* A bus stat data */ 2N/A /* Fill in the occupant (child) state. */ 2N/A * Routine for checking each target device found in device tree. 2N/A * When the matching port WWN dev is found from the accessble ldata list 2N/A * the target device is updated with configured ostate. 2N/A * Overall algorithm: 2N/A * Parse the device tree to find configured devices which matches with 2N/A * list argument. If cmd is stat on a specific target device it 2N/A * matches port WWN and continues to further processing. If cmd is 2N/A * stat on hba port all the device target under the hba are processed. 2N/A * Skip partial nodes 2N/A * This checking is from the scsi plug-in and will be deleted for 2N/A * fp plug-in. The node will be processed for fp even if it is 2N/A * in driver detached state. From fp perspective the node is configured 2N/A * as long as the node is not in offline or down state. 2N/A * scsi plug-in considers the known state when it is offlined 2N/A * regradless of driver detached state or when it is not in driver 2N/A * detached state like normal state. 2N/A * If the node is only in driver detached state it is considered as 2N/A * if (!known_state(node) && (lap->cmd != FPCFGA_STAT_FC_DEV)) { 2N/A * return (DI_WALK_CONTINUE); 2N/A /* Skip node if it is HBA */ 2N/A /* If stat'ing a specific device, is this node that device */ 2N/A /* checks port wwn property to find a match */ 2N/A * port wwn doesn't match contine to walk 2N/A * if match call do_stat_fc_dev. 2N/A * If stat'ing a xport only, we look at device nodes only to get 2N/A * xport configuration status. So a limited stat will suffice. 2N/A * Ignore errors if stat'ing a bus or listing all 2N/A * If stat'ing a specific device, we are done at this point. 2N/A * Routine for checking each FCP SCSI LUN device found in device tree. 2N/A * When the matching port WWN and LUN are found from the accessble ldata list 2N/A * the FCP SCSI LUN is updated with configured ostate. 2N/A * Overall algorithm: 2N/A * Parse the device tree to find configured devices which matches with 2N/A * list argument. If cmd is stat on a specific target device it 2N/A * matches port WWN and continues to further processing. If cmd is 2N/A * stat on hba port all the FCP SCSI LUN under the hba are processed. 2N/A /* Skip node if it is HBA */ 2N/A /* If stat'ing a specific device, is this node that device */ 2N/A /* checks port wwn property to find a match */ 2N/A * port wwn doesn't match contine to walk 2N/A * if match call do_stat_FCP_dev. 2N/A * If stat'ing a xport only, we look at device nodes only to get 2N/A * xport configuration status. So a limited stat will suffice. 2N/A * Ignore errors if stat'ing a bus or listing all 2N/A /* Get xport state */ 2N/A * Get topology works okay even if the fp port is connected 2N/A * to a switch and no devices connected to the switch. 2N/A * In this case the list will only shows fp port info without 2N/A * any device listed. 2N/A * HBA_PORTTYPE_UNKNOWN means nothing is connected 2N/A /* NOT_PRESENT, OTHER, FPORT, FLPORT */ 2N/A /* We only want to know bus(receptacle) connect status */ 2N/A /* Link it in. lap->listp is NULL originally. */ 2N/A /* lap->listp now gets cfga_list_data for the fca port. */ 2N/A * Routine for updating ldata list based on the state of device node. 2N/A * When no matching accessible ldata is found a new ldata is created 2N/A * with proper state information. 2N/A * Overall algorithm: 2N/A * If the device node is online and the matching ldata is found 2N/A * the target device is updated with configued and unknown condition. 2N/A * If the device node is offline or down and the matching ldata is found 2N/A * the target device is updated with configued and unusable condition. 2N/A * If the device node is online but the matching ldata is not found 2N/A * the target device is created with configued and failing condition. 2N/A * If the device node is offline or down and the matching ldata is not found 2N/A * the target device is created with configued and unusable condition. 2N/A * NOTE: The framework cannot currently detect layered driver 2N/A * opens, so the busy indicator is not very reliable. Also, 2N/A * non-root users will not be able to determine busy 2N/A * status (libdevice needs root permissions). 2N/A * This should probably be fixed by adding a DI_BUSY to the di_state() 2N/A * routine in libdevinfo. 2N/A /* We only want to know device config state */ 2N/A * If child device is configured, see if it is accessible also 2N/A * for FPCFGA_STAT_FC_DEV cmd. 2N/A * if configured and not accessble, the device is 2N/A * till be displayed with failing condition. 2N/A * return code should be FPCFGA_OK to display it. 2N/A * If not unconfigured and not attached 2N/A * the state is set to CFGA_STAT_NONE currently. 2N/A * This is okay for the detached node due to 2N/A * the driver being unloaded. 2N/A * May need to define another state to 2N/A * isolate the detached only state. 2N/A * handle the same way as configured. 2N/A * if unconfigured - offline or down, 2N/A * set to cond to unusable regardless of accessibility. 2N/A * This behavior needs to be examined further. 2N/A * When the device is not accessible the node 2N/A * may get offline or down. In that case failing 2N/A * cond may make more sense. 2N/A * In anycase the ostate will be set to configured 2N/A * For fabric port the fca port is considered as 2N/A * configured since user configured previously 2N/A * for any existing node. Otherwise when the 2N/A * device was accessible, the hba is considered as 2N/A /* if device found in disco ports, ldata already created. */ 2N/A * if cond is not changed then don't update 2N/A * condition to keep the previous condition. 2N/A * if cmd is stat all check ldata list 2N/A * to see if the node exist on the dev list. Otherwise create 2N/A /* node exists so set ostate to configured. */ 2N/A * If not unconfigured and not attached 2N/A * the state is set to CFGA_STAT_NONE currently. 2N/A * This is okay for the detached node due to 2N/A * the driver being unloaded. 2N/A * May need to define another state to 2N/A * isolate the detached only state. 2N/A /* update ap_type and ap_info */ 2N/A * node is offline or down. 2N/A * set cond to unusable. 2N/A * if cond is not unknown 2N/A * we already set the cond from 2N/A * a different node with the same 2N/A * port WWN or initial probing 2N/A * was failed so don't update again. 2N/A /* node found in ldata list so just return. */ 2N/A /* node is attached but not in dev list */ 2N/A * node is offline or down. 2N/A * set cond to unusable. 2N/A * For fabric port the fca port is 2N/A * considered as configured since user 2N/A * configured previously for any 2N/A * continue to create ldata_list struct for 2N/A * dev_list is null so there is no accessible dev. 2N/A * set the cond and continue to create ldata. 2N/A * node is offline or down. 2N/A * set cond to unusable. 2N/A * For fabric port the fca port is 2N/A * considered as configured since user 2N/A * configured previously for any 2N/A /* Create the dynamic component. */ 2N/A /* Create logical and physical ap_id */ 2N/A /* set to ostate to configured and set cond with info. */ 2N/A /* get ap_type and ap_info. */ 2N/A * Wrapper routine for handling path info. 2N/A * When show_FCP_dev option is given stat_path_info_FCP_dev() is called. 2N/A * Otherwise stat_path_info_fc_dev() is called. 2N/A * Routine for updating ldata list based on the state of path info node. 2N/A * When no matching accessible ldata is found a new ldata is created 2N/A * with proper state information. 2N/A * Overall algorithm: 2N/A * If the path info node is not offline and the matching ldata is found 2N/A * the target device is updated with configued and unknown condition. 2N/A * If the path info node is offline or failed and the matching ldata is found 2N/A * the target device is updated with configued and unusable condition. 2N/A * If the path info node is online but the matching ldata is not found 2N/A * the target device is created with configued and failing condition. 2N/A * If the path info is offline or failed and the matching ldata is not found 2N/A * the target device is created with configued and unusable condition. 2N/A * if stat on a specific dev and walk_node found it okay 2N/A * then just return ok. 2N/A * if stat on a fca xport and chld_config is set 2N/A * then just return ok. 2N/A * when there is no path_info node return FPCFGA_OK. 2N/A * That way the result from walk_node shall be maintained. 2N/A * if the dev was in dev list but not found 2N/A * return OK to indicate is not configured. 2N/A /* if stat on fca port return. */ 2N/A * now parse the path info node. 2N/A /* if no match contine to the next path info node. */ 2N/A /* if device in dev_list, ldata already created. */ 2N/A /* check if there is list data. */ 2N/A * Update the condition as unusable 2N/A * if the pathinfo state is failed 2N/A * now create ldata for this particular path info node. 2N/A * if port top is private loop and pathinfo is in 2N/A * in offline state don't include to ldata list. 2N/A * Routine for updating ldata list based on the state of path info node. 2N/A * When no matching accessible ldata is found a new ldata is created 2N/A * with proper state information. 2N/A * The difference from stat_path_info_fc_dev() is 2N/A * to handle FCP SCSI LUN information. Otherwise overall algorithm is 2N/A * Overall algorithm: 2N/A * If the path info node is not offline and the matching ldata is found 2N/A * the target device is updated with configued and unknown condition. 2N/A * If the path info node is offline or failed and the matching ldata is found 2N/A * the target device is updated with configued and unusable condition. 2N/A * If the path info node is online but the matching ldata is not found 2N/A * the target device is created with configued and failing condition. 2N/A * If the path info is offline or failed and the matching ldata is not found 2N/A * the target device is created with configued and unusable condition. 2N/A * if stat on a fca xport and chld_config is set 2N/A * then just return ok. 2N/A * when there is no path_info node return FPCFGA_OK. 2N/A * That way the result from walk_node shall be maintained. 2N/A * if the dev was in dev list but not found 2N/A * If stat on fca port and port topology is fabric return here. 2N/A * If not fabric return only when path state is not offfline. 2N/A * The other cases are handbled below. 2N/A * now parse the path info node. 2N/A * Update the condition as unusable 2N/A * if the pathinfo state is failed 2N/A * now create ldata for this particular path info node. 2N/A * if port top is private loop and pathinfo is in 2N/A * in offline state don't include to ldata list. 2N/A /* create ldata for this pi node. */ 2N/A /* Create logical and physical ap_id */ 2N/A * We reached here since FCP dev is not found 2N/A * in ldata list but path info node exists. 2N/A * Update the condition as failing 2N/A * if the pathinfo state was normal. 2N/A * Update the condition as unusable 2N/A * if the pathinfo state is failed 2N/A /* update ap_type and ap_info */ 2N/A * Update the condition as unusable 2N/A * if the pathinfo state is failed 2N/A * now create ldata for this particular path info node. 2N/A * if port top is private loop and pathinfo is in 2N/A * in offline state don't include to ldata list. 2N/A /* create ldata for this pi node. */ 2N/A /* Create logical and physical ap_id */ 2N/A * We reached here since FCP dev is not found 2N/A * in ldata list but path info node exists. 2N/A * Update the condition as failing 2N/A * if the pathinfo state was normal. 2N/A * Update the condition as unusable 2N/A * if the pathinfo state is failed 2N/A /* update ap_type and ap_info */ 2N/A * Routine for updating ldata list based on the state of device node. 2N/A * When no matching accessible ldata is found a new ldata is created 2N/A * with proper state information. 2N/A * The difference from do_stat_fc_dev() is 2N/A * to handle FCP SCSI LUN information. Otherwise overall algorithm is 2N/A * Overall algorithm: 2N/A * If the device node is online and the matching ldata is found 2N/A * the target device is updated with configued and unknown condition. 2N/A * If the device node is offline or down and the matching ldata is found 2N/A * the target device is updated with configued and unusable condition. 2N/A * If the device node is online but the matching ldata is not found 2N/A * the target device is created with configued and failing condition. 2N/A * If the device node is offline or down and the matching ldata is not found 2N/A * the target device is created with configued and unusable condition. 2N/A * NOTE: The devctl framework cannot currently detect layered driver 2N/A * opens, so the busy indicator is not very reliable. Also, 2N/A * non-root users will not be able to determine busy 2N/A * status (libdevice needs root permissions). 2N/A * This should probably be fixed by adding a DI_BUSY to the di_state() 2N/A * routine in libdevinfo. 2N/A /* We only want to know device config state */ 2N/A * If child device is configured, see if it is accessible also 2N/A * for FPCFGA_STAT_FC_DEV cmd. 2N/A * if configured and not accessble, the device is 2N/A * till be displayed with failing condition. 2N/A * return code should be FPCFGA_OK to display it. 2N/A * If not unconfigured and not attached 2N/A * the state is set to CFGA_STAT_NONE currently. 2N/A * This is okay for the detached node due to 2N/A * the driver being unloaded. 2N/A * May need to define another state to 2N/A * isolate the detached only state. 2N/A * handle the same way as configured. 2N/A * if unconfigured - offline or down, 2N/A * set to cond to unusable regardless of accessibility. 2N/A * This behavior needs to be examined further. 2N/A * When the device is not accessible the node 2N/A * may get offline or down. In that case failing 2N/A * cond may make more sense. 2N/A * In anycase the ostate will be set to configured 2N/A * For fabric port the fca port is considered as 2N/A * configured since user configured previously 2N/A * for any existing node. Otherwise when the 2N/A * device was accessible, the hba is considered as 2N/A * if lap->ret is okay there is at least 2N/A * one matching ldata exist. Need to keep 2N/A * okay ret to display the matching ones. 2N/A /* if device found in dev_list, ldata already created. */ 2N/A * if cond is not changed then don't update 2N/A * condition to keep any condtion 2N/A * from initial discovery. If the initial 2N/A * cond was failed the same condition will be kept. 2N/A /* update ap_info via inquiry */ 2N/A /* update ap_type and ap_info */ 2N/A * if cmd is stat all check ldata list 2N/A * to see if the node exist on the dev list. Otherwise create 2N/A /* node exists so set ostate to configured. */ 2N/A * If not unconfigured and not attached 2N/A * the state is set to CFGA_STAT_NONE currently. 2N/A * This is okay for the detached node due to 2N/A * the driver being unloaded. 2N/A * May need to define another state to 2N/A * isolate the detached only state. 2N/A /* update ap_type and ap_info */ 2N/A * node is offline or down. 2N/A * set cond to unusable. 2N/A * if cond is not unknown 2N/A * initial probing was failed 2N/A * so don't update again. 2N/A /* node found in ldata list so just return. */ 2N/A /* node is attached but not in dev list */ 2N/A * node is offline or down. 2N/A * set cond to unusable. 2N/A * For fabric port the fca port is 2N/A * considered as configured since user 2N/A * configured previously for any 2N/A * continue to create ldata_list struct for 2N/A /* Create logical and physical ap_id */ 2N/A * Searches the ldata_list to find if the the input port_wwn exist. 2N/A * Input: port_wwn, ldata_list. 2N/A * Return value: FPCFGA_APID_NOACCESS if not found on ldata_list. 2N/A * FPCFGA_ACCESS_OK if found on ldata_list. 2N/A * Searches the ldata_list to find if the the input port_wwn and lun exist. 2N/A * Input: port_wwn, ldata_list. 2N/A * Return value: FPCFGA_APID_NOACCESS if not found on ldata_list. 2N/A * FPCFGA_ACCESS_OK if found on ldata_list. 2N/A * if there is no list data just return the FCP dev list. 2N/A * Normally this should not occur since list data should 2N/A * be created through discoveredPort list. 2N/A /* we have match without lun comp. */ 2N/A /* we have match without lun comp. */ 2N/A * This routine is called when a pathinfo without matching pwwn in dev_list 2N/A /* get the client node path */ 2N/A /* now need to create ldata for this dev */ 2N/A /* Create logical and physical ap_id */ 2N/A /* Filled in by libcfgadm */ 2N/A /* set to ostate to configured. */ 2N/A * This routine is called when a port WWN is not found in dev list 2N/A * but path info node exists. 2N/A * Update the condition as failing if the pathinfo state was normal. 2N/A * Update the condition as unusable if the pathinfo state is failed 2N/A /* update ap_type and ap_info */ 2N/A /* now return with ok status with ldata. */ 2N/A * Initialize the cfga_list_data struct for an accessible device 2N/A * from g_get_dev_list(). 2N/A * Input: fca port ldata. 2N/A * Output: device cfga_list_data. 2N/A /* Create logical and physical ap_id */ 2N/A * Initialize the cfga_list_data struct for an accessible FCP SCSI LUN device 2N/A * from the report lun data. 2N/A * Input: fca port ldata. report lun info 2N/A * Output: device cfga_list_data. 2N/A /* when number of lun is 0 it is not an error. so just return ok. */ 2N/A * peripheral qualifier is not 0 so the device node should not 2N/A * included in the ldata list. There should not be a device 2N/A * node for the lun either. 2N/A * Followed FCP driver for getting lun number from report 2N/A * According to SAM-2 there are multiple address method for 2N/A * FCP SCIS LUN. Logincal unit addressing, peripheral device 2N/A * addressing, flat space addressing, and extended logical 2N/A * as of 11/2001 FCP supports logical unit addressing and 2N/A * peripheral device addressing even thoough 3 defined. 2N/A * SSFCP_LUN_ADDRESSING 0x80 2N/A * SSFCP_PD_ADDRESSING 0x00 2N/A * SSFCP_VOLUME_ADDRESSING 0x40 2N/A * the menthod below is used by FCP when (lun_string[0] & 0xC0) 2N/A * is either SSFCP_LUN_ADDRESSING or SSFCP_PD_ADDRESSING mode. 2N/A /* Create logical and physical ap_id */ 2N/A * list data can be null when device peripheral qualifier is not 0 2N/A * for any luns. Return ok to continue. 2N/A * get the end of list for later uses. 2N/A * if there is no list data just return the FCP dev list. 2N/A * Normally this should not occur since list data should 2N/A * be created through g_get_dev_list(). 2N/A /* fillup inqdtype */ 2N/A /* link the new elem of lap->listp. */ 2N/A /* free the one matching wwn. */ 2N/A /* link lap->listp to listp_start. */ 2N/A /* link the next elem to listp_end. */ 2N/A /* link prevlp to listp_start to drop curlp. */ 2N/A /* free matching pwwn elem. */ 2N/A * Dev not found from accessible 2N/A * fc dev list but the node should 2N/A * exist. Set to failing cond now 2N/A * and check the node state later. 2N/A /* keep the cur elem by linking to list_end. */ 2N/A/* fill in device type, vid, pid from properties */ 2N/A * if the type is not previously assigned with valid SCSI device type 2N/A * check devinfo to find the type. 2N/A * once device is configured it should have a valid device type. 2N/A * device node is configured but no valid device type is found 2N/A * the type will be set to unavailable. 2N/A * if the type is not one of defined SCSI device type 2N/A * check devinfo to find the type. 2N/A * Note: unknown type is not a valid device type. 2N/A * It is added in to the device list table to provide 2N/A * constant string of "unknown". 2N/A * Fill in vendor and product ID. 2N/A * Get dtype from "inquiry-device-type" property. If not present, 2N/A * derive it from minor node type 2N/A /* first, derive type based on inquiry property */ 2N/A * when found to be unknown type, set name to null to check 2N/A * device minor node type. 2N/A /* if property fails, use minor nodetype */ 2N/A/* Transform list data to stat data */ 2N/A /* Extract the list_data structures from the linked list */ 2N/A * Convert bus state to receptacle state 2N/A * NOTE: An explicit flag for active should probably be added to 2N/A * Convert device state to occupant state 2N/A * if driver is attached the node is configured. 2N/A * if offline or down the node is unconfigured. 2N/A * if only driver detached it is none state which is treated the same 2N/A * way as configured state. 2N/A /* Driver attached ? */ 2N/A * Wrapper routine for inserting ldata to make an sorted ldata list. 2N/A * When show_FCP_dev option is given insert_FCP_dev_ldata() is called. 2N/A * Otherwise insert_fc_dev_ldata() is called. 2N/A * Insert an input ldata to ldata list to make sorted ldata list. 2N/A /* add the ldata to the end of the list. */ 2N/A * Insert an input ldata to ldata list to make sorted ldata list. 2N/A /* add the ldata to the end of the list. */ 2N/A * This function will return the dtype for the given device 2N/A * It will first issue a report lun to lun 0 and then it will issue a SCSI 2N/A * Inquiry to the first lun returned by report luns. 2N/A * If everything is successful, the dtype will be returned with the peri 2N/A * qualifier masked out. 2N/A * If either the report lun or the scsi inquiry fails, we will first check 2N/A * the return status. If the return status is SCSI_DEVICE_NOT_TGT, then 2N/A * we will assume this is a remote HBA and return an UNKNOWN DTYPE 2N/A * for all other failures, we will return a dtype of ERR_INQ_DTYPE 2N/A * Checking the sense key data as well as the additional 2N/A * sense key. The SES Node is not required to repond 2N/A * to Report LUN. In the case of Minnow, the SES node 2N/A * returns with KEY_ILLEGAL_REQUEST and the additional 2N/A * sense key of 0x20. In this case we will blindly 2N/A * send the SCSI Inquiry call to lun 0 2N/A * if we get any other error we will set the inq_type 2N/A /* send the inquiry to the first lun */