Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a PCIe device that only works correctly when the computer is fully powered off then on again. Issuing a simple reboot or reboot -p command does not appear to cycle the power to the PCIe card, which causes it not to work after the reboot.

Is there a way to, from the OS, cycle power to a device in a PCIe slot? I can find it in /sys/bus/pci/devices/0000*/, but I can't figure out how to properly reset the board. Toggling power seems to be the only way.

Barring that, can I change a setting somewhere that will cause a full power cycle on a reboot command?

I'm running Ubuntu 12.10 by the way.

share|improve this question

1 Answer 1

Potential Method #1

I think you can do it with these commands:

disable

echo 0 > /sys/bus/pci/slots/$N/power

enable

echo 1 > /sys/bus/pci/slots/$N/power

Where $N is the number of the PCI slot.

lspci -vv may help to identify the device. This is not very well documented...

Potential Method #2

I came across this thread on U&L, similar issue: there are some answers to that question that say you can reset with this command:

echo "1" > /sys/bus/pci/devices/$NUMBER/reset. 

However, I'd read the answers there! There are conditions around doing it this way! Specifically I'd read this answer!

Potential Method #3

There is a unix command, setpci that may give you a method for resetting a device in the PCI bus.

I did not see any specific examples with this command so you'll have to google for examples and look through the man page. I would tread lightly with this command until you're confident in it's use. From what I've read about it, it's manipulating the hardware directly and so there are always risks in doing it yourself vs. using a tool that is exposing this type of functionality!

share|improve this answer
1  
Nothing shows up in slots, even though I have multiple cards plugged in. I do have a power directory in /sys/bus/pci/devices/$NUMBER/. But nothing seems to warrant setting 0 or 1 –  zachd1_618 Apr 27 '13 at 23:30
1  
I came across this thread on U&L, similar issue: there are some answers to that Q that say you can reset with this: echo "1" > /sys/bus/pci/devices/$NUMBER/reset. Read that Q though, there are conditions around doing it that way! –  slm Apr 27 '13 at 23:42
    
Thanks for the link. I've tried that however and it doesn't seem to do anything. Specifically, the device doesn't power cycle and the system still knows it is there. (When the card is on and plugged in, there are devices in /dev that I can watch). They don't disappear when I echo "1" > .... –  zachd1_618 Apr 28 '13 at 0:06
1  
Are you unloading the kernel modules for that card prior to the power cycling? I think you have to do that as well. –  slm Apr 28 '13 at 0:33
    
Good thought, but unfortunately that has no effect. Thanks for all the ideas! –  zachd1_618 Apr 28 '13 at 1:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.