cepci.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef __CEPCI_H__
  27. #define __CEPCI_H__
  28. /*
  29. * Support for Copy Engine over PCI.
  30. * Structures shared between Host software and Target firmware.
  31. */
  32. /*
  33. * Total number of PCIe MSI interrupts requested for all interrupt sources.
  34. * PCIe standard forces this to be a power of 2.
  35. * Some Host OS's limit MSI requests that can be granted to 8
  36. * so for now we abide by this limit and avoid requesting more
  37. * than that.
  38. */
  39. #define MSI_NUM_REQUEST_LOG2 4
  40. #define MSI_NUM_REQUEST 1 /* (1<<MSI_NUM_REQUEST_LOG2) */
  41. /*
  42. * Granted MSIs are assigned as follows:
  43. * Firmware uses the first
  44. * Remaining MSIs, if any, are used by Copy Engines
  45. * This mapping is known to both Target firmware and Host software.
  46. * It may be changed as long as Host and Target are kept in sync.
  47. */
  48. #define MSI_ASSIGN_FW 0 /* 1 MSI for firmware (errors, etc.) */
  49. #define MSI_ASSIGN_CE_INITIAL 1 /* 7 MSIs for Copy Engines */
  50. #define MSI_ASSIGN_CE_MAX 7
  51. /*
  52. * PCI-specific Target state. Much of this may be of interest
  53. * to the Host so HOST_INTEREST->hi_interconnect_state points
  54. * here (and all members are 32-bit quantities in order to
  55. * facilitate Host access). In particular, Host software is
  56. * required to initialize pipe_cfg_addr and svc_to_pipe_map.
  57. */
  58. struct pcie_state_s {
  59. uint32_t pipe_cfg_addr; /* Pipe configuration Target address */
  60. /* NB: CE_pipe_config[CE_COUNT] */
  61. uint32_t svc_to_pipe_map; /* Service to pipe map Target address */
  62. /* NB: service_to_pipe[PIPE_TO_CE_MAP_CN] */
  63. uint32_t MSI_requested; /* number of MSI interrupts requested */
  64. uint32_t MSI_granted; /* number of MSI interrupts granted */
  65. uint32_t MSI_addr; /* Message Signalled Interrupt address */
  66. uint32_t MSI_data; /* Base data */
  67. uint32_t MSI_fw_intr_data; /* Data for firmware interrupt;
  68. MSI data for other interrupts are
  69. in various SoC registers */
  70. uint32_t power_mgmt_method; /* PCIE_PWR_METHOD_* */
  71. uint32_t config_flags; /* PCIE_CONFIG_FLAG_* */
  72. };
  73. /*
  74. * PCIE_CONFIG_FLAG definitions
  75. */
  76. #define PCIE_CONFIG_FLAG_ENABLE_L1 0x0000001
  77. #define PCIE_CONFIG_FLAG_CLK_SWITCH_WAIT 0x0000002
  78. #define PCIE_CONFIG_FLAG_AXI_CLK_GATE 0x0000004
  79. #define PIPE_TO_CE_MAP_CNT 32 /* simple implementation constant */
  80. /*
  81. * Configuration information for a Copy Engine pipe.
  82. * Passed from Host to Target during startup (one per CE).
  83. */
  84. struct CE_pipe_config {
  85. uint32_t pipenum;
  86. uint32_t pipedir;
  87. uint32_t nentries;
  88. uint32_t nbytes_max;
  89. uint32_t flags;
  90. uint32_t reserved;
  91. };
  92. /*
  93. * HIA Map Definition
  94. */
  95. struct host_interest_area_t {
  96. uint32_t hi_interconnect_state;
  97. uint32_t hi_early_alloc;
  98. uint32_t hi_option_flag2;
  99. uint32_t hi_board_data;
  100. uint32_t hi_board_data_initialized;
  101. uint32_t hi_failure_state;
  102. uint32_t hi_rddi_msi_num;
  103. uint32_t hi_pcie_perst_couple_en;
  104. uint32_t hi_sw_protocol_version;
  105. };
  106. struct shadow_reg_cfg {
  107. uint16_t ce_id;
  108. uint16_t reg_offset;
  109. };
  110. #endif /* __CEPCI_H__ */