Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
af3a2ab5
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
af3a2ab5
编写于
2月 15, 2017
作者:
B
Bjorn Helgaas
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'pci/dpc' into next
* pci/dpc: PCI/DPC: Wait for Root Port busy to clear PCI/DPC: Decode extended reasons
上级
8f417ca9
abdbf4d6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
32 addition
and
3 deletion
+32
-3
drivers/pci/pcie/pcie-dpc.c
drivers/pci/pcie/pcie-dpc.c
+31
-3
include/uapi/linux/pci_regs.h
include/uapi/linux/pci_regs.h
+1
-0
未找到文件。
drivers/pci/pcie/pcie-dpc.c
浏览文件 @
af3a2ab5
...
@@ -19,8 +19,28 @@ struct dpc_dev {
...
@@ -19,8 +19,28 @@ struct dpc_dev {
struct
pcie_device
*
dev
;
struct
pcie_device
*
dev
;
struct
work_struct
work
;
struct
work_struct
work
;
int
cap_pos
;
int
cap_pos
;
bool
rp
;
};
};
static
int
dpc_wait_rp_inactive
(
struct
dpc_dev
*
dpc
)
{
unsigned
long
timeout
=
jiffies
+
HZ
;
struct
pci_dev
*
pdev
=
dpc
->
dev
->
port
;
u16
status
;
pci_read_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_STATUS
,
&
status
);
while
(
status
&
PCI_EXP_DPC_RP_BUSY
&&
!
time_after
(
jiffies
,
timeout
))
{
msleep
(
10
);
pci_read_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_STATUS
,
&
status
);
}
if
(
status
&
PCI_EXP_DPC_RP_BUSY
)
{
dev_warn
(
&
pdev
->
dev
,
"DPC root port still busy
\n
"
);
return
-
EBUSY
;
}
return
0
;
}
static
void
dpc_wait_link_inactive
(
struct
pci_dev
*
pdev
)
static
void
dpc_wait_link_inactive
(
struct
pci_dev
*
pdev
)
{
{
unsigned
long
timeout
=
jiffies
+
HZ
;
unsigned
long
timeout
=
jiffies
+
HZ
;
...
@@ -33,7 +53,7 @@ static void dpc_wait_link_inactive(struct pci_dev *pdev)
...
@@ -33,7 +53,7 @@ static void dpc_wait_link_inactive(struct pci_dev *pdev)
pcie_capability_read_word
(
pdev
,
PCI_EXP_LNKSTA
,
&
lnk_status
);
pcie_capability_read_word
(
pdev
,
PCI_EXP_LNKSTA
,
&
lnk_status
);
}
}
if
(
lnk_status
&
PCI_EXP_LNKSTA_DLLLA
)
if
(
lnk_status
&
PCI_EXP_LNKSTA_DLLLA
)
dev_warn
(
&
pdev
->
dev
,
"Link state not disabled for DPC event"
);
dev_warn
(
&
pdev
->
dev
,
"Link state not disabled for DPC event
\n
"
);
}
}
static
void
interrupt_event_handler
(
struct
work_struct
*
work
)
static
void
interrupt_event_handler
(
struct
work_struct
*
work
)
...
@@ -52,6 +72,8 @@ static void interrupt_event_handler(struct work_struct *work)
...
@@ -52,6 +72,8 @@ static void interrupt_event_handler(struct work_struct *work)
pci_unlock_rescan_remove
();
pci_unlock_rescan_remove
();
dpc_wait_link_inactive
(
pdev
);
dpc_wait_link_inactive
(
pdev
);
if
(
dpc
->
rp
&&
dpc_wait_rp_inactive
(
dpc
))
return
;
pci_write_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_STATUS
,
pci_write_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_STATUS
,
PCI_EXP_DPC_STATUS_TRIGGER
|
PCI_EXP_DPC_STATUS_INTERRUPT
);
PCI_EXP_DPC_STATUS_TRIGGER
|
PCI_EXP_DPC_STATUS_INTERRUPT
);
}
}
...
@@ -73,11 +95,15 @@ static irqreturn_t dpc_irq(int irq, void *context)
...
@@ -73,11 +95,15 @@ static irqreturn_t dpc_irq(int irq, void *context)
if
(
status
&
PCI_EXP_DPC_STATUS_TRIGGER
)
{
if
(
status
&
PCI_EXP_DPC_STATUS_TRIGGER
)
{
u16
reason
=
(
status
>>
1
)
&
0x3
;
u16
reason
=
(
status
>>
1
)
&
0x3
;
u16
ext_reason
=
(
status
>>
5
)
&
0x3
;
dev_warn
(
&
dpc
->
dev
->
device
,
"DPC %s
trigger
ed, remove downstream devices
\n
"
,
dev_warn
(
&
dpc
->
dev
->
device
,
"DPC %s
detect
ed, remove downstream devices
\n
"
,
(
reason
==
0
)
?
"unmasked uncorrectable error"
:
(
reason
==
0
)
?
"unmasked uncorrectable error"
:
(
reason
==
1
)
?
"ERR_NONFATAL"
:
(
reason
==
1
)
?
"ERR_NONFATAL"
:
(
reason
==
2
)
?
"ERR_FATAL"
:
"extended error"
);
(
reason
==
2
)
?
"ERR_FATAL"
:
(
ext_reason
==
0
)
?
"RP PIO error"
:
(
ext_reason
==
1
)
?
"software trigger"
:
"reserved error"
);
schedule_work
(
&
dpc
->
work
);
schedule_work
(
&
dpc
->
work
);
}
}
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
...
@@ -111,6 +137,8 @@ static int dpc_probe(struct pcie_device *dev)
...
@@ -111,6 +137,8 @@ static int dpc_probe(struct pcie_device *dev)
pci_read_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_CAP
,
&
cap
);
pci_read_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_CAP
,
&
cap
);
pci_read_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_CTL
,
&
ctl
);
pci_read_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_CTL
,
&
ctl
);
dpc
->
rp
=
(
cap
&
PCI_EXP_DPC_CAP_RP_EXT
);
ctl
|=
PCI_EXP_DPC_CTL_EN_NONFATAL
|
PCI_EXP_DPC_CTL_INT_EN
;
ctl
|=
PCI_EXP_DPC_CTL_EN_NONFATAL
|
PCI_EXP_DPC_CTL_INT_EN
;
pci_write_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_CTL
,
ctl
);
pci_write_config_word
(
pdev
,
dpc
->
cap_pos
+
PCI_EXP_DPC_CTL
,
ctl
);
...
...
include/uapi/linux/pci_regs.h
浏览文件 @
af3a2ab5
...
@@ -974,6 +974,7 @@
...
@@ -974,6 +974,7 @@
#define PCI_EXP_DPC_STATUS 8
/* DPC Status */
#define PCI_EXP_DPC_STATUS 8
/* DPC Status */
#define PCI_EXP_DPC_STATUS_TRIGGER 0x01
/* Trigger Status */
#define PCI_EXP_DPC_STATUS_TRIGGER 0x01
/* Trigger Status */
#define PCI_EXP_DPC_STATUS_INTERRUPT 0x08
/* Interrupt Status */
#define PCI_EXP_DPC_STATUS_INTERRUPT 0x08
/* Interrupt Status */
#define PCI_EXP_DPC_RP_BUSY 0x10
/* Root Port Busy */
#define PCI_EXP_DPC_SOURCE_ID 10
/* DPC Source Identifier */
#define PCI_EXP_DPC_SOURCE_ID 10
/* DPC Source Identifier */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录