+/*
+** ml_set_processor_speed_dpll()
+**
+*/
+; Force a line boundry here
+ .align 5
+ .globl EXT(ml_set_processor_speed_dpll)
+
+LEXT(ml_set_processor_speed_dpll)
+ mfsprg r5, 0 ; Get the per_proc_info
+
+ cmplwi r3, 0 ; Turn off BTIC before low speed
+ beq spsDPLL1
+ mfspr r4, hid0 ; Get the current hid0 value
+ rlwinm r4, r4, 0, btic+1, btic-1 ; Clear the BTIC bit
+ sync
+ mtspr hid0, r4 ; Set the new hid0 value
+ isync
+ sync
+
+spsDPLL1:
+ mfspr r4, hid1 ; Get the current PLL settings
+ rlwimi r4, r3, 31-hid1ps, hid1ps, hid1ps ; Copy the PLL Select bit
+ stw r4, pfHID1(r5) ; Save the new hid1 value
+ mtspr hid1, r4 ; Select desired PLL
+
+ cmplwi r3, 0 ; Restore BTIC after high speed
+ bne spsDPLL2
+ lwz r4, pfHID0(r5) ; Load the hid0 value
+ sync
+ mtspr hid0, r4 ; Set the hid0 value
+ isync
+ sync
+spsDPLL2:
+ blr
+
+
+/*
+** ml_set_processor_speed_dfs()
+**
+*/
+; Force a line boundry here
+ .align 5
+ .globl EXT(ml_set_processor_speed_dfs)
+
+LEXT(ml_set_processor_speed_dfs)
+ mfsprg r5, 0 ; Get the per_proc_info
+
+ cmplwi r3, 0 ; full speed?
+ mfspr r3, hid1 ; Get the current HID1
+ rlwinm r3, r3, 0, hid1dfs1+1, hid1dfs0-1 ; assume full speed, clear dfs bits
+ beq spsDFS
+ oris r3, r3, hi16(hid1dfs1m) ; slow, set half speed dfs1 bit
+
+spsDFS:
+ stw r3, pfHID1(r5) ; Save the new hid1 value
+ sync
+ mtspr hid1, r3 ; Set the new HID1
+ sync
+ isync
+ blr
+
+