Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
35cfc45c
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 大约 4 年
通知
14
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
35cfc45c
编写于
1月 17, 2006
作者:
J
Jeff Garzik
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'lba48-opt'
上级
8a6d498e
0825788f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
27 deletion
+33
-27
drivers/scsi/libata-scsi.c
drivers/scsi/libata-scsi.c
+21
-27
include/linux/ata.h
include/linux/ata.h
+12
-0
未找到文件。
drivers/scsi/libata-scsi.c
浏览文件 @
35cfc45c
...
@@ -985,9 +985,13 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *sc
...
@@ -985,9 +985,13 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *sc
if
(
dev
->
flags
&
ATA_DFLAG_LBA
)
{
if
(
dev
->
flags
&
ATA_DFLAG_LBA
)
{
tf
->
flags
|=
ATA_TFLAG_LBA
;
tf
->
flags
|=
ATA_TFLAG_LBA
;
if
(
dev
->
flags
&
ATA_DFLAG_LBA48
)
{
if
(
lba_28_ok
(
block
,
n_block
))
{
if
(
n_block
>
(
64
*
1024
))
/* use LBA28 */
goto
invalid_fld
;
tf
->
command
=
ATA_CMD_VERIFY
;
tf
->
device
|=
(
block
>>
24
)
&
0xf
;
}
else
if
(
lba_48_ok
(
block
,
n_block
))
{
if
(
!
(
dev
->
flags
&
ATA_DFLAG_LBA48
))
goto
out_of_range
;
/* use LBA48 */
/* use LBA48 */
tf
->
flags
|=
ATA_TFLAG_LBA48
;
tf
->
flags
|=
ATA_TFLAG_LBA48
;
...
@@ -998,15 +1002,9 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *sc
...
@@ -998,15 +1002,9 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *sc
tf
->
hob_lbah
=
(
block
>>
40
)
&
0xff
;
tf
->
hob_lbah
=
(
block
>>
40
)
&
0xff
;
tf
->
hob_lbam
=
(
block
>>
32
)
&
0xff
;
tf
->
hob_lbam
=
(
block
>>
32
)
&
0xff
;
tf
->
hob_lbal
=
(
block
>>
24
)
&
0xff
;
tf
->
hob_lbal
=
(
block
>>
24
)
&
0xff
;
}
else
{
}
else
if
(
n_block
>
256
)
/* request too large even for LBA48 */
goto
invalid_fld
;
goto
out_of_range
;
/* use LBA28 */
tf
->
command
=
ATA_CMD_VERIFY
;
tf
->
device
|=
(
block
>>
24
)
&
0xf
;
}
tf
->
nsect
=
n_block
&
0xff
;
tf
->
nsect
=
n_block
&
0xff
;
...
@@ -1019,8 +1017,8 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *sc
...
@@ -1019,8 +1017,8 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *sc
/* CHS */
/* CHS */
u32
sect
,
head
,
cyl
,
track
;
u32
sect
,
head
,
cyl
,
track
;
if
(
n_block
>
256
)
if
(
!
lba_28_ok
(
block
,
n_block
)
)
goto
invalid_fld
;
goto
out_of_range
;
/* Convert LBA to CHS */
/* Convert LBA to CHS */
track
=
(
u32
)
block
/
dev
->
sectors
;
track
=
(
u32
)
block
/
dev
->
sectors
;
...
@@ -1139,9 +1137,11 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
...
@@ -1139,9 +1137,11 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
if
(
dev
->
flags
&
ATA_DFLAG_LBA
)
{
if
(
dev
->
flags
&
ATA_DFLAG_LBA
)
{
tf
->
flags
|=
ATA_TFLAG_LBA
;
tf
->
flags
|=
ATA_TFLAG_LBA
;
if
(
dev
->
flags
&
ATA_DFLAG_LBA48
)
{
if
(
lba_28_ok
(
block
,
n_block
))
{
/* The request -may- be too large for LBA48. */
/* use LBA28 */
if
((
block
>>
48
)
||
(
n_block
>
65536
))
tf
->
device
|=
(
block
>>
24
)
&
0xf
;
}
else
if
(
lba_48_ok
(
block
,
n_block
))
{
if
(
!
(
dev
->
flags
&
ATA_DFLAG_LBA48
))
goto
out_of_range
;
goto
out_of_range
;
/* use LBA48 */
/* use LBA48 */
...
@@ -1152,15 +1152,9 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
...
@@ -1152,15 +1152,9 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
tf
->
hob_lbah
=
(
block
>>
40
)
&
0xff
;
tf
->
hob_lbah
=
(
block
>>
40
)
&
0xff
;
tf
->
hob_lbam
=
(
block
>>
32
)
&
0xff
;
tf
->
hob_lbam
=
(
block
>>
32
)
&
0xff
;
tf
->
hob_lbal
=
(
block
>>
24
)
&
0xff
;
tf
->
hob_lbal
=
(
block
>>
24
)
&
0xff
;
}
else
{
}
else
/* use LBA28 */
/* request too large even for LBA48 */
goto
out_of_range
;
/* The request -may- be too large for LBA28. */
if
((
block
>>
28
)
||
(
n_block
>
256
))
goto
out_of_range
;
tf
->
device
|=
(
block
>>
24
)
&
0xf
;
}
if
(
unlikely
(
ata_rwcmd_protocol
(
qc
)
<
0
))
if
(
unlikely
(
ata_rwcmd_protocol
(
qc
)
<
0
))
goto
invalid_fld
;
goto
invalid_fld
;
...
@@ -1178,7 +1172,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
...
@@ -1178,7 +1172,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
u32
sect
,
head
,
cyl
,
track
;
u32
sect
,
head
,
cyl
,
track
;
/* The request -may- be too large for CHS addressing. */
/* The request -may- be too large for CHS addressing. */
if
(
(
block
>>
28
)
||
(
n_block
>
256
))
if
(
!
lba_28_ok
(
block
,
n_block
))
goto
out_of_range
;
goto
out_of_range
;
if
(
unlikely
(
ata_rwcmd_protocol
(
qc
)
<
0
))
if
(
unlikely
(
ata_rwcmd_protocol
(
qc
)
<
0
))
...
...
include/linux/ata.h
浏览文件 @
35cfc45c
...
@@ -302,4 +302,16 @@ static inline int ata_ok(u8 status)
...
@@ -302,4 +302,16 @@ static inline int ata_ok(u8 status)
==
ATA_DRDY
);
==
ATA_DRDY
);
}
}
static
inline
int
lba_28_ok
(
u64
block
,
u32
n_block
)
{
/* check the ending block number */
return
((
block
+
n_block
-
1
)
<
((
u64
)
1
<<
28
))
&&
(
n_block
<=
256
);
}
static
inline
int
lba_48_ok
(
u64
block
,
u32
n_block
)
{
/* check the ending block number */
return
((
block
+
n_block
-
1
)
<
((
u64
)
1
<<
48
))
&&
(
n_block
<=
65536
);
}
#endif
/* __LINUX_ATA_H__ */
#endif
/* __LINUX_ATA_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录