nosy.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /*
  2. * nosy - Snoop mode driver for TI PCILynx 1394 controllers
  3. * Copyright (C) 2002-2007 Kristian Høgsberg
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software Foundation,
  17. * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. #include <linux/errno.h>
  20. #include <linux/fs.h>
  21. #include <linux/init.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/io.h>
  24. #include <linux/kernel.h>
  25. #include <linux/miscdevice.h>
  26. #include <linux/module.h>
  27. #include <linux/pci.h>
  28. #include <linux/poll.h>
  29. #include <linux/sched.h> /* required for linux/wait.h */
  30. #include <linux/slab.h>
  31. #include <linux/spinlock.h>
  32. #include <linux/timex.h>
  33. #include <linux/uaccess.h>
  34. #include <linux/wait.h>
  35. #include <asm/atomic.h>
  36. #include <asm/byteorder.h>
  37. #include "nosy.h"
  38. #include "nosy-user.h"
  39. #define TCODE_PHY_PACKET 0x10
  40. #define PCI_DEVICE_ID_TI_PCILYNX 0x8000
  41. #define notify(s, args...) printk(KERN_NOTICE s, ## args)
  42. #define error(s, args...) printk(KERN_ERR s, ## args)
  43. #define debug(s, args...) printk(KERN_DEBUG s, ## args)
  44. static char driver_name[] = KBUILD_MODNAME;
  45. struct pcl_status {
  46. unsigned int transfer_count : 13;
  47. unsigned int reserved0 : 1;
  48. unsigned int ack_type : 1;
  49. unsigned int ack : 4;
  50. unsigned int rcv_speed : 2;
  51. unsigned int rcv_dma_channel : 6;
  52. unsigned int packet_complete : 1;
  53. unsigned int packet_error : 1;
  54. unsigned int master_error : 1;
  55. unsigned int iso_mode : 1;
  56. unsigned int self_id : 1;
  57. };
  58. /* this is the physical layout of a PCL, its size is 128 bytes */
  59. struct pcl {
  60. u32 next;
  61. u32 async_error_next;
  62. u32 user_data;
  63. struct pcl_status pcl_status;
  64. u32 remaining_transfer_count;
  65. u32 next_data_buffer;
  66. struct {
  67. u32 control;
  68. u32 pointer;
  69. } buffer[13] __attribute__ ((packed));
  70. } __attribute__ ((packed));
  71. struct packet {
  72. unsigned int length;
  73. char data[0];
  74. };
  75. struct packet_buffer {
  76. char *data;
  77. size_t capacity;
  78. long total_packet_count, lost_packet_count;
  79. atomic_t size;
  80. struct packet *head, *tail;
  81. wait_queue_head_t wait;
  82. };
  83. struct pcilynx {
  84. struct pci_dev *pci_device;
  85. unsigned char *registers;
  86. struct pcl *rcv_start_pcl, *rcv_pcl;
  87. u32 *rcv_buffer;
  88. dma_addr_t rcv_start_pcl_bus, rcv_pcl_bus, rcv_buffer_bus;
  89. spinlock_t client_list_lock;
  90. struct list_head client_list;
  91. struct miscdevice misc;
  92. };
  93. struct client {
  94. struct pcilynx *lynx;
  95. u32 tcode_mask;
  96. struct packet_buffer buffer;
  97. struct list_head link;
  98. };
  99. #define MAX_MINORS 64
  100. static struct pcilynx *minors[MAX_MINORS];
  101. static int
  102. packet_buffer_init(struct packet_buffer *buffer, size_t capacity)
  103. {
  104. buffer->data = kmalloc(capacity, GFP_KERNEL);
  105. if (buffer->data == NULL)
  106. return -ENOMEM;
  107. buffer->head = (struct packet *) buffer->data;
  108. buffer->tail = (struct packet *) buffer->data;
  109. buffer->capacity = capacity;
  110. buffer->lost_packet_count = 0;
  111. atomic_set(&buffer->size, 0);
  112. init_waitqueue_head(&buffer->wait);
  113. return 0;
  114. }
  115. static void
  116. packet_buffer_destroy(struct packet_buffer *buffer)
  117. {
  118. kfree(buffer->data);
  119. }
  120. static int
  121. packet_buffer_get(struct packet_buffer *buffer, void *data, size_t user_length)
  122. {
  123. size_t length;
  124. char *end;
  125. if (wait_event_interruptible(buffer->wait,
  126. atomic_read(&buffer->size) > 0))
  127. return -ERESTARTSYS;
  128. /* FIXME: Check length <= user_length. */
  129. end = buffer->data + buffer->capacity;
  130. length = buffer->head->length;
  131. if (&buffer->head->data[length] < end) {
  132. if (copy_to_user(data, buffer->head->data, length))
  133. return -EFAULT;
  134. buffer->head = (struct packet *) &buffer->head->data[length];
  135. } else {
  136. size_t split = end - buffer->head->data;
  137. if (copy_to_user(data, buffer->head->data, split))
  138. return -EFAULT;
  139. if (copy_to_user(data + split, buffer->data, length - split))
  140. return -EFAULT;
  141. buffer->head = (struct packet *) &buffer->data[length - split];
  142. }
  143. /*
  144. * Decrease buffer->size as the last thing, since this is what
  145. * keeps the interrupt from overwriting the packet we are
  146. * retrieving from the buffer.
  147. */
  148. atomic_sub(sizeof(struct packet) + length, &buffer->size);
  149. return length;
  150. }
  151. static void
  152. packet_buffer_put(struct packet_buffer *buffer, void *data, size_t length)
  153. {
  154. char *end;
  155. buffer->total_packet_count++;
  156. if (buffer->capacity <
  157. atomic_read(&buffer->size) + sizeof(struct packet) + length) {
  158. buffer->lost_packet_count++;
  159. return;
  160. }
  161. end = buffer->data + buffer->capacity;
  162. buffer->tail->length = length;
  163. if (&buffer->tail->data[length] < end) {
  164. memcpy(buffer->tail->data, data, length);
  165. buffer->tail = (struct packet *) &buffer->tail->data[length];
  166. } else {
  167. size_t split = end - buffer->tail->data;
  168. memcpy(buffer->tail->data, data, split);
  169. memcpy(buffer->data, data + split, length - split);
  170. buffer->tail = (struct packet *) &buffer->data[length - split];
  171. }
  172. /* Finally, adjust buffer size and wake up userspace reader. */
  173. atomic_add(sizeof(struct packet) + length, &buffer->size);
  174. wake_up_interruptible(&buffer->wait);
  175. }
  176. static inline void
  177. reg_write(struct pcilynx *lynx, int offset, u32 data)
  178. {
  179. writel(data, lynx->registers + offset);
  180. }
  181. static inline u32
  182. reg_read(struct pcilynx *lynx, int offset)
  183. {
  184. return readl(lynx->registers + offset);
  185. }
  186. static inline void
  187. reg_set_bits(struct pcilynx *lynx, int offset, u32 mask)
  188. {
  189. reg_write(lynx, offset, (reg_read(lynx, offset) | mask));
  190. }
  191. /*
  192. * Maybe the pcl programs could be set up to just append data instead
  193. * of using a whole packet.
  194. */
  195. static inline void
  196. run_pcl(struct pcilynx *lynx, dma_addr_t pcl_bus,
  197. int dmachan)
  198. {
  199. reg_write(lynx, DMA0_CURRENT_PCL + dmachan * 0x20, pcl_bus);
  200. reg_write(lynx, DMA0_CHAN_CTRL + dmachan * 0x20,
  201. DMA_CHAN_CTRL_ENABLE | DMA_CHAN_CTRL_LINK);
  202. }
  203. static int
  204. set_phy_reg(struct pcilynx *lynx, int addr, int val)
  205. {
  206. if (addr > 15) {
  207. debug("PHY register address %d out of range\n", addr);
  208. return -1;
  209. }
  210. if (val > 0xff) {
  211. debug("PHY register value %d out of range\n", val);
  212. return -1;
  213. }
  214. reg_write(lynx, LINK_PHY, LINK_PHY_WRITE |
  215. LINK_PHY_ADDR(addr) | LINK_PHY_WDATA(val));
  216. return 0;
  217. }
  218. static void
  219. nosy_start_snoop(struct client *client)
  220. {
  221. spin_lock_irq(&client->lynx->client_list_lock);
  222. list_add_tail(&client->link, &client->lynx->client_list);
  223. spin_unlock_irq(&client->lynx->client_list_lock);
  224. }
  225. static void
  226. nosy_stop_snoop(struct client *client)
  227. {
  228. spin_lock_irq(&client->lynx->client_list_lock);
  229. list_del_init(&client->link);
  230. spin_unlock_irq(&client->lynx->client_list_lock);
  231. }
  232. static struct client *
  233. nosy_add_client(struct pcilynx *lynx)
  234. {
  235. struct client *client;
  236. client = kmalloc(sizeof *client, GFP_KERNEL);
  237. client->tcode_mask = ~0;
  238. client->lynx = lynx;
  239. INIT_LIST_HEAD(&client->link);
  240. if (packet_buffer_init(&client->buffer, 128 * 1024) < 0) {
  241. kfree(client);
  242. debug("Failed to allocate packet buffer\n");
  243. return NULL;
  244. }
  245. return client;
  246. }
  247. static void
  248. nosy_remove_client(struct client *client)
  249. {
  250. nosy_stop_snoop(client);
  251. packet_buffer_destroy(&client->buffer);
  252. kfree(client);
  253. }
  254. static int
  255. nosy_open(struct inode *inode, struct file *file)
  256. {
  257. int minor = iminor(inode);
  258. if (minor > MAX_MINORS || minors[minor] == NULL)
  259. return -ENODEV;
  260. file->private_data = nosy_add_client(minors[minor]);
  261. if (file->private_data == NULL)
  262. return -ENOMEM;
  263. else
  264. return 0;
  265. }
  266. static int
  267. nosy_release(struct inode *inode, struct file *file)
  268. {
  269. nosy_remove_client(file->private_data);
  270. return 0;
  271. }
  272. static unsigned int
  273. nosy_poll(struct file *file, poll_table *pt)
  274. {
  275. struct client *client = file->private_data;
  276. poll_wait(file, &client->buffer.wait, pt);
  277. if (atomic_read(&client->buffer.size) > 0)
  278. return POLLIN | POLLRDNORM;
  279. else
  280. return 0;
  281. }
  282. static ssize_t
  283. nosy_read(struct file *file, char *buffer, size_t count, loff_t *offset)
  284. {
  285. struct client *client = file->private_data;
  286. return packet_buffer_get(&client->buffer, buffer, count);
  287. }
  288. static long
  289. nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  290. {
  291. struct client *client = file->private_data;
  292. spinlock_t *client_list_lock = &client->lynx->client_list_lock;
  293. struct nosy_stats stats;
  294. switch (cmd) {
  295. case NOSY_IOC_GET_STATS:
  296. spin_lock_irq(client_list_lock);
  297. stats.total_packet_count = client->buffer.total_packet_count;
  298. stats.lost_packet_count = client->buffer.lost_packet_count;
  299. spin_unlock_irq(client_list_lock);
  300. if (copy_to_user((void *) arg, &stats, sizeof stats))
  301. return -EFAULT;
  302. else
  303. return 0;
  304. case NOSY_IOC_START:
  305. nosy_start_snoop(client);
  306. return 0;
  307. case NOSY_IOC_STOP:
  308. nosy_stop_snoop(client);
  309. return 0;
  310. case NOSY_IOC_FILTER:
  311. spin_lock_irq(client_list_lock);
  312. client->tcode_mask = arg;
  313. spin_unlock_irq(client_list_lock);
  314. return 0;
  315. default:
  316. return -EINVAL;
  317. /* Flush buffer, configure filter. */
  318. }
  319. }
  320. static const struct file_operations nosy_ops = {
  321. .owner = THIS_MODULE,
  322. .read = nosy_read,
  323. .unlocked_ioctl = nosy_ioctl,
  324. .poll = nosy_poll,
  325. .open = nosy_open,
  326. .release = nosy_release,
  327. };
  328. #define PHY_PACKET_SIZE 12 /* 1 payload, 1 inverse, 1 ack = 3 quadlets */
  329. struct link_packet {
  330. unsigned int priority : 4;
  331. unsigned int tcode : 4;
  332. unsigned int rt : 2;
  333. unsigned int tlabel : 6;
  334. unsigned int destination : 16;
  335. };
  336. static void
  337. packet_irq_handler(struct pcilynx *lynx)
  338. {
  339. struct client *client;
  340. u32 tcode_mask;
  341. size_t length;
  342. struct link_packet *packet;
  343. struct timeval tv;
  344. /* FIXME: Also report rcv_speed. */
  345. length = lynx->rcv_pcl->pcl_status.transfer_count;
  346. packet = (struct link_packet *) &lynx->rcv_buffer[1];
  347. do_gettimeofday(&tv);
  348. lynx->rcv_buffer[0] = tv.tv_usec;
  349. if (length == PHY_PACKET_SIZE)
  350. tcode_mask = 1 << TCODE_PHY_PACKET;
  351. else
  352. tcode_mask = 1 << packet->tcode;
  353. spin_lock(&lynx->client_list_lock);
  354. list_for_each_entry(client, &lynx->client_list, link)
  355. if (client->tcode_mask & tcode_mask)
  356. packet_buffer_put(&client->buffer,
  357. lynx->rcv_buffer, length + 4);
  358. spin_unlock(&lynx->client_list_lock);
  359. }
  360. static void
  361. bus_reset_irq_handler(struct pcilynx *lynx)
  362. {
  363. struct client *client;
  364. struct timeval tv;
  365. do_gettimeofday(&tv);
  366. spin_lock(&lynx->client_list_lock);
  367. list_for_each_entry(client, &lynx->client_list, link)
  368. packet_buffer_put(&client->buffer, &tv.tv_usec, 4);
  369. spin_unlock(&lynx->client_list_lock);
  370. }
  371. static irqreturn_t
  372. irq_handler(int irq, void *device)
  373. {
  374. struct pcilynx *lynx = device;
  375. u32 pci_int_status;
  376. pci_int_status = reg_read(lynx, PCI_INT_STATUS);
  377. if ((pci_int_status & PCI_INT_INT_PEND) == 0)
  378. /* Not our interrupt, bail out quickly. */
  379. return IRQ_NONE;
  380. if ((pci_int_status & PCI_INT_P1394_INT) != 0) {
  381. u32 link_int_status;
  382. link_int_status = reg_read(lynx, LINK_INT_STATUS);
  383. reg_write(lynx, LINK_INT_STATUS, link_int_status);
  384. if ((link_int_status & LINK_INT_PHY_BUSRESET) > 0)
  385. bus_reset_irq_handler(lynx);
  386. }
  387. /* Clear the PCI_INT_STATUS register only after clearing the
  388. * LINK_INT_STATUS register; otherwise the PCI_INT_P1394 will
  389. * be set again immediately. */
  390. reg_write(lynx, PCI_INT_STATUS, pci_int_status);
  391. if ((pci_int_status & PCI_INT_DMA0_HLT) > 0) {
  392. packet_irq_handler(lynx);
  393. run_pcl(lynx, lynx->rcv_start_pcl_bus, 0);
  394. }
  395. return IRQ_HANDLED;
  396. }
  397. static void
  398. remove_card(struct pci_dev *dev)
  399. {
  400. struct pcilynx *lynx;
  401. lynx = pci_get_drvdata(dev);
  402. if (!lynx)
  403. return;
  404. pci_set_drvdata(dev, NULL);
  405. reg_write(lynx, PCI_INT_ENABLE, 0);
  406. free_irq(lynx->pci_device->irq, lynx);
  407. pci_free_consistent(lynx->pci_device, sizeof(struct pcl),
  408. lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);
  409. pci_free_consistent(lynx->pci_device, sizeof(struct pcl),
  410. lynx->rcv_pcl, lynx->rcv_pcl_bus);
  411. pci_free_consistent(lynx->pci_device, PAGE_SIZE,
  412. lynx->rcv_buffer, lynx->rcv_buffer_bus);
  413. iounmap(lynx->registers);
  414. minors[lynx->misc.minor] = NULL;
  415. misc_deregister(&lynx->misc);
  416. kfree(lynx);
  417. }
  418. #define RCV_BUFFER_SIZE (16 * 1024)
  419. static int __devinit
  420. add_card(struct pci_dev *dev, const struct pci_device_id *unused)
  421. {
  422. struct pcilynx *lynx;
  423. u32 p, end;
  424. int i;
  425. if (pci_set_dma_mask(dev, 0xffffffff)) {
  426. error("DMA address limits not supported "
  427. "for PCILynx hardware\n");
  428. return -ENXIO;
  429. }
  430. if (pci_enable_device(dev)) {
  431. error("Failed to enable PCILynx hardware\n");
  432. return -ENXIO;
  433. }
  434. pci_set_master(dev);
  435. lynx = kzalloc(sizeof *lynx, GFP_KERNEL);
  436. if (lynx == NULL) {
  437. error("Failed to allocate control structure memory\n");
  438. return -ENOMEM;
  439. }
  440. lynx->pci_device = dev;
  441. pci_set_drvdata(dev, lynx);
  442. spin_lock_init(&lynx->client_list_lock);
  443. INIT_LIST_HEAD(&lynx->client_list);
  444. lynx->registers = ioremap_nocache(pci_resource_start(dev, 0),
  445. PCILYNX_MAX_REGISTER);
  446. lynx->rcv_start_pcl = pci_alloc_consistent(lynx->pci_device,
  447. sizeof(struct pcl), &lynx->rcv_start_pcl_bus);
  448. lynx->rcv_pcl = pci_alloc_consistent(lynx->pci_device,
  449. sizeof(struct pcl), &lynx->rcv_pcl_bus);
  450. lynx->rcv_buffer = pci_alloc_consistent(lynx->pci_device,
  451. RCV_BUFFER_SIZE, &lynx->rcv_buffer_bus);
  452. if (lynx->rcv_start_pcl == NULL ||
  453. lynx->rcv_pcl == NULL ||
  454. lynx->rcv_buffer == NULL) {
  455. /* FIXME: do proper error handling. */
  456. error("Failed to allocate receive buffer\n");
  457. return -ENOMEM;
  458. }
  459. lynx->rcv_start_pcl->next = lynx->rcv_pcl_bus;
  460. lynx->rcv_pcl->next = PCL_NEXT_INVALID;
  461. lynx->rcv_pcl->async_error_next = PCL_NEXT_INVALID;
  462. lynx->rcv_pcl->buffer[0].control =
  463. PCL_CMD_RCV | PCL_BIGENDIAN | 2044;
  464. lynx->rcv_pcl->buffer[0].pointer = lynx->rcv_buffer_bus + 4;
  465. p = lynx->rcv_buffer_bus + 2048;
  466. end = lynx->rcv_buffer_bus + RCV_BUFFER_SIZE;
  467. for (i = 1; p < end; i++, p += 2048) {
  468. lynx->rcv_pcl->buffer[i].control =
  469. PCL_CMD_RCV | PCL_BIGENDIAN | 2048;
  470. lynx->rcv_pcl->buffer[i].pointer = p;
  471. }
  472. lynx->rcv_pcl->buffer[i - 1].control |= PCL_LAST_BUFF;
  473. reg_set_bits(lynx, MISC_CONTROL, MISC_CONTROL_SWRESET);
  474. /* Fix buggy cards with autoboot pin not tied low: */
  475. reg_write(lynx, DMA0_CHAN_CTRL, 0);
  476. reg_write(lynx, DMA_GLOBAL_REGISTER, 0x00 << 24);
  477. #if 0
  478. /* now, looking for PHY register set */
  479. if ((get_phy_reg(lynx, 2) & 0xe0) == 0xe0) {
  480. lynx->phyic.reg_1394a = 1;
  481. PRINT(KERN_INFO, lynx->id,
  482. "found 1394a conform PHY (using extended register set)");
  483. lynx->phyic.vendor = get_phy_vendorid(lynx);
  484. lynx->phyic.product = get_phy_productid(lynx);
  485. } else {
  486. lynx->phyic.reg_1394a = 0;
  487. PRINT(KERN_INFO, lynx->id, "found old 1394 PHY");
  488. }
  489. #endif
  490. /* Setup the general receive FIFO max size. */
  491. reg_write(lynx, FIFO_SIZES, 255);
  492. reg_set_bits(lynx, PCI_INT_ENABLE, PCI_INT_DMA_ALL);
  493. reg_write(lynx, LINK_INT_ENABLE,
  494. LINK_INT_PHY_TIME_OUT | LINK_INT_PHY_REG_RCVD |
  495. LINK_INT_PHY_BUSRESET | LINK_INT_IT_STUCK |
  496. LINK_INT_AT_STUCK | LINK_INT_SNTRJ |
  497. LINK_INT_TC_ERR | LINK_INT_GRF_OVER_FLOW |
  498. LINK_INT_ITF_UNDER_FLOW | LINK_INT_ATF_UNDER_FLOW);
  499. /* Disable the L flag in self ID packets. */
  500. set_phy_reg(lynx, 4, 0);
  501. /* Put this baby into snoop mode */
  502. reg_set_bits(lynx, LINK_CONTROL, LINK_CONTROL_SNOOP_ENABLE);
  503. run_pcl(lynx, lynx->rcv_start_pcl_bus, 0);
  504. if (request_irq(dev->irq, irq_handler, IRQF_SHARED,
  505. driver_name, lynx)) {
  506. error("Failed to allocate shared interrupt %d\n", dev->irq);
  507. return -EIO;
  508. }
  509. lynx->misc.parent = &dev->dev;
  510. lynx->misc.minor = MISC_DYNAMIC_MINOR;
  511. lynx->misc.name = "nosy";
  512. lynx->misc.fops = &nosy_ops;
  513. if (misc_register(&lynx->misc)) {
  514. error("Failed to register misc char device\n");
  515. return -ENOMEM;
  516. }
  517. minors[lynx->misc.minor] = lynx;
  518. notify("Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq);
  519. return 0;
  520. }
  521. static struct pci_device_id pci_table[] __devinitdata = {
  522. {
  523. .vendor = PCI_VENDOR_ID_TI,
  524. .device = PCI_DEVICE_ID_TI_PCILYNX,
  525. .subvendor = PCI_ANY_ID,
  526. .subdevice = PCI_ANY_ID,
  527. },
  528. { } /* Terminating entry */
  529. };
  530. static struct pci_driver lynx_pci_driver = {
  531. .name = driver_name,
  532. .id_table = pci_table,
  533. .probe = add_card,
  534. .remove = remove_card,
  535. };
  536. MODULE_AUTHOR("Kristian Hoegsberg");
  537. MODULE_DESCRIPTION("Snoop mode driver for TI pcilynx 1394 controllers");
  538. MODULE_LICENSE("GPL");
  539. MODULE_DEVICE_TABLE(pci, pci_table);
  540. static int __init nosy_init(void)
  541. {
  542. return pci_register_driver(&lynx_pci_driver);
  543. }
  544. static void __exit nosy_cleanup(void)
  545. {
  546. pci_unregister_driver(&lynx_pci_driver);
  547. notify("Unloaded %s.\n", driver_name);
  548. }
  549. module_init(nosy_init);
  550. module_exit(nosy_cleanup);