• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

SE/30 soft power

zuiko21

Well-known member
I've been thinking about this for a long time... my idea is to keep the SE/30 (or any other Mac without soft-power) permanently switched on, but plugged into an external switching box, which would be little more than a relay, a flip-flop and a tiny PSU for them.

This box needs two control lines from the Mac: the turn-on signal comes from the ADB keyboard, of course. Since the SE/30 has two ADB connectors, and only one (keyboard & mouse in series) is normally used, this is quite easy to get -- provided the PSW lines on both ports are tied together, which they aren't... but that's easily solved by a jumper wire. Other Macs with a single ADB port may use a small extension in order to derive this signal -- again an easy task, because ADB uses the same 4-pin Mini-DIN connector as S-Video (S-VHS)

Then we need the turn-off signal... Mac II series computers' PSUs use a /PFW line from the start-up circuit, which in turn is derived from VIA2's PB2 line. Upon issuing the Shutdown command, once the Mac is ready to be turned off, this line goes from +5 V down to 0, signalling the PSU to turn off. Then, the Mac will show the It's safe to switch off your Macintosh message, but if the PSU/start-up circuit works as intended, it won't go that far ;) I tried this on a IIx (which in a way has similar hardware as the SE/30, plus the very same ROM) with a hacked PSU in order to stay on regardless of the /PFW line status, and PB2 went to zero as soon as the aforementioned message appeared -- as expected.

Back to the SE/30, theoretically this line should be present at pin 81 (C1) of the PDS slot, but actually won't reach there -- quite understandable since the SE/30 has no use for it. Then I searched for a point in the mobo directly connected to VIA2's PB2, and I found it. The only remaining thing would be taking it outside -- pin 5 of the external floppy connector is unused and not connected, so it seems quite suitable for the task.

I have marked my SE/30 board with the location of the required jumpers: there should be one wire from P to 5, and another one joining both K points.



For obvious reasons, I have designed the external box to stay on whenever the control link is lost. One of the ground pins on the FDD connector is used as a presence detect line.

But then I repeated the IIx test on the SE/30 and... that damned PB2 line stays on forever, even with the It's safe to switch off... on display! 8-o

Not sure if I'm missing anything... I am aware that, despite sharing the same ROM code, the SE/30, IIx and IIcx give different Gestalt codes -- it's computed from a couple of hardwired VIA ports. Maybe the programmed PB2 value on shutdown is taken from those bits? Or is it simply disabled upon detecting unsupported (soft-power wise) hardware? I was using a custom, ahem, IIci ROM anyway ;) If the reason behind is the latter, it shouldn't be too difficult to write a small system extension in order to enable this soft-power feature, but I have zero experience writing Mac-specific software at all :(

Any ideas?

 

techknight

Well-known member
I dont have any macintosh hardware guides in front of me, but maybe that line is addressable via the hardware somewhere.... If this is the case, hell a simple hook in the OS, extension as you say, or for the less-elite like me, a regular old program to take the place of the one in the apple menu items. executes and cuts out the power supply.

 

bbraun

Well-known member
Maybe it's just because I've got gestalts stuck in my cache... But, the gestaltHardwareAttr gestalt can return a gestaltHasSoftPowerOff value. It's possible the Finder is doing a gestalt check to see if soft poweroff exists and not toggling VIA2 PB2 if it doesn't believe that functionality is available.

Seeing as how I now have gestalt altering code, I can see if changing this prevents a soft power off machine from powering off on shutdown.

 

bbraun

Well-known member
I tested it, and by changing that value on my IIx, the IIx no longer soft powers off. It comes up with the screen to turn the power off or restart. To me, that says the Finder is not toggling the VIA when that gestalt says no softpoweroff is available.

I apologize for the hackiness of this, but it was just a quick test. This is a minor change from the SYSVInit from this thread. This INIT overrides the gestaltHardwareAttr gestalt selector and returns a hard coded value. The gestaltHardwareAttr returns a bitmask of machine capabilities, so the hard coded value will not work for all machines. The value I'm returning is the IIx's value, which should be the same as the SE/30's, except with softpower added.

So, if you're running on an SE/30, just copy the SYSVInit into your extensions and reboot.

If you happen to run it on something other than an SE/30, and you don't want to rebuild the project in CodeWarrior, here's an alternate path to finding the proper gestalt value for your machine and updating the INIT:

The ANSI Console app in the "sysv check" folder will print out the current value, first in decimal, then hex. The second value is what's interesting. Then open the SYSVInit (again, sorry about the naming, this is just a hack on a previous hack...) in resedit, and open the GSLT resource, and look for the value 0008 089B. That's the hardwareAttr gestalt value for the IIx, and the 0008 is the bit enabling softpower. So modify that 32bit value (0008089B) to be whatever your machine's hardwareAttr gestalt is from the "sysv check" app, with a bitwise and of 00080000. Hopefully that made sense. If not, run the ANSI Console app and tell me what it says, then I can make a new INIT for you.

