@kas1e I probably did not have to implement anything for this so it's handled by QEMU in some way that I don't know. If the VT8231 has some bits to disable PS2 ports those are likely not emulated but if you add -device usb-kbd then QEMU will direct keyboard input to that so it should work with USB as well. I don't know if the default PS2 keyboard also gets keyboard input with -device usb-kbd but could be that both keep working. Maybe on real machine also both should work but SmartFirmware has only one input source so you can either use PS2 or USB keyboard? In any case you can test with original firmware with -device usb-kbd and if that works with your version too then maybe it's OK.
Maybe on real machine also both should work but SmartFirmware has only one input source so you can either use PS2 or USB keyboard?
On real pegasos2 if you have attached both usb-keyboard and ps/2 keyboard, the usb-keyboard is one which smartfirmware take as the input, and ps/2 is unusable and didn't work.
Quote:
In any case you can test with original firmware with -device usb-kbd and if that works with your version too then maybe it's OK.
With -device usb-kbd , while i can see with both my and original firmware that i do have:
But then who can say what keyboard works now when i type, ps/2 or usb one from smartfirmware in qemu?:) that why i were in hope to disable ps/2 to see if it will works.
But that anyway not so matter now, because issue was that keyboard was hardcoded to isa, so now i add "set it to isa only after there wasn't usb one found" , to act like original firmware, and then it works.
Now fighting with usb-mass sticks, because simple os4_stick.img, formatted in fat16 works for qemu now (i just go scsi route), but have issues with real sticks on real pegasos2.
Maybe i need to do passthrough for this exactly usb-sticks, so to try real ones on qemu where it all more easy to debug.
@all Were able to add UHCI support to original OF, so now my firmware can detect usb keyabord, and can detect usb-sticks, and put them to OF as scsi/block devices, and so i can list files on them, etc.
So far all sounds good, if not one moment : i have 3 usb sticks. 2 of them , detects fine, no problem:
But one which is JetFlash 8GB (8564:1000), while surely works fine and detects fine on windows or on same pegasos2 just via amigaos4, simple fail for me to detects from within firmware: UHCI controller executes the very first address-0 SETUP packet, but the device never gives a valid USB response, so enumeration cannot even read the descriptor. Does not matter what i tried. I compared from amigaos4's usbinfo/ranger the differences: nothing which can explain it. I compare with lspci -vvv from linux : nothing can explain it. In the datasheet on VIA's VT8231 i see nothing about USB quirks or whatever ..
Maybe anyone have any clue or experience with to where a look at ?
The difference is only that i have this stick formatted FFS, and others two (working) are Fat32 and NTFS, but that just about FS, which is not matter until enumeration take place..
@kas1e I think you should not worry about that too much. Just release the sources and let others help find it out. Rather than spending time with this one USB stick, do the missing parts of the bootstrap for which you can likely use the code from U-Boot for the Marvell Discovery development board that was once upstream and then clean up the sources to be able to put them in a repo so others can help you out with finding issues and further improve it.
@Balaton Deal with this stick, was some small issue about wrong order initialisation. As for releasing anything: sure, but it firstly should work at all :) Currently i only deal with smartfirmware itself, to be able to boots correctly with original bootstrap , and it still acts in one or another way which need to deal with. Once it will works, i can simple release just a smartfirmware part with a python script which build a new rom from original (extracting bootstrap, combine with our smartfirmware, and create new rom). This way ppls already can use it, while i will worry about bootstrap replacement, which, IMHO, will be harder part.
Currently fighting with another strange issue : when i run original firmware, then soft reset, then i can run my own fine too till workbench boot (both uses same bootstrap from bplan). If i run my firmware after cold boot : Then once i run amigaboot.of it stops/hangs after returning to its own code. No next OF call, and no exception so far. And this can be anything : CPU/cache/MSR/exception/vector state, stack/runtime convention, timer/interrupt state, or some device/platform state original firmware leaves initialized (but only after graphics boot!). And to note that bootstrap is the same bPlan's one..
Edit: issue was about missing fp exception vector together with missing msr's fp bit set, causing silent hang in allocator. Fixed this one and now need to understand how properly hands off usb stack to OS..
Edited by kas1e on 2026/5/5 9:31:10 Edited by kas1e on 2026/5/6 11:15:02
@All Good progress: USB issues gone , it was one of the VT config registers.
Also added UDMA for ATA (be it pure IDE , or sata disk via IDE2SATA adapter) together with LBA48 (originaly it was just 28) + batching for PIO if UDMA not supported on some drive, which in result mean that: originally my kickstart modules loads up for 21s (i just have debug version of modules, both radeonrx/hd ones, kernel , etc). Now, if UDMA driver detected : 3s (!). IF UDMA not detected, fallback to PIO, but improved one, which instead of 21s gives 8s, which is good too.
Also added SFS2 support of all flavors : original firmware simple list only morphos SFS version, in my one now any SFS/SFS2 can be listed/booted from. Together with that added read/listing/booting from FAT16/32 with VFAT, NTFS (!) , Linuxes (LNX, EXT2/3) and improve FFS to have support of latest ones.
Some bits were fixed in original smartfirmware like "ls" on relative block-device (before you can't "ls disk@0,0" when you in /pci@80000000/ide@c,1 for example). And fixed when you CD to any device , and do "cd non_present_anything" instead of fallback to the root it keep stays on same place.
Everything done of course on REAL pegasos2, where i upload just SmartFirmware over IKARUS (so original BPlan's bootstrap still in use).
Now, what i else want to do is:
- USB booting from massstorage - CD-USB booting - Booting from SATA PCI directly - Booting from USB stick from PCI USB card directly. - Make the GFX card in PCI bridges be visibly in firmware and usable. - Improve a bit network support (to have sane ping return, not like now, and to not died on network after one network operation as it was with original)
Once that done, clean the debug, and first release with proper scripts so one can use it on original peg2 via uploading only SF part via Ikarus, or one can use full rom which will be done by script which will take original pegasos2.rom, extract bootstrap from and build a ready rom for you, so to play with QEMU.
Then, it will time to somehow think how better to prepare reflashing work (at first with original bootstrap) , so to have basics works. Because flash on pegasos is TSOP32, which you can't easyly solder-resolder many times, so this need to be thinks of how to do it all correctly ..
But if anyone want to play with it right now , i can put it now too, just ask.
@all Was another 2 hardworking days : imroved UHCI, so USB booting works from pure VIA's ports of pegasos2 + does not matter on what port you attach keyboard/mouse it works in any now.
Then played with 2 new PCI USB cards : one is NEC based, another one is VIA based. The NEC one have ability to work as EHCI, and as companion OHCI, and VIA one same can work as EHCI and as companion an UHCI.
So, starting from NEC one, and default SmartFirmware's OHCI was very dumb, and detect nothing properly, so starting writing new one, and meet with all sort of possible usb issues about everything, until realized that i better take the proved to works one from latest UBoot and integrate it to smartfirmware. Then while OHCI start to works, i can detect sticks attached to it , but it still acts a bit strage, need to do some more debugging.
Also while was at it , borrowed from Uboot more harder EHCI driver, so now SmartFirmware have all 3 : OHCI, UHCI and EHCI. While really necessary is the UHCI one (as pegasos's VIA's usb is UHCI) , still have OHCI and EHCI can find it use by some one.
Next stage : PCI SATA. Once i will be able to boot from, it will means no more needs of anything connected to IDE ports anymore, even through IDE2SATA adapters..