linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add machine state register support
@ 2005-05-23 23:40 Geoff Levand
  2005-05-23 23:53 ` Benjamin Herrenschmidt
  2005-05-24 17:05 ` Geert Uytterhoeven
  0 siblings, 2 replies; 4+ messages in thread
From: Geoff Levand @ 2005-05-23 23:40 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev

This patch adds routines to get and set the machine state register.  These 
are needed by power management code on some platforms.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> for CELF

--

Index:linux-2.6.11/arch/ppc/kernel/misc.S
===================================================================
--- linux-2.6.11.orig/arch/ppc/kernel/misc.S	2005-04-15 14:59:12.408518820 -0700
+++ linux-2.6.11/arch/ppc/kernel/misc.S	2005-04-15 14:59:34.005586781 -0700

@@ -1160,6 +1159,14 @@
 	addi	r1,r1,16
 	blr
 
+_GLOBAL(_get_msr)
+	mfmsr   r3
+	blr
+
+_GLOBAL(_set_msr)
+	mtmsr   r3
+	blr
+
 /*
  * This routine is just here to keep GCC happy - sigh...
  */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add machine state register support
  2005-05-23 23:40 [PATCH] add machine state register support Geoff Levand
@ 2005-05-23 23:53 ` Benjamin Herrenschmidt
  2005-05-24 17:39   ` Geoff Levand
  2005-05-24 17:05 ` Geert Uytterhoeven
  1 sibling, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2005-05-23 23:53 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev

On Mon, 2005-05-23 at 16:40 -0700, Geoff Levand wrote:
> This patch adds routines to get and set the machine state register.  These 
> are needed by power management code on some platforms.
> 
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> for CELF

Hi Geoff !

Can you tell me more about this power management code ? I tend to think
that code that wants to do more than just using the existing accessors
should be written in assembly... 

Also, there is already

void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);

That you can use for manipulating MSR bits.

Finally, I tend to prefer such small register accessors to be written as
inline assembly in some headers. But then, I don't think you actually
need to add anything here.

Regards,
Ben.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add machine state register support
  2005-05-23 23:40 [PATCH] add machine state register support Geoff Levand
  2005-05-23 23:53 ` Benjamin Herrenschmidt
@ 2005-05-24 17:05 ` Geert Uytterhoeven
  1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2005-05-24 17:05 UTC (permalink / raw)
  To: Geoff Levand; +Cc: Linux/PPC Development

On Mon, 23 May 2005, Geoff Levand wrote:
> This patch adds routines to get and set the machine state register.  These 
> are needed by power management code on some platforms.
> 
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> for CELF
> 
> --
> 
> Index:linux-2.6.11/arch/ppc/kernel/misc.S
> ===================================================================
> --- linux-2.6.11.orig/arch/ppc/kernel/misc.S	2005-04-15 14:59:12.408518820 -0700
> +++ linux-2.6.11/arch/ppc/kernel/misc.S	2005-04-15 14:59:34.005586781 -0700
> 
> @@ -1160,6 +1159,14 @@
>  	addi	r1,r1,16
>  	blr
>  
> +_GLOBAL(_get_msr)
> +	mfmsr   r3
> +	blr
> +
> +_GLOBAL(_set_msr)
> +	mtmsr   r3
> +	blr
> +

Please check m[ft]msr() in <asm/reg.h>.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add machine state register support
  2005-05-23 23:53 ` Benjamin Herrenschmidt
@ 2005-05-24 17:39   ` Geoff Levand
  0 siblings, 0 replies; 4+ messages in thread
From: Geoff Levand @ 2005-05-24 17:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Mon, 2005-05-23 at 16:40 -0700, Geoff Levand wrote:
> 
>>This patch adds routines to get and set the machine state register.  These 
>>are needed by power management code on some platforms.
>>
>>Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> for CELF
> 
> 
> Hi Geoff !
> 
> Can you tell me more about this power management code ? I tend to think
> that code that wants to do more than just using the existing accessors
> should be written in assembly... 
> 
> Also, there is already
> 
> void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
> 
> That you can use for manipulating MSR bits.
> 
> Finally, I tend to prefer such small register accessors to be written as
> inline assembly in some headers. But then, I don't think you actually
> need to add anything here.
> 

Sorry for the trouble, Geert is right, there are already mfmsr() and 
mtmsr() in <ppc-asm/reg.h>.  I found get_msr in ppc64 and assumed they 
were missing for ppc.  I should have looked more carefully.

-Geoff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-24 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-23 23:40 [PATCH] add machine state register support Geoff Levand
2005-05-23 23:53 ` Benjamin Herrenschmidt
2005-05-24 17:39   ` Geoff Levand
2005-05-24 17:05 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).