In order to properly shutdown the computer you need to touch the ACPI and bring the system into G3 - Global State 3 (Hardware off). The ACPI specification is here:
http://www.acpi.info/DOWNLOADS/ACPIspec40a.pdfI have been reading it on and off, and I guess I will get down to reading it completely in a week or so and then I should have a more definite answer and actual code.
I have just been too busy with other projects to look at it right now (and I have to get my kernel re-programmed again
)