1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <amdblocks/agesawrapper.h>
4 #include <device/device.h>
5 #include <soc/pci_devs.h>
8 static int is_sata_config(void)
10 return !((SataNativeIde
== CONFIG_STONEYRIDGE_SATA_MODE
)
11 || (SataLegacyIde
== CONFIG_STONEYRIDGE_SATA_MODE
));
14 static inline int sb_sata_enable(void)
16 /* True if IDE or AHCI. */
17 return (SataNativeIde
== CONFIG_STONEYRIDGE_SATA_MODE
) ||
18 (SataAhci
== CONFIG_STONEYRIDGE_SATA_MODE
);
21 static inline int sb_ide_enable(void)
23 /* True if IDE or LEGACY IDE. */
24 return (SataNativeIde
== CONFIG_STONEYRIDGE_SATA_MODE
) ||
25 (SataLegacyIde
== CONFIG_STONEYRIDGE_SATA_MODE
);
28 void SetFchResetParams(FCH_RESET_INTERFACE
*params
)
30 params
->Xhci0Enable
= CONFIG(STONEYRIDGE_XHCI_ENABLE
);
31 if (is_dev_enabled(DEV_PTR(sata
))) {
32 params
->SataEnable
= sb_sata_enable();
33 params
->IdeEnable
= sb_ide_enable();
35 params
->SataEnable
= FALSE
;
36 params
->IdeEnable
= FALSE
;
40 void SetFchEnvParams(FCH_INTERFACE
*params
)
42 params
->AzaliaController
= AzEnable
;
43 params
->SataClass
= CONFIG_STONEYRIDGE_SATA_MODE
;
44 if (is_dev_enabled(DEV_PTR(sata
))) {
45 params
->SataEnable
= is_sata_config();
46 params
->IdeEnable
= !params
->SataEnable
;
47 params
->SataIdeMode
= (CONFIG_STONEYRIDGE_SATA_MODE
==
50 params
->SataEnable
= FALSE
;
51 params
->IdeEnable
= FALSE
;
52 params
->SataIdeMode
= FALSE
;
56 void SetFchMidParams(FCH_INTERFACE
*params
)
58 SetFchEnvParams(params
);