Skip to contentSkip to conversation

More SMU commands

PATCH In review Michael Hanselmann 2 participants 6 messages Dec 24, 2006 – Jan 14, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 More SMU commands

This patch updates smu.h with several new commands and parameter descriptions for existing ones.

---

include/asm-powerpc/smu.h +77 -3
diff -Nrup --exclude-from linux-exclude-from linux-2.6.19.1.orig/include/asm-powerpc/smu.h linux-2.6.19.1/include/asm-powerpc/smu.h
@@ -173,7 +173,7 @@
  * Power supply control
  *
  * The "sub" command is an ASCII string in the data, the
- * data lenght is that of the string.
+ * data length is that of the string.
  *
  * The VSLEW command can be used to get or set the voltage slewing.
  *  - lenght 5 (only "VSLEW") : it returns "DONE" and 3 bytes of
@@ -206,16 +206,52 @@
  * This command seem to be a grab bag of various things
  */
 #define SMU_CMD_MISC_df_COMMAND			0xdf
-#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02 /* i: 1 byte */
+
+/*
+ * Sets "system ready" status
+ *
+ * Parameters:
+ *   1: status [0x00, 0x01 or 0x02]
+ */
+#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02
+
+/*
+ * Sets mode of power switch
+ *
+ * Parameters:
+ *   1: enable power switch? [0x00 or 0x01]
+ *   2: enable nmi? [0x00 or 0x01]
+ */
 #define   SMU_CMD_MISC_df_NMI_OPTION		0x04
 
 /*
  * Version info commands
  *
- * I haven't quite tried to figure out how these work
+ * Parameters:
+ *   1 (optional): version type
+ *
+ * Returns:
+ *   Version value
  */
 #define SMU_CMD_VERSION_COMMAND			0xea
+#define   SMU_VERSION_RUNNING			0x00
+#define   SMU_VERSION_BASE			0x01
+#define   SMU_VERSION_UPDATE			0x02
+
+/*
+ * Switches
+ *
+ * These are switches whose status seems to be known to the SMU.
+ *
+ * Parameters:
+ *   none
+ */
+#define SMU_CMD_SWITCHES			0xdc
 
+/* Switches bits */
+#define SMU_SWITCH_CASE_CLOSED			0x01
+#define SMU_SWITCH_AC_POWER			0x04
+#define SMU_SWITCH_POWER_SWITCH			0x08
 
 /*
  * Misc commands
@@ -246,6 +282,44 @@
 #define	  SMU_CMD_MISC_ee_LEDS_CTRL		0x04 /* i: 00 (00,01) [00] */
 #define   SMU_CMD_MISC_ee_GET_DATA		0x05 /* i: 00 , o: ?? */
 
+/*
+ * Misc commands 2
+ *
+ * Parameters:
+ *   1: subcommand
+ */
+#define SMU_CMD_MISC_8f_COMMAND			0x8f
+
+/*
+ * File server mode
+ *
+ * Parameters:
+ *   2: to enable, set to 0x01, otherwise 0xff
+ *   3: always 0xff
+ */
+#define   SMU_CMD_MISC_8f_FILESERVER_MODE	0x02
+
+/*
+ * Retrieves last shutdown cause
+ *
+ * Parameters:
+ *   none
+ *
+ * Returns:
+ *   Last shutdown cause
+ */
+#define   SMU_CMD_MISC_8f_LAST_SHUTDOWN_CAUSE	0x07
+
+/*
+ * Sets or gets server ID
+ *
+ * Parameters:
+ *   2 (optional): Set server ID to this value
+ *
+ * Returns:
+ *   Current server ID
+ */
+#define   SMU_CMD_MISC_8f_SERVER_ID		0x08
 
 
 /*
#1 lore raw

include/asm-powerpc/smu.h line 216

Quoted 7 lines · Michael Hanselmann
include/asm-powerpc/smu.h +7 -0
+/*
+ * Sets "system ready" status
+ *
+ * Parameters:
+ *   1: status [0x00, 0x01 or 0x02]
+ */
+#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02

Do you know more about wha that actually does ?

Quoted 8 lines

