Initializing the PlayStation 2 from cold boot

Code:
 //Transfer to IOP RAM
   while(SifSetDma(&dmat, 1)==0){};
If one does not set any flag of dmat( ie :dmat.attr=0),
This will be a EE side only .
But
Code:
while(SifRpcGetOtherData(...) < 0){}
need EE and IOP cooperation .

SifSetDma implied bugs in Sony's EE kernel since RDB run at IOP side only .
Yes. If you are wondering, sceSifRpcGetOtherData uses SIFCMD APIs to request that the IOP-side SIFCMD implementation send a certain number of bytes of data from a certain address.

Not really. It also involves the EE-side DECI2 manager.
Even if not, the load on the IOP can cause timing bugs to appear.

I later on encountered a jump to address 0. The contents of the stack might suggest that last function might have been within DECI2DRU, which is one of the RDB modules.
I have made new releases of FMCB with the new libraries, so I know that they are mostly functional.
During development, I have found some issues and made amendments. I have also updated some of the comments.

Please refer to these links to get the latest samples (OSD, MBR and kernel patch):
Only the kernel patches have not been changed, since the last time.

I did not mention it anywhere, but the hdd0:__system/osd/osdmain.elf target of the MBR is an unofficial target, meant for FHDB.
The official MBR programs only have 2 targets (either osd/hosdsys.elf or osd100/hosdsys.elf), so I added a third to avoid overwriting any official files.

EDIT: I've updated the OSD Init example again.
Forgot to change the SifInitCmd() to SifInitRpc(0) at the start of main().

EDIT: OSD Initialization package has been replaced. Please refer to the post below.

EDIT 2018/06/28: OSD Initialization sample package has been replaced. The compiler warnings have been fixed.
Please use this updated file for the OSD Initialization sample: (refer to the previous post)
The post above has been updated.

For some reason, I took an older archive and uploaded it. I was wondering why the incomplete part was entirely missing, since it wasn't even implemented in the old version!
The comments have been updated and the OSD Configuration code has the "unknowns" named properly.

This new version has cleaner examples, code and explanations. So sorry for the mix-up.

EDIT 2018/06/28: OSD Initialization sample package has been replaced. The compiler warnings have been fixed.
Please use the new OSD Initialization sample package: http://www.mediafire.com/file/xpd3qt5p60k4pb6/%5B180825%5Dosd.7z/file

The model name function did not handle the return value correctly.
Please use the new MBR sample package: https://www.mediafire.com/file/ikf8hy2y0fs5j8j/[190107]mbr.7z/file

There was a typo in the shutdown() function, which is used to set the DEV9 hardware into the desired power states. That function was modelled after the code from the Japanese HDD Browser v1.00's MBR, so it used the HDIOC_IDLE code (for the ATA IDLE command). However, I missed out the parameter.

I also found that Sony changed that behaviour slightly for the PSBBN. On the surface, the documented behaviour remained the same for the three options for HDDUNITPOWER (something similar is used within the MBR):
  • NICHDD: HDD's standby timer will be set to the Sony default of 0xff (21 minutes & 15 seconds).
  • NIC: The HDD unit is put into IDLE state (it is usually still spinning).
  • A blank: The network adaptor is switched off.
For the "NIC" mode, the HDD was put into IDLE state with the ATA IDLE command, but with a standby timer value of 0. Unfortunately, that also prevented the HDD from ever transitioning into STANDBY state (which could mean a spin down, depending on the HDD).
With the PSBBN, Sony issued the ATA IDLE IMMEDIATE command instead, which will only set the HDD into IDLE state without changing the standby timer. And so the HDD will allowed to enter STANDBY state after 21 minutes and 15 seconds, as per the Sony default.

I only checked the Japanese HDD Browser, however. But I doubt Sony would have corrected it for the US HDD Browser releases because they only added the IDLE IMMEDIATE command at SDK release 2.5.

Original thread: https://assemblergames.com/threads/initializing-the-playstation-2-from-cold-boot.67794/