aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-11-17 15:46:17 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-11-17 15:46:17 +1100
commit5af6acab5ccd0fe2aa1686c502580e984887c62c (patch)
tree596cb71ec15ec6a958ff58482167170fd8fa157a
parent915cd77c123761301c2ae9fee7681cbe120401db (diff)
downloadskiboot-5af6acab5ccd0fe2aa1686c502580e984887c62c.zip
skiboot-5af6acab5ccd0fe2aa1686c502580e984887c62c.tar.gz
skiboot-5af6acab5ccd0fe2aa1686c502580e984887c62c.tar.bz2
PCI: use define for wanting dynamic PHB id for pci_register_phb
No functional change, but static analysis showed up the oddity of something that is generally unsigned (opal_id) having a signed value assigned to it. Took the opportunity to use a define to increase readability. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/pci.c2
-rw-r--r--hw/npu.c2
-rw-r--r--hw/p5ioc2-phb.c2
-rw-r--r--hw/p7ioc-phb.c2
-rw-r--r--include/pci.h1
5 files changed, 5 insertions, 4 deletions
diff --git a/core/pci.c b/core/pci.c
index e584da8..03d5a35 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -795,7 +795,7 @@ static void pci_scan_phb(void *data)
int64_t pci_register_phb(struct phb *phb, int opal_id)
{
/* The user didn't specify an opal_id, allocate one */
- if (opal_id < 0) {
+ if (opal_id == OPAL_DYNAMIC_PHB_ID) {
/* This is called at init time in non-concurrent way, so no lock needed */
for (opal_id = 0; opal_id < ARRAY_SIZE(phbs); opal_id++)
if (!phbs[opal_id])
diff --git a/hw/npu.c b/hw/npu.c
index 3649728..f0be9fc 100644
--- a/hw/npu.c
+++ b/hw/npu.c
@@ -1692,7 +1692,7 @@ static void npu_create_phb(struct dt_node *dn)
npu_add_phb_properties(p);
/* Register PHB */
- pci_register_phb(&p->phb, -1);
+ pci_register_phb(&p->phb, OPAL_DYNAMIC_PHB_ID);
/* Initialize IODA cache */
npu_ioda_init(p);
diff --git a/hw/p5ioc2-phb.c b/hw/p5ioc2-phb.c
index 1c9dbb6..70a1a09 100644
--- a/hw/p5ioc2-phb.c
+++ b/hw/p5ioc2-phb.c
@@ -1197,7 +1197,7 @@ void p5ioc2_phb_setup(struct p5ioc2 *ioc, struct p5ioc2_phb *p,
/* We register the PHB before we initialize it so we
* get a useful OPAL ID for it
*/
- pci_register_phb(&p->phb, -1);
+ pci_register_phb(&p->phb, OPAL_DYNAMIC_PHB_ID);
/* Platform additional setup */
if (platform.pci_setup_phb)
diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c
index 66c166f..97e4885 100644
--- a/hw/p7ioc-phb.c
+++ b/hw/p7ioc-phb.c
@@ -2929,7 +2929,7 @@ void p7ioc_phb_setup(struct p7ioc *ioc, uint8_t index)
/* We register the PHB before we initialize it so we
* get a useful OPAL ID for it
*/
- pci_register_phb(&p->phb, -1);
+ pci_register_phb(&p->phb, OPAL_DYNAMIC_PHB_ID);
/* Platform additional setup */
if (platform.pci_setup_phb)
diff --git a/include/pci.h b/include/pci.h
index 52579ad..4640dda 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -531,6 +531,7 @@ extern struct pci_cfg_reg_filter *pci_add_cfg_reg_filter(struct pci_device *pd,
uint32_t flags, pci_cfg_reg_func func);
/* Manage PHBs */
+#define OPAL_DYNAMIC_PHB_ID (~0)
extern int64_t pci_register_phb(struct phb *phb, int opal_id);
extern int64_t pci_unregister_phb(struct phb *phb);
extern struct phb *pci_get_phb(uint64_t phb_id);