Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
8dcce408
Commit
8dcce408
authored
Jun 13, 2009
by
Bartlomiej Zolnierkiewicz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bp-remove-pc-buf' into for-next
Conflicts: drivers/ide/ide-tape.c
parents
f3ad1165
103f7033
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
230 additions
and
261 deletions
+230
-261
drivers/ide/ide-atapi.c
drivers/ide/ide-atapi.c
+87
-51
drivers/ide/ide-cd.c
drivers/ide/ide-cd.c
+11
-57
drivers/ide/ide-floppy.c
drivers/ide/ide-floppy.c
+22
-28
drivers/ide/ide-floppy_ioctl.c
drivers/ide/ide-floppy_ioctl.c
+23
-20
drivers/ide/ide-tape.c
drivers/ide/ide-tape.c
+83
-91
include/linux/ide.h
include/linux/ide.h
+4
-14
No files found.
drivers/ide/ide-atapi.c
View file @
8dcce408
This diff is collapsed.
Click to expand it.
drivers/ide/ide-cd.c
View file @
8dcce408
...
...
@@ -92,16 +92,16 @@ static void cdrom_saw_media_change(ide_drive_t *drive)
drive
->
atapi_flags
&=
~
IDE_AFLAG_TOC_VALID
;
}
static
int
cdrom_log_sense
(
ide_drive_t
*
drive
,
struct
request
*
rq
,
struct
request_sense
*
sense
)
static
int
cdrom_log_sense
(
ide_drive_t
*
drive
,
struct
request
*
rq
)
{
struct
request_sense
*
sense
=
&
drive
->
sense_data
;
int
log
=
0
;
ide_debug_log
(
IDE_DBG_SENSE
,
"sense_key: 0x%x"
,
sense
->
sense_key
);
if
(
!
sense
||
!
rq
||
(
rq
->
cmd_flags
&
REQ_QUIET
))
return
0
;
ide_debug_log
(
IDE_DBG_SENSE
,
"sense_key: 0x%x"
,
sense
->
sense_key
);
switch
(
sense
->
sense_key
)
{
case
NO_SENSE
:
case
RECOVERED_ERROR
:
...
...
@@ -140,12 +140,12 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq,
}
static
void
cdrom_analyze_sense_data
(
ide_drive_t
*
drive
,
struct
request
*
failed_command
,
struct
request_sense
*
sense
)
struct
request
*
failed_command
)
{
struct
request_sense
*
sense
=
&
drive
->
sense_data
;
struct
cdrom_info
*
info
=
drive
->
driver_data
;
unsigned
long
sector
;
unsigned
long
bio_sectors
;
struct
cdrom_info
*
info
=
drive
->
driver_data
;
ide_debug_log
(
IDE_DBG_SENSE
,
"error_code: 0x%x, sense_key: 0x%x"
,
sense
->
error_code
,
sense
->
sense_key
);
...
...
@@ -154,7 +154,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
ide_debug_log
(
IDE_DBG_SENSE
,
"failed cmd: 0x%x"
,
failed_command
->
cmd
[
0
]);
if
(
!
cdrom_log_sense
(
drive
,
failed_command
,
sense
))
if
(
!
cdrom_log_sense
(
drive
,
failed_command
))
return
;
/*
...
...
@@ -225,15 +225,14 @@ static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
* sense pointer set.
*/
memcpy
(
failed
->
sense
,
sense
,
18
);
sense
=
failed
->
sense
;
failed
->
sense_len
=
rq
->
sense_len
;
}
cdrom_analyze_sense_data
(
drive
,
failed
,
sense
);
cdrom_analyze_sense_data
(
drive
,
failed
);
if
(
ide_end_rq
(
drive
,
failed
,
-
EIO
,
blk_rq_bytes
(
failed
)))
BUG
();
}
else
cdrom_analyze_sense_data
(
drive
,
NULL
,
sense
);
cdrom_analyze_sense_data
(
drive
,
NULL
);
}
...
...
@@ -410,50 +409,6 @@ end_request:
return
2
;
}
/*
* Check the contents of the interrupt reason register from the cdrom
* and attempt to recover if there are problems. Returns 0 if everything's
* ok; nonzero if the request has been terminated.
*/
static
int
ide_cd_check_ireason
(
ide_drive_t
*
drive
,
struct
request
*
rq
,
int
len
,
int
ireason
,
int
rw
)
{
ide_hwif_t
*
hwif
=
drive
->
hwif
;
ide_debug_log
(
IDE_DBG_FUNC
,
"ireason: 0x%x, rw: 0x%x"
,
ireason
,
rw
);
/*
* ireason == 0: the drive wants to receive data from us
* ireason == 2: the drive is expecting to transfer data to us
*/
if
(
ireason
==
(
!
rw
<<
1
))
return
0
;
else
if
(
ireason
==
(
rw
<<
1
))
{
/* whoops... */
printk
(
KERN_ERR
PFX
"%s: %s: wrong transfer direction!
\n
"
,
drive
->
name
,
__func__
);
ide_pad_transfer
(
drive
,
rw
,
len
);
}
else
if
(
rw
==
0
&&
ireason
==
1
)
{
/*
* Some drives (ASUS) seem to tell us that status info is
* available. Just get it and ignore.
*/
(
void
)
hwif
->
tp_ops
->
read_status
(
hwif
);
return
0
;
}
else
{
/* drive wants a command packet, or invalid ireason... */
printk
(
KERN_ERR
PFX
"%s: %s: bad interrupt reason 0x%02x
\n
"
,
drive
->
name
,
__func__
,
ireason
);
}
if
(
rq
->
cmd_type
==
REQ_TYPE_ATA_PC
)
rq
->
cmd_flags
|=
REQ_FAILED
;
return
-
1
;
}
static
void
ide_cd_request_sense_fixup
(
ide_drive_t
*
drive
,
struct
ide_cmd
*
cmd
)
{
struct
request
*
rq
=
cmd
->
rq
;
...
...
@@ -645,8 +600,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
goto
out_end
;
}
/* check which way to transfer data */
rc
=
ide_cd_check_ireason
(
drive
,
rq
,
len
,
ireason
,
write
);
rc
=
ide_check_ireason
(
drive
,
rq
,
len
,
ireason
,
write
);
if
(
rc
)
goto
out_end
;
...
...
drivers/ide/ide-floppy.c
View file @
8dcce408
...
...
@@ -77,7 +77,8 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
(
rq
&&
blk_pc_request
(
rq
)))
uptodate
=
1
;
/* FIXME */
else
if
(
pc
->
c
[
0
]
==
GPCMD_REQUEST_SENSE
)
{
u8
*
buf
=
pc
->
buf
;
u8
*
buf
=
bio_data
(
rq
->
bio
);
if
(
!
pc
->
error
)
{
floppy
->
sense_key
=
buf
[
2
]
&
0x0F
;
...
...
@@ -209,8 +210,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive,
pc
->
rq
=
rq
;
if
(
rq
->
cmd_flags
&
REQ_RW
)
pc
->
flags
|=
PC_FLAG_WRITING
;
pc
->
buf
=
NULL
;
pc
->
req_xfer
=
pc
->
buf_size
=
blocks
*
floppy
->
block_size
;
pc
->
flags
|=
PC_FLAG_DMA_OK
;
}
...
...
@@ -225,9 +225,6 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy,
if
(
rq_data_dir
(
rq
)
==
WRITE
)
pc
->
flags
|=
PC_FLAG_WRITING
;
}
/* pio will be performed by ide_pio_bytes() which handles sg fine */
pc
->
buf
=
NULL
;
pc
->
req_xfer
=
pc
->
buf_size
=
blk_rq_bytes
(
rq
);
}
static
ide_startstop_t
ide_floppy_do_request
(
ide_drive_t
*
drive
,
...
...
@@ -286,8 +283,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
cmd
.
rq
=
rq
;
if
(
blk_fs_request
(
rq
)
||
pc
->
req_xfer
)
{
ide_init_sg_cmd
(
&
cmd
,
pc
->
req_xfer
);
if
(
blk_fs_request
(
rq
)
||
blk_rq_bytes
(
rq
)
)
{
ide_init_sg_cmd
(
&
cmd
,
blk_rq_bytes
(
rq
)
);
ide_map_sg
(
drive
,
&
cmd
);
}
...
...
@@ -311,33 +308,33 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive,
{
struct
ide_disk_obj
*
floppy
=
drive
->
driver_data
;
struct
gendisk
*
disk
=
floppy
->
disk
;
u8
*
page
;
u8
*
page
,
buf
[
40
]
;
int
capacity
,
lba_capacity
;
u16
transfer_rate
,
sector_size
,
cyls
,
rpm
;
u8
heads
,
sectors
;
ide_floppy_create_mode_sense_cmd
(
pc
,
IDEFLOPPY_FLEXIBLE_DISK_PAGE
);
if
(
ide_queue_pc_tail
(
drive
,
disk
,
pc
))
{
if
(
ide_queue_pc_tail
(
drive
,
disk
,
pc
,
buf
,
pc
->
req_xfer
))
{
printk
(
KERN_ERR
PFX
"Can't get flexible disk page params
\n
"
);
return
1
;
}
if
(
pc
->
buf
[
3
]
&
0x80
)
if
(
buf
[
3
]
&
0x80
)
drive
->
dev_flags
|=
IDE_DFLAG_WP
;
else
drive
->
dev_flags
&=
~
IDE_DFLAG_WP
;
set_disk_ro
(
disk
,
!!
(
drive
->
dev_flags
&
IDE_DFLAG_WP
));
page
=
&
pc
->
buf
[
8
];
page
=
&
buf
[
8
];
transfer_rate
=
be16_to_cpup
((
__be16
*
)
&
pc
->
buf
[
8
+
2
]);
sector_size
=
be16_to_cpup
((
__be16
*
)
&
pc
->
buf
[
8
+
6
]);
cyls
=
be16_to_cpup
((
__be16
*
)
&
pc
->
buf
[
8
+
8
]);
rpm
=
be16_to_cpup
((
__be16
*
)
&
pc
->
buf
[
8
+
28
]);
heads
=
pc
->
buf
[
8
+
4
];
sectors
=
pc
->
buf
[
8
+
5
];
transfer_rate
=
be16_to_cpup
((
__be16
*
)
&
buf
[
8
+
2
]);
sector_size
=
be16_to_cpup
((
__be16
*
)
&
buf
[
8
+
6
]);
cyls
=
be16_to_cpup
((
__be16
*
)
&
buf
[
8
+
8
]);
rpm
=
be16_to_cpup
((
__be16
*
)
&
buf
[
8
+
28
]);
heads
=
buf
[
8
+
4
];
sectors
=
buf
[
8
+
5
];
capacity
=
cyls
*
heads
*
sectors
*
sector_size
;
...
...
@@ -387,22 +384,19 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
drive
->
capacity64
=
0
;
ide_floppy_create_read_capacity_cmd
(
&
pc
);
pc
.
buf
=
&
pc_buf
[
0
];
pc
.
buf_size
=
sizeof
(
pc_buf
);
if
(
ide_queue_pc_tail
(
drive
,
disk
,
&
pc
))
{
if
(
ide_queue_pc_tail
(
drive
,
disk
,
&
pc
,
pc_buf
,
pc
.
req_xfer
))
{
printk
(
KERN_ERR
PFX
"Can't get floppy parameters
\n
"
);
return
1
;
}
header_len
=
pc
.
buf
[
3
];
cap_desc
=
&
pc
.
buf
[
4
];
header_len
=
pc
_
buf
[
3
];
cap_desc
=
&
pc
_
buf
[
4
];
desc_cnt
=
header_len
/
8
;
/* capacity descriptor of 8 bytes */
for
(
i
=
0
;
i
<
desc_cnt
;
i
++
)
{
unsigned
int
desc_start
=
4
+
i
*
8
;
blocks
=
be32_to_cpup
((
__be32
*
)
&
pc
.
buf
[
desc_start
]);
length
=
be16_to_cpup
((
__be16
*
)
&
pc
.
buf
[
desc_start
+
6
]);
blocks
=
be32_to_cpup
((
__be32
*
)
&
pc
_
buf
[
desc_start
]);
length
=
be16_to_cpup
((
__be16
*
)
&
pc
_
buf
[
desc_start
+
6
]);
ide_debug_log
(
IDE_DBG_PROBE
,
"Descriptor %d: %dkB, %d blocks, "
"%d sector size"
,
...
...
@@ -415,7 +409,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
* the code below is valid only for the 1st descriptor, ie i=0
*/
switch
(
pc
.
buf
[
desc_start
+
4
]
&
0x03
)
{
switch
(
pc
_
buf
[
desc_start
+
4
]
&
0x03
)
{
/* Clik! drive returns this instead of CAPACITY_CURRENT */
case
CAPACITY_UNFORMATTED
:
if
(
!
(
drive
->
atapi_flags
&
IDE_AFLAG_CLIK_DRIVE
))
...
...
@@ -464,7 +458,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
break
;
}
ide_debug_log
(
IDE_DBG_PROBE
,
"Descriptor 0 Code: %d"
,
pc
.
buf
[
desc_start
+
4
]
&
0x03
);
pc
_
buf
[
desc_start
+
4
]
&
0x03
);
}
/* Clik! disk does not support get_flexible_disk_page */
...
...
drivers/ide/ide-floppy_ioctl.c
View file @
8dcce408
...
...
@@ -47,15 +47,13 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive,
return
-
EINVAL
;
ide_floppy_create_read_capacity_cmd
(
pc
);
pc
->
buf
=
&
pc_buf
[
0
];
pc
->
buf_size
=
sizeof
(
pc_buf
);
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
))
{
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
,
pc_buf
,
pc
->
req_xfer
))
{
printk
(
KERN_ERR
"ide-floppy: Can't get floppy parameters
\n
"
);
return
-
EIO
;
}
header_len
=
pc
->
buf
[
3
];
header_len
=
pc
_
buf
[
3
];
desc_cnt
=
header_len
/
8
;
/* capacity descriptor of 8 bytes */
u_index
=
0
;
...
...
@@ -72,8 +70,8 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive,
if
(
u_index
>=
u_array_size
)
break
;
/* User-supplied buffer too small */
blocks
=
be32_to_cpup
((
__be32
*
)
&
pc
->
buf
[
desc_start
]);
length
=
be16_to_cpup
((
__be16
*
)
&
pc
->
buf
[
desc_start
+
6
]);
blocks
=
be32_to_cpup
((
__be32
*
)
&
pc
_
buf
[
desc_start
]);
length
=
be16_to_cpup
((
__be16
*
)
&
pc
_
buf
[
desc_start
+
6
]);
if
(
put_user
(
blocks
,
argp
))
return
-
EFAULT
;
...
...
@@ -94,40 +92,42 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive,
return
0
;
}
static
void
ide_floppy_create_format_unit_cmd
(
struct
ide_atapi_pc
*
pc
,
int
b
,
int
l
,
int
flags
)
static
void
ide_floppy_create_format_unit_cmd
(
struct
ide_atapi_pc
*
pc
,
u8
*
buf
,
int
b
,
int
l
,
int
flags
)
{
ide_init_pc
(
pc
);
pc
->
c
[
0
]
=
GPCMD_FORMAT_UNIT
;
pc
->
c
[
1
]
=
0x17
;
memset
(
pc
->
buf
,
0
,
12
);
pc
->
buf
[
1
]
=
0xA2
;
memset
(
buf
,
0
,
12
);
buf
[
1
]
=
0xA2
;
/* Default format list header, u8 1: FOV/DCRT/IMM bits set */
if
(
flags
&
1
)
/* Verify bit on... */
pc
->
buf
[
1
]
^=
0x20
;
/* ... turn off DCRT bit */
pc
->
buf
[
3
]
=
8
;
buf
[
1
]
^=
0x20
;
/* ... turn off DCRT bit */
buf
[
3
]
=
8
;
put_unaligned
(
cpu_to_be32
(
b
),
(
unsigned
int
*
)(
&
pc
->
buf
[
4
]));
put_unaligned
(
cpu_to_be32
(
l
),
(
unsigned
int
*
)(
&
pc
->
buf
[
8
]));
pc
->
buf_size
=
12
;
put_unaligned
(
cpu_to_be32
(
b
),
(
unsigned
int
*
)(
&
buf
[
4
]));
put_unaligned
(
cpu_to_be32
(
l
),
(
unsigned
int
*
)(
&
buf
[
8
]));
pc
->
req_xfer
=
12
;
pc
->
flags
|=
PC_FLAG_WRITING
;
}
static
int
ide_floppy_get_sfrp_bit
(
ide_drive_t
*
drive
,
struct
ide_atapi_pc
*
pc
)
{
struct
ide_disk_obj
*
floppy
=
drive
->
driver_data
;
u8
buf
[
20
];
drive
->
atapi_flags
&=
~
IDE_AFLAG_SRFP
;
ide_floppy_create_mode_sense_cmd
(
pc
,
IDEFLOPPY_CAPABILITIES_PAGE
);
pc
->
flags
|=
PC_FLAG_SUPPRESS_ERROR
;
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
))
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
,
buf
,
pc
->
req_xfer
))
return
1
;
if
(
pc
->
buf
[
8
+
2
]
&
0x40
)
if
(
buf
[
8
+
2
]
&
0x40
)
drive
->
atapi_flags
|=
IDE_AFLAG_SRFP
;
return
0
;
...
...
@@ -137,6 +137,7 @@ static int ide_floppy_format_unit(ide_drive_t *drive, struct ide_atapi_pc *pc,
int
__user
*
arg
)
{
struct
ide_disk_obj
*
floppy
=
drive
->
driver_data
;
u8
buf
[
12
];
int
blocks
,
length
,
flags
,
err
=
0
;
if
(
floppy
->
openers
>
1
)
{
...
...
@@ -170,9 +171,9 @@ static int ide_floppy_format_unit(ide_drive_t *drive, struct ide_atapi_pc *pc,
}
ide_floppy_get_sfrp_bit
(
drive
,
pc
);
ide_floppy_create_format_unit_cmd
(
pc
,
blocks
,
length
,
flags
);
ide_floppy_create_format_unit_cmd
(
pc
,
b
uf
,
b
locks
,
length
,
flags
);
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
))
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
,
buf
,
pc
->
req_xfer
))
err
=
-
EIO
;
out:
...
...
@@ -196,11 +197,13 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive,
int
__user
*
arg
)
{
struct
ide_disk_obj
*
floppy
=
drive
->
driver_data
;
u8
sense_buf
[
18
];
int
progress_indication
=
0x10000
;
if
(
drive
->
atapi_flags
&
IDE_AFLAG_SRFP
)
{
ide_create_request_sense_cmd
(
drive
,
pc
);
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
))
if
(
ide_queue_pc_tail
(
drive
,
floppy
->
disk
,
pc
,
sense_buf
,
pc
->
req_xfer
))
return
-
EIO
;
if
(
floppy
->
sense_key
==
2
&&
...
...
drivers/ide/ide-tape.c
View file @
8dcce408
This diff is collapsed.
Click to expand it.
include/linux/ide.h
View file @
8dcce408
...
...
@@ -331,11 +331,6 @@ enum {
PC_FLAG_WRITING
=
(
1
<<
6
),
};
/*
* With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
* This is used for several packet commands (not for READ/WRITE commands).
*/
#define IDE_PC_BUFFER_SIZE 64
#define ATAPI_WAIT_PC (60 * HZ)
struct
ide_atapi_pc
{
...
...
@@ -347,12 +342,6 @@ struct ide_atapi_pc {
/* bytes to transfer */
int
req_xfer
;
/* bytes actually transferred */
int
xferred
;
/* data buffer */
u8
*
buf
;
int
buf_size
;
/* the corresponding request */
struct
request
*
rq
;
...
...
@@ -363,8 +352,6 @@ struct ide_atapi_pc {
* those are more or less driver-specific and some of them are subject
* to change/removal later.
*/
u8
pc_buf
[
IDE_PC_BUFFER_SIZE
];
unsigned
long
timeout
;
};
...
...
@@ -1130,6 +1117,8 @@ void SELECT_MASK(ide_drive_t *, int);
u8
ide_read_error
(
ide_drive_t
*
);
void
ide_read_bcount_and_ireason
(
ide_drive_t
*
,
u16
*
,
u8
*
);
int
ide_check_ireason
(
ide_drive_t
*
,
struct
request
*
,
int
,
int
,
int
);
int
ide_check_atapi_device
(
ide_drive_t
*
,
const
char
*
);
void
ide_init_pc
(
struct
ide_atapi_pc
*
);
...
...
@@ -1154,7 +1143,8 @@ enum {
REQ_IDETAPE_WRITE
=
(
1
<<
3
),
};
int
ide_queue_pc_tail
(
ide_drive_t
*
,
struct
gendisk
*
,
struct
ide_atapi_pc
*
);
int
ide_queue_pc_tail
(
ide_drive_t
*
,
struct
gendisk
*
,
struct
ide_atapi_pc
*
,
void
*
,
unsigned
int
);
int
ide_do_test_unit_ready
(
ide_drive_t
*
,
struct
gendisk
*
);
int
ide_do_start_stop
(
ide_drive_t
*
,
struct
gendisk
*
,
int
);
...
...
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