+/*
+ * Sets mode of power switch
+ *
+ * Parameters:
+ * 1: enable power switch? [0x00 or 0x01]
+ * 2: enable nmi? [0x00 or 0x01]
+ */
#define SMU_CMD_MISC_df_NMI_OPTION 0x04

More coments here as well... what does "enabling power switch" means ? enabling reception of events / interrupts when it's pressed ? same for NMI, if you don't know, say it, but give as much details as you can.

include/asm-powerpc/smu.h line 249

Quoted 9 lines
include/asm-powerpc/smu.h +9 -0
+/*
+ * Switches
+ *
+ * These are switches whose status seems to be known to the SMU.
+ *
+ * Parameters:
+ *   none
+ */
+#define SMU_CMD_SWITCHES			0xdc

You didn't give any info on the format of the command (parameters, results).

Review

Quoted 12 lines
(quoted diff) +11 -0
+/* Switches bits */
+#define SMU_SWITCH_CASE_CLOSED			0x01
+#define SMU_SWITCH_AC_POWER			0x04
+#define SMU_SWITCH_POWER_SWITCH			0x08
 
+/*
+ * Misc commands 2
+ *
+ * Parameters:
+ *   1: subcommand
+ */
+#define SMU_CMD_MISC_8f_COMMAND			0x8f

This should probably be named POWER EVENTS or so.

include/asm-powerpc/smu.h line 300

Quoted 8 lines
include/asm-powerpc/smu.h +8 -0
+/*
+ * File server mode
+ *
+ * Parameters:
+ *   2: to enable, set to 0x01, otherwise 0xff
+ *   3: always 0xff
+ */
+#define   SMU_CMD_MISC_8f_FILESERVER_MODE	0x02

The meaning of the power events parameters is the same as for the PMU, you can get the actual constants there. Your constant is incorrect. The first parameter (subcommand) is apparently like the PMU:

        PMU_PWR_GET_POWERUP_EVENTS      = 0x00,
        PMU_PWR_SET_POWERUP_EVENTS      = 0x01,
        PMU_PWR_CLR_POWERUP_EVENTS      = 0x02,
        PMU_PWR_GET_WAKEUP_EVENTS       = 0x03,
        PMU_PWR_SET_WAKEUP_EVENTS       = 0x04,
        PMU_PWR_CLR_WAKEUP_EVENTS       = 0x05,

Followed by a 16 bits event mask whose only known defined values for the PMU are:

        PMU_PWR_WAKEUP_KEY              = 0x01, /* Wake on key press */
        PMU_PWR_WAKEUP_AC_INSERT        = 0x02, /* Wake on AC adapter plug */
        PMU_PWR_WAKEUP_AC_CHANGE        = 0x04,
        PMU_PWR_WAKEUP_LID_OPEN         = 0x08,
        PMU_PWR_WAKEUP_RING             = 0x10,

I haven't really verified if those match the values on SMU based machines.

include/asm-powerpc/smu.h line 311

Quoted 10 lines
include/asm-powerpc/smu.h +10 -0
+/*
+ * Retrieves last shutdown cause
+ *
+ * Parameters:
+ *   none
+ *
+ * Returns:
+ *   Last shutdown cause
+ */
+#define   SMU_CMD_MISC_8f_LAST_SHUTDOWN_CAUSE	0x07

Same comment as before, you didn't provide info about the arguments and results of this. If you don't know, say it so, but at least provide the number of args/results as I think it can be found in the OF code.

include/asm-powerpc/smu.h line 322

Quoted 10 lines
include/asm-powerpc/smu.h +10 -0
+/*
+ * Sets or gets server ID
+ *
+ * Parameters:
+ *   2 (optional): Set server ID to this value
+ *
+ * Returns:
+ *   Current server ID
+ */
+#define   SMU_CMD_MISC_8f_SERVER_ID		0x08

Any idea what this means ?

Ben.

#2 lore raw

Hello Benjamin

Unless otherwise noted, stuff is commented or fixed in the patch below.

Quoted 11 lines · Benjamin Herrenschmidt

Review

Quoted 8 lines
(quoted diff) +8 -0
+/*
+ * File server mode
+ *
+ * Parameters:
+ *   2: to enable, set to 0x01, otherwise 0xff
+ *   3: always 0xff
+ */
+#define   SMU_CMD_MISC_8f_FILESERVER_MODE	0x02

