Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | <:copyright-BRCM:2016:DUAL/GPL:standard |
| 3 | |
| 4 | Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Unless you and Broadcom execute a separate written software license |
| 8 | agreement governing use of this software, this software is licensed |
| 9 | to you under the terms of the GNU General Public License version 2 |
| 10 | (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 11 | with the following added to such license: |
| 12 | |
| 13 | As a special exception, the copyright holders of this software give |
| 14 | you permission to link this software with independent modules, and |
| 15 | to copy and distribute the resulting executable under terms of your |
| 16 | choice, provided that you also meet, for each linked independent |
| 17 | module, the terms and conditions of the license of that module. |
| 18 | An independent module is a module which is not derived from this |
| 19 | software. The special exception does not apply to any modifications |
| 20 | of the software. |
| 21 | |
| 22 | Not withstanding the above, under no circumstances may you combine |
| 23 | this software in any way with any other Broadcom software provided |
| 24 | under a license other than the GPL, without Broadcom's express prior |
| 25 | written consent. |
| 26 | |
| 27 | :> |
| 28 | */ |
| 29 | |
| 30 | /* |
| 31 | * bcm_llpcie.h - Low-level PCIe driver interface |
| 32 | */ |
| 33 | |
| 34 | #ifndef BCMOLT_LLPCIE_H_ |
| 35 | #define BCMOLT_LLPCIE_H_ |
| 36 | |
| 37 | #include "bcmos_system.h" |
| 38 | #define BCMOLT_MAX_MAPLE_DEVICES 2 /* 5 */ |
| 39 | |
| 40 | /** Low-level device info */ |
| 41 | typedef struct bcmolt_ll_dev_info |
| 42 | { |
| 43 | unsigned long soc_regs_base; /**< Device registers base in host address space */ |
| 44 | unsigned long soc_sram_base; /**< Device SRAM base in host address space */ |
| 45 | unsigned long soc_ddr_base; /**< Device DDR base in host address space */ |
| 46 | uint32_t soc_ddr_length; /**< Device DDR window size */ |
| 47 | uint32_t irq; /**< Device irq number */ |
| 48 | } bcm_ll_dev_info; |
| 49 | |
| 50 | /** Device PCIe link status change notification callback */ |
| 51 | typedef enum |
| 52 | { |
| 53 | BCM_LL_PCIE_LINK_DOWN, /**< PCIe link is down */ |
| 54 | BCM_LL_PCIE_LINK_UP, /**< PCIe link is up */ |
| 55 | } bcm_ll_pcie_link_status; |
| 56 | |
| 57 | /** Low-level device handle */ |
| 58 | typedef void *bcm_ll_pcie_dev; |
| 59 | |
| 60 | /** Status change indication */ |
| 61 | typedef void (*bcm_ll_pcie_status_change)(uint8_t dev_id, bcm_ll_pcie_link_status status); |
| 62 | |
| 63 | /** Register status change notification callback |
| 64 | * \param[in] cb Status change notification callback |
| 65 | * \return 0=OK or error <0 |
| 66 | */ |
| 67 | bcmos_errno bcm_ll_pcie_status_change_register(bcm_ll_pcie_status_change cb); |
| 68 | |
| 69 | /** Unregister status change notification callback |
| 70 | * \return 0=OK or error <0 |
| 71 | */ |
| 72 | bcmos_errno bcm_ll_pcie_status_change_unregister(void); |
| 73 | |
| 74 | /** Query PCIe device |
| 75 | * \param[in] dev_id Device id |
| 76 | * \param[out] info Device info |
| 77 | * \return 0=OK, BCM_ERR_IO-dev_id is in proper range, but link is down |
| 78 | */ |
| 79 | bcmos_errno bcm_ll_pcie_query(uint8_t dev_id, bcm_ll_dev_info *info); |
| 80 | |
| 81 | /** Get low-level device handle |
| 82 | * \param[in] dev_id Device id |
| 83 | * \param[out] lldev Low-level device handle |
| 84 | * \return device handle or NULL if link is down |
| 85 | */ |
| 86 | bcm_ll_pcie_dev bcm_ll_pcie_dev_get(uint8_t dev_id); |
| 87 | |
| 88 | /** Enable/disable host reset for all PCIe interfaces (automatic |
| 89 | * device reset when host is reset) |
| 90 | * \param[in] enabled Whether or not hot reset should be enabled |
| 91 | * \return 0=OK or error <0 |
| 92 | */ |
| 93 | bcmos_errno bcm_ll_pcie_host_reset_enable(uint8_t dev_id, bcmos_bool enabled); |
| 94 | |
| 95 | #ifdef TX_ENABLE_EVENT_TRACE |
| 96 | /** Handle low-level trace on target |
| 97 | * \param[in] dev_id Device id |
| 98 | * \param[in] lfile name for trace |
| 99 | * \return device handle or NULL if link is down |
| 100 | */ |
| 101 | bcmos_errno bcm_ll_pcie_setrace(uint8_t dev_id); |
| 102 | bcmos_errno bcm_ll_pcie_cleartrace(uint8_t dev_id); |
| 103 | bcmos_errno bcm_ll_pcie_savetrace(uint8_t dev_id, char *tracefilename); |
| 104 | #endif |
| 105 | #endif |