nosy.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. /* -*- c-file-style: "linux" -*-
  2. *
  3. * nosy.c - Snoop mode driver for TI pcilynx 1394 controllers
  4. * Copyright (C) 2002 Kristian Høgsberg
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/slab.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/sched.h> /* required for linux/wait.h */
  24. #include <linux/wait.h>
  25. #include <linux/errno.h>
  26. #include <linux/module.h>
  27. #include <linux/init.h>
  28. #include <linux/pci.h>
  29. #include <linux/fs.h>
  30. #include <linux/poll.h>
  31. #include <linux/miscdevice.h>
  32. #include <asm/byteorder.h>
  33. #include <asm/atomic.h>
  34. #include <asm/io.h>
  35. #include <asm/uaccess.h>
  36. #include <asm/timex.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 const char driver_name[] = "nosy";
  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 : 16;
  73. unsigned int code : 16;
  74. char data[0];
  75. };
  76. struct packet_buffer {
  77. char *data;
  78. size_t capacity;
  79. long total_packet_count, lost_packet_count;
  80. atomic_t size;
  81. struct packet *head, *tail;
  82. wait_queue_head_t wait;
  83. };
  84. struct pcilynx {
  85. struct pci_dev *pci_device;
  86. unsigned char *registers;
  87. struct pcl *rcv_start_pcl, *rcv_pcl;
  88. u32 *rcv_buffer;
  89. dma_addr_t rcv_start_pcl_bus, rcv_pcl_bus, rcv_buffer_bus;
  90. spinlock_t client_list_lock;
  91. struct list_head client_list;
  92. struct miscdevice misc;
  93. };
  94. struct client {
  95. struct pcilynx *lynx;
  96. unsigned long tcode_mask;
  97. struct packet_buffer buffer;
  98. struct list_head link;
  99. };
  100. #define MAX_MINORS 64
  101. struct pcilynx *minors[MAX_MINORS];
  102. static int
  103. packet_buffer_init(struct packet_buffer *buffer, size_t capacity)
  104. {
  105. buffer->data = kmalloc(capacity, GFP_KERNEL);
  106. if (buffer->data == NULL)
  107. return -ENOMEM;
  108. buffer->head = (struct packet *) buffer->data;
  109. buffer->tail = (struct packet *) buffer->data;
  110. buffer->capacity = capacity;
  111. buffer->lost_packet_count = 0;
  112. atomic_set(&buffer->size, 0);
  113. init_waitqueue_head(&buffer->wait);
  114. return 0;
  115. }
  116. static void
  117. packet_buffer_destroy(struct packet_buffer *buffer)
  118. {
  119. kfree(buffer->data);
  120. }
  121. static int
  122. packet_buffer_get(struct packet_buffer *buffer, void *data, size_t user_length)
  123. {
  124. size_t length;
  125. char *end;
  126. if (wait_event_interruptible(buffer->wait,
  127. atomic_read(&buffer->size) > 0))
  128. return -ERESTARTSYS;
  129. /* FIXME: Check length <= user_length. */
  130. end = buffer->data + buffer->capacity;
  131. length = buffer->head->length;
  132. if (&buffer->head->data[length] < end) {
  133. if (copy_to_user(data, buffer->head->data, length))
  134. return -EFAULT;
  135. buffer->head = (struct packet *) &buffer->head->data[length];
  136. }
  137. else {
  138. size_t split = end - buffer->head->data;
  139. if (copy_to_user(data, buffer->head->data, split))
  140. return -EFAULT;
  141. if (copy_to_user(data + split, buffer->data, length - split))
  142. return -EFAULT;
  143. buffer->head = (struct packet *) &buffer->data[length - split];
  144. }
  145. /* Decrease buffer->size as the last thing, since this is what
  146. * keeps the interrupt from overwriting the packet we are
  147. * retrieving from the buffer. */
  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. }
  167. else {
  168. size_t split = end - buffer->tail->data;
  169. memcpy(buffer->tail->data, data, split);
  170. memcpy(buffer->data, data + split, length - split);
  171. buffer->tail = (struct packet *) &buffer->data[length - split];
  172. }
  173. /* Finally, adjust buffer size and wake up userspace reader. */
  174. atomic_add(sizeof (struct packet) + length, &buffer->size);
  175. wake_up_interruptible(&buffer->wait);
  176. }
  177. static inline void
  178. reg_write(struct pcilynx *lynx, int offset, u32 data)
  179. {
  180. writel(data, lynx->registers + offset);
  181. }
  182. static inline u32
  183. reg_read(struct pcilynx *lynx, int offset)
  184. {
  185. return readl(lynx->registers + offset);
  186. }
  187. static inline void
  188. reg_set_bits(struct pcilynx *lynx, int offset, u32 mask)
  189. {
  190. reg_write(lynx, offset, (reg_read(lynx, offset) | mask));
  191. }
  192. /* Maybe the pcl programs could be setup to just append data instead
  193. * of using a whole packet. */
  194. static inline void
  195. run_pcl(struct pcilynx *lynx, dma_addr_t pcl_bus, int dmachan)
  196. {
  197. reg_write(lynx, DMA0_CURRENT_PCL + dmachan * 0x20, pcl_bus);
  198. reg_write(lynx, DMA0_CHAN_CTRL + dmachan * 0x20,
  199. DMA_CHAN_CTRL_ENABLE | DMA_CHAN_CTRL_LINK);
  200. }
  201. static int
  202. set_phy_reg(struct pcilynx *lynx, int addr, int val)
  203. {
  204. if (addr > 15) {
  205. debug("%s: PHY register address %d out of range",
  206. __FUNCTION__, addr);
  207. return -1;
  208. }
  209. if (val > 0xff) {
  210. debug("%s: PHY register value %d out of range",
  211. __FUNCTION__, 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(&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 int
  291. nosy_ioctl(struct inode *inode, struct file *file,
  292. unsigned int cmd, unsigned long arg)
  293. {
  294. struct client *client = file->private_data;
  295. switch (cmd) {
  296. case NOSY_IOC_GET_STATS: {
  297. struct nosy_stats stats;
  298. stats.total_packet_count = client->buffer.total_packet_count;
  299. stats.lost_packet_count = client->buffer.lost_packet_count;
  300. if (copy_to_user((void *) arg, &stats, sizeof stats))
  301. return -EFAULT;
  302. else
  303. return 0;
  304. }
  305. case NOSY_IOC_START:
  306. nosy_start_snoop(client);
  307. return 0;
  308. case NOSY_IOC_STOP:
  309. nosy_stop_snoop(client);
  310. return 0;
  311. case NOSY_IOC_FILTER:
  312. client->tcode_mask = arg;
  313. return 0;
  314. default:
  315. return -EINVAL;
  316. /* Flush buffer, configure filter. */
  317. }
  318. }
  319. static struct file_operations nosy_ops = {
  320. .owner = THIS_MODULE,
  321. .read = nosy_read,
  322. .ioctl = nosy_ioctl,
  323. .poll = nosy_poll,
  324. .open = nosy_open,
  325. .release = nosy_release,
  326. };
  327. #define PHY_PACKET_SIZE 12 /* 1 payload, 1 inverse, 1 ack = 3 quadlets */
  328. struct link_packet {
  329. unsigned int priority : 4;
  330. unsigned int tcode : 4;
  331. unsigned int rt : 2;
  332. unsigned int tlabel : 6;
  333. unsigned int destination : 16;
  334. };
  335. static void
  336. packet_handler(struct pcilynx *lynx)
  337. {
  338. unsigned long flags;
  339. struct list_head *pos;
  340. struct client *client;
  341. unsigned long tcode_mask;
  342. size_t length;
  343. struct link_packet *packet;
  344. struct timeval tv;
  345. /* FIXME: Also report rcv_speed. */
  346. length = lynx->rcv_pcl->pcl_status.transfer_count;
  347. packet = (struct link_packet *) &lynx->rcv_buffer[1];
  348. do_gettimeofday(&tv);
  349. lynx->rcv_buffer[0] = tv.tv_usec;
  350. if (length == PHY_PACKET_SIZE)
  351. tcode_mask = 1 << TCODE_PHY_PACKET;
  352. else
  353. tcode_mask = 1 << packet->tcode;
  354. spin_lock_irqsave(&lynx->client_list_lock, flags);
  355. list_for_each(pos, &lynx->client_list) {
  356. client = list_entry(pos, struct client, link);
  357. if (client->tcode_mask & tcode_mask)
  358. packet_buffer_put(&client->buffer,
  359. lynx->rcv_buffer, length + 4);
  360. }
  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 list_head *pos;
  368. struct client *client;
  369. struct timeval tv;
  370. do_gettimeofday(&tv);
  371. spin_lock_irqsave(&lynx->client_list_lock, flags);
  372. list_for_each(pos, &lynx->client_list) {
  373. client = list_entry(pos, struct client, link);
  374. packet_buffer_put(&client->buffer, &tv.tv_usec, 4);
  375. }
  376. spin_unlock_irqrestore(&lynx->client_list_lock, flags);
  377. }
  378. static irqreturn_t
  379. irq_handler(int irq, void *device)
  380. {
  381. struct pcilynx *lynx = (struct pcilynx *) device;
  382. u32 pci_int_status;
  383. pci_int_status = reg_read(lynx, PCI_INT_STATUS);
  384. if ((pci_int_status & PCI_INT_INT_PEND) == 0)
  385. /* Not our interrupt, bail out quickly. */
  386. return IRQ_NONE;
  387. if ((pci_int_status & PCI_INT_P1394_INT) != 0) {
  388. u32 link_int_status;
  389. link_int_status = reg_read(lynx, LINK_INT_STATUS);
  390. reg_write(lynx, LINK_INT_STATUS, link_int_status);
  391. if ((link_int_status & LINK_INT_PHY_BUSRESET) > 0)
  392. bus_reset_handler(lynx);
  393. }
  394. /* Clear the PCI_INT_STATUS register only after clearing the
  395. * LINK_INT_STATUS register; otherwise the PCI_INT_P1394 will
  396. * be set again immediately. */
  397. reg_write(lynx, PCI_INT_STATUS, pci_int_status);
  398. if ((pci_int_status & PCI_INT_DMA0_HLT) > 0) {
  399. packet_handler(lynx);
  400. run_pcl(lynx, lynx->rcv_start_pcl_bus, 0);
  401. }
  402. return IRQ_HANDLED;
  403. }
  404. static void
  405. remove_card(struct pci_dev *dev)
  406. {
  407. struct pcilynx *lynx;
  408. lynx = pci_get_drvdata(dev);
  409. if (!lynx)
  410. return;
  411. pci_set_drvdata(dev, NULL);
  412. reg_write(lynx, PCI_INT_ENABLE, 0);
  413. free_irq(lynx->pci_device->irq, lynx);
  414. pci_free_consistent(lynx->pci_device, sizeof (struct pcl),
  415. lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);
  416. pci_free_consistent(lynx->pci_device, sizeof (struct pcl),
  417. lynx->rcv_pcl, lynx->rcv_pcl_bus);
  418. pci_free_consistent(lynx->pci_device, PAGE_SIZE,
  419. lynx->rcv_buffer, lynx->rcv_buffer_bus);
  420. iounmap(lynx->registers);
  421. minors[lynx->misc.minor] = NULL;
  422. misc_deregister(&lynx->misc);
  423. kfree(lynx);
  424. }
  425. #define RCV_BUFFER_SIZE (16 * 1024)
  426. #define FAIL(s, args...) \
  427. do { \
  428. error(s, ## args); \
  429. return err; \
  430. } while (0)
  431. static int __devinit
  432. add_card(struct pci_dev *dev, const struct pci_device_id *unused)
  433. {
  434. struct pcilynx *lynx;
  435. u32 p, end;
  436. int err, i;
  437. err = -ENXIO;
  438. if (pci_set_dma_mask(dev, 0xffffffff))
  439. FAIL("DMA address limits not supported "
  440. "for PCILynx hardware.\n");
  441. if (pci_enable_device(dev))
  442. FAIL("Failed to enable PCILynx hardware.\n");
  443. pci_set_master(dev);
  444. err = -ENOMEM;
  445. lynx = kzalloc(sizeof *lynx, GFP_KERNEL);
  446. if (lynx == NULL)
  447. FAIL("Failed to allocate control structure memory.\n");
  448. lynx->pci_device = dev;
  449. pci_set_drvdata(dev, lynx);
  450. spin_lock_init(&lynx->client_list_lock);
  451. INIT_LIST_HEAD(&lynx->client_list);
  452. lynx->registers = ioremap_nocache(pci_resource_start(dev, 0),
  453. PCILYNX_MAX_REGISTER);
  454. lynx->rcv_start_pcl = pci_alloc_consistent(lynx->pci_device,
  455. sizeof(struct pcl),
  456. &lynx->rcv_start_pcl_bus);
  457. lynx->rcv_pcl = pci_alloc_consistent(lynx->pci_device,
  458. sizeof(struct pcl),
  459. &lynx->rcv_pcl_bus);
  460. lynx->rcv_buffer = pci_alloc_consistent(lynx->pci_device, RCV_BUFFER_SIZE,
  461. &lynx->rcv_buffer_bus);
  462. if (lynx->rcv_start_pcl == NULL ||
  463. lynx->rcv_pcl == NULL ||
  464. lynx->rcv_buffer == NULL)
  465. /* FIXME: do proper error handling. */
  466. FAIL("Failed to allocate receive buffer.\n");
  467. lynx->rcv_start_pcl->next = lynx->rcv_pcl_bus;
  468. lynx->rcv_pcl->next = PCL_NEXT_INVALID;
  469. lynx->rcv_pcl->async_error_next = PCL_NEXT_INVALID;
  470. lynx->rcv_pcl->buffer[0].control =
  471. PCL_CMD_RCV | PCL_BIGENDIAN | 2044;
  472. lynx->rcv_pcl->buffer[0].pointer = lynx->rcv_buffer_bus + 4;
  473. p = lynx->rcv_buffer_bus + 2048;
  474. end = lynx->rcv_buffer_bus + RCV_BUFFER_SIZE;
  475. for (i = 1; p < end; i++, p += 2048) {
  476. lynx->rcv_pcl->buffer[i].control =
  477. PCL_CMD_RCV | PCL_BIGENDIAN | 2048;
  478. lynx->rcv_pcl->buffer[i].pointer = p;
  479. }
  480. lynx->rcv_pcl->buffer[i - 1].control |= PCL_LAST_BUFF;
  481. reg_set_bits(lynx, MISC_CONTROL, MISC_CONTROL_SWRESET);
  482. /* Fix buggy cards with autoboot pin not tied low: */
  483. reg_write(lynx, DMA0_CHAN_CTRL, 0);
  484. reg_write(lynx, DMA_GLOBAL_REGISTER, 0x00 << 24);
  485. #if 0
  486. /* now, looking for PHY register set */
  487. if ((get_phy_reg(lynx, 2) & 0xe0) == 0xe0) {
  488. lynx->phyic.reg_1394a = 1;
  489. PRINT(KERN_INFO, lynx->id,
  490. "found 1394a conform PHY (using extended register set)");
  491. lynx->phyic.vendor = get_phy_vendorid(lynx);
  492. lynx->phyic.product = get_phy_productid(lynx);
  493. } else {
  494. lynx->phyic.reg_1394a = 0;
  495. PRINT(KERN_INFO, lynx->id, "found old 1394 PHY");
  496. }
  497. #endif
  498. /* Setup the general receive FIFO max size. */
  499. reg_write(lynx, FIFO_SIZES, 255);
  500. reg_set_bits(lynx, PCI_INT_ENABLE, PCI_INT_DMA_ALL);
  501. reg_write(lynx, LINK_INT_ENABLE,
  502. LINK_INT_PHY_TIME_OUT | LINK_INT_PHY_REG_RCVD |
  503. LINK_INT_PHY_BUSRESET | LINK_INT_IT_STUCK |
  504. LINK_INT_AT_STUCK | LINK_INT_SNTRJ |
  505. LINK_INT_TC_ERR | LINK_INT_GRF_OVER_FLOW |
  506. LINK_INT_ITF_UNDER_FLOW | LINK_INT_ATF_UNDER_FLOW);
  507. /* Disable the L flag in self ID packets. */
  508. set_phy_reg(lynx, 4, 0);
  509. /* Put this baby into snoop mode */
  510. reg_set_bits(lynx, LINK_CONTROL, LINK_CONTROL_SNOOP_ENABLE);
  511. run_pcl(lynx, lynx->rcv_start_pcl_bus, 0);
  512. if (request_irq(dev->irq, irq_handler, IRQF_SHARED, driver_name, lynx))
  513. FAIL("Failed to allocate shared interrupt %d.", dev->irq);
  514. lynx->misc.parent = &dev->dev;
  515. lynx->misc.minor = MISC_DYNAMIC_MINOR;
  516. lynx->misc.name = "nosy";
  517. lynx->misc.fops = &nosy_ops;
  518. if (misc_register(&lynx->misc))
  519. FAIL("Failed to register misc char device.");
  520. minors[lynx->misc.minor] = lynx;
  521. notify("Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq);
  522. return 0;
  523. }
  524. static struct pci_device_id pci_table[] __devinitdata = {
  525. {
  526. .vendor = PCI_VENDOR_ID_TI,
  527. .device = PCI_DEVICE_ID_TI_PCILYNX,
  528. .subvendor = PCI_ANY_ID,
  529. .subdevice = PCI_ANY_ID,
  530. },
  531. { } /* Terminating entry */
  532. };
  533. static struct pci_driver lynx_pci_driver = {
  534. .name = (char *) driver_name,
  535. .id_table = pci_table,
  536. .probe = add_card,
  537. .remove = __devexit_p(remove_card),
  538. };
  539. MODULE_AUTHOR("Kristian Høgsberg");
  540. MODULE_DESCRIPTION("Snoop mode driver for TI pcilynx 1394 controllers");
  541. MODULE_LICENSE("GPL");
  542. MODULE_DEVICE_TABLE(pci, pci_table);
  543. static int __init nosy_init(void)
  544. {
  545. /* notify("Loaded %s version %s.\n", driver_name, VERSION); */
  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);