fsl-mc-private.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Freescale Management Complex (MC) bus private declarations
  4. *
  5. * Copyright (C) 2016 Freescale Semiconductor, Inc.
  6. *
  7. */
  8. #ifndef _FSL_MC_PRIVATE_H_
  9. #define _FSL_MC_PRIVATE_H_
  10. #include <linux/fsl/mc.h>
  11. #include <linux/mutex.h>
  12. #include <linux/ioctl.h>
  13. #include <linux/miscdevice.h>
  14. /*
  15. * Data Path Management Complex (DPMNG) General API
  16. */
  17. /* DPMNG command versioning */
  18. #define DPMNG_CMD_BASE_VERSION 1
  19. #define DPMNG_CMD_ID_OFFSET 4
  20. #define DPMNG_CMD(id) (((id) << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION)
  21. /* DPMNG command IDs */
  22. #define DPMNG_CMDID_GET_VERSION DPMNG_CMD(0x831)
  23. struct dpmng_rsp_get_version {
  24. __le32 revision;
  25. __le32 version_major;
  26. __le32 version_minor;
  27. };
  28. /*
  29. * Data Path Management Command Portal (DPMCP) API
  30. */
  31. /* Minimal supported DPMCP Version */
  32. #define DPMCP_MIN_VER_MAJOR 3
  33. #define DPMCP_MIN_VER_MINOR 0
  34. /* DPMCP command versioning */
  35. #define DPMCP_CMD_BASE_VERSION 1
  36. #define DPMCP_CMD_ID_OFFSET 4
  37. #define DPMCP_CMD(id) (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
  38. /* DPMCP command IDs */
  39. #define DPMCP_CMDID_CLOSE DPMCP_CMD(0x800)
  40. #define DPMCP_CMDID_RESET DPMCP_CMD(0x005)
  41. struct dpmcp_cmd_open {
  42. __le32 dpmcp_id;
  43. };
  44. /*
  45. * Initialization and runtime control APIs for DPMCP
  46. */
  47. int dpmcp_open(struct fsl_mc_io *mc_io,
  48. u32 cmd_flags,
  49. int dpmcp_id,
  50. u16 *token);
  51. int dpmcp_close(struct fsl_mc_io *mc_io,
  52. u32 cmd_flags,
  53. u16 token);
  54. int dpmcp_reset(struct fsl_mc_io *mc_io,
  55. u32 cmd_flags,
  56. u16 token);
  57. /*
  58. * Data Path Resource Container (DPRC) API
  59. */
  60. /* Minimal supported DPRC Version */
  61. #define DPRC_MIN_VER_MAJOR 6
  62. #define DPRC_MIN_VER_MINOR 0
  63. /* DPRC command versioning */
  64. #define DPRC_CMD_BASE_VERSION 1
  65. #define DPRC_CMD_2ND_VERSION 2
  66. #define DPRC_CMD_3RD_VERSION 3
  67. #define DPRC_CMD_ID_OFFSET 4
  68. #define DPRC_CMD(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
  69. #define DPRC_CMD_V2(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION)
  70. #define DPRC_CMD_V3(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_3RD_VERSION)
  71. /* DPRC command IDs */
  72. #define DPRC_CMDID_CLOSE DPRC_CMD(0x800)
  73. #define DPRC_CMDID_GET_API_VERSION DPRC_CMD(0xa05)
  74. #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
  75. #define DPRC_CMDID_RESET_CONT DPRC_CMD(0x005)
  76. #define DPRC_CMDID_RESET_CONT_V2 DPRC_CMD_V2(0x005)
  77. #define DPRC_CMDID_SET_IRQ DPRC_CMD(0x010)
  78. #define DPRC_CMDID_SET_IRQ_ENABLE DPRC_CMD(0x012)
  79. #define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
  80. #define DPRC_CMDID_GET_IRQ_STATUS DPRC_CMD(0x016)
  81. #define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
  82. #define DPRC_CMDID_GET_CONT_ID DPRC_CMD(0x830)
  83. #define DPRC_CMDID_GET_OBJ_COUNT DPRC_CMD(0x159)
  84. #define DPRC_CMDID_GET_OBJ DPRC_CMD(0x15A)
  85. #define DPRC_CMDID_GET_OBJ_REG DPRC_CMD(0x15E)
  86. #define DPRC_CMDID_GET_OBJ_REG_V2 DPRC_CMD_V2(0x15E)
  87. #define DPRC_CMDID_GET_OBJ_REG_V3 DPRC_CMD_V3(0x15E)
  88. #define DPRC_CMDID_SET_OBJ_IRQ DPRC_CMD(0x15F)
  89. #define DPRC_CMDID_GET_CONNECTION DPRC_CMD(0x16C)
  90. struct dprc_cmd_open {
  91. __le32 container_id;
  92. };
  93. struct dprc_cmd_reset_container {
  94. __le32 child_container_id;
  95. __le32 options;
  96. };
  97. struct dprc_cmd_set_irq {
  98. /* cmd word 0 */
  99. __le32 irq_val;
  100. u8 irq_index;
  101. u8 pad[3];
  102. /* cmd word 1 */
  103. __le64 irq_addr;
  104. /* cmd word 2 */
  105. __le32 irq_num;
  106. };
  107. #define DPRC_ENABLE 0x1
  108. struct dprc_cmd_set_irq_enable {
  109. u8 enable;
  110. u8 pad[3];
  111. u8 irq_index;
  112. };
  113. struct dprc_cmd_set_irq_mask {
  114. __le32 mask;
  115. u8 irq_index;
  116. };
  117. struct dprc_cmd_get_irq_status {
  118. __le32 status;
  119. u8 irq_index;
  120. };
  121. struct dprc_rsp_get_irq_status {
  122. __le32 status;
  123. };
  124. struct dprc_cmd_clear_irq_status {
  125. __le32 status;
  126. u8 irq_index;
  127. };
  128. struct dprc_rsp_get_attributes {
  129. /* response word 0 */
  130. __le32 container_id;
  131. __le32 icid;
  132. /* response word 1 */
  133. __le32 options;
  134. __le32 portal_id;
  135. };
  136. struct dprc_rsp_get_obj_count {
  137. __le32 pad;
  138. __le32 obj_count;
  139. };
  140. struct dprc_cmd_get_obj {
  141. __le32 obj_index;
  142. };
  143. struct dprc_rsp_get_obj {
  144. /* response word 0 */
  145. __le32 pad0;
  146. __le32 id;
  147. /* response word 1 */
  148. __le16 vendor;
  149. u8 irq_count;
  150. u8 region_count;
  151. __le32 state;
  152. /* response word 2 */
  153. __le16 version_major;
  154. __le16 version_minor;
  155. __le16 flags;
  156. __le16 pad1;
  157. /* response word 3-4 */
  158. u8 type[16];
  159. /* response word 5-6 */
  160. u8 label[16];
  161. };
  162. struct dprc_cmd_get_obj_region {
  163. /* cmd word 0 */
  164. __le32 obj_id;
  165. __le16 pad0;
  166. u8 region_index;
  167. u8 pad1;
  168. /* cmd word 1-2 */
  169. __le64 pad2[2];
  170. /* cmd word 3-4 */
  171. u8 obj_type[16];
  172. };
  173. struct dprc_rsp_get_obj_region {
  174. /* response word 0 */
  175. __le64 pad0;
  176. /* response word 1 */
  177. __le64 base_offset;
  178. /* response word 2 */
  179. __le32 size;
  180. u8 type;
  181. u8 pad2[3];
  182. /* response word 3 */
  183. __le32 flags;
  184. __le32 pad3;
  185. /* response word 4 */
  186. /* base_addr may be zero if older MC firmware is used */
  187. __le64 base_addr;
  188. };
  189. struct dprc_cmd_set_obj_irq {
  190. /* cmd word 0 */
  191. __le32 irq_val;
  192. u8 irq_index;
  193. u8 pad[3];
  194. /* cmd word 1 */
  195. __le64 irq_addr;
  196. /* cmd word 2 */
  197. __le32 irq_num;
  198. __le32 obj_id;
  199. /* cmd word 3-4 */
  200. u8 obj_type[16];
  201. };
  202. struct dprc_cmd_get_connection {
  203. __le32 ep1_id;
  204. __le16 ep1_interface_id;
  205. u8 pad[2];
  206. u8 ep1_type[16];
  207. };
  208. struct dprc_rsp_get_connection {
  209. __le64 pad[3];
  210. __le32 ep2_id;
  211. __le16 ep2_interface_id;
  212. __le16 pad1;
  213. u8 ep2_type[16];
  214. __le32 state;
  215. };
  216. /*
  217. * DPRC API for managing and querying DPAA resources
  218. */
  219. int dprc_open(struct fsl_mc_io *mc_io,
  220. u32 cmd_flags,
  221. int container_id,
  222. u16 *token);
  223. int dprc_close(struct fsl_mc_io *mc_io,
  224. u32 cmd_flags,
  225. u16 token);
  226. /* DPRC IRQ events */
  227. /* IRQ event - Indicates that a new object added to the container */
  228. #define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001
  229. /* IRQ event - Indicates that an object was removed from the container */
  230. #define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002
  231. /*
  232. * IRQ event - Indicates that one of the descendant containers that opened by
  233. * this container is destroyed
  234. */
  235. #define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010
  236. /*
  237. * IRQ event - Indicates that on one of the container's opened object is
  238. * destroyed
  239. */
  240. #define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020
  241. /* Irq event - Indicates that object is created at the container */
  242. #define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040
  243. /**
  244. * struct dprc_irq_cfg - IRQ configuration
  245. * @paddr: Address that must be written to signal a message-based interrupt
  246. * @val: Value to write into irq_addr address
  247. * @irq_num: A user defined number associated with this IRQ
  248. */
  249. struct dprc_irq_cfg {
  250. phys_addr_t paddr;
  251. u32 val;
  252. int irq_num;
  253. };
  254. int dprc_set_irq(struct fsl_mc_io *mc_io,
  255. u32 cmd_flags,
  256. u16 token,
  257. u8 irq_index,
  258. struct dprc_irq_cfg *irq_cfg);
  259. int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
  260. u32 cmd_flags,
  261. u16 token,
  262. u8 irq_index,
  263. u8 en);
  264. int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
  265. u32 cmd_flags,
  266. u16 token,
  267. u8 irq_index,
  268. u32 mask);
  269. int dprc_get_irq_status(struct fsl_mc_io *mc_io,
  270. u32 cmd_flags,
  271. u16 token,
  272. u8 irq_index,
  273. u32 *status);
  274. int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
  275. u32 cmd_flags,
  276. u16 token,
  277. u8 irq_index,
  278. u32 status);
  279. /**
  280. * struct dprc_attributes - Container attributes
  281. * @container_id: Container's ID
  282. * @icid: Container's ICID
  283. * @portal_id: Container's portal ID
  284. * @options: Container's options as set at container's creation
  285. */
  286. struct dprc_attributes {
  287. int container_id;
  288. u32 icid;
  289. int portal_id;
  290. u64 options;
  291. };
  292. int dprc_get_attributes(struct fsl_mc_io *mc_io,
  293. u32 cmd_flags,
  294. u16 token,
  295. struct dprc_attributes *attributes);
  296. int dprc_get_obj_count(struct fsl_mc_io *mc_io,
  297. u32 cmd_flags,
  298. u16 token,
  299. int *obj_count);
  300. int dprc_get_obj(struct fsl_mc_io *mc_io,
  301. u32 cmd_flags,
  302. u16 token,
  303. int obj_index,
  304. struct fsl_mc_obj_desc *obj_desc);
  305. int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
  306. u32 cmd_flags,
  307. u16 token,
  308. char *obj_type,
  309. int obj_id,
  310. u8 irq_index,
  311. struct dprc_irq_cfg *irq_cfg);
  312. /**
  313. * enum dprc_region_type - Region type
  314. * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
  315. * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region
  316. */
  317. enum dprc_region_type {
  318. DPRC_REGION_TYPE_MC_PORTAL,
  319. DPRC_REGION_TYPE_QBMAN_PORTAL,
  320. DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL
  321. };
  322. /**
  323. * struct dprc_region_desc - Mappable region descriptor
  324. * @base_offset: Region offset from region's base address.
  325. * For DPMCP and DPRC objects, region base is offset from SoC MC portals
  326. * base address; For DPIO, region base is offset from SoC QMan portals
  327. * base address
  328. * @size: Region size (in bytes)
  329. * @flags: Region attributes
  330. * @type: Portal region type
  331. */
  332. struct dprc_region_desc {
  333. u32 base_offset;
  334. u32 size;
  335. u32 flags;
  336. enum dprc_region_type type;
  337. u64 base_address;
  338. };
  339. int dprc_get_obj_region(struct fsl_mc_io *mc_io,
  340. u32 cmd_flags,
  341. u16 token,
  342. char *obj_type,
  343. int obj_id,
  344. u8 region_index,
  345. struct dprc_region_desc *region_desc);
  346. int dprc_get_api_version(struct fsl_mc_io *mc_io,
  347. u32 cmd_flags,
  348. u16 *major_ver,
  349. u16 *minor_ver);
  350. int dprc_get_container_id(struct fsl_mc_io *mc_io,
  351. u32 cmd_flags,
  352. int *container_id);
  353. /**
  354. * struct dprc_endpoint - Endpoint description for link connect/disconnect
  355. * operations
  356. * @type: Endpoint object type: NULL terminated string
  357. * @id: Endpoint object ID
  358. * @if_id: Interface ID; should be set for endpoints with multiple
  359. * interfaces ("dpsw", "dpdmux"); for others, always set to 0
  360. */
  361. struct dprc_endpoint {
  362. char type[16];
  363. int id;
  364. u16 if_id;
  365. };
  366. int dprc_get_connection(struct fsl_mc_io *mc_io,
  367. u32 cmd_flags,
  368. u16 token,
  369. const struct dprc_endpoint *endpoint1,
  370. struct dprc_endpoint *endpoint2,
  371. int *state);
  372. /*
  373. * Data Path Buffer Pool (DPBP) API
  374. */
  375. /* DPBP Version */
  376. #define DPBP_VER_MAJOR 3
  377. #define DPBP_VER_MINOR 2
  378. /* Command versioning */
  379. #define DPBP_CMD_BASE_VERSION 1
  380. #define DPBP_CMD_ID_OFFSET 4
  381. #define DPBP_CMD(id) (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
  382. /* Command IDs */
  383. #define DPBP_CMDID_CLOSE DPBP_CMD(0x800)
  384. #define DPBP_CMDID_ENABLE DPBP_CMD(0x002)
  385. #define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
  386. #define DPBP_CMDID_GET_ATTR DPBP_CMD(0x004)
  387. #define DPBP_CMDID_RESET DPBP_CMD(0x005)
  388. struct dpbp_cmd_open {
  389. __le32 dpbp_id;
  390. };
  391. #define DPBP_ENABLE 0x1
  392. struct dpbp_rsp_get_attributes {
  393. /* response word 0 */
  394. __le16 pad;
  395. __le16 bpid;
  396. __le32 id;
  397. /* response word 1 */
  398. __le16 version_major;
  399. __le16 version_minor;
  400. };
  401. /*
  402. * Data Path Concentrator (DPCON) API
  403. */
  404. /* DPCON Version */
  405. #define DPCON_VER_MAJOR 3
  406. #define DPCON_VER_MINOR 2
  407. /* Command versioning */
  408. #define DPCON_CMD_BASE_VERSION 1
  409. #define DPCON_CMD_ID_OFFSET 4
  410. #define DPCON_CMD(id) (((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
  411. /* Command IDs */
  412. #define DPCON_CMDID_CLOSE DPCON_CMD(0x800)
  413. #define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
  414. #define DPCON_CMDID_DISABLE DPCON_CMD(0x003)
  415. #define DPCON_CMDID_GET_ATTR DPCON_CMD(0x004)
  416. #define DPCON_CMDID_RESET DPCON_CMD(0x005)
  417. #define DPCON_CMDID_SET_NOTIFICATION DPCON_CMD(0x100)
  418. struct dpcon_cmd_open {
  419. __le32 dpcon_id;
  420. };
  421. #define DPCON_ENABLE 1
  422. struct dpcon_rsp_get_attr {
  423. /* response word 0 */
  424. __le32 id;
  425. __le16 qbman_ch_id;
  426. u8 num_priorities;
  427. u8 pad;
  428. };
  429. struct dpcon_cmd_set_notification {
  430. /* cmd word 0 */
  431. __le32 dpio_id;
  432. u8 priority;
  433. u8 pad[3];
  434. /* cmd word 1 */
  435. __le64 user_ctx;
  436. };
  437. /*
  438. * Generic FSL MC API
  439. */
  440. /* generic command versioning */
  441. #define OBJ_CMD_BASE_VERSION 1
  442. #define OBJ_CMD_ID_OFFSET 4
  443. #define OBJ_CMD(id) (((id) << OBJ_CMD_ID_OFFSET) | OBJ_CMD_BASE_VERSION)
  444. /* open command codes */
  445. #define DPRTC_CMDID_OPEN OBJ_CMD(0x810)
  446. #define DPNI_CMDID_OPEN OBJ_CMD(0x801)
  447. #define DPSW_CMDID_OPEN OBJ_CMD(0x802)
  448. #define DPIO_CMDID_OPEN OBJ_CMD(0x803)
  449. #define DPBP_CMDID_OPEN OBJ_CMD(0x804)
  450. #define DPRC_CMDID_OPEN OBJ_CMD(0x805)
  451. #define DPDMUX_CMDID_OPEN OBJ_CMD(0x806)
  452. #define DPCI_CMDID_OPEN OBJ_CMD(0x807)
  453. #define DPCON_CMDID_OPEN OBJ_CMD(0x808)
  454. #define DPSECI_CMDID_OPEN OBJ_CMD(0x809)
  455. #define DPAIOP_CMDID_OPEN OBJ_CMD(0x80a)
  456. #define DPMCP_CMDID_OPEN OBJ_CMD(0x80b)
  457. #define DPMAC_CMDID_OPEN OBJ_CMD(0x80c)
  458. #define DPDCEI_CMDID_OPEN OBJ_CMD(0x80d)
  459. #define DPDMAI_CMDID_OPEN OBJ_CMD(0x80e)
  460. #define DPDBG_CMDID_OPEN OBJ_CMD(0x80f)
  461. /* Generic object command IDs */
  462. #define OBJ_CMDID_CLOSE OBJ_CMD(0x800)
  463. #define OBJ_CMDID_RESET OBJ_CMD(0x005)
  464. struct fsl_mc_obj_cmd_open {
  465. __le32 obj_id;
  466. };
  467. /**
  468. * struct fsl_mc_resource_pool - Pool of MC resources of a given
  469. * type
  470. * @type: type of resources in the pool
  471. * @max_count: maximum number of resources in the pool
  472. * @free_count: number of free resources in the pool
  473. * @mutex: mutex to serialize access to the pool's free list
  474. * @free_list: anchor node of list of free resources in the pool
  475. * @mc_bus: pointer to the MC bus that owns this resource pool
  476. */
  477. struct fsl_mc_resource_pool {
  478. enum fsl_mc_pool_type type;
  479. int max_count;
  480. int free_count;
  481. struct mutex mutex; /* serializes access to free_list */
  482. struct list_head free_list;
  483. struct fsl_mc_bus *mc_bus;
  484. };
  485. /**
  486. * struct fsl_mc_uapi - information associated with a device file
  487. * @misc: struct miscdevice linked to the root dprc
  488. * @device: newly created device in /dev
  489. * @mutex: mutex lock to serialize the open/release operations
  490. * @local_instance_in_use: local MC I/O instance in use or not
  491. * @static_mc_io: pointer to the static MC I/O object
  492. */
  493. struct fsl_mc_uapi {
  494. struct miscdevice misc;
  495. struct device *device;
  496. struct mutex mutex; /* serialize open/release operations */
  497. u32 local_instance_in_use;
  498. struct fsl_mc_io *static_mc_io;
  499. };
  500. /**
  501. * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC
  502. * @mc_dev: fsl-mc device for the bus device itself.
  503. * @resource_pools: array of resource pools (one pool per resource type)
  504. * for this MC bus. These resources represent allocatable entities
  505. * from the physical DPRC.
  506. * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
  507. * @scan_mutex: Serializes bus scanning
  508. * @dprc_attr: DPRC attributes
  509. * @uapi_misc: struct that abstracts the interaction with userspace
  510. */
  511. struct fsl_mc_bus {
  512. struct fsl_mc_device mc_dev;
  513. struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
  514. struct fsl_mc_device_irq *irq_resources;
  515. struct mutex scan_mutex; /* serializes bus scanning */
  516. struct dprc_attributes dprc_attr;
  517. struct fsl_mc_uapi uapi_misc;
  518. int irq_enabled;
  519. };
  520. #define to_fsl_mc_bus(_mc_dev) \
  521. container_of(_mc_dev, struct fsl_mc_bus, mc_dev)
  522. int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
  523. struct fsl_mc_io *mc_io,
  524. struct device *parent_dev,
  525. struct fsl_mc_device **new_mc_dev);
  526. void fsl_mc_device_remove(struct fsl_mc_device *mc_dev);
  527. int __init dprc_driver_init(void);
  528. void dprc_driver_exit(void);
  529. int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
  530. bool alloc_interrupts);
  531. int __init fsl_mc_allocator_driver_init(void);
  532. void fsl_mc_allocator_driver_exit(void);
  533. void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
  534. void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
  535. int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
  536. enum fsl_mc_pool_type pool_type,
  537. struct fsl_mc_resource
  538. **new_resource);
  539. void fsl_mc_resource_free(struct fsl_mc_resource *resource);
  540. int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
  541. unsigned int irq_count);
  542. void fsl_mc_msi_domain_free_irqs(struct device *dev);
  543. struct irq_domain *fsl_mc_find_msi_domain(struct device *dev);
  544. int __must_check fsl_create_mc_io(struct device *dev,
  545. phys_addr_t mc_portal_phys_addr,
  546. u32 mc_portal_size,
  547. struct fsl_mc_device *dpmcp_dev,
  548. u32 flags, struct fsl_mc_io **new_mc_io);
  549. void fsl_destroy_mc_io(struct fsl_mc_io *mc_io);
  550. bool fsl_mc_is_root_dprc(struct device *dev);
  551. void fsl_mc_get_root_dprc(struct device *dev,
  552. struct device **root_dprc_dev);
  553. struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc,
  554. struct fsl_mc_device *mc_bus_dev);
  555. u16 mc_cmd_hdr_read_cmdid(struct fsl_mc_command *cmd);
  556. #ifdef CONFIG_FSL_MC_UAPI_SUPPORT
  557. int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus);
  558. void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus);
  559. #else
  560. static inline int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus)
  561. {
  562. return 0;
  563. }
  564. static inline void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus)
  565. {
  566. }
  567. #endif
  568. int disable_dprc_irq(struct fsl_mc_device *mc_dev);
  569. int enable_dprc_irq(struct fsl_mc_device *mc_dev);
  570. int get_dprc_irq_state(struct fsl_mc_device *mc_dev);
  571. #endif /* _FSL_MC_PRIVATE_H_ */