Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Rairii

macrumors newbie
Original poster
Feb 22, 2024
18
22
Some thoughts:
  • New World Grackle+Paddington systems don't have usb mass storage drivers in the bootrom
  • Newer uni-north systems do have such drivers
  • One can add/replace drivers by nvram
  • Thus in theory one could bring in the entire USB stack from a slightly later system's bootrom (I looked, the low level USB stack in fcode is basically identical, save for one function being changed to add the extra USB mass storage/audio support when enumerating devices)

So this is possible in theory, I'm not sure how to do this (I'm more comfortable with C!).

Has someone else managed to do this yet? It would be nice for rapid testing on my lombard (without needing to acquire a scsi cable and scsi emulator), currently I'm just booting into OSX single user, mounting USB and copying binary to hd...
 

joevt

Contributor
Jun 21, 2012
6,767
4,102
I don't think anyone has tried.

I can dump the Old World and New World ROMs, extract the fcode images, and convert them to Forth.

Next step is to compile them back to fcode that will be compatible with older ROMs. This probably requires some minor updates to the tokenizer (toke).

Besides USB, other packages may need to be included (deblocker, disk-label, mac-parts, etc.) if you want to access files on HFS+ volumes etc. But since you're talking about New World ROMs, that might not be a problem. Those other fcode images would be useful for Old World Macs.

All the new fcode will need to be loaded from somewhere, maybe from the ROM of a PCI card or some blocks on a supported ATA or SCSI disk because nvram is not large enough for everything. Use a disk that is available before probe-all because you want the USB fcode to be installed by the probing process. The probably includes only disks that are connected to mac-io.

They should be loaded to virtual memory (claim in memory and mmu and map in mmu) instead of the Open Firmware dictionary (allot) or the Open Firmware heap (alloc-mem) because those are limited and there space will be taken when the new fcode images are loaded/compiled into the dictionary.

Once the fcode is loaded, some part if it will be executed to setup/patch everything.

probe-slots may need to be patched to load the USB fcode image. Or maybe you just need to change >fcfiles in @startvec to insert the new USB OHCI driver into the list of fcode images (and any other fcode images that need to be loaded with byte-load-file).

Since you're talking about New World Macs, it may be possible to put the new fcode into the ROM itself. That would be a last step.

Here's some links:
https://forums.macrumors.com/thread...eige-power-macintosh-g3.2303689/post-30082400
https://forums.macrumors.com/thread...eige-power-macintosh-g3.2303689/post-32937887
https://forums.macrumors.com/threads/7800-gt-with-64k-rom-no-go.2425522/post-33142717

One issue with New World Grackle+Paddington systems is that even though they don't support USB mass storage, they may support USB keyboard/mouse in Open Firmware so there will be some issue with working around that. It would be easier to start with an Old World Mac in that case. But you said the fcode USB stack is basically identical between the Open Firmware version that has the mass storage driver and the Open Firmware version that doesn't so maybe just the mass storage bits needs to be added.
 

Rairii

macrumors newbie
Original poster
Feb 22, 2024
18
22
yeah, I was hoping just being able to get the mass storage driver in would be enough, but one would also need to patch the USB deviceprobe function to add the support there too. I think I've seen patches to existing functions done in nvramrc but again, no idea how to proceed there.

By the way, slightly offtopic, but I noticed your set of bootrom dumps didn't have these. I dumped the bootroms from my iBook G3 Snow (PowerBook4,3) and Lombard, by using small tool after booting from linux (that was interesting in itself, when Debian PPC moved to grub the APM sector size in the ISO was changed to 2048, and Lombard (and probably other new world Grackle+Paddington systems) have 512 byte sector size hardcoded in the APM parser).

I tried using your tools and notes to dump the fcode but I wasn't able to get something like the "Part2.of" in your bootrom disassemblies.

There's also a dump of the iMac G3 (bondi blue) bootrom in the MAME sets (imac.zip, find it wherever you find MAME ROMs).
 

Attachments

  • bootroms.zip
    1.3 MB · Views: 12

joevt

Contributor
Jun 21, 2012
6,767
4,102
yeah, I was hoping just being able to get the mass storage driver in would be enough, but one would also need to patch the USB deviceprobe function to add the support there too. I think I've seen patches to existing functions done in nvramrc but again, no idea how to proceed there.
First figure out what needs to be patched, then you can figure out how to patch it.