The meaning of the power events parameters is the same as for the PMU, you can get the actual constants there. Your constant is incorrect.

You were right. I did a mistake there. Should be fixed now and got some more commands for 0x8f.

Quoted 3 lines
Quoted 1 line

+#define SMU_CMD_MISC_8f_SERVER_ID 0x08

Any idea what this means ?

No, I don't. Just guessing, but maybe it's somehow related to Xserve and clusters.

New patch below. Is this one better?

---

include/asm-powerpc/smu.h +142 -4
diff -Nrup --exclude-from linux-exclude-from linux-2.6.19.1.orig/include/asm-powerpc/smu.h linux-2.6.19.1/include/asm-powerpc/smu.h
@@ -173,7 +173,7 @@
  * Power supply control
  *
  * The "sub" command is an ASCII string in the data, the
- * data lenght is that of the string.
+ * data length is that of the string.
  *
  * The VSLEW command can be used to get or set the voltage slewing.
  *  - lenght 5 (only "VSLEW") : it returns "DONE" and 3 bytes of
@@ -206,16 +206,67 @@
  * This command seem to be a grab bag of various things
  */
 #define SMU_CMD_MISC_df_COMMAND			0xdf
-#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02 /* i: 1 byte */
+
+/*
+ * Sets "system ready" status
+ *
+ * What this actually does is not yet known, but Apple's driver sets it at some
+ * point.
+ *
+ * Parameters:
+ *   1: status [0x00, 0x01 or 0x02]
+ */
+#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02
+
+/*
+ * Sets mode of power switch.
+ *
+ * What this actually does is not yet known. Maybe it enables some interrupt.
+ *
+ * Parameters:
+ *   1: enable power switch? [0x00 or 0x01]
+ *   2: enable nmi? [0x00 or 0x01]
+ */
 #define   SMU_CMD_MISC_df_NMI_OPTION		0x04
 
+/* Sets LED dimm offset.
+ *
+ * Parameters:
+ *   1-7: unknown (BCD coding)
+ */
+#define   SMU_CMD_MISC_df_DIMM_OFFSET		0x99
+
 /*
  * Version info commands
  *
- * I haven't quite tried to figure out how these work
+ * Parameters:
+ *   1 (optional): Specifies version part to retrieve
+ *
+ * Returns:
+ *   Version value
  */
 #define SMU_CMD_VERSION_COMMAND			0xea
+#define   SMU_VERSION_RUNNING			0x00
+#define   SMU_VERSION_BASE			0x01
+#define   SMU_VERSION_UPDATE			0x02
 
+/*
+ * Switches
+ *
+ * These are switches whose status seems to be known to the SMU.
+ *
+ * Parameters:
+ *   none
+ *
+ * Result:
+ *   Switch bits (ORed, see below)
+ */
+#define SMU_CMD_SWITCHES			0xdc
+
+/* Switches bits */
+#define SMU_SWITCH_CASE_CLOSED			0x01
+#define SMU_SWITCH_AC_POWER			0x04
+#define SMU_SWITCH_POWER_SWITCH			0x08
 
 /*
  * Misc commands
@@ -243,10 +294,97 @@
  */
 #define SMU_CMD_MISC_ee_COMMAND			0xee
 #define   SMU_CMD_MISC_ee_GET_DATABLOCK_REC	0x02
-#define	  SMU_CMD_MISC_ee_LEDS_CTRL		0x04 /* i: 00 (00,01) [00] */
+
+/* Retrieves currently used watts.
+ *
+ * Parameters:
+ *   1: 0x03 (Meaning unknown)
+ */
+#define   SMU_CMD_MISC_ee_GET_WATTS		0x03
+
+#define   SMU_CMD_MISC_ee_LEDS_CTRL		0x04 /* i: 00 (00,01) [00] */
 #define   SMU_CMD_MISC_ee_GET_DATA		0x05 /* i: 00 , o: ?? */
 
 
