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
nexedi
linux
Commits
759ee30e
Commit
759ee30e
authored
Nov 26, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
http://linux-acpi.bkbits.net/linux-acpi
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
52c7d802
cce8ca33
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
705 additions
and
652 deletions
+705
-652
drivers/acpi/ac.c
drivers/acpi/ac.c
+26
-31
drivers/acpi/button.c
drivers/acpi/button.c
+20
-25
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsmthdat.c
+35
-14
drivers/acpi/events/evevent.c
drivers/acpi/events/evevent.c
+41
-37
drivers/acpi/events/evrgnini.c
drivers/acpi/events/evrgnini.c
+6
-1
drivers/acpi/include/acconfig.h
drivers/acpi/include/acconfig.h
+2
-2
drivers/acpi/include/aclocal.h
drivers/acpi/include/aclocal.h
+2
-3
drivers/acpi/include/acpiosxf.h
drivers/acpi/include/acpiosxf.h
+8
-0
drivers/acpi/osl.c
drivers/acpi/osl.c
+39
-0
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psopcode.c
+2
-2
drivers/acpi/power.c
drivers/acpi/power.c
+29
-34
drivers/acpi/processor.c
drivers/acpi/processor.c
+153
-183
drivers/acpi/sleep.c
drivers/acpi/sleep.c
+44
-58
drivers/acpi/thermal.c
drivers/acpi/thermal.c
+117
-134
drivers/acpi/toshiba_acpi.c
drivers/acpi/toshiba_acpi.c
+133
-95
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/utcopy.c
+44
-20
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utmisc.c
+4
-13
No files found.
drivers/acpi/ac.c
View file @
759ee30e
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -53,6 +54,7 @@ MODULE_LICENSE("GPL");
...
@@ -53,6 +54,7 @@ MODULE_LICENSE("GPL");
int
acpi_ac_add
(
struct
acpi_device
*
device
);
int
acpi_ac_add
(
struct
acpi_device
*
device
);
int
acpi_ac_remove
(
struct
acpi_device
*
device
,
int
type
);
int
acpi_ac_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_ac_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_ac_driver
=
{
static
struct
acpi_driver
acpi_ac_driver
=
{
.
name
=
ACPI_AC_DRIVER_NAME
,
.
name
=
ACPI_AC_DRIVER_NAME
,
...
@@ -69,6 +71,12 @@ struct acpi_ac {
...
@@ -69,6 +71,12 @@ struct acpi_ac {
unsigned
long
state
;
unsigned
long
state
;
};
};
static
struct
file_operations
acpi_ac_fops
=
{
.
open
=
acpi_ac_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
AC Adapter Management
AC Adapter Management
...
@@ -103,53 +111,40 @@ acpi_ac_get_state (
...
@@ -103,53 +111,40 @@ acpi_ac_get_state (
struct
proc_dir_entry
*
acpi_ac_dir
=
NULL
;
struct
proc_dir_entry
*
acpi_ac_dir
=
NULL
;
static
int
int
acpi_ac_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_ac_read_state
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_ac
*
ac
=
(
struct
acpi_ac
*
)
data
;
struct
acpi_ac
*
ac
=
(
struct
acpi_ac
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_ac_
read_state
"
);
ACPI_FUNCTION_TRACE
(
"acpi_ac_
seq_show
"
);
if
(
!
ac
||
(
off
!=
0
)
)
if
(
!
ac
)
goto
end
;
return
0
;
if
(
acpi_ac_get_state
(
ac
))
{
if
(
acpi_ac_get_state
(
ac
))
{
p
+=
sprintf
(
p
,
"ERROR: Unable to read AC Adapter state
\n
"
);
seq_puts
(
seq
,
"ERROR: Unable to read AC Adapter state
\n
"
);
goto
end
;
return
0
;
}
}
p
+=
sprintf
(
p
,
"state: "
);
seq_puts
(
seq
,
"state: "
);
switch
(
ac
->
state
)
{
switch
(
ac
->
state
)
{
case
ACPI_AC_STATUS_OFFLINE
:
case
ACPI_AC_STATUS_OFFLINE
:
p
+=
sprintf
(
p
,
"off-line
\n
"
);
seq_puts
(
seq
,
"off-line
\n
"
);
break
;
break
;
case
ACPI_AC_STATUS_ONLINE
:
case
ACPI_AC_STATUS_ONLINE
:
p
+=
sprintf
(
p
,
"on-line
\n
"
);
seq_puts
(
seq
,
"on-line
\n
"
);
break
;
break
;
default:
default:
p
+=
sprintf
(
p
,
"unknown
\n
"
);
seq_puts
(
seq
,
"unknown
\n
"
);
break
;
break
;
}
}
end:
return
0
;
len
=
(
p
-
page
);
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_ac_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_ac_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_ac_add_fs
(
acpi_ac_add_fs
(
...
@@ -174,7 +169,7 @@ acpi_ac_add_fs (
...
@@ -174,7 +169,7 @@ acpi_ac_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_AC_FILE_STATE
));
ACPI_AC_FILE_STATE
));
else
{
else
{
entry
->
read_proc
=
acpi_ac_read_state
;
entry
->
proc_fops
=
&
acpi_ac_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/button.c
View file @
759ee30e
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -69,6 +70,7 @@ MODULE_LICENSE("GPL");
...
@@ -69,6 +70,7 @@ MODULE_LICENSE("GPL");
int
acpi_button_add
(
struct
acpi_device
*
device
);
int
acpi_button_add
(
struct
acpi_device
*
device
);
int
acpi_button_remove
(
struct
acpi_device
*
device
,
int
type
);
int
acpi_button_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_button_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_button_driver
=
{
static
struct
acpi_driver
acpi_button_driver
=
{
.
name
=
ACPI_BUTTON_DRIVER_NAME
,
.
name
=
ACPI_BUTTON_DRIVER_NAME
,
...
@@ -87,6 +89,12 @@ struct acpi_button {
...
@@ -87,6 +89,12 @@ struct acpi_button {
unsigned
long
pushed
;
unsigned
long
pushed
;
};
};
static
struct
file_operations
acpi_button_fops
=
{
.
open
=
acpi_button_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
FS Interface (/proc)
FS Interface (/proc)
...
@@ -94,38 +102,25 @@ struct acpi_button {
...
@@ -94,38 +102,25 @@ struct acpi_button {
static
struct
proc_dir_entry
*
acpi_button_dir
=
NULL
;
static
struct
proc_dir_entry
*
acpi_button_dir
=
NULL
;
static
int
static
int
acpi_button_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_button_read_info
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_button
*
button
=
(
struct
acpi_button
*
)
data
;
struct
acpi_button
*
button
=
(
struct
acpi_button
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_button_
read_info
"
);
ACPI_FUNCTION_TRACE
(
"acpi_button_
seq_show
"
);
if
(
!
button
||
!
button
->
device
)
if
(
!
button
||
!
button
->
device
)
goto
end
;
return
0
;
p
+=
sprintf
(
p
,
"type: %s
\n
"
,
seq_printf
(
seq
,
"type: %s
\n
"
,
acpi_device_name
(
button
->
device
));
acpi_device_name
(
button
->
device
));
end:
return
0
;
len
=
(
p
-
page
);
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_button_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_button_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_button_add_fs
(
acpi_button_add_fs
(
...
@@ -170,7 +165,7 @@ acpi_button_add_fs (
...
@@ -170,7 +165,7 @@ acpi_button_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_BUTTON_FILE_INFO
));
ACPI_BUTTON_FILE_INFO
));
else
{
else
{
entry
->
read_proc
=
acpi_button_read_info
;
entry
->
proc_fops
=
&
acpi_button_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/dispatcher/dsmthdat.c
View file @
759ee30e
/*******************************************************************************
/*******************************************************************************
*
*
* Module Name: dsmthdat - control method arguments and local variables
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 6
4
$
* $Revision: 6
6
$
*
*
******************************************************************************/
******************************************************************************/
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "acdispat.h"
#include "acdispat.h"
#include "amlcode.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
#define _COMPONENT ACPI_DISPATCHER
...
@@ -274,6 +275,7 @@ acpi_ds_method_data_get_node (
...
@@ -274,6 +275,7 @@ acpi_ds_method_data_get_node (
* RETURN: Status
* RETURN: Status
*
*
* DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
* DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
* Note: There is no "implicit conversion" for locals.
*
*
******************************************************************************/
******************************************************************************/
...
@@ -286,11 +288,17 @@ acpi_ds_method_data_set_value (
...
@@ -286,11 +288,17 @@ acpi_ds_method_data_set_value (
{
{
acpi_status
status
;
acpi_status
status
;
acpi_namespace_node
*
node
;
acpi_namespace_node
*
node
;
acpi_operand_object
*
new_desc
=
object
;
ACPI_FUNCTION_TRACE
(
"Ds_method_data_set_value"
);
ACPI_FUNCTION_TRACE
(
"Ds_method_data_set_value"
);
ACPI_DEBUG_PRINT
((
ACPI_DB_EXEC
,
"obj %p op %X, ref count = %d [%s]
\n
"
,
object
,
opcode
,
object
->
common
.
reference_count
,
acpi_ut_get_type_name
(
object
->
common
.
type
)));
/* Get the namespace node for the arg/local */
/* Get the namespace node for the arg/local */
status
=
acpi_ds_method_data_get_node
(
opcode
,
index
,
walk_state
,
&
node
);
status
=
acpi_ds_method_data_get_node
(
opcode
,
index
,
walk_state
,
&
node
);
...
@@ -298,14 +306,30 @@ acpi_ds_method_data_set_value (
...
@@ -298,14 +306,30 @@ acpi_ds_method_data_set_value (
return_ACPI_STATUS
(
status
);
return_ACPI_STATUS
(
status
);
}
}
/*
* If the object has just been created and is not attached to anything,
* (the reference count is 1), then we can just store it directly into
* the arg/local. Otherwise, we must copy it.
*/
if
(
object
->
common
.
reference_count
>
1
)
{
status
=
acpi_ut_copy_iobject_to_iobject
(
object
,
&
new_desc
,
walk_state
);
if
(
ACPI_FAILURE
(
status
))
{
return_ACPI_STATUS
(
status
);
}
ACPI_DEBUG_PRINT
((
ACPI_DB_EXEC
,
"Object Copied %p, new %p
\n
"
,
object
,
new_desc
));
}
else
{
/* Increment ref count so object can't be deleted while installed */
/* Increment ref count so object can't be deleted while installed */
acpi_ut_add_reference
(
object
);
acpi_ut_add_reference
(
new_desc
);
}
/* Install the object
into the stack entry
*/
/* Install the object */
node
->
object
=
object
;
node
->
object
=
new_desc
;
return_ACPI_STATUS
(
AE_OK
);
return_ACPI_STATUS
(
status
);
}
}
...
@@ -560,7 +584,8 @@ acpi_ds_store_object_to_local (
...
@@ -560,7 +584,8 @@ acpi_ds_store_object_to_local (
current_obj_desc
=
acpi_ns_get_attached_object
(
node
);
current_obj_desc
=
acpi_ns_get_attached_object
(
node
);
if
(
current_obj_desc
==
obj_desc
)
{
if
(
current_obj_desc
==
obj_desc
)
{
ACPI_DEBUG_PRINT
((
ACPI_DB_EXEC
,
"Obj=%p already installed!
\n
"
,
obj_desc
));
ACPI_DEBUG_PRINT
((
ACPI_DB_EXEC
,
"Obj=%p already installed!
\n
"
,
obj_desc
));
return_ACPI_STATUS
(
status
);
return_ACPI_STATUS
(
status
);
}
}
...
@@ -609,16 +634,12 @@ acpi_ds_store_object_to_local (
...
@@ -609,16 +634,12 @@ acpi_ds_store_object_to_local (
"Arg (%p) is an Obj_ref(Node), storing in node %p
\n
"
,
"Arg (%p) is an Obj_ref(Node), storing in node %p
\n
"
,
obj_desc
,
current_obj_desc
));
obj_desc
,
current_obj_desc
));
/* Detach an existing object from the referenced Node */
acpi_ns_detach_object
(
current_obj_desc
->
reference
.
object
);
/*
/*
* Store this object
in
to the Node
* Store this object to the Node
* (perform the indirect store)
* (perform the indirect store)
*/
*/
status
=
acpi_
ns_attach_object
(
current_obj_desc
->
reference
.
object
,
status
=
acpi_
ex_store_object_to_node
(
obj_desc
,
obj_desc
,
ACPI_GET_OBJECT_TYPE
(
obj_desc
)
);
current_obj_desc
->
reference
.
object
,
walk_state
);
return_ACPI_STATUS
(
status
);
return_ACPI_STATUS
(
status
);
}
}
}
}
...
...
drivers/acpi/events/evevent.c
View file @
759ee30e
/******************************************************************************
/******************************************************************************
*
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 9
6
$
* $Revision: 9
9
$
*
*
*****************************************************************************/
*****************************************************************************/
...
@@ -331,11 +331,8 @@ acpi_ev_gpe_initialize (void)
...
@@ -331,11 +331,8 @@ acpi_ev_gpe_initialize (void)
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* to be the same size."
* to be the same size."
*/
*/
acpi_gbl_gpe_block_info
[
0
].
address_space_id
=
acpi_gbl_FADT
->
Xgpe0_blk
.
address_space_id
;
acpi_gbl_gpe_block_info
[
0
].
register_count
=
0
;
acpi_gbl_gpe_block_info
[
1
].
address_space_id
=
acpi_gbl_FADT
->
Xgpe1_blk
.
address_space_id
;
acpi_gbl_gpe_block_info
[
1
].
register_count
=
0
;
acpi_gbl_gpe_block_info
[
0
].
register_count
=
(
u16
)
ACPI_DIV_16
(
acpi_gbl_FADT
->
Xgpe0_blk
.
register_bit_width
);
acpi_gbl_gpe_block_info
[
1
].
register_count
=
(
u16
)
ACPI_DIV_16
(
acpi_gbl_FADT
->
Xgpe1_blk
.
register_bit_width
);
acpi_gbl_gpe_block_info
[
0
].
block_address
=
&
acpi_gbl_FADT
->
Xgpe0_blk
;
acpi_gbl_gpe_block_info
[
0
].
block_address
=
&
acpi_gbl_FADT
->
Xgpe0_blk
;
acpi_gbl_gpe_block_info
[
1
].
block_address
=
&
acpi_gbl_FADT
->
Xgpe1_blk
;
acpi_gbl_gpe_block_info
[
1
].
block_address
=
&
acpi_gbl_FADT
->
Xgpe1_blk
;
...
@@ -343,28 +340,25 @@ acpi_ev_gpe_initialize (void)
...
@@ -343,28 +340,25 @@ acpi_ev_gpe_initialize (void)
acpi_gbl_gpe_block_info
[
0
].
block_base_number
=
0
;
acpi_gbl_gpe_block_info
[
0
].
block_base_number
=
0
;
acpi_gbl_gpe_block_info
[
1
].
block_base_number
=
acpi_gbl_FADT
->
gpe1_base
;
acpi_gbl_gpe_block_info
[
1
].
block_base_number
=
acpi_gbl_FADT
->
gpe1_base
;
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count
=
acpi_gbl_gpe_block_info
[
0
].
register_count
+
acpi_gbl_gpe_block_info
[
1
].
register_count
;
if
(
!
acpi_gbl_gpe_register_count
)
{
ACPI_REPORT_WARNING
((
"There are no GPE blocks defined in the FADT
\n
"
));
return_ACPI_STATUS
(
AE_OK
);
}
/*
/*
* Determine the maximum GPE number for this machine.
* Determine the maximum GPE number for this machine.
* Note: both GPE0 and GPE1 are optional, and either can exist without
* Note: both GPE0 and GPE1 are optional, and either can exist without
* the other
* the other.
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
*/
if
(
acpi_gbl_
gpe_block_info
[
0
].
register_count
)
{
if
(
acpi_gbl_
FADT
->
Xgpe0_blk
.
register_bit_width
&&
ACPI_GET_ADDRESS
(
acpi_gbl_FADT
->
Xgpe0_blk
.
address
)
)
{
/* GPE block 0 exists */
/* GPE block 0 exists
(has length and address > 0)
*/
acpi_gbl_gpe_block_info
[
0
].
register_count
=
(
u16
)
ACPI_DIV_16
(
acpi_gbl_FADT
->
Xgpe0_blk
.
register_bit_width
);
acpi_gbl_gpe_number_max
=
ACPI_MUL_8
(
acpi_gbl_gpe_block_info
[
0
].
register_count
)
-
1
;
acpi_gbl_gpe_number_max
=
ACPI_MUL_8
(
acpi_gbl_gpe_block_info
[
0
].
register_count
)
-
1
;
}
}
if
(
acpi_gbl_gpe_block_info
[
1
].
register_count
)
{
if
(
acpi_gbl_FADT
->
Xgpe1_blk
.
register_bit_width
&&
ACPI_GET_ADDRESS
(
acpi_gbl_FADT
->
Xgpe1_blk
.
address
))
{
/* GPE block 1 exists */
/* GPE block 1 exists (has length and address > 0) */
acpi_gbl_gpe_block_info
[
1
].
register_count
=
(
u16
)
ACPI_DIV_16
(
acpi_gbl_FADT
->
Xgpe1_blk
.
register_bit_width
);
/* Check for GPE0/GPE1 overlap (if both banks exist) */
/* Check for GPE0/GPE1 overlap (if both banks exist) */
...
@@ -385,6 +379,15 @@ acpi_ev_gpe_initialize (void)
...
@@ -385,6 +379,15 @@ acpi_ev_gpe_initialize (void)
(
ACPI_MUL_8
(
acpi_gbl_gpe_block_info
[
1
].
register_count
)
-
1
);
(
ACPI_MUL_8
(
acpi_gbl_gpe_block_info
[
1
].
register_count
)
-
1
);
}
}
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count
=
acpi_gbl_gpe_block_info
[
0
].
register_count
+
acpi_gbl_gpe_block_info
[
1
].
register_count
;
if
(
!
acpi_gbl_gpe_register_count
)
{
ACPI_REPORT_WARNING
((
"There are no GPE blocks defined in the FADT
\n
"
));
return_ACPI_STATUS
(
AE_OK
);
}
/* Check for Max GPE number out-of-range */
/* Check for Max GPE number out-of-range */
if
(
acpi_gbl_gpe_number_max
>
ACPI_GPE_MAX
)
{
if
(
acpi_gbl_gpe_number_max
>
ACPI_GPE_MAX
)
{
...
@@ -460,8 +463,8 @@ acpi_ev_gpe_initialize (void)
...
@@ -460,8 +463,8 @@ acpi_ev_gpe_initialize (void)
+
i
+
i
+
acpi_gbl_gpe_block_info
[
gpe_block
].
register_count
));
+
acpi_gbl_gpe_block_info
[
gpe_block
].
register_count
));
gpe_register_info
->
status_address
.
address_space_id
=
acpi_gbl_gpe_block_info
[
gpe_block
].
address_space_id
;
gpe_register_info
->
status_address
.
address_space_id
=
acpi_gbl_gpe_block_info
[
gpe_block
].
block_address
->
address_space_id
;
gpe_register_info
->
enable_address
.
address_space_id
=
acpi_gbl_gpe_block_info
[
gpe_block
].
address_space_id
;
gpe_register_info
->
enable_address
.
address_space_id
=
acpi_gbl_gpe_block_info
[
gpe_block
].
block_address
->
address_space_id
;
gpe_register_info
->
status_address
.
register_bit_width
=
8
;
gpe_register_info
->
status_address
.
register_bit_width
=
8
;
gpe_register_info
->
enable_address
.
register_bit_width
=
8
;
gpe_register_info
->
enable_address
.
register_bit_width
=
8
;
gpe_register_info
->
status_address
.
register_bit_offset
=
8
;
gpe_register_info
->
status_address
.
register_bit_offset
=
8
;
...
@@ -615,7 +618,7 @@ acpi_ev_save_method_info (
...
@@ -615,7 +618,7 @@ acpi_ev_save_method_info (
* for use during dispatch of this GPE.
* for use during dispatch of this GPE.
*/
*/
acpi_gbl_gpe_number_info
[
gpe_number_index
].
type
=
type
;
acpi_gbl_gpe_number_info
[
gpe_number_index
].
type
=
type
;
acpi_gbl_gpe_number_info
[
gpe_number_index
].
method_
handle
=
obj_handle
;
acpi_gbl_gpe_number_info
[
gpe_number_index
].
method_
node
=
(
acpi_namespace_node
*
)
obj_handle
;
/*
/*
* Enable the GPE (SCIs should be disabled at this point)
* Enable the GPE (SCIs should be disabled at this point)
...
@@ -625,7 +628,7 @@ acpi_ev_save_method_info (
...
@@ -625,7 +628,7 @@ acpi_ev_save_method_info (
return
(
status
);
return
(
status
);
}
}
ACPI_DEBUG_PRINT
((
ACPI_DB_INFO
,
"Registered GPE method %s as GPE number %X
\n
"
,
ACPI_DEBUG_PRINT
((
ACPI_DB_INFO
,
"Registered GPE method %s as GPE number %
2.2
X
\n
"
,
name
,
gpe_number
));
name
,
gpe_number
));
return
(
AE_OK
);
return
(
AE_OK
);
}
}
...
@@ -805,15 +808,16 @@ acpi_ev_asynch_execute_gpe_method (
...
@@ -805,15 +808,16 @@ acpi_ev_asynch_execute_gpe_method (
return_VOID
;
return_VOID
;
}
}
if
(
gpe_info
.
method_
handl
e
)
{
if
(
gpe_info
.
method_
nod
e
)
{
/*
/*
* Invoke the GPE Method (_Lxx, _Exx):
* Invoke the GPE Method (_Lxx, _Exx):
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
*/
*/
status
=
acpi_ns_evaluate_by_handle
(
gpe_info
.
method_
handl
e
,
NULL
,
NULL
);
status
=
acpi_ns_evaluate_by_handle
(
gpe_info
.
method_
nod
e
,
NULL
,
NULL
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
ACPI_REPORT_ERROR
((
"%s while evaluating GPE%X method
\n
"
,
ACPI_REPORT_ERROR
((
"%s while evaluating method [%4.4s] for GPE[%2.2X]
\n
"
,
acpi_format_exception
(
status
),
gpe_number
));
acpi_format_exception
(
status
),
gpe_info
.
method_node
->
name
.
ascii
,
gpe_number
));
}
}
}
}
...
@@ -881,7 +885,7 @@ acpi_ev_gpe_dispatch (
...
@@ -881,7 +885,7 @@ acpi_ev_gpe_dispatch (
if
(
gpe_info
->
type
&
ACPI_EVENT_EDGE_TRIGGERED
)
{
if
(
gpe_info
->
type
&
ACPI_EVENT_EDGE_TRIGGERED
)
{
status
=
acpi_hw_clear_gpe
(
gpe_number
);
status
=
acpi_hw_clear_gpe
(
gpe_number
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]
\n
"
,
gpe_number
));
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to clear GPE[%
2.2
X]
\n
"
,
gpe_number
));
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
}
}
}
}
...
@@ -898,14 +902,14 @@ acpi_ev_gpe_dispatch (
...
@@ -898,14 +902,14 @@ acpi_ev_gpe_dispatch (
gpe_info
->
handler
(
gpe_info
->
context
);
gpe_info
->
handler
(
gpe_info
->
context
);
}
}
else
if
(
gpe_info
->
method_
handl
e
)
{
else
if
(
gpe_info
->
method_
nod
e
)
{
/*
/*
* Disable GPE, so it doesn't keep firing before the method has a
* Disable GPE, so it doesn't keep firing before the method has a
* chance to run.
* chance to run.
*/
*/
status
=
acpi_hw_disable_gpe
(
gpe_number
);
status
=
acpi_hw_disable_gpe
(
gpe_number
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]
\n
"
,
gpe_number
));
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to disable GPE[%
2.2
X]
\n
"
,
gpe_number
));
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
}
}
...
@@ -915,13 +919,13 @@ acpi_ev_gpe_dispatch (
...
@@ -915,13 +919,13 @@ acpi_ev_gpe_dispatch (
if
(
ACPI_FAILURE
(
acpi_os_queue_for_execution
(
OSD_PRIORITY_GPE
,
if
(
ACPI_FAILURE
(
acpi_os_queue_for_execution
(
OSD_PRIORITY_GPE
,
acpi_ev_asynch_execute_gpe_method
,
acpi_ev_asynch_execute_gpe_method
,
ACPI_TO_POINTER
(
gpe_number
))))
{
ACPI_TO_POINTER
(
gpe_number
))))
{
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%X], event is disabled
\n
"
,
gpe_number
));
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%
2.2
X], event is disabled
\n
"
,
gpe_number
));
}
}
}
}
else
{
else
{
/* No handler or method to run! */
/* No handler or method to run! */
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: No handler or method for GPE[%X], disabling event
\n
"
,
gpe_number
));
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: No handler or method for GPE[%
2.2
X], disabling event
\n
"
,
gpe_number
));
/*
/*
* Disable the GPE. The GPE will remain disabled until the ACPI
* Disable the GPE. The GPE will remain disabled until the ACPI
...
@@ -929,7 +933,7 @@ acpi_ev_gpe_dispatch (
...
@@ -929,7 +933,7 @@ acpi_ev_gpe_dispatch (
*/
*/
status
=
acpi_hw_disable_gpe
(
gpe_number
);
status
=
acpi_hw_disable_gpe
(
gpe_number
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]
\n
"
,
gpe_number
));
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to disable GPE[%
2.2
X]
\n
"
,
gpe_number
));
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
}
}
}
}
...
@@ -940,7 +944,7 @@ acpi_ev_gpe_dispatch (
...
@@ -940,7 +944,7 @@ acpi_ev_gpe_dispatch (
if
(
gpe_info
->
type
&
ACPI_EVENT_LEVEL_TRIGGERED
)
{
if
(
gpe_info
->
type
&
ACPI_EVENT_LEVEL_TRIGGERED
)
{
status
=
acpi_hw_clear_gpe
(
gpe_number
);
status
=
acpi_hw_clear_gpe
(
gpe_number
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]
\n
"
,
gpe_number
));
ACPI_REPORT_ERROR
((
"Acpi_ev_gpe_dispatch: Unable to clear GPE[%
2.2
X]
\n
"
,
gpe_number
));
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
return_VALUE
(
ACPI_INTERRUPT_NOT_HANDLED
);
}
}
}
}
...
...
drivers/acpi/events/evrgnini.c
View file @
759ee30e
/******************************************************************************
/******************************************************************************
*
*
* Module Name: evrgnini- ACPI Address_space (Op_region) init
* Module Name: evrgnini- ACPI Address_space (Op_region) init
* $Revision: 6
3
$
* $Revision: 6
4
$
*
*
*****************************************************************************/
*****************************************************************************/
...
@@ -269,6 +269,11 @@ acpi_ev_pci_config_region_setup (
...
@@ -269,6 +269,11 @@ acpi_ev_pci_config_region_setup (
pci_id
->
bus
=
ACPI_LOWORD
(
temp
);
pci_id
->
bus
=
ACPI_LOWORD
(
temp
);
}
}
/*
* Complete this device's Pci_id
*/
acpi_os_derive_pci_id
(
node
,
region_obj
->
region
.
node
,
&
pci_id
);
*
region_context
=
pci_id
;
*
region_context
=
pci_id
;
return_ACPI_STATUS
(
AE_OK
);
return_ACPI_STATUS
(
AE_OK
);
}
}
...
...
drivers/acpi/include/acconfig.h
View file @
759ee30e
/******************************************************************************
/******************************************************************************
*
*
* Name: acconfig.h - Global configuration constants
* Name: acconfig.h - Global configuration constants
* $Revision: 11
8
$
* $Revision: 11
9
$
*
*
*****************************************************************************/
*****************************************************************************/
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
/* Version string */
/* Version string */
#define ACPI_CA_VERSION 0x200211
15
#define ACPI_CA_VERSION 0x200211
22
/* Version of ACPI supported */
/* Version of ACPI supported */
...
...
drivers/acpi/include/aclocal.h
View file @
759ee30e
/******************************************************************************
/******************************************************************************
*
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 1
79
$
* $Revision: 1
81
$
*
*
*****************************************************************************/
*****************************************************************************/
...
@@ -301,7 +301,6 @@ typedef struct
...
@@ -301,7 +301,6 @@ typedef struct
typedef
struct
typedef
struct
{
{
u8
address_space_id
;
acpi_generic_address
*
block_address
;
acpi_generic_address
*
block_address
;
u16
register_count
;
u16
register_count
;
u8
block_base_number
;
u8
block_base_number
;
...
@@ -330,7 +329,7 @@ typedef struct
...
@@ -330,7 +329,7 @@ typedef struct
typedef
struct
typedef
struct
{
{
acpi_
handle
method_handle
;
/* Method handle for direct (fast) execution
*/
acpi_
namespace_node
*
method_node
;
/* Method node for this GPE level
*/
acpi_gpe_handler
handler
;
/* Address of handler, if any */
acpi_gpe_handler
handler
;
/* Address of handler, if any */
void
*
context
;
/* Context to be passed to handler */
void
*
context
;
/* Context to be passed to handler */
u8
type
;
/* Level or Edge */
u8
type
;
/* Level or Edge */
...
...
drivers/acpi/include/acpiosxf.h
View file @
759ee30e
...
@@ -246,6 +246,14 @@ acpi_os_write_pci_configuration (
...
@@ -246,6 +246,14 @@ acpi_os_write_pci_configuration (
acpi_integer
value
,
acpi_integer
value
,
u32
width
);
u32
width
);
/*
* Interim function needed for PCI IRQ routing
*/
void
acpi_os_derive_pci_id
(
acpi_handle
rhandle
,
acpi_handle
chandle
,
acpi_pci_id
**
pci_id
);
/*
/*
* Miscellaneous
* Miscellaneous
...
...
drivers/acpi/osl.c
View file @
759ee30e
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <asm/io.h>
#include <asm/io.h>
#include "acpi_bus.h"
#include "acpi.h"
#include "acpi.h"
#ifdef CONFIG_ACPI_EFI
#ifdef CONFIG_ACPI_EFI
...
@@ -483,6 +484,44 @@ acpi_os_write_pci_configuration (
...
@@ -483,6 +484,44 @@ acpi_os_write_pci_configuration (
return
(
result
?
AE_ERROR
:
AE_OK
);
return
(
result
?
AE_ERROR
:
AE_OK
);
}
}
/* TODO: Rewrite this code!!! */
void
acpi_os_derive_pci_id
(
acpi_handle
rhandle
,
/* upper bound */
acpi_handle
chandle
,
/* current node */
acpi_pci_id
**
id
)
{
acpi_handle
handle
;
acpi_pci_id
*
pci_id
=
*
id
;
acpi_status
status
;
unsigned
long
temp
;
acpi_object_type
type
;
u8
tu8
;
acpi_get_parent
(
chandle
,
&
handle
);
if
(
handle
!=
rhandle
)
{
acpi_os_derive_pci_id
(
rhandle
,
handle
,
&
pci_id
);
status
=
acpi_get_type
(
handle
,
&
type
);
if
(
(
ACPI_FAILURE
(
status
))
||
(
type
!=
ACPI_TYPE_DEVICE
)
)
return
;
status
=
acpi_evaluate_integer
(
handle
,
METHOD_NAME__ADR
,
NULL
,
&
temp
);
if
(
ACPI_SUCCESS
(
status
))
{
pci_id
->
device
=
ACPI_HIWORD
(
ACPI_LODWORD
(
temp
));
pci_id
->
function
=
ACPI_LOWORD
(
ACPI_LODWORD
(
temp
));
/* any nicer way to get bus number of bridge ? */
status
=
acpi_os_read_pci_configuration
(
pci_id
,
0x0e
,
&
tu8
,
8
);
if
(
ACPI_SUCCESS
(
status
)
&&
(
tu8
&
0x7f
)
==
1
)
{
status
=
acpi_os_read_pci_configuration
(
pci_id
,
0x19
,
&
tu8
,
8
);
if
(
ACPI_SUCCESS
(
status
))
pci_id
->
bus
=
tu8
;
}
}
}
}
#else
/*!CONFIG_ACPI_PCI*/
#else
/*!CONFIG_ACPI_PCI*/
acpi_status
acpi_status
...
...
drivers/acpi/parser/psopcode.c
View file @
759ee30e
/******************************************************************************
/******************************************************************************
*
*
* Module Name: psopcode - Parser/Interpreter opcode information table
* Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 7
3
$
* $Revision: 7
4
$
*
*
*****************************************************************************/
*****************************************************************************/
...
@@ -734,7 +734,7 @@ NATIVE_CHAR *
...
@@ -734,7 +734,7 @@ NATIVE_CHAR *
acpi_ps_get_opcode_name
(
acpi_ps_get_opcode_name
(
u16
opcode
)
u16
opcode
)
{
{
#if
def ACPI_DISASSEMBLER
#if
defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
const
acpi_opcode_info
*
op
;
const
acpi_opcode_info
*
op
;
...
...
drivers/acpi/power.c
View file @
759ee30e
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -48,6 +49,7 @@ ACPI_MODULE_NAME ("acpi_power")
...
@@ -48,6 +49,7 @@ ACPI_MODULE_NAME ("acpi_power")
int
acpi_power_add
(
struct
acpi_device
*
device
);
int
acpi_power_add
(
struct
acpi_device
*
device
);
int
acpi_power_remove
(
struct
acpi_device
*
device
,
int
type
);
int
acpi_power_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_power_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_power_driver
=
{
static
struct
acpi_driver
acpi_power_driver
=
{
.
name
=
ACPI_POWER_DRIVER_NAME
,
.
name
=
ACPI_POWER_DRIVER_NAME
,
...
@@ -71,6 +73,12 @@ struct acpi_power_resource
...
@@ -71,6 +73,12 @@ struct acpi_power_resource
static
struct
list_head
acpi_power_resource_list
;
static
struct
list_head
acpi_power_resource_list
;
static
struct
file_operations
acpi_power_fops
=
{
.
open
=
acpi_power_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
Power Resource Management
Power Resource Management
...
@@ -379,58 +387,45 @@ acpi_power_transition (
...
@@ -379,58 +387,45 @@ acpi_power_transition (
struct
proc_dir_entry
*
acpi_power_dir
=
NULL
;
struct
proc_dir_entry
*
acpi_power_dir
=
NULL
;
static
int
acpi_power_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_power_read_status
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_power_resource
*
resource
=
NULL
;
struct
acpi_power_resource
*
resource
=
NULL
;
char
*
p
=
page
;
int
len
;
ACPI_FUNCTION_TRACE
(
"acpi_power_
read_status
"
);
ACPI_FUNCTION_TRACE
(
"acpi_power_
seq_show
"
);
if
(
!
data
||
(
off
!=
0
))
resource
=
(
struct
acpi_power_resource
*
)
seq
->
private
;
goto
end
;
resource
=
(
struct
acpi_power_resource
*
)
data
;
if
(
!
resource
)
goto
end
;
p
+=
sprintf
(
p
,
"state: "
);
seq_puts
(
seq
,
"state: "
);
switch
(
resource
->
state
)
{
switch
(
resource
->
state
)
{
case
ACPI_POWER_RESOURCE_STATE_ON
:
case
ACPI_POWER_RESOURCE_STATE_ON
:
p
+=
sprintf
(
p
,
"on
\n
"
);
seq_puts
(
seq
,
"on
\n
"
);
break
;
break
;
case
ACPI_POWER_RESOURCE_STATE_OFF
:
case
ACPI_POWER_RESOURCE_STATE_OFF
:
p
+=
sprintf
(
p
,
"off
\n
"
);
seq_puts
(
seq
,
"off
\n
"
);
break
;
break
;
default:
default:
p
+=
sprintf
(
p
,
"unknown
\n
"
);
seq_puts
(
seq
,
"unknown
\n
"
);
break
;
break
;
}
}
p
+=
sprintf
(
p
,
"system level: S%d
\n
"
,
seq_printf
(
seq
,
"system level: S%d
\n
"
resource
->
system_level
);
"order: %d
\n
"
p
+=
sprintf
(
p
,
"order:
%d
\n
"
,
"reference count:
%d
\n
"
,
resource
->
order
);
resource
->
system_level
,
p
+=
sprintf
(
p
,
"reference count: %d
\n
"
,
resource
->
order
,
resource
->
references
);
resource
->
references
);
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_power_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_power_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_power_add_fs
(
acpi_power_add_fs
(
...
@@ -458,7 +453,7 @@ acpi_power_add_fs (
...
@@ -458,7 +453,7 @@ acpi_power_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_POWER_FILE_STATUS
));
ACPI_POWER_FILE_STATUS
));
else
{
else
{
entry
->
read_proc
=
acpi_power_read_statu
s
;
entry
->
proc_fops
=
&
acpi_power_fop
s
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/processor.c
View file @
759ee30e
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include <asm/delay.h>
#include <asm/delay.h>
#include <linux/compatmac.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -90,6 +91,11 @@ MODULE_LICENSE("GPL");
...
@@ -90,6 +91,11 @@ MODULE_LICENSE("GPL");
static
int
acpi_processor_add
(
struct
acpi_device
*
device
);
static
int
acpi_processor_add
(
struct
acpi_device
*
device
);
static
int
acpi_processor_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_processor_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_processor_info_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_processor_throttling_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_processor_power_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_processor_limit_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_processor_driver
=
{
static
struct
acpi_driver
acpi_processor_driver
=
{
.
name
=
ACPI_PROCESSOR_DRIVER_NAME
,
.
name
=
ACPI_PROCESSOR_DRIVER_NAME
,
...
@@ -224,6 +230,34 @@ struct acpi_processor_errata {
...
@@ -224,6 +230,34 @@ struct acpi_processor_errata {
}
piix4
;
}
piix4
;
};
};
static
struct
file_operations
acpi_processor_info_fops
=
{
.
open
=
acpi_processor_info_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_processor_power_fops
=
{
.
open
=
acpi_processor_power_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_processor_throttling_fops
=
{
.
open
=
acpi_processor_throttling_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_processor_limit_fops
=
{
.
open
=
acpi_processor_limit_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
acpi_processor
*
processors
[
NR_CPUS
];
static
struct
acpi_processor
*
processors
[
NR_CPUS
];
static
struct
acpi_processor_errata
errata
;
static
struct
acpi_processor_errata
errata
;
static
void
(
*
pm_idle_save
)(
void
)
=
NULL
;
static
void
(
*
pm_idle_save
)(
void
)
=
NULL
;
...
@@ -231,6 +265,13 @@ static void (*pm_idle_save)(void) = NULL;
...
@@ -231,6 +265,13 @@ static void (*pm_idle_save)(void) = NULL;
#ifdef CONFIG_ACPI_PROCESSOR_PERF
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static
unsigned
int
cpufreq_usage_count
=
0
;
static
unsigned
int
cpufreq_usage_count
=
0
;
static
struct
cpufreq_driver
*
acpi_cpufreq_driver
;
static
struct
cpufreq_driver
*
acpi_cpufreq_driver
;
static
int
acpi_processor_perf_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
file_operations
acpi_processor_perf_fops
=
{
.
open
=
acpi_processor_perf_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
#endif
#endif
...
@@ -1884,174 +1925,132 @@ acpi_cpufreq_exit (
...
@@ -1884,174 +1925,132 @@ acpi_cpufreq_exit (
struct
proc_dir_entry
*
acpi_processor_dir
=
NULL
;
struct
proc_dir_entry
*
acpi_processor_dir
=
NULL
;
static
int
static
int
acpi_processor_info_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_processor_read_info
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
data
;
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_processor_
read_info
"
);
ACPI_FUNCTION_TRACE
(
"acpi_processor_
info_seq_show
"
);
if
(
!
pr
||
(
off
!=
0
)
)
if
(
!
pr
)
goto
end
;
goto
end
;
p
+=
sprintf
(
p
,
"processor id: %d
\n
"
,
seq_printf
(
seq
,
"processor id: %d
\n
"
pr
->
id
);
"acpi id: %d
\n
"
"bus mastering control: %s
\n
"
p
+=
sprintf
(
p
,
"acpi id: %d
\n
"
,
"power management: %s
\n
"
pr
->
acpi_id
);
"throttling control: %s
\n
"
"performance management: %s
\n
"
p
+=
sprintf
(
p
,
"bus mastering control: %s
\n
"
,
"limit interface: %s
\n
"
,
pr
->
flags
.
bm_control
?
"yes"
:
"no"
);
pr
->
id
,
pr
->
acpi_id
,
p
+=
sprintf
(
p
,
"power management: %s
\n
"
,
pr
->
flags
.
bm_control
?
"yes"
:
"no"
,
pr
->
flags
.
power
?
"yes"
:
"no"
);
pr
->
flags
.
power
?
"yes"
:
"no"
,
pr
->
flags
.
throttling
?
"yes"
:
"no"
,
p
+=
sprintf
(
p
,
"throttling control: %s
\n
"
,
pr
->
flags
.
performance
?
"yes"
:
"no"
,
pr
->
flags
.
throttling
?
"yes"
:
"no"
);
p
+=
sprintf
(
p
,
"performance management: %s
\n
"
,
pr
->
flags
.
performance
?
"yes"
:
"no"
);
p
+=
sprintf
(
p
,
"limit interface: %s
\n
"
,
pr
->
flags
.
limit
?
"yes"
:
"no"
);
pr
->
flags
.
limit
?
"yes"
:
"no"
);
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_processor_info_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_processor_info_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_processor_power_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_processor_read_power
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
data
;
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
int
i
=
0
;
int
i
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_processor_
read_power
"
);
ACPI_FUNCTION_TRACE
(
"acpi_processor_
power_seq_show
"
);
if
(
!
pr
||
(
off
!=
0
)
)
if
(
!
pr
)
goto
end
;
goto
end
;
p
+=
sprintf
(
p
,
"active state: C%d
\n
"
,
seq_printf
(
seq
,
"active state: C%d
\n
"
pr
->
power
.
state
);
"default state: C%d
\n
"
"bus master activity: %08x
\n
"
,
p
+=
sprintf
(
p
,
"default state: C%d
\n
"
,
pr
->
power
.
state
,
pr
->
power
.
default_state
);
pr
->
power
.
default_state
,
p
+=
sprintf
(
p
,
"bus master activity: %08x
\n
"
,
pr
->
power
.
bm_activity
);
pr
->
power
.
bm_activity
);
p
+=
sprintf
(
p
,
"states:
\n
"
);
seq_puts
(
seq
,
"states:
\n
"
);
for
(
i
=
1
;
i
<
ACPI_C_STATE_COUNT
;
i
++
)
{
p
+=
sprintf
(
p
,
" %cC%d: "
,
for
(
i
=
1
;
i
<
ACPI_C_STATE_COUNT
;
i
++
)
{
seq_printf
(
seq
,
" %cC%d: "
,
(
i
==
pr
->
power
.
state
?
'*'
:
' '
),
i
);
(
i
==
pr
->
power
.
state
?
'*'
:
' '
),
i
);
if
(
!
pr
->
power
.
states
[
i
].
valid
)
{
if
(
!
pr
->
power
.
states
[
i
].
valid
)
{
p
+=
sprintf
(
p
,
"<not supported>
\n
"
);
seq_puts
(
seq
,
"<not supported>
\n
"
);
continue
;
continue
;
}
}
if
(
pr
->
power
.
states
[
i
].
promotion
.
state
)
if
(
pr
->
power
.
states
[
i
].
promotion
.
state
)
p
+=
sprintf
(
p
,
"promotion[C%d] "
,
seq_printf
(
seq
,
"promotion[C%d] "
,
pr
->
power
.
states
[
i
].
promotion
.
state
);
pr
->
power
.
states
[
i
].
promotion
.
state
);
else
else
p
+=
sprintf
(
p
,
"promotion[--] "
);
seq_puts
(
seq
,
"promotion[--] "
);
if
(
pr
->
power
.
states
[
i
].
demotion
.
state
)
if
(
pr
->
power
.
states
[
i
].
demotion
.
state
)
p
+=
sprintf
(
p
,
"demotion[C%d] "
,
seq_printf
(
seq
,
"demotion[C%d] "
,
pr
->
power
.
states
[
i
].
demotion
.
state
);
pr
->
power
.
states
[
i
].
demotion
.
state
);
else
else
p
+=
sprintf
(
p
,
"demotion[--] "
);
seq_puts
(
seq
,
"demotion[--] "
);
p
+=
sprintf
(
p
,
"latency[%03d] usage[%08d]
\n
"
,
seq_printf
(
seq
,
"latency[%03d] usage[%08d]
\n
"
,
pr
->
power
.
states
[
i
].
latency
,
pr
->
power
.
states
[
i
].
latency
,
pr
->
power
.
states
[
i
].
usage
);
pr
->
power
.
states
[
i
].
usage
);
}
}
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
}
*
start
=
page
+
off
;
len
-=
off
;
static
int
acpi_processor_power_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
if
(
len
>
count
)
len
=
count
;
{
if
(
len
<
0
)
len
=
0
;
return
single_open
(
file
,
acpi_processor_power_seq_show
,
PDE
(
inode
)
->
data
);
return_VALUE
(
len
);
}
}
#ifdef CONFIG_ACPI_PROCESSOR_PERF
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static
int
static
int
acpi_processor_perf_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_processor_read_performance
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
data
;
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
int
i
=
0
;
int
i
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_processor_
read_performance
"
);
ACPI_FUNCTION_TRACE
(
"acpi_processor_
perf_seq_show
"
);
if
(
!
pr
||
(
off
!=
0
)
)
if
(
!
pr
)
goto
end
;
goto
end
;
if
(
!
pr
->
flags
.
performance
)
{
if
(
!
pr
->
flags
.
performance
)
{
p
+=
sprintf
(
p
,
"<not supported>
\n
"
);
seq_puts
(
seq
,
"<not supported>
\n
"
);
goto
end
;
goto
end
;
}
}
p
+=
sprintf
(
p
,
"state count: %d
\n
"
,
seq_printf
(
seq
,
"state count: %d
\n
"
pr
->
performance
.
state_count
);
"active state: P%d
\n
"
,
pr
->
performance
.
state_count
,
p
+=
sprintf
(
p
,
"active state: P%d
\n
"
,
pr
->
performance
.
state
);
pr
->
performance
.
state
);
p
+=
sprintf
(
p
,
"states:
\n
"
);
seq_puts
(
seq
,
"states:
\n
"
);
for
(
i
=
0
;
i
<
pr
->
performance
.
state_count
;
i
++
)
for
(
i
=
0
;
i
<
pr
->
performance
.
state_count
;
i
++
)
seq_printf
(
seq
,
" %cP%d: %d MHz, %d mW, %d uS
\n
"
,
p
+=
sprintf
(
p
,
" %cP%d: %d MHz, %d mW, %d uS
\n
"
,
(
i
==
pr
->
performance
.
state
?
'*'
:
' '
),
i
,
(
i
==
pr
->
performance
.
state
?
'*'
:
' '
),
i
,
(
u32
)
pr
->
performance
.
states
[
i
].
core_frequency
,
(
u32
)
pr
->
performance
.
states
[
i
].
core_frequency
,
(
u32
)
pr
->
performance
.
states
[
i
].
power
,
(
u32
)
pr
->
performance
.
states
[
i
].
power
,
(
u32
)
pr
->
performance
.
states
[
i
].
transition_latency
);
(
u32
)
pr
->
performance
.
states
[
i
].
transition_latency
);
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
}
*
start
=
page
+
off
;
len
-=
off
;
static
int
acpi_processor_perf_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
if
(
len
>
count
)
len
=
count
;
{
if
(
len
<
0
)
len
=
0
;
return
single_open
(
file
,
acpi_processor_perf_seq_show
,
PDE
(
inode
)
->
data
);
return_VALUE
(
len
);
}
}
static
int
static
int
...
@@ -2091,63 +2090,49 @@ acpi_processor_write_performance (
...
@@ -2091,63 +2090,49 @@ acpi_processor_write_performance (
}
}
#endif
#endif
static
int
acpi_processor_throttling_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_processor_read_throttling
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
data
;
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
int
i
=
0
;
int
i
=
0
;
int
result
=
0
;
int
result
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_processor_
read_throttling
"
);
ACPI_FUNCTION_TRACE
(
"acpi_processor_
throttling_seq_show
"
);
if
(
!
pr
||
(
off
!=
0
)
)
if
(
!
pr
)
goto
end
;
goto
end
;
if
(
!
(
pr
->
throttling
.
state_count
>
0
))
{
if
(
!
(
pr
->
throttling
.
state_count
>
0
))
{
p
+=
sprintf
(
p
,
"<not supported>
\n
"
);
seq_puts
(
seq
,
"<not supported>
\n
"
);
goto
end
;
goto
end
;
}
}
result
=
acpi_processor_get_throttling
(
pr
);
result
=
acpi_processor_get_throttling
(
pr
);
if
(
result
)
{
if
(
result
)
{
p
+=
sprintf
(
p
,
"Could not determine current throttling state.
\n
"
);
seq_puts
(
seq
,
"Could not determine current throttling state.
\n
"
);
goto
end
;
goto
end
;
}
}
p
+=
sprintf
(
p
,
"state count: %d
\n
"
,
seq_printf
(
seq
,
"state count: %d
\n
"
pr
->
throttling
.
state_count
);
"active state: T%d
\n
"
,
pr
->
throttling
.
state_count
,
p
+=
sprintf
(
p
,
"active state: T%d
\n
"
,
pr
->
throttling
.
state
);
pr
->
throttling
.
state
);
p
+=
sprintf
(
p
,
"states:
\n
"
);
seq_puts
(
seq
,
"states:
\n
"
);
for
(
i
=
0
;
i
<
pr
->
throttling
.
state_count
;
i
++
)
for
(
i
=
0
;
i
<
pr
->
throttling
.
state_count
;
i
++
)
seq_printf
(
seq
,
" %cT%d: %02d%%
\n
"
,
p
+=
sprintf
(
p
,
" %cT%d: %02d%%
\n
"
,
(
i
==
pr
->
throttling
.
state
?
'*'
:
' '
),
i
,
(
i
==
pr
->
throttling
.
state
?
'*'
:
' '
),
i
,
(
pr
->
throttling
.
states
[
i
].
performance
?
pr
->
throttling
.
states
[
i
].
performance
/
10
:
0
));
(
pr
->
throttling
.
states
[
i
].
performance
?
pr
->
throttling
.
states
[
i
].
performance
/
10
:
0
));
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_processor_throttling_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_processor_throttling_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_processor_write_throttling
(
acpi_processor_write_throttling
(
...
@@ -2178,53 +2163,38 @@ acpi_processor_write_throttling (
...
@@ -2178,53 +2163,38 @@ acpi_processor_write_throttling (
return_VALUE
(
count
);
return_VALUE
(
count
);
}
}
static
int
acpi_processor_limit_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_processor_read_limit
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
data
;
struct
acpi_processor
*
pr
=
(
struct
acpi_processor
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_processor_
read_limit
"
);
ACPI_FUNCTION_TRACE
(
"acpi_processor_
limit_seq_show
"
);
if
(
!
pr
||
(
off
!=
0
)
)
if
(
!
pr
)
goto
end
;
goto
end
;
if
(
!
pr
->
flags
.
limit
)
{
if
(
!
pr
->
flags
.
limit
)
{
p
+=
sprintf
(
p
,
"<not supported>
\n
"
);
seq_puts
(
seq
,
"<not supported>
\n
"
);
goto
end
;
goto
end
;
}
}
p
+=
sprintf
(
p
,
"active limit: P%d:T%d
\n
"
,
seq_printf
(
seq
,
"active limit: P%d:T%d
\n
"
pr
->
limit
.
state
.
px
,
pr
->
limit
.
state
.
tx
);
"platform limit: P%d:T0
\n
"
"user limit: P%d:T%d
\n
"
p
+=
sprintf
(
p
,
"platform limit: P%d:T0
\n
"
,
"thermal limit: P%d:T%d
\n
"
,
pr
->
flags
.
performance
?
pr
->
performance
.
platform_limit
:
0
);
pr
->
limit
.
state
.
px
,
pr
->
limit
.
state
.
tx
,
pr
->
flags
.
performance
?
pr
->
performance
.
platform_limit
:
0
,
p
+=
sprintf
(
p
,
"user limit: P%d:T%d
\n
"
,
pr
->
limit
.
user
.
px
,
pr
->
limit
.
user
.
tx
,
pr
->
limit
.
user
.
px
,
pr
->
limit
.
user
.
tx
);
p
+=
sprintf
(
p
,
"thermal limit: P%d:T%d
\n
"
,
pr
->
limit
.
thermal
.
px
,
pr
->
limit
.
thermal
.
tx
);
pr
->
limit
.
thermal
.
px
,
pr
->
limit
.
thermal
.
tx
);
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_processor_limit_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_processor_limit_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_processor_write_limit
(
acpi_processor_write_limit
(
...
@@ -2304,7 +2274,7 @@ acpi_processor_add_fs (
...
@@ -2304,7 +2274,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_PROCESSOR_FILE_INFO
));
ACPI_PROCESSOR_FILE_INFO
));
else
{
else
{
entry
->
read_proc
=
acpi_processor_read_info
;
entry
->
proc_fops
=
&
acpi_processor_info_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -2316,7 +2286,7 @@ acpi_processor_add_fs (
...
@@ -2316,7 +2286,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_PROCESSOR_FILE_POWER
));
ACPI_PROCESSOR_FILE_POWER
));
else
{
else
{
entry
->
read_proc
=
acpi_processor_read_power
;
entry
->
proc_fops
=
&
acpi_processor_power_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -2329,7 +2299,7 @@ acpi_processor_add_fs (
...
@@ -2329,7 +2299,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_PROCESSOR_FILE_PERFORMANCE
));
ACPI_PROCESSOR_FILE_PERFORMANCE
));
else
{
else
{
entry
->
read_proc
=
acpi_processor_read_performance
;
entry
->
proc_fops
=
&
acpi_processor_perf_fops
;
entry
->
write_proc
=
acpi_processor_write_performance
;
entry
->
write_proc
=
acpi_processor_write_performance
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -2343,7 +2313,7 @@ acpi_processor_add_fs (
...
@@ -2343,7 +2313,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_PROCESSOR_FILE_THROTTLING
));
ACPI_PROCESSOR_FILE_THROTTLING
));
else
{
else
{
entry
->
read_proc
=
acpi_processor_read_throttling
;
entry
->
proc_fops
=
&
acpi_processor_throttling_fops
;
entry
->
write_proc
=
acpi_processor_write_throttling
;
entry
->
write_proc
=
acpi_processor_write_throttling
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -2356,7 +2326,7 @@ acpi_processor_add_fs (
...
@@ -2356,7 +2326,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_PROCESSOR_FILE_LIMIT
));
ACPI_PROCESSOR_FILE_LIMIT
));
else
{
else
{
entry
->
read_proc
=
acpi_processor_read_limit
;
entry
->
proc_fops
=
&
acpi_processor_limit_fops
;
entry
->
write_proc
=
acpi_processor_write_limit
;
entry
->
write_proc
=
acpi_processor_write_limit
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/sleep.c
View file @
759ee30e
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/acpi.h>
#include <asm/acpi.h>
...
@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
...
@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
#define ACPI_SYSTEM_FILE_SLEEP "sleep"
#define ACPI_SYSTEM_FILE_SLEEP "sleep"
#define ACPI_SYSTEM_FILE_ALARM "alarm"
#define ACPI_SYSTEM_FILE_ALARM "alarm"
static
int
acpi_system_sleep_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_system_alarm_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
u8
sleep_states
[
ACPI_S_STATE_COUNT
];
static
u8
sleep_states
[
ACPI_S_STATE_COUNT
];
static
struct
file_operations
acpi_system_sleep_fops
=
{
.
open
=
acpi_system_sleep_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_system_alarm_fops
=
{
.
open
=
acpi_system_alarm_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
void
static
void
acpi_power_off
(
void
)
acpi_power_off
(
void
)
{
{
...
@@ -271,43 +289,26 @@ acpi_suspend (
...
@@ -271,43 +289,26 @@ acpi_suspend (
return
status
;
return
status
;
}
}
static
int
acpi_system_sleep_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_system_read_sleep
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
char
*
p
=
page
;
int
size
;
int
i
;
int
i
;
ACPI_FUNCTION_TRACE
(
"acpi_system_read_sleep"
);
ACPI_FUNCTION_TRACE
(
"acpi_system_sleep_seq_show"
);
if
(
off
!=
0
)
goto
end
;
for
(
i
=
0
;
i
<=
ACPI_STATE_S5
;
i
++
)
{
for
(
i
=
0
;
i
<=
ACPI_STATE_S5
;
i
++
)
{
if
(
sleep_states
[
i
])
if
(
sleep_states
[
i
])
p
+=
sprintf
(
p
,
"S%d "
,
i
);
seq_printf
(
seq
,
"S%d "
,
i
);
}
}
p
+=
sprintf
(
p
,
"
\n
"
);
seq_puts
(
seq
,
"
\n
"
);
end:
return
0
;
size
=
(
p
-
page
);
if
(
size
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
size
-=
off
;
if
(
size
>
count
)
size
=
count
;
if
(
size
<
0
)
size
=
0
;
return_VALUE
(
size
);
}
}
static
int
acpi_system_sleep_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_system_sleep_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_system_write_sleep
(
acpi_system_write_sleep
(
...
@@ -349,25 +350,12 @@ acpi_system_write_sleep (
...
@@ -349,25 +350,12 @@ acpi_system_write_sleep (
return_VALUE
(
count
);
return_VALUE
(
count
);
}
}
static
int
acpi_system_alarm_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_system_read_alarm
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
int
size
=
0
;
u32
sec
,
min
,
hr
;
u32
sec
,
min
,
hr
;
u32
day
,
mo
,
yr
;
u32
day
,
mo
,
yr
;
ACPI_FUNCTION_TRACE
(
"acpi_system_read_alarm"
);
ACPI_FUNCTION_TRACE
(
"acpi_system_alarm_seq_show"
);
if
(
off
!=
0
)
goto
end
;
spin_lock
(
&
rtc_lock
);
spin_lock
(
&
rtc_lock
);
...
@@ -427,21 +415,19 @@ acpi_system_read_alarm (
...
@@ -427,21 +415,19 @@ acpi_system_read_alarm (
yr
+=
2000
;
yr
+=
2000
;
#endif
#endif
p
+=
sprintf
(
p
,
"%4.4u-"
,
yr
);
seq_printf
(
seq
,
"%4.4u-"
,
yr
);
p
+=
(
mo
>
12
)
?
sprintf
(
p
,
"**-"
)
:
sprintf
(
p
,
"%2.2u-"
,
mo
);
(
mo
>
12
)
?
seq_puts
(
seq
,
"**-"
)
:
seq_printf
(
seq
,
"%2.2u-"
,
mo
);
p
+=
(
day
>
31
)
?
sprintf
(
p
,
"** "
)
:
sprintf
(
p
,
"%2.2u "
,
day
);
(
day
>
31
)
?
seq_puts
(
seq
,
"** "
)
:
seq_printf
(
seq
,
"%2.2u "
,
day
);
p
+=
(
hr
>
23
)
?
sprintf
(
p
,
"**:"
)
:
sprintf
(
p
,
"%2.2u:"
,
hr
);
(
hr
>
23
)
?
seq_puts
(
seq
,
"**:"
)
:
seq_printf
(
seq
,
"%2.2u:"
,
hr
);
p
+=
(
min
>
59
)
?
sprintf
(
p
,
"**:"
)
:
sprintf
(
p
,
"%2.2u:"
,
min
);
(
min
>
59
)
?
seq_puts
(
seq
,
"**:"
)
:
seq_printf
(
seq
,
"%2.2u:"
,
min
);
p
+=
(
sec
>
59
)
?
sprintf
(
p
,
"**
\n
"
)
:
sprintf
(
p
,
"%2.2u
\n
"
,
sec
);
(
sec
>
59
)
?
seq_puts
(
seq
,
"**
\n
"
)
:
seq_printf
(
seq
,
"%2.2u
\n
"
,
sec
);
end:
return
0
;
size
=
p
-
page
;
}
if
(
size
<
count
)
*
eof
=
1
;
else
if
(
size
>
count
)
size
=
count
;
static
int
acpi_system_alarm_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
if
(
size
<
0
)
size
=
0
;
{
*
start
=
page
;
return
single_open
(
file
,
acpi_system_alarm_seq_show
,
PDE
(
inode
)
->
data
);
return_VALUE
(
size
);
}
}
...
@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
...
@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_SYSTEM_FILE_SLEEP
));
ACPI_SYSTEM_FILE_SLEEP
));
else
{
else
{
entry
->
read_proc
=
acpi_system_read_sleep
;
entry
->
proc_fops
=
&
acpi_system_sleep_fops
;
entry
->
write_proc
=
acpi_system_write_sleep
;
entry
->
write_proc
=
acpi_system_write_sleep
;
}
}
...
@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
...
@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_SYSTEM_FILE_ALARM
));
ACPI_SYSTEM_FILE_ALARM
));
else
{
else
{
entry
->
read_proc
=
acpi_system_read_alarm
;
entry
->
proc_fops
=
&
acpi_system_alarm_fops
;
entry
->
write_proc
=
acpi_system_write_alarm
;
entry
->
write_proc
=
acpi_system_write_alarm
;
}
}
...
...
drivers/acpi/thermal.c
View file @
759ee30e
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/kmod.h>
#include <linux/kmod.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -79,6 +80,11 @@ MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
...
@@ -79,6 +80,11 @@ MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
static
int
acpi_thermal_add
(
struct
acpi_device
*
device
);
static
int
acpi_thermal_add
(
struct
acpi_device
*
device
);
static
int
acpi_thermal_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_thermal_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_thermal_state_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_thermal_temp_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_thermal_trip_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_thermal_cooling_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_thermal_polling_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_thermal_driver
=
{
static
struct
acpi_driver
acpi_thermal_driver
=
{
.
name
=
ACPI_THERMAL_DRIVER_NAME
,
.
name
=
ACPI_THERMAL_DRIVER_NAME
,
...
@@ -157,6 +163,40 @@ struct acpi_thermal {
...
@@ -157,6 +163,40 @@ struct acpi_thermal {
struct
timer_list
timer
;
struct
timer_list
timer
;
};
};
static
struct
file_operations
acpi_thermal_state_fops
=
{
.
open
=
acpi_thermal_state_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_thermal_temp_fops
=
{
.
open
=
acpi_thermal_temp_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_thermal_trip_fops
=
{
.
open
=
acpi_thermal_trip_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_thermal_cooling_fops
=
{
.
open
=
acpi_thermal_cooling_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_thermal_polling_fops
=
{
.
open
=
acpi_thermal_polling_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
Thermal Zone Management
Thermal Zone Management
...
@@ -720,154 +760,119 @@ acpi_thermal_check (
...
@@ -720,154 +760,119 @@ acpi_thermal_check (
struct
proc_dir_entry
*
acpi_thermal_dir
=
NULL
;
struct
proc_dir_entry
*
acpi_thermal_dir
=
NULL
;
static
int
acpi_thermal_state_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_thermal_read_state
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
data
;
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
read_state
"
);
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
state_seq_show
"
);
if
(
!
tz
||
(
off
!=
0
)
)
if
(
!
tz
)
goto
end
;
goto
end
;
p
+=
sprintf
(
p
,
"state: "
);
seq_puts
(
seq
,
"state: "
);
if
(
!
tz
->
state
.
critical
&&
!
tz
->
state
.
hot
&&
!
tz
->
state
.
passive
&&
!
tz
->
state
.
active
)
if
(
!
tz
->
state
.
critical
&&
!
tz
->
state
.
hot
&&
!
tz
->
state
.
passive
&&
!
tz
->
state
.
active
)
p
+=
sprintf
(
p
,
"ok
\n
"
);
seq_puts
(
seq
,
"ok
\n
"
);
else
{
else
{
if
(
tz
->
state
.
critical
)
if
(
tz
->
state
.
critical
)
p
+=
sprintf
(
p
,
"critical "
);
seq_puts
(
seq
,
"critical "
);
if
(
tz
->
state
.
hot
)
if
(
tz
->
state
.
hot
)
p
+=
sprintf
(
p
,
"hot "
);
seq_puts
(
seq
,
"hot "
);
if
(
tz
->
state
.
passive
)
if
(
tz
->
state
.
passive
)
p
+=
sprintf
(
p
,
"passive "
);
seq_puts
(
seq
,
"passive "
);
if
(
tz
->
state
.
active
)
if
(
tz
->
state
.
active
)
p
+=
sprintf
(
p
,
"active[%d]"
,
tz
->
state
.
active_index
);
seq_printf
(
seq
,
"active[%d]"
,
tz
->
state
.
active_index
);
p
+=
sprintf
(
p
,
"
\n
"
);
seq_puts
(
seq
,
"
\n
"
);
}
}
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_thermal_state_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_thermal_state_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
acpi_thermal_read_temperature
(
static
int
acpi_thermal_temp_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
int
result
=
0
;
int
result
=
0
;
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
data
;
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
read_temperature
"
);
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
temp_seq_show
"
);
if
(
!
tz
||
(
off
!=
0
)
)
if
(
!
tz
)
goto
end
;
goto
end
;
result
=
acpi_thermal_get_temperature
(
tz
);
result
=
acpi_thermal_get_temperature
(
tz
);
if
(
result
)
if
(
result
)
goto
end
;
goto
end
;
p
+=
sprintf
(
p
,
"temperature: %ld C
\n
"
,
seq_printf
(
seq
,
"temperature: %ld C
\n
"
,
KELVIN_TO_CELSIUS
(
tz
->
temperature
));
KELVIN_TO_CELSIUS
(
tz
->
temperature
));
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_thermal_temp_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_thermal_temp_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
acpi_thermal_read_trip_points
(
static
int
acpi_thermal_trip_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
data
;
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
int
i
=
0
;
int
i
=
0
;
int
j
=
0
;
int
j
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
read_trip_points
"
);
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
trip_seq_show
"
);
if
(
!
tz
||
(
off
!=
0
)
)
if
(
!
tz
)
goto
end
;
goto
end
;
if
(
tz
->
trips
.
critical
.
flags
.
valid
)
if
(
tz
->
trips
.
critical
.
flags
.
valid
)
p
+=
sprintf
(
p
,
"critical (S5): %ld C
\n
"
,
seq_printf
(
seq
,
"critical (S5): %ld C
\n
"
,
KELVIN_TO_CELSIUS
(
tz
->
trips
.
critical
.
temperature
));
KELVIN_TO_CELSIUS
(
tz
->
trips
.
critical
.
temperature
));
if
(
tz
->
trips
.
hot
.
flags
.
valid
)
if
(
tz
->
trips
.
hot
.
flags
.
valid
)
p
+=
sprintf
(
p
,
"hot (S4): %ld C
\n
"
,
seq_printf
(
seq
,
"hot (S4): %ld C
\n
"
,
KELVIN_TO_CELSIUS
(
tz
->
trips
.
hot
.
temperature
));
KELVIN_TO_CELSIUS
(
tz
->
trips
.
hot
.
temperature
));
if
(
tz
->
trips
.
passive
.
flags
.
valid
)
{
if
(
tz
->
trips
.
passive
.
flags
.
valid
)
{
p
+=
sprintf
(
p
,
"passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices="
,
seq_printf
(
seq
,
"passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices="
,
KELVIN_TO_CELSIUS
(
tz
->
trips
.
passive
.
temperature
),
KELVIN_TO_CELSIUS
(
tz
->
trips
.
passive
.
temperature
),
tz
->
trips
.
passive
.
tc1
,
tz
->
trips
.
passive
.
tc1
,
tz
->
trips
.
passive
.
tc2
,
tz
->
trips
.
passive
.
tc2
,
tz
->
trips
.
passive
.
tsp
);
tz
->
trips
.
passive
.
tsp
);
for
(
j
=
0
;
j
<
tz
->
trips
.
passive
.
devices
.
count
;
j
++
)
{
for
(
j
=
0
;
j
<
tz
->
trips
.
passive
.
devices
.
count
;
j
++
)
{
p
+=
sprintf
(
p
,
"0x%p "
,
tz
->
trips
.
passive
.
devices
.
handles
[
j
]);
seq_printf
(
seq
,
"0x%p "
,
tz
->
trips
.
passive
.
devices
.
handles
[
j
]);
}
}
p
+=
sprintf
(
p
,
"
\n
"
);
seq_puts
(
seq
,
"
\n
"
);
}
}
for
(
i
=
0
;
i
<
ACPI_THERMAL_MAX_ACTIVE
;
i
++
)
{
for
(
i
=
0
;
i
<
ACPI_THERMAL_MAX_ACTIVE
;
i
++
)
{
if
(
!
(
tz
->
trips
.
active
[
i
].
flags
.
valid
))
if
(
!
(
tz
->
trips
.
active
[
i
].
flags
.
valid
))
break
;
break
;
p
+=
sprintf
(
p
,
"active[%d]: %ld C: devices="
,
seq_printf
(
seq
,
"active[%d]: %ld C: devices="
,
i
,
KELVIN_TO_CELSIUS
(
tz
->
trips
.
active
[
i
].
temperature
));
i
,
KELVIN_TO_CELSIUS
(
tz
->
trips
.
active
[
i
].
temperature
));
for
(
j
=
0
;
j
<
tz
->
trips
.
active
[
i
].
devices
.
count
;
j
++
)
for
(
j
=
0
;
j
<
tz
->
trips
.
active
[
i
].
devices
.
count
;
j
++
)
p
+=
sprintf
(
p
,
"0x%p "
,
seq_printf
(
seq
,
"0x%p "
,
tz
->
trips
.
active
[
i
].
devices
.
handles
[
j
]);
tz
->
trips
.
active
[
i
].
devices
.
handles
[
j
]);
p
+=
sprintf
(
p
,
"
\n
"
);
seq_puts
(
seq
,
"
\n
"
);
}
}
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_thermal_trip_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_thermal_trip_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_thermal_write_trip_points
(
acpi_thermal_write_trip_points
(
...
@@ -909,43 +914,32 @@ acpi_thermal_write_trip_points (
...
@@ -909,43 +914,32 @@ acpi_thermal_write_trip_points (
}
}
static
int
static
int
acpi_thermal_cooling_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_thermal_read_cooling_mode
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
data
;
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
read_cooling_mode
"
);
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
cooling_seq_show
"
);
if
(
!
tz
||
(
off
!=
0
)
)
if
(
!
tz
)
goto
end
;
goto
end
;
if
(
!
tz
->
flags
.
cooling_mode
)
{
if
(
!
tz
->
flags
.
cooling_mode
)
{
p
+=
sprintf
(
p
,
"<not supported>
\n
"
);
seq_puts
(
seq
,
"<not supported>
\n
"
);
goto
end
;
goto
end
;
}
}
p
+=
sprintf
(
p
,
"cooling mode: %s
\n
"
,
seq_printf
(
seq
,
"cooling mode: %s
\n
"
,
tz
->
cooling_mode
?
"passive"
:
"active"
);
tz
->
cooling_mode
?
"passive"
:
"active"
);
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_thermal_cooling_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_thermal_cooling_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_thermal_write_cooling_mode
(
acpi_thermal_write_cooling_mode
(
...
@@ -980,43 +974,32 @@ acpi_thermal_write_cooling_mode (
...
@@ -980,43 +974,32 @@ acpi_thermal_write_cooling_mode (
}
}
static
int
static
int
acpi_thermal_polling_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_thermal_read_polling
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
data
;
struct
acpi_thermal
*
tz
=
(
struct
acpi_thermal
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
read_polling
"
);
ACPI_FUNCTION_TRACE
(
"acpi_thermal_
polling_seq_show
"
);
if
(
!
tz
||
(
off
!=
0
)
)
if
(
!
tz
)
goto
end
;
goto
end
;
if
(
!
tz
->
polling_frequency
)
{
if
(
!
tz
->
polling_frequency
)
{
p
+=
sprintf
(
p
,
"<polling disabled>
\n
"
);
seq_puts
(
seq
,
"<polling disabled>
\n
"
);
goto
end
;
goto
end
;
}
}
p
+=
sprintf
(
p
,
"polling frequency: %lu seconds
\n
"
,
seq_printf
(
seq
,
"polling frequency: %lu seconds
\n
"
,
(
tz
->
polling_frequency
/
10
));
(
tz
->
polling_frequency
/
10
));
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_thermal_polling_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_thermal_polling_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_thermal_write_polling
(
acpi_thermal_write_polling
(
...
@@ -1075,7 +1058,7 @@ acpi_thermal_add_fs (
...
@@ -1075,7 +1058,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_THERMAL_FILE_STATE
));
ACPI_THERMAL_FILE_STATE
));
else
{
else
{
entry
->
read_proc
=
acpi_thermal_read_state
;
entry
->
proc_fops
=
&
acpi_thermal_state_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -1087,7 +1070,7 @@ acpi_thermal_add_fs (
...
@@ -1087,7 +1070,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_THERMAL_FILE_TEMPERATURE
));
ACPI_THERMAL_FILE_TEMPERATURE
));
else
{
else
{
entry
->
read_proc
=
acpi_thermal_read_temperature
;
entry
->
proc_fops
=
&
acpi_thermal_temp_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -1099,7 +1082,7 @@ acpi_thermal_add_fs (
...
@@ -1099,7 +1082,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_THERMAL_FILE_POLLING_FREQ
));
ACPI_THERMAL_FILE_POLLING_FREQ
));
else
{
else
{
entry
->
read_proc
=
acpi_thermal_read_trip_point
s
;
entry
->
proc_fops
=
&
acpi_thermal_trip_fop
s
;
entry
->
write_proc
=
acpi_thermal_write_trip_points
;
entry
->
write_proc
=
acpi_thermal_write_trip_points
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -1112,7 +1095,7 @@ acpi_thermal_add_fs (
...
@@ -1112,7 +1095,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_THERMAL_FILE_COOLING_MODE
));
ACPI_THERMAL_FILE_COOLING_MODE
));
else
{
else
{
entry
->
read_proc
=
acpi_thermal_read_cooling_mode
;
entry
->
proc_fops
=
&
acpi_thermal_cooling_fops
;
entry
->
write_proc
=
acpi_thermal_write_cooling_mode
;
entry
->
write_proc
=
acpi_thermal_write_cooling_mode
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
@@ -1125,7 +1108,7 @@ acpi_thermal_add_fs (
...
@@ -1125,7 +1108,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_THERMAL_FILE_POLLING_FREQ
));
ACPI_THERMAL_FILE_POLLING_FREQ
));
else
{
else
{
entry
->
read_proc
=
acpi_thermal_read_polling
;
entry
->
proc_fops
=
&
acpi_thermal_polling_fops
;
entry
->
write_proc
=
acpi_thermal_write_polling
;
entry
->
write_proc
=
acpi_thermal_write_polling
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/toshiba_acpi.c
View file @
759ee30e
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/version.h>
#include <linux/version.h>
#include <acconfig.h>
#include <acconfig.h>
...
@@ -100,6 +101,47 @@ MODULE_LICENSE("GPL");
...
@@ -100,6 +101,47 @@ MODULE_LICENSE("GPL");
#define HCI_VIDEO_OUT_CRT 0x2
#define HCI_VIDEO_OUT_CRT 0x2
#define HCI_VIDEO_OUT_TV 0x4
#define HCI_VIDEO_OUT_TV 0x4
static
int
toshiba_lcd_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_video_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_fan_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_keys_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_version_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
file_operations
toshiba_lcd_fops
=
{
.
open
=
toshiba_lcd_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_video_fops
=
{
.
open
=
toshiba_video_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_fan_fops
=
{
.
open
=
toshiba_fan_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_keys_fops
=
{
.
open
=
toshiba_keys_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_version_fops
=
{
.
open
=
toshiba_version_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* utility
/* utility
*/
*/
...
@@ -126,22 +168,6 @@ snscanf(const char* str, int n, const char* format, ...)
...
@@ -126,22 +168,6 @@ snscanf(const char* str, int n, const char* format, ...)
return
result
;
return
result
;
}
}
/* This is the common code at the end of every proc read handler. I don't
* understand it yet.
*/
static
int
end_proc_read
(
const
char
*
p
,
char
*
page
,
off_t
off
,
int
count
,
char
**
start
,
int
*
eof
)
{
int
len
=
(
p
-
page
);
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return
len
;
}
/* acpi interface wrappers
/* acpi interface wrappers
*/
*/
...
@@ -259,29 +285,27 @@ static int key_event_valid;
...
@@ -259,29 +285,27 @@ static int key_event_valid;
/* proc file handlers
/* proc file handlers
*/
*/
static
int
static
int
toshiba_lcd_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_lcd
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
hci_read1
(
HCI_LCD_BRIGHTNESS
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_LCD_BRIGHTNESS
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
value
=
value
>>
HCI_LCD_BRIGHTNESS_SHIFT
;
value
=
value
>>
HCI_LCD_BRIGHTNESS_SHIFT
;
p
+=
sprintf
(
p
,
"brightness: %d
\n
"
,
value
);
seq_printf
(
seq
,
"brightness: %d
\n
"
p
+=
sprintf
(
p
,
"brightness_levels: %d
\n
"
,
"brightness_levels: %d
\n
"
,
value
,
HCI_LCD_BRIGHTNESS_LEVELS
);
HCI_LCD_BRIGHTNESS_LEVELS
);
}
else
{
}
else
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
seq_puts
(
seq
,
"ERROR
\n
"
);
goto
end
;
}
end:
return
0
;
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
}
static
int
toshiba_lcd_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
toshiba_lcd_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -306,31 +330,31 @@ proc_write_lcd(struct file* file, const char* buffer, unsigned long count,
...
@@ -306,31 +330,31 @@ proc_write_lcd(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_video_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_video
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
hci_read1
(
HCI_VIDEO_OUT
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_VIDEO_OUT
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
int
is_lcd
=
(
value
&
HCI_VIDEO_OUT_LCD
)
?
1
:
0
;
int
is_lcd
=
(
value
&
HCI_VIDEO_OUT_LCD
)
?
1
:
0
;
int
is_crt
=
(
value
&
HCI_VIDEO_OUT_CRT
)
?
1
:
0
;
int
is_crt
=
(
value
&
HCI_VIDEO_OUT_CRT
)
?
1
:
0
;
int
is_tv
=
(
value
&
HCI_VIDEO_OUT_TV
)
?
1
:
0
;
int
is_tv
=
(
value
&
HCI_VIDEO_OUT_TV
)
?
1
:
0
;
p
+=
sprintf
(
p
,
"lcd_out: %d
\n
"
,
is_lcd
);
seq_printf
(
seq
,
"lcd_out: %d
\n
"
p
+=
sprintf
(
p
,
"crt_out: %d
\n
"
,
is_crt
);
"crt_out: %d
\n
"
p
+=
sprintf
(
p
,
"tv_out: %d
\n
"
,
is_tv
);
"tv_out: %d
\n
"
,
}
else
{
is_lcd
,
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
is_crt
,
goto
end
;
is_tv
);
}
}
else
seq_puts
(
seq
,
"ERROR
\n
"
);
return
0
;
}
end:
static
int
toshiba_video_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
{
return
single_open
(
file
,
toshiba_video_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -376,27 +400,26 @@ proc_write_video(struct file* file, const char* buffer, unsigned long count,
...
@@ -376,27 +400,26 @@ proc_write_video(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_fan_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_fan
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
hci_read1
(
HCI_FAN
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_FAN
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
p
+=
sprintf
(
p
,
"running: %d
\n
"
,
(
value
>
0
));
seq_printf
(
seq
,
"running: %d
\n
"
p
+=
sprintf
(
p
,
"force_on: %d
\n
"
,
force_fan
);
"force_on: %d
\n
"
,
}
else
{
(
value
>
0
),
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
force_fan
);
goto
end
;
}
else
}
seq_puts
(
seq
,
"ERROR
\n
"
);
return
0
;
}
end:
static
int
toshiba_fan_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
{
return
single_open
(
file
,
toshiba_fan_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -420,16 +443,11 @@ proc_write_fan(struct file* file, const char* buffer, unsigned long count,
...
@@ -420,16 +443,11 @@ proc_write_fan(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_keys_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_keys
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
if
(
!
key_event_valid
)
{
if
(
!
key_event_valid
)
{
hci_read1
(
HCI_SYSTEM_EVENT
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_SYSTEM_EVENT
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
...
@@ -438,16 +456,23 @@ proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
...
@@ -438,16 +456,23 @@ proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
}
else
if
(
hci_result
==
HCI_EMPTY
)
{
}
else
if
(
hci_result
==
HCI_EMPTY
)
{
/* better luck next time */
/* better luck next time */
}
else
{
}
else
{
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
seq_puts
(
seq
,
"ERROR
\n
"
);
goto
end
;
goto
end
;
}
}
}
}
p
+=
sprintf
(
p
,
"hotkey_ready: %d
\n
"
,
key_event_valid
);
seq_printf
(
seq
,
"hotkey_ready: %d
\n
"
p
+=
sprintf
(
p
,
"hotkey: 0x%04x
\n
"
,
last_key_event
);
"hotkey: 0x%04x
\n
"
,
key_event_valid
,
last_key_event
);
end:
end:
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
return
0
;
}
static
int
toshiba_keys_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
toshiba_keys_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -466,20 +491,19 @@ proc_write_keys(struct file* file, const char* buffer, unsigned long count,
...
@@ -466,20 +491,19 @@ proc_write_keys(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_version_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_version
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
seq_printf
(
seq
,
"driver: %s
\n
"
"proc_interface: %d
\n
"
,
if
(
off
!=
0
)
goto
end
;
TOSHIBA_ACPI_VERSION
,
p
+=
sprintf
(
p
,
"driver: %s
\n
"
,
TOSHIBA_ACPI_VERSION
);
p
+=
sprintf
(
p
,
"proc_interface: %d
\n
"
,
PROC_INTERFACE_VERSION
);
PROC_INTERFACE_VERSION
);
end:
return
0
;
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
}
static
int
toshiba_version_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
toshiba_version_seq_show
,
NULL
);
}
}
/* proc and module init
/* proc and module init
...
@@ -490,24 +514,38 @@ add_device(void)
...
@@ -490,24 +514,38 @@ add_device(void)
{
{
struct
proc_dir_entry
*
proc
;
struct
proc_dir_entry
*
proc
;
proc
=
create_proc_read_entry
(
PROC_LCD
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_LCD
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_lcd
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_lcd
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_lcd_fops
;
proc
->
write_proc
=
proc_write_lcd
;
}
proc
=
create_proc_read_entry
(
PROC_VIDEO
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_VIDEO
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_video
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_video
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_video_fops
;
proc
->
write_proc
=
proc_write_video
;
}
proc
=
create_proc_read_entry
(
PROC_FAN
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_FAN
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_fan
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_fan
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_fan_fops
;
proc
->
write_proc
=
proc_write_fan
;
}
proc
=
create_proc_read_entry
(
PROC_KEYS
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_KEYS
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_keys
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_keys
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_keys_fops
;
proc
->
write_proc
=
proc_write_keys
;
}
proc
=
create_proc_read_entry
(
PROC_VERSION
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_VERSION
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_version
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
proc_fops
=
&
toshiba_version_fops
;
return
(
AE_OK
);
return
(
AE_OK
);
}
}
...
...
drivers/acpi/utilities/utcopy.c
View file @
759ee30e
/******************************************************************************
/******************************************************************************
*
*
* Module Name: utcopy - Internal to external object translation utilities
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 10
5
$
* $Revision: 10
6
$
*
*
*****************************************************************************/
*****************************************************************************/
...
@@ -419,7 +419,8 @@ acpi_ut_copy_esimple_to_isimple (
...
@@ -419,7 +419,8 @@ acpi_ut_copy_esimple_to_isimple (
case
ACPI_TYPE_STRING
:
case
ACPI_TYPE_STRING
:
internal_object
->
string
.
pointer
=
ACPI_MEM_CALLOCATE
((
ACPI_SIZE
)
external_object
->
string
.
length
+
1
);
internal_object
->
string
.
pointer
=
ACPI_MEM_CALLOCATE
((
ACPI_SIZE
)
external_object
->
string
.
length
+
1
);
if
(
!
internal_object
->
string
.
pointer
)
{
if
(
!
internal_object
->
string
.
pointer
)
{
return_ACPI_STATUS
(
AE_NO_MEMORY
);
return_ACPI_STATUS
(
AE_NO_MEMORY
);
}
}
...
@@ -434,7 +435,8 @@ acpi_ut_copy_esimple_to_isimple (
...
@@ -434,7 +435,8 @@ acpi_ut_copy_esimple_to_isimple (
case
ACPI_TYPE_BUFFER
:
case
ACPI_TYPE_BUFFER
:
internal_object
->
buffer
.
pointer
=
ACPI_MEM_CALLOCATE
(
external_object
->
buffer
.
length
);
internal_object
->
buffer
.
pointer
=
ACPI_MEM_CALLOCATE
(
external_object
->
buffer
.
length
);
if
(
!
internal_object
->
buffer
.
pointer
)
{
if
(
!
internal_object
->
buffer
.
pointer
)
{
return_ACPI_STATUS
(
AE_NO_MEMORY
);
return_ACPI_STATUS
(
AE_NO_MEMORY
);
}
}
...
@@ -474,7 +476,7 @@ acpi_ut_copy_esimple_to_isimple (
...
@@ -474,7 +476,7 @@ acpi_ut_copy_esimple_to_isimple (
* *Buffer - Where the object is returned
* *Buffer - Where the object is returned
* *Space_used - Where the length of the object is returned
* *Space_used - Where the length of the object is returned
*
*
* RETURN: Status
- the status of the call
* RETURN: Status
*
*
* DESCRIPTION: This function is called to place a package object in a user
* DESCRIPTION: This function is called to place a package object in a user
* buffer. A package object by definition contains other objects.
* buffer. A package object by definition contains other objects.
...
@@ -607,7 +609,8 @@ acpi_ut_copy_simple_object (
...
@@ -607,7 +609,8 @@ acpi_ut_copy_simple_object (
/* Copy the entire source object over the destination object*/
/* Copy the entire source object over the destination object*/
ACPI_MEMCPY
((
char
*
)
dest_desc
,
(
char
*
)
source_desc
,
sizeof
(
acpi_operand_object
));
ACPI_MEMCPY
((
char
*
)
dest_desc
,
(
char
*
)
source_desc
,
sizeof
(
acpi_operand_object
));
/* Restore the saved fields */
/* Restore the saved fields */
...
@@ -687,12 +690,16 @@ acpi_ut_copy_ielement_to_ielement (
...
@@ -687,12 +690,16 @@ acpi_ut_copy_ielement_to_ielement (
&
state
->
pkg
.
dest_object
->
package
.
elements
[
this_index
];
&
state
->
pkg
.
dest_object
->
package
.
elements
[
this_index
];
switch
(
object_type
)
{
switch
(
object_type
)
{
case
0
:
case
ACPI_COPY_TYPE_SIMPLE
:
/* A null source object indicates a (legal) null package element */
if
(
source_object
)
{
/*
/*
* This is a simple object, just copy it
* This is a simple object, just copy it
*/
*/
target_object
=
acpi_ut_create_internal_object
(
ACPI_GET_OBJECT_TYPE
(
source_object
));
target_object
=
acpi_ut_create_internal_object
(
ACPI_GET_OBJECT_TYPE
(
source_object
));
if
(
!
target_object
)
{
if
(
!
target_object
)
{
return
(
AE_NO_MEMORY
);
return
(
AE_NO_MEMORY
);
}
}
...
@@ -703,10 +710,16 @@ acpi_ut_copy_ielement_to_ielement (
...
@@ -703,10 +710,16 @@ acpi_ut_copy_ielement_to_ielement (
}
}
*
this_target_ptr
=
target_object
;
*
this_target_ptr
=
target_object
;
}
else
{
/* Pass through a null element */
*
this_target_ptr
=
NULL
;
}
break
;
break
;
case
1
:
case
ACPI_COPY_TYPE_PACKAGE
:
/*
/*
* This object is a package - go down another nesting level
* This object is a package - go down another nesting level
...
@@ -720,6 +733,17 @@ acpi_ut_copy_ielement_to_ielement (
...
@@ -720,6 +733,17 @@ acpi_ut_copy_ielement_to_ielement (
target_object
->
package
.
count
=
source_object
->
package
.
count
;
target_object
->
package
.
count
=
source_object
->
package
.
count
;
target_object
->
common
.
flags
=
source_object
->
common
.
flags
;
target_object
->
common
.
flags
=
source_object
->
common
.
flags
;
/*
* Create the object array
*/
target_object
->
package
.
elements
=
ACPI_MEM_CALLOCATE
(((
ACPI_SIZE
)
source_object
->
package
.
count
+
1
)
*
sizeof
(
void
*
));
if
(
!
target_object
->
package
.
elements
)
{
ACPI_MEM_FREE
(
target_object
);
return
(
AE_NO_MEMORY
);
}
/*
/*
* Pass the new package object back to the package walk routine
* Pass the new package object back to the package walk routine
*/
*/
...
...
drivers/acpi/utilities/utmisc.c
View file @
759ee30e
/*******************************************************************************
/*******************************************************************************
*
*
* Module Name: utmisc - common utility procedures
* Module Name: utmisc - common utility procedures
* $Revision: 8
6
$
* $Revision: 8
7
$
*
*
******************************************************************************/
******************************************************************************/
...
@@ -475,7 +475,6 @@ acpi_ut_strupr (
...
@@ -475,7 +475,6 @@ acpi_ut_strupr (
string
++
;
string
++
;
}
}
return
(
src_string
);
return
(
src_string
);
}
}
...
@@ -575,7 +574,6 @@ acpi_ut_create_mutex (
...
@@ -575,7 +574,6 @@ acpi_ut_create_mutex (
return_ACPI_STATUS
(
AE_BAD_PARAMETER
);
return_ACPI_STATUS
(
AE_BAD_PARAMETER
);
}
}
if
(
!
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
)
{
if
(
!
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
)
{
status
=
acpi_os_create_semaphore
(
1
,
1
,
status
=
acpi_os_create_semaphore
(
1
,
1
,
&
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
);
&
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
);
...
@@ -613,7 +611,6 @@ acpi_ut_delete_mutex (
...
@@ -613,7 +611,6 @@ acpi_ut_delete_mutex (
return_ACPI_STATUS
(
AE_BAD_PARAMETER
);
return_ACPI_STATUS
(
AE_BAD_PARAMETER
);
}
}
status
=
acpi_os_delete_semaphore
(
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
);
status
=
acpi_os_delete_semaphore
(
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
);
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
=
NULL
;
acpi_gbl_acpi_mutex_info
[
mutex_id
].
mutex
=
NULL
;
...
@@ -651,7 +648,6 @@ acpi_ut_acquire_mutex (
...
@@ -651,7 +648,6 @@ acpi_ut_acquire_mutex (
return
(
AE_BAD_PARAMETER
);
return
(
AE_BAD_PARAMETER
);
}
}
this_thread_id
=
acpi_os_get_thread_id
();
this_thread_id
=
acpi_os_get_thread_id
();
/*
/*
...
@@ -679,7 +675,6 @@ acpi_ut_acquire_mutex (
...
@@ -679,7 +675,6 @@ acpi_ut_acquire_mutex (
}
}
}
}
ACPI_DEBUG_PRINT
((
ACPI_DB_MUTEX
,
ACPI_DEBUG_PRINT
((
ACPI_DB_MUTEX
,
"Thread %X attempting to acquire Mutex [%s]
\n
"
,
"Thread %X attempting to acquire Mutex [%s]
\n
"
,
this_thread_id
,
acpi_ut_get_mutex_name
(
mutex_id
)));
this_thread_id
,
acpi_ut_get_mutex_name
(
mutex_id
)));
...
@@ -693,7 +688,6 @@ acpi_ut_acquire_mutex (
...
@@ -693,7 +688,6 @@ acpi_ut_acquire_mutex (
acpi_gbl_acpi_mutex_info
[
mutex_id
].
use_count
++
;
acpi_gbl_acpi_mutex_info
[
mutex_id
].
use_count
++
;
acpi_gbl_acpi_mutex_info
[
mutex_id
].
owner_id
=
this_thread_id
;
acpi_gbl_acpi_mutex_info
[
mutex_id
].
owner_id
=
this_thread_id
;
}
}
else
{
else
{
ACPI_DEBUG_PRINT
((
ACPI_DB_ERROR
,
"Thread %X could not acquire Mutex [%s] %s
\n
"
,
ACPI_DEBUG_PRINT
((
ACPI_DB_ERROR
,
"Thread %X could not acquire Mutex [%s] %s
\n
"
,
this_thread_id
,
acpi_ut_get_mutex_name
(
mutex_id
),
this_thread_id
,
acpi_ut_get_mutex_name
(
mutex_id
),
...
@@ -737,7 +731,6 @@ acpi_ut_release_mutex (
...
@@ -737,7 +731,6 @@ acpi_ut_release_mutex (
return
(
AE_BAD_PARAMETER
);
return
(
AE_BAD_PARAMETER
);
}
}
/*
/*
* Mutex must be acquired in order to release it!
* Mutex must be acquired in order to release it!
*/
*/
...
@@ -749,7 +742,6 @@ acpi_ut_release_mutex (
...
@@ -749,7 +742,6 @@ acpi_ut_release_mutex (
return
(
AE_NOT_ACQUIRED
);
return
(
AE_NOT_ACQUIRED
);
}
}
/*
/*
* Deadlock prevention. Check if this thread owns any mutexes of value
* Deadlock prevention. Check if this thread owns any mutexes of value
* greater than this one. If so, the thread has violated the mutex
* greater than this one. If so, the thread has violated the mutex
...
@@ -770,7 +762,6 @@ acpi_ut_release_mutex (
...
@@ -770,7 +762,6 @@ acpi_ut_release_mutex (
}
}
}
}
/* Mark unlocked FIRST */
/* Mark unlocked FIRST */
acpi_gbl_acpi_mutex_info
[
mutex_id
].
owner_id
=
ACPI_MUTEX_NOT_ACQUIRED
;
acpi_gbl_acpi_mutex_info
[
mutex_id
].
owner_id
=
ACPI_MUTEX_NOT_ACQUIRED
;
...
@@ -828,7 +819,6 @@ acpi_ut_create_update_state_and_push (
...
@@ -828,7 +819,6 @@ acpi_ut_create_update_state_and_push (
return
(
AE_NO_MEMORY
);
return
(
AE_NO_MEMORY
);
}
}
acpi_ut_push_generic_state
(
state_list
,
state
);
acpi_ut_push_generic_state
(
state_list
,
state
);
return
(
AE_OK
);
return
(
AE_OK
);
}
}
...
@@ -866,7 +856,6 @@ acpi_ut_create_pkg_state_and_push (
...
@@ -866,7 +856,6 @@ acpi_ut_create_pkg_state_and_push (
return
(
AE_NO_MEMORY
);
return
(
AE_NO_MEMORY
);
}
}
acpi_ut_push_generic_state
(
state_list
,
state
);
acpi_ut_push_generic_state
(
state_list
,
state
);
return
(
AE_OK
);
return
(
AE_OK
);
}
}
...
@@ -1129,7 +1118,6 @@ acpi_ut_create_control_state (
...
@@ -1129,7 +1118,6 @@ acpi_ut_create_control_state (
return_PTR
(
NULL
);
return_PTR
(
NULL
);
}
}
/* Init fields specific to the control struct */
/* Init fields specific to the control struct */
state
->
common
.
data_type
=
ACPI_DESC_TYPE_STATE_CONTROL
;
state
->
common
.
data_type
=
ACPI_DESC_TYPE_STATE_CONTROL
;
...
@@ -1224,6 +1212,8 @@ acpi_ut_walk_package_tree (
...
@@ -1224,6 +1212,8 @@ acpi_ut_walk_package_tree (
}
}
while
(
state
)
{
while
(
state
)
{
/* Get one element of the package */
this_index
=
state
->
pkg
.
index
;
this_index
=
state
->
pkg
.
index
;
this_source_obj
=
(
acpi_operand_object
*
)
this_source_obj
=
(
acpi_operand_object
*
)
state
->
pkg
.
source_object
->
package
.
elements
[
this_index
];
state
->
pkg
.
source_object
->
package
.
elements
[
this_index
];
...
@@ -1324,6 +1314,7 @@ acpi_ut_generate_checksum (
...
@@ -1324,6 +1314,7 @@ acpi_ut_generate_checksum (
u32
i
;
u32
i
;
signed
char
sum
=
0
;
signed
char
sum
=
0
;
for
(
i
=
0
;
i
<
length
;
i
++
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
sum
=
(
signed
char
)
(
sum
+
buffer
[
i
]);
sum
=
(
signed
char
)
(
sum
+
buffer
[
i
]);
}
}
...
...
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