Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
bug2833
cloud-kernel
提交
907f4678
cloud-kernel
项目概览
bug2833
/
cloud-kernel
与 Fork 源项目一致
Fork自
openanolis / cloud-kernel
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
907f4678
编写于
5月 12, 2005
作者:
J
Jeff Garzik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[libata ahci] support PCI MSI interrupt vector
上级
88d7bd8c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
10 deletion
+63
-10
drivers/scsi/ahci.c
drivers/scsi/ahci.c
+63
-10
未找到文件。
drivers/scsi/ahci.c
浏览文件 @
907f4678
...
...
@@ -152,6 +152,7 @@ struct ahci_sg {
struct
ahci_host_priv
{
unsigned
long
flags
;
unsigned
int
have_msi
;
/* is PCI MSI enabled? */
u32
cap
;
/* cache of HOST_CAP register */
u32
port_map
;
/* cache of HOST_PORTS_IMPL reg */
};
...
...
@@ -182,6 +183,7 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc);
static
u8
ahci_check_status
(
struct
ata_port
*
ap
);
static
u8
ahci_check_err
(
struct
ata_port
*
ap
);
static
inline
int
ahci_host_intr
(
struct
ata_port
*
ap
,
struct
ata_queued_cmd
*
qc
);
static
void
ahci_remove_one
(
struct
pci_dev
*
pdev
);
static
Scsi_Host_Template
ahci_sht
=
{
.
module
=
THIS_MODULE
,
...
...
@@ -271,7 +273,7 @@ static struct pci_driver ahci_pci_driver = {
.
name
=
DRV_NAME
,
.
id_table
=
ahci_pci_tbl
,
.
probe
=
ahci_init_one
,
.
remove
=
a
ta_p
ci_remove_one
,
.
remove
=
a
h
ci_remove_one
,
};
...
...
@@ -876,15 +878,19 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent)
}
/* move to PCI layer, integrate w/ MSI stuff */
static
void
pci_
enable_intx
(
struct
pci_dev
*
pdev
)
static
void
pci_
intx
(
struct
pci_dev
*
pdev
,
int
enable
)
{
u16
pci_command
;
u16
pci_command
,
new
;
pci_read_config_word
(
pdev
,
PCI_COMMAND
,
&
pci_command
);
if
(
pci_command
&
PCI_COMMAND_INTX_DISABLE
)
{
pci_command
&=
~
PCI_COMMAND_INTX_DISABLE
;
if
(
enable
)
new
=
pci_command
&
~
PCI_COMMAND_INTX_DISABLE
;
else
new
=
pci_command
|
PCI_COMMAND_INTX_DISABLE
;
if
(
new
!=
pci_command
)
pci_write_config_word
(
pdev
,
PCI_COMMAND
,
pci_command
);
}
}
static
void
ahci_print_info
(
struct
ata_probe_ent
*
probe_ent
)
...
...
@@ -966,7 +972,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
unsigned
long
base
;
void
*
mmio_base
;
unsigned
int
board_idx
=
(
unsigned
int
)
ent
->
driver_data
;
int
pci_dev_busy
=
0
;
int
have_msi
,
pci_dev_busy
=
0
;
int
rc
;
VPRINTK
(
"ENTER
\n
"
);
...
...
@@ -984,12 +990,17 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
goto
err_out
;
}
pci_enable_intx
(
pdev
);
if
(
pci_enable_msi
(
pdev
)
==
0
)
have_msi
=
1
;
else
{
pci_intx
(
pdev
,
1
);
have_msi
=
0
;
}
probe_ent
=
kmalloc
(
sizeof
(
*
probe_ent
),
GFP_KERNEL
);
if
(
probe_ent
==
NULL
)
{
rc
=
-
ENOMEM
;
goto
err_out_
regions
;
goto
err_out_
msi
;
}
memset
(
probe_ent
,
0
,
sizeof
(
*
probe_ent
));
...
...
@@ -1022,6 +1033,8 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent
->
mmio_base
=
mmio_base
;
probe_ent
->
private_data
=
hpriv
;
hpriv
->
have_msi
=
have_msi
;
/* initialize adapter */
rc
=
ahci_host_init
(
probe_ent
);
if
(
rc
)
...
...
@@ -1041,7 +1054,11 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap
(
mmio_base
);
err_out_free_ent:
kfree
(
probe_ent
);
err_out_regions:
err_out_msi:
if
(
have_msi
)
pci_disable_msi
(
pdev
);
else
pci_intx
(
pdev
,
0
);
pci_release_regions
(
pdev
);
err_out:
if
(
!
pci_dev_busy
)
...
...
@@ -1049,6 +1066,42 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
return
rc
;
}
static
void
ahci_remove_one
(
struct
pci_dev
*
pdev
)
{
struct
device
*
dev
=
pci_dev_to_dev
(
pdev
);
struct
ata_host_set
*
host_set
=
dev_get_drvdata
(
dev
);
struct
ahci_host_priv
*
hpriv
=
host_set
->
private_data
;
struct
ata_port
*
ap
;
unsigned
int
i
;
int
have_msi
;
for
(
i
=
0
;
i
<
host_set
->
n_ports
;
i
++
)
{
ap
=
host_set
->
ports
[
i
];
scsi_remove_host
(
ap
->
host
);
}
have_msi
=
hpriv
->
have_msi
;
free_irq
(
host_set
->
irq
,
host_set
);
host_set
->
ops
->
host_stop
(
host_set
);
iounmap
(
host_set
->
mmio_base
);
for
(
i
=
0
;
i
<
host_set
->
n_ports
;
i
++
)
{
ap
=
host_set
->
ports
[
i
];
ata_scsi_release
(
ap
->
host
);
scsi_host_put
(
ap
->
host
);
}
if
(
have_msi
)
pci_disable_msi
(
pdev
);
else
pci_intx
(
pdev
,
0
);
pci_release_regions
(
pdev
);
kfree
(
host_set
);
pci_disable_device
(
pdev
);
dev_set_drvdata
(
dev
,
NULL
);
}
static
int
__init
ahci_init
(
void
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录