Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mps/mps_sas_lsi.c
Show First 20 Lines • Show All 663 Lines • ▼ Show 20 Lines | if (ret) { | ||||
"(SSD or HDD) for SATA device with handle 0x%04x\n", | "(SSD or HDD) for SATA device with handle 0x%04x\n", | ||||
__func__, handle); | __func__, handle); | ||||
} else { | } else { | ||||
mps_dprint(sc, MPS_INFO, "SAS Address from SATA " | mps_dprint(sc, MPS_INFO, "SAS Address from SATA " | ||||
"device = %jx\n", sas_address); | "device = %jx\n", sas_address); | ||||
} | } | ||||
} | } | ||||
/* | |||||
* use_phynum: | |||||
* 1 - use the PhyNum field as a fallback to the mapping logic | |||||
* 0 - never use the PhyNum field | |||||
* -1 - only use the PhyNum field | |||||
*/ | |||||
id = MPS_MAP_BAD_ID; | |||||
if (sc->use_phynum != -1) | |||||
id = mps_mapping_get_sas_id(sc, sas_address, handle); | id = mps_mapping_get_sas_id(sc, sas_address, handle); | ||||
if (id == MPS_MAP_BAD_ID) { | if (id == MPS_MAP_BAD_ID) { | ||||
printf("failure at %s:%d/%s()! Could not get ID for device " | if ((sc->use_phynum == 0) | ||||
"with handle 0x%04x\n", __FILE__, __LINE__, __func__, | || ((id = config_page.PhyNum) > sassc->maxtargets)) { | ||||
handle); | mps_dprint(sc, MPS_INFO, "failure at %s:%d/%s()! " | ||||
"Could not get ID for device with handle 0x%04x\n", | |||||
__FILE__, __LINE__, __func__, handle); | |||||
error = ENXIO; | error = ENXIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
} | |||||
if (mpssas_check_id(sassc, id) != 0) { | if (mpssas_check_id(sassc, id) != 0) { | ||||
device_printf(sc->mps_dev, "Excluding target id %d\n", id); | device_printf(sc->mps_dev, "Excluding target id %d\n", id); | ||||
error = ENXIO; | error = ENXIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
targ = &sassc->targets[id]; | |||||
if (targ->handle != 0x0) { | |||||
mps_dprint(sc, MPS_MAPPING, "Attempting to reuse target id " | |||||
"%d handle 0x%04x\n", id, targ->handle); | |||||
error = ENXIO; | |||||
goto out; | |||||
} | |||||
mps_dprint(sc, MPS_MAPPING, "SAS Address from SAS device page0 = %jx\n", | mps_dprint(sc, MPS_MAPPING, "SAS Address from SAS device page0 = %jx\n", | ||||
sas_address); | sas_address); | ||||
targ = &sassc->targets[id]; | |||||
targ->devinfo = device_info; | targ->devinfo = device_info; | ||||
targ->devname = le32toh(config_page.DeviceName.High); | targ->devname = le32toh(config_page.DeviceName.High); | ||||
targ->devname = (targ->devname << 32) | | targ->devname = (targ->devname << 32) | | ||||
le32toh(config_page.DeviceName.Low); | le32toh(config_page.DeviceName.Low); | ||||
targ->encl_handle = le16toh(config_page.EnclosureHandle); | targ->encl_handle = le16toh(config_page.EnclosureHandle); | ||||
targ->encl_slot = le16toh(config_page.Slot); | targ->encl_slot = le16toh(config_page.Slot); | ||||
targ->handle = handle; | targ->handle = handle; | ||||
targ->parent_handle = le16toh(config_page.ParentDevHandle); | targ->parent_handle = le16toh(config_page.ParentDevHandle); | ||||
▲ Show 20 Lines • Show All 601 Lines • Show Last 20 Lines |