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
nexedi
linux
Commits
82708167
Commit
82708167
authored
Jul 03, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[libata] create, and use aga_sg_init[_one] helpers
Move more SCSI-specific code out of libata core.
parent
513e3486
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
19 deletions
+42
-19
drivers/scsi/libata-core.c
drivers/scsi/libata-core.c
+34
-17
drivers/scsi/libata-scsi.c
drivers/scsi/libata-scsi.c
+3
-2
include/linux/libata.h
include/linux/libata.h
+5
-0
No files found.
drivers/scsi/libata-core.c
View file @
82708167
...
...
@@ -1834,6 +1834,33 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
ata_fill_sg
(
qc
);
}
void
ata_sg_init_one
(
struct
ata_queued_cmd
*
qc
,
void
*
buf
,
unsigned
int
buflen
)
{
struct
scatterlist
*
sg
;
qc
->
flags
|=
ATA_QCFLAG_SINGLE
;
memset
(
&
qc
->
sgent
,
0
,
sizeof
(
qc
->
sgent
));
qc
->
sg
=
&
qc
->
sgent
;
qc
->
n_elem
=
1
;
qc
->
buf_virt
=
buf
;
sg
=
qc
->
sg
;
sg
->
page
=
virt_to_page
(
buf
);
sg
->
offset
=
(
unsigned
long
)
buf
&
~
PAGE_MASK
;
sg_dma_len
(
sg
)
=
buflen
;
WARN_ON
(
buflen
>
PAGE_SIZE
);
}
void
ata_sg_init
(
struct
ata_queued_cmd
*
qc
,
struct
scatterlist
*
sg
,
unsigned
int
n_elem
)
{
qc
->
flags
|=
ATA_QCFLAG_SG
;
qc
->
sg
=
sg
;
qc
->
n_elem
=
n_elem
;
}
/**
* ata_sg_setup_one -
* @qc:
...
...
@@ -1848,26 +1875,18 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
static
int
ata_sg_setup_one
(
struct
ata_queued_cmd
*
qc
)
{
struct
ata_port
*
ap
=
qc
->
ap
;
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
int
dir
=
qc
->
pci_dma_dir
;
struct
scatterlist
*
sg
=
qc
->
sg
;
dma_addr_t
dma_address
;
assert
(
sg
==
&
qc
->
sgent
);
assert
(
qc
->
n_elem
==
1
);
sg
->
page
=
virt_to_page
(
cmd
->
request_buffer
);
sg
->
offset
=
(
unsigned
long
)
cmd
->
request_buffer
&
~
PAGE_MASK
;
sg_dma_len
(
sg
)
=
cmd
->
request_bufflen
;
dma_address
=
pci_map_single
(
ap
->
host_set
->
pdev
,
cmd
->
request_buffer
,
cmd
->
request_bufflen
,
dir
);
dma_address
=
pci_map_single
(
ap
->
host_set
->
pdev
,
qc
->
buf_virt
,
sg_dma_len
(
sg
),
dir
);
if
(
pci_dma_mapping_error
(
dma_address
))
return
-
1
;
sg_dma_address
(
sg
)
=
dma_address
;
DPRINTK
(
"mapped buffer of %d bytes for %s
\n
"
,
cmd
->
request_bufflen
,
DPRINTK
(
"mapped buffer of %d bytes for %s
\n
"
,
sg_dma_len
(
sg
)
,
qc
->
tf
.
flags
&
ATA_TFLAG_WRITE
?
"write"
:
"read"
);
return
0
;
...
...
@@ -1887,16 +1906,14 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
static
int
ata_sg_setup
(
struct
ata_queued_cmd
*
qc
)
{
struct
ata_port
*
ap
=
qc
->
ap
;
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
struct
scatterlist
*
sg
;
struct
scatterlist
*
sg
=
qc
->
sg
;
int
n_elem
,
dir
;
VPRINTK
(
"ENTER, ata%u
\n
"
,
ap
->
id
);
assert
(
qc
->
flags
&
ATA_QCFLAG_SG
);
sg
=
(
struct
scatterlist
*
)
cmd
->
request_buffer
;
dir
=
qc
->
pci_dma_dir
;
n_elem
=
pci_map_sg
(
ap
->
host_set
->
pdev
,
sg
,
cmd
->
use_sg
,
dir
);
n_elem
=
pci_map_sg
(
ap
->
host_set
->
pdev
,
sg
,
qc
->
n_elem
,
dir
);
if
(
n_elem
<
1
)
return
-
1
;
...
...
@@ -2012,7 +2029,6 @@ static void ata_pio_sector(struct ata_port *ap)
{
struct
ata_queued_cmd
*
qc
;
struct
scatterlist
*
sg
;
struct
scsi_cmnd
*
cmd
;
unsigned
char
*
buf
;
u8
status
;
...
...
@@ -2044,7 +2060,6 @@ static void ata_pio_sector(struct ata_port *ap)
qc
=
ata_qc_from_tag
(
ap
,
ap
->
active_tag
);
assert
(
qc
!=
NULL
);
cmd
=
qc
->
scsicmd
;
sg
=
qc
->
sg
;
if
(
qc
->
cursect
==
(
qc
->
nsect
-
1
))
...
...
@@ -3340,6 +3355,8 @@ EXPORT_SYMBOL_GPL(pci_test_config_bits);
EXPORT_SYMBOL_GPL
(
ata_std_bios_param
);
EXPORT_SYMBOL_GPL
(
ata_std_ports
);
EXPORT_SYMBOL_GPL
(
ata_device_add
);
EXPORT_SYMBOL_GPL
(
ata_sg_init
);
EXPORT_SYMBOL_GPL
(
ata_sg_init_one
);
EXPORT_SYMBOL_GPL
(
ata_qc_complete
);
EXPORT_SYMBOL_GPL
(
ata_qc_issue_prot
);
EXPORT_SYMBOL_GPL
(
ata_eng_timeout
);
...
...
drivers/scsi/libata-scsi.c
View file @
82708167
...
...
@@ -396,9 +396,10 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
}
if
(
cmd
->
use_sg
)
qc
->
flags
|=
ATA_QCFLAG_SG
;
ata_sg_init
(
qc
,
cmd
->
request_buffer
,
cmd
->
use_sg
)
;
else
qc
->
flags
|=
ATA_QCFLAG_SINGLE
;
ata_sg_init_one
(
qc
,
cmd
->
request_buffer
,
cmd
->
request_bufflen
);
qc
->
pci_dma_dir
=
scsi_to_pci_dma_dir
(
cmd
->
sc_data_direction
);
}
...
...
include/linux/libata.h
View file @
82708167
...
...
@@ -228,6 +228,7 @@ struct ata_queued_cmd {
struct
ata_taskfile
tf
;
struct
scatterlist
sgent
;
void
*
buf_virt
;
struct
scatterlist
*
sg
;
...
...
@@ -384,6 +385,10 @@ extern void ata_port_stop (struct ata_port *ap);
extern
irqreturn_t
ata_interrupt
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
regs
);
extern
void
ata_qc_prep
(
struct
ata_queued_cmd
*
qc
);
extern
int
ata_qc_issue_prot
(
struct
ata_queued_cmd
*
qc
);
extern
void
ata_sg_init_one
(
struct
ata_queued_cmd
*
qc
,
void
*
buf
,
unsigned
int
buflen
);
extern
void
ata_sg_init
(
struct
ata_queued_cmd
*
qc
,
struct
scatterlist
*
sg
,
unsigned
int
n_elem
);
extern
void
ata_dev_id_string
(
struct
ata_device
*
dev
,
unsigned
char
*
s
,
unsigned
int
ofs
,
unsigned
int
len
);
extern
void
ata_bmdma_setup_mmio
(
struct
ata_queued_cmd
*
qc
);
...
...
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