fsl-mc-allocator.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * fsl-mc object allocator driver
  4. *
  5. * Copyright (C) 2013-2016 Freescale Semiconductor, Inc.
  6. *
  7. */
  8. #include <linux/module.h>
  9. #include <linux/msi.h>
  10. #include <linux/fsl/mc.h>
  11. #include "fsl-mc-private.h"
  12. static bool __must_check fsl_mc_is_allocatable(struct fsl_mc_device *mc_dev)
  13. {
  14. return is_fsl_mc_bus_dpbp(mc_dev) ||
  15. is_fsl_mc_bus_dpmcp(mc_dev) ||
  16. is_fsl_mc_bus_dpcon(mc_dev);
  17. }
  18. /**
  19. * fsl_mc_resource_pool_add_device - add allocatable object to a resource
  20. * pool of a given fsl-mc bus
  21. *
  22. * @mc_bus: pointer to the fsl-mc bus
  23. * @pool_type: pool type
  24. * @mc_dev: pointer to allocatable fsl-mc device
  25. */
  26. static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus
  27. *mc_bus,
  28. enum fsl_mc_pool_type
  29. pool_type,
  30. struct fsl_mc_device
  31. *mc_dev)
  32. {
  33. struct fsl_mc_resource_pool *res_pool;
  34. struct fsl_mc_resource *resource;
  35. struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
  36. int error = -EINVAL;
  37. if (pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)
  38. goto out;
  39. if (!fsl_mc_is_allocatable(mc_dev))
  40. goto out;
  41. if (mc_dev->resource)
  42. goto out;
  43. res_pool = &mc_bus->resource_pools[pool_type];
  44. if (res_pool->type != pool_type)
  45. goto out;
  46. if (res_pool->mc_bus != mc_bus)
  47. goto out;
  48. mutex_lock(&res_pool->mutex);
  49. if (res_pool->max_count < 0)
  50. goto out_unlock;
  51. if (res_pool->free_count < 0 ||
  52. res_pool->free_count > res_pool->max_count)
  53. goto out_unlock;
  54. resource = devm_kzalloc(&mc_bus_dev->dev, sizeof(*resource),
  55. GFP_KERNEL);
  56. if (!resource) {
  57. error = -ENOMEM;
  58. dev_err(&mc_bus_dev->dev,
  59. "Failed to allocate memory for fsl_mc_resource\n");
  60. goto out_unlock;
  61. }
  62. resource->type = pool_type;
  63. resource->id = mc_dev->obj_desc.id;
  64. resource->data = mc_dev;
  65. resource->parent_pool = res_pool;
  66. INIT_LIST_HEAD(&resource->node);
  67. list_add_tail(&resource->node, &res_pool->free_list);
  68. mc_dev->resource = resource;
  69. res_pool->free_count++;
  70. res_pool->max_count++;
  71. error = 0;
  72. out_unlock:
  73. mutex_unlock(&res_pool->mutex);
  74. out:
  75. return error;
  76. }
  77. /**
  78. * fsl_mc_resource_pool_remove_device - remove an allocatable device from a
  79. * resource pool
  80. *
  81. * @mc_dev: pointer to allocatable fsl-mc device
  82. *
  83. * It permanently removes an allocatable fsl-mc device from the resource
  84. * pool. It's an error if the device is in use.
  85. */
  86. static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
  87. *mc_dev)
  88. {
  89. struct fsl_mc_device *mc_bus_dev;
  90. struct fsl_mc_bus *mc_bus;
  91. struct fsl_mc_resource_pool *res_pool;
  92. struct fsl_mc_resource *resource;
  93. int error = -EINVAL;
  94. if (!fsl_mc_is_allocatable(mc_dev))
  95. goto out;
  96. resource = mc_dev->resource;
  97. if (!resource || resource->data != mc_dev)
  98. goto out;
  99. mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
  100. mc_bus = to_fsl_mc_bus(mc_bus_dev);
  101. res_pool = resource->parent_pool;
  102. if (res_pool != &mc_bus->resource_pools[resource->type])
  103. goto out;
  104. mutex_lock(&res_pool->mutex);
  105. if (res_pool->max_count <= 0)
  106. goto out_unlock;
  107. if (res_pool->free_count <= 0 ||
  108. res_pool->free_count > res_pool->max_count)
  109. goto out_unlock;
  110. /*
  111. * If the device is currently allocated, its resource is not
  112. * in the free list and thus, the device cannot be removed.
  113. */
  114. if (list_empty(&resource->node)) {
  115. error = -EBUSY;
  116. dev_err(&mc_bus_dev->dev,
  117. "Device %s cannot be removed from resource pool\n",
  118. dev_name(&mc_dev->dev));
  119. goto out_unlock;
  120. }
  121. list_del_init(&resource->node);
  122. res_pool->free_count--;
  123. res_pool->max_count--;
  124. devm_kfree(&mc_bus_dev->dev, resource);
  125. mc_dev->resource = NULL;
  126. error = 0;
  127. out_unlock:
  128. mutex_unlock(&res_pool->mutex);
  129. out:
  130. return error;
  131. }
  132. static const char *const fsl_mc_pool_type_strings[] = {
  133. [FSL_MC_POOL_DPMCP] = "dpmcp",
  134. [FSL_MC_POOL_DPBP] = "dpbp",
  135. [FSL_MC_POOL_DPCON] = "dpcon",
  136. [FSL_MC_POOL_IRQ] = "irq",
  137. };
  138. static int __must_check object_type_to_pool_type(const char *object_type,
  139. enum fsl_mc_pool_type
  140. *pool_type)
  141. {
  142. unsigned int i;
  143. for (i = 0; i < ARRAY_SIZE(fsl_mc_pool_type_strings); i++) {
  144. if (strcmp(object_type, fsl_mc_pool_type_strings[i]) == 0) {
  145. *pool_type = i;
  146. return 0;
  147. }
  148. }
  149. return -EINVAL;
  150. }
  151. int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
  152. enum fsl_mc_pool_type pool_type,
  153. struct fsl_mc_resource **new_resource)
  154. {
  155. struct fsl_mc_resource_pool *res_pool;
  156. struct fsl_mc_resource *resource;
  157. struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
  158. int error = -EINVAL;
  159. BUILD_BUG_ON(ARRAY_SIZE(fsl_mc_pool_type_strings) !=
  160. FSL_MC_NUM_POOL_TYPES);
  161. *new_resource = NULL;
  162. if (pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)
  163. goto out;
  164. res_pool = &mc_bus->resource_pools[pool_type];
  165. if (res_pool->mc_bus != mc_bus)
  166. goto out;
  167. mutex_lock(&res_pool->mutex);
  168. resource = list_first_entry_or_null(&res_pool->free_list,
  169. struct fsl_mc_resource, node);
  170. if (!resource) {
  171. error = -ENXIO;
  172. dev_err(&mc_bus_dev->dev,
  173. "No more resources of type %s left\n",
  174. fsl_mc_pool_type_strings[pool_type]);
  175. goto out_unlock;
  176. }
  177. if (resource->type != pool_type)
  178. goto out_unlock;
  179. if (resource->parent_pool != res_pool)
  180. goto out_unlock;
  181. if (res_pool->free_count <= 0 ||
  182. res_pool->free_count > res_pool->max_count)
  183. goto out_unlock;
  184. list_del_init(&resource->node);
  185. res_pool->free_count--;
  186. error = 0;
  187. out_unlock:
  188. mutex_unlock(&res_pool->mutex);
  189. *new_resource = resource;
  190. out:
  191. return error;
  192. }
  193. EXPORT_SYMBOL_GPL(fsl_mc_resource_allocate);
  194. void fsl_mc_resource_free(struct fsl_mc_resource *resource)
  195. {
  196. struct fsl_mc_resource_pool *res_pool;
  197. res_pool = resource->parent_pool;
  198. if (resource->type != res_pool->type)
  199. return;
  200. mutex_lock(&res_pool->mutex);
  201. if (res_pool->free_count < 0 ||
  202. res_pool->free_count >= res_pool->max_count)
  203. goto out_unlock;
  204. if (!list_empty(&resource->node))
  205. goto out_unlock;
  206. list_add_tail(&resource->node, &res_pool->free_list);
  207. res_pool->free_count++;
  208. out_unlock:
  209. mutex_unlock(&res_pool->mutex);
  210. }
  211. EXPORT_SYMBOL_GPL(fsl_mc_resource_free);
  212. /**
  213. * fsl_mc_object_allocate - Allocates an fsl-mc object of the given
  214. * pool type from a given fsl-mc bus instance
  215. *
  216. * @mc_dev: fsl-mc device which is used in conjunction with the
  217. * allocated object
  218. * @pool_type: pool type
  219. * @new_mc_adev: pointer to area where the pointer to the allocated device
  220. * is to be returned
  221. *
  222. * Allocatable objects are always used in conjunction with some functional
  223. * device. This function allocates an object of the specified type from
  224. * the DPRC containing the functional device.
  225. *
  226. * NOTE: pool_type must be different from FSL_MC_POOL_MCP, since MC
  227. * portals are allocated using fsl_mc_portal_allocate(), instead of
  228. * this function.
  229. */
  230. int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev,
  231. enum fsl_mc_pool_type pool_type,
  232. struct fsl_mc_device **new_mc_adev)
  233. {
  234. struct fsl_mc_device *mc_bus_dev;
  235. struct fsl_mc_bus *mc_bus;
  236. struct fsl_mc_device *mc_adev;
  237. int error = -EINVAL;
  238. struct fsl_mc_resource *resource = NULL;
  239. *new_mc_adev = NULL;
  240. if (mc_dev->flags & FSL_MC_IS_DPRC)
  241. goto error;
  242. if (!dev_is_fsl_mc(mc_dev->dev.parent))
  243. goto error;
  244. if (pool_type == FSL_MC_POOL_DPMCP)
  245. goto error;
  246. mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
  247. mc_bus = to_fsl_mc_bus(mc_bus_dev);
  248. error = fsl_mc_resource_allocate(mc_bus, pool_type, &resource);
  249. if (error < 0)
  250. goto error;
  251. mc_adev = resource->data;
  252. if (!mc_adev) {
  253. error = -EINVAL;
  254. goto error;
  255. }
  256. mc_adev->consumer_link = device_link_add(&mc_dev->dev,
  257. &mc_adev->dev,
  258. DL_FLAG_AUTOREMOVE_CONSUMER);
  259. if (!mc_adev->consumer_link) {
  260. error = -EINVAL;
  261. goto error;
  262. }
  263. *new_mc_adev = mc_adev;
  264. return 0;
  265. error:
  266. if (resource)
  267. fsl_mc_resource_free(resource);
  268. return error;
  269. }
  270. EXPORT_SYMBOL_GPL(fsl_mc_object_allocate);
  271. /**
  272. * fsl_mc_object_free - Returns an fsl-mc object to the resource
  273. * pool where it came from.
  274. * @mc_adev: Pointer to the fsl-mc device
  275. */
  276. void fsl_mc_object_free(struct fsl_mc_device *mc_adev)
  277. {
  278. struct fsl_mc_resource *resource;
  279. resource = mc_adev->resource;
  280. if (resource->type == FSL_MC_POOL_DPMCP)
  281. return;
  282. if (resource->data != mc_adev)
  283. return;
  284. fsl_mc_resource_free(resource);
  285. mc_adev->consumer_link = NULL;
  286. }
  287. EXPORT_SYMBOL_GPL(fsl_mc_object_free);
  288. /*
  289. * A DPRC and the devices in the DPRC all share the same GIC-ITS device
  290. * ID. A block of IRQs is pre-allocated and maintained in a pool
  291. * from which devices can allocate them when needed.
  292. */
  293. /*
  294. * Initialize the interrupt pool associated with an fsl-mc bus.
  295. * It allocates a block of IRQs from the GIC-ITS.
  296. */
  297. int fsl_mc_populate_irq_pool(struct fsl_mc_device *mc_bus_dev,
  298. unsigned int irq_count)
  299. {
  300. unsigned int i;
  301. struct fsl_mc_device_irq *irq_resources;
  302. struct fsl_mc_device_irq *mc_dev_irq;
  303. int error;
  304. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  305. struct fsl_mc_resource_pool *res_pool =
  306. &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  307. /* do nothing if the IRQ pool is already populated */
  308. if (mc_bus->irq_resources)
  309. return 0;
  310. if (irq_count == 0 ||
  311. irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS)
  312. return -EINVAL;
  313. error = fsl_mc_msi_domain_alloc_irqs(&mc_bus_dev->dev, irq_count);
  314. if (error < 0)
  315. return error;
  316. irq_resources = devm_kcalloc(&mc_bus_dev->dev,
  317. irq_count, sizeof(*irq_resources),
  318. GFP_KERNEL);
  319. if (!irq_resources) {
  320. error = -ENOMEM;
  321. goto cleanup_msi_irqs;
  322. }
  323. for (i = 0; i < irq_count; i++) {
  324. mc_dev_irq = &irq_resources[i];
  325. /*
  326. * NOTE: This mc_dev_irq's MSI addr/value pair will be set
  327. * by the fsl_mc_msi_write_msg() callback
  328. */
  329. mc_dev_irq->resource.type = res_pool->type;
  330. mc_dev_irq->resource.data = mc_dev_irq;
  331. mc_dev_irq->resource.parent_pool = res_pool;
  332. mc_dev_irq->virq = msi_get_virq(&mc_bus_dev->dev, i);
  333. mc_dev_irq->resource.id = mc_dev_irq->virq;
  334. INIT_LIST_HEAD(&mc_dev_irq->resource.node);
  335. list_add_tail(&mc_dev_irq->resource.node, &res_pool->free_list);
  336. }
  337. res_pool->max_count = irq_count;
  338. res_pool->free_count = irq_count;
  339. mc_bus->irq_resources = irq_resources;
  340. return 0;
  341. cleanup_msi_irqs:
  342. fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
  343. return error;
  344. }
  345. EXPORT_SYMBOL_GPL(fsl_mc_populate_irq_pool);
  346. /*
  347. * Teardown the interrupt pool associated with an fsl-mc bus.
  348. * It frees the IRQs that were allocated to the pool, back to the GIC-ITS.
  349. */
  350. void fsl_mc_cleanup_irq_pool(struct fsl_mc_device *mc_bus_dev)
  351. {
  352. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  353. struct fsl_mc_resource_pool *res_pool =
  354. &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  355. if (!mc_bus->irq_resources)
  356. return;
  357. if (res_pool->max_count == 0)
  358. return;
  359. if (res_pool->free_count != res_pool->max_count)
  360. return;
  361. INIT_LIST_HEAD(&res_pool->free_list);
  362. res_pool->max_count = 0;
  363. res_pool->free_count = 0;
  364. mc_bus->irq_resources = NULL;
  365. fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
  366. }
  367. EXPORT_SYMBOL_GPL(fsl_mc_cleanup_irq_pool);
  368. /*
  369. * Allocate the IRQs required by a given fsl-mc device.
  370. */
  371. int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev)
  372. {
  373. int i;
  374. int irq_count;
  375. int res_allocated_count = 0;
  376. int error = -EINVAL;
  377. struct fsl_mc_device_irq **irqs = NULL;
  378. struct fsl_mc_bus *mc_bus;
  379. struct fsl_mc_resource_pool *res_pool;
  380. if (mc_dev->irqs)
  381. return -EINVAL;
  382. irq_count = mc_dev->obj_desc.irq_count;
  383. if (irq_count == 0)
  384. return -EINVAL;
  385. if (is_fsl_mc_bus_dprc(mc_dev))
  386. mc_bus = to_fsl_mc_bus(mc_dev);
  387. else
  388. mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent));
  389. if (!mc_bus->irq_resources)
  390. return -EINVAL;
  391. res_pool = &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  392. if (res_pool->free_count < irq_count) {
  393. dev_err(&mc_dev->dev,
  394. "Not able to allocate %u irqs for device\n", irq_count);
  395. return -ENOSPC;
  396. }
  397. irqs = devm_kcalloc(&mc_dev->dev, irq_count, sizeof(irqs[0]),
  398. GFP_KERNEL);
  399. if (!irqs)
  400. return -ENOMEM;
  401. for (i = 0; i < irq_count; i++) {
  402. struct fsl_mc_resource *resource;
  403. error = fsl_mc_resource_allocate(mc_bus, FSL_MC_POOL_IRQ,
  404. &resource);
  405. if (error < 0)
  406. goto error_resource_alloc;
  407. irqs[i] = to_fsl_mc_irq(resource);
  408. res_allocated_count++;
  409. irqs[i]->mc_dev = mc_dev;
  410. irqs[i]->dev_irq_index = i;
  411. }
  412. mc_dev->irqs = irqs;
  413. return 0;
  414. error_resource_alloc:
  415. for (i = 0; i < res_allocated_count; i++) {
  416. irqs[i]->mc_dev = NULL;
  417. fsl_mc_resource_free(&irqs[i]->resource);
  418. }
  419. return error;
  420. }
  421. EXPORT_SYMBOL_GPL(fsl_mc_allocate_irqs);
  422. /*
  423. * Frees the IRQs that were allocated for an fsl-mc device.
  424. */
  425. void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev)
  426. {
  427. int i;
  428. int irq_count;
  429. struct fsl_mc_bus *mc_bus;
  430. struct fsl_mc_device_irq **irqs = mc_dev->irqs;
  431. if (!irqs)
  432. return;
  433. irq_count = mc_dev->obj_desc.irq_count;
  434. if (is_fsl_mc_bus_dprc(mc_dev))
  435. mc_bus = to_fsl_mc_bus(mc_dev);
  436. else
  437. mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent));
  438. if (!mc_bus->irq_resources)
  439. return;
  440. for (i = 0; i < irq_count; i++) {
  441. irqs[i]->mc_dev = NULL;
  442. fsl_mc_resource_free(&irqs[i]->resource);
  443. }
  444. mc_dev->irqs = NULL;
  445. }
  446. EXPORT_SYMBOL_GPL(fsl_mc_free_irqs);
  447. void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
  448. {
  449. int pool_type;
  450. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  451. for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++) {
  452. struct fsl_mc_resource_pool *res_pool =
  453. &mc_bus->resource_pools[pool_type];
  454. res_pool->type = pool_type;
  455. res_pool->max_count = 0;
  456. res_pool->free_count = 0;
  457. res_pool->mc_bus = mc_bus;
  458. INIT_LIST_HEAD(&res_pool->free_list);
  459. mutex_init(&res_pool->mutex);
  460. }
  461. }
  462. static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
  463. enum fsl_mc_pool_type pool_type)
  464. {
  465. struct fsl_mc_resource *resource;
  466. struct fsl_mc_resource *next;
  467. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  468. struct fsl_mc_resource_pool *res_pool =
  469. &mc_bus->resource_pools[pool_type];
  470. int free_count = 0;
  471. list_for_each_entry_safe(resource, next, &res_pool->free_list, node) {
  472. free_count++;
  473. devm_kfree(&mc_bus_dev->dev, resource);
  474. }
  475. }
  476. void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
  477. {
  478. int pool_type;
  479. for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++)
  480. fsl_mc_cleanup_resource_pool(mc_bus_dev, pool_type);
  481. }
  482. /*
  483. * fsl_mc_allocator_probe - callback invoked when an allocatable device is
  484. * being added to the system
  485. */
  486. static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
  487. {
  488. enum fsl_mc_pool_type pool_type;
  489. struct fsl_mc_device *mc_bus_dev;
  490. struct fsl_mc_bus *mc_bus;
  491. int error;
  492. if (!fsl_mc_is_allocatable(mc_dev))
  493. return -EINVAL;
  494. mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
  495. if (!dev_is_fsl_mc(&mc_bus_dev->dev))
  496. return -EINVAL;
  497. mc_bus = to_fsl_mc_bus(mc_bus_dev);
  498. error = object_type_to_pool_type(mc_dev->obj_desc.type, &pool_type);
  499. if (error < 0)
  500. return error;
  501. error = fsl_mc_resource_pool_add_device(mc_bus, pool_type, mc_dev);
  502. if (error < 0)
  503. return error;
  504. dev_dbg(&mc_dev->dev,
  505. "Allocatable fsl-mc device bound to fsl_mc_allocator driver");
  506. return 0;
  507. }
  508. /*
  509. * fsl_mc_allocator_remove - callback invoked when an allocatable device is
  510. * being removed from the system
  511. */
  512. static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
  513. {
  514. int error;
  515. if (!fsl_mc_is_allocatable(mc_dev))
  516. return -EINVAL;
  517. if (mc_dev->resource) {
  518. error = fsl_mc_resource_pool_remove_device(mc_dev);
  519. if (error < 0)
  520. return error;
  521. }
  522. dev_dbg(&mc_dev->dev,
  523. "Allocatable fsl-mc device unbound from fsl_mc_allocator driver");
  524. return 0;
  525. }
  526. static const struct fsl_mc_device_id match_id_table[] = {
  527. {
  528. .vendor = FSL_MC_VENDOR_FREESCALE,
  529. .obj_type = "dpbp",
  530. },
  531. {
  532. .vendor = FSL_MC_VENDOR_FREESCALE,
  533. .obj_type = "dpmcp",
  534. },
  535. {
  536. .vendor = FSL_MC_VENDOR_FREESCALE,
  537. .obj_type = "dpcon",
  538. },
  539. {.vendor = 0x0},
  540. };
  541. static struct fsl_mc_driver fsl_mc_allocator_driver = {
  542. .driver = {
  543. .name = "fsl_mc_allocator",
  544. .pm = NULL,
  545. },
  546. .match_id_table = match_id_table,
  547. .probe = fsl_mc_allocator_probe,
  548. .remove = fsl_mc_allocator_remove,
  549. };
  550. int __init fsl_mc_allocator_driver_init(void)
  551. {
  552. return fsl_mc_driver_register(&fsl_mc_allocator_driver);
  553. }
  554. void fsl_mc_allocator_driver_exit(void)
  555. {
  556. fsl_mc_driver_unregister(&fsl_mc_allocator_driver);
  557. }