AlexeiFedorov | 36ed009 | 2024-09-10 10:37:54 +0100 | [diff] [blame] | 1 | /* |
AlexeiFedorov | 718fd79 | 2024-11-08 14:55:20 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2024-2025, Arm Limited. All rights reserved. |
AlexeiFedorov | 36ed009 | 2024-09-10 10:37:54 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
AlexeiFedorov | 718fd79 | 2024-11-08 14:55:20 +0000 | [diff] [blame^] | 7 | #include <assert.h> |
AlexeiFedorov | 36ed009 | 2024-09-10 10:37:54 +0100 | [diff] [blame] | 8 | #include <pcie.h> |
| 9 | |
| 10 | #include <platform.h> |
| 11 | #include <platform_pcie.h> |
| 12 | |
| 13 | CASSERT(PLATFORM_NUM_ECAM != 0, PLATFORM_NUM_ECAM_is_zero); |
| 14 | |
Soby Mathew | 2c2810f | 2024-11-15 17:11:24 +0000 | [diff] [blame] | 15 | const struct pcie_info_table fvp_pcie_cfg = { |
AlexeiFedorov | 36ed009 | 2024-09-10 10:37:54 +0100 | [diff] [blame] | 16 | .num_entries = PLATFORM_NUM_ECAM, |
| 17 | .block[0] = { |
| 18 | PLATFORM_PCIE_ECAM_BASE_ADDR_0, |
| 19 | PLATFORM_PCIE_SEGMENT_GRP_NUM_0, |
| 20 | PLATFORM_PCIE_START_BUS_NUM_0, |
| 21 | PLATFORM_PCIE_END_BUS_NUM_0 |
| 22 | } |
| 23 | }; |
| 24 | |
Soby Mathew | 2c2810f | 2024-11-15 17:11:24 +0000 | [diff] [blame] | 25 | const struct pcie_info_table *plat_pcie_get_info_table(void) |
AlexeiFedorov | 36ed009 | 2024-09-10 10:37:54 +0100 | [diff] [blame] | 26 | { |
| 27 | return &fvp_pcie_cfg; |
| 28 | } |
AlexeiFedorov | 718fd79 | 2024-11-08 14:55:20 +0000 | [diff] [blame^] | 29 | |
| 30 | /* |
| 31 | * Retrieve platform PCIe memory region (Base Platform RevC only) |
| 32 | */ |
| 33 | int plat_get_dev_region(uint64_t *base, size_t *size, |
| 34 | uint32_t type, uint32_t idx) |
| 35 | { |
| 36 | #ifdef __aarch64__ |
| 37 | assert((base != NULL) && (size != NULL)); |
| 38 | |
| 39 | if (type == DEV_MEM_NON_COHERENT) { |
| 40 | switch (idx) { |
| 41 | case 0U: |
| 42 | /* PCIe memory region 1 */ |
| 43 | *base = PCIE_MEM_1_BASE; |
| 44 | *size = PCIE_MEM_1_SIZE; |
| 45 | return 0; |
| 46 | case 1U: |
| 47 | /* PCIe memory region 2 */ |
| 48 | *base = PCIE_MEM_2_BASE; |
| 49 | *size = PCIE_MEM_2_SIZE; |
| 50 | return 0; |
| 51 | default: |
| 52 | break; |
| 53 | } |
| 54 | } |
| 55 | #endif |
| 56 | return -1; |
| 57 | } |