question regarding pciehp and pciehp_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to get my setup to work with the native PCIe hotplug driver.
>From my testing, it looks like when the pciehp driver is loaded, it
expects all the PCIe slots to be powered off.  In pciehp_probe(), we
have:

t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is
occupied */
if (value && pciehp_force) {
    rc = pciehp_enable_slot(t_slot);
    if (rc)   /* -ENODEV: shouldn't happen, but deal with it */
        value = 0;
}
if ((POWER_CTRL(ctrl)) && !value) {
    rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if
not occupied*/
    if (rc)
        goto err_out_free_ctrl_slot;
}

But pciehp_enable_slot() will return EINVAL if the slot is already
powered up and ready to go.  Consequently pciehp_probe() will attempt to
power off the slot.  If I change the rc conditional after the
pciehp_enable_slot() call to explicitly specify ENODEV (and thus exclude
the case of the EINVAL return):

... 
   if (rc == ENODEV) /* no adapter in slot or latch open on slot */
        value = 0;
}

it seems to work right, the PCIe card in the slot is up initially, I
modprobe pciehp in, it correctly handles the slot being powered already
and loads without error, and I'm able to hotplug the card out and back
in just fine.  

But I'm guessing it's like it is for a reason.  Can someone explain why
this is so?

Thanks,
Praveen

--
Praveen Kalamegham
praveen@xxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux