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
57e34bbb
Commit
57e34bbb
authored
Oct 27, 2002
by
Alan Cox
Committed by
Linus Torvalds
Oct 27, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] nsp_cs update from maintainer
parent
515a6f24
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
722 additions
and
291 deletions
+722
-291
drivers/scsi/pcmcia/nsp_cs.c
drivers/scsi/pcmcia/nsp_cs.c
+556
-259
drivers/scsi/pcmcia/nsp_cs.h
drivers/scsi/pcmcia/nsp_cs.h
+53
-24
drivers/scsi/pcmcia/nsp_debug.c
drivers/scsi/pcmcia/nsp_debug.c
+11
-4
drivers/scsi/pcmcia/nsp_io.h
drivers/scsi/pcmcia/nsp_io.h
+100
-2
drivers/scsi/pcmcia/nsp_message.c
drivers/scsi/pcmcia/nsp_message.c
+2
-2
No files found.
drivers/scsi/pcmcia/nsp_cs.c
View file @
57e34bbb
This diff is collapsed.
Click to expand it.
drivers/scsi/pcmcia/nsp_cs.h
View file @
57e34bbb
...
...
@@ -10,13 +10,13 @@
=========================================================*/
/* $Id: nsp_cs.h,v 1.
27 2001/09/10 10:31:13
elca Exp $ */
/* $Id: nsp_cs.h,v 1.
3 2002/10/10 11:07:52
elca Exp $ */
#ifndef __nsp_cs__
#define __nsp_cs__
/* for debugging */
/
*#define PCMCIA_DEBUG 9*/
/
/#define PCMCIA_DEBUG 9
/*
#define static
...
...
@@ -27,11 +27,11 @@
* Some useful macros...
*/
#define Number(arr) ((int) (sizeof(arr) / sizeof(arr[0])))
#define BIT(x) (1
<<
(x))
#define BIT(x) (1
L <<
(x))
#define MIN(a,b) ((a) > (b) ? (b) : (a))
/* SCSI initiator must be 7 */
#define
SCSI
_INITIATOR_ID 7
/* SCSI initiator must be
ID
7 */
#define
NSP
_INITIATOR_ID 7
#define NSP_SELTIMEOUT 200
...
...
@@ -73,6 +73,7 @@
#define CLOCKDIV 0x11
# define CLOCK_40M 0x02
# define CLOCK_20M 0x01
# define FAST_20 BIT(2)
#define TERMPWRCTRL 0x13
# define POWER_ON BIT(0)
...
...
@@ -133,6 +134,9 @@
# define REQ_COUNTER_CLEAR BIT(2)
# define HOST_COUNTER_CLEAR BIT(3)
# define READ_SOURCE 0x30
# define ACK_COUNTER (0)
# define REQ_COUNTER (BIT(4))
# define HOST_COUNTER (BIT(5))
#define TRANSFERCOUNT 0x1E
/* R */
...
...
@@ -222,11 +226,14 @@ typedef struct _sync_data {
unsigned
char
AckWidth
;
}
sync_data
;
typedef
struct
_nsp_data
{
typedef
struct
_nsp_
hw_
data
{
unsigned
int
BaseAddress
;
unsigned
int
NumAddress
;
unsigned
int
IrqNumber
;
unsigned
long
MmioAddress
;
#define NSP_MMIO_OFFSET 0x0800
unsigned
char
ScsiClockDiv
;
unsigned
char
TransferMode
;
...
...
@@ -238,9 +245,9 @@ typedef struct _nsp_data {
int
FifoCount
;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
int
Residual
;
#define RESID
data->Residual
#define RESID
(data->Residual)
#else
#define RESID
SCpnt->resid
#define RESID
(SCpnt->resid)
#endif
#define MSGBUF_SIZE 20
...
...
@@ -248,10 +255,20 @@ typedef struct _nsp_data {
int
MsgLen
;
#define N_TARGET 8
#define N_LUN 8
sync_data
Sync
[
N_TARGET
][
N_LUN
];
sync_data
Sync
[
N_TARGET
];
char
nspinfo
[
110
];
/* description */
spinlock_t
Lock
;
}
nsp_hw_data
;
/* scatter-gather table */
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2))
# define BUFFER_ADDR ((char *)((unsigned int)(SCpnt->SCp.buffer->page) + SCpnt->SCp.buffer->offset))
#else
# define BUFFER_ADDR SCpnt->SCp.buffer->address
#endif
static
void
nsp_cs_release
(
u_long
arg
);
static
int
nsp_cs_event
(
event_t
event
,
int
priority
,
event_callback_args_t
*
args
);
...
...
@@ -263,14 +280,16 @@ static void nsp_start_timer(Scsi_Cmnd *SCpnt, nsp_hw_data *data, int time);
static
int
nsp_detect
(
Scsi_Host_Template
*
);
static
int
nsp_release
(
struct
Scsi_Host
*
shpnt
);
static
const
char
*
nsp_info
(
struct
Scsi_Host
*
shpnt
);
static
const
char
*
nsp_info
(
struct
Scsi_Host
*
shpnt
);
static
int
nsp_proc_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
int
hostno
,
int
inout
);
static
int
nsp_queuecommand
(
Scsi_Cmnd
*
,
void
(
*
done
)(
Scsi_Cmnd
*
));
static
int
nsp_abort
(
Scsi_Cmnd
*
);
static
int
nsp_reset
(
Scsi_Cmnd
*
,
unsigned
int
);
static
int
nsp_eh_abort
(
Scsi_Cmnd
*
SCpnt
);
static
int
nsp_eh_device_reset
(
Scsi_Cmnd
*
SCpnt
);
/*static int nsp_eh_abort(Scsi_Cmnd * SCpnt);*/
/*static int nsp_eh_device_reset(Scsi_Cmnd *SCpnt);*/
static
int
nsp_eh_bus_reset
(
Scsi_Cmnd
*
SCpnt
);
static
int
nsp_eh_host_reset
(
Scsi_Cmnd
*
SCpnt
);
...
...
@@ -294,17 +313,19 @@ static void show_message(nsp_hw_data *data);
* SCSI phase
*/
enum
_scsi_phase
{
PH_UNDETERMINED
,
PH_ARBSTART
,
PH_SELSTART
,
PH_SELECTED
,
PH_COMMAND
,
PH_DATA
,
PH_STATUS
,
PH_MSG_IN
,
PH_MSG_OUT
,
PH_DISCONNECT
,
PH_RESELECT
PH_UNDETERMINED
,
PH_ARBSTART
,
PH_SELSTART
,
PH_SELECTED
,
PH_COMMAND
,
PH_DATA
,
PH_STATUS
,
PH_MSG_IN
,
PH_MSG_OUT
,
PH_DISCONNECT
,
PH_RESELECT
,
PH_ABORT
,
PH_RESET
};
enum
_data_in_out
{
...
...
@@ -313,11 +334,19 @@ enum _data_in_out {
IO_OUT
};
enum
_burst_mode
{
BURST_IO8
=
0
,
BURST_IO32
,
BURST_MEM32
};
/* SCSI messaage */
#define MSG_COMMAND_COMPLETE 0x00
#define MSG_EXTENDED 0x01
#define MSG_ABORT 0x06
#define MSG_NO_OPERATION 0x08
#define MSG_BUS_DEVICE_RESET 0x0c
#define MSG_EXT_SDTR 0x01
...
...
drivers/scsi/pcmcia/nsp_debug.c
View file @
57e34bbb
...
...
@@ -6,7 +6,7 @@
the GNU General Public License.
=========================================================================*/
/* $Id: nsp_debug.c,v 1.
8 2001/09/07 04:32:28 elca
Exp $ */
/* $Id: nsp_debug.c,v 1.
2 2002/09/20 04:06:58 gotom
Exp $ */
/*
* Show the command data of a command
...
...
@@ -87,14 +87,21 @@ static void print_opcodek(unsigned char opcode)
static
void
print_commandk
(
unsigned
char
*
command
)
{
int
i
,
s
;
int
i
,
s
;
printk
(
KERN_DEBUG
);
print_opcodek
(
command
[
0
]);
/*printk(KERN_DEBUG __FUNCTION__ " ");*/
for
(
i
=
1
,
s
=
COMMAND_SIZE
(
command
[
0
]);
i
<
s
;
++
i
)
{
if
((
command
[
0
]
>>
5
)
==
6
||
(
command
[
0
]
>>
5
)
==
7
)
{
s
=
12
;
/* vender specific */
}
else
{
s
=
COMMAND_SIZE
(
command
[
0
]);
}
for
(
i
=
1
;
i
<
s
;
++
i
)
{
printk
(
"%02x "
,
command
[
i
]);
}
switch
(
COMMAND_SIZE
(
command
[
0
]))
{
switch
(
s
)
{
case
6
:
printk
(
"LBA=%d len=%d"
,
(((
unsigned
int
)
command
[
1
]
&
0x0f
)
<<
16
)
|
...
...
drivers/scsi/pcmcia/nsp_io.h
View file @
57e34bbb
...
...
@@ -7,7 +7,7 @@
*/
/* $Id: nsp_io.h,v 1.
9 2001/09/07 04:32:42 elca
Exp $ */
/* $Id: nsp_io.h,v 1.
2 2002/09/20 04:06:58 gotom
Exp $ */
#ifndef __NSP_IO_H__
#define __NSP_IO_H__
...
...
@@ -76,7 +76,7 @@ static inline void nsp_fifo8_read(unsigned int base,
void
*
buf
,
unsigned
long
count
)
{
/
/DEBUG(0, __FUNCTION__ "() buf=0x%p, count=0x%lx\n", buf, count);
/
*DEBUG(0, __FUNCTION__ "() buf=0x%p, count=0x%lx\n", buf, count);*/
nsp_multi_read_1
(
base
,
FIFODATA
,
buf
,
count
);
}
...
...
@@ -172,5 +172,103 @@ static inline void nsp_fifo32_write(unsigned int base,
nsp_multi_write_4
(
base
,
FIFODATA
,
buf
,
count
);
}
/*====================================================================*/
static
inline
void
nsp_mmio_write
(
unsigned
long
base
,
unsigned
int
index
,
unsigned
char
val
)
{
unsigned
char
*
ptr
=
(
unsigned
char
*
)(
base
+
NSP_MMIO_OFFSET
+
index
);
writeb
(
val
,
ptr
);
}
static
inline
unsigned
char
nsp_mmio_read
(
unsigned
long
base
,
unsigned
int
index
)
{
unsigned
char
*
ptr
=
(
unsigned
char
*
)(
base
+
NSP_MMIO_OFFSET
+
index
);
return
readb
(
ptr
);
}
/*-----------*/
static
inline
unsigned
char
nsp_mmio_index_read
(
unsigned
long
base
,
unsigned
int
reg
)
{
unsigned
char
*
index_ptr
=
(
unsigned
char
*
)(
base
+
NSP_MMIO_OFFSET
+
INDEXREG
);
unsigned
char
*
data_ptr
=
(
unsigned
char
*
)(
base
+
NSP_MMIO_OFFSET
+
DATAREG
);
writeb
((
unsigned
char
)
reg
,
index_ptr
);
return
readb
(
data_ptr
);
}
static
inline
void
nsp_mmio_index_write
(
unsigned
long
base
,
unsigned
int
reg
,
unsigned
char
val
)
{
unsigned
char
*
index_ptr
=
(
unsigned
char
*
)(
base
+
NSP_MMIO_OFFSET
+
INDEXREG
);
unsigned
char
*
data_ptr
=
(
unsigned
char
*
)(
base
+
NSP_MMIO_OFFSET
+
DATAREG
);
writeb
((
unsigned
char
)
reg
,
index_ptr
);
writeb
(
val
,
data_ptr
);
}
/* read 32bit FIFO */
static
inline
void
nsp_mmio_multi_read_4
(
unsigned
long
base
,
unsigned
int
Register
,
void
*
buf
,
unsigned
long
count
)
{
unsigned
long
*
ptr
=
(
unsigned
long
*
)(
base
+
Register
);
unsigned
long
*
tmp
=
(
unsigned
long
*
)
buf
;
int
i
;
//printk("base 0x%0lx ptr 0x%p\n",base,ptr);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
*
tmp
=
readl
(
ptr
);
//printk("<%d,%p,%p,%lx>", i, ptr, tmp, *tmp);
tmp
++
;
}
}
static
inline
void
nsp_mmio_fifo32_read
(
unsigned
int
base
,
void
*
buf
,
unsigned
long
count
)
{
//DEBUG(0, __FUNCTION__ "() buf=0x%p, count=0x%lx*4\n", buf, count);
nsp_mmio_multi_read_4
(
base
,
FIFODATA
,
buf
,
count
);
}
static
inline
void
nsp_mmio_multi_write_4
(
unsigned
long
base
,
unsigned
int
Register
,
void
*
buf
,
unsigned
long
count
)
{
unsigned
long
*
ptr
=
(
unsigned
long
*
)(
base
+
Register
);
unsigned
long
*
tmp
=
(
unsigned
long
*
)
buf
;
int
i
;
//printk("base 0x%0lx ptr 0x%p\n",base,ptr);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
writel
(
*
tmp
,
ptr
);
//printk("<%d,%p,%p,%lx>", i, ptr, tmp, *tmp);
tmp
++
;
}
}
static
inline
void
nsp_mmio_fifo32_write
(
unsigned
int
base
,
void
*
buf
,
unsigned
long
count
)
{
//DEBUG(0, __FUNCTION__ "() buf=0x%p, count=0x%lx*4\n", buf, count);
nsp_mmio_multi_write_4
(
base
,
FIFODATA
,
buf
,
count
);
}
#endif
/* end */
drivers/scsi/pcmcia/nsp_message.c
View file @
57e34bbb
...
...
@@ -6,7 +6,7 @@
the GNU General Public License.
*/
/* $Id: nsp_message.c,v 1.
7 2001/09/07 04:33:01 elca
Exp $ */
/* $Id: nsp_message.c,v 1.
2 2002/09/20 04:06:58 gotom
Exp $ */
static
void
nsp_message_in
(
Scsi_Cmnd
*
SCpnt
,
nsp_hw_data
*
data
)
{
...
...
@@ -64,7 +64,7 @@ static void nsp_message_out(Scsi_Cmnd *SCpnt, nsp_hw_data *data)
DEBUG
(
0
,
" msgout loop
\n
"
);
do
{
if
(
nsp_xfer
(
SCpnt
,
data
,
BUSPHASE_MESSAGE_OUT
))
{
printk
(
KERN_DEBUG
"
"
__FUNCTION__
" msgout: xfer short
\n
"
);
printk
(
KERN_DEBUG
"
%s msgout: xfer short
\n
"
,
__FUNCTION__
);
}
/* catch a next signal */
...
...
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