### Author Topic: Temporarily disabling devices from the device tree in Open Firmware  (Read 8549 times)

#### nanopico

• Moderator
• Platinum Member (500+ Posts)
• Posts: 753
• Liked:
• Likes Given: 4
##### Temporarily disabling devices from the device tree in Open Firmware
« on: May 30, 2016, 10:38:27 AM »
So sometimes we are running into issues with unsupported hardware not setting up right, but may not really be needed.
Here is a way to temporarily disable the device so Mac OS 9 will not use or even attempt to initialize it.
From open firmware go to the device you want to disable. (word of caution if there are child devices that are needed they also won't work).

I will use the usb controller on my G3 powerbook as an example
Code: [Select]
dev /pci/usb@10" reg" delete-property" interrupts" delete-property" none" encode-string " compatible" propertydevice-end
In this case when I boot I will have no usb support.  If I reboot it will all come back.

Explanation:
The reg property give instructions for setting up and registering the device.  Clear it and no instructions.
the interrupts property indicates how many interrupts there are for the device.
The compatible property indicates what drivers the device is compatible with.
By removing and reseting these properties then OS 9 has no clue what to do with the device and pretty much skips over it.
If it ain't broke, don't fix it, or break it so you can fix it!

#### nanopico

• Moderator
• Platinum Member (500+ Posts)
• Posts: 753
• Liked:
• Likes Given: 4
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #1 on: May 31, 2016, 06:55:47 PM »
Just an fyi this does not disable child devices so if you disable something with children, then good luck having any sort of stable boot.
If it ain't broke, don't fix it, or break it so you can fix it!

#### Daniel

• Gold Member (200+ Posts)
• Posts: 307
• Programmer, Hacker, Thinker
• Liked:
• Likes Given: 5
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #2 on: May 16, 2017, 06:08:40 AM »
It appears that there is a better way to do this, but It was buried in another thread. I have found it.
Learned something new in my journey today.
I think it was asked how to delete a node from the device tree in open firmware.
I had provided some instruction somewhere on how to sort of disable and it would work for most things, but depending on how the interrupts are set up in hardware I found it can not work well.

If you can delete the node then it clears out those dependent interrupts so things are happy.

so with out further delay's here's how you can delete a node (and it deletes all the children below it as well)

I am not responsible for what you choose to do with this information.

So let's say we want to delete the mac-io node (fyi this will pretty much make your machine do pretty much nothing after this until you restart) located at /pci@f2000000/mac-io

Code: [Select]
" /pci@f2000000/mac-io" find-package drop delete-node
then just change the path to the node you want in the first part.  The space between the first " and the / is important.

• Platinum Member (500+ Posts)
• Posts: 619
• New Member
• Liked:
• Likes Given: 0
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #3 on: February 17, 2019, 08:55:51 AM »
Daniel, any way to drop the agp/@10?

Seems to give me and invalid memory access when I try:

Code: [Select]
" agp/@10" find-package drop delete-node
I picked up a 1Ghz iMac G4 with a NV18 Geforce4 MX( 0x0189 device ID ), and I've got OS 9 booting on it, but I can't seem to hack together the video drivers. The OS 9 Drivers should support the NV18( 0x0184 Device ID ), but I'm thinking the Fcode ROM must have the basic 'NDRV' nVidia used for all OS 9 compatible cards.

I have the Fcode ROM for the 0x0184, but I can't use it because the Fcode ROM built-in to the BootROM is already active for the device:

Code: [Select]
load hd:,\ppc\4mx.fcdev agp/@10800000 1 byte-load" agp/@10" open-dev to my-self800000 1 byte-load
the byte-load command returns ok, but nothing gets executed, assuming because of the BootROM Fcode.

So I need to find a way to delete the node, even if it makes the screen go dark and I have to telnet in to execute the Fcode I want to try?

#### Daniel

• Gold Member (200+ Posts)
• Posts: 307
• Programmer, Hacker, Thinker
• Liked:
• Likes Given: 5
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #4 on: February 17, 2019, 10:30:23 AM »
I think I linked the PCI DDK to you at some point. One of the useful tools it has is a tokenizer for FCode.

According to its documentation, fcode images for pci encode the vendor#, device#, and class-code in their headers. If those 3 values are different from the pci device, the fcode won't load.

I suggest changing device-tree properties to make sure those 3 values match up.

• Platinum Member (500+ Posts)
• Posts: 619
• New Member
• Liked:
• Likes Given: 0
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #5 on: February 17, 2019, 10:43:55 AM »
You have to remove the PCI Header to load the FCode ROM via the load command, so the device ID's won't matter.

OS 9 Runtime Drivers are not fooled by OF changes to the Device ID, they read it direct from the PCI Registers on the PCI card, not the Device Tree.

I need to delete the node holding the Fcode ROM for the built-in GF4MX and load my custom Fcode.

I've done it with unflashed PC Graphics cards, but the FCode in the BootROM for the card is interfering in the process.

#### Daniel

• Gold Member (200+ Posts)
• Posts: 307
• Programmer, Hacker, Thinker
• Liked:
• Likes Given: 5
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #6 on: February 17, 2019, 11:07:51 AM »

#### Daniel

• Gold Member (200+ Posts)
• Posts: 307
• Programmer, Hacker, Thinker
• Liked:
• Likes Given: 5
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #7 on: June 18, 2019, 12:49:10 PM »
My work on the sil3124 project has forced me to figure out how to do this.

If you want to load fcode that does anything actually interesting, the device node has to have an open instance as you do it. Normally this would be handled by the system when it loads fcode from roms, but doing it from the user interface takes deep magic.

Code: [Select]
load hd:,\path\to\filedev /your-device: open true ; : close ; : init load-base 1 byte-load ;" /your-device" select-dev init0 to my-self
Here is the exact incantation that I have to type every single time I want to test the fcode I am writing:
Code: [Select]
load hd:14,\sil3124.fcodedevalias s71 /pci@f2000000/pci1095,7124devalias s31 /pci@f2000000/SIL3124dev s71: open true ; : close ; : init load-base 1 byte-load ;" s71" select-devinit0 to my-self" s31" open-dev constant s31-ihdir s31/sil3124,port0/disk:,\
And then when the test invevitably fails, then I have to manually read and write chip registers to figure out where the show-stopping bug is this time. Low-level development is completely insane.

#### macStuff

• Guest
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #8 on: June 18, 2019, 07:08:05 PM »
daniel;
is there some type of OF emulation that you could run in a virtualized space to be able to cut + paste such stuff?

#### Daniel

• Gold Member (200+ Posts)
• Posts: 307
• Programmer, Hacker, Thinker
• Liked:
• Likes Given: 5
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #9 on: June 18, 2019, 07:34:32 PM »
I suppose I could load it from a file or use telnet.

For some reason I never bother to do it

#### Protools5LEGuy

• Global Moderator
• Platinum Member (500+ Posts)
• Posts: 2527
• Liked:
• Likes Given: 1133
##### Re: Temporarily disabling devices from the device tree in Open Firmware
« Reply #10 on: June 19, 2019, 04:49:31 AM »
Looking for MacOS 9.2.4

### 10 Post Recent Posts

 I linked Google's HTML5 parser [Application Development & Programming in the Classic Mac OS] OS923Today at 09:11:54 AM Where to find "OMS Midi Manager Driver"? [DAW - Digital Audio Workstation (Audio Interfaces & MIDI Hardware)] jmacdougNovember 30, 2021, 09:05:36 PM Polymer recaps [General Hardware Discussions] FBzNovember 30, 2021, 03:40:37 PM Members Introduction... time to reflect on our past that got us here :) [Welcome to Our Community - Guidelines, News, & Social Posts] DieHardNovember 30, 2021, 09:55:55 AM Syncing another DAWs [DAW (Digital Audio Workstation) General Discussions] mrhappyNovember 30, 2021, 08:20:15 AM anyone using TC Powercore in 2020? (Discontinued in 2011) [DAW (Digital Audio Workstation) General Discussions] mrhappyNovember 30, 2021, 07:36:57 AM sonnet 1.33 os9 troubles [no original cpu] [Mac CPU Upgrades] mrhappyNovember 30, 2021, 07:33:25 AM PCI GPU in an AGP PowerMac G4 [Video Cards, Monitors, & Displays] lepidotosNovember 28, 2021, 07:19:02 PM Got Bored this weekend... [Welcome to Our Community - Guidelines, News, & Social Posts] OS923November 24, 2021, 07:39:42 AM Can't paste text in ResEdit [Application Development & Programming in the Classic Mac OS] OS923November 24, 2021, 07:31:12 AM