ppc4xx: Use ram_addr_t in ppc4xx_sdram_adjust()
To avoid overflow if larger values are added later use ram_addr_t for the sdram_bank_sizes parameter to match ram_size to which it is compared. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
08fd99179a
commit
7d8ccf58d5
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
#define PPC440EP_SDRAM_NR_BANKS 4
|
#define PPC440EP_SDRAM_NR_BANKS 4
|
||||||
|
|
||||||
static const unsigned int ppc440ep_sdram_bank_sizes[] = {
|
static const ram_addr_t ppc440ep_sdram_bank_sizes[] = {
|
||||||
256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 16 * MiB, 8 * MiB, 0
|
256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 16 * MiB, 8 * MiB, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -679,12 +679,12 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
|
|||||||
MemoryRegion ram_memories[],
|
MemoryRegion ram_memories[],
|
||||||
hwaddr ram_bases[],
|
hwaddr ram_bases[],
|
||||||
hwaddr ram_sizes[],
|
hwaddr ram_sizes[],
|
||||||
const unsigned int sdram_bank_sizes[])
|
const ram_addr_t sdram_bank_sizes[])
|
||||||
{
|
{
|
||||||
MemoryRegion *ram = g_malloc0(sizeof(*ram));
|
MemoryRegion *ram = g_malloc0(sizeof(*ram));
|
||||||
ram_addr_t size_left = ram_size;
|
ram_addr_t size_left = ram_size;
|
||||||
ram_addr_t base = 0;
|
ram_addr_t base = 0;
|
||||||
unsigned int bank_size;
|
ram_addr_t bank_size;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
#define SDRAM_NR_BANKS 4
|
#define SDRAM_NR_BANKS 4
|
||||||
|
|
||||||
/* FIXME: See u-boot.git 8ac41e, also fix in ppc440_uc.c */
|
/* FIXME: See u-boot.git 8ac41e, also fix in ppc440_uc.c */
|
||||||
static const unsigned int ppc460ex_sdram_bank_sizes[] = {
|
static const ram_addr_t ppc460ex_sdram_bank_sizes[] = {
|
||||||
1 * GiB, 512 * MiB, 256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 0
|
1 * GiB, 512 * MiB, 256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
|
|||||||
MemoryRegion ram_memories[],
|
MemoryRegion ram_memories[],
|
||||||
hwaddr ram_bases[],
|
hwaddr ram_bases[],
|
||||||
hwaddr ram_sizes[],
|
hwaddr ram_sizes[],
|
||||||
const unsigned int sdram_bank_sizes[]);
|
const ram_addr_t sdram_bank_sizes[]);
|
||||||
|
|
||||||
void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks,
|
void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks,
|
||||||
MemoryRegion ram_memories[],
|
MemoryRegion ram_memories[],
|
||||||
|
Loading…
Reference in New Issue
Block a user