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

Enable EE UART #68

Open bignaux opened 2 years ago

bignaux commented 2 years ago

Be able to debug via a real serial link is vital. We need to port the old driver : https://github.com/rickgaiser/linux/blob/75027f334badf119f707e3b037c7df3698702ad5/drivers/tty/serial/ps2_uart.c and eventually add support to get early printk, in : https://github.com/frno7/linux/blob/ps2-main/arch/mips/boot/compressed/dbg.c The video driver will never give us the ability to have a console. besides the fact that it requires a high resolution screen.

frno7 commented 2 years ago

Yes, a serial console can be helpful if one has soldered its pins. I suppose it’s a fairly straight-forward, although I’m unable to test it myself.

AKuHAK commented 2 years ago

Yes, a serial console can be helpful if one has soldered its pins. I suppose it’s a fairly straight-forward, although I’m unable to test it myself.

You can test serial output in PCSX2. The emulator will handle sio_ prints correctly. Is there an easy way to switch from GS console to EE UART console? I have SCPH-70003 with EE UART, so I can test it also on a real console, but currently, PCSX2 doesn't output anything on serial.

Also, currently, the GS debug console is hardcoded to some values: https://github.com/frno7/linux/blob/de37b463522983681ec7fd3530119f36ec63789f/arch/mips/boot/compressed/dbg.c#L626-L648 Can you comment on how to calculate these values? If I want to switch from 1920x1080 to some low res mode?

frno7 commented 2 years ago

You can test serial output in PCSX2. The emulator will handle sio_ prints correctly.

Good to know, thanks!

Is there an easy way to switch from GS console to EE UART console? I have SCPH-70003 with EE UART, so I can test it also on a real console, but currently, PCSX2 doesn't output anything on serial.

Well, the UART isn’t implemented yet. This issue is about doing it. I think it’s a reasonable good first issue for a newcomer trying out kernel programming. :-)

Also, currently, the GS debug console is hardcoded to some values: https://github.com/frno7/linux/blob/de37b463522983681ec7fd3530119f36ec63789f/arch/mips/boot/compressed/dbg.c#L626-L648

Can you comment on how to calculate these values? If I want to switch from 1920x1080 to some low res mode?

Sure, I set an appropriate video mode using the fbset command, or /sys/class/graphics/fb0/mode, and read the registers explained in the wiki article about examining and manipulating Graphics Synthesizer registers. At the time the values were probably printed in hexadecimal, and thereby easier to copy-paste for this particular case. Nowadays they are symbolic.

I thought this GS console would never be merged, but Maciej W. Rozycki suggested it might be, in the post [PATCH 094/120] MIPS: PS2: FB: Frame buffer driver for the PlayStation 2.

My responses are slow due to travelling.

frno7 commented 2 years ago

@AKuHAK, see also issue #9 for some ideas on how to improve early printk using the Graphics Synthesizer. More specifically its first item listed, for your case. :-)

frno7 commented 2 years ago

Can you comment on how to calculate these values? If I want to switch from 1920x1080 to some low res mode?

@AKuHAK, I could mention that when examining GS registers their values are impossible to read from the GS hardware itself, as these are write-only by hardware design. To solve this, the Linux kernel maintains a set of software shadow-registers that are readable by sysfs in the /sys/devices/platform/gs/registers/ directory. These GS shadow-registers are updated by the kernel whenever the hardware registers are updated, giving the illusion GS registers are freely both readable and writable.

AKuHAK commented 1 year ago

For the records here low level EE SIO description in u-boot project: https://github.com/jur/ps2-u-boot/compare/jur:ps2-u-boot:22a240c32c1340183fce12867ae5f8736b92a638...master#diff-03eceba5b4bd071d7366a84ab693ee313d9da7f6fe564308aaedf851dee89875R24 also has low level IDE specs

frno7 commented 1 year ago

@AKuHAK, thanks! I believe the IDE is a standard parallel ATA interface, although I’m unsure about its exact variant. The main complication is its DMA, needing bounce buffers, detailed in issue #18.