Angel Pons | 80d9238 | 2020-04-05 15:47:00 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
| 4 | #include <soc/fiamux.h> |
| 5 | |
| 6 | #define FSP_FIAMUX_HOB_GUID \ |
| 7 | { \ |
| 8 | 0x26ad492e, 0xf951, 0x4e43, \ |
| 9 | { \ |
| 10 | 0xbc, 0x72, 0x22, 0x76, 0x58, 0xb1, 0xf6, 0x23 \ |
| 11 | } \ |
| 12 | } |
| 13 | |
| 14 | int get_fiamux_hsio_info(uint16_t num_of_lanes, size_t num_of_entry, |
| 15 | BL_HSIO_INFORMATION **config) |
| 16 | { |
| 17 | uint8_t entry; |
| 18 | |
| 19 | if ((num_of_lanes == 0) || (num_of_entry == 0) || (*config == NULL)) |
| 20 | return 1; |
| 21 | |
| 22 | for (entry = 0; entry < num_of_entry; entry++) { |
| 23 | if ((*config)[entry].NumLanesSupported == num_of_lanes) { |
| 24 | *config = &(*config)[entry]; |
| 25 | return 0; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | return 1; |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | * Display the FIA MUX HOB. |
| 34 | * |
| 35 | * @param Pointer of FIA MUX HOB data |
| 36 | * |
| 37 | * @return None |
| 38 | * |
| 39 | */ |
| 40 | void print_fiamux_config_hob(BL_FIA_MUX_CONFIG_HOB *fiamux_hob_data) |
| 41 | { |
| 42 | /* Display the FIA MUX Configuration */ |
| 43 | printk(BIOS_DEBUG, "FIA MUX Configuration in FSP HOB is:\n"); |
| 44 | |
| 45 | printk(BIOS_DEBUG, " FiaMuxConfig.SkuNumLanesAllowed = 0x%x\n", |
| 46 | (uint32_t)(fiamux_hob_data->FiaMuxConfig.SkuNumLanesAllowed)); |
| 47 | |
| 48 | printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfig = 0x%llx\n", |
| 49 | (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfig |
| 50 | .MuxConfiguration.MeFiaMuxLaneConfig)); |
| 51 | |
| 52 | printk(BIOS_DEBUG, |
| 53 | " FiaMuxConfig.FiaMuxConfig.SataLaneConfiguration = 0x%llx\n", |
| 54 | (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfig |
| 55 | .SataLaneConfiguration.MeFiaSataLaneConfig)); |
| 56 | |
| 57 | printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfig." |
| 58 | "PcieRootPortsConfiguration = 0x%llx\n", |
| 59 | (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfig |
| 60 | .PcieRootPortsConfiguration |
| 61 | .MeFiaPcieRootPortsConfig)); |
| 62 | |
| 63 | printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfigRequest = 0x%llx\n", |
| 64 | (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfigRequest |
| 65 | .MuxConfiguration.MeFiaMuxLaneConfig)); |
| 66 | |
| 67 | printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfigRequest." |
| 68 | "SataLaneConfiguration = 0x%llx\n", |
| 69 | (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfigRequest |
| 70 | .SataLaneConfiguration.MeFiaSataLaneConfig)); |
| 71 | |
| 72 | printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfigRequest." |
| 73 | "PcieRootPortsConfiguration = 0x%llx\n", |
| 74 | (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfigRequest |
| 75 | .PcieRootPortsConfiguration |
| 76 | .MeFiaPcieRootPortsConfig)); |
| 77 | printk(BIOS_DEBUG, |
| 78 | " FiaMuxConfigStatus.FiaMuxConfigGetStatus = 0x%x\n", |
| 79 | (uint32_t)(fiamux_hob_data->FiaMuxConfigStatus |
| 80 | .FiaMuxConfigGetStatus)); |
| 81 | |
| 82 | printk(BIOS_DEBUG, |
| 83 | " FiaMuxConfigStatus.FiaMuxConfigSetStatus = 0x%x\n", |
| 84 | (uint32_t)(fiamux_hob_data->FiaMuxConfigStatus |
| 85 | .FiaMuxConfigSetStatus)); |
| 86 | |
| 87 | printk(BIOS_DEBUG, |
| 88 | " FiaMuxConfigStatus.FiaMuxConfigSetRequired = 0x%x\n", |
| 89 | (uint8_t)(fiamux_hob_data->FiaMuxConfigStatus |
| 90 | .FiaMuxConfigSetRequired)); |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | * Get the pointer of FIA MUX HOB data |
| 95 | * |
| 96 | * @param Pointer of FIA MUX HOB data |
| 97 | * |
| 98 | * @return: |
| 99 | * Non-zero - FIA MUX configuration correct. |
| 100 | * Zero - Either FIA MUX configuration incorrect or |
| 101 | * it can not be verified. |
| 102 | */ |
| 103 | BL_FIA_MUX_CONFIG_HOB *get_fiamux_hob_data(void) |
| 104 | { |
| 105 | u32 const *fiamux_hob = NULL; |
| 106 | BL_FIA_MUX_CONFIG_HOB *fiamux_hob_data = NULL; |
| 107 | const EFI_GUID fiamux_guid = FSP_FIAMUX_HOB_GUID; |
| 108 | size_t size; |
| 109 | |
| 110 | /* Parse FIA MUX configuration HOB */ |
| 111 | fiamux_hob = fsp_find_extension_hob_by_guid( |
| 112 | (uint8_t const *)&fiamux_guid, &size); |
| 113 | |
| 114 | if (fiamux_hob == NULL) { |
| 115 | /* FIA MUX configuration HOB not exist */ |
| 116 | die("FIA MUX Configuration Data Hob does not present!\n"); |
| 117 | } else { |
| 118 | /* Get FIA MUX configuration HOB */ |
| 119 | fiamux_hob_data = (BL_FIA_MUX_CONFIG_HOB *)(fiamux_hob); |
| 120 | |
| 121 | /* Display FIA MUX configuration HOB */ |
| 122 | print_fiamux_config_hob(fiamux_hob_data); |
| 123 | } |
| 124 | |
| 125 | return fiamux_hob_data; |
| 126 | } |
Julien Viard de Galbert | f528195 | 2017-11-06 13:19:58 +0100 | [diff] [blame] | 127 | |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 128 | __weak size_t mainboard_get_hsio_config(BL_HSIO_INFORMATION **p_hsio_config) |
Julien Viard de Galbert | f528195 | 2017-11-06 13:19:58 +0100 | [diff] [blame] | 129 | { |
| 130 | *p_hsio_config = NULL; |
| 131 | return 0; |
| 132 | } |