summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2016-09-05 12:07:49 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-09-14 16:36:01 +1000
commit0754d2e8fce72548d19219544d0ef6c8d4101f06 (patch)
tree12d5c90341d243a25569191a46cf3bb93313ee6f
parente434afaa710dc917c4e8f5098a5576623695eed7 (diff)
downloadblackbird-skiboot-0754d2e8fce72548d19219544d0ef6c8d4101f06.tar.gz
blackbird-skiboot-0754d2e8fce72548d19219544d0ef6c8d4101f06.zip
core/vpd: rename vpd to vpd_lid
This file contains several helper functions which also take an argument named "vpd". Even at the best of times, the VPD parsing code is a soup of confusing terminology so lets not make a bad situation worse. This patch renames vpd to vpd_lid and vpd_size to vpd_lid_size to clarify the situation. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/vpd.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/core/vpd.c b/core/vpd.c
index 83da7440..505b3d63 100644
--- a/core/vpd.c
+++ b/core/vpd.c
@@ -118,8 +118,8 @@ const void *vpd_find(const void *vpd, size_t vpd_size,
return p;
}
-static void *vpd;
-static size_t vpd_size;
+static void *vpd_lid;
+static size_t vpd_lid_size;
static uint32_t vpd_lid_no;
/* Helper to load a VPD LID. Pass a ptr to the corresponding LX keyword */
@@ -146,9 +146,9 @@ static void *vpd_lid_preload(const uint8_t *lx)
* I've seen so far are much smaller.
*/
#define VPD_LID_MAX_SIZE 0x4000
- vpd = malloc(VPD_LID_MAX_SIZE);
+ vpd_lid = malloc(VPD_LID_MAX_SIZE);
- if (!vpd) {
+ if (!vpd_lid) {
prerror("VPD: Failed to allocate memory for LID\n");
return NULL;
}
@@ -157,18 +157,18 @@ static void *vpd_lid_preload(const uint8_t *lx)
vpd_lid_no = fsp_adjust_lid_side(vpd_lid_no);
printf("VPD: Trying to load VPD LID 0x%08x...\n", vpd_lid_no);
- vpd_size = VPD_LID_MAX_SIZE;
+ vpd_lid_size = VPD_LID_MAX_SIZE;
/* Load it from the FSP */
- rc = fsp_preload_lid(vpd_lid_no, vpd, &vpd_size);
+ rc = fsp_preload_lid(vpd_lid_no, vpd_lid, &vpd_lid_size);
if (rc) {
prerror("VPD: Error %d loading VPD LID\n", rc);
goto fail;
}
- return vpd;
+ return vpd_lid;
fail:
- free(vpd);
+ free(vpd_lid);
return NULL;
}
@@ -189,7 +189,8 @@ void vpd_iohub_load(struct dt_node *hub_node)
lxrn = p[0];
lx = (const char *)&p[1];
- if (!vpd || !vpd_lid_no) {
+ /* verify the lid preload has started */
+ if (!vpd_lid || !vpd_lid_no) {
prlog(PR_WARNING, "VPD: WARNING: Unable to load VPD lid");
return;
}
@@ -205,7 +206,7 @@ void vpd_iohub_load(struct dt_node *hub_node)
else
memcpy(record, "VINI", 4);
- valid_lx = vpd_find(vpd, vpd_size, record, "LX", &lx_size);
+ valid_lx = vpd_find(vpd_lid, vpd_lid_size, record, "LX", &lx_size);
if (!valid_lx || lx_size != 8) {
prerror("VPD: Cannot find validation LX record\n");
goto fail;
@@ -215,15 +216,15 @@ void vpd_iohub_load(struct dt_node *hub_node)
goto fail;
}
- printf("VPD: Loaded %zu bytes\n", vpd_size);
+ printf("VPD: Loaded %zu bytes\n", vpd_lid_size);
- dt_add_property(hub_node, "ibm,io-vpd", vpd, vpd_size);
- free(vpd);
+ dt_add_property(hub_node, "ibm,io-vpd", vpd_lid, vpd_lid_size);
+ free(vpd_lid);
return;
fail:
- free(vpd);
- vpd = NULL;
+ free(vpd_lid);
+ vpd_lid = NULL;
prerror("VPD: Failed to load VPD LID\n");
return;
}
@@ -239,5 +240,5 @@ void vpd_preload(struct dt_node *hub_node)
lxr = (const char *)&p[1];
- vpd = vpd_lid_preload(lxr);
+ vpd_lid = vpd_lid_preload(lxr);
}
OpenPOWER on IntegriCloud