Skip to content

Commit

Permalink
phb4: Re-factor phb4_fenced() and introduce phb4_dump_pec_err_regs()
Browse files Browse the repository at this point in the history
Couple of places in 'phb4.c' where we may want to dump the PEC's error
registers. Hence we introduce a phb4_dump_pec_err_regs() that dumps
all the PEC error registers and also update phb4->nfir_cache &
phb4->pfir_cache for later use.

Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
vaibhav92 authored and stewartsmith committed Sep 20, 2018
1 parent 09fabd6 commit 0f78682
Showing 1 changed file with 38 additions and 30 deletions.
68 changes: 38 additions & 30 deletions hw/phb4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,36 @@ static void phb4_train_info(struct phb4 *p, uint64_t reg, unsigned long time)
PHBERR(p, "%s\n", s);
}

static void phb4_dump_pec_err_regs(struct phb4 *p)
{
uint64_t nfir_p_wof, nfir_n_wof, err_aib;
uint64_t err_rpt0, err_rpt1;

/* Read the PCI and NEST FIRs and dump them. Also cache PCI/NEST FIRs */
xscom_read(p->chip_id,
p->pci_stk_xscom + XPEC_PCI_STK_PCI_FIR, &p->pfir_cache);
xscom_read(p->chip_id,
p->pci_stk_xscom + XPEC_PCI_STK_PCI_FIR_WOF, &nfir_p_wof);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_PCI_NFIR, &p->nfir_cache);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_PCI_NFIR_WOF, &nfir_n_wof);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_ERR_RPT0, &err_rpt0);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_ERR_RPT1, &err_rpt1);
xscom_read(p->chip_id,
p->pci_stk_xscom + XPEC_PCI_STK_PBAIB_ERR_REPORT, &err_aib);

PHBERR(p, " PCI FIR=%016llx\n", p->pfir_cache);
PHBERR(p, " PCI FIR WOF=%016llx\n", nfir_p_wof);
PHBERR(p, " NEST FIR=%016llx\n", p->nfir_cache);
PHBERR(p, " NEST FIR WOF=%016llx\n", nfir_n_wof);
PHBERR(p, " ERR RPT0=%016llx\n", err_rpt0);
PHBERR(p, " ERR RPT1=%016llx\n", err_rpt1);
PHBERR(p, " AIB ERR=%016llx\n", err_aib);
}

static void phb4_dump_capp_err_regs(struct phb4 *p)
{
uint64_t fir, apc_master_err, snoop_err, transport_err;
Expand All @@ -2502,8 +2532,6 @@ static void phb4_dump_capp_err_regs(struct phb4 *p)
/* Check if AIB is fenced via PBCQ NFIR */
static bool phb4_fenced(struct phb4 *p)
{
uint64_t nfir_p, nfir_p_wof, nfir_n, nfir_n_wof, err_aib;
uint64_t err_rpt0, err_rpt1;

/* Already fenced ? */
if (p->flags & PHB4_AIB_FENCED)
Expand All @@ -2516,37 +2544,17 @@ static bool phb4_fenced(struct phb4 *p)
if (in_be64(p->regs + PHB_CPU_LOADSTORE_STATUS)!= 0xfffffffffffffffful)
return false;

PHBERR(p, "PHB Freeze/Fence detected !\n");

/* We read the PCI and NEST FIRs and dump them */
xscom_read(p->chip_id,
p->pci_stk_xscom + XPEC_PCI_STK_PCI_FIR, &nfir_p);
xscom_read(p->chip_id,
p->pci_stk_xscom + XPEC_PCI_STK_PCI_FIR_WOF, &nfir_p_wof);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_PCI_NFIR, &nfir_n);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_PCI_NFIR_WOF, &nfir_n_wof);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_ERR_RPT0, &err_rpt0);
xscom_read(p->chip_id,
p->pe_stk_xscom + XPEC_NEST_STK_ERR_RPT1, &err_rpt1);
xscom_read(p->chip_id,
p->pci_stk_xscom + XPEC_PCI_STK_PBAIB_ERR_REPORT, &err_aib);

PHBERR(p, " PCI FIR=%016llx\n", nfir_p);
PHBERR(p, " PCI FIR WOF=%016llx\n", nfir_p_wof);
PHBERR(p, " NEST FIR=%016llx\n", nfir_n);
PHBERR(p, " NEST FIR WOF=%016llx\n", nfir_n_wof);
PHBERR(p, " ERR RPT0=%016llx\n", err_rpt0);
PHBERR(p, " ERR RPT1=%016llx\n", err_rpt1);
PHBERR(p, " AIB ERR=%016llx\n", err_aib);

/* Mark ourselves fenced */
p->flags |= PHB4_AIB_FENCED;

/* dump capp error registers in case phb was fenced due to capp */
if (nfir_n & XPEC_NEST_STK_PCI_NFIR_CXA_PE_CAPP)
PHBERR(p, "PHB Freeze/Fence detected !\n");
phb4_dump_pec_err_regs(p);

/*
* dump capp error registers in case phb was fenced due to capp.
* Expect p->nfir_cache already updated in phb4_dump_pec_err_regs()
*/
if (p->nfir_cache & XPEC_NEST_STK_PCI_NFIR_CXA_PE_CAPP)
phb4_dump_capp_err_regs(p);

phb4_eeh_dump_regs(p);
Expand Down

0 comments on commit 0f78682

Please sign in to comment.