ip2.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #include <linux/module.h>
  9. #include <linux/version.h>
  10. #include <linux/init.h>
  11. #include <linux/wait.h>
  12. #ifndef __init
  13. #define __init
  14. #endif
  15. #ifndef __initfunc
  16. #define __initfunc(a) a
  17. #endif
  18. #ifndef __initdata
  19. #define __initdata
  20. #endif
  21. #include "./ip2/ip2types.h"
  22. #include "./ip2/fip_firm.h" // the meat
  23. int
  24. ip2_loadmain(int *, int *, unsigned char *, int ); // ref into ip2main.c
  25. /* Note: Add compiled in defaults to these arrays, not to the structure
  26. in ip2/ip2.h any longer. That structure WILL get overridden
  27. by these values, or command line values, or insmod values!!! =mhw=
  28. */
  29. static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 };
  30. static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
  31. static int poll_only = 0;
  32. MODULE_AUTHOR("Doug McNash");
  33. MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
  34. module_param_array(irq, int, NULL, 0);
  35. MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards");
  36. module_param_array(io, int, NULL, 0);
  37. MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards");
  38. module_param(poll_only, bool, 0);
  39. MODULE_PARM_DESC(poll_only,"Do not use card interrupts");
  40. static int __init ip2_init(void)
  41. {
  42. if( poll_only ) {
  43. /* Hard lock the interrupts to zero */
  44. irq[0] = irq[1] = irq[2] = irq[3] = 0;
  45. }
  46. return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
  47. }
  48. module_init(ip2_init);
  49. MODULE_LICENSE("GPL");
  50. #ifndef MODULE
  51. /******************************************************************************
  52. * ip2_setup:
  53. * str: kernel command line string
  54. *
  55. * Can't autoprobe the boards so user must specify configuration on
  56. * kernel command line. Sane people build it modular but the others
  57. * come here.
  58. *
  59. * Alternating pairs of io,irq for up to 4 boards.
  60. * ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3
  61. *
  62. * io=0 => No board
  63. * io=1 => PCI
  64. * io=2 => EISA
  65. * else => ISA I/O address
  66. *
  67. * irq=0 or invalid for ISA will revert to polling mode
  68. *
  69. * Any value = -1, do not overwrite compiled in value.
  70. *
  71. ******************************************************************************/
  72. static int __init ip2_setup(char *str)
  73. {
  74. int ints[10]; /* 4 boards, 2 parameters + 2 */
  75. int i, j;
  76. str = get_options (str, ARRAY_SIZE(ints), ints);
  77. for( i = 0, j = 1; i < 4; i++ ) {
  78. if( j > ints[0] ) {
  79. break;
  80. }
  81. if( ints[j] >= 0 ) {
  82. io[i] = ints[j];
  83. }
  84. j++;
  85. if( j > ints[0] ) {
  86. break;
  87. }
  88. if( ints[j] >= 0 ) {
  89. irq[i] = ints[j];
  90. }
  91. j++;
  92. }
  93. return 1;
  94. }
  95. __setup("ip2=", ip2_setup);
  96. #endif /* !MODULE */