I'm not entirely sure how the machine determines whether the softpower bit should be set, although I suspect early in the boot process it is based off the machine type, which as you've said is based off wired pins of one of the VIAs. If this INIT works for you, and you think it's OK to require the INIT for your soft power off to work, then all is good. If not, I guess we need to dig a little deeper to figure out how this value is set, and whether you could make a hardware change, perhaps reconfiguring your VIA pins to pretend to be a IIx...

 

bbraun

Well-known member
Sorry what I posted was such a mess. Here is something that should enable the soft power off gestalt for all machines. No mucking around with resedit and all that.

 

zuiko21

Well-known member
Since I'd like to keep the hardware minimally modified, your idea of using a system extension in order to enable the soft-power VIA bit is more than adequate and I have to say a BIG THANK YOU!!!

Now, here come the bad news: it doesn't work on the SE/30 :( I tried first the "universal" second version, but the testpoint keeps at 5V all the time... then I did the ResEdit mod to the first version -- the sysv check app said:

Code:
Response: 2203 89b
so I changed the resource value to 220B 089B -- let's hope I did the binary math right! But again, to no avail...

Let's hope that line isn't just hardwired to 5V...

Anyway, there are some good news today: I'm posting this from the SE/30!!! connected to WiFi Internet with the help of my sister's sparkling MacBook Pro. This site works surprisingly well on Netscape 3.01, I downloaded the SysV extensions on it. I'm using System 7.5.5, OpenTransport 1.1, an (expensive) Asante MacNIC II/E card and 20M of RAM. TCP/IP uses DHCP.

On the MBP side, there's Lion (10.7.3) and Internet Sharing from AirPort to Ethernet -- the latter set manually, with the Airport IP as Router/Gateway. The WiFi itself comes from my MacMini sharing my CableModem Internet connection (!)

Back to our problem, I may try on the IIx (with a hacked PSU) connecting the VIA port to the NMI line, and checking with MACSbug what code is being executed at the very moment of shutdown...

se30wifi.PNG

 

bbraun

Well-known member
No problem, and it's unfortunate it didn't end up working for you. Oh well, it was worth a shot.

Congrats on getting the SE/30 up and online!

 

Trash80toHP_Mini

NIGHT STALKER
I'm more than a bit lost now! :-/ But I am very tired . . .

I'm trying to collect all ATX Hack Related Info and links to all the contributing topics into one thread.

This isn't it yet: 68k Soft/Hard 68k Power and ATX conversions . . .

But I hope to get somewhere near there soon.

You guys have piqued my interest in the Via hack approach to Mac IDs. Am I to understand that it might be possible to do a hardware hack that could convince my IIsi/ROM combo that it's actually a more useful Mac with more flexible memory mapping for PseudoSlottage?

TIA for you patience, this is an entirely new area for me.

 

techknight

Well-known member
For me as well. I am DEFINITELY NOT a low level macintosh programmer, so most of bbraun's posts are way over my head, because he is using hardware/OS API specific mnemonics that I dont quite understand. At most I ran a BASIC compiler on the macintosh, like RealBasic which you dont need to know any of this stuff and wrote mac software this way.

FutureBasic is alot more low-level and you have to know the API and the entire toolbox to use this software, much like codewarrior, So you can compile low level extensions, drivers, etc.. RealBasic takes all that out of it, kinda like VisualBasic did for windows, but at the cost of compiling drivers and extensions. Maybe control panels, but thats it.

But i do follow along. :)

 

bbraun

Well-known member
According to the Guide to the Macintosh Family Hardware, Chapter 4 on VIAs, various machines use bits of the one or both VIAs to determine what machine they're running on. For instance, on the II and IIx, bit 6 of VIA1 data register A indicates a II if low, a IIx if high. I've only got the 2nd edition of the book, so it doesn't cover the IIsi... But anyway, if you've got the documentation for the IIsi, you should be able to figure out which bits (and hopefully the subsequent pins) that provide the machine identification. The thing is, they don't provide the full definition of the machine. Presumably the software can determine roughly what class machine it is running on from other aspects, and only use the CPU ID bits of the VIAs to provide disambiguation when it's otherwise too difficult to determine. For example, you can't use VIA pins to convince anything you've got a IIfx when you've really got a IIx. But you could probably convince something you've got a II.

But, while reading that chapter, I came across this, documenting the functions of VIA2 on the SE/30/II/IIx/IIcx:

It provides a signal (/POWEROFF) that shuts off the power supply. (In the Macintosh SE/30, this signal goes to the processor-direct slot only. An expansion card can use this signal to determine that it is about to lose power.)
Then later in the section about VIA2 data register B:

When the v2PowerOff bit is set to 0, the power supply is shut off in the Macintosh II-family computers. The signal controlled by this bit is available at the processor-direct slot in the Macintosh SE/30 so that an expansion card can use it to shut down operations before losing power from the computer.
That seems like the SE/30 should still be toggling that line even though it's not a soft-power machine, which means my INIT shouldn't be necessary at all.

 

Trash80toHP_Mini

NIGHT STALKER
As my post-storage room fiasco status would be sans SE/30 et IIci, the parents of the bastardized IIsi, am I safe in my guesstimation that the IIsi has the Compact Mac/SE/30 Hard Power implementation vs. the IIci's Soft Power capability?

 

zuiko21

