1 |
1275 |
phoenix |
/*
|
2 |
|
|
* linux/drivers/message/fusion/isense.c
|
3 |
|
|
* Little linux driver / shim that interfaces with the Fusion MPT
|
4 |
|
|
* Linux base driver to provide english readable strings in SCSI
|
5 |
|
|
* Error Report logging output. This module implements SCSI-3
|
6 |
|
|
* Opcode lookup and a sorted table of SCSI-3 ASC/ASCQ strings.
|
7 |
|
|
*
|
8 |
|
|
* Copyright (c) 1991-2002 Steven J. Ralston
|
9 |
|
|
* Written By: Steven J. Ralston
|
10 |
|
|
* (yes I wrote some of the orig. code back in 1991!)
|
11 |
|
|
* (mailto:sjralston1@netscape.net)
|
12 |
|
|
* (mailto:mpt_linux_developer@lsil.com)
|
13 |
|
|
*
|
14 |
|
|
* $Id: isense.c,v 1.1.1.1 2004-04-15 02:27:32 phoenix Exp $
|
15 |
|
|
*/
|
16 |
|
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
17 |
|
|
/*
|
18 |
|
|
This program is free software; you can redistribute it and/or modify
|
19 |
|
|
it under the terms of the GNU General Public License as published by
|
20 |
|
|
the Free Software Foundation; version 2 of the License.
|
21 |
|
|
|
22 |
|
|
This program is distributed in the hope that it will be useful,
|
23 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
|
|
GNU General Public License for more details.
|
26 |
|
|
|
27 |
|
|
NO WARRANTY
|
28 |
|
|
THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
|
29 |
|
|
CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
|
30 |
|
|
LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
|
31 |
|
|
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
|
32 |
|
|
solely responsible for determining the appropriateness of using and
|
33 |
|
|
distributing the Program and assumes all risks associated with its
|
34 |
|
|
exercise of rights under this Agreement, including but not limited to
|
35 |
|
|
the risks and costs of program errors, damage to or loss of data,
|
36 |
|
|
programs or equipment, and unavailability or interruption of operations.
|
37 |
|
|
|
38 |
|
|
DISCLAIMER OF LIABILITY
|
39 |
|
|
NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
|
40 |
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
41 |
|
|
DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
|
42 |
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
43 |
|
|
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
44 |
|
|
USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
|
45 |
|
|
HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
|
46 |
|
|
|
47 |
|
|
You should have received a copy of the GNU General Public License
|
48 |
|
|
along with this program; if not, write to the Free Software
|
49 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
50 |
|
|
*/
|
51 |
|
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
52 |
|
|
|
53 |
|
|
#include <linux/version.h>
|
54 |
|
|
#include <linux/kernel.h>
|
55 |
|
|
#include <linux/module.h>
|
56 |
|
|
#include <linux/errno.h>
|
57 |
|
|
#include <linux/init.h>
|
58 |
|
|
#include <asm/io.h>
|
59 |
|
|
#if defined (__sparc__)
|
60 |
|
|
#include <linux/timer.h>
|
61 |
|
|
#endif
|
62 |
|
|
|
63 |
|
|
/* Hmmm, avoid undefined spinlock_t on lk-2.2.14-5.0 */
|
64 |
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
|
65 |
|
|
#include <asm/spinlock.h>
|
66 |
|
|
#endif
|
67 |
|
|
|
68 |
|
|
#define MODULEAUTHOR "Steven J. Ralston"
|
69 |
|
|
#define COPYRIGHT "Copyright (c) 2001-2002 " MODULEAUTHOR
|
70 |
|
|
#include "mptbase.h"
|
71 |
|
|
|
72 |
|
|
#include "isense.h"
|
73 |
|
|
|
74 |
|
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
75 |
|
|
/*
|
76 |
|
|
* Private data...
|
77 |
|
|
*/
|
78 |
|
|
|
79 |
|
|
/*
|
80 |
|
|
* YIKES! I don't usually #include C source files, but..
|
81 |
|
|
* The following #include's pulls in our needed ASCQ_Table[] array,
|
82 |
|
|
* ASCQ_TableSz integer, and ScsiOpcodeString[] array!
|
83 |
|
|
*/
|
84 |
|
|
#include "ascq_tbl.c"
|
85 |
|
|
#include "scsiops.c"
|
86 |
|
|
|
87 |
|
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
88 |
|
|
#define my_NAME "SCSI-3 Opcodes & ASC/ASCQ Strings"
|
89 |
|
|
#define my_VERSION MPT_LINUX_VERSION_COMMON
|
90 |
|
|
#define MYNAM "isense"
|
91 |
|
|
|
92 |
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62)
|
93 |
|
|
EXPORT_NO_SYMBOLS;
|
94 |
|
|
#endif
|
95 |
|
|
MODULE_AUTHOR(MODULEAUTHOR);
|
96 |
|
|
MODULE_DESCRIPTION(my_NAME);
|
97 |
|
|
MODULE_LICENSE("GPL");
|
98 |
|
|
|
99 |
|
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
100 |
|
|
int __init isense_init(void)
|
101 |
|
|
{
|
102 |
|
|
show_mptmod_ver(my_NAME, my_VERSION);
|
103 |
|
|
|
104 |
|
|
/*
|
105 |
|
|
* Install our handler
|
106 |
|
|
*/
|
107 |
|
|
if (mpt_register_ascqops_strings(&ASCQ_Table[0], ASCQ_TableSize, ScsiOpcodeString) != 1)
|
108 |
|
|
{
|
109 |
|
|
printk(KERN_ERR MYNAM ": ERROR: Can't register with Fusion MPT base driver!\n");
|
110 |
|
|
return -EBUSY;
|
111 |
|
|
}
|
112 |
|
|
printk(KERN_INFO MYNAM ": Registered SCSI-3 Opcodes & ASC/ASCQ Strings\n");
|
113 |
|
|
return 0;
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
118 |
|
|
static void isense_exit(void)
|
119 |
|
|
{
|
120 |
|
|
#ifdef MODULE
|
121 |
|
|
mpt_deregister_ascqops_strings();
|
122 |
|
|
#endif
|
123 |
|
|
printk(KERN_INFO MYNAM ": Deregistered SCSI-3 Opcodes & ASC/ASCQ Strings\n");
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
module_init(isense_init);
|
127 |
|
|
module_exit(isense_exit);
|
128 |
|
|
|
129 |
|
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
130 |
|
|
|