Ticket #3322: qemu_powerpc_largememory.diff

File qemu_powerpc_largememory.diff, 2.4 KB (added by Eric Tremblay, on Mar 19, 2018 at 3:09:27 PM)

Corrected comments and removed unnecessary label in assembly file.

  • c/src/lib/libbsp/powerpc/shared/start/start.S

     c/src/lib/libbsp/powerpc/shared/start/start.S      | 17 +++++++++++++++++
     c/src/lib/libbsp/powerpc/shared/startup/bspstart.c | 18 ++++++++++++++++++
     2 files changed, 35 insertions(+)
    
    diff --git a/c/src/lib/libbsp/powerpc/shared/start/start.S b/c/src/lib/libbsp/powerpc/shared/start/start.S
    index 729c89c40b..efc6de42de 100644
    a b __rtems_entry_point: 
    9393        mtspr   IBAT0L,r8
    9494        mtspr   IBAT0U,r11
    9595        isync
     96/*   Map section where residual is located if outside
     97 *   the first 256Mb of RAM.  This is to support cases
     98 *   where the available system memory is larger than
     99 *   256Mb of RAM.
     100 */
     101    mr r9, r1 /* Get where residual was mapped */
     102    lis r12,0xf0000000@h
     103    and r9,r9,r12
     104    cmpi 0,1,r9, 0
     105    beq enter_C_code
     106    isync
     107    ori r11,r9,0x1ffe
     108    mtspr DBAT1L,r8     /* N.B. 6xx (not 601) have valid */
     109    mtspr DBAT1U,r11    /* bit in upper BAT register */
     110    mtspr IBAT1L,r8
     111    mtspr IBAT1U,r11
     112    isync
    96113
    97114/*
    98115 * we now have the 1st 256M of ram mapped with the bats. We are still
  • c/src/lib/libbsp/powerpc/shared/startup/bspstart.c

    diff --git a/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c b/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c
    index 5a97cc8531..1b5f69060b 100644
    a b void bsp_start( void ) 
    300300   */
    301301  _BSP_clear_hostbridge_errors(0 /* enableMCP */, 0/*quiet*/);
    302302
     303  if (BSP_mem_size > 0x10000000)
     304  {
     305    /* Support cases of system memory size larger than 256Mb.
     306     *
     307     * We use BAT3 in order to obtain access to the top section of the RAM.
     308     * We also need to do this just before setting up the page table because
     309     * this is where the page table will be located.
     310     */
     311    const unsigned int mem256Count = (BSP_mem_size / 0x10000000);
     312    const unsigned int BAT3Addr    = ((BSP_mem_size % 0x10000000)  ?
     313                                       (mem256Count     * 0x10000000) :
     314                                      ((mem256Count-1) * 0x10000000));
     315    setdbat(3, BAT3Addr, BAT3Addr, 0x10000000, IO_PAGE);
     316#ifdef SHOW_MORE_INIT_SETTINGS
     317    printk("Setting up BAT3 for large memory support. (BAT3 --> 0x%x)\n", BAT3Addr);
     318#endif
     319  }
     320
    303321  /* Allocate and set up the page table mappings
    304322   * This is only available on >604 CPUs.
    305323   *