| 1 |
|
| 2 |
|
| 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> |
| 8 |
|
| 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 |
| 12 |
}; |
| 13 |
|
| 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 |
| 17 |
}; |
| 18 |
|
| 19 |
|
| 20 |
#define PLATFORM_RESET_STRING_LENGTH 20 |
| 21 |
|
| 22 |
struct pch_reset_data { |
| 23 |
char reserved[PLATFORM_RESET_STRING_LENGTH]; |
| 24 |
efi_guid_t global_reset_uid; |
| 25 |
}; |
| 26 |
|
| 27 |
|
| 28 |
struct fsp_reset_hob { |
| 29 |
EFI_RESET_TYPE reset_type; |
| 30 |
struct pch_reset_data reset_data; |
| 31 |
}; |
| 32 |
|
| 33 |
void chipset_handle_reset(efi_return_status_t status) |
| 34 |
{ |
| 35 |
if (status == CONFIG_FSP_STATUS_GLOBAL_RESET) { |
| 36 |
printk(BIOS_DEBUG, "GLOBAL RESET!\n"); |
| 37 |
global_reset(); |
| 38 |
} |
| 39 |
|
| 40 |
fsp_printk(status, BIOS_ERR, "unhandled reset type"); |
| 41 |
die("unknown reset type"); |
| 42 |
} |
| 43 |
|
| 44 |
static efi_return_status_t fsp_reset_type_to_status(EFI_RESET_TYPE reset_type) |
| 45 |
{ |
| 46 |
efi_return_status_t status; |
| 47 |
|
| 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"); |
| 58 |
} |
| 59 |
|
| 60 |
return status; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
efi_return_status_t fsp_get_pch_reset_status(void) |
| 72 |
{ |
| 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; |
| 77 |
|
| 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; |
| 82 |
|
| 83 |
return fsp_reset_type_to_status(hob->reset_type); |
| 84 |
} |