Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
| 8 | #include <debug.h> |
| 9 | #include <plat_arm.h> |
| 10 | #include <platform_def.h> |
| 11 | #include <sgi_variant.h> |
| 12 | #include <sgi_plat_config.h> |
| 13 | #include <string.h> |
| 14 | |
| 15 | static css_plat_config_t *css_plat_info; |
| 16 | |
| 17 | /* GIC */ |
| 18 | /* The GICv3 driver only needs to be initialized in EL3 */ |
| 19 | uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT]; |
| 20 | |
| 21 | const interrupt_prop_t sgi575_interrupt_props[] = { |
| 22 | CSS_G1S_IRQ_PROPS(INTR_GROUP1S), |
| 23 | ARM_G0_IRQ_PROPS(INTR_GROUP0), |
| 24 | }; |
| 25 | |
| 26 | /* Special definition for SGI575 */ |
| 27 | /* GIC configuration for SGI575 */ |
| 28 | const gicv3_driver_data_t sgi575_gic_data = { |
| 29 | .gicd_base = PLAT_ARM_GICD_BASE, |
| 30 | .gicr_base = PLAT_ARM_GICR_BASE, |
| 31 | .interrupt_props = sgi575_interrupt_props, |
| 32 | .interrupt_props_num = ARRAY_SIZE(sgi575_interrupt_props), |
| 33 | .rdistif_num = PLATFORM_CORE_COUNT, |
| 34 | .rdistif_base_addrs = rdistif_base_addrs, |
| 35 | .mpidr_to_core_pos = plat_arm_calc_core_pos |
| 36 | }; |
| 37 | |
| 38 | /* Interconnect configuration for SGI575 */ |
| 39 | const css_inteconn_config_t sgi575_inteconn = { |
| 40 | .ip_type = ARM_CMN, |
| 41 | .plat_inteconn_desc = NULL |
| 42 | }; |
| 43 | |
| 44 | /* Configuration structure for SGI575 */ |
| 45 | css_plat_config_t sgi575_config = { |
| 46 | .gic_data = &sgi575_gic_data, |
| 47 | .inteconn = &sgi575_inteconn, |
| 48 | }; |
| 49 | |
| 50 | /******************************************************************************* |
| 51 | * This function initializes the platform sturcture. |
| 52 | ******************************************************************************/ |
| 53 | void plat_config_init(void) |
| 54 | { |
| 55 | /* Get the platform configurations */ |
| 56 | switch (GET_SGI_PART_NUM) { |
| 57 | case SGI575_SSC_VER_PART_NUM: |
| 58 | css_plat_info = &sgi575_config; |
| 59 | break; |
| 60 | default: |
| 61 | ERROR("Not a valid sgi variant!\n"); |
| 62 | panic(); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /******************************************************************************* |
| 67 | * This function returns the platform structure pointer. |
| 68 | ******************************************************************************/ |
| 69 | css_plat_config_t *get_plat_config(void) |
| 70 | { |
| 71 | assert(css_plat_info != NULL); |
| 72 | return css_plat_info; |
| 73 | } |