Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
1f84253e
Commit
1f84253e
authored
Mar 21, 2006
by
Tony Luck
Browse files
Options
Browse Files
Download
Plain Diff
Pull sn-handle-sc-powerdown into release branch
parents
58124996
28ff6b9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
drivers/char/snsc.h
drivers/char/snsc.h
+4
-1
drivers/char/snsc_event.c
drivers/char/snsc_event.c
+24
-8
No files found.
drivers/char/snsc.h
View file @
1f84253e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* License. See the file "COPYING" in the main directory of this archive
* License. See the file "COPYING" in the main directory of this archive
* for more details.
* for more details.
*
*
* Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2004
-2006
Silicon Graphics, Inc. All rights reserved.
*/
*/
/*
/*
...
@@ -70,6 +70,9 @@ struct sysctl_data_s {
...
@@ -70,6 +70,9 @@ struct sysctl_data_s {
#define EV_CLASS_TEST_WARNING 0x6000ul
#define EV_CLASS_TEST_WARNING 0x6000ul
#define EV_CLASS_PWRD_NOTIFY 0x8000ul
#define EV_CLASS_PWRD_NOTIFY 0x8000ul
/* ENV class codes */
#define ENV_PWRDN_PEND 0x4101ul
#define EV_SEVERITY_POWER_STABLE 0x0000ul
#define EV_SEVERITY_POWER_STABLE 0x0000ul
#define EV_SEVERITY_POWER_LOW_WARNING 0x0100ul
#define EV_SEVERITY_POWER_LOW_WARNING 0x0100ul
#define EV_SEVERITY_POWER_HIGH_WARNING 0x0200ul
#define EV_SEVERITY_POWER_HIGH_WARNING 0x0200ul
...
...
drivers/char/snsc_event.c
View file @
1f84253e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* License. See the file "COPYING" in the main directory of this archive
* License. See the file "COPYING" in the main directory of this archive
* for more details.
* for more details.
*
*
* Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2004
-2006
Silicon Graphics, Inc. All rights reserved.
*/
*/
/*
/*
...
@@ -187,7 +187,8 @@ scdrv_event_severity(int code)
...
@@ -187,7 +187,8 @@ scdrv_event_severity(int code)
static
void
static
void
scdrv_dispatch_event
(
char
*
event
,
int
len
)
scdrv_dispatch_event
(
char
*
event
,
int
len
)
{
{
int
code
,
esp_code
,
src
;
static
int
snsc_shutting_down
=
0
;
int
code
,
esp_code
,
src
,
class
;
char
desc
[
CHUNKSIZE
];
char
desc
[
CHUNKSIZE
];
char
*
severity
;
char
*
severity
;
...
@@ -199,9 +200,25 @@ scdrv_dispatch_event(char *event, int len)
...
@@ -199,9 +200,25 @@ scdrv_dispatch_event(char *event, int len)
/* how urgent is the message? */
/* how urgent is the message? */
severity
=
scdrv_event_severity
(
code
);
severity
=
scdrv_event_severity
(
code
);
if
((
code
&
EV_CLASS_MASK
)
==
EV_CLASS_PWRD_NOTIFY
)
{
class
=
(
code
&
EV_CLASS_MASK
);
if
(
class
==
EV_CLASS_PWRD_NOTIFY
||
code
==
ENV_PWRDN_PEND
)
{
struct
task_struct
*
p
;
struct
task_struct
*
p
;
if
(
snsc_shutting_down
)
return
;
snsc_shutting_down
=
1
;
/* give a message for each type of event */
if
(
class
==
EV_CLASS_PWRD_NOTIFY
)
printk
(
KERN_NOTICE
"Power off indication received."
" Sending SIGPWR to init...
\n
"
);
else
if
(
code
==
ENV_PWRDN_PEND
)
printk
(
KERN_CRIT
"WARNING: Shutting down the system"
" due to a critical environmental condition."
" Sending SIGPWR to init...
\n
"
);
/* give a SIGPWR signal to init proc */
/* give a SIGPWR signal to init proc */
/* first find init's task */
/* first find init's task */
...
@@ -210,12 +227,11 @@ scdrv_dispatch_event(char *event, int len)
...
@@ -210,12 +227,11 @@ scdrv_dispatch_event(char *event, int len)
if
(
p
->
pid
==
1
)
if
(
p
->
pid
==
1
)
break
;
break
;
}
}
if
(
p
)
{
/* we found init's task */
if
(
p
)
{
printk
(
KERN_EMERG
"Power off indication received. Initiating power fail sequence...
\n
"
);
force_sig
(
SIGPWR
,
p
);
force_sig
(
SIGPWR
,
p
);
}
else
{
/* failed to find init's task - just give message(s) */
}
else
{
printk
(
KERN_
WARNING
"Failed to find init proc to handle power off
!
\n
"
);
printk
(
KERN_
ERR
"Failed to signal init
!
\n
"
);
printk
(
"%s|$(0x%x)%s
\n
"
,
severity
,
esp_code
,
desc
);
snsc_shutting_down
=
0
;
/* so can try again (?) */
}
}
read_unlock
(
&
tasklist_lock
);
read_unlock
(
&
tasklist_lock
);
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment