2006-05-25 16:35:32

by linas

[permalink] [raw]
Subject: PCI reset using x86 or x86-64 BIOS calls?


I've go a newbie x86 BIOS question: is there a BIOS function that
can be called to reset a PCI device? (By "reset a device" I mean
raise the #RST PCI signal line to electrical high for 1.5 seconds).
I know that BIOS does this during a soft reboot, but I was wondering
if there's a stand-alone function for doing this while the system is up
and running.

This question ame up during conversations about kexec. When kexec is
used to get out from under a crashed system, the PCI devices are
typically in some unknown state, and need to be brought to heel.
It seems to me that a brute-force reset would be a particularly
straightforward way of doing this.

--linas


2006-05-26 01:52:33

by Robert Hancock

[permalink] [raw]
Subject: Re: PCI reset using x86 or x86-64 BIOS calls?

Linas Vepstas wrote:
> I've go a newbie x86 BIOS question: is there a BIOS function that
> can be called to reset a PCI device? (By "reset a device" I mean
> raise the #RST PCI signal line to electrical high for 1.5 seconds).
> I know that BIOS does this during a soft reboot, but I was wondering
> if there's a stand-alone function for doing this while the system is up
> and running.

Unlikely - if you mean just resetting one PCI device, it's likely
electrically impossible on many, if not most machines as the RST lines
will be tied together on all slots.

The BIOS might possibly have the ability to issue a PCI bus reset
independent of resetting the CPU, chipset, etc. but I don't think
there's any standardized way to trigger this, even so.

In any case, I don't think - or at least would hope - that a PCI device
going so far into the weeds that it can't be recovered without a RST
would be a rare situation.

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/

2006-05-26 22:01:18

by linas

[permalink] [raw]
Subject: Re: PCI reset using x86 or x86-64 BIOS calls?

On Thu, May 25, 2006 at 07:52:23PM -0600, Robert Hancock wrote:
> Linas Vepstas wrote:
> >I've go a newbie x86 BIOS question: is there a BIOS function that
> >can be called to reset a PCI device? (By "reset a device" I mean
> >raise the #RST PCI signal line to electrical high for 1.5 seconds).
> >I know that BIOS does this during a soft reboot, but I was wondering
> >if there's a stand-alone function for doing this while the system is up
> >and running.
>
> Unlikely - if you mean just resetting one PCI device, it's likely
> electrically impossible on many, if not most machines as the RST lines
> will be tied together on all slots.

I was afraid of that.

> In any case, I don't think - or at least would hope - that a PCI device
> going so far into the weeds that it can't be recovered without a RST
> would be a rare situation.

Well, this comes up in the case of having kexec take over from a crashed
kernel; the state of any given PCI card is unclear, and its conceptually
easiest to hit them with a hammer to put them back into a known state.

For hotplug slots, this can be accomplished by toggling power to a slot,
but not all slots out there are hot-pluggable.

The other situation where this is useful is in recovering from a PCI bus
error (e.g. parity error); but his has additional complications.

I've got someone here asking about the LSI megaraid controller;
appearently its under-documented, and it can hang hard on kexec.
Hitting it with a reset would make life simpler.

--linas

2006-05-27 05:55:13

by Lennart Sorensen

[permalink] [raw]
Subject: Re: PCI reset using x86 or x86-64 BIOS calls?

On Thu, May 25, 2006 at 07:52:23PM -0600, Robert Hancock wrote:
> Unlikely - if you mean just resetting one PCI device, it's likely
> electrically impossible on many, if not most machines as the RST lines
> will be tied together on all slots.
>
> The BIOS might possibly have the ability to issue a PCI bus reset
> independent of resetting the CPU, chipset, etc. but I don't think
> there's any standardized way to trigger this, even so.
>
> In any case, I don't think - or at least would hope - that a PCI device
> going so far into the weeds that it can't be recovered without a RST
> would be a rare situation.

Well I know there is a way to make a pci to pci bridge assert reset on
the secondary bus, which of course resets all devices behind the bridge.
I am not sure when, other than in the bios, this would be useful. I
wouldn't want to have to go clean up the pci configuration settings on
all the devices after the reset. I considered doing it to solve a rare
problem with some pci cards, but decided a reboot was simpler.

Len Sorensen