[Skiboot] [PATCH v10 16/17] core/opal: Use PCI slot and new APIs for slot states

Stewart Smith stewart at linux.vnet.ibm.com
Thu May 12 15:18:50 AEST 2016


Gavin Shan <gwshan at linux.vnet.ibm.com> writes:
> The various reset requests are completed by PHB's callbacks. All
> of them (except reset on IODA table or error injection) are covered
> by PCI slot. opal_pci_poll() faces similar situation.
>
> This reimplements opal_pci_reset() and opal_pci_poll() based on
> the callbacks provided by PCI slot instead of PHB. Also, couple of
> new APIs are introduced based on the callbacks in PCI slot as below:
>
>    * opal_pci_get_presence_state(): Check if there is adapter presented
>      behind the specified PHB or PCI slot.
>    * opal_pci_get_power_state(): Returns power supply state (on or off)
>      on the specified PHB or PCI slot.
>    * opal_pci_set_power_state(): Sets power supply state (on or off)
>      on the specified PHB or PCI slot.
>    * opal_pci_poll2(): Poll for PCI slot state. It accepts two arguments
>      while opal_pci_poll() accepts only one.
>
> Eventually, the definition of unused PHB's callbacks are removed.
>
> Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
> ---
>  core/pci-opal.c    | 174 +++++++++++++++++++++++++++++++++++++++++++++--------
>  include/opal-api.h |   6 +-
>  include/pci.h      |  72 ----------------------
>  3 files changed, 153 insertions(+), 99 deletions(-)

Please also add documentation for the new calls in doc/opal-api/

> +static int64_t opal_pci_poll2(uint64_t id, uint64_t data)

If we're going to start fixing the PCI calls, we could at the same time
use the more modern OPAL convention of async calls, and there's a
standard way to wait for them in the kernel -
opal_async_wait_response() - although we may want to ensure that things
are cranked often enough.

We could also convert the existing users of opal_pci_poll() to proper
async completions too... we'd then be able to get rid of the old calls
for p9 and (eventually) remove them altogether.



-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list