Try to Disable PPC Interrupt

5 messages, 4 authors, 2007-03-29 · open the first message on its own page

Try to Disable PPC Interrupt

From: Zhou Rui <hidden>
Date: 2007-03-29 02:40:00

Hi, all
    I am trying to disable interrupt on a PPC405EP board. I have checked from the 405 maunual that once the EE bit of MSR is set to 0, the external interrupt will be disabled. So I write a simple test module for that:

#ifndef MODULE
#define MODULE
#endif

#ifndef __KERNEL__
#define __KERNEL__
#endif

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>

void hw_disable_irq (void) {
        int c;
        __asm__ __volatile__(
                "mfmsr %%r0; \
                wrteei 0; \
                mfmsr %0;":"=r"(c) : );

        printk("%h\n",c);
}

int init_module(void)
{
}

void cleanup_module(void)
{
}

MODULE_LICENSE("GPL");

When I insert this module, it seems nothing happens and there is no output of the varible "c". So would you like to tell me what the problem is here? Thank you very much.


Best wishes

Zhou Rui
Distributed & Embedded System Lab
School of Information Science & Engineering
Lanzhou University, P. R. China
http://dslab.lzu.edu.cn/~zr/
 		
---------------------------------
 Mp3疯狂搜-新歌热歌高速下   

Re: Try to Disable PPC Interrupt

From: Grant Likely <hidden>
Date: 2007-03-29 02:48:00

On 3/28/07, Zhou Rui [off-list ref] wrote:
Hi, all
    I am trying to disable interrupt on a PPC405EP board. I have checked
from the 405 maunual that once the EE bit of MSR is set to 0, the external
interrupt will be disabled. So I write a simple test module for that:

#ifndef MODULE
#define MODULE
#endif

#ifndef __KERNEL__
#define __KERNEL__
#endif

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>

void hw_disable_irq (void) {
        int c;
        __asm__ __volatile__(
                "mfmsr %%r0; \
                wrteei 0; \
                mfmsr %0;":"=r"(c) : );

        printk("%h\n",c);
}

int init_module(void)
{
}

void cleanup_module(void)
{
}

MODULE_LICENSE("GPL");

When I insert this module, it seems nothing happens and there is no output
of the varible "c". So would you like to tell me what the problem is here?
Thank you very much.
Umm, because this modules doesn't do anything perhaps?  You've
declared init and cleanup routines, but there are two problems with
them.
1. You haven't used the module_init and module_exit macros to actually
register them as init/exit routines.
2. They're empty

There is no possible way for your hw_disable_irq() routine to get called.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

Re: Try to Disable PPC Interrupt

From: Zhou Rui <hidden>
Date: 2007-03-29 04:20:26

Hi
Sorry for my silly mistake, and I modify it like this:
 #ifndef MODULE
 #define MODULE
 #endif
 
 #ifndef __KERNEL__
 #define __KERNEL__
 #endif
 
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 
 void hw_disable_irq (void) {
         int c;
         __asm__ __volatile__(
                 "mfmsr %%r0; \
                 wrteei 0; \
                 mfmsr %0;":"=r"(c) :  );
 
         printk("%x\n",c);
 }
 
 int init_module(void)
 {
             hw_disable_irq();
 }
 
 void cleanup_module(void)
 {
 }
 
 MODULE_LICENSE("GPL");

 
 I can get the output is 0x21030. But I also use BDI2000 here and when I halt the board from BDI2000, I get
 405EP>halt
     Core number            : 0
     Core state                 : debug mode
     Debug entry cause : JTAG stop request
     Current PC               : 0xc00042d8
     Current CR               : 0x22004082
     Current MSR           : 0x00029030
     Current LR               : 0xc00042d8
 Hope my understanding for big endian is right. It seems 0x00029030 in MSR is
 00000000 00000010 10010000 00110000, but 0x21030 is
 00000000 00000010 00010000 00110000.
 It seems the 16th bit (EE) has been set to 0, but what should I do to make sure whether the external interrupt is disabled or not? Thank you very much.

Grant Likely [off-list ref] 写道: On 3/28/07, Zhou Rui  wrote:
Hi, all
    I am trying to disable interrupt on a PPC405EP board. I have checked
from the 405 maunual that once the EE bit of MSR is set to 0, the external
interrupt will be disabled. So I write a simple test module for that:

#ifndef MODULE
#define MODULE
#endif

#ifndef __KERNEL__
#define __KERNEL__
#endif

#include 
#include 
#include 
#include 
void hw_disable_irq (void) {
        int c;
        __asm__ __volatile__(
                "mfmsr %%r0; \
                wrteei 0; \
                mfmsr %0;":"=r"(c) : );

        printk("%h\n",c);
}

