Patch queue for ppc - 2014-07-22

Only a single bug fix to make -mem-path only affect RAM regions.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJTzoVcAAoJECszeR4D/txg1HwP/1BuC1J4fNL+YeyToVQeG6iu
 KJGoFooQF1HFNm6U0m+U4Cx+0Z4g4MgVPLNL/VZZuOw3+rN5cc0ouyHli0n/6Q0o
 vcS7CdUKoFWfk5J/gZd0rNmJES3x0dtAkVz+pabrxpLmHEzqsT6vC7obZCXtaZU+
 saedouLPnDOX1hVV5jgh8205ctb8uoa7fE7x+ampgq4K27r0P0siQD/KAnZ6sgLJ
 Ve/fizdVXc5b0SrAN1N+Ybc/vYe+3qPIe24hauafA3V5otT5pAiXm300TLWFsO0G
 NWAGivaod3UlfdRcFF0iETQI7dIH7d6w9HmhzalFvdKSuPcjeZxZNYgEzCpjgvky
 mxuarXXRRoBE3WKUET8yF1t/04P2g0z3/JWoCh9+Q5ZfjRwQn3qhGN8k2uosayB4
 YvbgylGdwXNcNmbFdN69xV/J85ZFLz5YSUyzpa7pLSMS1zMn3AaI5wMsOaj0rSLs
 h0eDyuQSEggjSxXyJwWgysliZIAoxyjTXJtyyHjV5C3oQO++s20ZkW00Zs1ZN/VS
 yaOC16Au9Uvrd1P4kQwNwe2uJi7TC08l6g4tmI5dMhXK9rq+HHb0wVnF9wYJy1F7
 9GRvH6Zx0l0yKUxcOF/p2WJVbJqOWr4bWWL0jn86Mo/QuP7u90Dj7hQ/6P9hEa/S
 kUdPudapRSzvxk1mBp0D
 =KL8S
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging

Patch queue for ppc - 2014-07-22

Only a single bug fix to make -mem-path only affect RAM regions.

# gpg: Signature made Tue 22 Jul 2014 16:38:04 BST using RSA key ID 03FEDC60
# gpg: Can't check signature: public key not found

* remotes/agraf/tags/signed-ppc-for-upstream:
  ppc: fix -mem-path failure

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-07-22 16:40:34 +01:00
commit 3a18d44983
5 changed files with 52 additions and 28 deletions

View file

@ -204,8 +204,9 @@ static void ppc_core99_init(MachineState *machine)
memory_region_add_subregion(get_system_memory(), 0, ram);
/* allocate and load BIOS */
memory_region_allocate_system_memory(bios, NULL, "ppc_core99.bios",
BIOS_SIZE);
memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE);
vmstate_register_ram_global(bios);
if (bios_name == NULL)
bios_name = PROM_FILENAME;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);

View file

@ -135,8 +135,9 @@ static void ppc_heathrow_init(MachineState *machine)
memory_region_add_subregion(sysmem, 0, ram);
/* allocate and load BIOS */
memory_region_allocate_system_memory(bios, NULL, "ppc_heathrow.bios",
BIOS_SIZE);
memory_region_init_ram(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE);
vmstate_register_ram_global(bios);
if (bios_name == NULL)
bios_name = PROM_FILENAME;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);

View file

@ -214,7 +214,8 @@ static void ref405ep_init(MachineState *machine)
33333333, &pic, kernel_filename == NULL ? 0 : 1);
/* allocate SRAM */
sram_size = 512 * 1024;
memory_region_allocate_system_memory(sram, NULL, "ef405ep.sram", sram_size);
memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size);
vmstate_register_ram_global(sram);
memory_region_add_subregion(sysmem, 0xFFF00000, sram);
/* allocate and load BIOS */
#ifdef DEBUG_BOARD_INIT
@ -245,8 +246,9 @@ static void ref405ep_init(MachineState *machine)
printf("Load BIOS from file\n");
#endif
bios = g_new(MemoryRegion, 1);
memory_region_allocate_system_memory(bios, NULL, "ef405ep.bios",
BIOS_SIZE);
memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE);
vmstate_register_ram_global(bios);
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
@ -508,6 +510,7 @@ static void taihu_405ep_init(MachineState *machine)
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *bios;
MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories));
MemoryRegion *ram = g_malloc0(sizeof(*ram));
hwaddr ram_bases[2], ram_sizes[2];
long bios_size;
target_ulong kernel_base, initrd_base;
@ -517,15 +520,20 @@ static void taihu_405ep_init(MachineState *machine)
DriveInfo *dinfo;
/* RAM is soldered to the board so the size cannot be changed */
memory_region_allocate_system_memory(&ram_memories[0], NULL,
"taihu_405ep.ram-0", 0x04000000);
ram_size = 0x08000000;
memory_region_allocate_system_memory(ram, NULL, "taihu_405ep.ram",
ram_size);
ram_bases[0] = 0;
ram_sizes[0] = 0x04000000;
memory_region_allocate_system_memory(&ram_memories[1], NULL,
"taihu_405ep.ram-1", 0x04000000);
memory_region_init_alias(&ram_memories[0], NULL,
"taihu_405ep.ram-0", ram, ram_bases[0],
ram_sizes[0]);
ram_bases[1] = 0x04000000;
ram_sizes[1] = 0x04000000;
ram_size = 0x08000000;
memory_region_init_alias(&ram_memories[1], NULL,
"taihu_405ep.ram-1", ram, ram_bases[1],
ram_sizes[1]);
#ifdef DEBUG_BOARD_INIT
printf("%s: register cpu\n", __func__);
#endif
@ -564,8 +572,8 @@ static void taihu_405ep_init(MachineState *machine)
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
bios = g_new(MemoryRegion, 1);
memory_region_allocate_system_memory(bios, NULL, "taihu_405ep.bios",
BIOS_SIZE);
memory_region_init_ram(bios, NULL, "taihu_405ep.bios", BIOS_SIZE);
vmstate_register_ram_global(bios);
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = load_image(filename, memory_region_get_ram_ptr(bios));

View file

@ -974,8 +974,8 @@ static void ppc405_ocm_init(CPUPPCState *env)
ocm = g_malloc0(sizeof(ppc405_ocm_t));
/* XXX: Size is 4096 or 0x04000000 */
memory_region_allocate_system_memory(&ocm->isarc_ram, NULL, "ppc405.ocm",
4096);
memory_region_init_ram(&ocm->isarc_ram, NULL, "ppc405.ocm", 4096);
vmstate_register_ram_global(&ocm->isarc_ram);
memory_region_init_alias(&ocm->dsarc_ram, NULL, "ppc405.dsarc", &ocm->isarc_ram,
0, 4096);
qemu_register_reset(&ocm_reset, ocm);

View file

@ -683,28 +683,20 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
hwaddr ram_sizes[],
const unsigned int sdram_bank_sizes[])
{
MemoryRegion *ram = g_malloc0(sizeof(*ram));
ram_addr_t size_left = ram_size;
ram_addr_t base = 0;
unsigned int bank_size;
int i;
int j;
for (i = 0; i < nr_banks; i++) {
for (j = 0; sdram_bank_sizes[j] != 0; j++) {
unsigned int bank_size = sdram_bank_sizes[j];
bank_size = sdram_bank_sizes[j];
if (bank_size <= size_left) {
char name[32];
snprintf(name, sizeof(name), "ppc4xx.sdram%d", i);
memory_region_allocate_system_memory(&ram_memories[i], NULL,
name, bank_size);
ram_bases[i] = base;
ram_sizes[i] = bank_size;
base += bank_size;
size_left -= bank_size;
break;
}
}
if (!size_left) {
/* No need to use the remaining banks. */
break;
@ -712,9 +704,31 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
}
ram_size -= size_left;
if (size_left)
if (size_left) {
printf("Truncating memory to %d MiB to fit SDRAM controller limits.\n",
(int)(ram_size >> 20));
}
memory_region_allocate_system_memory(ram, NULL, "ppc4xx.sdram", ram_size);
size_left = ram_size;
for (i = 0; i < nr_banks && size_left; i++) {
for (j = 0; sdram_bank_sizes[j] != 0; j++) {
bank_size = sdram_bank_sizes[j];
if (bank_size <= size_left) {
char name[32];
snprintf(name, sizeof(name), "ppc4xx.sdram%d", i);
memory_region_init_alias(&ram_memories[i], NULL, name, ram,
base, bank_size);
ram_bases[i] = base;
ram_sizes[i] = bank_size;
base += bank_size;
size_left -= bank_size;
break;
}
}
}
return ram_size;
}