Skip to content

Commit

Permalink
phb4: Add ability to log config space access
Browse files Browse the repository at this point in the history
Useful for debugging

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
mikey authored and stewartsmith committed Nov 30, 2016
1 parent 5f0dfda commit 61784ac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions hw/phb4.c
Expand Up @@ -69,6 +69,12 @@ static void phb4_init_hw(struct phb4 *p, bool first_init);
(p)->phb.opal_id, (p)->chip_id, \
(p)->index, ## a)

#ifdef LOG_CFG
#define PHBLOGCFG(p, fmt, a...) PHBDBG(p, fmt, ## a)
#else
#define PHBLOGCFG(p, fmt, a...) do {} while (0)
#endif

/* Note: The "ASB" name is historical, practically this means access via
* the XSCOM backdoor
*/
Expand Down Expand Up @@ -352,13 +358,19 @@ static int64_t phb4_pcicfg_read(struct phb4 *p, uint32_t bdfn,
case 1:
*((uint8_t *)data) =
in_8(p->regs + PHB_CONFIG_DATA + (offset & 3));
PHBLOGCFG(p, "CFG8 Rd %02x=%02x\n",
offset, *((uint8_t *)data));
break;
case 2:
*((uint16_t *)data) =
in_le16(p->regs + PHB_CONFIG_DATA + (offset & 2));
PHBLOGCFG(p, "CFG16 Rd %02x=%04x\n",
offset, *((uint16_t *)data));
break;
case 4:
*((uint32_t *)data) = in_le32(p->regs + PHB_CONFIG_DATA);
PHBLOGCFG(p, "CFG32 Rd %02x=%08x\n",
offset, *((uint32_t *)data));
break;
default:
return OPAL_PARAMETER;
Expand Down Expand Up @@ -446,6 +458,7 @@ static int64_t phb4_pcicfg_write(struct phb4 *p, uint32_t bdfn,
}
#endif
}
PHBLOGCFG(p, "CFG%d Wr %02x=%08x\n", 8 * size, offset, data);
return OPAL_SUCCESS;
}

Expand Down

0 comments on commit 61784ac

Please sign in to comment.