int init_module(void)
{
}

void cleanup_module(void)
{
}

MODULE_LICENSE("GPL");

When I insert this module, it seems nothing happens and there is no output
of the varible "c". So would you like to tell me what the problem is here?
Thank you very much.
Umm, because this modules doesn't do anything perhaps?  You've
declared init and cleanup routines, but there are two problems with
them.
1. You haven't used the module_init and module_exit macros to actually
register them as init/exit routines.
2. They're empty

There is no possible way for your hw_disable_irq() routine to get called.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
Sorry for my silly mistake, and I modify it like this:
#ifndef MODULE
#define MODULE
#endif

#ifndef __KERNEL__
#define __KERNEL__
#endif

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>

void hw_disable_irq (void) {
        int c;
        __asm__ __volatile__(
                "mfmsr %%r0; \
                wrteei 0; \
                mfmsr %0;":"=r"(c) :  );

        printk("%x\n",c);
}

int init_module(void)
{
            hw_disable_irq();
}

void cleanup_module(void)
{
}

MODULE_LICENSE("GPL");


I can get the output is 0x21030. But I also use BDI2000 here and when I halt the board from BDI2000, I get
405EP>halt
    Core number            : 0
    Core state                 : debug mode
    Debug entry cause : JTAG stop request
    Current PC               : 0xc00042d8
    Current CR               : 0x22004082
    Current MSR           : 0x00029030
    Current LR               : 0xc00042d8
Hope my understanding for big endian is right. It seems 0x00029030 in MSR is
00000000 00000010 10010000 00110000, but 0x21030 is
00000000 00000010 00010000 00110000.
It seems the 16th bit (EE) has been set to 0, but what should I do to make sure whether the external interrupt is disabled or not? Thank you very much.


Best wishes

Zhou Rui
Distributed and Embedded System Lab
Room 532, Information Building
School of Information Science
 		
---------------------------------
抢注雅虎免费邮箱-3.5G容量,20M附件! 

Re: Try to Disable PPC Interrupt

From: Kumar Gala <hidden>
Date: 2007-03-29 18:42:27

On Mar 28, 2007, at 11:20 PM, Zhou Rui wrote:
Hi
Sorry for my silly mistake, and I modify it like this:
#ifndef MODULE
#define MODULE
#endif

#ifndef __KERNEL__
#define __KERNEL__
#endif

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>

void hw_disable_irq (void) {
        int c;
        __asm__ __volatile__(
                "mfmsr %%r0; \
                wrteei 0; \
                mfmsr %0;":"=r"(c) : );
Why don't use use local_irq_disable() ?

        printk("%x\n",c);
}

int init_module(void)
{
          hw_disable_irq();
}

void cleanup_module(void)
{
}

MODULE_LICENSE("GPL");


I can get the output is 0x21030. But I also use BDI2000 here and  
when I halt the board from BDI2000, I get
405EP>halt
    Core number            : 0
    Core state                 : debug mode
    Debug entry cause : JTAG stop request
    Current PC               : 0xc00042d8
    Current CR               : 0x22004082
    Current MSR           : 0x00029030
    Current LR               : 0xc00042d8
Hope my understanding for big endian is right. It seems 0x00029030  
in MSR is
00000000 00000010 10010000 00110000, but 0x21030 is
00000000 00000010 00010000 00110000.
It seems the 16th bit (EE) has been set to 0, but what should I do  
to make sure whether the external interrupt is disabled or not?  
Thank you very much.
What exactly are you asking?  If MSR[EE] = 0, interrupts are disabled.

- k

Re: Try to Disable PPC Interrupt

From: Josh Boyer <hidden>
Date: 2007-03-29 19:23:23

On Thu, 2007-03-29 at 13:41 -0500, Kumar Gala wrote:
quoted
It seems the 16th bit (EE) has been set to 0, but what should I do  
to make sure whether the external interrupt is disabled or not?  
Thank you very much.
What exactly are you asking?  If MSR[EE] = 0, interrupts are disabled.
Since you're on a 405, you can actually test this from within your code
still.  Use the SRS bits in the UICs to generate a spurious interrupt at
the UIC level for something that is currently enabled in the ER
register.  If you still get an interrupt at the CPU with MSR[EE] == 0,
then you've found a very odd bug indeed.

But as Kumar says, if MSR[EE] == 0, external interrupts are disabled.
Of course, that doesn't mean that debug, machine check, or critical
interrupts are.

(How to use the SRS bits in the UICs is an exercise left up to the
reader.)

josh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help