Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
51e7fff1
K
Kernel
项目概览
openeuler
/
Kernel
接近 2 年 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
51e7fff1
编写于
3月 09, 2007
作者:
L
Len Brown
浏览文件
操作
浏览文件
下载
差异文件
Pull bugzilla-8110 into release branch
上级
bdf3aaf9
9e197219
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
17 deletion
+23
-17
drivers/acpi/ec.c
drivers/acpi/ec.c
+23
-17
未找到文件。
drivers/acpi/ec.c
浏览文件 @
51e7fff1
...
...
@@ -100,6 +100,7 @@ static struct acpi_ec {
unsigned
long
global_lock
;
struct
mutex
lock
;
atomic_t
query_pending
;
atomic_t
event_count
;
atomic_t
leaving_burst
;
/* 0 : No, 1 : Yes, 2: abort */
wait_queue_head_t
wait
;
}
*
ec_ecdt
;
...
...
@@ -131,10 +132,12 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
outb
(
data
,
ec
->
data_addr
);
}
static
inline
int
acpi_ec_check_status
(
struct
acpi_ec
*
ec
,
enum
ec_event
event
)
static
inline
int
acpi_ec_check_status
(
struct
acpi_ec
*
ec
,
enum
ec_event
event
,
unsigned
old_count
)
{
u8
status
=
acpi_ec_read_status
(
ec
);
if
(
old_count
==
atomic_read
(
&
ec
->
event_count
))
return
0
;
if
(
event
==
ACPI_EC_EVENT_OBF_1
)
{
if
(
status
&
ACPI_EC_FLAG_OBF
)
return
1
;
...
...
@@ -146,19 +149,19 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
return
0
;
}
static
int
acpi_ec_wait
(
struct
acpi_ec
*
ec
,
enum
ec_event
event
)
static
int
acpi_ec_wait
(
struct
acpi_ec
*
ec
,
enum
ec_event
event
,
unsigned
count
)
{
if
(
acpi_ec_mode
==
EC_POLL
)
{
unsigned
long
delay
=
jiffies
+
msecs_to_jiffies
(
ACPI_EC_DELAY
);
while
(
time_before
(
jiffies
,
delay
))
{
if
(
acpi_ec_check_status
(
ec
,
event
))
if
(
acpi_ec_check_status
(
ec
,
event
,
0
))
return
0
;
}
}
else
{
if
(
wait_event_timeout
(
ec
->
wait
,
acpi_ec_check_status
(
ec
,
event
),
acpi_ec_check_status
(
ec
,
event
,
count
),
msecs_to_jiffies
(
ACPI_EC_DELAY
))
||
acpi_ec_check_status
(
ec
,
event
))
{
acpi_ec_check_status
(
ec
,
event
,
0
))
{
return
0
;
}
else
{
printk
(
KERN_ERR
PREFIX
"acpi_ec_wait timeout,"
...
...
@@ -225,21 +228,22 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
u8
*
rdata
,
unsigned
rdata_len
)
{
int
result
=
0
;
unsigned
count
=
atomic_read
(
&
ec
->
event_count
);
acpi_ec_write_cmd
(
ec
,
command
);
for
(;
wdata_len
>
0
;
--
wdata_len
)
{
result
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_IBF_0
);
result
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_IBF_0
,
count
);
if
(
result
)
{
printk
(
KERN_ERR
PREFIX
"write_cmd timeout, command = %d
\n
"
,
command
);
goto
end
;
}
count
=
atomic_read
(
&
ec
->
event_count
);
acpi_ec_write_data
(
ec
,
*
(
wdata
++
));
}
if
(
!
rdata_len
)
{
result
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_IBF_0
);
result
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_IBF_0
,
count
);
if
(
result
)
{
printk
(
KERN_ERR
PREFIX
"finish-write timeout, command = %d
\n
"
,
command
);
...
...
@@ -250,13 +254,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
}
for
(;
rdata_len
>
0
;
--
rdata_len
)
{
result
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_OBF_1
);
result
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_OBF_1
,
count
);
if
(
result
)
{
printk
(
KERN_ERR
PREFIX
"read timeout, command = %d
\n
"
,
command
);
goto
end
;
}
count
=
atomic_read
(
&
ec
->
event_count
);
*
(
rdata
++
)
=
acpi_ec_read_data
(
ec
);
}
end:
...
...
@@ -288,7 +292,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
/* Make sure GPE is enabled before doing transaction */
acpi_enable_gpe
(
NULL
,
ec
->
gpe
,
ACPI_NOT_ISR
);
status
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_IBF_0
);
status
=
acpi_ec_wait
(
ec
,
ACPI_EC_EVENT_IBF_0
,
0
);
if
(
status
)
{
printk
(
KERN_DEBUG
PREFIX
"input buffer is not empty, aborting transaction
\n
"
);
...
...
@@ -369,8 +373,8 @@ int ec_write(u8 addr, u8 val)
EXPORT_SYMBOL
(
ec_write
);
int
ec_transaction
(
u8
command
,
const
u8
*
wdata
,
unsigned
wdata_len
,
u8
*
rdata
,
unsigned
rdata_len
)
const
u8
*
wdata
,
unsigned
wdata_len
,
u8
*
rdata
,
unsigned
rdata_len
)
{
struct
acpi_ec
*
ec
;
...
...
@@ -435,7 +439,7 @@ static u32 acpi_ec_gpe_handler(void *data)
acpi_status
status
=
AE_OK
;
u8
value
;
struct
acpi_ec
*
ec
=
(
struct
acpi_ec
*
)
data
;
atomic_inc
(
&
ec
->
event_count
);
if
(
acpi_ec_mode
==
EC_INTR
)
{
wake_up
(
&
ec
->
wait
);
}
...
...
@@ -633,6 +637,7 @@ static int acpi_ec_add(struct acpi_device *device)
ec
->
uid
=
-
1
;
mutex_init
(
&
ec
->
lock
);
atomic_set
(
&
ec
->
query_pending
,
0
);
atomic_set
(
&
ec
->
event_count
,
1
);
if
(
acpi_ec_mode
==
EC_INTR
)
{
atomic_set
(
&
ec
->
leaving_burst
,
1
);
init_waitqueue_head
(
&
ec
->
wait
);
...
...
@@ -807,6 +812,7 @@ acpi_fake_ecdt_callback(acpi_handle handle,
acpi_status
status
;
mutex_init
(
&
ec_ecdt
->
lock
);
atomic_set
(
&
ec_ecdt
->
event_count
,
1
);
if
(
acpi_ec_mode
==
EC_INTR
)
{
init_waitqueue_head
(
&
ec_ecdt
->
wait
);
}
...
...
@@ -888,6 +894,7 @@ static int __init acpi_ec_get_real_ecdt(void)
return
-
ENOMEM
;
mutex_init
(
&
ec_ecdt
->
lock
);
atomic_set
(
&
ec_ecdt
->
event_count
,
1
);
if
(
acpi_ec_mode
==
EC_INTR
)
{
init_waitqueue_head
(
&
ec_ecdt
->
wait
);
}
...
...
@@ -1016,8 +1023,7 @@ static int __init acpi_ec_set_intr_mode(char *str)
acpi_ec_mode
=
EC_POLL
;
}
acpi_ec_driver
.
ops
.
add
=
acpi_ec_add
;
printk
(
KERN_NOTICE
PREFIX
"%s mode.
\n
"
,
intr
?
"interrupt"
:
"polling"
);
printk
(
KERN_NOTICE
PREFIX
"%s mode.
\n
"
,
intr
?
"interrupt"
:
"polling"
);
return
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录