#3849 closed defect (fixed)

Fix PSIM memory map

Reported by: Sebastian Huber Owned by: Joel Sherrill <joel@…>
Priority: normal Milestone: 5.1
Component: arch/powerpc Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

b08278e/rtems leads to the following run-time error on PSIM:

BATs must not overlap; area 0x08000000..0x09000000 hits DBAT 0
BATs must not overlap; area 0x0c000000..0x0d000000 hits DBAT 0

The RAM overlaps with the PCI area:

  /*
   * Setup BATs and enable MMU
   */
  /* Memory */
  setdbat(0, 0x0<<28, 0x0<<28, 1<<28, _PAGE_RW);
  setibat(0, 0x0<<28, 0x0<<28, 1<<28,        0);
  /* PCI    */
  setdbat(1, 0x8<<24, 0x8<<24, 1<<24,  IO_PAGE);
  setdbat(2, 0xc<<24, 0xc<<24, 1<<24,  IO_PAGE);

Increasing the RAM size to 256MiB (0x10000000) on PSIM breaks also the shared memory support:

typedef struct {
  /* 0x0c000000 - 0x0c007FFF - AMD 29F040 */
  volatile uint8_t Flash[ 512 * 1024 ];

  /* 0x0c080000 - 0x0c0FFFFF - NVRAM/NVRAM */
  volatile uint8_t nvram[ 512 * 1024 ];

  /* 0x0c100000 - 0x0c100007 - NVRAM/RTC */
  psim_rtc_t RTC;

  /* 0x0c100008 - 0x0c10000F - NVRAM/RTC */
  uint8_t gap1[8];

  /* 0x0c100010 - 0x0c10001b - System V IPC Semaphore */
  psim_sysv_sem_t Semaphore;

  /* 0x0c10001c - 0x0c10001f - NVRAM/RTC */
  uint8_t gap2[4];

  /* 0x0c100020 - 0x0c10005F - Ethernet */
  volatile uint8_t Ethtap[ 64 ];

  /* 0x0c100060 - 0x0c10FFFF - NVRAM/RTC */
  uint8_t gap3[65440];

  /* 0x0c110000 - 0x0c12FFFF - System V IPC Shared Memory */
  uint8_t SharedMemory[ 128 * 1024 ];

  /* 0x0c130000 - 0x0c170000 - OpenPIC IRQ Controller */
  volatile uint8_t OpenPIC[ 256 * 1024 ];

} psim_registers_t;

Proposed solution is to adjust the memory map so that 256MiB of RAM are supported. Probably needs changes in rtems-tools.

Change History (3)

comment:1 Changed on Mar 5, 2020 at 10:58:03 PM by Joel Sherrill

The code posted here misses the most important part -- the simulator device tree (https://git.rtems.org/rtems-tools/tree/tester/rtems/testing/bsps/psim-device-tree). All of the device addresses start with 0x0c000000 which was OK when the RAM was smaller. But increasing the RAM to 256MB (0x10000000) resulted in the RAM overlapping the devices. The simplest option I see is to change the leading 0x0c... to 0xfc... in all device addresses and avoid the conflict.

As best I can tell, the set of changes is pretty small:

  • Change rtems-tools/tester/testing/bsps/psim-device-tree to use 0xFC for all devices. This reconfigures the "hardware"
  • Change rtems/bsps/powerpc/psim/linkcmds to change new base address of of all the devices which are at the symbol PSIM
  • Delete rtems/bsps/powerpc/start/device-tree and update the BSP README to note where the device tree file is. Also update the README to note that you don't need a modified gdb since the modifications have been in since the last century and no one knows the papyrus BSP anymore. I can't even remember it.
  • Change rtems/bsps/start/bspstart.c to fix 0x0c to 0xfc in the PCI setdbat calls. Note: I don't remember how a base address is broken down to be passed in

I think that's it.

comment:2 Changed on Mar 6, 2020 at 3:27:01 AM by Joel Sherrill <joel@…>

In 097ea1e/rtems:

psim: Rework device tree so devices do not conflict with 256MB RAM

updates #3849.

comment:3 Changed on Mar 6, 2020 at 3:29:17 AM by Joel Sherrill <joel@…>

Owner: set to Joel Sherrill <joel@…>
Resolution: fixed
Status: newclosed

In 3833c39/rtems-tools:

psim-device-tree: Rework so devices do not conflict with 256MB RAM

closes #3849.

Note: See TracTickets for help on using tickets.