bman_priv.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Copyright 2008 - 2016 Freescale Semiconductor, Inc.
  2. *
  3. * Redistribution and use in source and binary forms, with or without
  4. * modification, are permitted provided that the following conditions are met:
  5. * * Redistributions of source code must retain the above copyright
  6. * notice, this list of conditions and the following disclaimer.
  7. * * Redistributions in binary form must reproduce the above copyright
  8. * notice, this list of conditions and the following disclaimer in the
  9. * documentation and/or other materials provided with the distribution.
  10. * * Neither the name of Freescale Semiconductor nor the
  11. * names of its contributors may be used to endorse or promote products
  12. * derived from this software without specific prior written permission.
  13. *
  14. * ALTERNATIVELY, this software may be distributed under the terms of the
  15. * GNU General Public License ("GPL") as published by the Free Software
  16. * Foundation, either version 2 of that License or (at your option) any
  17. * later version.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
  20. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
  23. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  31. #include "dpaa_sys.h"
  32. #include <soc/fsl/bman.h>
  33. /* Portal processing (interrupt) sources */
  34. #define BM_PIRQ_RCRI 0x00000002 /* RCR Ring (below threshold) */
  35. /* Revision info (for errata and feature handling) */
  36. #define BMAN_REV10 0x0100
  37. #define BMAN_REV20 0x0200
  38. #define BMAN_REV21 0x0201
  39. extern u16 bman_ip_rev; /* 0 if uninitialised, otherwise BMAN_REVx */
  40. extern struct gen_pool *bm_bpalloc;
  41. struct bm_portal_config {
  42. /* Portal addresses */
  43. void *addr_virt_ce;
  44. void __iomem *addr_virt_ci;
  45. /* Allow these to be joined in lists */
  46. struct list_head list;
  47. struct device *dev;
  48. /* User-visible portal configuration settings */
  49. /* portal is affined to this cpu */
  50. int cpu;
  51. /* portal interrupt line */
  52. int irq;
  53. };
  54. struct bman_portal *bman_create_affine_portal(
  55. const struct bm_portal_config *config);
  56. /*
  57. * The below bman_p_***() variant might be called in a situation that the cpu
  58. * which the portal affine to is not online yet.
  59. * @bman_portal specifies which portal the API will use.
  60. */
  61. int bman_p_irqsource_add(struct bman_portal *p, u32 bits);
  62. /*
  63. * Used by all portal interrupt registers except 'inhibit'
  64. * This mask contains all the "irqsource" bits visible to API users
  65. */
  66. #define BM_PIRQ_VISIBLE BM_PIRQ_RCRI
  67. const struct bm_portal_config *
  68. bman_get_bm_portal_config(const struct bman_portal *portal);
  69. int bman_requires_cleanup(void);
  70. void bman_done_cleanup(void);
  71. int bm_shutdown_pool(u32 bpid);