frno7 / linux

Linux 2.2, 2.6, 3.x, 4.x and 5.x kernels for the PlayStation 2.
Other
86 stars 5 forks source link

Accurately model RAM and ROM configurations #72

Open frno7 opened 2 years ago

frno7 commented 2 years ago

The read-only memory (ROM) and random-access memory (RAM) configurations vary between different models of PlayStation 2 hardware. A single, simplified, configuration is currently used for all models:

https://github.com/frno7/linux/blob/59a11ab94a4020408c7dfbf92bd55778e17b43f1/arch/mips/ps2/memory.c#L41-L43

See https://github.com/frno7/linux/issues/28#issuecomment-1105913884 for additional details.

AKuHAK commented 2 years ago

This issue comment and this comment should probably be moved here.

AKuHAK commented 2 years ago

Also few notes about EE RAM https://github.com/frno7/linux/blob/59a11ab94a4020408c7dfbf92bd55778e17b43f1/arch/mips/ps2/memory.c#L41 Here 0x02000000 represents available EE RAM (32Mb). Just would like to mention that this is also not a fixed value. PSX DESR can operate 64Mb of RAM and PS2Tool can operate 128Mb of RAM. Part of this code is represented here: https://gitlab.com/ps2max/linux/linux-2.2.1/-/blob/master/arch/mips/ps2/sbios/init.c#L38-L43

#ifdef CONFIG_T10000_MAXMEM
    ps2_bootinfox.maxmem = 128;
#else /* CONFIG_T10000_MAXMEM */
    ps2_bootinfox.maxmem = 32;
#endif /* !CONFIG_T10000_MAXMEM */
    ps2_bootinfox.maxmem = ps2_bootinfox.maxmem * 1024 * 1024 - 4096;

Here maximum RAM is defined in config, but it is possible to determine console type by proceeding with some commands.

Also, I noticed that last 4096 bytes of RAM is not usable for some reason, so probably you should map 0x02000000 - 0x10000 = 0x01FFF000