1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-28 11:57:28 +00:00

Fix fdt_platform_fixups() mem region handling. It turns out u-boot puts

several types of data into the mem-info array (DRAM, SRAM, flash).  We
need to extract just the DRAM entries for translation into fdt memory
properties.

Also, increase the number of regions we can handle from 5 to 16.

Submitted by:	Michal Meloun
This commit is contained in:
Ian Lepore 2015-03-17 21:15:24 +00:00
parent 612d9391a4
commit db7e396903
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280194
2 changed files with 9 additions and 11 deletions

View File

@ -88,7 +88,7 @@ fdt_platform_load_dtb(void)
void
fdt_platform_fixups(void)
{
struct fdt_mem_region regions[3];
static struct fdt_mem_region regions[UB_MAX_MR];
const char *env, *str;
char *end, *ethstr;
int eth_no, i, len, n;
@ -165,17 +165,15 @@ fdt_platform_fixups(void)
/* Modify cpu(s) and bus clock frequenties in /cpus node [Hz] */
fdt_fixup_cpubusfreqs(si->clk_cpu, si->clk_bus);
/* Copy the data into a useful form */
for (i = 0; i < si->mr_no; i++) {
if (i > nitems(regions)) {
i = nitems(regions);
break;
/* Extract the DRAM regions into fdt_mem_region format. */
for (i = 0, n = 0; i < si->mr_no && n < nitems(regions); i++) {
if (si->mr[i].flags == MR_ATTR_DRAM) {
regions[n].start = si->mr[i].start;
regions[n].size = si->mr[i].size;
n++;
}
regions[i].start = si->mr[i].start;
regions[i].size = si->mr[i].size;
}
/* Fixup memory regions */
fdt_fixup_memory(regions, i);
fdt_fixup_memory(regions, n);
}

View File

@ -40,7 +40,7 @@ void *syscall_ptr;
int api_search_sig(struct api_signature **sig);
#define UB_MAX_MR 5 /* max mem regions number */
#define UB_MAX_MR 16 /* max mem regions number */
#define UB_MAX_DEV 6 /* max devices number */
/*