linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Device driver question
@ 2002-05-15 13:17 Bloch, Jack
  2002-05-15 13:36 ` Tommy Reynolds
  2002-05-16  0:18 ` jw schultz
  0 siblings, 2 replies; 6+ messages in thread
From: Bloch, Jack @ 2002-05-15 13:17 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org.'

I am relatively new to Linux (< 6 months). We have designed an embedded
system (on compact PCI) running on a Pentium III 700Mhz cPCI machine. This
machine supports upt to 6 cPCI boards for specific functions (this is our
own HW). I have already written the device drivers for these boards and the
system is running. I have a specific case where our HW can generate a
special interrupt. In this case I simply want the ISR to halt the system
(i.e. take the same action as if I typed halt from the command line). How
can I from within my device driver cause a halt? Please CC me specifically
on any replies.

Thanks in advance. 

Jack Bloch
Siemens Carrier Networks
e-mail    : jack.bloch@icn.siemens.com
phone     : (561) 923-6550


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

* Re: Device driver question
  2002-05-15 13:17 Device driver question Bloch, Jack
@ 2002-05-15 13:36 ` Tommy Reynolds
  2002-05-15 15:03   ` Joe deBlaquiere
  2002-05-16  0:18 ` jw schultz
  1 sibling, 1 reply; 6+ messages in thread
From: Tommy Reynolds @ 2002-05-15 13:36 UTC (permalink / raw)
  To: Bloch, Jack; +Cc: linux-kernel

Uttered "Bloch, Jack" <Jack.Bloch@icn.siemens.com>, spoke thus:

> I have a specific case where our HW can generate a
>  special interrupt. In this case I simply want the ISR to halt the system
>  (i.e. take the same action as if I typed halt from the command line). How
>  can I from within my device driver cause a halt? Please CC me specifically
>  on any replies.

Check out the code for "sys_reboot" in "kernel/sys.c" for ideas on how to do
this.  I don't think you can invoke "sys_reboot" from inside an interrupt
handler, but you could probably do the same thing by calling the service
routines "sys_reboot" does.

If that doesn't shut your machine down gracefully, then you might resort to
"call_usermodehelper" in "kernel/kmod.c" to run "/sbin/shutdown -h now".  You
can't invoke "call_usermodehelper" from an interrupt top half, but it should
work find from a tasklett.

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

* Re: Device driver question
  2002-05-15 13:36 ` Tommy Reynolds
@ 2002-05-15 15:03   ` Joe deBlaquiere
  2002-05-15 15:13     ` Tommy Reynolds
  2002-05-15 15:16     ` Tommy Reynolds
  0 siblings, 2 replies; 6+ messages in thread
From: Joe deBlaquiere @ 2002-05-15 15:03 UTC (permalink / raw)
  To: Tommy Reynolds; +Cc: Bloch, Jack, linux-kernel

How about just write a driver that responds to the interrupt, and write
a program that does a blocking read from the driver. The driver read
routine stuff the program on a wait queue... until... interrupt occurs,
wake up the program, program does exec(/sbin/halt) ?

This could actually be made into a good demonstration of driver
programming in that you could hook the parport interrupt and do it with
any PC.... 

On Wed, 2002-05-15 at 08:36, Tommy Reynolds wrote:
> Uttered "Bloch, Jack" <Jack.Bloch@icn.siemens.com>, spoke thus:
> 
> > I have a specific case where our HW can generate a
> >  special interrupt. In this case I simply want the ISR to halt the system
> >  (i.e. take the same action as if I typed halt from the command line). How
> >  can I from within my device driver cause a halt? Please CC me specifically
> >  on any replies.
> 
> Check out the code for "sys_reboot" in "kernel/sys.c" for ideas on how to do
> this.  I don't think you can invoke "sys_reboot" from inside an interrupt
> handler, but you could probably do the same thing by calling the service
> routines "sys_reboot" does.
> 
> If that doesn't shut your machine down gracefully, then you might resort to
> "call_usermodehelper" in "kernel/kmod.c" to run "/sbin/shutdown -h now".  You
> can't invoke "call_usermodehelper" from an interrupt top half, but it should
> work find from a tasklett.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
-- 
Joe deBlaquiere
Red Hat, Inc.
voice : 256-217-0123
mobile: 256-527-5633
fax   : 256-837-3839
jadb@redhat.com


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

* Re: Device driver question
  2002-05-15 15:03   ` Joe deBlaquiere
