coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
psp_efs.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <amdblocks/psp_efs.h>
4 #include <arch/mmio.h>
5 #include <boot_device.h>
6 #include <commonlib/region.h>
7 #include <types.h>
8 
9 static struct embedded_firmware *efs;
10 
11 bool efs_is_valid(void)
12 {
13  if (!efs)
14  efs = rdev_mmap(boot_device_ro(), EFS_OFFSET, sizeof(*efs));
15 
17  return false;
18 
19  return true;
20 }
21 
23 {
24  if (!efs_is_valid())
25  return false;
26 
27  *mode = efs->SPI_MODE_FIELD;
28  *speed = efs->SPI_SPEED_FIELD;
29  return true;
30 }
const struct region_device * boot_device_ro(void)
Definition: rom_media.c:9
bool efs_is_valid(void)
Definition: psp_efs.c:11
bool read_efs_spi_settings(uint8_t *mode, uint8_t *speed)
Definition: psp_efs.c:22
static struct embedded_firmware * efs
Definition: psp_efs.c:9
#define EMBEDDED_FW_SIGNATURE
Definition: psp_efs.h:11
#define EFS_OFFSET
Definition: psp_efs.h:9
void * rdev_mmap(const struct region_device *rd, size_t offset, size_t size)
Definition: region.c:46
unsigned char uint8_t
Definition: stdint.h:8
uint32_t signature
Definition: psp_efs.h:36