*/
int fdt_reserved_memory_fixup(void *fdt);
-/**
- * Fix up the reserved memory subnodes in the device tree
- *
- * This routine adds the no-map property to the reserved memory subnodes so
- * that the OS does not map those PMP protected memory regions.
- *
- * Platform codes must call this helper in their final_init() after fdt_fixups()
- * if the OS should not map the PMP protected reserved regions.
- *
- * @param fdt: device tree blob
- * @return zero on success and -ve on failure
- */
-int fdt_reserved_memory_nomap_fixup(void *fdt);
-
/**
* General device tree fix-up
*
static int fdt_resv_memory_update_node(void *fdt, unsigned long addr,
unsigned long size, int index,
- int parent, bool no_map)
+ int parent)
{
int na = fdt_address_cells(fdt, 0);
int ns = fdt_size_cells(fdt, 0);
if (subnode < 0)
return subnode;
- if (no_map) {
- /*
- * Tell operating system not to create a virtual
- * mapping of the region as part of its standard
- * mapping of system memory.
- */
- err = fdt_setprop_empty(fdt, subnode, "no-map");
- if (err < 0)
- return err;
- }
+ /*
+ * Tell operating system not to create a virtual
+ * mapping of the region as part of its standard
+ * mapping of system memory.
+ */
+ err = fdt_setprop_empty(fdt, subnode, "no-map");
+ if (err < 0)
+ return err;
/* encode the <reg> property value */
val = reg;
{
struct sbi_domain_memregion *reg;
struct sbi_domain *dom = sbi_domain_thishart_ptr();
- struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
unsigned long filtered_base[PMP_COUNT] = { 0 };
unsigned char filtered_order[PMP_COUNT] = { 0 };
unsigned long addr, size;
for (j = 0; j < i; j++) {
addr = filtered_base[j];
size = 1UL << filtered_order[j];
- fdt_resv_memory_update_node(fdt, addr, size, j, parent,
- (sbi_hart_pmp_count(scratch))
- ? false : true);
- }
-
- return 0;
-}
-
-int fdt_reserved_memory_nomap_fixup(void *fdt)
-{
- int parent, subnode;
- int err;
-
- /* Locate the reserved memory node */
- parent = fdt_path_offset(fdt, "/reserved-memory");
- if (parent < 0)
- return parent;
-
- fdt_for_each_subnode(subnode, fdt, parent) {
- /*
- * Tell operating system not to create a virtual
- * mapping of the region as part of its standard
- * mapping of system memory.
- */
- err = fdt_setprop_empty(fdt, subnode, "no-map");
- if (err < 0)
- return err;
+ fdt_resv_memory_update_node(fdt, addr, size, j, parent);
}
return 0;
return 0;
}
-static int sifive_fu540_fdt_fixup(void *fdt, const struct fdt_match *match)
-{
- /*
- * SiFive Freedom U540 has an erratum that prevents S-mode software
- * to access a PMP protected region using 1GB page table mapping, so
- * always add the no-map attribute on this platform.
- */
- fdt_reserved_memory_nomap_fixup(fdt);
-
- return 0;
-}
-
static const struct fdt_match sifive_fu540_match[] = {
{ .compatible = "sifive,fu540" },
{ .compatible = "sifive,fu540g" },
const struct platform_override sifive_fu540 = {
.match_table = sifive_fu540_match,
.tlbr_flush_limit = sifive_fu540_tlbr_flush_limit,
- .fdt_fixup = sifive_fu540_fdt_fixup,
};