[Skiboot] [PATCH 1/3] mem_region: rename HW_RESERVE to FW_RESERVE
Oliver O'Halloran
oohall at gmail.com
Wed May 24 16:00:51 AEST 2017
Currently all existing reservations are made by hostboot itself or on
behalf of some other part of system firmware (e.g. the OCCs). We want
to add a "true" hardware reservation type that should not be touched
by the host OS. To prepare for that this patch renames the existing
reservation type to refect it's actual usage.
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
core/mem_region.c | 10 +++++-----
core/test/run-mem_range_is_reserved.c | 2 +-
core/test/run-mem_region_reservations.c | 4 ++--
hdata/memory.c | 2 +-
hdata/test/stubs.c | 3 +--
hw/homer.c | 6 +++---
hw/prd.c | 2 +-
include/mem_region.h | 4 ++--
8 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/core/mem_region.c b/core/mem_region.c
index a3145583cd76..a8a92ff21171 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -756,13 +756,13 @@ static bool add_region(struct mem_region *region)
return true;
}
-void mem_reserve_hw(const char *name, uint64_t start, uint64_t len)
+void mem_reserve_fw(const char *name, uint64_t start, uint64_t len)
{
struct mem_region *region;
bool added = true;
lock(&mem_region_lock);
- region = new_region(name, start, len, NULL, REGION_HW_RESERVED);
+ region = new_region(name, start, len, NULL, REGION_FW_RESERVED);
assert(region);
if (!mem_region_init_done)
@@ -935,7 +935,7 @@ static void mem_region_parse_reserved_properties(void)
region = new_region(name,
dt_get_number(range, 2),
dt_get_number(range + 1, 2),
- NULL, REGION_HW_RESERVED);
+ NULL, REGION_FW_RESERVED);
add_region(region);
}
} else if (names || ranges) {
@@ -974,7 +974,7 @@ static bool mem_region_parse_reserved_nodes(const char *path)
region = new_region(strdup(node->name),
dt_get_number(reg->prop, 2),
dt_get_number(reg->prop + sizeof(u64), 2),
- node, REGION_HW_RESERVED);
+ node, REGION_FW_RESERVED);
add_region(region);
}
@@ -1151,7 +1151,7 @@ static void mem_region_add_dt_reserved_node(struct dt_node *parent,
* update regions' device-tree nodes, and we want those updates to
* apply to the nodes in /reserved-memory/.
*/
- if (region->type == REGION_HW_RESERVED && region->node) {
+ if (region->type == REGION_FW_RESERVED && region->node) {
if (region->node->parent != parent)
region->node = dt_copy(region->node, parent);
return;
diff --git a/core/test/run-mem_range_is_reserved.c b/core/test/run-mem_range_is_reserved.c
index 0efe9b921cf4..95c790dca53b 100644
--- a/core/test/run-mem_range_is_reserved.c
+++ b/core/test/run-mem_range_is_reserved.c
@@ -165,7 +165,7 @@ static void run_test(struct test *test)
/* create our reservations */
for (r = test->regions; r->start; r++)
- mem_reserve_hw("r", r->start, r->end - r->start);
+ mem_reserve_fw("r", r->start, r->end - r->start);
reserved = mem_range_is_reserved(0x1000, 0x1000);
diff --git a/core/test/run-mem_region_reservations.c b/core/test/run-mem_region_reservations.c
index 8764953290e7..584b7c340f41 100644
--- a/core/test/run-mem_region_reservations.c
+++ b/core/test/run-mem_region_reservations.c
@@ -205,14 +205,14 @@ int main(void)
/* add pre-init reservations */
for (i = 0; i < ARRAY_SIZE(test_regions); i++)
- mem_reserve_hw(test_regions[i].name,
+ mem_reserve_fw(test_regions[i].name,
test_regions[i].addr, 0x1000);
/* Now convert. */
mem_region_init();
/* add a post-init reservation */
- mem_reserve_hw("test.4", 0x5000, 0x1000);
+ mem_reserve_fw("test.4", 0x5000, 0x1000);
/* release unused */
mem_region_release_unused();
diff --git a/hdata/memory.c b/hdata/memory.c
index 0c6c0811f61a..46ad4f7de625 100644
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -470,7 +470,7 @@ static void get_hb_reserved_mem(struct HDIF_common_hdr *ms_vpd)
prlog(PR_DEBUG, "MEM: Reserve '%s' %#" PRIx64 "-%#" PRIx64 " (type/inst=0x%08x)\n",
label, start_addr, end_addr, be32_to_cpu(hb_resv_mem->type_instance));
- mem_reserve_hw(label, start_addr, end_addr - start_addr + 1);
+ mem_reserve_fw(label, start_addr, end_addr - start_addr + 1);
}
}
diff --git a/hdata/test/stubs.c b/hdata/test/stubs.c
index 0777730f418c..e3b0fdf0be6f 100644
--- a/hdata/test/stubs.c
+++ b/hdata/test/stubs.c
@@ -99,7 +99,6 @@ STUB(op_display);
STUB(fsp_preload_lid);
STUB(fsp_wait_lid_loaded);
STUB(fsp_adjust_lid_side);
-STUB(backtrace);
/* Add HW specific stubs here */
static void noop_function(void) {}
@@ -107,4 +106,4 @@ static void noop_function(void) {}
void fnname(void) __attribute__((weak, alias ("noop_function")))
NOOP_STUB(early_uart_init);
-NOOP_STUB(mem_reserve_hw);
+NOOP_STUB(mem_reserve_fw);
diff --git a/hw/homer.c b/hw/homer.c
index 1e2298b12e59..b1bdba5ba103 100644
--- a/hw/homer.c
+++ b/hw/homer.c
@@ -116,7 +116,7 @@ static void homer_init_chip(struct proc_chip *chip)
if (!mem_range_is_reserved(hbase, hsize)) {
prlog(PR_WARNING,
"HOMER image is not reserved! Reserving\n");
- mem_reserve_hw("ibm,homer-image", hbase, hsize);
+ mem_reserve_fw("ibm,homer-image", hbase, hsize);
}
chip->homer_base = hbase;
@@ -141,7 +141,7 @@ static void homer_init_chip(struct proc_chip *chip)
!mem_range_is_reserved(sbase, ssize)) {
prlog(PR_WARNING,
"SLW image is not reserved! Reserving\n");
- mem_reserve_hw("ibm,slw-image", sbase, ssize);
+ mem_reserve_fw("ibm,slw-image", sbase, ssize);
}
chip->slw_base = sbase;
@@ -206,7 +206,7 @@ void homer_init(void)
chip->occ_common_size)) {
prlog(PR_WARNING,
"OCC common area is not reserved! Reserving\n");
- mem_reserve_hw("ibm,occ-common-area",
+ mem_reserve_fw("ibm,occ-common-area",
chip->occ_common_base,
chip->occ_common_size);
}
diff --git a/hw/prd.c b/hw/prd.c
index 0db7e6bba365..01bbf966c958 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -397,7 +397,7 @@ void prd_register_reserved_memory(void)
for (region = mem_region_next(NULL); region;
region = mem_region_next(region)) {
- if (region->type != REGION_HW_RESERVED)
+ if (region->type != REGION_FW_RESERVED)
continue;
if (!region->node)
diff --git a/include/mem_region.h b/include/mem_region.h
index c34858e4eb9d..8a6bf4079d0c 100644
--- a/include/mem_region.h
+++ b/include/mem_region.h
@@ -32,7 +32,7 @@ enum mem_region_type {
REGION_SKIBOOT_FIRMWARE,
/* ranges reserved before skiboot init, eg HBRT memory */
- REGION_HW_RESERVED,
+ REGION_FW_RESERVED,
/* ranges reserved, eg HW framebuffer */
REGION_RESERVED,
@@ -73,7 +73,7 @@ void adjust_cpu_stacks_alloc(void);
void mem_region_add_dt_reserved(void);
/* Mark memory as reserved */
-void mem_reserve_hw(const char *name, uint64_t start, uint64_t len);
+void mem_reserve_fw(const char *name, uint64_t start, uint64_t len);
struct mem_region *find_mem_region(const char *name);
--
2.9.3
More information about the Skiboot
mailing list