Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v2.6.14-rc2 110 lines 2.8 kB view raw
1// ip2.c 2// This is a dummy module to make the firmware available when needed 3// and allows it to be unloaded when not. Rumor is the __initdata 4// macro doesn't always works on all platforms so we use this kludge. 5// If not compiled as a module it just makes fip_firm avaliable then 6// __initdata should work as advertized 7// 8 9#include <linux/module.h> 10#include <linux/version.h> 11#include <linux/init.h> 12#include <linux/wait.h> 13 14#ifndef __init 15#define __init 16#endif 17#ifndef __initfunc 18#define __initfunc(a) a 19#endif 20#ifndef __initdata 21#define __initdata 22#endif 23 24#include "./ip2/ip2types.h" 25#include "./ip2/fip_firm.h" // the meat 26 27int 28ip2_loadmain(int *, int *, unsigned char *, int ); // ref into ip2main.c 29 30/* Note: Add compiled in defaults to these arrays, not to the structure 31 in ip2/ip2.h any longer. That structure WILL get overridden 32 by these values, or command line values, or insmod values!!! =mhw= 33*/ 34static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 }; 35static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 }; 36 37static int poll_only = 0; 38 39MODULE_AUTHOR("Doug McNash"); 40MODULE_DESCRIPTION("Computone IntelliPort Plus Driver"); 41module_param_array(irq, int, NULL, 0); 42MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards"); 43module_param_array(io, int, NULL, 0); 44MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards"); 45module_param(poll_only, bool, 0); 46MODULE_PARM_DESC(poll_only,"Do not use card interrupts"); 47 48 49static int __init ip2_init(void) 50{ 51 if( poll_only ) { 52 /* Hard lock the interrupts to zero */ 53 irq[0] = irq[1] = irq[2] = irq[3] = 0; 54 } 55 56 return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm)); 57} 58module_init(ip2_init); 59 60MODULE_LICENSE("GPL"); 61 62#ifndef MODULE 63/****************************************************************************** 64 * ip2_setup: 65 * str: kernel command line string 66 * 67 * Can't autoprobe the boards so user must specify configuration on 68 * kernel command line. Sane people build it modular but the others 69 * come here. 70 * 71 * Alternating pairs of io,irq for up to 4 boards. 72 * ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3 73 * 74 * io=0 => No board 75 * io=1 => PCI 76 * io=2 => EISA 77 * else => ISA I/O address 78 * 79 * irq=0 or invalid for ISA will revert to polling mode 80 * 81 * Any value = -1, do not overwrite compiled in value. 82 * 83 ******************************************************************************/ 84static int __init ip2_setup(char *str) 85{ 86 int ints[10]; /* 4 boards, 2 parameters + 2 */ 87 int i, j; 88 89 str = get_options (str, ARRAY_SIZE(ints), ints); 90 91 for( i = 0, j = 1; i < 4; i++ ) { 92 if( j > ints[0] ) { 93 break; 94 } 95 if( ints[j] >= 0 ) { 96 io[i] = ints[j]; 97 } 98 j++; 99 if( j > ints[0] ) { 100 break; 101 } 102 if( ints[j] >= 0 ) { 103 irq[i] = ints[j]; 104 } 105 j++; 106 } 107 return 1; 108} 109__setup("ip2=", ip2_setup); 110#endif /* !MODULE */