Well-known member
I don't think so... the IIsi is as every bit as soft-power as the IIci. Despite the different form factors, their PSUs have the same connector! You can use a IIcx/ci/vx, Quadra 700/650 or PowerMac 7100 PSU to power a IIsi -- on the bench, that is:



But instead of the discrete start-up circuit of the IIci, the IIsi goes the microcontroller way... that's why it doesn't have any programmer switches, the RESET and NMI signals are generated by the microcontroller from ADB key combos.

Back to the SE/30 project, quoting myself:

theoretically this line [PWF] should be present at pin 81 (C1) of the PDS slot, but actually won't reach there
Just checked with the DMM, there's about 7.5 Kohm of resistance between the VIA port and the PDS pin -- enough to isolate a logic signal xx( Between the VIA pin and +5V I measure 3.8 Kohm, so it isn't just tied... the port should be strong enough for that reasonable pull-up. :?:

 

bbraun

Well-known member
If I were able to write a 0 to the VIA2 register for that pin on a IIx, it should basically be a hard poweroff right?

I might give it a shot, then you can see if it helps your case, at least as a diagnostic...

 

Trash80toHP_Mini

NIGHT STALKER
Roger that! I just fired up my IIsi on the new DEDICATED IIsi Hackstation

. . . it's probably the crappiest rolling PC workstation (sans wheels at that!) I've ever seen, much less liberated garbage compactor side! :p

I noticed right off that it inherited the IIci's Soft Power Button . . . OOPSIE! :I

I started out with a replacement Q700 CPU on the bench when the IIsi's went POP!!!!!!

But if you unhook the connector and stretch the wiring just right . . .

iisiq700psutestmod0.jpg.34dc94cd2e42223b2e64a274bdfd8f0a.jpg


IIsi PSU: Catastrophic Failure! = 8-o

The setup becomes much more portable! }:)

edit: I just identified another feature for my theoretical Universal Mac <-> ATX Adapter PCB and the probable location for such a device. the Switched Monitor Receptacle Power will be necessary for any Soft Power Macs with this feature, such as my IIsi, Q700, IIfx, Q700 Triplets, Radius 81/110 etc.

I'm assuming that these connections will be moved from the ATX PSU's back panel for proper location, so the (hopefully) Universal ATX Adapter PCB would be the obvious location, at the location of the soft power switch and A/C I/O ports.

 

bbraun

Well-known member
Heh, yeah no fun and no one would know why!

Well, this app reliably hard powers off my IIx, and if I know what I'm doing, that should be because the v2PowerOff bit of the VIA2 data register B is being set to 0, causing the power supply to shut off. Which should provide a reasonable diagnostic for your SE/30. If running this app causes that line to go low, but regular shutdown doesn't, then it's reasonable to assume regular shutdown isn't toggling that pin. If this app doesn't cause that line to go low, then I'm not sure...

For those following along at home, I recommend not running this. Not all machines have a 2nd VIA. Some machines have other stuff at that location and what's "safe" (as much as hard powering off your machine is safe...) for this class of machines, may be even worse for other machines. It's intended for diagnostic purposes only, and even then only on IIx & SE/30's...

 

zuiko21

Well-known member
I'd like to point a couple of things:

1) bbraun, another BIG THANK YOU for your effort making these small but very interesting pieces of code. They're very helpful, even without reaching total success.

2) I'm... errr... an idiot :I The via (inter-layer connection, not the 6522 VIA) I was probing in these tests (marked P on the first picture of this thread) is not connected to VIA2-PB2 as I supposed xx(

Anyway, with the SE/30 in service mode, I did some more tests probing the actual VIA's pin. In short, results are:

  1. Your Power Off application does toggle PB2, as expected -- no hardware surprises here
  2. The Finder's Shutdown command does not toggle PB2 -- no matter if your Sysv hack is installed or not :(
  3. Pin 81 (C1) on the PDS socket keeps at +5 V forever, even if PB2 has toggled by your app.


[Aaaargh! Hit the send button too early...]

But an interesting result came out from your Power Off app... the Data Direction Register 2, before any action, was set as 0x80, thus leaving PB2 as a high-impedance input, staying at "1" thanks to the pull-up. It could be that the soft-power capabilities are decided very early in the start-up sequence, via Gestalt before any extension could change it and, if not present, PB2 gets configured as an input. That way, the Finder won't bother with the availability of soft-power upon issuing the Shutdown command: it just "toggles" PB2 which, if set as an input, won't come out. Makes sense to me.

Maybe all that is needed to enable PB2 control is to set it as an output in the Data Direction Register? (shameless plug) :I I really should dust off Codewarrior and try it by myself...

Thanks again,

 

bbraun

Well-known member
Great, I'm glad the poweroff worked!

FWIW, I think the pin is not configured as output by default on the IIx either. I needed to set the direction otherwise the IIx wouldn't power off. This might be a safety mechanism to prevent accidental bugs that might write to that address from hard powering off the machine.

In the process of figuring out the poweroff stuff, I came across some functions that looked like you could hook in to the shutdown process, so it might be possible to create an init that registers for the shutdown, and then runs the poweroff code...

 
Top