ibm_emac_mal.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. /*
  2. * drivers/net/ibm_emac/ibm_emac_mal.c
  3. *
  4. * Memory Access Layer (MAL) support
  5. *
  6. * Copyright (c) 2004, 2005 Zultys Technologies.
  7. * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  8. *
  9. * Based on original work by
  10. * Benjamin Herrenschmidt <benh@kernel.crashing.org>,
  11. * David Gibson <hermes@gibson.dropbear.id.au>,
  12. *
  13. * Armin Kuster <akuster@mvista.com>
  14. * Copyright 2002 MontaVista Softare Inc.
  15. *
  16. * This program is free software; you can redistribute it and/or modify it
  17. * under the terms of the GNU General Public License as published by the
  18. * Free Software Foundation; either version 2 of the License, or (at your
  19. * option) any later version.
  20. *
  21. */
  22. #include <linux/module.h>
  23. #include <linux/kernel.h>
  24. #include <linux/errno.h>
  25. #include <linux/netdevice.h>
  26. #include <linux/init.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/dma-mapping.h>
  29. #include <asm/ocp.h>
  30. #include "ibm_emac_core.h"
  31. #include "ibm_emac_mal.h"
  32. #include "ibm_emac_debug.h"
  33. int __init mal_register_commac(struct ibm_ocp_mal *mal,
  34. struct mal_commac *commac)
  35. {
  36. unsigned long flags;
  37. local_irq_save(flags);
  38. MAL_DBG("%d: reg(%08x, %08x)" NL, mal->def->index,
  39. commac->tx_chan_mask, commac->rx_chan_mask);
  40. /* Don't let multiple commacs claim the same channel(s) */
  41. if ((mal->tx_chan_mask & commac->tx_chan_mask) ||
  42. (mal->rx_chan_mask & commac->rx_chan_mask)) {
  43. local_irq_restore(flags);
  44. printk(KERN_WARNING "mal%d: COMMAC channels conflict!\n",
  45. mal->def->index);
  46. return -EBUSY;
  47. }
  48. mal->tx_chan_mask |= commac->tx_chan_mask;
  49. mal->rx_chan_mask |= commac->rx_chan_mask;
  50. list_add(&commac->list, &mal->list);
  51. local_irq_restore(flags);
  52. return 0;
  53. }
  54. void __exit mal_unregister_commac(struct ibm_ocp_mal *mal,
  55. struct mal_commac *commac)
  56. {
  57. unsigned long flags;
  58. local_irq_save(flags);
  59. MAL_DBG("%d: unreg(%08x, %08x)" NL, mal->def->index,
  60. commac->tx_chan_mask, commac->rx_chan_mask);
  61. mal->tx_chan_mask &= ~commac->tx_chan_mask;
  62. mal->rx_chan_mask &= ~commac->rx_chan_mask;
  63. list_del_init(&commac->list);
  64. local_irq_restore(flags);
  65. }
  66. int mal_set_rcbs(struct ibm_ocp_mal *mal, int channel, unsigned long size)
  67. {
  68. struct ocp_func_mal_data *maldata = mal->def->additions;
  69. BUG_ON(channel < 0 || channel >= maldata->num_rx_chans ||
  70. size > MAL_MAX_RX_SIZE);
  71. MAL_DBG("%d: set_rbcs(%d, %lu)" NL, mal->def->index, channel, size);
  72. if (size & 0xf) {
  73. printk(KERN_WARNING
  74. "mal%d: incorrect RX size %lu for the channel %d\n",
  75. mal->def->index, size, channel);
  76. return -EINVAL;
  77. }
  78. set_mal_dcrn(mal, MAL_RCBS(channel), size >> 4);
  79. return 0;
  80. }
  81. int mal_tx_bd_offset(struct ibm_ocp_mal *mal, int channel)
  82. {
  83. struct ocp_func_mal_data *maldata = mal->def->additions;
  84. BUG_ON(channel < 0 || channel >= maldata->num_tx_chans);
  85. return channel * NUM_TX_BUFF;
  86. }
  87. int mal_rx_bd_offset(struct ibm_ocp_mal *mal, int channel)
  88. {
  89. struct ocp_func_mal_data *maldata = mal->def->additions;
  90. BUG_ON(channel < 0 || channel >= maldata->num_rx_chans);
  91. return maldata->num_tx_chans * NUM_TX_BUFF + channel * NUM_RX_BUFF;
  92. }
  93. void mal_enable_tx_channel(struct ibm_ocp_mal *mal, int channel)
  94. {
  95. local_bh_disable();
  96. MAL_DBG("%d: enable_tx(%d)" NL, mal->def->index, channel);
  97. set_mal_dcrn(mal, MAL_TXCASR,
  98. get_mal_dcrn(mal, MAL_TXCASR) | MAL_CHAN_MASK(channel));
  99. local_bh_enable();
  100. }
  101. void mal_disable_tx_channel(struct ibm_ocp_mal *mal, int channel)
  102. {
  103. set_mal_dcrn(mal, MAL_TXCARR, MAL_CHAN_MASK(channel));
  104. MAL_DBG("%d: disable_tx(%d)" NL, mal->def->index, channel);
  105. }
  106. void mal_enable_rx_channel(struct ibm_ocp_mal *mal, int channel)
  107. {
  108. local_bh_disable();
  109. MAL_DBG("%d: enable_rx(%d)" NL, mal->def->index, channel);
  110. set_mal_dcrn(mal, MAL_RXCASR,
  111. get_mal_dcrn(mal, MAL_RXCASR) | MAL_CHAN_MASK(channel));
  112. local_bh_enable();
  113. }
  114. void mal_disable_rx_channel(struct ibm_ocp_mal *mal, int channel)
  115. {
  116. set_mal_dcrn(mal, MAL_RXCARR, MAL_CHAN_MASK(channel));
  117. MAL_DBG("%d: disable_rx(%d)" NL, mal->def->index, channel);
  118. }
  119. void mal_poll_add(struct ibm_ocp_mal *mal, struct mal_commac *commac)
  120. {
  121. local_bh_disable();
  122. MAL_DBG("%d: poll_add(%p)" NL, mal->def->index, commac);
  123. list_add_tail(&commac->poll_list, &mal->poll_list);
  124. local_bh_enable();
  125. }
  126. void mal_poll_del(struct ibm_ocp_mal *mal, struct mal_commac *commac)
  127. {
  128. local_bh_disable();
  129. MAL_DBG("%d: poll_del(%p)" NL, mal->def->index, commac);
  130. list_del(&commac->poll_list);
  131. local_bh_enable();
  132. }
  133. /* synchronized by mal_poll() */
  134. static inline void mal_enable_eob_irq(struct ibm_ocp_mal *mal)
  135. {
  136. MAL_DBG2("%d: enable_irq" NL, mal->def->index);
  137. set_mal_dcrn(mal, MAL_CFG, get_mal_dcrn(mal, MAL_CFG) | MAL_CFG_EOPIE);
  138. }
  139. /* synchronized by __LINK_STATE_RX_SCHED bit in ndev->state */
  140. static inline void mal_disable_eob_irq(struct ibm_ocp_mal *mal)
  141. {
  142. set_mal_dcrn(mal, MAL_CFG, get_mal_dcrn(mal, MAL_CFG) & ~MAL_CFG_EOPIE);
  143. MAL_DBG2("%d: disable_irq" NL, mal->def->index);
  144. }
  145. static irqreturn_t mal_serr(int irq, void *dev_instance)
  146. {
  147. struct ibm_ocp_mal *mal = dev_instance;
  148. u32 esr = get_mal_dcrn(mal, MAL_ESR);
  149. /* Clear the error status register */
  150. set_mal_dcrn(mal, MAL_ESR, esr);
  151. MAL_DBG("%d: SERR %08x" NL, mal->def->index, esr);
  152. if (esr & MAL_ESR_EVB) {
  153. if (esr & MAL_ESR_DE) {
  154. /* We ignore Descriptor error,
  155. * TXDE or RXDE interrupt will be generated anyway.
  156. */
  157. return IRQ_HANDLED;
  158. }
  159. if (esr & MAL_ESR_PEIN) {
  160. /* PLB error, it's probably buggy hardware or
  161. * incorrect physical address in BD (i.e. bug)
  162. */
  163. if (net_ratelimit())
  164. printk(KERN_ERR
  165. "mal%d: system error, PLB (ESR = 0x%08x)\n",
  166. mal->def->index, esr);
  167. return IRQ_HANDLED;
  168. }
  169. /* OPB error, it's probably buggy hardware or incorrect EBC setup */
  170. if (net_ratelimit())
  171. printk(KERN_ERR
  172. "mal%d: system error, OPB (ESR = 0x%08x)\n",
  173. mal->def->index, esr);
  174. }
  175. return IRQ_HANDLED;
  176. }
  177. static inline void mal_schedule_poll(struct ibm_ocp_mal *mal)
  178. {
  179. if (likely(netif_rx_schedule_prep(&mal->poll_dev))) {
  180. MAL_DBG2("%d: schedule_poll" NL, mal->def->index);
  181. mal_disable_eob_irq(mal);
  182. __netif_rx_schedule(&mal->poll_dev);
  183. } else
  184. MAL_DBG2("%d: already in poll" NL, mal->def->index);
  185. }
  186. static irqreturn_t mal_txeob(int irq, void *dev_instance)
  187. {
  188. struct ibm_ocp_mal *mal = dev_instance;
  189. u32 r = get_mal_dcrn(mal, MAL_TXEOBISR);
  190. MAL_DBG2("%d: txeob %08x" NL, mal->def->index, r);
  191. mal_schedule_poll(mal);
  192. set_mal_dcrn(mal, MAL_TXEOBISR, r);
  193. return IRQ_HANDLED;
  194. }
  195. static irqreturn_t mal_rxeob(int irq, void *dev_instance)
  196. {
  197. struct ibm_ocp_mal *mal = dev_instance;
  198. u32 r = get_mal_dcrn(mal, MAL_RXEOBISR);
  199. MAL_DBG2("%d: rxeob %08x" NL, mal->def->index, r);
  200. mal_schedule_poll(mal);
  201. set_mal_dcrn(mal, MAL_RXEOBISR, r);
  202. return IRQ_HANDLED;
  203. }
  204. static irqreturn_t mal_txde(int irq, void *dev_instance)
  205. {
  206. struct ibm_ocp_mal *mal = dev_instance;
  207. u32 deir = get_mal_dcrn(mal, MAL_TXDEIR);
  208. set_mal_dcrn(mal, MAL_TXDEIR, deir);
  209. MAL_DBG("%d: txde %08x" NL, mal->def->index, deir);
  210. if (net_ratelimit())
  211. printk(KERN_ERR
  212. "mal%d: TX descriptor error (TXDEIR = 0x%08x)\n",
  213. mal->def->index, deir);
  214. return IRQ_HANDLED;
  215. }
  216. static irqreturn_t mal_rxde(int irq, void *dev_instance)
  217. {
  218. struct ibm_ocp_mal *mal = dev_instance;
  219. struct list_head *l;
  220. u32 deir = get_mal_dcrn(mal, MAL_RXDEIR);
  221. MAL_DBG("%d: rxde %08x" NL, mal->def->index, deir);
  222. list_for_each(l, &mal->list) {
  223. struct mal_commac *mc = list_entry(l, struct mal_commac, list);
  224. if (deir & mc->rx_chan_mask) {
  225. mc->rx_stopped = 1;
  226. mc->ops->rxde(mc->dev);
  227. }
  228. }
  229. mal_schedule_poll(mal);
  230. set_mal_dcrn(mal, MAL_RXDEIR, deir);
  231. return IRQ_HANDLED;
  232. }
  233. static int mal_poll(struct net_device *ndev, int *budget)
  234. {
  235. struct ibm_ocp_mal *mal = ndev->priv;
  236. struct list_head *l;
  237. int rx_work_limit = min(ndev->quota, *budget), received = 0, done;
  238. MAL_DBG2("%d: poll(%d) %d ->" NL, mal->def->index, *budget,
  239. rx_work_limit);
  240. again:
  241. /* Process TX skbs */
  242. list_for_each(l, &mal->poll_list) {
  243. struct mal_commac *mc =
  244. list_entry(l, struct mal_commac, poll_list);
  245. mc->ops->poll_tx(mc->dev);
  246. }
  247. /* Process RX skbs.
  248. * We _might_ need something more smart here to enforce polling fairness.
  249. */
  250. list_for_each(l, &mal->poll_list) {
  251. struct mal_commac *mc =
  252. list_entry(l, struct mal_commac, poll_list);
  253. int n = mc->ops->poll_rx(mc->dev, rx_work_limit);
  254. if (n) {
  255. received += n;
  256. rx_work_limit -= n;
  257. if (rx_work_limit <= 0) {
  258. done = 0;
  259. goto more_work; // XXX What if this is the last one ?
  260. }
  261. }
  262. }
  263. /* We need to disable IRQs to protect from RXDE IRQ here */
  264. local_irq_disable();
  265. __netif_rx_complete(ndev);
  266. mal_enable_eob_irq(mal);
  267. local_irq_enable();
  268. done = 1;
  269. /* Check for "rotting" packet(s) */
  270. list_for_each(l, &mal->poll_list) {
  271. struct mal_commac *mc =
  272. list_entry(l, struct mal_commac, poll_list);
  273. if (unlikely(mc->ops->peek_rx(mc->dev) || mc->rx_stopped)) {
  274. MAL_DBG2("%d: rotting packet" NL, mal->def->index);
  275. if (netif_rx_reschedule(ndev, received))
  276. mal_disable_eob_irq(mal);
  277. else
  278. MAL_DBG2("%d: already in poll list" NL,
  279. mal->def->index);
  280. if (rx_work_limit > 0)
  281. goto again;
  282. else
  283. goto more_work;
  284. }
  285. mc->ops->poll_tx(mc->dev);
  286. }
  287. more_work:
  288. ndev->quota -= received;
  289. *budget -= received;
  290. MAL_DBG2("%d: poll() %d <- %d" NL, mal->def->index, *budget,
  291. done ? 0 : 1);
  292. return done ? 0 : 1;
  293. }
  294. static void mal_reset(struct ibm_ocp_mal *mal)
  295. {
  296. int n = 10;
  297. MAL_DBG("%d: reset" NL, mal->def->index);
  298. set_mal_dcrn(mal, MAL_CFG, MAL_CFG_SR);
  299. /* Wait for reset to complete (1 system clock) */
  300. while ((get_mal_dcrn(mal, MAL_CFG) & MAL_CFG_SR) && n)
  301. --n;
  302. if (unlikely(!n))
  303. printk(KERN_ERR "mal%d: reset timeout\n", mal->def->index);
  304. }
  305. int mal_get_regs_len(struct ibm_ocp_mal *mal)
  306. {
  307. return sizeof(struct emac_ethtool_regs_subhdr) +
  308. sizeof(struct ibm_mal_regs);
  309. }
  310. void *mal_dump_regs(struct ibm_ocp_mal *mal, void *buf)
  311. {
  312. struct emac_ethtool_regs_subhdr *hdr = buf;
  313. struct ibm_mal_regs *regs = (struct ibm_mal_regs *)(hdr + 1);
  314. struct ocp_func_mal_data *maldata = mal->def->additions;
  315. int i;
  316. hdr->version = MAL_VERSION;
  317. hdr->index = mal->def->index;
  318. regs->tx_count = maldata->num_tx_chans;
  319. regs->rx_count = maldata->num_rx_chans;
  320. regs->cfg = get_mal_dcrn(mal, MAL_CFG);
  321. regs->esr = get_mal_dcrn(mal, MAL_ESR);
  322. regs->ier = get_mal_dcrn(mal, MAL_IER);
  323. regs->tx_casr = get_mal_dcrn(mal, MAL_TXCASR);
  324. regs->tx_carr = get_mal_dcrn(mal, MAL_TXCARR);
  325. regs->tx_eobisr = get_mal_dcrn(mal, MAL_TXEOBISR);
  326. regs->tx_deir = get_mal_dcrn(mal, MAL_TXDEIR);
  327. regs->rx_casr = get_mal_dcrn(mal, MAL_RXCASR);
  328. regs->rx_carr = get_mal_dcrn(mal, MAL_RXCARR);
  329. regs->rx_eobisr = get_mal_dcrn(mal, MAL_RXEOBISR);
  330. regs->rx_deir = get_mal_dcrn(mal, MAL_RXDEIR);
  331. for (i = 0; i < regs->tx_count; ++i)
  332. regs->tx_ctpr[i] = get_mal_dcrn(mal, MAL_TXCTPR(i));
  333. for (i = 0; i < regs->rx_count; ++i) {
  334. regs->rx_ctpr[i] = get_mal_dcrn(mal, MAL_RXCTPR(i));
  335. regs->rcbs[i] = get_mal_dcrn(mal, MAL_RCBS(i));
  336. }
  337. return regs + 1;
  338. }
  339. static int __init mal_probe(struct ocp_device *ocpdev)
  340. {
  341. struct ibm_ocp_mal *mal;
  342. struct ocp_func_mal_data *maldata;
  343. int err = 0, i, bd_size;
  344. MAL_DBG("%d: probe" NL, ocpdev->def->index);
  345. maldata = ocpdev->def->additions;
  346. if (maldata == NULL) {
  347. printk(KERN_ERR "mal%d: missing additional data!\n",
  348. ocpdev->def->index);
  349. return -ENODEV;
  350. }
  351. mal = kzalloc(sizeof(struct ibm_ocp_mal), GFP_KERNEL);
  352. if (!mal) {
  353. printk(KERN_ERR
  354. "mal%d: out of memory allocating MAL structure!\n",
  355. ocpdev->def->index);
  356. return -ENOMEM;
  357. }
  358. mal->dcrbase = maldata->dcr_base;
  359. mal->def = ocpdev->def;
  360. INIT_LIST_HEAD(&mal->poll_list);
  361. set_bit(__LINK_STATE_START, &mal->poll_dev.state);
  362. mal->poll_dev.weight = CONFIG_IBM_EMAC_POLL_WEIGHT;
  363. mal->poll_dev.poll = mal_poll;
  364. mal->poll_dev.priv = mal;
  365. atomic_set(&mal->poll_dev.refcnt, 1);
  366. INIT_LIST_HEAD(&mal->list);
  367. /* Load power-on reset defaults */
  368. mal_reset(mal);
  369. /* Set the MAL configuration register */
  370. set_mal_dcrn(mal, MAL_CFG, MAL_CFG_DEFAULT | MAL_CFG_PLBB |
  371. MAL_CFG_OPBBL | MAL_CFG_LEA);
  372. mal_enable_eob_irq(mal);
  373. /* Allocate space for BD rings */
  374. BUG_ON(maldata->num_tx_chans <= 0 || maldata->num_tx_chans > 32);
  375. BUG_ON(maldata->num_rx_chans <= 0 || maldata->num_rx_chans > 32);
  376. bd_size = sizeof(struct mal_descriptor) *
  377. (NUM_TX_BUFF * maldata->num_tx_chans +
  378. NUM_RX_BUFF * maldata->num_rx_chans);
  379. mal->bd_virt =
  380. dma_alloc_coherent(&ocpdev->dev, bd_size, &mal->bd_dma, GFP_KERNEL);
  381. if (!mal->bd_virt) {
  382. printk(KERN_ERR
  383. "mal%d: out of memory allocating RX/TX descriptors!\n",
  384. mal->def->index);
  385. err = -ENOMEM;
  386. goto fail;
  387. }
  388. memset(mal->bd_virt, 0, bd_size);
  389. for (i = 0; i < maldata->num_tx_chans; ++i)
  390. set_mal_dcrn(mal, MAL_TXCTPR(i), mal->bd_dma +
  391. sizeof(struct mal_descriptor) *
  392. mal_tx_bd_offset(mal, i));
  393. for (i = 0; i < maldata->num_rx_chans; ++i)
  394. set_mal_dcrn(mal, MAL_RXCTPR(i), mal->bd_dma +
  395. sizeof(struct mal_descriptor) *
  396. mal_rx_bd_offset(mal, i));
  397. err = request_irq(maldata->serr_irq, mal_serr, 0, "MAL SERR", mal);
  398. if (err)
  399. goto fail2;
  400. err = request_irq(maldata->txde_irq, mal_txde, 0, "MAL TX DE", mal);
  401. if (err)
  402. goto fail3;
  403. err = request_irq(maldata->txeob_irq, mal_txeob, 0, "MAL TX EOB", mal);
  404. if (err)
  405. goto fail4;
  406. err = request_irq(maldata->rxde_irq, mal_rxde, 0, "MAL RX DE", mal);
  407. if (err)
  408. goto fail5;
  409. err = request_irq(maldata->rxeob_irq, mal_rxeob, 0, "MAL RX EOB", mal);
  410. if (err)
  411. goto fail6;
  412. /* Enable all MAL SERR interrupt sources */
  413. set_mal_dcrn(mal, MAL_IER, MAL_IER_EVENTS);
  414. /* Advertise this instance to the rest of the world */
  415. ocp_set_drvdata(ocpdev, mal);
  416. mal_dbg_register(mal->def->index, mal);
  417. printk(KERN_INFO "mal%d: initialized, %d TX channels, %d RX channels\n",
  418. mal->def->index, maldata->num_tx_chans, maldata->num_rx_chans);
  419. return 0;
  420. fail6:
  421. free_irq(maldata->rxde_irq, mal);
  422. fail5:
  423. free_irq(maldata->txeob_irq, mal);
  424. fail4:
  425. free_irq(maldata->txde_irq, mal);
  426. fail3:
  427. free_irq(maldata->serr_irq, mal);
  428. fail2:
  429. dma_free_coherent(&ocpdev->dev, bd_size, mal->bd_virt, mal->bd_dma);
  430. fail:
  431. kfree(mal);
  432. return err;
  433. }
  434. static void __exit mal_remove(struct ocp_device *ocpdev)
  435. {
  436. struct ibm_ocp_mal *mal = ocp_get_drvdata(ocpdev);
  437. struct ocp_func_mal_data *maldata = mal->def->additions;
  438. MAL_DBG("%d: remove" NL, mal->def->index);
  439. /* Syncronize with scheduled polling,
  440. stolen from net/core/dev.c:dev_close()
  441. */
  442. clear_bit(__LINK_STATE_START, &mal->poll_dev.state);
  443. netif_poll_disable(&mal->poll_dev);
  444. if (!list_empty(&mal->list)) {
  445. /* This is *very* bad */
  446. printk(KERN_EMERG
  447. "mal%d: commac list is not empty on remove!\n",
  448. mal->def->index);
  449. }
  450. ocp_set_drvdata(ocpdev, NULL);
  451. free_irq(maldata->serr_irq, mal);
  452. free_irq(maldata->txde_irq, mal);
  453. free_irq(maldata->txeob_irq, mal);
  454. free_irq(maldata->rxde_irq, mal);
  455. free_irq(maldata->rxeob_irq, mal);
  456. mal_reset(mal);
  457. mal_dbg_register(mal->def->index, NULL);
  458. dma_free_coherent(&ocpdev->dev,
  459. sizeof(struct mal_descriptor) *
  460. (NUM_TX_BUFF * maldata->num_tx_chans +
  461. NUM_RX_BUFF * maldata->num_rx_chans), mal->bd_virt,
  462. mal->bd_dma);
  463. kfree(mal);
  464. }
  465. /* Structure for a device driver */
  466. static struct ocp_device_id mal_ids[] = {
  467. { .vendor = OCP_VENDOR_IBM, .function = OCP_FUNC_MAL },
  468. { .vendor = OCP_VENDOR_INVALID}
  469. };
  470. static struct ocp_driver mal_driver = {
  471. .name = "mal",
  472. .id_table = mal_ids,
  473. .probe = mal_probe,
  474. .remove = mal_remove,
  475. };
  476. int __init mal_init(void)
  477. {
  478. MAL_DBG(": init" NL);
  479. return ocp_register_driver(&mal_driver);
  480. }
  481. void __exit mal_exit(void)
  482. {
  483. MAL_DBG(": exit" NL);
  484. ocp_unregister_driver(&mal_driver);
  485. }