Skip to contentSkip to conversation

[7067] Yet more phys_ram_base elimination.

Qemu-devel Paul Brook 1 participant 1 message Apr 10, 2009

lore
Share & tools
lore

Paul Brook

author
#0 lore raw

Revision: 7067

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7067
Author:   pbrook
Date:     2009-04-10 14:29:45 +0000 (Fri, 10 Apr 2009)

Log Message:
-----------
Yet more phys_ram_base elimination.

Modified Paths:
--------------

    trunk/hw/nseries.c
    trunk/hw/omap_dss.c
    trunk/hw/onenand.c
    trunk/hw/pflash_cfi01.c
    trunk/hw/pflash_cfi02.c
    trunk/hw/ppc.c
    trunk/hw/ppc405.h
    trunk/hw/ppc405_boards.c
    trunk/hw/ppc405_uc.c
    trunk/hw/ppc4xx_devs.c
    trunk/hw/soc_dma.h
    trunk/hw/virtio-balloon.c

Modified: trunk/hw/nseries.c
===================================================================

hw/nseries.c +5 -3
@@ -1342,6 +1342,7 @@
 
     if (option_rom[0] && (boot_device[0] == 'n' || !kernel_filename)) {
         int rom_size;
+        uint8_t nolo_tags[0x10000];
         /* No, wait, better start at the ROM.  */
         s->cpu->env->regs[15] = OMAP2_Q2_BASE + 0x400000;
 
@@ -1359,7 +1360,8 @@
                                        sdram_size - 0x400000);
         printf("%i bytes of image loaded\n", rom_size);
 
-        n800_setup_nolo_tags(phys_ram_base + sdram_size);
+        n800_setup_nolo_tags(nolo_tags);
+        cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000);
     }
     /* FIXME: We shouldn't really be doing this here.  The LCD controller
        will set the size once configured, so this just sets an initial
@@ -1412,7 +1414,7 @@
     .name = "n800",
     .desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
     .init = n800_init,
-    .ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) |
+    .ram_require = (0x08000000 + 0x00018000 + OMAP242X_SRAM_SIZE) |
             RAMSIZE_FIXED,
 };
 
@@ -1420,6 +1422,6 @@
     .name = "n810",
     .desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
     .init = n810_init,
-    .ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) |
+    .ram_require = (0x08000000 + 0x00018000 + OMAP242X_SRAM_SIZE) |
             RAMSIZE_FIXED,
 };

Modified: trunk/hw/omap_dss.c
===================================================================

hw/omap_dss.c +24 -22

73 lines not on this page · raw message

Modified: trunk/hw/onenand.c
===================================================================

hw/onenand.c +1 -1
@@ -642,7 +642,7 @@
     s->otp = memset(qemu_malloc((64 + 2) << PAGE_SHIFT),
                     0xff, (64 + 2) << PAGE_SHIFT);
     s->ram = qemu_ram_alloc(0xc000 << s->shift);
-    ram = phys_ram_base + s->ram;
+    ram = qemu_get_ram_ptr(s->ram);
     s->boot[0] = ram + (0x0000 << s->shift);
     s->boot[1] = ram + (0x8000 << s->shift);
     s->data[0][0] = ram + ((0x0200 + (0 << (PAGE_SHIFT - 1))) << s->shift);

Modified: trunk/hw/pflash_cfi01.c
===================================================================

hw/pflash_cfi01.c +2 -1
@@ -519,7 +519,8 @@
 
     pfl = qemu_mallocz(sizeof(pflash_t));
 
-    pfl->storage = phys_ram_base + off;
+    /* FIXME: Allocate ram ourselves.  */
+    pfl->storage = qemu_get_ram_ptr(off);
     pfl->fl_mem = cpu_register_io_memory(0,
                     pflash_read_ops, pflash_write_ops, pfl);
     pfl->off = off;

Modified: trunk/hw/pflash_cfi02.c
===================================================================

hw/pflash_cfi02.c +2 -1
@@ -557,7 +557,8 @@
         return NULL;
 #endif
     pfl = qemu_mallocz(sizeof(pflash_t));
-    pfl->storage = phys_ram_base + off;
+    /* FIXME: Allocate ram ourselves.  */
+    pfl->storage = qemu_get_ram_ptr(off);
     pfl->fl_mem = cpu_register_io_memory(0, pflash_read_ops, pflash_write_ops,
                                          pfl);
     pfl->off = off;

Modified: trunk/hw/ppc.c
===================================================================

hw/ppc.c +1 -1
@@ -1257,7 +1257,7 @@
     NVRAM_set_lword(nvram,  0x3C, kernel_size);
     if (cmdline) {
         /* XXX: put the cmdline in NVRAM too ? */
-        strcpy((char *)(phys_ram_base + CMDLINE_ADDR), cmdline);
+        pstrcpy_targphys(CMDLINE_ADDR, RAM_size - CMDLINE_ADDR, cmdline);
         NVRAM_set_lword(nvram,  0x40, CMDLINE_ADDR);
         NVRAM_set_lword(nvram,  0x44, strlen(cmdline));
     } else {

Modified: trunk/hw/ppc405.h
===================================================================

hw/ppc405.h +3 -3
@@ -78,7 +78,7 @@
                          target_phys_addr_t offset, qemu_irq irq,
                          CharDriverState *chr);
 /* On Chip Memory */
-void ppc405_ocm_init (CPUState *env, unsigned long offset);
+void ppc405_ocm_init (CPUState *env);
 /* I2C controller */
 void ppc405_i2c_init (CPUState *env, ppc4xx_mmio_t *mmio,
                       target_phys_addr_t offset, qemu_irq irq);
@@ -91,11 +91,11 @@
 CPUState *ppc405cr_init (target_phys_addr_t ram_bases[4],
                          target_phys_addr_t ram_sizes[4],
                          uint32_t sysclk, qemu_irq **picp,
-                         ram_addr_t *offsetp, int do_init);
+                         int do_init);
 CPUState *ppc405ep_init (target_phys_addr_t ram_bases[2],
                          target_phys_addr_t ram_sizes[2],
                          uint32_t sysclk, qemu_irq **picp,
-                         ram_addr_t *offsetp, int do_init);
+                         int do_init);
 /* IBM STBxxx microcontrollers */
 CPUState *ppc_stb025_init (target_phys_addr_t ram_bases[2],
                            target_phys_addr_t ram_sizes[2],

Modified: trunk/hw/ppc405_boards.c
===================================================================

hw/ppc405_boards.c +26 -26

166 lines not on this page · raw message

Modified: trunk/hw/ppc405_uc.c
===================================================================

hw/ppc405_uc.c +27 -40

147 lines not on this page · raw message

Modified: trunk/hw/ppc4xx_devs.c
===================================================================

hw/ppc4xx_devs.c +8 -8
@@ -855,7 +855,7 @@
                                target_phys_addr_t ram_sizes[],
                                const unsigned int sdram_bank_sizes[])
 {
-    ram_addr_t ram_end = 0;
+    ram_addr_t size_left = ram_size;
     int i;
     int j;
 
@@ -863,24 +863,24 @@
         for (j = 0; sdram_bank_sizes[j] != 0; j++) {
             unsigned int bank_size = sdram_bank_sizes[j];
 
-            if (bank_size <= ram_size) {
-                ram_bases[i] = ram_end;
+            if (bank_size <= size_left) {
+                ram_bases[i] = qemu_ram_alloc(bank_size);
                 ram_sizes[i] = bank_size;
-                ram_end += bank_size;
-                ram_size -= bank_size;
+                size_left -= bank_size;
                 break;
             }
         }
 
-        if (!ram_size) {
+        if (!size_left) {
             /* No need to use the remaining banks. */
             break;
         }
     }
 
+    ram_size -= size_left;
     if (ram_size)
         printf("Truncating memory to %d MiB to fit SDRAM controller limits.\n",
-               (int)(ram_end >> 20));
+               (int)(ram_size >> 20));
 
-    return ram_end;
+    return ram_size;
 }

Modified: trunk/hw/soc_dma.h
===================================================================

hw/soc_dma.h +1 -1
@@ -110,5 +110,5 @@
 static inline void soc_dma_port_add_mem_ram(struct soc_dma_s *dma,
                 ram_addr_t offset, target_phys_addr_t virt_base, size_t size)
 {
-    return soc_dma_port_add_mem(dma, phys_ram_base + offset, virt_base, size);
+    return soc_dma_port_add_mem(dma, qemu_get_ram_ptr(offset), virt_base, size);
 }

Modified: trunk/hw/virtio-balloon.c
===================================================================

hw/virtio-balloon.c +3 -1
@@ -94,7 +94,9 @@
             if ((addr & ~TARGET_PAGE_MASK) != IO_MEM_RAM)
                 continue;
 
-            balloon_page(phys_ram_base + addr, !!(vq == s->dvq));
+            /* Using qemu_get_ram_ptr is bending the rules a bit, but
+               should be OK because we only want a single page.  */
+            balloon_page(qemu_get_ram_ptr(addr), !!(vq == s->dvq));
         }
 
         virtqueue_push(vq, &elem, offset);