Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5017077e
Commit
5017077e
authored
Apr 25, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[libata] move ATAPI command initiation code from libata-scsi to libata-core
parent
d27a0b0f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
46 deletions
+58
-46
drivers/scsi/libata-core.c
drivers/scsi/libata-core.c
+53
-0
drivers/scsi/libata-scsi.c
drivers/scsi/libata-scsi.c
+4
-46
drivers/scsi/libata.h
drivers/scsi/libata.h
+1
-0
No files found.
drivers/scsi/libata-core.c
View file @
5017077e
...
...
@@ -2767,6 +2767,59 @@ static unsigned long ata_thread_iter(struct ata_port *ap)
return
timeout
;
}
void
atapi_start
(
struct
ata_queued_cmd
*
qc
)
{
struct
ata_port
*
ap
=
qc
->
ap
;
struct
ata_device
*
dev
=
qc
->
dev
;
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
u8
status
;
int
doing_dma
;
doing_dma
=
(
qc
->
tf
.
protocol
==
ATA_PROT_ATAPI_DMA
);
if
(
cmd
->
sc_data_direction
==
SCSI_DATA_NONE
)
{
ap
->
active_tag
=
qc
->
tag
;
qc
->
flags
|=
ATA_QCFLAG_ACTIVE
|
ATA_QCFLAG_POLL
;
ata_dev_select
(
ap
,
dev
->
devno
,
1
,
0
);
DPRINTK
(
"direction: none
\n
"
);
qc
->
tf
.
ctl
|=
ATA_NIEN
;
/* disable interrupts */
ata_tf_to_host_nolock
(
ap
,
&
qc
->
tf
);
}
else
{
qc
->
flags
|=
ATA_QCFLAG_SG
;
/* data is present; dma-map it */
qc
->
tf
.
feature
=
ATAPI_PKT_DMA
;
/* select device, send command to hardware */
if
(
ata_qc_issue
(
qc
))
goto
err_out
;
}
status
=
ata_busy_wait
(
ap
,
ATA_BUSY
,
1000
);
if
(
status
&
ATA_BUSY
)
{
queue_work
(
ata_wq
,
&
ap
->
packet_task
);
return
;
}
if
((
status
&
ATA_DRQ
)
==
0
)
goto
err_out
;
/* FIXME: mmio-ize */
DPRINTK
(
"writing cdb
\n
"
);
outsl
(
ap
->
ioaddr
.
data_addr
,
cmd
->
cmnd
,
ap
->
host
->
max_cmd_len
/
4
);
if
(
!
doing_dma
)
queue_work
(
ata_wq
,
&
ap
->
packet_task
);
VPRINTK
(
"EXIT
\n
"
);
return
;
err_out:
if
(
!
doing_dma
)
ata_irq_on
(
ap
);
/* re-enable interrupts */
ata_bad_cdb
(
cmd
,
qc
->
scsidone
);
DPRINTK
(
"EXIT - badcmd
\n
"
);
}
/**
* atapi_packet_task - Write CDB bytes to hardware
* @_data: Port to which ATAPI device is attached.
...
...
drivers/scsi/libata-scsi.c
View file @
5017077e
...
...
@@ -885,8 +885,7 @@ static void atapi_scsi_queuecmd(struct ata_port *ap, struct ata_device *dev,
struct
scsi_cmnd
*
cmd
,
void
(
*
done
)(
struct
scsi_cmnd
*
))
{
struct
ata_queued_cmd
*
qc
;
u8
*
scsicmd
=
cmd
->
cmnd
,
status
;
unsigned
int
doing_dma
=
0
;
u8
*
scsicmd
=
cmd
->
cmnd
;
VPRINTK
(
"ENTER, drv_stat = 0x%x
\n
"
,
ata_chk_status
(
ap
));
...
...
@@ -925,53 +924,12 @@ static void atapi_scsi_queuecmd(struct ata_port *ap, struct ata_device *dev,
}
qc
->
tf
.
command
=
ATA_CMD_PACKET
;
/* set up SG table */
if
(
cmd
->
sc_data_direction
==
SCSI_DATA_NONE
)
{
ap
->
active_tag
=
qc
->
tag
;
qc
->
flags
|=
ATA_QCFLAG_ACTIVE
|
ATA_QCFLAG_POLL
;
if
(
cmd
->
sc_data_direction
==
SCSI_DATA_NONE
)
qc
->
tf
.
protocol
=
ATA_PROT_ATAPI
;
ata_dev_select
(
ap
,
dev
->
devno
,
1
,
0
);
DPRINTK
(
"direction: none
\n
"
);
qc
->
tf
.
ctl
|=
ATA_NIEN
;
/* disable interrupts */
ata_tf_to_host_nolock
(
ap
,
&
qc
->
tf
);
}
else
{
qc
->
flags
|=
ATA_QCFLAG_SG
;
/* data is present; dma-map it */
qc
->
tf
.
feature
=
ATAPI_PKT_DMA
;
else
qc
->
tf
.
protocol
=
ATA_PROT_ATAPI_DMA
;
doing_dma
=
1
;
/* select device, send command to hardware */
if
(
ata_qc_issue
(
qc
))
goto
err_out
;
}
status
=
ata_busy_wait
(
ap
,
ATA_BUSY
,
1000
);
if
(
status
&
ATA_BUSY
)
{
queue_work
(
ata_wq
,
&
ap
->
packet_task
);
return
;
}
if
((
status
&
ATA_DRQ
)
==
0
)
goto
err_out
;
/* FIXME: mmio-ize */
DPRINTK
(
"writing cdb
\n
"
);
outsl
(
ap
->
ioaddr
.
data_addr
,
scsicmd
,
ap
->
host
->
max_cmd_len
/
4
);
if
(
!
doing_dma
)
queue_work
(
ata_wq
,
&
ap
->
packet_task
);
VPRINTK
(
"EXIT
\n
"
);
return
;
err_out:
if
(
!
doing_dma
)
ata_irq_on
(
ap
);
/* re-enable interrupts */
ata_bad_cdb
(
cmd
,
done
);
DPRINTK
(
"EXIT - badcmd
\n
"
);
atapi_start
(
qc
);
}
/**
...
...
drivers/scsi/libata.h
View file @
5017077e
...
...
@@ -46,6 +46,7 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc);
extern
void
ata_dev_select
(
struct
ata_port
*
ap
,
unsigned
int
device
,
unsigned
int
wait
,
unsigned
int
can_sleep
);
extern
void
ata_tf_to_host_nolock
(
struct
ata_port
*
ap
,
struct
ata_taskfile
*
tf
);
extern
void
atapi_start
(
struct
ata_queued_cmd
*
qc
);
/* libata-scsi.c */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment