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
7425033b
Commit
7425033b
authored
Oct 15, 2004
by
Bartlomiej Zolnierkiewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[libata] arbitrary size ATAPI PIO support
Signed-off-by:
Bartlomiej Zolnierkiewicz
<
bzolnier@gmail.com
>
parent
430a8c49
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
13 deletions
+50
-13
drivers/scsi/libata-core.c
drivers/scsi/libata-core.c
+44
-13
drivers/scsi/libata-scsi.c
drivers/scsi/libata-scsi.c
+2
-0
include/linux/libata.h
include/linux/libata.h
+4
-0
No files found.
drivers/scsi/libata-core.c
View file @
7425033b
...
...
@@ -2195,11 +2195,50 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
kunmap
(
page
);
}
static
void
atapi_pio_sector
(
struct
ata_queued_cmd
*
qc
)
static
void
__atapi_pio_bytes
(
struct
ata_queued_cmd
*
qc
,
unsigned
int
bytes
)
{
int
do_write
=
(
qc
->
tf
.
flags
&
ATA_TFLAG_WRITE
);
struct
scatterlist
*
sg
=
qc
->
sg
;
struct
ata_port
*
ap
=
qc
->
ap
;
struct
page
*
page
;
unsigned
char
*
buf
;
unsigned
int
count
;
if
(
qc
->
curbytes
==
qc
->
nbytes
-
bytes
)
ap
->
pio_task_state
=
PIO_ST_LAST
;
next_sg:
sg
=
&
sg
[
qc
->
cursg
];
page
=
sg
->
page
;
count
=
min
(
sg_dma_len
(
sg
)
-
qc
->
cursg_ofs
,
bytes
);
buf
=
kmap
(
page
)
+
sg
->
offset
+
qc
->
cursg_ofs
;
bytes
-=
count
;
qc
->
curbytes
+=
count
;
qc
->
cursg_ofs
+=
count
;
if
(
qc
->
cursg_ofs
==
sg_dma_len
(
sg
))
{
qc
->
cursg
++
;
qc
->
cursg_ofs
=
0
;
}
DPRINTK
(
"data %s
\n
"
,
qc
->
tf
.
flags
&
ATA_TFLAG_WRITE
?
"write"
:
"read"
);
/* do the actual data transfer */
ata_data_xfer
(
ap
,
buf
,
count
,
do_write
);
kunmap
(
page
);
if
(
bytes
)
goto
next_sg
;
}
static
void
atapi_pio_bytes
(
struct
ata_queued_cmd
*
qc
)
{
struct
ata_port
*
ap
=
qc
->
ap
;
struct
ata_device
*
dev
=
qc
->
dev
;
unsigned
int
i
,
i
reason
,
bc_lo
,
bc_hi
,
bytes
;
unsigned
int
ireason
,
bc_lo
,
bc_hi
,
bytes
;
int
i_write
,
do_write
=
(
qc
->
tf
.
flags
&
ATA_TFLAG_WRITE
)
?
1
:
0
;
ap
->
ops
->
tf_read
(
ap
,
&
qc
->
tf
);
...
...
@@ -2217,16 +2256,7 @@ static void atapi_pio_sector(struct ata_queued_cmd *qc)
if
(
do_write
!=
i_write
)
goto
err_out
;
/* make sure byte count is multiple of sector size; not
* required by standard (warning! warning!), but IDE driver
* does this to simplify things a bit. We are lazy, and
* follow suit.
*/
if
(
bytes
&
(
ATA_SECT_SIZE
-
1
))
goto
err_out
;
for
(
i
=
0
;
i
<
(
bytes
>>
9
);
i
++
)
ata_pio_sector
(
qc
);
__atapi_pio_bytes
(
qc
,
bytes
);
return
;
...
...
@@ -2277,7 +2307,7 @@ static void ata_pio_block(struct ata_port *ap)
assert
(
qc
!=
NULL
);
if
(
is_atapi_taskfile
(
&
qc
->
tf
))
atapi_pio_
sector
(
qc
);
atapi_pio_
bytes
(
qc
);
else
ata_pio_sector
(
qc
);
}
...
...
@@ -2556,6 +2586,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
qc
->
dev
=
dev
;
qc
->
cursect
=
qc
->
cursg
=
qc
->
cursg_ofs
=
0
;
qc
->
nsect
=
0
;
qc
->
nbytes
=
qc
->
nbytes
=
0
;
ata_tf_init
(
ap
,
&
qc
->
tf
,
dev
->
devno
);
...
...
drivers/scsi/libata-scsi.c
View file @
7425033b
...
...
@@ -1328,6 +1328,8 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
#endif
}
qc
->
nbytes
=
cmd
->
bufflen
;
return
0
;
}
...
...
include/linux/libata.h
View file @
7425033b
...
...
@@ -230,6 +230,10 @@ struct ata_queued_cmd {
unsigned
int
nsect
;
unsigned
int
cursect
;
unsigned
int
nbytes
;
unsigned
int
curbytes
;
unsigned
int
cursg
;
unsigned
int
cursg_ofs
;
...
...
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