Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
43864069
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
43864069
编写于
11年前
作者:
M
Michael S. Tsirkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pci: add helper to retrieve the 64-bit range
Signed-off-by:
N
Michael S. Tsirkin
<
mst@redhat.com
>
上级
c5a22c43
无相关合并请求
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
0 deletion
+51
-0
hw/pci/pci.c
hw/pci/pci.c
+50
-0
include/hw/pci/pci.h
include/hw/pci/pci.h
+1
-0
未找到文件。
hw/pci/pci.c
浏览文件 @
43864069
...
...
@@ -2257,6 +2257,56 @@ void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque)
bus
->
iommu_opaque
=
opaque
;
}
static
void
pci_dev_get_w64
(
PCIBus
*
b
,
PCIDevice
*
dev
,
void
*
opaque
)
{
Range
*
range
=
opaque
;
PCIDeviceClass
*
pc
=
PCI_DEVICE_GET_CLASS
(
dev
);
uint16_t
cmd
=
pci_get_word
(
dev
->
config
+
PCI_COMMAND
);
int
r
;
if
(
!
(
cmd
&
PCI_COMMAND_MEMORY
))
{
return
;
}
if
(
pc
->
is_bridge
)
{
pcibus_t
base
=
pci_bridge_get_base
(
dev
,
PCI_BASE_ADDRESS_MEM_PREFETCH
);
pcibus_t
limit
=
pci_bridge_get_limit
(
dev
,
PCI_BASE_ADDRESS_MEM_PREFETCH
);
base
=
MAX
(
base
,
0x1ULL
<<
32
);
if
(
limit
>=
base
)
{
Range
pref_range
;
pref_range
.
begin
=
base
;
pref_range
.
end
=
limit
+
1
;
range_extend
(
range
,
&
pref_range
);
}
}
for
(
r
=
0
;
r
<
PCI_NUM_REGIONS
;
++
r
)
{
PCIIORegion
*
region
=
&
dev
->
io_regions
[
r
];
Range
region_range
;
if
(
!
region
->
size
||
(
region
->
type
&
PCI_BASE_ADDRESS_SPACE_IO
)
||
!
(
region
->
type
&
PCI_BASE_ADDRESS_MEM_TYPE_64
))
{
continue
;
}
region_range
.
begin
=
pci_get_quad
(
dev
->
config
+
pci_bar
(
dev
,
r
));
region_range
.
end
=
region_range
.
begin
+
region
->
size
;
region_range
.
begin
=
MAX
(
region_range
.
begin
,
0x1ULL
<<
32
);
if
(
region_range
.
end
-
1
>=
region_range
.
begin
)
{
range_extend
(
range
,
&
region_range
);
}
}
}
void
pci_bus_get_w64_range
(
PCIBus
*
bus
,
Range
*
range
)
{
range
->
begin
=
range
->
end
=
0
;
pci_for_each_device_under_bus
(
bus
,
pci_dev_get_w64
,
range
);
}
static
const
TypeInfo
pci_device_type_info
=
{
.
name
=
TYPE_PCI_DEVICE
,
.
parent
=
TYPE_DEVICE
,
...
...
This diff is collapsed.
Click to expand it.
include/hw/pci/pci.h
浏览文件 @
43864069
...
...
@@ -397,6 +397,7 @@ const char *pci_root_bus_path(PCIDevice *dev);
PCIDevice
*
pci_find_device
(
PCIBus
*
bus
,
int
bus_num
,
uint8_t
devfn
);
int
pci_qdev_find_device
(
const
char
*
id
,
PCIDevice
**
pdev
);
PCIBus
*
pci_get_bus_devfn
(
int
*
devfnp
,
PCIBus
*
root
,
const
char
*
devaddr
);
void
pci_bus_get_w64_range
(
PCIBus
*
bus
,
Range
*
range
);
int
pci_parse_devaddr
(
const
char
*
addr
,
int
*
domp
,
int
*
busp
,
unsigned
int
*
slotp
,
unsigned
int
*
funcp
);
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部