+/*
+ * Power related commands
+ *
+ * Parameters:
+ *   1: subcommand
+ */
+#define SMU_CMD_POWER_COMMAND			0x8f
+
+/*
+ * Enables file server mode
+ *
+ * Meaning or use is unknown. Maybe this allows the machine to power up after
+ * AC loss.
+ *
+ * Parameters:
+ *   2: always 0x00, meaning unknown
+ *   3: always 0x02, meaning unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_SET_FILESERVER_MODE	0x01
+
+/*
+ * Disables file server mode
+ *
+ * Parameters:
+ *   2: always 0xff, meaning unknown
+ *   3: always 0xff, meaning unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_CLR_FILESERVER_MODE	0x02
+
+/* Unknown meaning. Used during sleep preparation.
+ *
+ * Parameters:
+ *   2: unknown
+ *   3: unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_UNKNOWN_04		0x04
+
+/* Unknown meaning. Used during sleep preparation.
+ *
+ * Parameters:
+ *   2: 0xff, meaning unknown
+ *   3: 0xff, meaning unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_UNKNOWN_05		0x05
+
+/*
+ * Get last shutdown cause
+ *
+ * Parameters:
+ *   none
+ *
+ * Returns:
+ *   1 byte (signed char): Last shutdown cause. Exact meaning unknown.
+ */
+#define   SMU_CMD_POWER_LAST_SHUTDOWN_CAUSE	0x07
+
+/*
+ * Sets or gets server ID. Meaning or use is unknown.
+ *
+ * Parameters:
+ *   2 (optional): Set server ID (1 byte)
+ *
+ * Returns:
+ *   1 byte (server ID?)
+ */
+#define   SMU_CMD_POWER_SERVER_ID		0x08
+
 
 /*
  * - Kernel side interface -
#3 lore raw
Quoted 1 line · Michael Hanselmann

New patch below. Is this one better?

Unfortuntely, there was a naming conflict. Here's a better patch with even more comments.

---

include/asm-powerpc/smu.h +163 -4
@@ -173,7 +173,7 @@
  * Power supply control
  *
  * The "sub" command is an ASCII string in the data, the
- * data lenght is that of the string.
+ * data length is that of the string.
  *
  * The VSLEW command can be used to get or set the voltage slewing.
  *  - lenght 5 (only "VSLEW") : it returns "DONE" and 3 bytes of
@@ -201,20 +201,90 @@
  */
 #define SMU_CMD_READ_ADC			0xd8
 
+
 /* Misc commands
  *
  * This command seem to be a grab bag of various things
+ *
+ * Parameters:
+ *   1: subcommand
  */
 #define SMU_CMD_MISC_df_COMMAND			0xdf
-#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02 /* i: 1 byte */
+
+/*
+ * Sets "system ready" status
+ *
+ * I did not yet understand how it exactly works or what it does.
+ *
+ * Guessing from OF code, 0x02 activates the display backlight. Apple uses/used
+ * the same codebase for all OF versions. On PowerBooks, this command would
+ * enable the backlight. For the G5s, it only activates the front LED. However,
+ * don't take this for granted.
+ *
+ * Parameters:
+ *   2: status [0x00, 0x01 or 0x02]
+ */
+#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02
+
+/*
+ * Sets mode of power switch.
+ *
+ * What this actually does is not yet known. Maybe it enables some interrupt.
+ *
+ * Parameters:
+ *   2: enable power switch? [0x00 or 0x01]
+ *   3 (optional): enable nmi? [0x00 or 0x01]
+ *
+ * Returns:
+ *   If parameter 2 is 0x00 and parameter 3 is not specified, returns wether
+ *   NMI is enabled. Otherwise unknown.
+ */
 #define   SMU_CMD_MISC_df_NMI_OPTION		0x04
 
+/* Sets LED dimm offset.
+ *
+ * The front LED dimms itself during sleep. Its brightness (or, well, the PWM
+ * frequency) depends on current time. Therefore, the SMU needs to know the
+ * timezone.
+ *
+ * Parameters:
+ *   2-8: unknown (BCD coding)
+ */
+#define   SMU_CMD_MISC_df_DIMM_OFFSET		0x99
+
+
 /*
  * Version info commands
  *
- * I haven't quite tried to figure out how these work
+ * Parameters:
+ *   1 (optional): Specifies version part to retrieve
+ *
+ * Returns:
+ *   Version value
  */
 #define SMU_CMD_VERSION_COMMAND			0xea
