| 1 |
|
| 2 |
|
| 3 |
#include <amdblocks/psp_efs.h> |
| 4 |
#include <boot_device.h> |
| 5 |
#include <commonlib/region.h> |
| 6 |
#include <device/mmio.h> |
| 7 |
#include <types.h> |
| 8 |
|
| 9 |
bool read_efs_spi_settings(uint8_t *mode, uint8_t *speed) |
| 10 |
{ |
| 11 |
bool ret = false; |
| 12 |
struct embedded_firmware *efs; |
| 13 |
|
| 14 |
efs = rdev_mmap(boot_device_ro(), EFS_OFFSET, sizeof(*efs)); |
| 15 |
if (!efs) |
| 16 |
return false; |
| 17 |
|
| 18 |
if (efs->signature == EMBEDDED_FW_SIGNATURE) { |
| 19 |
#ifndef SPI_MODE_FIELD |
| 20 |
printk(BIOS_ERR, "Unknown cpu in psp_efs.h\n"); |
| 21 |
printk(BIOS_ERR, "SPI speed/mode not set.\n"); |
| 22 |
#else |
| 23 |
*mode = efs->SPI_MODE_FIELD; |
| 24 |
*speed = efs->SPI_SPEED_FIELD; |
| 25 |
ret = true; |
| 26 |
#endif |
| 27 |
} |
| 28 |
rdev_munmap(boot_device_ro(), efs); |
| 29 |
return ret; |
| 30 |
} |