VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / message / fusion / isense.c
1 /*
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-2004 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.33 2002/02/27 18:44:19 sralston 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
60 #define MODULEAUTHOR "Steven J. Ralston"
61 #define COPYRIGHT "Copyright (c) 2001-2004 " MODULEAUTHOR
62 #include "mptbase.h"
63
64 #include "isense.h"
65
66 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
67 /*
68  *  Private data...
69  */
70
71 /*
72  *  YIKES!  I don't usually #include C source files, but..
73  *  The following #include's pulls in our needed ASCQ_Table[] array,
74  *  ASCQ_TableSz integer, and ScsiOpcodeString[] array!
75  */
76 #include "ascq_tbl.c"
77 #include "scsiops.c"
78
79 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
80 #define my_NAME         "SCSI-3 Opcodes & ASC/ASCQ Strings"
81 #define my_VERSION      MPT_LINUX_VERSION_COMMON
82 #define MYNAM           "isense"
83
84 MODULE_AUTHOR(MODULEAUTHOR);
85 MODULE_DESCRIPTION(my_NAME);
86 MODULE_LICENSE("GPL");
87
88 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
89 int __init isense_init(void)
90 {
91         show_mptmod_ver(my_NAME, my_VERSION);
92
93         /*
94          *  Install our handler
95          */
96         if (mpt_register_ascqops_strings(&ASCQ_Table[0], ASCQ_TableSize, ScsiOpcodeString) != 1)
97         {
98                 printk(KERN_ERR MYNAM ": ERROR: Can't register with Fusion MPT base driver!\n");
99                 return -EBUSY;
100         }
101         printk(KERN_INFO MYNAM ": Registered SCSI-3 Opcodes & ASC/ASCQ Strings\n");
102         return 0;
103 }
104
105
106 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
107 static void isense_exit(void)
108 {
109 #ifdef MODULE
110         mpt_deregister_ascqops_strings();
111 #endif
112         printk(KERN_INFO MYNAM ": Deregistered SCSI-3 Opcodes & ASC/ASCQ Strings\n");
113 }
114
115 module_init(isense_init);
116 module_exit(isense_exit);
117
118 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
119