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
0098b69e
Commit
0098b69e
authored
Dec 17, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
http://linux-scsi.bkbits.net/scsi-for-linus-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
43d332b0
e5064e24
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
182 additions
and
133 deletions
+182
-133
drivers/scsi/hosts.c
drivers/scsi/hosts.c
+0
-7
drivers/scsi/osst.c
drivers/scsi/osst.c
+81
-104
drivers/scsi/scsi.c
drivers/scsi/scsi.c
+7
-0
drivers/scsi/scsi.h
drivers/scsi/scsi.h
+8
-0
drivers/scsi/sd.c
drivers/scsi/sd.c
+82
-22
include/scsi/scsi.h
include/scsi/scsi.h
+4
-0
No files found.
drivers/scsi/hosts.c
View file @
0098b69e
...
@@ -485,13 +485,6 @@ int scsi_register_host(Scsi_Host_Template *shost_tp)
...
@@ -485,13 +485,6 @@ int scsi_register_host(Scsi_Host_Template *shost_tp)
BUG_ON
(
!
shost_tp
->
detect
);
BUG_ON
(
!
shost_tp
->
detect
);
if
(
!
shost_tp
->
max_sectors
)
{
printk
(
KERN_WARNING
"scsi HBA driver %s didn't set max_sectors, "
"please fix the template
\n
"
,
shost_tp
->
name
);
shost_tp
->
max_sectors
=
1024
;
}
if
(
!
shost_tp
->
release
)
{
if
(
!
shost_tp
->
release
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"scsi HBA driver %s didn't set a release method, "
"scsi HBA driver %s didn't set a release method, "
...
...
drivers/scsi/osst.c
View file @
0098b69e
This diff is collapsed.
Click to expand it.
drivers/scsi/scsi.c
View file @
0098b69e
...
@@ -177,6 +177,13 @@ void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt)
...
@@ -177,6 +177,13 @@ void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt)
*/
*/
blk_queue_max_phys_segments
(
q
,
MAX_PHYS_SEGMENTS
);
blk_queue_max_phys_segments
(
q
,
MAX_PHYS_SEGMENTS
);
if
(
!
SHpnt
->
max_sectors
)
/* driver imposes no hard sector transfer limit.
* start at machine infinity initially */
SHpnt
->
max_sectors
=
SCSI_DEFAULT_MAX_SECTORS
;
/* FIXME: we should also adjust this limit later on
* after we know what the device capabilities are */
blk_queue_max_sectors
(
q
,
SHpnt
->
max_sectors
);
blk_queue_max_sectors
(
q
,
SHpnt
->
max_sectors
);
if
(
!
SHpnt
->
use_clustering
)
if
(
!
SHpnt
->
use_clustering
)
...
...
drivers/scsi/scsi.h
View file @
0098b69e
...
@@ -373,6 +373,14 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
...
@@ -373,6 +373,14 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
#define ASKED_FOR_SENSE 0x20
#define ASKED_FOR_SENSE 0x20
#define SYNC_RESET 0x40
#define SYNC_RESET 0x40
/*
* This specifies "machine infinity" for host templates which don't
* limit the transfer size. Note this limit represents an absolute
* maximum, and may be over the transfer limits allowed for individual
* devices (e.g. 256 for SCSI-1)
*/
#define SCSI_DEFAULT_MAX_SECTORS 1024
/*
/*
* This is the crap from the old error handling code. We have it in a special
* This is the crap from the old error handling code. We have it in a special
* place so that we can more easily delete it later on.
* place so that we can more easily delete it later on.
...
...
drivers/scsi/sd.c
View file @
0098b69e
...
@@ -172,7 +172,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
...
@@ -172,7 +172,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
**/
**/
static
int
sd_init_command
(
struct
scsi_cmnd
*
SCpnt
)
static
int
sd_init_command
(
struct
scsi_cmnd
*
SCpnt
)
{
{
int
this_count
,
timeout
;
unsigned
int
this_count
,
timeout
;
struct
gendisk
*
disk
;
struct
gendisk
*
disk
;
sector_t
block
;
sector_t
block
;
struct
scsi_device
*
sdp
=
SCpnt
->
device
;
struct
scsi_device
*
sdp
=
SCpnt
->
device
;
...
@@ -298,8 +298,23 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
...
@@ -298,8 +298,23 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
"writing"
:
"reading"
,
this_count
,
SCpnt
->
request
->
nr_sectors
));
"writing"
:
"reading"
,
this_count
,
SCpnt
->
request
->
nr_sectors
));
SCpnt
->
cmnd
[
1
]
=
0
;
SCpnt
->
cmnd
[
1
]
=
0
;
if
(((
this_count
>
0xff
)
||
(
block
>
0x1fffff
))
||
SCpnt
->
device
->
ten
)
{
if
(
block
>
0xffffffff
)
{
SCpnt
->
cmnd
[
0
]
+=
READ_16
-
READ_6
;
SCpnt
->
cmnd
[
2
]
=
(
unsigned
char
)
(
block
>>
56
)
&
0xff
;
SCpnt
->
cmnd
[
3
]
=
(
unsigned
char
)
(
block
>>
48
)
&
0xff
;
SCpnt
->
cmnd
[
4
]
=
(
unsigned
char
)
(
block
>>
40
)
&
0xff
;
SCpnt
->
cmnd
[
5
]
=
(
unsigned
char
)
(
block
>>
32
)
&
0xff
;
SCpnt
->
cmnd
[
6
]
=
(
unsigned
char
)
(
block
>>
24
)
&
0xff
;
SCpnt
->
cmnd
[
7
]
=
(
unsigned
char
)
(
block
>>
16
)
&
0xff
;
SCpnt
->
cmnd
[
8
]
=
(
unsigned
char
)
(
block
>>
8
)
&
0xff
;
SCpnt
->
cmnd
[
9
]
=
(
unsigned
char
)
block
&
0xff
;
SCpnt
->
cmnd
[
10
]
=
(
unsigned
char
)
(
this_count
>>
24
)
&
0xff
;
SCpnt
->
cmnd
[
11
]
=
(
unsigned
char
)
(
this_count
>>
16
)
&
0xff
;
SCpnt
->
cmnd
[
12
]
=
(
unsigned
char
)
(
this_count
>>
8
)
&
0xff
;
SCpnt
->
cmnd
[
13
]
=
(
unsigned
char
)
this_count
&
0xff
;
SCpnt
->
cmnd
[
14
]
=
SCpnt
->
cmnd
[
15
]
=
0
;
}
else
if
(((
this_count
>
0xff
)
||
(
block
>
0x1fffff
))
||
SCpnt
->
device
->
ten
)
{
if
(
this_count
>
0xffff
)
if
(
this_count
>
0xffff
)
this_count
=
0xffff
;
this_count
=
0xffff
;
...
@@ -904,24 +919,34 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
...
@@ -904,24 +919,34 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
static
void
static
void
sd_read_capacity
(
struct
scsi_disk
*
sdkp
,
char
*
diskname
,
sd_read_capacity
(
struct
scsi_disk
*
sdkp
,
char
*
diskname
,
struct
scsi_request
*
SRpnt
,
unsigned
char
*
buffer
)
{
struct
scsi_request
*
SRpnt
,
unsigned
char
*
buffer
)
{
unsigned
char
cmd
[
1
0
];
unsigned
char
cmd
[
1
6
];
struct
scsi_device
*
sdp
=
sdkp
->
device
;
struct
scsi_device
*
sdp
=
sdkp
->
device
;
int
the_result
,
retries
;
int
the_result
,
retries
;
int
sector_size
;
int
sector_size
=
0
;
int
longrc
=
0
;
repeat:
retries
=
3
;
retries
=
3
;
do
{
do
{
cmd
[
0
]
=
READ_CAPACITY
;
if
(
longrc
)
{
memset
((
void
*
)
&
cmd
[
1
],
0
,
9
);
memset
((
void
*
)
cmd
,
0
,
16
);
memset
((
void
*
)
buffer
,
0
,
8
);
cmd
[
0
]
=
SERVICE_ACTION_IN
;
cmd
[
1
]
=
0x10
;
/* READ CAPACITY (16) */
cmd
[
13
]
=
12
;
memset
((
void
*
)
buffer
,
0
,
12
);
}
else
{
cmd
[
0
]
=
READ_CAPACITY
;
memset
((
void
*
)
&
cmd
[
1
],
0
,
9
);
memset
((
void
*
)
buffer
,
0
,
8
);
}
SRpnt
->
sr_cmd_len
=
0
;
SRpnt
->
sr_cmd_len
=
0
;
SRpnt
->
sr_sense_buffer
[
0
]
=
0
;
SRpnt
->
sr_sense_buffer
[
0
]
=
0
;
SRpnt
->
sr_sense_buffer
[
2
]
=
0
;
SRpnt
->
sr_sense_buffer
[
2
]
=
0
;
SRpnt
->
sr_data_direction
=
SCSI_DATA_READ
;
SRpnt
->
sr_data_direction
=
SCSI_DATA_READ
;
scsi_wait_req
(
SRpnt
,
(
void
*
)
cmd
,
(
void
*
)
buffer
,
scsi_wait_req
(
SRpnt
,
(
void
*
)
cmd
,
(
void
*
)
buffer
,
8
,
SD_TIMEOUT
,
SD_MAX_RETRIES
);
longrc
?
12
:
8
,
SD_TIMEOUT
,
SD_MAX_RETRIES
);
if
(
media_not_present
(
sdkp
,
SRpnt
))
if
(
media_not_present
(
sdkp
,
SRpnt
))
return
;
return
;
...
@@ -931,7 +956,7 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
...
@@ -931,7 +956,7 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
}
while
(
the_result
&&
retries
);
}
while
(
the_result
&&
retries
);
if
(
the_result
)
{
if
(
the_result
&&
!
longrc
)
{
printk
(
KERN_NOTICE
"%s : READ CAPACITY failed.
\n
"
printk
(
KERN_NOTICE
"%s : READ CAPACITY failed.
\n
"
"%s : status=%x, message=%02x, host=%d, driver=%02x
\n
"
,
"%s : status=%x, message=%02x, host=%d, driver=%02x
\n
"
,
diskname
,
diskname
,
diskname
,
diskname
,
...
@@ -957,16 +982,51 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
...
@@ -957,16 +982,51 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
sdkp
->
capacity
=
0x200000
;
/* 1 GB - random */
sdkp
->
capacity
=
0x200000
;
/* 1 GB - random */
return
;
return
;
}
}
else
if
(
the_result
&&
longrc
)
{
/* READ CAPACITY(16) has been failed */
sdkp
->
capacity
=
1
+
(((
sector_t
)
buffer
[
0
]
<<
24
)
|
printk
(
KERN_NOTICE
"%s : READ CAPACITY(16) failed.
\n
"
(
buffer
[
1
]
<<
16
)
|
"%s : status=%x, message=%02x, host=%d, driver=%02x
\n
"
,
(
buffer
[
2
]
<<
8
)
|
diskname
,
diskname
,
buffer
[
3
]);
status_byte
(
the_result
),
msg_byte
(
the_result
),
sector_size
=
(
buffer
[
4
]
<<
24
)
|
host_byte
(
the_result
),
(
buffer
[
5
]
<<
16
)
|
(
buffer
[
6
]
<<
8
)
|
buffer
[
7
];
driver_byte
(
the_result
));
printk
(
KERN_NOTICE
"%s : use 0xffffffff as device size
\n
"
,
diskname
);
sdkp
->
capacity
=
1
+
(
sector_t
)
0xffffffff
;
goto
got_data
;
}
if
(
!
longrc
)
{
sector_size
=
(
buffer
[
4
]
<<
24
)
|
(
buffer
[
5
]
<<
16
)
|
(
buffer
[
6
]
<<
8
)
|
buffer
[
7
];
if
(
buffer
[
0
]
==
0xff
&&
buffer
[
1
]
==
0xff
&&
buffer
[
2
]
==
0xff
&&
buffer
[
3
]
==
0xff
)
{
printk
(
KERN_NOTICE
"%s : very big device. try to use"
" READ CAPACITY(16).
\n
"
,
diskname
);
longrc
=
1
;
goto
repeat
;
}
sdkp
->
capacity
=
1
+
(((
sector_t
)
buffer
[
0
]
<<
24
)
|
(
buffer
[
1
]
<<
16
)
|
(
buffer
[
2
]
<<
8
)
|
buffer
[
3
]);
}
else
{
sdkp
->
capacity
=
1
+
(((
sector_t
)
buffer
[
0
]
<<
56
)
|
((
sector_t
)
buffer
[
1
]
<<
48
)
|
((
sector_t
)
buffer
[
2
]
<<
40
)
|
((
sector_t
)
buffer
[
3
]
<<
32
)
|
((
sector_t
)
buffer
[
4
]
<<
24
)
|
((
sector_t
)
buffer
[
5
]
<<
16
)
|
((
sector_t
)
buffer
[
6
]
<<
8
)
|
(
sector_t
)
buffer
[
7
]);
sector_size
=
(
buffer
[
8
]
<<
24
)
|
(
buffer
[
9
]
<<
16
)
|
(
buffer
[
10
]
<<
8
)
|
buffer
[
11
];
}
got_data:
if
(
sector_size
==
0
)
{
if
(
sector_size
==
0
)
{
sector_size
=
512
;
sector_size
=
512
;
printk
(
KERN_NOTICE
"%s : sector size 0 reported, "
printk
(
KERN_NOTICE
"%s : sector size 0 reported, "
...
@@ -1139,10 +1199,10 @@ sd_init_onedisk(struct scsi_disk * sdkp, struct gendisk *disk)
...
@@ -1139,10 +1199,10 @@ sd_init_onedisk(struct scsi_disk * sdkp, struct gendisk *disk)
if
(
sdkp
->
media_present
)
if
(
sdkp
->
media_present
)
sd_read_capacity
(
sdkp
,
disk
->
disk_name
,
SRpnt
,
buffer
);
sd_read_capacity
(
sdkp
,
disk
->
disk_name
,
SRpnt
,
buffer
);
if
(
sdp
->
removable
&&
sdkp
->
media_present
)
if
(
sdp
->
removable
&&
sdkp
->
media_present
)
sd_read_write_protect_flag
(
sdkp
,
disk
->
disk_name
,
SRpnt
,
buffer
);
sd_read_write_protect_flag
(
sdkp
,
disk
->
disk_name
,
SRpnt
,
buffer
);
SRpnt
->
sr_device
->
ten
=
1
;
SRpnt
->
sr_device
->
ten
=
1
;
SRpnt
->
sr_device
->
remap
=
1
;
SRpnt
->
sr_device
->
remap
=
1
;
...
...
include/scsi/scsi.h
View file @
0098b69e
...
@@ -96,6 +96,10 @@ extern const unsigned char scsi_command_size[8];
...
@@ -96,6 +96,10 @@ extern const unsigned char scsi_command_size[8];
#define READ_ELEMENT_STATUS 0xb8
#define READ_ELEMENT_STATUS 0xb8
#define SEND_VOLUME_TAG 0xb6
#define SEND_VOLUME_TAG 0xb6
#define WRITE_LONG_2 0xea
#define WRITE_LONG_2 0xea
#define READ_16 0x88
#define WRITE_16 0x8a
#define SERVICE_ACTION_IN 0x9e
/*
/*
* Status codes
* Status codes
...
...
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