Try to discover what's in the device tree before probe-all gets called (using nvramrc with install-console dev / ls probe-all banner). Best if you can get the output to serial port if the built-in buffer isn't big enough.

By the way, slightly offtopic, but I noticed your set of bootrom dumps didn't have these. I dumped the bootroms from my iBook G3 Snow (PowerBook4,3) and Lombard, by using small tool after booting from linux (that was interesting in itself, when Debian PPC moved to grub the APM sector size in the ISO was changed to 2048, and Lombard (and probably other new world Grackle+Paddington systems) have 512 byte sector size hardcoded in the APM parser).
My flashrom utility for Mac OS X can probably dump the ROMs also. For grackle Macs, you probably need to avoid using it to access the flash directly (the internal programmer), and use the anymem programmer instead which just maps the ROM. The internal programmer works on later Macs (G4s, G5s) after you hold the programmer's button at boot.

I tried using your tools and notes to dump the fcode but I wasn't able to get something like the "Part2.of" in your bootrom disassemblies.
There's also a dump of the iMac G3 (bondi blue) bootrom in the MAME sets (imac.zip, find it wherever you find MAME ROMs).
I'll have a look at the ROMs later. I think all the ROMs are packaged differently. If you sort them in order of build date, you can see how the method changes over time. The B&W G3 is a single compressed image. Later versions have multiple compressed parts.
 

joevt

Contributor
Jun 21, 2012
6,767
4,102
The Bondi Blue and Lombard ROMs are similar in age to the B&W G3 ROM so I used the B&W G3 rom method to decompress those.

The iBook (Snow) is similar in age to the Power Mac G4 (Mirrored Drive Doors) ROM so I used that method to decompress the multiple images (but the list of images for the iBook begins at offset 0x18 of the Rom Image or Recovery parts whereas the G4 has only one image which is listed at offset 0x20).

All three ROMs appear to include all the names for the words, unlike the B&W G3 ROM so it should be pretty easy to understand how they do USB.

The first Mac ROM that I have that includes USB mass storage in Open Firmware is PowerBook G3 (FireWire) Pismo.
https://68kmla.org/bb/index.php?thr...-imac-g3-from-usb-challenge.46660/post-521895

Lombard is interesting because it has code to look for a usb-ms-class package but doesn't include the package? If you have a Lombard, check the device tree and the Open Firmware version number to verify.
 

Attachments

  • Lombard, Bondi Blue, Snow.zip
    1.8 MB · Views: 13

joevt

Contributor
Jun 21, 2012
6,767
4,102
Maybe I decompressed the Lombard rom incorrectly. It may have additional compressed parts.
 

joevt

Contributor
Jun 21, 2012
6,767
4,102
Maybe I decompressed the Lombard rom incorrectly. It may have additional compressed parts.
Nope. The other 3 parts are not Open Firmware related as far as I can tell.
 

Attachments

  • updates for Lombard worksheet and OF version list.zip
    5.5 KB · Views: 11

Rairii

macrumors newbie
Original poster
Feb 22, 2024
18
22
Lombard is interesting because it has code to look for a usb-ms-class package but doesn't include the package? If you have a Lombard, check the device tree and the Open Firmware version number to verify.
That seems to be completely unused dead code on Lombard, the main USB stack doesn't call it at all.
 

joevt

Contributor
Jun 21, 2012
6,767
4,102
That seems to be completely unused dead code on Lombard, the main USB stack doesn't call it at all.
That just means some other USB related parts were also removed or weren't ready in time for that ROM. Compare probe-config of Lombard with Pismo.

Actually, the Lombard ROM mentions Pismo. I wonder if you could just update the Pismo ROM to Lombard ROM? (keep nvram and config areas).
Correction: The Lombard ROM doesn't mention other Macs. The Pismo ROM mentions these:
- iMac G3, iMac DV, iMac DV+, iMac DV SE - Kihei, P7
- iBook - P1
- Power Mac G4 (AGP Graphics) - Sawtooth
- PowerBook (FireWire) - Pismo
- Power Mac G4 Cube - Trinity
- ????? - Apogee
The Pismo ROM doesn't mention Lombard so it's probably not appropriate to use the entire Pismo ROM for Lombard.

There's a Open Firmware Universal Serial Bus document at https://www.openfirmware.info/Bindings
I haven't compared Apple's implementation with that.
 

Attachments

  • Open Firmware PowerBook G3 Pismo.zip
    854.1 KB · Views: 11
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.