Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
0fe5ea89
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看板
提交
0fe5ea89
编写于
11月 11, 2007
作者:
B
blueswir1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix Sun4u compile
git-svn-id:
svn://svn.savannah.nongnu.org/qemu/trunk@3594
c046a42c-6fe2-441c-8c8c-71466251a162
上级
775b58d8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
67 deletion
+42
-67
hw/sun4u.c
hw/sun4u.c
+42
-67
未找到文件。
hw/sun4u.c
浏览文件 @
0fe5ea89
...
...
@@ -67,23 +67,23 @@ void DMA_register_channel (int nchan,
}
/* NVRAM helpers */
void
NVRAM
_set_byte
(
m48t59_t
*
nvram
,
uint32_t
addr
,
uint8_t
value
)
static
void
nvram
_set_byte
(
m48t59_t
*
nvram
,
uint32_t
addr
,
uint8_t
value
)
{
m48t59_write
(
nvram
,
addr
,
value
);
}
uint8_t
NVRAM
_get_byte
(
m48t59_t
*
nvram
,
uint32_t
addr
)
static
uint8_t
nvram
_get_byte
(
m48t59_t
*
nvram
,
uint32_t
addr
)
{
return
m48t59_read
(
nvram
,
addr
);
}
void
NVRAM
_set_word
(
m48t59_t
*
nvram
,
uint32_t
addr
,
uint16_t
value
)
static
void
nvram
_set_word
(
m48t59_t
*
nvram
,
uint32_t
addr
,
uint16_t
value
)
{
m48t59_write
(
nvram
,
addr
,
value
>>
8
);
m48t59_write
(
nvram
,
addr
+
1
,
value
&
0xFF
);
m48t59_write
(
nvram
,
addr
++
,
(
value
>>
8
)
&
0xff
);
m48t59_write
(
nvram
,
addr
++
,
value
&
0xff
);
}
uint16_t
NVRAM
_get_word
(
m48t59_t
*
nvram
,
uint32_t
addr
)
static
uint16_t
nvram
_get_word
(
m48t59_t
*
nvram
,
uint32_t
addr
)
{
uint16_t
tmp
;
...
...
@@ -93,30 +93,18 @@ uint16_t NVRAM_get_word (m48t59_t *nvram, uint32_t addr)
return
tmp
;
}
void
NVRAM
_set_lword
(
m48t59_t
*
nvram
,
uint32_t
addr
,
uint32_t
value
)
static
void
nvram
_set_lword
(
m48t59_t
*
nvram
,
uint32_t
addr
,
uint32_t
value
)
{
m48t59_write
(
nvram
,
addr
,
value
>>
24
);
m48t59_write
(
nvram
,
addr
+
1
,
(
value
>>
16
)
&
0xFF
);
m48t59_write
(
nvram
,
addr
+
2
,
(
value
>>
8
)
&
0xFF
);
m48t59_write
(
nvram
,
addr
+
3
,
value
&
0xFF
);
m48t59_write
(
nvram
,
addr
++
,
value
>>
24
);
m48t59_write
(
nvram
,
addr
++
,
(
value
>>
16
)
&
0xff
);
m48t59_write
(
nvram
,
addr
++
,
(
value
>>
8
)
&
0xff
);
m48t59_write
(
nvram
,
addr
++
,
value
&
0xff
);
}
uint32_t
NVRAM_get_lword
(
m48t59_t
*
nvram
,
uint32_t
addr
)
{
uint32_t
tmp
;
tmp
=
m48t59_read
(
nvram
,
addr
)
<<
24
;
tmp
|=
m48t59_read
(
nvram
,
addr
+
1
)
<<
16
;
tmp
|=
m48t59_read
(
nvram
,
addr
+
2
)
<<
8
;
tmp
|=
m48t59_read
(
nvram
,
addr
+
3
);
return
tmp
;
}
void
NVRAM_set_string
(
m48t59_t
*
nvram
,
uint32_t
addr
,
static
void
nvram_set_string
(
m48t59_t
*
nvram
,
uint32_t
addr
,
const
unsigned
char
*
str
,
uint32_t
max
)
{
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
max
&&
str
[
i
]
!=
'\0'
;
i
++
)
{
m48t59_write
(
nvram
,
addr
+
i
,
str
[
i
]);
...
...
@@ -124,21 +112,7 @@ void NVRAM_set_string (m48t59_t *nvram, uint32_t addr,
m48t59_write
(
nvram
,
addr
+
max
-
1
,
'\0'
);
}
int
NVRAM_get_string
(
m48t59_t
*
nvram
,
uint8_t
*
dst
,
uint16_t
addr
,
int
max
)
{
int
i
;
memset
(
dst
,
0
,
max
);
for
(
i
=
0
;
i
<
max
;
i
++
)
{
dst
[
i
]
=
NVRAM_get_byte
(
nvram
,
addr
+
i
);
if
(
dst
[
i
]
==
'\0'
)
break
;
}
return
i
;
}
static
uint16_t
NVRAM_crc_update
(
uint16_t
prev
,
uint16_t
value
)
static
uint16_t
nvram_crc_update
(
uint16_t
prev
,
uint16_t
value
)
{
uint16_t
tmp
;
uint16_t
pd
,
pd1
,
pd2
;
...
...
@@ -153,7 +127,8 @@ static uint16_t NVRAM_crc_update (uint16_t prev, uint16_t value)
return
tmp
;
}
uint16_t
NVRAM_compute_crc
(
m48t59_t
*
nvram
,
uint32_t
start
,
uint32_t
count
)
static
uint16_t
nvram_compute_crc
(
m48t59_t
*
nvram
,
uint32_t
start
,
uint32_t
count
)
{
uint32_t
i
;
uint16_t
crc
=
0xFFFF
;
...
...
@@ -162,10 +137,10 @@ uint16_t NVRAM_compute_crc (m48t59_t *nvram, uint32_t start, uint32_t count)
odd
=
count
&
1
;
count
&=
~
1
;
for
(
i
=
0
;
i
!=
count
;
i
++
)
{
crc
=
NVRAM_crc_update
(
crc
,
NVRAM
_get_word
(
nvram
,
start
+
i
));
crc
=
nvram_crc_update
(
crc
,
nvram
_get_word
(
nvram
,
start
+
i
));
}
if
(
odd
)
{
crc
=
NVRAM_crc_update
(
crc
,
NVRAM
_get_byte
(
nvram
,
start
+
i
)
<<
8
);
crc
=
nvram_crc_update
(
crc
,
nvram
_get_byte
(
nvram
,
start
+
i
)
<<
8
);
}
return
crc
;
...
...
@@ -177,7 +152,7 @@ static uint32_t nvram_set_var (m48t59_t *nvram, uint32_t addr,
uint32_t
len
;
len
=
strlen
(
str
)
+
1
;
NVRAM
_set_string
(
nvram
,
addr
,
str
,
len
);
nvram
_set_string
(
nvram
,
addr
,
str
,
len
);
return
addr
+
len
;
}
...
...
@@ -215,39 +190,39 @@ int sun4u_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
uint32_t
start
,
end
;
/* Set parameters for Open Hack'Ware BIOS */
NVRAM
_set_string
(
nvram
,
0x00
,
"QEMU_BIOS"
,
16
);
NVRAM
_set_lword
(
nvram
,
0x10
,
0x00000002
);
/* structure v2 */
NVRAM
_set_word
(
nvram
,
0x14
,
NVRAM_size
);
NVRAM
_set_string
(
nvram
,
0x20
,
arch
,
16
);
NVRAM
_set_byte
(
nvram
,
0x2f
,
nographic
&
0xff
);
NVRAM
_set_lword
(
nvram
,
0x30
,
RAM_size
);
NVRAM
_set_byte
(
nvram
,
0x34
,
boot_device
);
NVRAM
_set_lword
(
nvram
,
0x38
,
kernel_image
);
NVRAM
_set_lword
(
nvram
,
0x3C
,
kernel_size
);
nvram
_set_string
(
nvram
,
0x00
,
"QEMU_BIOS"
,
16
);
nvram
_set_lword
(
nvram
,
0x10
,
0x00000002
);
/* structure v2 */
nvram
_set_word
(
nvram
,
0x14
,
NVRAM_size
);
nvram
_set_string
(
nvram
,
0x20
,
arch
,
16
);
nvram
_set_byte
(
nvram
,
0x2f
,
nographic
&
0xff
);
nvram
_set_lword
(
nvram
,
0x30
,
RAM_size
);
nvram
_set_byte
(
nvram
,
0x34
,
boot_device
);
nvram
_set_lword
(
nvram
,
0x38
,
kernel_image
);
nvram
_set_lword
(
nvram
,
0x3C
,
kernel_size
);
if
(
cmdline
)
{
/* XXX: put the cmdline in NVRAM too ? */
strcpy
(
phys_ram_base
+
CMDLINE_ADDR
,
cmdline
);
NVRAM
_set_lword
(
nvram
,
0x40
,
CMDLINE_ADDR
);
NVRAM
_set_lword
(
nvram
,
0x44
,
strlen
(
cmdline
));
nvram
_set_lword
(
nvram
,
0x40
,
CMDLINE_ADDR
);
nvram
_set_lword
(
nvram
,
0x44
,
strlen
(
cmdline
));
}
else
{
NVRAM
_set_lword
(
nvram
,
0x40
,
0
);
NVRAM
_set_lword
(
nvram
,
0x44
,
0
);
nvram
_set_lword
(
nvram
,
0x40
,
0
);
nvram
_set_lword
(
nvram
,
0x44
,
0
);
}
NVRAM
_set_lword
(
nvram
,
0x48
,
initrd_image
);
NVRAM
_set_lword
(
nvram
,
0x4C
,
initrd_size
);
NVRAM
_set_lword
(
nvram
,
0x50
,
NVRAM_image
);
nvram
_set_lword
(
nvram
,
0x48
,
initrd_image
);
nvram
_set_lword
(
nvram
,
0x4C
,
initrd_size
);
nvram
_set_lword
(
nvram
,
0x50
,
NVRAM_image
);
NVRAM
_set_word
(
nvram
,
0x54
,
width
);
NVRAM
_set_word
(
nvram
,
0x56
,
height
);
NVRAM
_set_word
(
nvram
,
0x58
,
depth
);
crc
=
NVRAM
_compute_crc
(
nvram
,
0x00
,
0xF8
);
NVRAM
_set_word
(
nvram
,
0xFC
,
crc
);
nvram
_set_word
(
nvram
,
0x54
,
width
);
nvram
_set_word
(
nvram
,
0x56
,
height
);
nvram
_set_word
(
nvram
,
0x58
,
depth
);
crc
=
nvram
_compute_crc
(
nvram
,
0x00
,
0xF8
);
nvram
_set_word
(
nvram
,
0xFC
,
crc
);
// OpenBIOS nvram variables
// Variable partition
start
=
256
;
m48t59_write
(
nvram
,
start
,
0x70
);
NVRAM
_set_string
(
nvram
,
start
+
4
,
"system"
,
12
);
nvram
_set_string
(
nvram
,
start
+
4
,
"system"
,
12
);
end
=
start
+
16
;
for
(
i
=
0
;
i
<
nb_prom_envs
;
i
++
)
...
...
@@ -260,7 +235,7 @@ int sun4u_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
// free partition
start
=
end
;
m48t59_write
(
nvram
,
start
,
0x7f
);
NVRAM
_set_string
(
nvram
,
start
+
4
,
"free"
,
12
);
nvram
_set_string
(
nvram
,
start
+
4
,
"free"
,
12
);
end
=
0x1fd0
;
nvram_finish_partition
(
nvram
,
start
,
end
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录