Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:sp5-rebuild
powerpc-utils.8401
lsslot-Split-dynamic-memory-v1-parsing-into-sep...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File lsslot-Split-dynamic-memory-v1-parsing-into-separate.patch of Package powerpc-utils.8401
From 6a1b89bb7e9f58262da0f08906674cae3efc7bfc Mon Sep 17 00:00:00 2001 From: Nathan Fontenot <nfont@linux.vnet.ibm.com> Date: Thu, 19 Jul 2018 23:12:34 -0500 Subject: [PATCH] lsslot: Split dynamic-memory v1 parsing into separate routine In preparation for support of parsing the new ibm,dynamic-memory-v2 device tree property, this patch splits the current code that parses the current v1 version of the device tree propertry into its own routine. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> --- src/drmgr/drmem.h | 1 + src/drmgr/drslot_chrp_mem.c | 53 +++++++++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/drmgr/drmem.h b/src/drmgr/drmem.h index 5da67581d981..70f9bc5f754c 100644 --- a/src/drmgr/drmem.h +++ b/src/drmgr/drmem.h @@ -43,6 +43,7 @@ struct drconf_mem { #define MEM_PROBE_FILE "/sys/devices/system/memory/probe" #define MEM_BLOCK_SIZE_BYTES "/sys/devices/system/memory/block_size_bytes" #define DYNAMIC_RECONFIG_MEM "/proc/device-tree/ibm,dynamic-reconfiguration-memory" +#define DYNAMIC_RECONFIG_MEM_V1 DYNAMIC_RECONFIG_MEM "/ibm,dynamic-memory" #define LMB_NORMAL_SORT 0 #define LMB_REVERSE_SORT 1 diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index c59cf8dcb739..dda6e9fb19ba 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -307,32 +307,21 @@ get_mem_node_lmbs(struct lmb_list_head *lmb_list) } /** - * get_dynamic_reconfig_lmbs + * get_dynamic_reconfig_lmbs_v1 * @brief Retrieve lmbs from OF device tree located in the ibm,dynamic-memory * property. * + * @param lmb_sz size of LMBs * @param lmb_list pointer to lmb list head to populate * @returns 0 on success, !0 on failure */ int -get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) +get_dynamic_reconfig_lmbs_v1(uint64_t lmb_sz, struct lmb_list_head *lmb_list) { struct drconf_mem *drmem; - uint64_t lmb_sz; int i, num_entries; int rc = 0; - rc = get_property(DYNAMIC_RECONFIG_MEM, "ibm,lmb-size", - &lmb_sz, sizeof(lmb_sz)); - - /* convert for LE systems */ - lmb_sz = be64toh(lmb_sz); - - if (rc) { - say(DEBUG, "Could not retrieve drconf LMB size\n"); - return rc; - } - lmb_list->drconf_buf_sz = get_property_size(DYNAMIC_RECONFIG_MEM, "ibm,dynamic-memory"); lmb_list->drconf_buf = zalloc(lmb_list->drconf_buf_sz); @@ -388,6 +377,42 @@ get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) drmem++; /* trust your compiler */ } + return rc; +} + +/** + * get_dynamic_reconfig_lmbs + * @brief Retrieve lmbs from OF device tree located in the ibm,dynamic-memory + * property. + * + * @param lmb_list pointer to lmb list head to populate + * @returns 0 on success, !0 on failure + */ +int +get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) +{ + struct stat sbuf; + uint64_t lmb_sz; + int rc = 0; + + rc = get_property(DYNAMIC_RECONFIG_MEM, "ibm,lmb-size", + &lmb_sz, sizeof(lmb_sz)); + + /* convert for LE systems */ + lmb_sz = be64toh(lmb_sz); + + if (rc) { + say(DEBUG, "Could not retrieve drconf LMB size\n"); + return rc; + } + + if (stat(DYNAMIC_RECONFIG_MEM_V1, &sbuf) == 0) { + rc = get_dynamic_reconfig_lmbs_v1(lmb_sz, lmb_list); + } else { + say(ERROR, "No dynamic reconfiguration LMBs found\n"); + return -1; + } + say(INFO, "Found %d LMBs currently allocated\n", lmb_list->lmbs_found); return rc; } -- 2.13.7
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor