Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
a6cb20fc
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a6cb20fc
编写于
8月 03, 2013
作者:
A
Andreas Färber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
microdrive: Coding Style cleanups
Add missing braces. Signed-off-by:
N
Andreas Färber
<
afaerber@suse.de
>
上级
d1f2c96a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
24 deletion
+38
-24
hw/ide/microdrive.c
hw/ide/microdrive.c
+38
-24
未找到文件。
hw/ide/microdrive.c
浏览文件 @
a6cb20fc
...
@@ -103,10 +103,12 @@ static inline void md_interrupt_update(MicroDriveState *s)
...
@@ -103,10 +103,12 @@ static inline void md_interrupt_update(MicroDriveState *s)
static
void
md_set_irq
(
void
*
opaque
,
int
irq
,
int
level
)
static
void
md_set_irq
(
void
*
opaque
,
int
irq
,
int
level
)
{
{
MicroDriveState
*
s
=
opaque
;
MicroDriveState
*
s
=
opaque
;
if
(
level
)
if
(
level
)
{
s
->
stat
|=
STAT_INT
;
s
->
stat
|=
STAT_INT
;
else
}
else
{
s
->
stat
&=
~
STAT_INT
;
s
->
stat
&=
~
STAT_INT
;
}
md_interrupt_update
(
s
);
md_interrupt_update
(
s
);
}
}
...
@@ -142,10 +144,11 @@ static uint8_t md_attr_read(PCMCIACardState *card, uint32_t at)
...
@@ -142,10 +144,11 @@ static uint8_t md_attr_read(PCMCIACardState *card, uint32_t at)
case
0x00
:
/* Configuration Option Register */
case
0x00
:
/* Configuration Option Register */
return
s
->
opt
;
return
s
->
opt
;
case
0x02
:
/* Card Configuration Status Register */
case
0x02
:
/* Card Configuration Status Register */
if
(
s
->
ctrl
&
CTRL_IEN
)
if
(
s
->
ctrl
&
CTRL_IEN
)
{
return
s
->
stat
&
~
STAT_INT
;
return
s
->
stat
&
~
STAT_INT
;
else
}
else
{
return
s
->
stat
;
return
s
->
stat
;
}
case
0x04
:
/* Pin Replacement Register */
case
0x04
:
/* Pin Replacement Register */
return
(
s
->
pins
&
PINS_CRDY
)
|
0x0c
;
return
(
s
->
pins
&
PINS_CRDY
)
|
0x0c
;
case
0x06
:
/* Socket and Copy Register */
case
0x06
:
/* Socket and Copy Register */
...
@@ -174,8 +177,9 @@ static void md_attr_write(PCMCIACardState *card, uint32_t at, uint8_t value)
...
@@ -174,8 +177,9 @@ static void md_attr_write(PCMCIACardState *card, uint32_t at, uint8_t value)
md_interrupt_update
(
s
);
md_interrupt_update
(
s
);
break
;
break
;
case
0x02
:
/* Card Configuration Status Register */
case
0x02
:
/* Card Configuration Status Register */
if
((
s
->
stat
^
value
)
&
STAT_PWRDWN
)
if
((
s
->
stat
^
value
)
&
STAT_PWRDWN
)
{
s
->
pins
|=
PINS_CRDY
;
s
->
pins
|=
PINS_CRDY
;
}
s
->
stat
&=
0x82
;
s
->
stat
&=
0x82
;
s
->
stat
|=
value
&
0x74
;
s
->
stat
|=
value
&
0x74
;
md_interrupt_update
(
s
);
md_interrupt_update
(
s
);
...
@@ -201,23 +205,26 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
...
@@ -201,23 +205,26 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
switch
(
s
->
opt
&
OPT_MODE
)
{
switch
(
s
->
opt
&
OPT_MODE
)
{
case
OPT_MODE_MMAP
:
case
OPT_MODE_MMAP
:
if
((
at
&
~
0x3ff
)
==
0x400
)
if
((
at
&
~
0x3ff
)
==
0x400
)
{
at
=
0
;
at
=
0
;
}
break
;
break
;
case
OPT_MODE_IOMAP16
:
case
OPT_MODE_IOMAP16
:
at
&=
0xf
;
at
&=
0xf
;
break
;
break
;
case
OPT_MODE_IOMAP1
:
case
OPT_MODE_IOMAP1
:
if
((
at
&
~
0xf
)
==
0x3f0
)
if
((
at
&
~
0xf
)
==
0x3f0
)
{
at
-=
0x3e8
;
at
-=
0x3e8
;
else
if
((
at
&
~
0xf
)
==
0x1f0
)
}
else
if
((
at
&
~
0xf
)
==
0x1f0
)
{
at
-=
0x1f0
;
at
-=
0x1f0
;
}
break
;
break
;
case
OPT_MODE_IOMAP2
:
case
OPT_MODE_IOMAP2
:
if
((
at
&
~
0xf
)
==
0x370
)
if
((
at
&
~
0xf
)
==
0x370
)
{
at
-=
0x368
;
at
-=
0x368
;
else
if
((
at
&
~
0xf
)
==
0x170
)
}
else
if
((
at
&
~
0xf
)
==
0x170
)
{
at
-=
0x170
;
at
-=
0x170
;
}
}
}
switch
(
at
)
{
switch
(
at
)
{
...
@@ -226,9 +233,9 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
...
@@ -226,9 +233,9 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
return
ide_data_readw
(
&
s
->
bus
,
0
);
return
ide_data_readw
(
&
s
->
bus
,
0
);
/* TODO: 8-bit accesses */
/* TODO: 8-bit accesses */
if
(
s
->
cycle
)
if
(
s
->
cycle
)
{
ret
=
s
->
io
>>
8
;
ret
=
s
->
io
>>
8
;
else
{
}
else
{
s
->
io
=
ide_data_readw
(
&
s
->
bus
,
0
);
s
->
io
=
ide_data_readw
(
&
s
->
bus
,
0
);
ret
=
s
->
io
&
0xff
;
ret
=
s
->
io
&
0xff
;
}
}
...
@@ -240,10 +247,11 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
...
@@ -240,10 +247,11 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
return
ide_ioport_read
(
&
s
->
bus
,
0x1
);
return
ide_ioport_read
(
&
s
->
bus
,
0x1
);
case
0xe
:
/* Alternate Status */
case
0xe
:
/* Alternate Status */
ifs
=
idebus_active_if
(
&
s
->
bus
);
ifs
=
idebus_active_if
(
&
s
->
bus
);
if
(
ifs
->
bs
)
if
(
ifs
->
bs
)
{
return
ifs
->
status
;
return
ifs
->
status
;
else
}
else
{
return
0
;
return
0
;
}
case
0xf
:
/* Device Address */
case
0xf
:
/* Device Address */
ifs
=
idebus_active_if
(
&
s
->
bus
);
ifs
=
idebus_active_if
(
&
s
->
bus
);
return
0xc2
|
((
~
ifs
->
select
<<
2
)
&
0x3c
);
return
0xc2
|
((
~
ifs
->
select
<<
2
)
&
0x3c
);
...
@@ -261,23 +269,26 @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
...
@@ -261,23 +269,26 @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
switch
(
s
->
opt
&
OPT_MODE
)
{
switch
(
s
->
opt
&
OPT_MODE
)
{
case
OPT_MODE_MMAP
:
case
OPT_MODE_MMAP
:
if
((
at
&
~
0x3ff
)
==
0x400
)
if
((
at
&
~
0x3ff
)
==
0x400
)
{
at
=
0
;
at
=
0
;
}
break
;
break
;
case
OPT_MODE_IOMAP16
:
case
OPT_MODE_IOMAP16
:
at
&=
0xf
;
at
&=
0xf
;
break
;
break
;
case
OPT_MODE_IOMAP1
:
case
OPT_MODE_IOMAP1
:
if
((
at
&
~
0xf
)
==
0x3f0
)
if
((
at
&
~
0xf
)
==
0x3f0
)
{
at
-=
0x3e8
;
at
-=
0x3e8
;
else
if
((
at
&
~
0xf
)
==
0x1f0
)
}
else
if
((
at
&
~
0xf
)
==
0x1f0
)
{
at
-=
0x1f0
;
at
-=
0x1f0
;
}
break
;
break
;
case
OPT_MODE_IOMAP2
:
case
OPT_MODE_IOMAP2
:
if
((
at
&
~
0xf
)
==
0x370
)
if
((
at
&
~
0xf
)
==
0x370
)
{
at
-=
0x368
;
at
-=
0x368
;
else
if
((
at
&
~
0xf
)
==
0x170
)
}
else
if
((
at
&
~
0xf
)
==
0x170
)
{
at
-=
0x170
;
at
-=
0x170
;
}
}
}
switch
(
at
)
{
switch
(
at
)
{
...
@@ -287,10 +298,11 @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
...
@@ -287,10 +298,11 @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
break
;
break
;
/* TODO: 8-bit accesses */
/* TODO: 8-bit accesses */
if
(
s
->
cycle
)
if
(
s
->
cycle
)
{
ide_data_writew
(
&
s
->
bus
,
0
,
s
->
io
|
(
value
<<
8
));
ide_data_writew
(
&
s
->
bus
,
0
,
s
->
io
|
(
value
<<
8
));
else
}
else
{
s
->
io
=
value
&
0xff
;
s
->
io
=
value
&
0xff
;
}
s
->
cycle
=
!
s
->
cycle
;
s
->
cycle
=
!
s
->
cycle
;
break
;
break
;
case
0x9
:
case
0x9
:
...
@@ -546,8 +558,10 @@ static int dscm1xxxx_detach(PCMCIACardState *card)
...
@@ -546,8 +558,10 @@ static int dscm1xxxx_detach(PCMCIACardState *card)
PCMCIACardState
*
dscm1xxxx_init
(
DriveInfo
*
dinfo
)
PCMCIACardState
*
dscm1xxxx_init
(
DriveInfo
*
dinfo
)
{
{
MicroDriveState
*
md
=
MICRODRIVE
(
object_new
(
TYPE_DSCM1XXXX
));
MicroDriveState
*
md
;
PCMCIACardState
*
card
=
PCMCIA_CARD
(
md
);
md
=
MICRODRIVE
(
object_new
(
TYPE_DSCM1XXXX
));
qdev_init_nofail
(
DEVICE
(
md
));
if
(
dinfo
!=
NULL
)
{
if
(
dinfo
!=
NULL
)
{
ide_create_drive
(
&
md
->
bus
,
0
,
dinfo
);
ide_create_drive
(
&
md
->
bus
,
0
,
dinfo
);
...
@@ -556,7 +570,7 @@ PCMCIACardState *dscm1xxxx_init(DriveInfo *dinfo)
...
@@ -556,7 +570,7 @@ PCMCIACardState *dscm1xxxx_init(DriveInfo *dinfo)
md
->
bus
.
ifs
[
0
].
mdata_size
=
METADATA_SIZE
;
md
->
bus
.
ifs
[
0
].
mdata_size
=
METADATA_SIZE
;
md
->
bus
.
ifs
[
0
].
mdata_storage
=
(
uint8_t
*
)
g_malloc0
(
METADATA_SIZE
);
md
->
bus
.
ifs
[
0
].
mdata_storage
=
(
uint8_t
*
)
g_malloc0
(
METADATA_SIZE
);
return
card
;
return
PCMCIA_CARD
(
md
)
;
}
}
static
void
dscm1xxxx_class_init
(
ObjectClass
*
oc
,
void
*
data
)
static
void
dscm1xxxx_class_init
(
ObjectClass
*
oc
,
void
*
data
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录