soc/mediatek/mt8196: Initialize SSPM
[coreboot.git] / src / soc / intel / common / fsp_reset.c
blob983d4fce5311c118d1881f8a0c0f1e564255ef5a
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <fsp/api.h>
5 #include <fsp/util.h>
6 #include <soc/intel/common/reset.h>
7 #include <stdint.h>
9 static const uint8_t fsp_reset_guid[16] = {
10 0xff, 0x97, 0x05, 0xea, 0x58, 0x88, 0xca, 0x41,
11 0xbb, 0xc1, 0xfe, 0x18, 0xfc, 0xd2, 0x8e, 0x22
14 static const uint8_t fsp_global_reset_guid[16] = {
15 0x4c, 0x1b, 0xb3, 0x9d, 0xef, 0xf5, 0xbb, 0x48,
16 0x94, 0x2b, 0x18, 0x1f, 0x7e, 0x3a, 0x3e, 0x40
19 /* Platform Reset String as per Intel FSP is "PCH RESET" in unicode */
20 #define PLATFORM_RESET_STRING_LENGTH 20
22 struct pch_reset_data {
23 char reserved[PLATFORM_RESET_STRING_LENGTH];
24 efi_guid_t global_reset_uid;
27 /* This structure is used to provide information about PCH Reset */
28 struct fsp_reset_hob {
29 EFI_RESET_TYPE reset_type;
30 struct pch_reset_data reset_data;
33 void chipset_handle_reset(efi_return_status_t status)
35 if (status == CONFIG_FSP_STATUS_GLOBAL_RESET) {
36 printk(BIOS_DEBUG, "GLOBAL RESET!\n");
37 global_reset();
40 fsp_printk(status, BIOS_ERR, "unhandled reset type");
41 die("unknown reset type");
44 static efi_return_status_t fsp_reset_type_to_status(EFI_RESET_TYPE reset_type)
46 efi_return_status_t status;
48 switch (reset_type) {
49 case EfiResetCold:
50 status = FSP_STATUS_RESET_REQUIRED_COLD;
51 break;
52 case EfiResetWarm:
53 status = FSP_STATUS_RESET_REQUIRED_WARM;
54 break;
55 default:
56 printk(BIOS_ERR, "unhandled reset type %x\n", reset_type);
57 die("unknown reset type");
60 return status;
64 * Return PCH Reset Status
65 * The return status can be between EfiResetCold, EfiResetWarm, EfiResetShutdown
66 * or EfiResetPlatformSpecific.
68 * If reset type is `EfiResetPlatformSpecific` then relying on pch_reset_data structure
69 * to know if the reset type is a global reset.
71 efi_return_status_t fsp_get_pch_reset_status(void)
73 size_t size;
74 const struct fsp_reset_hob *hob = fsp_find_extension_hob_by_guid(fsp_reset_guid, &size);
75 if (!hob)
76 return 0;
78 if ((hob->reset_type == EfiResetPlatformSpecific) &&
79 fsp_guid_compare((void *)&(hob->reset_data.global_reset_uid),
80 fsp_global_reset_guid))
81 return CONFIG_FSP_STATUS_GLOBAL_RESET;
83 return fsp_reset_type_to_status(hob->reset_type);