Changeset View
Standalone View
sys/dev/mpr/mpr_sas_lsi.c
Show First 20 Lines • Show All 833 Lines • ▼ Show 20 Lines | if (device_info & MPI2_SAS_DEVICE_INFO_SATA_DEVICE) { | ||||
} else { | } else { | ||||
mpr_dprint(sc, MPR_MAPPING, "Handle 0x%04x SAS Address " | mpr_dprint(sc, MPR_MAPPING, "Handle 0x%04x SAS Address " | ||||
"from SATA device = %jx\n", handle, sas_address); | "from SATA device = %jx\n", handle, sas_address); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* use_phynum: | * use_phynum: | ||||
* 1 - use the PhyNum field as a fallback to the mapping logic | * 1 - use the PhyNum (and other) fields as fallback to the mapping logic | ||||
* 0 - never use the PhyNum field | * 0 - never use the PhyNum field | ||||
* -1 - only use the PhyNum field | * -1 - only use the PhyNum field | ||||
* | * | ||||
* Note that using the Phy number to map a device can cause device adds | * Note that the fallback logic is falliable, and should only be used | ||||
slm: 'fallible' | |||||
* to fail if multiple enclosures/expanders are in the topology. For | * if the mapping logic isn't working. It will fail in the following | ||||
* example, if two devices are in the same slot number in two different | * situations: | ||||
* enclosures within the topology, only one of those devices will be | * - A single enclosure has more than 128 slots | ||||
* added. PhyNum mapping should not be used if multiple enclosures are | * - More than 8 enclosures are present on one bus | ||||
* in the topology. | * - The SEP assigns the same slot number to multiple drives | ||||
*/ | */ | ||||
id = MPR_MAP_BAD_ID; | id = MPR_MAP_BAD_ID; | ||||
if (sc->use_phynum != -1) | if (sc->use_phynum != -1) | ||||
id = mpr_mapping_get_tid(sc, sas_address, handle); | id = mpr_mapping_get_tid(sc, sas_address, handle); | ||||
if (id == MPR_MAP_BAD_ID) { | if (id == MPR_MAP_BAD_ID) { | ||||
if ((sc->use_phynum == 0) || | /* | ||||
((id = config_page.PhyNum) > sassc->maxtargets)) { | * No mapping table. Generate an id based on the | ||||
* EnclosureHandle and Slot. We can't use PhyNum alone because | |||||
* there may be multiple expanders on a single bus. Ditto for | |||||
* Slot. And we can't use EnclosureHandle + Phynum because some | |||||
* enclosures legitimately contain multiple expanders | |||||
*/ | |||||
id = ((config_page.EnclosureHandle - 1) << 7) | config_page.Slot; | |||||
slmUnsubmitted Not Done Inline ActionsDoes this work for directly attached devices too, with no enclosures? slm: Does this work for directly attached devices too, with no enclosures? | |||||
asomersAuthorUnsubmitted Not Done Inline ActionsProbably not. asomers: Probably not. | |||||
slmUnsubmitted Not Done Inline ActionsIt might work, but I guess it should be tested to be sure. I think the EnclosureHandle will be 1 for direct-attached devices. Can you explain why you're subtracting 1 here? slm: It might work, but I guess it should be tested to be sure. I think the EnclosureHandle will be… | |||||
asomersAuthorUnsubmitted Not Done Inline ActionsI'm subtracting one just to make the best use out of my 1024 available IDs. The first enclosure always has enclosure handle 1, not 0. The problem with directly-attached devices is that their Slot is probably 0. But I don't have any to test with. asomers: I'm subtracting one just to make the best use out of my 1024 available IDs. The first… | |||||
slmUnsubmitted Not Done Inline ActionsI was just concerned about an EnclosureHandle of 0, but that's an invalid value that shouldn't be returned and it's probably OK. The way it works is that the EnclosureHandle will be 1 for direct-attached devices and it represents a virtual Enclosure to the FW. I believe the Slot or Phy number should be valid, even for direct-attached devices. It's probably OK to leave it as is, and it will work. You can't attach any drives directly to test? slm: I was just concerned about an EnclosureHandle of 0, but that's an invalid value that shouldn't… | |||||
asomersAuthorUnsubmitted Not Done Inline ActionsI don't think I have the right type of cables for direct attaching a drive. Everything I do uses expanders. asomers: I don't think I have the right type of cables for direct attaching a drive. Everything I do… | |||||
if ((sc->use_phynum == 0) || (id > sassc->maxtargets)) { | |||||
mpr_dprint(sc, MPR_INFO, "failure at %s:%d/%s()! " | mpr_dprint(sc, MPR_INFO, "failure at %s:%d/%s()! " | ||||
"Could not get ID for device with handle 0x%04x\n", | "Could not get ID for device with handle 0x%04x\n", | ||||
__FILE__, __LINE__, __func__, handle); | __FILE__, __LINE__, __func__, handle); | ||||
error = ENXIO; | error = ENXIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
} | } | ||||
mpr_dprint(sc, MPR_MAPPING, "%s: Target ID for added device is %d.\n", | mpr_dprint(sc, MPR_MAPPING, "%s: Target ID for added device is %d.\n", | ||||
▲ Show 20 Lines • Show All 414 Lines • ▼ Show 20 Lines | mprsas_add_pcie_device(struct mpr_softc *sc, u16 handle, u8 linkrate) | ||||
if ((mpr_config_get_pcie_device_pg2(sc, &mpi_reply, &config_page2, | if ((mpr_config_get_pcie_device_pg2(sc, &mpi_reply, &config_page2, | ||||
MPI26_PCIE_DEVICE_PGAD_FORM_HANDLE, handle))) { | MPI26_PCIE_DEVICE_PGAD_FORM_HANDLE, handle))) { | ||||
printf("%s: error reading PCIe device page2\n", __func__); | printf("%s: error reading PCIe device page2\n", __func__); | ||||
error = ENXIO; | error = ENXIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
id = mpr_mapping_get_tid(sc, pcie_wwid, handle); | id = mpr_mapping_get_tid(sc, pcie_wwid, handle); | ||||
slmUnsubmitted Not Done Inline ActionsDo you need to account for NVMe? slm: Do you need to account for NVMe? | |||||
asomersAuthorUnsubmitted Not Done Inline ActionsI don't know. Do I? I don't have any tri-mode hardware. asomers: I don't know. Do I? I don't have any tri-mode hardware. | |||||
slmUnsubmitted Not Done Inline ActionsI'm thinking we should handle them the same way. slm: I'm thinking we should handle them the same way. | |||||
asomersAuthorUnsubmitted Not Done Inline ActionsDo I need to make any changes for them? asomers: Do I need to make any changes for them? | |||||
slmUnsubmitted Not Done Inline ActionsYou should be able to make the exact same changes here just to cover both device types. If you don't there might be confusion later if things are working for SAS but not NVMe. slm: You should be able to make the exact same changes here just to cover both device types. If you… | |||||
if (id == MPR_MAP_BAD_ID) { | if (id == MPR_MAP_BAD_ID) { | ||||
mpr_dprint(sc, MPR_ERROR | MPR_INFO, "failure at %s:%d/%s()! " | mpr_dprint(sc, MPR_ERROR | MPR_INFO, "failure at %s:%d/%s()! " | ||||
"Could not get ID for device with handle 0x%04x\n", | "Could not get ID for device with handle 0x%04x\n", | ||||
__FILE__, __LINE__, __func__, handle); | __FILE__, __LINE__, __func__, handle); | ||||
error = ENXIO; | error = ENXIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
mpr_dprint(sc, MPR_MAPPING, "%s: Target ID for added device is %d.\n", | mpr_dprint(sc, MPR_MAPPING, "%s: Target ID for added device is %d.\n", | ||||
▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines |
'fallible'