1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <device/device.h>
6 #include <soc/pci_devs.h>
7 #include <soc/ramstage.h>
11 void mainboard_fill_fadt(acpi_fadt_t
*fadt
)
13 fadt
->preferred_pm_profile
= PM_DESKTOP
;
14 fadt
->iapc_boot_arch
|= ACPI_FADT_LEGACY_DEVICES
| ACPI_FADT_8042
;
17 static void mainboard_init(void *chip_info
)
21 u8
smbios_mainboard_feature_flags(void)
23 return SMBIOS_FEATURE_FLAGS_HOSTING_BOARD
| SMBIOS_FEATURE_FLAGS_REPLACEABLE
;
26 smbios_wakeup_type
smbios_system_wakeup_type(void)
28 return SMBIOS_WAKEUP_TYPE_POWER_SWITCH
;
31 const char *smbios_system_product_name(void)
36 const char *smbios_mainboard_product_name(void)
38 if (CONFIG(BOARD_MSI_Z690_A_PRO_WIFI_DDR4
)) {
39 if (is_devfn_enabled(PCH_DEVFN_CNVI_WIFI
))
40 return "PRO Z690-A WIFI DDR4(MS-7D25)";
42 return "PRO Z690-A DDR4(MS-7D25)";
45 if (CONFIG(BOARD_MSI_Z690_A_PRO_WIFI_DDR5
)) {
46 if (is_devfn_enabled(PCH_DEVFN_CNVI_WIFI
))
47 return "PRO Z690-A WIFI (MS-7D25)";
49 return "PRO Z690-A (MS-7D25)";
52 return mainboard_part_number
;
55 /* Only baseboard serial number is populated */
56 const char *smbios_system_serial_number(void)
58 return "Default string";
61 const char *smbios_system_sku(void)
63 return "Default string";
66 void mainboard_silicon_init_params(FSP_S_CONFIG
*params
)
68 uint8_t aspm
, aspm_l1
;
70 /* ASPM L1 sub-states require CLKREQ, so CLK_PM should be enabled as well */
71 if (CONFIG(PCIEXP_L1_SUB_STATE
) && CONFIG(PCIEXP_CLK_PM
))
72 aspm_l1
= 2; // 2 - L1.1 and L1.2
76 if (CONFIG(PCIEXP_ASPM
)) {
77 aspm
= CONFIG(PCIEXP_L1_SUB_STATE
) ? 3 : 1; // 3 - L0sL1, 1 - L0s
83 memset(params
->PcieRpEnableCpm
, 0, sizeof(params
->PcieRpEnableCpm
));
84 memset(params
->CpuPcieRpEnableCpm
, 0, sizeof(params
->CpuPcieRpEnableCpm
));
85 memset(params
->CpuPcieClockGating
, 0, sizeof(params
->CpuPcieClockGating
));
86 memset(params
->CpuPciePowerGating
, 0, sizeof(params
->CpuPciePowerGating
));
88 params
->UsbPdoProgramming
= 1;
90 params
->CpuPcieFiaProgramming
= 1;
92 params
->PcieRpFunctionSwap
= 0;
93 params
->CpuPcieRpFunctionSwap
= 0;
95 params
->PchLegacyIoLowLatency
= 1;
96 params
->PchDmiAspmCtrl
= 0;
98 params
->CpuPcieRpPmSci
[0] = 1; // M2_1
99 params
->CpuPcieRpPmSci
[1] = 1; // PCI_E1
100 params
->PcieRpPmSci
[0] = 1; // PCI_E2
101 params
->PcieRpPmSci
[1] = 1; // PCI_E4
102 params
->PcieRpPmSci
[2] = 1; // Ethernet
103 params
->PcieRpPmSci
[4] = 1; // PCI_E3
104 params
->PcieRpPmSci
[8] = 1; // M2_3
105 params
->PcieRpPmSci
[20] = 1; // M2_4
106 params
->PcieRpPmSci
[24] = 1; // M2_2
108 params
->PcieRpMaxPayload
[0] = 1; // PCI_E2
109 params
->PcieRpMaxPayload
[1] = 1; // PCI_E4
110 params
->PcieRpMaxPayload
[2] = 1; // Ethernet
111 params
->PcieRpMaxPayload
[4] = 1; // PCI_E3
112 params
->PcieRpMaxPayload
[8] = 1; // M2_3
113 params
->PcieRpMaxPayload
[20] = 1; // M2_4
114 params
->PcieRpMaxPayload
[24] = 1; // M2_2
116 params
->CpuPcieRpTransmitterHalfSwing
[0] = 1; // M2_1
117 params
->CpuPcieRpTransmitterHalfSwing
[1] = 1; // PCI_E1
118 params
->PcieRpTransmitterHalfSwing
[0] = 1; // PCI_E2
119 params
->PcieRpTransmitterHalfSwing
[1] = 1; // PCI_E4
120 params
->PcieRpTransmitterHalfSwing
[2] = 1; // Ethernet
121 params
->PcieRpTransmitterHalfSwing
[4] = 1; // PCI_E3
122 params
->PcieRpTransmitterHalfSwing
[8] = 1; // M2_3
123 params
->PcieRpTransmitterHalfSwing
[20] = 1; // M2_4
124 params
->PcieRpTransmitterHalfSwing
[24] = 1; // M2_2
126 params
->CpuPcieRpEnableCpm
[0] = CONFIG(PCIEXP_CLK_PM
); // M2_1
127 params
->CpuPcieRpEnableCpm
[1] = CONFIG(PCIEXP_CLK_PM
); // PCI_E1
128 params
->PcieRpEnableCpm
[0] = CONFIG(PCIEXP_CLK_PM
); // PCI_E2
129 params
->PcieRpEnableCpm
[1] = CONFIG(PCIEXP_CLK_PM
); // PCI_E4
130 params
->PcieRpEnableCpm
[4] = CONFIG(PCIEXP_CLK_PM
); // PCI_E3
131 params
->PcieRpEnableCpm
[8] = CONFIG(PCIEXP_CLK_PM
); // M2_3
132 params
->PcieRpEnableCpm
[20] = CONFIG(PCIEXP_CLK_PM
); // M2_4
133 params
->PcieRpEnableCpm
[24] = CONFIG(PCIEXP_CLK_PM
); // M2_2
135 params
->CpuPcieRpL1Substates
[0] = aspm_l1
; // M2_1
136 params
->CpuPcieRpL1Substates
[1] = aspm_l1
; // PCI_E1
137 params
->PcieRpL1Substates
[0] = aspm_l1
; // PCI_E2
138 params
->PcieRpL1Substates
[1] = aspm_l1
; // PCI_E4
139 params
->PcieRpL1Substates
[4] = aspm_l1
; // PCI_E3
140 params
->PcieRpL1Substates
[8] = aspm_l1
; // M2_3
141 params
->PcieRpL1Substates
[20] = aspm_l1
; // M2_4
142 params
->PcieRpL1Substates
[24] = aspm_l1
; // M2_2
144 params
->CpuPcieRpAspm
[0] = aspm
; // M2_1
145 params
->CpuPcieRpAspm
[1] = aspm
; // PCI_E1
146 params
->PcieRpAspm
[0] = aspm
; // PCI_E2
147 params
->PcieRpAspm
[1] = aspm
; // PCI_E4
148 params
->PcieRpAspm
[4] = aspm
; // PCI_E3
149 params
->PcieRpAspm
[8] = aspm
; // M2_3
150 params
->PcieRpAspm
[20] = aspm
; // M2_4
151 params
->PcieRpAspm
[24] = aspm
; // M2_2
153 params
->PcieRpAcsEnabled
[0] = 1; // PCI_E2
154 params
->PcieRpAcsEnabled
[1] = 1; // PCI_E4
155 params
->PcieRpAcsEnabled
[2] = 1; // Ethernet
156 params
->PcieRpAcsEnabled
[4] = 1; // PCI_E3
157 params
->PcieRpAcsEnabled
[8] = 1; // M2_3
158 params
->PcieRpAcsEnabled
[20] = 1; // M2_4
159 params
->PcieRpAcsEnabled
[24] = 1; // M2_2
161 params
->CpuPcieClockGating
[0] = CONFIG(PCIEXP_CLK_PM
);
162 params
->CpuPciePowerGating
[0] = CONFIG(PCIEXP_CLK_PM
);
163 params
->CpuPcieRpMultiVcEnabled
[0] = 1;
164 params
->CpuPcieRpPeerToPeerMode
[0] = 1;
165 params
->CpuPcieRpMaxPayload
[0] = 2; // 512B
166 params
->CpuPcieRpAcsEnabled
[0] = 1;
168 params
->CpuPcieClockGating
[1] = CONFIG(PCIEXP_CLK_PM
);
169 params
->CpuPciePowerGating
[1] = CONFIG(PCIEXP_CLK_PM
);
170 params
->CpuPcieRpPeerToPeerMode
[1] = 1;
171 params
->CpuPcieRpMaxPayload
[1] = 2; // 512B
172 params
->CpuPcieRpAcsEnabled
[1] = 1;
174 params
->SataPortsSolidStateDrive
[6] = 1; // M2_3
175 params
->SataPortsSolidStateDrive
[7] = 1; // M2_4
176 params
->SataLedEnable
= 1;
179 #if CONFIG(GENERATE_SMBIOS_TABLES)
180 static const struct port_information smbios_type8_info
[] = {
182 .internal_reference_designator
= "PS2_USB1",
183 .internal_connector_type
= CONN_NONE
,
184 .external_reference_designator
= "Keyboard",
185 .external_connector_type
= CONN_PS_2
,
186 .port_type
= TYPE_KEYBOARD_PORT
189 .internal_reference_designator
= "PS2_USB1",
190 .internal_connector_type
= CONN_NONE
,
191 .external_reference_designator
= "PS2Mouse",
192 .external_connector_type
= CONN_PS_2
,
193 .port_type
= TYPE_MOUSE_PORT
196 .internal_reference_designator
= "PS2_USB1",
197 .internal_connector_type
= CONN_NONE
,
198 .external_reference_designator
= "USB 2.0 Type-A",
199 .external_connector_type
= CONN_ACCESS_BUS_USB
,
200 .port_type
= TYPE_USB
203 .internal_reference_designator
= "PS2_USB1",
204 .internal_connector_type
= CONN_NONE
,
205 .external_reference_designator
= "USB 2.0 Type-A (Flash BIOS)",
206 .external_connector_type
= CONN_ACCESS_BUS_USB
,
207 .port_type
= TYPE_USB
210 .internal_reference_designator
= "JTPM1 - TPM HDR",
211 .internal_connector_type
= CONN_OTHER
,
212 .external_reference_designator
= "",
213 .external_connector_type
= CONN_NONE
,
214 .port_type
= TYPE_OTHER_PORT
217 .internal_reference_designator
= "LAN_USB1",
218 .internal_connector_type
= CONN_NONE
,
219 .external_reference_designator
= "Ethernet",
220 .external_connector_type
= CONN_RJ_45
,
221 .port_type
= TYPE_NETWORK_PORT
224 .internal_reference_designator
= "LAN_USB1",
225 .internal_connector_type
= CONN_NONE
,
226 .external_reference_designator
= "USB 3.2 Gen2x2 Type-C",
227 .external_connector_type
= CONN_USB_TYPE_C
,
228 .port_type
= TYPE_USB
231 .internal_reference_designator
= "LAN_USB1",
232 .internal_connector_type
= CONN_NONE
,
233 .external_reference_designator
= "USB 3.2 Gen2 Type-A",
234 .external_connector_type
= CONN_ACCESS_BUS_USB
,
235 .port_type
= TYPE_USB
238 .internal_reference_designator
= "SATA1",
239 .internal_connector_type
= CONN_SAS_SATA
,
240 .external_reference_designator
= "",
241 .external_connector_type
= CONN_NONE
,
242 .port_type
= TYPE_SATA
245 .internal_reference_designator
= "SATA2",
246 .internal_connector_type
= CONN_SAS_SATA
,
247 .external_reference_designator
= "",
248 .external_connector_type
= CONN_NONE
,
249 .port_type
= TYPE_SATA
252 .internal_reference_designator
= "SATA3",
253 .internal_connector_type
= CONN_SAS_SATA
,
254 .external_reference_designator
= "",
255 .external_connector_type
= CONN_NONE
,
256 .port_type
= TYPE_SATA
259 .internal_reference_designator
= "SATA4",
260 .internal_connector_type
= CONN_SAS_SATA
,
261 .external_reference_designator
= "",
262 .external_connector_type
= CONN_NONE
,
263 .port_type
= TYPE_SATA
266 .internal_reference_designator
= "SATA5",
267 .internal_connector_type
= CONN_SAS_SATA
,
268 .external_reference_designator
= "",
269 .external_connector_type
= CONN_NONE
,
270 .port_type
= TYPE_SATA
273 .internal_reference_designator
= "SATA6",
274 .internal_connector_type
= CONN_SAS_SATA
,
275 .external_reference_designator
= "",
276 .external_connector_type
= CONN_NONE
,
277 .port_type
= TYPE_SATA
280 .internal_reference_designator
= "JTBT1",
281 .internal_connector_type
= CONN_OTHER
,
282 .external_reference_designator
= "",
283 .external_connector_type
= CONN_NONE
,
284 .port_type
= TYPE_THUNDERBOLT
287 .internal_reference_designator
= "JC1 - CHASSIS INTRUSION",
288 .internal_connector_type
= CONN_OTHER
,
289 .external_reference_designator
= "",
290 .external_connector_type
= CONN_NONE
,
291 .port_type
= TYPE_OTHER_PORT
294 .internal_reference_designator
= "JAUD1 - FRONT AUDIO",
295 .internal_connector_type
= CONN_OTHER
,
296 .external_reference_designator
= "",
297 .external_connector_type
= CONN_NONE
,
298 .port_type
= TYPE_AUDIO_PORT
301 .internal_reference_designator
= "AUDIO1 - REAR AUDIO",
302 .internal_connector_type
= CONN_NONE
,
303 .external_reference_designator
= "Audio",
304 .external_connector_type
= CONN_OTHER
,
305 .port_type
= TYPE_AUDIO_PORT
308 .internal_reference_designator
= "JFP1 - FRONT PANEL",
309 .internal_connector_type
= CONN_OTHER
,
310 .external_reference_designator
= "",
311 .external_connector_type
= CONN_NONE
,
312 .port_type
= TYPE_OTHER_PORT
315 .internal_reference_designator
= "JFP2 - PC SPEAKER",
316 .internal_connector_type
= CONN_OTHER
,
317 .external_reference_designator
= "",
318 .external_connector_type
= CONN_NONE
,
319 .port_type
= TYPE_OTHER_PORT
322 .internal_reference_designator
= "JBAT1 - CLEAR CMOS",
323 .internal_connector_type
= CONN_OTHER
,
324 .external_reference_designator
= "",
325 .external_connector_type
= CONN_NONE
,
326 .port_type
= TYPE_OTHER_PORT
329 .internal_reference_designator
= "JDASH1 - TUNING CONTROLLER",
330 .internal_connector_type
= CONN_OTHER
,
331 .external_reference_designator
= "",
332 .external_connector_type
= CONN_NONE
,
333 .port_type
= TYPE_OTHER_PORT
336 .internal_reference_designator
= "JRGB1 - 5050 RGB LED",
337 .internal_connector_type
= CONN_OTHER
,
338 .external_reference_designator
= "",
339 .external_connector_type
= CONN_NONE
,
340 .port_type
= TYPE_OTHER_PORT
343 .internal_reference_designator
= "JRAINBOW1 - WS2812B RGB LED",
344 .internal_connector_type
= CONN_OTHER
,
345 .external_reference_designator
= "",
346 .external_connector_type
= CONN_NONE
,
347 .port_type
= TYPE_OTHER_PORT
350 .internal_reference_designator
= "JRAINBOW2 - WS2812B RGB LED",
351 .internal_connector_type
= CONN_OTHER
,
352 .external_reference_designator
= "",
353 .external_connector_type
= CONN_NONE
,
354 .port_type
= TYPE_OTHER_PORT
357 .internal_reference_designator
= "CPU_FAN1",
358 .internal_connector_type
= CONN_OTHER
,
359 .external_reference_designator
= "",
360 .external_connector_type
= CONN_NONE
,
361 .port_type
= TYPE_OTHER_PORT
364 .internal_reference_designator
= "PUMP_FAN1",
365 .internal_connector_type
= CONN_OTHER
,
366 .external_reference_designator
= "",
367 .external_connector_type
= CONN_NONE
,
368 .port_type
= TYPE_OTHER_PORT
371 .internal_reference_designator
= "SYS_FAN1",
372 .internal_connector_type
= CONN_OTHER
,
373 .external_reference_designator
= "",
374 .external_connector_type
= CONN_NONE
,
375 .port_type
= TYPE_OTHER_PORT
378 .internal_reference_designator
= "SYS_FAN2",
379 .internal_connector_type
= CONN_OTHER
,
380 .external_reference_designator
= "",
381 .external_connector_type
= CONN_NONE
,
382 .port_type
= TYPE_OTHER_PORT
385 .internal_reference_designator
= "SYS_FAN3",
386 .internal_connector_type
= CONN_OTHER
,
387 .external_reference_designator
= "",
388 .external_connector_type
= CONN_NONE
,
389 .port_type
= TYPE_OTHER_PORT
392 .internal_reference_designator
= "SYS_FAN4",
393 .internal_connector_type
= CONN_OTHER
,
394 .external_reference_designator
= "",
395 .external_connector_type
= CONN_NONE
,
396 .port_type
= TYPE_OTHER_PORT
399 .internal_reference_designator
= "SYS_FAN5",
400 .internal_connector_type
= CONN_OTHER
,
401 .external_reference_designator
= "",
402 .external_connector_type
= CONN_NONE
,
403 .port_type
= TYPE_OTHER_PORT
406 .internal_reference_designator
= "SYS_FAN6",
407 .internal_connector_type
= CONN_OTHER
,
408 .external_reference_designator
= "",
409 .external_connector_type
= CONN_NONE
,
410 .port_type
= TYPE_OTHER_PORT
413 .internal_reference_designator
= "DP_HDMI1",
414 .internal_connector_type
= CONN_NONE
,
415 .external_reference_designator
= "HDMI",
416 .external_connector_type
= CONN_OTHER
,
417 .port_type
= TYPE_VIDEO_PORT
420 .internal_reference_designator
= "DP_HDMI1",
421 .internal_connector_type
= CONN_NONE
,
422 .external_reference_designator
= "Display Port",
423 .external_connector_type
= CONN_OTHER
,
424 .port_type
= TYPE_VIDEO_PORT
427 .internal_reference_designator
= "USB2",
428 .internal_connector_type
= CONN_NONE
,
429 .external_reference_designator
= "USB 2.0 Type-A (Upper)",
430 .external_connector_type
= CONN_ACCESS_BUS_USB
,
431 .port_type
= TYPE_USB
434 .internal_reference_designator
= "USB2",
435 .internal_connector_type
= CONN_NONE
,
436 .external_reference_designator
= "USB 2.0 Type-A (Lower)",
437 .external_connector_type
= CONN_ACCESS_BUS_USB
,
438 .port_type
= TYPE_USB
441 .internal_reference_designator
= "USB2",
442 .internal_connector_type
= CONN_NONE
,
443 .external_reference_designator
= "USB 3.2 Gen1 Type-A (Upper)",
444 .external_connector_type
= CONN_ACCESS_BUS_USB
,
445 .port_type
= TYPE_USB
448 .internal_reference_designator
= "USB2",
449 .internal_connector_type
= CONN_NONE
,
450 .external_reference_designator
= "USB 3.2 Gen1 Type-A (Lower)",
451 .external_connector_type
= CONN_ACCESS_BUS_USB
,
452 .port_type
= TYPE_USB
455 .internal_reference_designator
= "JUSB1 - USB 2.0 ",
456 .internal_connector_type
= CONN_OTHER
,
457 .external_reference_designator
= "",
458 .external_connector_type
= CONN_NONE
,
459 .port_type
= TYPE_USB
462 .internal_reference_designator
= "JUSB2 - USB 2.0",
463 .internal_connector_type
= CONN_OTHER
,
464 .external_reference_designator
= "",
465 .external_connector_type
= CONN_NONE
,
466 .port_type
= TYPE_USB
469 .internal_reference_designator
= "JUSB3 - USB 3.2 GEN 1",
470 .internal_connector_type
= CONN_OTHER
,
471 .external_reference_designator
= "",
472 .external_connector_type
= CONN_NONE
,
473 .port_type
= TYPE_USB
476 .internal_reference_designator
= "JUSB4 - USB 3.2 GEN 1",
477 .internal_connector_type
= CONN_OTHER
,
478 .external_reference_designator
= "",
479 .external_connector_type
= CONN_NONE
,
480 .port_type
= TYPE_USB
483 .internal_reference_designator
= "JUSB5 - USB-C",
484 .internal_connector_type
= CONN_OTHER
,
485 .external_reference_designator
= "",
486 .external_connector_type
= CONN_NONE
,
487 .port_type
= TYPE_USB
490 .internal_reference_designator
= "ATX_PWR1",
491 .internal_connector_type
= CONN_OTHER
,
492 .external_reference_designator
= "",
493 .external_connector_type
= CONN_NONE
,
494 .port_type
= TYPE_OTHER_PORT
497 .internal_reference_designator
= "CPU_PWR1",
498 .internal_connector_type
= CONN_OTHER
,
499 .external_reference_designator
= "",
500 .external_connector_type
= CONN_NONE
,
501 .port_type
= TYPE_OTHER_PORT
504 .internal_reference_designator
= "CPU_PWR2",
505 .internal_connector_type
= CONN_OTHER
,
506 .external_reference_designator
= "",
507 .external_connector_type
= CONN_NONE
,
508 .port_type
= TYPE_OTHER_PORT
512 static int mainboard_smbios_data(struct device
*dev
, int *handle
, unsigned long *current
)
516 // add port information
517 len
+= smbios_write_type8(
520 ARRAY_SIZE(smbios_type8_info
)
527 static void mainboard_enable(struct device
*dev
)
529 #if CONFIG(GENERATE_SMBIOS_TABLES)
530 dev
->ops
->get_smbios_data
= mainboard_smbios_data
;
534 struct chip_operations mainboard_ops
= {
535 .init
= mainboard_init
,
536 .enable_dev
= mainboard_enable
,