Make the memory size returned from fdt_get_mem_regions a 64-bit type. This

is the physical memory size so may be larger than a u_long can hold, e.g.
on ARM with LPAE we could see an address space of up to 40 bits. On ARM
u_long is only 32 bits so the memory size will be truncated, possibly to
zero.

Reported by:	bz
Sponsored by:	ABT Systems Ltd
This commit is contained in:
Andrew Turner 2016-03-01 11:39:07 +00:00
parent 58f04b2a1e
commit 9636600cf2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296265
4 changed files with 5 additions and 5 deletions

View File

@ -1443,7 +1443,7 @@ initarm(struct arm_boot_params *abp)
struct pv_addr kernel_l1pt;
struct pv_addr dpcpu;
vm_offset_t dtbp, freemempos, l2_start, lastaddr;
u_long memsize;
uint64_t memsize;
uint32_t l2size;
char *env;
void *kmdp;

View File

@ -647,12 +647,12 @@ fdt_get_reserved_regions(struct mem_region *mr, int *mrcnt)
}
int
fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, u_long *memsize)
fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint64_t *memsize)
{
pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS];
pcell_t *regp;
phandle_t memory;
u_long memory_size;
uint64_t memory_size;
int addr_cells, size_cells;
int i, max_size, reg_len, rv, tuple_size, tuples;

View File

@ -85,7 +85,7 @@ u_long fdt_data_get(void *, int);
int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *);
phandle_t fdt_find_compatible(phandle_t, const char *, int);
phandle_t fdt_depth_search_compatible(phandle_t, const char *, int);
int fdt_get_mem_regions(struct mem_region *, int *, u_long *);
int fdt_get_mem_regions(struct mem_region *, int *, uint64_t *);
int fdt_get_reserved_regions(struct mem_region *, int *);
int fdt_get_phyaddr(phandle_t, device_t, int *, void **);
int fdt_get_range(phandle_t, int, u_long *, u_long *);

View File

@ -90,8 +90,8 @@ mips_init(void)
int i;
#ifdef FDT
struct mem_region mr[FDT_MEM_REGIONS];
uint64_t val;
int mr_cnt;
u_long val;
int j;
#endif