Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
6b1b92d3
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看板
提交
6b1b92d3
编写于
5月 14, 2009
作者:
P
Paul Brook
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PCI qdev support
Signed-off-by:
N
Paul Brook
<
paul@codesourcery.com
>
上级
4d6ae674
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
7 deletion
+56
-7
hw/pci.c
hw/pci.c
+48
-7
hw/pci.h
hw/pci.h
+8
-0
未找到文件。
hw/pci.c
浏览文件 @
6b1b92d3
...
@@ -237,13 +237,11 @@ int pci_assign_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp)
...
@@ -237,13 +237,11 @@ int pci_assign_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp)
}
}
/* -1 for devfn means auto assign */
/* -1 for devfn means auto assign */
PCIDevice
*
pci_register_device
(
PCIBus
*
bus
,
const
char
*
name
,
static
PCIDevice
*
do_pci_register_device
(
PCIDevice
*
pci_dev
,
PCIBus
*
bus
,
int
instance_siz
e
,
int
devfn
,
const
char
*
nam
e
,
int
devfn
,
PCIConfigReadFunc
*
config_read
,
PCIConfigReadFunc
*
config_read
,
PCIConfigWriteFunc
*
config_write
)
PCIConfigWriteFunc
*
config_write
)
{
{
PCIDevice
*
pci_dev
;
if
(
pci_irq_index
>=
PCI_DEVICES_MAX
)
if
(
pci_irq_index
>=
PCI_DEVICES_MAX
)
return
NULL
;
return
NULL
;
...
@@ -255,7 +253,6 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
...
@@ -255,7 +253,6 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
return
NULL
;
return
NULL
;
found:
;
found:
;
}
}
pci_dev
=
qemu_mallocz
(
instance_size
);
pci_dev
->
bus
=
bus
;
pci_dev
->
bus
=
bus
;
pci_dev
->
devfn
=
devfn
;
pci_dev
->
devfn
=
devfn
;
pstrcpy
(
pci_dev
->
name
,
sizeof
(
pci_dev
->
name
),
name
);
pstrcpy
(
pci_dev
->
name
,
sizeof
(
pci_dev
->
name
),
name
);
...
@@ -274,6 +271,18 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
...
@@ -274,6 +271,18 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
return
pci_dev
;
return
pci_dev
;
}
}
PCIDevice
*
pci_register_device
(
PCIBus
*
bus
,
const
char
*
name
,
int
instance_size
,
int
devfn
,
PCIConfigReadFunc
*
config_read
,
PCIConfigWriteFunc
*
config_write
)
{
PCIDevice
*
pci_dev
;
pci_dev
=
qemu_mallocz
(
instance_size
);
pci_dev
=
do_pci_register_device
(
pci_dev
,
bus
,
name
,
devfn
,
config_read
,
config_write
);
return
pci_dev
;
}
static
target_phys_addr_t
pci_to_cpu_addr
(
target_phys_addr_t
addr
)
static
target_phys_addr_t
pci_to_cpu_addr
(
target_phys_addr_t
addr
)
{
{
return
addr
+
pci_mem_base
;
return
addr
+
pci_mem_base
;
...
@@ -891,3 +900,35 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
...
@@ -891,3 +900,35 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
s
->
bus
=
pci_register_secondary_bus
(
&
s
->
dev
,
map_irq
);
s
->
bus
=
pci_register_secondary_bus
(
&
s
->
dev
,
map_irq
);
return
s
->
bus
;
return
s
->
bus
;
}
}
static
void
pci_qdev_init
(
DeviceState
*
qdev
,
void
*
opaque
)
{
PCIDevice
*
pci_dev
=
(
PCIDevice
*
)
qdev
;
pci_qdev_initfn
init
;
PCIBus
*
bus
;
int
devfn
;
init
=
opaque
;
bus
=
qdev_get_bus
(
qdev
);
devfn
=
qdev_get_prop_int
(
qdev
,
"devfn"
,
-
1
);
pci_dev
=
do_pci_register_device
(
pci_dev
,
bus
,
"FIXME"
,
devfn
,
NULL
,
NULL
);
//FIXME:config_read, config_write);
assert
(
pci_dev
);
init
(
pci_dev
);
}
void
pci_qdev_register
(
const
char
*
name
,
int
size
,
pci_qdev_initfn
init
)
{
qdev_register
(
name
,
size
,
pci_qdev_init
,
init
);
}
PCIDevice
*
pci_create_simple
(
PCIBus
*
bus
,
int
devfn
,
const
char
*
name
)
{
DeviceState
*
dev
;
dev
=
qdev_create
(
bus
,
name
);
qdev_set_prop_int
(
dev
,
"devfn"
,
devfn
);
qdev_init
(
dev
);
return
(
PCIDevice
*
)
dev
;
}
hw/pci.h
浏览文件 @
6b1b92d3
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
#include "qemu-common.h"
#include "qemu-common.h"
#include "qdev.h"
/* PCI includes legacy ISA access. */
/* PCI includes legacy ISA access. */
#include "isa.h"
#include "isa.h"
...
@@ -138,6 +140,7 @@ typedef struct PCIIORegion {
...
@@ -138,6 +140,7 @@ typedef struct PCIIORegion {
#define PCI_COMMAND_RESERVED_MASK_HI (PCI_COMMAND_RESERVED >> 8)
#define PCI_COMMAND_RESERVED_MASK_HI (PCI_COMMAND_RESERVED >> 8)
struct
PCIDevice
{
struct
PCIDevice
{
DeviceState
qdev
;
/* PCI config space */
/* PCI config space */
uint8_t
config
[
256
];
uint8_t
config
[
256
];
...
@@ -217,6 +220,11 @@ pci_config_set_class(uint8_t *pci_config, uint16_t val)
...
@@ -217,6 +220,11 @@ pci_config_set_class(uint8_t *pci_config, uint16_t val)
cpu_to_le16wu
((
uint16_t
*
)
&
pci_config
[
PCI_CLASS_DEVICE
],
val
);
cpu_to_le16wu
((
uint16_t
*
)
&
pci_config
[
PCI_CLASS_DEVICE
],
val
);
}
}
typedef
void
(
*
pci_qdev_initfn
)(
PCIDevice
*
dev
);
void
pci_qdev_register
(
const
char
*
name
,
int
size
,
pci_qdev_initfn
init
);
PCIDevice
*
pci_create_simple
(
PCIBus
*
bus
,
int
devfn
,
const
char
*
name
);
/* lsi53c895a.c */
/* lsi53c895a.c */
#define LSI_MAX_DEVS 7
#define LSI_MAX_DEVS 7
void
lsi_scsi_attach
(
void
*
opaque
,
BlockDriverState
*
bd
,
int
id
);
void
lsi_scsi_attach
(
void
*
opaque
,
BlockDriverState
*
bd
,
int
id
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录