nosy.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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. unsigned long flags;
  222. spin_lock_irqsave(&client->lynx->client_list_lock, flags);
  223. list_add_tail(&client->link, &client->lynx->client_list);
  224. spin_unlock_irqrestore(&client->lynx->client_list_lock, flags);
  225. }
  226. static void
  227. nosy_stop_snoop(struct client *client)
  228. {
  229. unsigned long flags;
  230. spin_lock_irqsave(&client->lynx->client_list_lock, flags);
  231. list_del_init(&client->link);
  232. spin_unlock_irqrestore(&client->lynx->client_list_lock, flags);
  233. }
  234. static struct client *
  235. nosy_add_client(struct pcilynx *lynx)
  236. {
  237. struct client *client;
  238. client = kmalloc(sizeof *client, GFP_KERNEL);
  239. client->tcode_mask = ~0;
  240. client->lynx = lynx;
  241. INIT_LIST_HEAD(&client->link);
  242. if (packet_buffer_init(&client->buffer, 128 * 1024) < 0) {
  243. kfree(client);
  244. debug("Failed to allocate packet buffer\n");
  245. return NULL;
  246. }
  247. return client;
  248. }
  249. static void
  250. nosy_remove_client(struct client *client)
  251. {
  252. nosy_stop_snoop(client);
  253. packet_buffer_destroy(&client->buffer);
  254. kfree(client);
  255. }
  256. static int
  257. nosy_open(struct inode *inode, struct file *file)
  258. {
  259. int minor = iminor(inode);
  260. if (minor > MAX_MINORS || minors[minor] == NULL)
  261. return -ENODEV;
  262. file->private_data = nosy_add_client(minors[minor]);
  263. if (file->private_data == NULL)
  264. return -ENOMEM;
  265. else
  266. return 0;
  267. }
  268. static int
  269. nosy_release(struct inode *inode, struct file *file)
  270. {
  271. nosy_remove_client(file->private_data);
  272. return 0;
  273. }
  274. static unsigned int
  275. nosy_poll(struct file *file, poll_table *pt)
  276. {
  277. struct client *client = file->private_data;
  278. poll_wait(file, &client->buffer.wait, pt);
  279. if (atomic_read(&client->buffer.size) > 0)
  280. return POLLIN | POLLRDNORM;
  281. else
  282. return 0;
  283. }
  284. static ssize_t
  285. nosy_read(struct file *file, char *buffer, size_t count, loff_t *offset)
  286. {
  287. struct client *client = file->private_data;
  288. return packet_buffer_get(&client->buffer, buffer, count);
  289. }
  290. static long
  291. nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  292. {
  293. struct client *client = file->private_data;
  294. spinlock_t *client_list_lock = &client->lynx->client_list_lock;
  295. struct nosy_stats stats;
  296. switch (cmd) {
  297. case NOSY_IOC_GET_STATS:
  298. spin_lock_irq(client_list_lock);
  299. stats.total_packet_count = client->buffer.total_packet_count;
  300. stats.lost_packet_count = client->buffer.lost_packet_count;
  301. spin_unlock_irq(client_list_lock);
  302. if (copy_to_user((void *) arg, &stats, sizeof stats))
  303. return -EFAULT;
  304. else
  305. return 0;
  306. case NOSY_IOC_START:
  307. nosy_start_snoop(client);
  308. return 0;
  309. case NOSY_IOC_STOP:
  310. nosy_stop_snoop(client);
  311. return 0;
  312. case NOSY_IOC_FILTER:
  313. spin_lock_irq(client_list_lock);
  314. client->tcode_mask = arg;
  315. spin_unlock_irq(client_list_lock);
  316. return 0;
  317. default:
  318. return -EINVAL;
  319. /* Flush buffer, configure filter. */
  320. }
  321. }
  322. static const struct file_operations nosy_ops = {
  323. .owner = THIS_MODULE,
  324. .read = nosy_read,
  325. .unlocked_ioctl = nosy_ioctl,
  326. .poll = nosy_poll,
  327. .open = nosy_open,
  328. .release = nosy_release,
  329. };
  330. #define PHY_PACKET_SIZE 12 /* 1 payload, 1 inverse, 1 ack = 3 quadlets */
  331. struct link_packet {
  332. unsigned int priority : 4;
  333. unsigned int tcode : 4;
  334. unsigned int rt : 2;
  335. unsigned int tlabel : 6;
  336. unsigned int destination : 16;
  337. };
  338. static void
  339. packet_handler(struct pcilynx *lynx)
  340. {
  341. unsigned long flags;
  342. struct client *client;
  343. u32 tcode_mask;
  344. size_t length;
  345. struct link_packet *packet;
  346. struct timeval tv;
  347. /* FIXME: Also report rcv_speed. */
  348. length = lynx->rcv_pcl->pcl_status.transfer_count;
  349. packet = (struct link_packet *) &lynx->rcv_buffer[1];
  350. do_gettimeofday(&tv);
  351. lynx->rcv_buffer[0] = tv.tv_usec;
  352. if (length == PHY_PACKET_SIZE)
  353. tcode_mask = 1 << TCODE_PHY_PACKET;
  354. else
  355. tcode_mask = 1 << packet->tcode;
  356. spin_lock_irqsave(&lynx->client_list_lock, flags);
  357. list_for_each_entry(client, &lynx->client_list, link)
  358. if (client->tcode_mask & tcode_mask)
  359. packet_buffer_put(&client->buffer,
  360. lynx->rcv_buffer, length + 4);
  361. spin_unlock_irqrestore(&lynx->client_list_lock, flags);
  362. }
  363. static void
  364. bus_reset_handler(struct pcilynx *lynx)
  365. {
  366. unsigned long flags;
  367. struct client *client;
  368. struct timeval tv;
  369. do_gettimeofday(&tv);
  370. spin_lock_irqsave(&lynx->client_list_lock, flags);
  371. list_for_each_entry(client, &lynx->client_list, link)
  372. packet_buffer_put(&client->buffer, &tv.tv_usec, 4);
  373. spin_unlock_irqrestore(&lynx->client_list_lock, flags);
  374. }
  375. static irqreturn_t
  376. irq_handler(int irq, void *device)
  377. {
  378. struct pcilynx *lynx = device;
  379. u32 pci_int_status;
  380. pci_int_status = reg_read(lynx, PCI_INT_STATUS);
  381. if ((pci_int_status & PCI_INT_INT_PEND) == 0)
  382. /* Not our interrupt, bail out quickly. */
  383. return IRQ_NONE;
  384. if ((pci_int_status & PCI_INT_P1394_INT) != 0) {
  385. u32 link_int_status;
  386. link_int_status = reg_read(lynx, LINK_INT_STATUS);
  387. reg_write(lynx, LINK_INT_STATUS, link_int_status);
  388. if ((link_int_status & LINK_INT_PHY_BUSRESET) > 0)
  389. bus_reset_handler(lynx);
  390. }
  391. /* Clear the PCI_INT_STATUS register only after clearing the
  392. * LINK_INT_STATUS register; otherwise the PCI_INT_P1394 will
  393. * be set again immediately. */
  394. reg_write(lynx, PCI_INT_STATUS, pci_int_status);
  395. if ((pci_int_status & PCI_INT_DMA0_HLT) > 0) {
  396. packet_handler(lynx);
  397. run_pcl(lynx, lynx->rcv_start_pcl_bus, 0);
  398. }
  399. return IRQ_HANDLED;
  400. }
  401. static void
  402. remove_card(struct pci_dev *dev)
  403. {
  404. struct pcilynx *lynx;
  405. lynx = pci_get_drvdata(dev);
  406. if (!lynx)
  407. return;
  408. pci_set_drvdata(dev, NULL);
  409. reg_write(lynx, PCI_INT_ENABLE, 0);
  410. free_irq(lynx->pci_device->irq, lynx);
  411. pci_free_consistent(lynx->pci_device, sizeof(struct pcl),
  412. lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);
  413. pci_free_consistent(lynx->pci_device, sizeof(struct pcl),
  414. lynx->rcv_pcl, lynx->rcv_pcl_bus);
  415. pci_free_consistent(lynx->pci_device, PAGE_SIZE,
  416. lynx->rcv_buffer, lynx->rcv_buffer_bus);
  417. iounmap(lynx->registers);
  418. minors[lynx->misc.minor] = NULL;
  419. misc_deregister(&lynx->misc);
  420. kfree(lynx);
  421. }
  422. #define RCV_BUFFER_SIZE (16 * 1024)
  423. static int __devinit
  424. add_card(struct pci_dev *dev, const struct pci_device_id *unused)
  425. {
  426. struct pcilynx *lynx;
  427. u32 p, end;
  428. int i;
  429. if (pci_set_dma_mask(dev, 0xffffffff)) {
  430. error("DMA address limits not supported "
  431. "for PCILynx hardware\n");
  432. return -ENXIO;
  433. }
  434. if (pci_enable_device(dev)) {
  435. error("Failed to enable PCILynx hardware\n");
  436. return -ENXIO;
  437. }
  438. pci_set_master(dev);
  439. lynx = kzalloc(sizeof *lynx, GFP_KERNEL);
  440. if (lynx == NULL) {
  441. error("Failed to allocate control structure memory\n");
  442. return -ENOMEM;
  443. }
  444. lynx->pci_device = dev;
  445. pci_set_drvdata(dev, lynx);
  446. spin_lock_init(&lynx->client_list_lock);
  447. INIT_LIST_HEAD(&lynx->client_list);
  448. lynx->registers = ioremap_nocache(pci_resource_start(dev, 0),
  449. PCILYNX_MAX_REGISTER);
  450. lynx->rcv_start_pcl = pci_alloc_consistent(lynx->pci_device,
  451. sizeof(struct pcl), &lynx->rcv_start_pcl_bus);
  452. lynx->rcv_pcl = pci_alloc_consistent(lynx->pci_device,
  453. sizeof(struct pcl), &lynx->rcv_pcl_bus);
  454. lynx->rcv_buffer = pci_alloc_consistent(lynx->pci_device,
  455. RCV_BUFFER_SIZE, &lynx->rcv_buffer_bus);
  456. if (lynx->rcv_start_pcl == NULL ||
  457. lynx->rcv_pcl == NULL ||
  458. lynx->rcv_buffer == NULL) {
  459. /* FIXME: do proper error handling. */
  460. error("Failed to allocate receive buffer\n");
  461. return -ENOMEM;
  462. }
  463. lynx->rcv_start_pcl->next = lynx->rcv_pcl_bus;
  464. lynx->rcv_pcl->next = PCL_NEXT_INVALID;
  465. lynx->rcv_pcl->async_error_next = PCL_NEXT_INVALID;
  466. lynx->rcv_pcl->buffer[0].control =
  467. PCL_CMD_RCV | PCL_BIGENDIAN | 2044;
  468. lynx->rcv_pcl->buffer[0].pointer = lynx->rcv_buffer_bus + 4;
  469. p = lynx->rcv_buffer_bus + 2048;
  470. end = lynx->rcv_buffer_bus + RCV_BUFFER_SIZE;
  471. for (i = 1; p < end; i++, p += 2048) {
  472. lynx->rcv_pcl->buffer[i].control =
  473. PCL_CMD_RCV | PCL_BIGENDIAN | 2048;
  474. lynx->rcv_pcl->buffer[i].pointer = p;
  475. }
  476. lynx->rcv_pcl->buffer[i - 1].control |= PCL_LAST_BUFF;
  477. reg_set_bits(lynx, MISC_CONTROL, MISC_CONTROL_SWRESET);
  478. /* Fix buggy cards with autoboot pin not tied low: */
  479. reg_write(lynx, DMA0_CHAN_CTRL, 0);
  480. reg_write(lynx, DMA_GLOBAL_REGISTER, 0x00 << 24);
  481. #if 0
  482. /* now, looking for PHY register set */
  483. if ((get_phy_reg(lynx, 2) & 0xe0) == 0xe0) {
  484. lynx->phyic.reg_1394a = 1;
  485. PRINT(KERN_INFO, lynx->id,
  486. "found 1394a conform PHY (using extended register set)");
  487. lynx->phyic.vendor = get_phy_vendorid(lynx);
  488. lynx->phyic.product = get_phy_productid(lynx);
  489. } else {
  490. lynx->phyic.reg_1394a = 0;
  491. PRINT(KERN_INFO, lynx->id, "found old 1394 PHY");
  492. }
  493. #endif
  494. /* Setup the general receive FIFO max size. */
  495. reg_write(lynx, FIFO_SIZES, 255);
  496. reg_set_bits(lynx, PCI_INT_ENABLE, PCI_INT_DMA_ALL);
  497. reg_write(lynx, LINK_INT_ENABLE,
  498. LINK_INT_PHY_TIME_OUT | LINK_INT_PHY_REG_RCVD |
  499. LINK_INT_PHY_BUSRESET | LINK_INT_IT_STUCK |
  500. LINK_INT_AT_STUCK | LINK_INT_SNTRJ |
  501. LINK_INT_TC_ERR | LINK_INT_GRF_OVER_FLOW |
  502. LINK_INT_ITF_UNDER_FLOW | LINK_INT_ATF_UNDER_FLOW);
  503. /* Disable the L flag in self ID packets. */
  504. set_phy_reg(lynx, 4, 0);
  505. /* Put this baby into snoop mode */
  506. reg_set_bits(lynx, LINK_CONTROL, LINK_CONTROL_SNOOP_ENABLE);
  507. run_pcl(lynx, lynx->rcv_start_pcl_bus, 0);
  508. if (request_irq(dev->irq, irq_handler, IRQF_SHARED,
  509. driver_name, lynx)) {
  510. error("Failed to allocate shared interrupt %d\n", dev->irq);
  511. return -EIO;
  512. }
  513. lynx->misc.parent = &dev->dev;
  514. lynx->misc.minor = MISC_DYNAMIC_MINOR;
  515. lynx->misc.name = "nosy";
  516. lynx->misc.fops = &nosy_ops;
  517. if (misc_register(&lynx->misc)) {
  518. error("Failed to register misc char device\n");
  519. return -ENOMEM;
  520. }
  521. minors[lynx->misc.minor] = lynx;
  522. notify("Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq);
  523. return 0;
  524. }
  525. static struct pci_device_id pci_table[] __devinitdata = {
  526. {
  527. .vendor = PCI_VENDOR_ID_TI,
  528. .device = PCI_DEVICE_ID_TI_PCILYNX,
  529. .subvendor = PCI_ANY_ID,
  530. .subdevice = PCI_ANY_ID,
  531. },
  532. { } /* Terminating entry */
  533. };
  534. static struct pci_driver lynx_pci_driver = {
  535. .name = driver_name,
  536. .id_table = pci_table,
  537. .probe = add_card,
  538. .remove = remove_card,
  539. };
  540. MODULE_AUTHOR("Kristian Hoegsberg");
  541. MODULE_DESCRIPTION("Snoop mode driver for TI pcilynx 1394 controllers");
  542. MODULE_LICENSE("GPL");
  543. MODULE_DEVICE_TABLE(pci, pci_table);
  544. static int __init nosy_init(void)
  545. {
  546. return pci_register_driver(&lynx_pci_driver);
  547. }
  548. static void __exit nosy_cleanup(void)
  549. {
  550. pci_unregister_driver(&lynx_pci_driver);
  551. notify("Unloaded %s.\n", driver_name);
  552. }
  553. module_init(nosy_init);
  554. module_exit(nosy_cleanup);