+#define   SMU_VERSION_RUNNING			0x00
+#define   SMU_VERSION_BASE			0x01
+#define   SMU_VERSION_UPDATE			0x02
+
+
+/*
+ * Switches
+ *
+ * These are switches whose status seems to be known to the SMU.
+ *
+ * Parameters:
+ *   none
+ *
+ * Result:
+ *   Switch bits (ORed, see below)
+ */
+#define SMU_CMD_SWITCHES			0xdc
+
+/* Switches bits */
+#define SMU_SWITCH_CASE_CLOSED			0x01
+#define SMU_SWITCH_AC_POWER			0x04
+#define SMU_SWITCH_POWER_SWITCH			0x08
 
 
 /*
@@ -243,10 +313,99 @@
  */
 #define SMU_CMD_MISC_ee_COMMAND			0xee
 #define   SMU_CMD_MISC_ee_GET_DATABLOCK_REC	0x02
-#define	  SMU_CMD_MISC_ee_LEDS_CTRL		0x04 /* i: 00 (00,01) [00] */
+
+/* Retrieves currently used watts.
+ *
+ * Parameters:
+ *   1: 0x03 (Meaning unknown)
+ */
+#define   SMU_CMD_MISC_ee_GET_WATTS		0x03
+
+#define   SMU_CMD_MISC_ee_LEDS_CTRL		0x04 /* i: 00 (00,01) [00] */
 #define   SMU_CMD_MISC_ee_GET_DATA		0x05 /* i: 00 , o: ?? */
 
 
+/*
+ * Power related commands
+ *
+ * Parameters:
+ *   1: subcommand
+ */
+#define SMU_CMD_POWER_EVENTS_COMMAND		0x8f
+
+/*
+ * Enables file server mode
+ *
+ * Meaning or use is unknown. Maybe this allows the machine to power up after
+ * AC loss.
+ *
+ * Parameters:
+ *   2: always 0x00, meaning unknown
+ *   3: always 0x02, meaning unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_EVENTS_SET_FILESERVER_MODE	0x01
+
+/*
+ * Disables file server mode
+ *
+ * Parameters:
+ *   2: always 0xff, meaning unknown
+ *   3: always 0xff, meaning unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_EVENTS_CLR_FILESERVER_MODE	0x02
+
+/*
+ * Unknown meaning. Used during sleep preparation.
+ *
+ * Parameters:
+ *   2: unknown
+ *   3: unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_EVENTS_UNKNOWN_04		0x04
+
+/*
+ * Unknown meaning. Used during sleep preparation.
+ *
+ * Parameters:
+ *   2: 0xff, meaning unknown
+ *   3: 0xff, meaning unknown
+ *
+ * Returns:
+ *   2 bytes
+ */
+#define   SMU_CMD_POWER_EVENTS_UNKNOWN_05		0x05
+
+/*
+ * Get last shutdown cause
+ *
+ * Parameters:
+ *   none
+ *
+ * Returns:
+ *   1 byte (signed char): Last shutdown cause. Exact meaning unknown.
+ */
+#define   SMU_CMD_POWER_EVENTS_LAST_SHUTDOWN_CAUSE	0x07
+
+/*
+ * Sets or gets server ID. Meaning or use is unknown.
+ *
+ * Parameters:
+ *   2 (optional): Set server ID (1 byte)
+ *
+ * Returns:
+ *   1 byte (server ID?)
+ */
+#define   SMU_CMD_POWER_EVENTS_SERVER_ID		0x08
+
 
 /*
  * - Kernel side interface -
#4 lore raw

include/asm-powerpc/smu.h line 340

Quoted 8 lines
include/asm-powerpc/smu.h +7 -0
+#define SMU_CMD_POWER_EVENTS_COMMAND		0x8f
+
+/*
+ * Enables file server mode
+ *
+ * Meaning or use is unknown. Maybe this allows the machine to power up after
+ * AC loss.

Meaning and use are known :-) This defines events related to powering or waking the machine up :-)

Quoted 3 lines

+ * Parameters:
+ * 2: always 0x00, meaning unknown
+ * 3: always 0x02, meaning unknown

Paremeters depend on the subcommand.

Quoted 4 lines

+ * Returns:
+ * 2 bytes
+ */
+#define SMU_CMD_POWER_EVENTS_SET_FILESERVER_MODE 0x01

