Fix fdt_get_mem_regions() to work with 64-bit addresses
Use u_long instead of uint32_t variables to avoid overflow in case of PA space bigger than 32-bit. Obtained from: Semihalf Submitted by: Michal Stanek <mst@semihalf.com> Sponsored by: Annapurna Labs Approved by: cognet (mentor) Reviewed by: andrew, br, wma Differential revision: https://reviews.freebsd.org/D5393
This commit is contained in:
parent
6512e69278
commit
e571e15cb0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296189
@ -1445,7 +1445,8 @@ initarm(struct arm_boot_params *abp)
|
||||
struct pv_addr kernel_l1pt;
|
||||
struct pv_addr dpcpu;
|
||||
vm_offset_t dtbp, freemempos, l2_start, lastaddr;
|
||||
uint32_t memsize, l2size;
|
||||
u_long memsize;
|
||||
uint32_t l2size;
|
||||
char *env;
|
||||
void *kmdp;
|
||||
u_int l1pagetable;
|
||||
@ -1714,7 +1715,7 @@ initarm(struct arm_boot_params *abp)
|
||||
struct mem_region mem_regions[FDT_MEM_REGIONS];
|
||||
vm_paddr_t lastaddr;
|
||||
vm_offset_t dtbp, kernelstack, dpcpu;
|
||||
uint32_t memsize;
|
||||
u_long memsize;
|
||||
char *env;
|
||||
void *kmdp;
|
||||
int err_devmap, mem_regions_sz;
|
||||
|
@ -917,7 +917,8 @@ decode_win_sdram_fixup(void)
|
||||
{
|
||||
struct mem_region mr[FDT_MEM_REGIONS];
|
||||
uint8_t window_valid[MV_WIN_DDR_MAX];
|
||||
int mr_cnt, memsize, err, i, j;
|
||||
int mr_cnt, err, i, j;
|
||||
u_long memsize;
|
||||
uint32_t valid_win_num = 0;
|
||||
|
||||
/* Grab physical memory regions information from device tree. */
|
||||
|
@ -1641,7 +1641,8 @@ decode_win_cesa_setup(struct cesa_softc *sc)
|
||||
{
|
||||
struct mem_region availmem_regions[FDT_MEM_REGIONS];
|
||||
int availmem_regions_sz;
|
||||
uint32_t memsize, br, cr, i;
|
||||
uint32_t br, cr, i;
|
||||
u_long memsize;
|
||||
|
||||
/* Grab physical memory regions information from DTS */
|
||||
if (fdt_get_mem_regions(availmem_regions, &availmem_regions_sz,
|
||||
|
@ -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, uint32_t *memsize)
|
||||
fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, u_long *memsize)
|
||||
{
|
||||
pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS];
|
||||
pcell_t *regp;
|
||||
phandle_t memory;
|
||||
uint32_t memory_size;
|
||||
u_long memory_size;
|
||||
int addr_cells, size_cells;
|
||||
int i, max_size, reg_len, rv, tuple_size, tuples;
|
||||
|
||||
|
@ -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 *, uint32_t *);
|
||||
int fdt_get_mem_regions(struct mem_region *, int *, u_long *);
|
||||
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 *);
|
||||
|
@ -90,7 +90,8 @@ mips_init(void)
|
||||
int i;
|
||||
#ifdef FDT
|
||||
struct mem_region mr[FDT_MEM_REGIONS];
|
||||
int mr_cnt, val;
|
||||
int mr_cnt;
|
||||
u_long val;
|
||||
int j;
|
||||
#endif
|
||||
|
||||
|
@ -739,7 +739,7 @@ initriscv(struct riscv_bootparams *rvbp)
|
||||
vm_offset_t lastaddr;
|
||||
int mem_regions_sz;
|
||||
vm_size_t kernlen;
|
||||
uint32_t memsize;
|
||||
u_long memsize;
|
||||
caddr_t kmdp;
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user