@ 2002-05-15 15:13     ` Tommy Reynolds
  2002-05-15 15:16     ` Tommy Reynolds
  1 sibling, 0 replies; 6+ messages in thread
From: Tommy Reynolds @ 2002-05-15 15:13 UTC (permalink / raw)
  To: Joe deBlaquiere; +Cc: Jack.Bloch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

Uttered "Joe deBlaquiere" <jadb@redhat.com>, spoke thus:

>  How about just write a driver that responds to the interrupt, and write
>  a program that does a blocking read from the driver. The driver read
>  routine stuff the program on a wait queue... until... interrupt occurs,
>  wake up the program, program does exec(/sbin/halt) ?

Yup, that could work too. (Classic see-interrupt-from-user-space solution)  It
all depends on how urgently his embedded system needs to reboot.  Choices abound
for rebooting: the hard part is not rebooting until you want to reboot.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Device driver question
  2002-05-15 15:03   ` Joe deBlaquiere
  2002-05-15 15:13     ` Tommy Reynolds
@ 2002-05-15 15:16     ` Tommy Reynolds
  1 sibling, 0 replies; 6+ messages in thread
From: Tommy Reynolds @ 2002-05-15 15:16 UTC (permalink / raw)
  To: Joe deBlaquiere; +Cc: Jack.Bloch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

Uttered "Joe deBlaquiere" <jadb@redhat.com>, spoke thus:

>  How about just write a driver that responds to the interrupt, and write
>  a program that does a blocking read from the driver.

Then there's the

	printk( KERN_EMERG "Hey, Y'all, let's reboot!\n" );

solution.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Device driver question
  2002-05-15 13:17 Device driver question Bloch, Jack
  2002-05-15 13:36 ` Tommy Reynolds
@ 2002-05-16  0:18 ` jw schultz
  1 sibling, 0 replies; 6+ messages in thread
From: jw schultz @ 2002-05-16  0:18 UTC (permalink / raw)
  To: Bloch, Jack; +Cc: 'linux-kernel@vger.kernel.org.'

On Wed, May 15, 2002 at 09:17:21AM -0400, Bloch, Jack wrote:
> I am relatively new to Linux (< 6 months). We have designed an embedded
> system (on compact PCI) running on a Pentium III 700Mhz cPCI machine. This
> machine supports upt to 6 cPCI boards for specific functions (this is our
> own HW). I have already written the device drivers for these boards and the
> system is running. I have a specific case where our HW can generate a
> special interrupt. In this case I simply want the ISR to halt the system
> (i.e. take the same action as if I typed halt from the command line). How
> can I from within my device driver cause a halt? Please CC me specifically
> on any replies.
> 
> Thanks in advance. 

I am assuming you are running more than just the kernel.
You could just post a signal to init (pid 1).
SIGINT would be a top candidate.

Take a look at powerd, init and inittab.


-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw@pegasys.ws

		Remember Cernan and Schmitt

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

end of thread, other threads:[~2002-05-16  0:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-15 13:17 Device driver question Bloch, Jack
2002-05-15 13:36 ` Tommy Reynolds
2002-05-15 15:03   ` Joe deBlaquiere
2002-05-15 15:13     ` Tommy Reynolds
2002-05-15 15:16     ` Tommy Reynolds
2002-05-16  0:18 ` jw schultz

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).