Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
c71c1857
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c71c1857
编写于
10月 04, 2005
作者:
A
Albert Lee
提交者:
Jeff Garzik
10月 04, 2005
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libata: move atapi_send_cdb() and ata_dataout_task()
to be near ata_pio_*() functions
上级
0fbbbf2b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
108 addition
and
109 deletion
+108
-109
drivers/scsi/libata-core.c
drivers/scsi/libata-core.c
+108
-109
未找到文件。
drivers/scsi/libata-core.c
浏览文件 @
c71c1857
...
...
@@ -2781,6 +2781,114 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
local_irq_restore
(
flags
);
}
/**
* atapi_send_cdb - Write CDB bytes to hardware
* @ap: Port to which ATAPI device is attached.
* @qc: Taskfile currently active
*
* When device has indicated its readiness to accept
* a CDB, this function is called. Send the CDB.
*
* LOCKING:
* caller.
*/
static
void
atapi_send_cdb
(
struct
ata_port
*
ap
,
struct
ata_queued_cmd
*
qc
)
{
/* send SCSI cdb */
DPRINTK
(
"send cdb
\n
"
);
assert
(
ap
->
cdb_len
>=
12
);
ata_data_xfer
(
ap
,
qc
->
cdb
,
ap
->
cdb_len
,
1
);
ata_altstatus
(
ap
);
/* flush */
switch
(
qc
->
tf
.
protocol
)
{
case
ATA_PROT_ATAPI
:
ap
->
hsm_task_state
=
HSM_ST
;
break
;
case
ATA_PROT_ATAPI_NODATA
:
ap
->
hsm_task_state
=
HSM_ST_LAST
;
break
;
case
ATA_PROT_ATAPI_DMA
:
ap
->
hsm_task_state
=
HSM_ST_LAST
;
/* initiate bmdma */
ap
->
ops
->
bmdma_start
(
qc
);
break
;
}
}
/**
* ata_dataout_task - Write first data block to hardware
* @_data: Port to which ATA/ATAPI device is attached.
*
* When device has indicated its readiness to accept
* the data, this function sends out the CDB or
* the first data block by PIO.
* After this,
* - If polling, ata_pio_task() handles the rest.
* - Otherwise, interrupt handler takes over.
*
* LOCKING:
* Kernel thread context (may sleep)
*/
static
void
ata_dataout_task
(
void
*
_data
)
{
struct
ata_port
*
ap
=
_data
;
struct
ata_queued_cmd
*
qc
;
u8
status
;
unsigned
long
flags
;
qc
=
ata_qc_from_tag
(
ap
,
ap
->
active_tag
);
assert
(
qc
!=
NULL
);
assert
(
qc
->
flags
&
ATA_QCFLAG_ACTIVE
);
/* sleep-wait for BSY to clear */
DPRINTK
(
"busy wait
\n
"
);
if
(
ata_busy_sleep
(
ap
,
ATA_TMOUT_DATAOUT_QUICK
,
ATA_TMOUT_DATAOUT
))
goto
err_out
;
/* make sure DRQ is set */
status
=
ata_chk_status
(
ap
);
if
((
status
&
(
ATA_BUSY
|
ATA_DRQ
))
!=
ATA_DRQ
)
goto
err_out
;
/* Send the CDB (atapi) or the first data block (ata pio out).
* During the state transition, interrupt handler shouldn't
* be invoked before the data transfer is complete and
* hsm_task_state is changed. Hence, the following locking.
*/
spin_lock_irqsave
(
&
ap
->
host_set
->
lock
,
flags
);
if
(
qc
->
tf
.
protocol
==
ATA_PROT_PIO
)
{
/* PIO data out protocol.
* send first data block.
*/
/* ata_pio_sector() might change the state to HSM_ST_LAST.
* so, the state is changed here before ata_pio_sector().
*/
ap
->
hsm_task_state
=
HSM_ST
;
ata_pio_sector
(
qc
);
ata_altstatus
(
ap
);
/* flush */
}
else
/* send CDB */
atapi_send_cdb
(
ap
,
qc
);
/* if polling, ata_pio_task() handles the rest.
* otherwise, interrupt handler takes over from here.
*/
if
(
qc
->
tf
.
flags
&
ATA_TFLAG_POLLING
)
queue_work
(
ata_wq
,
&
ap
->
pio_task
);
spin_unlock_irqrestore
(
&
ap
->
host_set
->
lock
,
flags
);
return
;
err_out:
ata_pio_error
(
ap
);
}
/**
* __atapi_pio_bytes - Transfer data from/to the ATAPI device.
* @qc: Command on going
...
...
@@ -3784,42 +3892,6 @@ void ata_bmdma_stop(struct ata_queued_cmd *qc)
ata_altstatus
(
ap
);
/* dummy read */
}
/**
* atapi_send_cdb - Write CDB bytes to hardware
* @ap: Port to which ATAPI device is attached.
* @qc: Taskfile currently active
*
* When device has indicated its readiness to accept
* a CDB, this function is called. Send the CDB.
*
* LOCKING:
* caller.
*/
static
void
atapi_send_cdb
(
struct
ata_port
*
ap
,
struct
ata_queued_cmd
*
qc
)
{
/* send SCSI cdb */
DPRINTK
(
"send cdb
\n
"
);
assert
(
ap
->
cdb_len
>=
12
);
ata_data_xfer
(
ap
,
qc
->
cdb
,
ap
->
cdb_len
,
1
);
ata_altstatus
(
ap
);
/* flush */
switch
(
qc
->
tf
.
protocol
)
{
case
ATA_PROT_ATAPI
:
ap
->
hsm_task_state
=
HSM_ST
;
break
;
case
ATA_PROT_ATAPI_NODATA
:
ap
->
hsm_task_state
=
HSM_ST_LAST
;
break
;
case
ATA_PROT_ATAPI_DMA
:
ap
->
hsm_task_state
=
HSM_ST_LAST
;
/* initiate bmdma */
ap
->
ops
->
bmdma_start
(
qc
);
break
;
}
}
/**
* ata_host_intr - Handle host interrupt for given (port, task)
* @ap: Port on which interrupt arrived (possibly...)
...
...
@@ -4041,79 +4113,6 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
return
IRQ_RETVAL
(
handled
);
}
/**
* ata_dataout_task - Write first data block to hardware
* @_data: Port to which ATA/ATAPI device is attached.
*
* When device has indicated its readiness to accept
* the data, this function sends out the CDB or
* the first data block by PIO.
* After this,
* - If polling, ata_pio_task() handles the rest.
* - Otherwise, interrupt handler takes over.
*
* LOCKING:
* Kernel thread context (may sleep)
*/
static
void
ata_dataout_task
(
void
*
_data
)
{
struct
ata_port
*
ap
=
_data
;
struct
ata_queued_cmd
*
qc
;
u8
status
;
unsigned
long
flags
;
qc
=
ata_qc_from_tag
(
ap
,
ap
->
active_tag
);
assert
(
qc
!=
NULL
);
assert
(
qc
->
flags
&
ATA_QCFLAG_ACTIVE
);
/* sleep-wait for BSY to clear */
DPRINTK
(
"busy wait
\n
"
);
if
(
ata_busy_sleep
(
ap
,
ATA_TMOUT_DATAOUT_QUICK
,
ATA_TMOUT_DATAOUT
))
goto
err_out
;
/* make sure DRQ is set */
status
=
ata_chk_status
(
ap
);
if
((
status
&
(
ATA_BUSY
|
ATA_DRQ
))
!=
ATA_DRQ
)
goto
err_out
;
/* Send the CDB (atapi) or the first data block (ata pio out).
* During the state transition, interrupt handler shouldn't
* be invoked before the data transfer is complete and
* hsm_task_state is changed. Hence, the following locking.
*/
spin_lock_irqsave
(
&
ap
->
host_set
->
lock
,
flags
);
if
(
qc
->
tf
.
protocol
==
ATA_PROT_PIO
)
{
/* PIO data out protocol.
* send first data block.
*/
/* ata_pio_sector() might change the state to HSM_ST_LAST.
* so, the state is changed here before ata_pio_sector().
*/
ap
->
hsm_task_state
=
HSM_ST
;
ata_pio_sector
(
qc
);
ata_altstatus
(
ap
);
/* flush */
}
else
/* send CDB */
atapi_send_cdb
(
ap
,
qc
);
/* if polling, ata_pio_task() handles the rest.
* otherwise, interrupt handler takes over from here.
*/
if
(
qc
->
tf
.
flags
&
ATA_TFLAG_POLLING
)
queue_work
(
ata_wq
,
&
ap
->
pio_task
);
spin_unlock_irqrestore
(
&
ap
->
host_set
->
lock
,
flags
);
return
;
err_out:
ata_pio_error
(
ap
);
}
/**
* ata_port_start - Set port up for dma.
* @ap: Port to initialize
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录