Look at the corresponding PMU commands.

/* PMU PMU_POWER_EVENTS commands */

enum {
        PMU_PWR_GET_POWERUP_EVENTS      = 0x00,
        PMU_PWR_SET_POWERUP_EVENTS      = 0x01,
        PMU_PWR_CLR_POWERUP_EVENTS      = 0x02,
        PMU_PWR_GET_WAKEUP_EVENTS       = 0x03,
        PMU_PWR_SET_WAKEUP_EVENTS       = 0x04,
        PMU_PWR_CLR_WAKEUP_EVENTS       = 0x05,
};

(There might be others above 5 but that's the one I know about, they are the same on the SMU).

The "POWERUP" events define events that can powerup the machine when shut down. The "WAKEUP" events define events that can wake up the machine when sleeping.

Both sets of commands are made of 3 base commands: GET, SET abd CLR. The events are a 16 bits bit mask though from my experience, only the first 8 bits is ever used. GET reads the current mask afaik (though it might not always work, I had issues in the past). SET enabled some events, CLR disables some events.

The bit values for the events themselves aren't completly known, but they seem to follow the same convention as the PMU, which is

/* Power events wakeup bits */

enum {
        PMU_PWR_WAKEUP_KEY              = 0x01, /* Wake on key press */
        PMU_PWR_WAKEUP_AC_INSERT        = 0x02, /* Wake on AC adapter plug */
        PMU_PWR_WAKEUP_AC_CHANGE        = 0x04,
        PMU_PWR_WAKEUP_LID_OPEN         = 0x08,
        PMU_PWR_WAKEUP_RING             = 0x10,
};

So for example, a CLR with 0xff 0xff will clear all events. Then, a SET with 0x02 0x00 will enable "AC INSERT" event.

The way to enable file server mode is to enable POWERUP on the AC_INSERT event.

Ben.

#5 lore raw
Quoted 2 lines · Benjamin Herrenschmidt

Meaning and use are known :-) This defines events related to powering or waking the machine up :-)

You were right, now it makes sense.

Quoted 2 lines

