airo_cs.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. /*======================================================================
  2. Aironet driver for 4500 and 4800 series cards
  3. This code is released under both the GPL version 2 and BSD licenses.
  4. Either license may be used. The respective licenses are found at
  5. the end of this file.
  6. This code was developed by Benjamin Reed <breed@users.sourceforge.net>
  7. including portions of which come from the Aironet PC4500
  8. Developer's Reference Manual and used with permission. Copyright
  9. (C) 1999 Benjamin Reed. All Rights Reserved. Permission to use
  10. code in the Developer's manual was granted for this driver by
  11. Aironet.
  12. In addition this module was derived from dummy_cs.
  13. The initial developer of dummy_cs is David A. Hinds
  14. <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
  15. are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
  16. ======================================================================*/
  17. #include <linux/config.h>
  18. #ifdef __IN_PCMCIA_PACKAGE__
  19. #include <pcmcia/k_compat.h>
  20. #endif
  21. #include <linux/init.h>
  22. #include <linux/kernel.h>
  23. #include <linux/module.h>
  24. #include <linux/ptrace.h>
  25. #include <linux/slab.h>
  26. #include <linux/string.h>
  27. #include <linux/timer.h>
  28. #include <linux/netdevice.h>
  29. #include <pcmcia/cs_types.h>
  30. #include <pcmcia/cs.h>
  31. #include <pcmcia/cistpl.h>
  32. #include <pcmcia/cisreg.h>
  33. #include <pcmcia/ds.h>
  34. #include <asm/io.h>
  35. #include <asm/system.h>
  36. /*
  37. All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
  38. you do not define PCMCIA_DEBUG at all, all the debug code will be
  39. left out. If you compile with PCMCIA_DEBUG=0, the debug code will
  40. be present but disabled -- but it can then be enabled for specific
  41. modules at load time with a 'pc_debug=#' option to insmod.
  42. */
  43. #ifdef PCMCIA_DEBUG
  44. static int pc_debug = PCMCIA_DEBUG;
  45. module_param(pc_debug, int, 0);
  46. static char *version = "$Revision: 1.2 $";
  47. #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
  48. #else
  49. #define DEBUG(n, args...)
  50. #endif
  51. /*====================================================================*/
  52. MODULE_AUTHOR("Benjamin Reed");
  53. MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet \
  54. cards. This is the module that links the PCMCIA card \
  55. with the airo module.");
  56. MODULE_LICENSE("Dual BSD/GPL");
  57. MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
  58. /*====================================================================*/
  59. /*
  60. The event() function is this driver's Card Services event handler.
  61. It will be called by Card Services when an appropriate card status
  62. event is received. The config() and release() entry points are
  63. used to configure or release a socket, in response to card
  64. insertion and ejection events. They are invoked from the airo_cs
  65. event handler.
  66. */
  67. struct net_device *init_airo_card( int, int, int, struct device * );
  68. void stop_airo_card( struct net_device *, int );
  69. int reset_airo_card( struct net_device * );
  70. static void airo_config(dev_link_t *link);
  71. static void airo_release(dev_link_t *link);
  72. static int airo_event(event_t event, int priority,
  73. event_callback_args_t *args);
  74. /*
  75. The attach() and detach() entry points are used to create and destroy
  76. "instances" of the driver, where each instance represents everything
  77. needed to manage one actual PCMCIA card.
  78. */
  79. static dev_link_t *airo_attach(void);
  80. static void airo_detach(dev_link_t *);
  81. /*
  82. You'll also need to prototype all the functions that will actually
  83. be used to talk to your device. See 'pcmem_cs' for a good example
  84. of a fully self-sufficient driver; the other drivers rely more or
  85. less on other parts of the kernel.
  86. */
  87. /*
  88. The dev_info variable is the "key" that is used to match up this
  89. device driver with appropriate cards, through the card configuration
  90. database.
  91. */
  92. static dev_info_t dev_info = "airo_cs";
  93. /*
  94. A linked list of "instances" of the aironet device. Each actual
  95. PCMCIA card corresponds to one device instance, and is described
  96. by one dev_link_t structure (defined in ds.h).
  97. You may not want to use a linked list for this -- for example, the
  98. memory card driver uses an array of dev_link_t pointers, where minor
  99. device numbers are used to derive the corresponding array index.
  100. */
  101. static dev_link_t *dev_list = NULL;
  102. /*
  103. A dev_link_t structure has fields for most things that are needed
  104. to keep track of a socket, but there will usually be some device
  105. specific information that also needs to be kept track of. The
  106. 'priv' pointer in a dev_link_t structure can be used to point to
  107. a device-specific private data structure, like this.
  108. A driver needs to provide a dev_node_t structure for each device
  109. on a card. In some cases, there is only one device per card (for
  110. example, ethernet cards, modems). In other cases, there may be
  111. many actual or logical devices (SCSI adapters, memory cards with
  112. multiple partitions). The dev_node_t structures need to be kept
  113. in a linked list starting at the 'dev' field of a dev_link_t
  114. structure. We allocate them in the card's private data structure,
  115. because they generally shouldn't be allocated dynamically.
  116. In this case, we also provide a flag to indicate if a device is
  117. "stopped" due to a power management event, or card ejection. The
  118. device IO routines can use a flag like this to throttle IO to a
  119. card that is not ready to accept it.
  120. */
  121. typedef struct local_info_t {
  122. dev_node_t node;
  123. struct net_device *eth_dev;
  124. } local_info_t;
  125. /*======================================================================
  126. airo_attach() creates an "instance" of the driver, allocating
  127. local data structures for one device. The device is registered
  128. with Card Services.
  129. The dev_link structure is initialized, but we don't actually
  130. configure the card at this point -- we wait until we receive a
  131. card insertion event.
  132. ======================================================================*/
  133. static dev_link_t *airo_attach(void)
  134. {
  135. client_reg_t client_reg;
  136. dev_link_t *link;
  137. local_info_t *local;
  138. int ret;
  139. DEBUG(0, "airo_attach()\n");
  140. /* Initialize the dev_link_t structure */
  141. link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
  142. if (!link) {
  143. printk(KERN_ERR "airo_cs: no memory for new device\n");
  144. return NULL;
  145. }
  146. memset(link, 0, sizeof(struct dev_link_t));
  147. /* Interrupt setup */
  148. link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
  149. link->irq.IRQInfo1 = IRQ_LEVEL_ID;
  150. link->irq.Handler = NULL;
  151. /*
  152. General socket configuration defaults can go here. In this
  153. client, we assume very little, and rely on the CIS for almost
  154. everything. In most clients, many details (i.e., number, sizes,
  155. and attributes of IO windows) are fixed by the nature of the
  156. device, and can be hard-wired here.
  157. */
  158. link->conf.Attributes = 0;
  159. link->conf.Vcc = 50;
  160. link->conf.IntType = INT_MEMORY_AND_IO;
  161. /* Allocate space for private device-specific data */
  162. local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
  163. if (!local) {
  164. printk(KERN_ERR "airo_cs: no memory for new device\n");
  165. kfree (link);
  166. return NULL;
  167. }
  168. memset(local, 0, sizeof(local_info_t));
  169. link->priv = local;
  170. /* Register with Card Services */
  171. link->next = dev_list;
  172. dev_list = link;
  173. client_reg.dev_info = &dev_info;
  174. client_reg.Version = 0x0210;
  175. client_reg.event_callback_args.client_data = link;
  176. ret = pcmcia_register_client(&link->handle, &client_reg);
  177. if (ret != 0) {
  178. cs_error(link->handle, RegisterClient, ret);
  179. airo_detach(link);
  180. return NULL;
  181. }
  182. return link;
  183. } /* airo_attach */
  184. /*======================================================================
  185. This deletes a driver "instance". The device is de-registered
  186. with Card Services. If it has been released, all local data
  187. structures are freed. Otherwise, the structures will be freed
  188. when the device is released.
  189. ======================================================================*/
  190. static void airo_detach(dev_link_t *link)
  191. {
  192. dev_link_t **linkp;
  193. DEBUG(0, "airo_detach(0x%p)\n", link);
  194. /* Locate device structure */
  195. for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
  196. if (*linkp == link) break;
  197. if (*linkp == NULL)
  198. return;
  199. if (link->state & DEV_CONFIG)
  200. airo_release(link);
  201. if ( ((local_info_t*)link->priv)->eth_dev ) {
  202. stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
  203. }
  204. ((local_info_t*)link->priv)->eth_dev = NULL;
  205. /* Break the link with Card Services */
  206. if (link->handle)
  207. pcmcia_deregister_client(link->handle);
  208. /* Unlink device structure, free pieces */
  209. *linkp = link->next;
  210. if (link->priv) {
  211. kfree(link->priv);
  212. }
  213. kfree(link);
  214. } /* airo_detach */
  215. /*======================================================================
  216. airo_config() is scheduled to run after a CARD_INSERTION event
  217. is received, to configure the PCMCIA socket, and to make the
  218. device available to the system.
  219. ======================================================================*/
  220. #define CS_CHECK(fn, ret) \
  221. do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
  222. static void airo_config(dev_link_t *link)
  223. {
  224. client_handle_t handle;
  225. tuple_t tuple;
  226. cisparse_t parse;
  227. local_info_t *dev;
  228. int last_fn, last_ret;
  229. u_char buf[64];
  230. win_req_t req;
  231. memreq_t map;
  232. handle = link->handle;
  233. dev = link->priv;
  234. DEBUG(0, "airo_config(0x%p)\n", link);
  235. /*
  236. This reads the card's CONFIG tuple to find its configuration
  237. registers.
  238. */
  239. tuple.DesiredTuple = CISTPL_CONFIG;
  240. tuple.Attributes = 0;
  241. tuple.TupleData = buf;
  242. tuple.TupleDataMax = sizeof(buf);
  243. tuple.TupleOffset = 0;
  244. CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
  245. CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
  246. CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
  247. link->conf.ConfigBase = parse.config.base;
  248. link->conf.Present = parse.config.rmask[0];
  249. /* Configure card */
  250. link->state |= DEV_CONFIG;
  251. /*
  252. In this loop, we scan the CIS for configuration table entries,
  253. each of which describes a valid card configuration, including
  254. voltage, IO window, memory window, and interrupt settings.
  255. We make no assumptions about the card to be configured: we use
  256. just the information available in the CIS. In an ideal world,
  257. this would work for any PCMCIA card, but it requires a complete
  258. and accurate CIS. In practice, a driver usually "knows" most of
  259. these things without consulting the CIS, and most client drivers
  260. will only use the CIS to fill in implementation-defined details.
  261. */
  262. tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
  263. CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
  264. while (1) {
  265. cistpl_cftable_entry_t dflt = { 0 };
  266. cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
  267. if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
  268. pcmcia_parse_tuple(handle, &tuple, &parse) != 0)
  269. goto next_entry;
  270. if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
  271. if (cfg->index == 0) goto next_entry;
  272. link->conf.ConfigIndex = cfg->index;
  273. /* Does this card need audio output? */
  274. if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
  275. link->conf.Attributes |= CONF_ENABLE_SPKR;
  276. link->conf.Status = CCSR_AUDIO_ENA;
  277. }
  278. /* Use power settings for Vcc and Vpp if present */
  279. /* Note that the CIS values need to be rescaled */
  280. if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM))
  281. link->conf.Vcc = cfg->vcc.param[CISTPL_POWER_VNOM]/10000;
  282. else if (dflt.vcc.present & (1<<CISTPL_POWER_VNOM))
  283. link->conf.Vcc = dflt.vcc.param[CISTPL_POWER_VNOM]/10000;
  284. if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
  285. link->conf.Vpp1 = link->conf.Vpp2 =
  286. cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
  287. else if (dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
  288. link->conf.Vpp1 = link->conf.Vpp2 =
  289. dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
  290. /* Do we need to allocate an interrupt? */
  291. if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1)
  292. link->conf.Attributes |= CONF_ENABLE_IRQ;
  293. /* IO window settings */
  294. link->io.NumPorts1 = link->io.NumPorts2 = 0;
  295. if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
  296. cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
  297. link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
  298. if (!(io->flags & CISTPL_IO_8BIT))
  299. link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
  300. if (!(io->flags & CISTPL_IO_16BIT))
  301. link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
  302. link->io.BasePort1 = io->win[0].base;
  303. link->io.NumPorts1 = io->win[0].len;
  304. if (io->nwin > 1) {
  305. link->io.Attributes2 = link->io.Attributes1;
  306. link->io.BasePort2 = io->win[1].base;
  307. link->io.NumPorts2 = io->win[1].len;
  308. }
  309. }
  310. /* This reserves IO space but doesn't actually enable it */
  311. if (pcmcia_request_io(link->handle, &link->io) != 0)
  312. goto next_entry;
  313. /*
  314. Now set up a common memory window, if needed. There is room
  315. in the dev_link_t structure for one memory window handle,
  316. but if the base addresses need to be saved, or if multiple
  317. windows are needed, the info should go in the private data
  318. structure for this device.
  319. Note that the memory window base is a physical address, and
  320. needs to be mapped to virtual space with ioremap() before it
  321. is used.
  322. */
  323. if ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) {
  324. cistpl_mem_t *mem =
  325. (cfg->mem.nwin) ? &cfg->mem : &dflt.mem;
  326. req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
  327. req.Base = mem->win[0].host_addr;
  328. req.Size = mem->win[0].len;
  329. req.AccessSpeed = 0;
  330. if (pcmcia_request_window(&link->handle, &req, &link->win) != 0)
  331. goto next_entry;
  332. map.Page = 0; map.CardOffset = mem->win[0].card_addr;
  333. if (pcmcia_map_mem_page(link->win, &map) != 0)
  334. goto next_entry;
  335. }
  336. /* If we got this far, we're cool! */
  337. break;
  338. next_entry:
  339. CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
  340. }
  341. /*
  342. Allocate an interrupt line. Note that this does not assign a
  343. handler to the interrupt, unless the 'Handler' member of the
  344. irq structure is initialized.
  345. */
  346. if (link->conf.Attributes & CONF_ENABLE_IRQ)
  347. CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
  348. /*
  349. This actually configures the PCMCIA socket -- setting up
  350. the I/O windows and the interrupt mapping, and putting the
  351. card and host interface into "Memory and IO" mode.
  352. */
  353. CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
  354. ((local_info_t*)link->priv)->eth_dev =
  355. init_airo_card( link->irq.AssignedIRQ,
  356. link->io.BasePort1, 1, &handle_to_dev(handle) );
  357. if (!((local_info_t*)link->priv)->eth_dev) goto cs_failed;
  358. /*
  359. At this point, the dev_node_t structure(s) need to be
  360. initialized and arranged in a linked list at link->dev.
  361. */
  362. strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name );
  363. dev->node.major = dev->node.minor = 0;
  364. link->dev = &dev->node;
  365. /* Finally, report what we've done */
  366. printk(KERN_INFO "%s: index 0x%02x: Vcc %d.%d",
  367. dev->node.dev_name, link->conf.ConfigIndex,
  368. link->conf.Vcc/10, link->conf.Vcc%10);
  369. if (link->conf.Vpp1)
  370. printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10);
  371. if (link->conf.Attributes & CONF_ENABLE_IRQ)
  372. printk(", irq %d", link->irq.AssignedIRQ);
  373. if (link->io.NumPorts1)
  374. printk(", io 0x%04x-0x%04x", link->io.BasePort1,
  375. link->io.BasePort1+link->io.NumPorts1-1);
  376. if (link->io.NumPorts2)
  377. printk(" & 0x%04x-0x%04x", link->io.BasePort2,
  378. link->io.BasePort2+link->io.NumPorts2-1);
  379. if (link->win)
  380. printk(", mem 0x%06lx-0x%06lx", req.Base,
  381. req.Base+req.Size-1);
  382. printk("\n");
  383. link->state &= ~DEV_CONFIG_PENDING;
  384. return;
  385. cs_failed:
  386. cs_error(link->handle, last_fn, last_ret);
  387. airo_release(link);
  388. } /* airo_config */
  389. /*======================================================================
  390. After a card is removed, airo_release() will unregister the
  391. device, and release the PCMCIA configuration. If the device is
  392. still open, this will be postponed until it is closed.
  393. ======================================================================*/
  394. static void airo_release(dev_link_t *link)
  395. {
  396. DEBUG(0, "airo_release(0x%p)\n", link);
  397. /* Unlink the device chain */
  398. link->dev = NULL;
  399. /*
  400. In a normal driver, additional code may be needed to release
  401. other kernel data structures associated with this device.
  402. */
  403. /* Don't bother checking to see if these succeed or not */
  404. if (link->win)
  405. pcmcia_release_window(link->win);
  406. pcmcia_release_configuration(link->handle);
  407. if (link->io.NumPorts1)
  408. pcmcia_release_io(link->handle, &link->io);
  409. if (link->irq.AssignedIRQ)
  410. pcmcia_release_irq(link->handle, &link->irq);
  411. link->state &= ~DEV_CONFIG;
  412. }
  413. /*======================================================================
  414. The card status event handler. Mostly, this schedules other
  415. stuff to run after an event is received.
  416. When a CARD_REMOVAL event is received, we immediately set a
  417. private flag to block future accesses to this device. All the
  418. functions that actually access the device should check this flag
  419. to make sure the card is still present.
  420. ======================================================================*/
  421. static int airo_event(event_t event, int priority,
  422. event_callback_args_t *args)
  423. {
  424. dev_link_t *link = args->client_data;
  425. local_info_t *local = link->priv;
  426. DEBUG(1, "airo_event(0x%06x)\n", event);
  427. switch (event) {
  428. case CS_EVENT_CARD_REMOVAL:
  429. link->state &= ~DEV_PRESENT;
  430. if (link->state & DEV_CONFIG) {
  431. netif_device_detach(local->eth_dev);
  432. airo_release(link);
  433. }
  434. break;
  435. case CS_EVENT_CARD_INSERTION:
  436. link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
  437. airo_config(link);
  438. break;
  439. case CS_EVENT_PM_SUSPEND:
  440. link->state |= DEV_SUSPEND;
  441. /* Fall through... */
  442. case CS_EVENT_RESET_PHYSICAL:
  443. if (link->state & DEV_CONFIG) {
  444. netif_device_detach(local->eth_dev);
  445. pcmcia_release_configuration(link->handle);
  446. }
  447. break;
  448. case CS_EVENT_PM_RESUME:
  449. link->state &= ~DEV_SUSPEND;
  450. /* Fall through... */
  451. case CS_EVENT_CARD_RESET:
  452. if (link->state & DEV_CONFIG) {
  453. pcmcia_request_configuration(link->handle, &link->conf);
  454. reset_airo_card(local->eth_dev);
  455. netif_device_attach(local->eth_dev);
  456. }
  457. break;
  458. }
  459. return 0;
  460. } /* airo_event */
  461. static struct pcmcia_device_id airo_ids[] = {
  462. PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a),
  463. PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005),
  464. PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0007),
  465. PCMCIA_DEVICE_MANF_CARD(0x0105, 0x0007),
  466. PCMCIA_DEVICE_NULL,
  467. };
  468. MODULE_DEVICE_TABLE(pcmcia, airo_ids);
  469. static struct pcmcia_driver airo_driver = {
  470. .owner = THIS_MODULE,
  471. .drv = {
  472. .name = "airo_cs",
  473. },
  474. .attach = airo_attach,
  475. .event = airo_event,
  476. .detach = airo_detach,
  477. .id_table = airo_ids,
  478. };
  479. static int airo_cs_init(void)
  480. {
  481. return pcmcia_register_driver(&airo_driver);
  482. }
  483. static void airo_cs_cleanup(void)
  484. {
  485. pcmcia_unregister_driver(&airo_driver);
  486. BUG_ON(dev_list != NULL);
  487. }
  488. /*
  489. This program is free software; you can redistribute it and/or
  490. modify it under the terms of the GNU General Public License
  491. as published by the Free Software Foundation; either version 2
  492. of the License, or (at your option) any later version.
  493. This program is distributed in the hope that it will be useful,
  494. but WITHOUT ANY WARRANTY; without even the implied warranty of
  495. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  496. GNU General Public License for more details.
  497. In addition:
  498. Redistribution and use in source and binary forms, with or without
  499. modification, are permitted provided that the following conditions
  500. are met:
  501. 1. Redistributions of source code must retain the above copyright
  502. notice, this list of conditions and the following disclaimer.
  503. 2. Redistributions in binary form must reproduce the above copyright
  504. notice, this list of conditions and the following disclaimer in the
  505. documentation and/or other materials provided with the distribution.
  506. 3. The name of the author may not be used to endorse or promote
  507. products derived from this software without specific prior written
  508. permission.
  509. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  510. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  511. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  512. ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  513. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  514. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  515. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  516. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  517. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  518. IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  519. POSSIBILITY OF SUCH DAMAGE.
  520. */
  521. module_init(airo_cs_init);
  522. module_exit(airo_cs_cleanup);