ec/google/chromeec: Define ACPI_NOTIFY_CROS_EC_MKBP constant
[coreboot2.git] / src / soc / intel / denverton_ns / fiamux.c
blob792ea568562f8d6ff3d3589fd95434837a2cd400
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <soc/fiamux.h>
6 #define FSP_FIAMUX_HOB_GUID \
7 { \
8 0x26ad492e, 0xf951, 0x4e43, \
9 { \
10 0xbc, 0x72, 0x22, 0x76, 0x58, 0xb1, 0xf6, 0x23 \
11 } \
14 int get_fiamux_hsio_info(uint16_t num_of_lanes, size_t num_of_entry,
15 BL_HSIO_INFORMATION **config)
17 uint8_t entry;
19 if ((num_of_lanes == 0) || (num_of_entry == 0) || (*config == NULL))
20 return 1;
22 for (entry = 0; entry < num_of_entry; entry++) {
23 if ((*config)[entry].NumLanesSupported == num_of_lanes) {
24 *config = &(*config)[entry];
25 return 0;
29 return 1;
33 * Display the FIA MUX HOB.
35 * @param Pointer of FIA MUX HOB data
37 * @return None
40 void print_fiamux_config_hob(BL_FIA_MUX_CONFIG_HOB *fiamux_hob_data)
42 /* Display the FIA MUX Configuration */
43 printk(BIOS_DEBUG, "FIA MUX Configuration in FSP HOB is:\n");
45 printk(BIOS_DEBUG, " FiaMuxConfig.SkuNumLanesAllowed = 0x%x\n",
46 (uint32_t)(fiamux_hob_data->FiaMuxConfig.SkuNumLanesAllowed));
48 printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfig = 0x%llx\n",
49 (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfig
50 .MuxConfiguration.MeFiaMuxLaneConfig));
52 printk(BIOS_DEBUG,
53 " FiaMuxConfig.FiaMuxConfig.SataLaneConfiguration = 0x%llx\n",
54 (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfig
55 .SataLaneConfiguration.MeFiaSataLaneConfig));
57 printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfig."
58 "PcieRootPortsConfiguration = 0x%llx\n",
59 (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfig
60 .PcieRootPortsConfiguration
61 .MeFiaPcieRootPortsConfig));
63 printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfigRequest = 0x%llx\n",
64 (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfigRequest
65 .MuxConfiguration.MeFiaMuxLaneConfig));
67 printk(BIOS_DEBUG, " FiaMuxConfig.FiaMuxConfigRequest."
68 "SataLaneConfiguration = 0x%llx\n",
69 (uint64_t)(fiamux_hob_data->FiaMuxConfig.FiaMuxConfigRequest
70 .SataLaneConfiguration.MeFiaSataLaneConfig));
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));
82 printk(BIOS_DEBUG,
83 " FiaMuxConfigStatus.FiaMuxConfigSetStatus = 0x%x\n",
84 (uint32_t)(fiamux_hob_data->FiaMuxConfigStatus
85 .FiaMuxConfigSetStatus));
87 printk(BIOS_DEBUG,
88 " FiaMuxConfigStatus.FiaMuxConfigSetRequired = 0x%x\n",
89 (uint8_t)(fiamux_hob_data->FiaMuxConfigStatus
90 .FiaMuxConfigSetRequired));
94 * Get the pointer of FIA MUX HOB data
96 * @param Pointer of FIA MUX HOB data
98 * @return:
99 * Non-zero - FIA MUX configuration correct.
100 * Zero - Either FIA MUX configuration incorrect or
101 * it can not be verified.
103 BL_FIA_MUX_CONFIG_HOB *get_fiamux_hob_data(void)
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;
110 /* Parse FIA MUX configuration HOB */
111 fiamux_hob = fsp_find_extension_hob_by_guid(
112 (uint8_t const *)&fiamux_guid, &size);
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);
121 /* Display FIA MUX configuration HOB */
122 print_fiamux_config_hob(fiamux_hob_data);
125 return fiamux_hob_data;
128 __weak size_t mainboard_get_hsio_config(BL_HSIO_INFORMATION **p_hsio_config)
130 *p_hsio_config = NULL;
131 return 0;