blob: 38bdf3983ec19249b6bdb3d6a3222def1541c594 [file] [log] [blame]
AlexeiFedorov36ed0092024-09-10 10:37:54 +01001/*
AlexeiFedorov718fd792024-11-08 14:55:20 +00002 * Copyright (c) 2024-2025, Arm Limited. All rights reserved.
AlexeiFedorov36ed0092024-09-10 10:37:54 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
AlexeiFedorov718fd792024-11-08 14:55:20 +00007#include <assert.h>
AlexeiFedorov36ed0092024-09-10 10:37:54 +01008#include <pcie.h>
9
10#include <platform.h>
11#include <platform_pcie.h>
12
13CASSERT(PLATFORM_NUM_ECAM != 0, PLATFORM_NUM_ECAM_is_zero);
14
Soby Mathew2c2810f2024-11-15 17:11:24 +000015const struct pcie_info_table fvp_pcie_cfg = {
AlexeiFedorov36ed0092024-09-10 10:37:54 +010016 .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 Mathew2c2810f2024-11-15 17:11:24 +000025const struct pcie_info_table *plat_pcie_get_info_table(void)
AlexeiFedorov36ed0092024-09-10 10:37:54 +010026{
27 return &fvp_pcie_cfg;
28}
AlexeiFedorov718fd792024-11-08 14:55:20 +000029
30/*
31 * Retrieve platform PCIe memory region (Base Platform RevC only)
32 */
33int 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}