Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 2 | |
Patrick Rudolph | 7a593ab | 2024-01-25 15:15:00 +0100 | [diff] [blame^] | 3 | #include <cpu/x86/smm.h> |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 4 | #include <drivers/ipmi/ipmi_ops.h> |
| 5 | #include <drivers/ocp/dmi/ocp_dmi.h> |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 6 | #include <soc/ramstage.h> |
Patrick Rudolph | 7a593ab | 2024-01-25 15:15:00 +0100 | [diff] [blame^] | 7 | #include <soc/smmrelocate.h> |
Jonathan Zhang | 75985f1 | 2020-01-16 11:20:09 -0800 | [diff] [blame] | 8 | |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 9 | extern struct fru_info_str fru_strings; |
| 10 | |
BryantOu | d9da698 | 2020-04-20 20:39:39 -0700 | [diff] [blame] | 11 | static const struct port_information SMBIOS_type8_info[] = { |
| 12 | /* |
| 13 | * Port Information fields: |
| 14 | * Internal Reference Designator, |
| 15 | * Internal Connector Type, |
| 16 | * External Reference Designator, |
| 17 | * External Connector_Type, |
| 18 | * Port Type |
| 19 | */ |
| 20 | { |
| 21 | "J7F5 - BMC JTAG HEADER", |
| 22 | CONN_OTHER, |
| 23 | NULL, |
| 24 | CONN_NONE, |
| 25 | TYPE_OTHER_PORT |
| 26 | }, |
| 27 | { |
| 28 | "J8A1 - MINISAS1", |
| 29 | CONN_SAS_SATA, |
| 30 | NULL, |
| 31 | CONN_NONE, |
| 32 | TYPE_SAS |
| 33 | }, |
| 34 | { |
| 35 | "J8A2 - MINISAS2", |
| 36 | CONN_SAS_SATA, |
| 37 | NULL, |
| 38 | CONN_NONE, |
| 39 | TYPE_SAS |
| 40 | }, |
| 41 | { |
| 42 | "J8A3 - SATA CONBINE1", |
| 43 | CONN_SAS_SATA, |
| 44 | NULL, |
| 45 | CONN_NONE, |
| 46 | TYPE_SAS |
| 47 | }, |
| 48 | { |
| 49 | "J8B1 - ME_DBG", |
| 50 | CONN_OTHER, |
| 51 | NULL, |
| 52 | CONN_NONE, |
| 53 | TYPE_OTHER_PORT |
| 54 | }, |
| 55 | { |
| 56 | "J8D1 - VR_DBG", |
| 57 | CONN_OTHER, |
| 58 | NULL, |
| 59 | CONN_NONE, |
| 60 | TYPE_OTHER_PORT |
| 61 | }, |
| 62 | { |
| 63 | "J8E1 - TPM_MODULE", |
| 64 | CONN_OTHER, |
| 65 | NULL, |
| 66 | CONN_NONE, |
| 67 | TYPE_OTHER_PORT |
| 68 | }, |
| 69 | { |
| 70 | "J8F1 - M.2 CONNECTOR", |
| 71 | CONN_OTHER, |
| 72 | NULL, |
| 73 | CONN_NONE, |
| 74 | TYPE_OTHER_PORT |
| 75 | }, |
| 76 | { |
| 77 | "J9A1 - SATA RAID KEY", |
| 78 | CONN_OTHER, |
| 79 | NULL, |
| 80 | CONN_NONE, |
| 81 | TYPE_OTHER_PORT |
| 82 | }, |
| 83 | { |
| 84 | NULL, |
| 85 | CONN_NONE, |
| 86 | "J9A2 - DEBUG 80 PORT", |
| 87 | CONN_OTHER, |
| 88 | TYPE_OTHER_PORT |
| 89 | }, |
| 90 | { |
| 91 | "J9A3 - CPU & PCH XDP", |
| 92 | CONN_OTHER, |
| 93 | NULL, |
| 94 | CONN_NONE, |
| 95 | TYPE_OTHER_PORT |
| 96 | }, |
| 97 | { |
| 98 | NULL, |
| 99 | CONN_NONE, |
| 100 | "J9A5 - USB conn", |
| 101 | CONN_ACCESS_BUS_USB, |
| 102 | TYPE_USB |
| 103 | }, |
| 104 | { |
| 105 | "J9B1 - BMC_DBG", |
| 106 | CONN_OTHER, |
| 107 | NULL, |
| 108 | CONN_NONE, |
| 109 | TYPE_OTHER_PORT |
| 110 | }, |
| 111 | { |
| 112 | NULL, |
| 113 | CONN_NONE, |
| 114 | "J9D1 - USB3.0 TYPE C", |
| 115 | CONN_ACCESS_BUS_USB, |
| 116 | TYPE_USB |
| 117 | }, |
| 118 | { |
| 119 | NULL, |
| 120 | CONN_NONE, |
| 121 | "J9E1 - VGA", |
| 122 | CONN_OTHER, |
| 123 | TYPE_OTHER_PORT |
| 124 | }, |
| 125 | { |
| 126 | NULL, |
| 127 | CONN_NONE, |
| 128 | "JA9G1 - ETH0", |
| 129 | CONN_RJ_45, |
| 130 | TYPE_NETWORK_PORT |
| 131 | }, |
| 132 | }; |
| 133 | |
Jonathan Zhang | 75985f1 | 2020-01-16 11:20:09 -0800 | [diff] [blame] | 134 | void mainboard_silicon_init_params(FSPS_UPD *params) |
| 135 | { |
| 136 | } |
BryantOu | 4fc59af | 2020-04-15 23:17:01 -0700 | [diff] [blame] | 137 | |
BryantOu | d9da698 | 2020-04-20 20:39:39 -0700 | [diff] [blame] | 138 | #if CONFIG(GENERATE_SMBIOS_TABLES) |
| 139 | static int mainboard_smbios_data(struct device *dev, int *handle, unsigned long *current) |
| 140 | { |
| 141 | int len = 0; |
| 142 | |
| 143 | // add port information |
| 144 | len += smbios_write_type8( |
| 145 | current, handle, |
| 146 | SMBIOS_type8_info, |
| 147 | ARRAY_SIZE(SMBIOS_type8_info) |
| 148 | ); |
| 149 | |
| 150 | return len; |
| 151 | } |
| 152 | #endif |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 153 | |
| 154 | static void tp_oem_smbios_strings(struct device *dev, struct smbios_type11 *t) |
| 155 | { |
| 156 | /* OEM string 1 to 6 */ |
| 157 | ocp_oem_smbios_strings(dev, t); |
| 158 | |
| 159 | /* OEM string 7 */ |
| 160 | if (fru_strings.board_info.custom_count > 1 && |
| 161 | *(fru_strings.board_info.board_custom + 1) != NULL) |
| 162 | t->count = smbios_add_oem_string(t->eos, |
| 163 | *(fru_strings.board_info.board_custom + 1)); |
| 164 | else |
| 165 | t->count = smbios_add_oem_string(t->eos, TBF); |
| 166 | } |
| 167 | |
| 168 | static void mainboard_enable(struct device *dev) |
| 169 | { |
Elyes Haouas | 7ac796c | 2022-09-29 12:46:46 +0200 | [diff] [blame] | 170 | dev->ops->get_smbios_strings = tp_oem_smbios_strings; |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 171 | read_fru_areas(CONFIG_BMC_KCS_BASE, CONFIG_FRU_DEVICE_ID, 0, &fru_strings); |
BryantOu | d9da698 | 2020-04-20 20:39:39 -0700 | [diff] [blame] | 172 | #if CONFIG(GENERATE_SMBIOS_TABLES) |
| 173 | dev->ops->get_smbios_data = mainboard_smbios_data; |
| 174 | #endif |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | static void mainboard_final(void *chip_info) |
| 178 | { |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 179 | } |
| 180 | |
Patrick Rudolph | 7a593ab | 2024-01-25 15:15:00 +0100 | [diff] [blame^] | 181 | void smm_mainboard_pci_resource_store_init(struct smm_pci_resource_info *slots, size_t size) |
| 182 | { |
| 183 | soc_ubox_store_resources(slots, size); |
| 184 | } |
| 185 | |
Johnny Lin | f9e12e8 | 2020-04-20 19:03:41 +0800 | [diff] [blame] | 186 | struct chip_operations mainboard_ops = { |
| 187 | .enable_dev = mainboard_enable, |
| 188 | .final = mainboard_final, |
| 189 | }; |