Skip to content

Commit

Permalink
core/pci: Export pci_check_clear_freeze()
Browse files Browse the repository at this point in the history
We'd like to be able to check when we get a freeze in the quirk handling
code. Make pci_check_clear_freeze un-static so it can be used elsewhere.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-By: Alistair Popple <alistair@popple.id.au>
  • Loading branch information
oohal committed Aug 2, 2019
1 parent 9142bb3 commit 452a9a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/pci.c
Expand Up @@ -307,10 +307,12 @@ static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren
* everything (default state of our backend) so
* we just check and clear the state of PE#0
*
* returns true if a freeze was detected
*
* NOTE: We currently only handle simple PE freeze, not PHB fencing
* (or rather our backend does)
*/
static void pci_check_clear_freeze(struct phb *phb)
bool pci_check_clear_freeze(struct phb *phb)
{
uint8_t freeze_state;
uint16_t pci_error_type, sev;
Expand All @@ -321,23 +323,26 @@ static void pci_check_clear_freeze(struct phb *phb)
if (phb->ops->get_reserved_pe_number)
pe_number = phb->ops->get_reserved_pe_number(phb);
if (pe_number < 0)
return;
return false;

/* Retrieve the frozen state */
rc = phb->ops->eeh_freeze_status(phb, pe_number, &freeze_state,
&pci_error_type, &sev);
if (rc)
return;
return true; /* phb fence? */

if (freeze_state == OPAL_EEH_STOPPED_NOT_FROZEN)
return;
return false;
/* We can't handle anything worse than an ER here */
if (sev > OPAL_EEH_SEV_NO_ERROR &&
sev < OPAL_EEH_SEV_PE_ER) {
PCIERR(phb, 0, "Fatal probe in %s error !\n", __func__);
return;
return true;
}

phb->ops->eeh_freeze_clear(phb, pe_number,
OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
return true;
}

/*
Expand Down
2 changes: 2 additions & 0 deletions include/pci.h
Expand Up @@ -392,6 +392,8 @@ static inline void phb_unlock(struct phb *phb)
unlock(&phb->lock);
}

bool pci_check_clear_freeze(struct phb *phb);

/* Config space ops wrappers */
static inline int64_t pci_cfg_read8(struct phb *phb, uint32_t bdfn,
uint32_t offset, uint8_t *data)
Expand Down

0 comments on commit 452a9a4

Please sign in to comment.