(There might be others above 5 but that's the one I know about, they are the same on the SMU).

Yes, there are.

---

include/asm-powerpc/smu.h +128 -4
diff -Nrup --exclude-from linux-exclude-from linux-2.6.19.1.orig/include/asm-powerpc/smu.h linux-2.6.19.1/include/asm-powerpc/smu.h
@@ -173,7 +173,7 @@
  * Power supply control
  *
  * The "sub" command is an ASCII string in the data, the
- * data lenght is that of the string.
+ * data length is that of the string.
  *
  * The VSLEW command can be used to get or set the voltage slewing.
  *  - lenght 5 (only "VSLEW") : it returns "DONE" and 3 bytes of
@@ -201,20 +201,90 @@
  */
 #define SMU_CMD_READ_ADC			0xd8
 
+
 /* Misc commands
  *
  * This command seem to be a grab bag of various things
+ *
+ * Parameters:
+ *   1: subcommand
  */
 #define SMU_CMD_MISC_df_COMMAND			0xdf
-#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02 /* i: 1 byte */
+
+/*
+ * Sets "system ready" status
+ *
+ * I did not yet understand how it exactly works or what it does.
+ *
+ * Guessing from OF code, 0x02 activates the display backlight. Apple uses/used
+ * the same codebase for all OF versions. On PowerBooks, this command would
+ * enable the backlight. For the G5s, it only activates the front LED. However,
+ * don't take this for granted.
+ *
+ * Parameters:
+ *   2: status [0x00, 0x01 or 0x02]
+ */
+#define   SMU_CMD_MISC_df_SET_DISPLAY_LIT	0x02
+
+/*
+ * Sets mode of power switch.
+ *
+ * What this actually does is not yet known. Maybe it enables some interrupt.
+ *
+ * Parameters:
+ *   2: enable power switch? [0x00 or 0x01]
+ *   3 (optional): enable nmi? [0x00 or 0x01]
+ *
+ * Returns:
+ *   If parameter 2 is 0x00 and parameter 3 is not specified, returns wether
+ *   NMI is enabled. Otherwise unknown.
+ */
 #define   SMU_CMD_MISC_df_NMI_OPTION		0x04
 
+/* Sets LED dimm offset.
+ *
+ * The front LED dimms itself during sleep. Its brightness (or, well, the PWM
+ * frequency) depends on current time. Therefore, the SMU needs to know the
+ * timezone.
+ *
+ * Parameters:
+ *   2-8: unknown (BCD coding)
+ */
+#define   SMU_CMD_MISC_df_DIMM_OFFSET		0x99
+
+
 /*
  * Version info commands
  *
- * I haven't quite tried to figure out how these work
+ * Parameters:
+ *   1 (optional): Specifies version part to retrieve
+ *
+ * Returns:
+ *   Version value
  */
 #define SMU_CMD_VERSION_COMMAND			0xea
+#define   SMU_VERSION_RUNNING			0x00
+#define   SMU_VERSION_BASE			0x01
+#define   SMU_VERSION_UPDATE			0x02
+
+
+/*
+ * Switches
+ *
+ * These are switches whose status seems to be known to the SMU.
+ *
+ * Parameters:
+ *   none
+ *
+ * Result:
+ *   Switch bits (ORed, see below)
+ */
+#define SMU_CMD_SWITCHES			0xdc
+
+/* Switches bits */
+#define SMU_SWITCH_CASE_CLOSED			0x01
+#define SMU_SWITCH_AC_POWER			0x04
+#define SMU_SWITCH_POWER_SWITCH			0x08
 
 
 /*
@@ -243,10 +313,64 @@
  */
 #define SMU_CMD_MISC_ee_COMMAND			0xee
 #define   SMU_CMD_MISC_ee_GET_DATABLOCK_REC	0x02
-#define	  SMU_CMD_MISC_ee_LEDS_CTRL		0x04 /* i: 00 (00,01) [00] */
+
+/* Retrieves currently used watts.
+ *
+ * Parameters:
+ *   1: 0x03 (Meaning unknown)
+ */
+#define   SMU_CMD_MISC_ee_GET_WATTS		0x03
+
+#define   SMU_CMD_MISC_ee_LEDS_CTRL		0x04 /* i: 00 (00,01) [00] */
 #define   SMU_CMD_MISC_ee_GET_DATA		0x05 /* i: 00 , o: ?? */
 
 
+/*
+ * Power related commands
+ *
+ * Parameters:
+ *   1: subcommand
+ */
+#define SMU_CMD_POWER_EVENTS_COMMAND		0x8f
+
+/* SMU_POWER_EVENTS subcommands */
+enum {
+	SMU_PWR_GET_POWERUP_EVENTS      = 0x00,
+	SMU_PWR_SET_POWERUP_EVENTS      = 0x01,
+	SMU_PWR_CLR_POWERUP_EVENTS      = 0x02,
+	SMU_PWR_GET_WAKEUP_EVENTS       = 0x03,
+	SMU_PWR_SET_WAKEUP_EVENTS       = 0x04,
+	SMU_PWR_CLR_WAKEUP_EVENTS       = 0x05,
+
+	/*
+	 * Get last shutdown cause
+	 *
+	 * Returns:
+	 *   1 byte (signed char): Last shutdown cause. Exact meaning unknown.
+	 */
+	SMU_PWR_LAST_SHUTDOWN_CAUSE	= 0x07,
+
+	/*
+	 * Sets or gets server ID. Meaning or use is unknown.
+	 *
+	 * Parameters:
+	 *   2 (optional): Set server ID (1 byte)
+	 *
+	 * Returns:
+	 *   1 byte (server ID?)
+	 */
+	SMU_PWR_SERVER_ID		= 0x08,
+};
+
+/* Power events wakeup bits */
+enum {  
+	SMU_PWR_WAKEUP_KEY              = 0x01, /* Wake on key press */
+	SMU_PWR_WAKEUP_AC_INSERT        = 0x02, /* Wake on AC adapter plug */
+	SMU_PWR_WAKEUP_AC_CHANGE        = 0x04,
+	SMU_PWR_WAKEUP_LID_OPEN         = 0x08,
+	SMU_PWR_WAKEUP_RING             = 0x10,
+};
+
 
 /*
  * - Kernel side interface -