1 |
1275 |
phoenix |
/*
|
2 |
|
|
* scsi_module.c Copyright (1994, 1995) Eric Youngdale.
|
3 |
|
|
*
|
4 |
|
|
* Support for loading low-level scsi drivers using the linux kernel loadable
|
5 |
|
|
* module interface.
|
6 |
|
|
*
|
7 |
|
|
* To use, the host adapter should first define and initialize the variable
|
8 |
|
|
* driver_template (datatype Scsi_Host_Template), and then include this file.
|
9 |
|
|
* This should also be wrapped in a #ifdef MODULE/#endif.
|
10 |
|
|
*
|
11 |
|
|
* The low -level driver must also define a release function which will
|
12 |
|
|
* free any irq assignments, release any dma channels, release any I/O
|
13 |
|
|
* address space that might be reserved, and otherwise clean up after itself.
|
14 |
|
|
* The idea is that the same driver should be able to be reloaded without
|
15 |
|
|
* any difficulty. This makes debugging new drivers easier, as you should
|
16 |
|
|
* be able to load the driver, test it, unload, modify and reload.
|
17 |
|
|
*
|
18 |
|
|
* One *very* important caveat. If the driver may need to do DMA on the
|
19 |
|
|
* ISA bus, you must have unchecked_isa_dma set in the device template,
|
20 |
|
|
* even if this might be changed during the detect routine. This is
|
21 |
|
|
* because the shpnt structure will be allocated in a special way so that
|
22 |
|
|
* it will be below the appropriate DMA limit - thus if your driver uses
|
23 |
|
|
* the hostdata field of shpnt, and the board must be able to access this
|
24 |
|
|
* via DMA, the shpnt structure must be in a DMA accessible region of
|
25 |
|
|
* memory. This comment would be relevant for something like the buslogic
|
26 |
|
|
* driver where there are many boards, only some of which do DMA onto the
|
27 |
|
|
* ISA bus. There is no convenient way of specifying whether the host
|
28 |
|
|
* needs to be in a ISA DMA accessible region of memory when you call
|
29 |
|
|
* scsi_register.
|
30 |
|
|
*/
|
31 |
|
|
|
32 |
|
|
#include <linux/module.h>
|
33 |
|
|
#include <linux/init.h>
|
34 |
|
|
|
35 |
|
|
static int __init init_this_scsi_driver(void)
|
36 |
|
|
{
|
37 |
|
|
driver_template.module = THIS_MODULE;
|
38 |
|
|
scsi_register_module(MODULE_SCSI_HA, &driver_template);
|
39 |
|
|
if (driver_template.present)
|
40 |
|
|
return 0;
|
41 |
|
|
|
42 |
|
|
scsi_unregister_module(MODULE_SCSI_HA, &driver_template);
|
43 |
|
|
return -ENODEV;
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
static void __exit exit_this_scsi_driver(void)
|
47 |
|
|
{
|
48 |
|
|
scsi_unregister_module(MODULE_SCSI_HA, &driver_template);
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
module_init(init_this_scsi_driver);
|
52 |
|
|
module_exit(exit_this_scsi_driver);
|
53 |
|
|
|
54 |
|
|
/*
|
55 |
|
|
* Overrides for Emacs so that we almost follow Linus's tabbing style.
|
56 |
|
|
* Emacs will notice this stuff at the end of the file and automatically
|
57 |
|
|
* adjust the settings for this buffer only. This must remain at the end
|
58 |
|
|
* of the file.
|
59 |
|
|
* ---------------------------------------------------------------------------
|
60 |
|
|
* Local variables:
|
61 |
|
|
* c-indent-level: 4
|
62 |
|
|
* c-brace-imaginary-offset: 0
|
63 |
|
|
* c-brace-offset: -4
|
64 |
|
|
* c-argdecl-indent: 4
|
65 |
|
|
* c-label-offset: -4
|
66 |
|
|
* c-continued-statement-offset: 4
|
67 |
|
|
* c-continued-brace-offset: 0
|
68 |
|
|
* indent-tabs-mode: nil
|
69 |
|
|
* tab-width: 8
|
70 |
|
|
* End:
|
71 |
|
|
*/
|