Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
da726e5e
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看板
提交
da726e5e
编写于
11月 20, 2011
作者:
A
Avi Kivity
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ppc4xx_pci: convert to memory API
Signed-off-by:
N
Avi Kivity
<
avi@redhat.com
>
上级
d09510b2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
42 deletion
+26
-42
hw/ppc4xx_pci.c
hw/ppc4xx_pci.c
+26
-42
未找到文件。
hw/ppc4xx_pci.c
浏览文件 @
da726e5e
...
@@ -54,6 +54,8 @@ struct PPC4xxPCIState {
...
@@ -54,6 +54,8 @@ struct PPC4xxPCIState {
PCIHostState
pci_state
;
PCIHostState
pci_state
;
PCIDevice
*
pci_dev
;
PCIDevice
*
pci_dev
;
MemoryRegion
iomem_addr
;
MemoryRegion
iomem_regs
;
};
};
typedef
struct
PPC4xxPCIState
PPC4xxPCIState
;
typedef
struct
PPC4xxPCIState
PPC4xxPCIState
;
...
@@ -84,35 +86,30 @@ typedef struct PPC4xxPCIState PPC4xxPCIState;
...
@@ -84,35 +86,30 @@ typedef struct PPC4xxPCIState PPC4xxPCIState;
#define PCI_REG_SIZE 0x40
#define PCI_REG_SIZE 0x40
static
uint32_t
pci4xx_cfgaddr_readl
(
void
*
opaque
,
target_phys_addr_t
addr
)
static
uint64_t
pci4xx_cfgaddr_read
(
void
*
opaque
,
target_phys_addr_t
addr
,
unsigned
size
)
{
{
PPC4xxPCIState
*
ppc4xx_pci
=
opaque
;
PPC4xxPCIState
*
ppc4xx_pci
=
opaque
;
return
ppc4xx_pci
->
pci_state
.
config_reg
;
return
ppc4xx_pci
->
pci_state
.
config_reg
;
}
}
static
CPUReadMemoryFunc
*
const
pci4xx_cfgaddr_read
[]
=
{
static
void
pci4xx_cfgaddr_write
(
void
*
opaque
,
target_phys_addr_t
addr
,
&
pci4xx_cfgaddr_readl
,
uint64_t
value
,
unsigned
size
)
&
pci4xx_cfgaddr_readl
,
&
pci4xx_cfgaddr_readl
,
};
static
void
pci4xx_cfgaddr_writel
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
value
)
{
{
PPC4xxPCIState
*
ppc4xx_pci
=
opaque
;
PPC4xxPCIState
*
ppc4xx_pci
=
opaque
;
ppc4xx_pci
->
pci_state
.
config_reg
=
value
&
~
0x3
;
ppc4xx_pci
->
pci_state
.
config_reg
=
value
&
~
0x3
;
}
}
static
CPUWriteMemoryFunc
*
const
pci4xx_cfgaddr_write
[]
=
{
static
const
MemoryRegionOps
pci4xx_cfgaddr_ops
=
{
&
pci4xx_cfgaddr_writel
,
.
read
=
pci4xx_cfgaddr_read
,
&
pci4xx_cfgaddr_writel
,
.
write
=
pci4xx_cfgaddr_write
,
&
pci4xx_cfgaddr_writel
,
.
endianness
=
DEVICE_LITTLE_ENDIAN
,
};
};
static
void
ppc4xx_pci_reg_write4
(
void
*
opaque
,
target_phys_addr_t
offset
,
static
void
ppc4xx_pci_reg_write4
(
void
*
opaque
,
target_phys_addr_t
offset
,
uint
32_t
valu
e
)
uint
64_t
value
,
unsigned
siz
e
)
{
{
struct
PPC4xxPCIState
*
pci
=
opaque
;
struct
PPC4xxPCIState
*
pci
=
opaque
;
...
@@ -179,7 +176,8 @@ static void ppc4xx_pci_reg_write4(void *opaque, target_phys_addr_t offset,
...
@@ -179,7 +176,8 @@ static void ppc4xx_pci_reg_write4(void *opaque, target_phys_addr_t offset,
}
}
}
}
static
uint32_t
ppc4xx_pci_reg_read4
(
void
*
opaque
,
target_phys_addr_t
offset
)
static
uint64_t
ppc4xx_pci_reg_read4
(
void
*
opaque
,
target_phys_addr_t
offset
,
unsigned
size
)
{
{
struct
PPC4xxPCIState
*
pci
=
opaque
;
struct
PPC4xxPCIState
*
pci
=
opaque
;
uint32_t
value
;
uint32_t
value
;
...
@@ -246,16 +244,10 @@ static uint32_t ppc4xx_pci_reg_read4(void *opaque, target_phys_addr_t offset)
...
@@ -246,16 +244,10 @@ static uint32_t ppc4xx_pci_reg_read4(void *opaque, target_phys_addr_t offset)
return
value
;
return
value
;
}
}
static
CPUReadMemoryFunc
*
const
pci_reg_read
[]
=
{
static
const
MemoryRegionOps
pci_reg_ops
=
{
&
ppc4xx_pci_reg_read4
,
.
read
=
ppc4xx_pci_reg_read4
,
&
ppc4xx_pci_reg_read4
,
.
write
=
ppc4xx_pci_reg_write4
,
&
ppc4xx_pci_reg_read4
,
.
endianness
=
DEVICE_LITTLE_ENDIAN
,
};
static
CPUWriteMemoryFunc
*
const
pci_reg_write
[]
=
{
&
ppc4xx_pci_reg_write4
,
&
ppc4xx_pci_reg_write4
,
&
ppc4xx_pci_reg_write4
,
};
};
static
void
ppc4xx_pci_reset
(
void
*
opaque
)
static
void
ppc4xx_pci_reset
(
void
*
opaque
)
...
@@ -337,7 +329,6 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
...
@@ -337,7 +329,6 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
target_phys_addr_t
registers
)
target_phys_addr_t
registers
)
{
{
PPC4xxPCIState
*
controller
;
PPC4xxPCIState
*
controller
;
int
index
;
static
int
ppc4xx_pci_id
;
static
int
ppc4xx_pci_id
;
uint8_t
*
pci_conf
;
uint8_t
*
pci_conf
;
...
@@ -360,12 +351,11 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
...
@@ -360,12 +351,11 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
pci_config_set_class
(
pci_conf
,
PCI_CLASS_BRIDGE_OTHER
);
pci_config_set_class
(
pci_conf
,
PCI_CLASS_BRIDGE_OTHER
);
/* CFGADDR */
/* CFGADDR */
index
=
cpu_register_io_memory
(
pci4xx_cfgaddr_read
,
memory_region_init_io
(
&
controller
->
iomem_addr
,
&
pci4xx_cfgaddr_ops
,
pci4xx_cfgaddr_write
,
controller
,
controller
,
"pci.cfgaddr"
,
4
);
DEVICE_LITTLE_ENDIAN
);
memory_region_add_subregion
(
get_system_memory
(),
if
(
index
<
0
)
config_space
+
PCIC0_CFGADDR
,
goto
free
;
&
controller
->
iomem_addr
);
cpu_register_physical_memory
(
config_space
+
PCIC0_CFGADDR
,
4
,
index
);
/* CFGDATA */
/* CFGDATA */
memory_region_init_io
(
&
controller
->
pci_state
.
data_mem
,
memory_region_init_io
(
&
controller
->
pci_state
.
data_mem
,
...
@@ -376,11 +366,10 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
...
@@ -376,11 +366,10 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
&
controller
->
pci_state
.
data_mem
);
&
controller
->
pci_state
.
data_mem
);
/* Internal registers */
/* Internal registers */
index
=
cpu_register_io_memory
(
pci_reg_read
,
pci_reg_write
,
controller
,
memory_region_init_io
(
&
controller
->
iomem_regs
,
&
pci_reg_ops
,
controller
,
DEVICE_LITTLE_ENDIAN
);
"pci.regs"
,
PCI_REG_SIZE
);
if
(
index
<
0
)
memory_region_add_subregion
(
get_system_memory
(),
registers
,
goto
free
;
&
controller
->
iomem_regs
);
cpu_register_physical_memory
(
registers
,
PCI_REG_SIZE
,
index
);
qemu_register_reset
(
ppc4xx_pci_reset
,
controller
);
qemu_register_reset
(
ppc4xx_pci_reset
,
controller
);
...
@@ -389,9 +378,4 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
...
@@ -389,9 +378,4 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
&
vmstate_ppc4xx_pci
,
controller
);
&
vmstate_ppc4xx_pci
,
controller
);
return
controller
->
pci_state
.
bus
;
return
controller
->
pci_state
.
bus
;
free:
printf
(
"%s error
\n
"
,
__func__
);
g_free
(
controller
);
return
NULL
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录