coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spi.c File Reference
#include <device/device.h>
#include <device/mmio.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <device/spi.h>
#include <intelblocks/fast_spi.h>
#include <intelblocks/gspi.h>
#include <intelblocks/spi.h>
#include <soc/pci_devs.h>
#include <spi-generic.h>
Include dependency graph for spi.c:

Go to the source code of this file.

Data Structures

union  spi_bios_gpr0
 

Macros

#define __SIMPLE_DEVICE__
 
#define MMIO_BIOS_GPR0   0x98
 

Functions

static uintptr_t get_spi_bar (pci_devfn_t dev)
 
static uint32_t spi_read_bar (pci_devfn_t dev, uint32_t offset)
 
static uint32_t spi_read_bios_gpr0 (void)
 
static uint32_t spi_get_wp_cse_ro_start_offset (union spi_bios_gpr0 bios_gpr0)
 
static uint32_t spi_get_wp_cse_ro_limit (union spi_bios_gpr0 bios_gpr0)
 
bool is_spi_wp_cse_ro_en (void)
 
void spi_get_wp_cse_ro_range (uint32_t *base, uint32_t *limit)
 
static int spi_dev_to_bus (struct device *dev)
 

Variables

const struct spi_ctrlr_buses spi_ctrlr_bus_map []
 
const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map)
 
static struct spi_bus_operations spi_bus_ops
 
static struct device_operations spi_dev_ops
 
static const unsigned short pci_device_ids []
 
static const struct pci_driver pch_spi __pci_driver
 

Macro Definition Documentation

◆ __SIMPLE_DEVICE__

#define __SIMPLE_DEVICE__

Definition at line 3 of file spi.c.

◆ MMIO_BIOS_GPR0

#define MMIO_BIOS_GPR0   0x98

Definition at line 27 of file spi.c.

Function Documentation

◆ get_spi_bar()

static uintptr_t get_spi_bar ( pci_devfn_t  dev)
static

Definition at line 54 of file spi.c.

References assert, PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_MEM_ATTR_MASK, and pci_read_config32().

Referenced by spi_read_bar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_spi_wp_cse_ro_en()

bool is_spi_wp_cse_ro_en ( void  )

Definition at line 87 of file spi.c.

References spi_bios_gpr0::data, spi_bios_gpr0::fields, spi_read_bios_gpr0(), and spi_bios_gpr0::write_protect_en.

Referenced by log_me_ro_write_protection_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_dev_to_bus()

static int spi_dev_to_bus ( struct device dev)
static

Definition at line 104 of file spi.c.

◆ spi_get_wp_cse_ro_limit()

static uint32_t spi_get_wp_cse_ro_limit ( union spi_bios_gpr0  bios_gpr0)
static

Definition at line 82 of file spi.c.

References spi_bios_gpr0::fields, and spi_bios_gpr0::protect_range_limit.

Referenced by spi_get_wp_cse_ro_range().

Here is the caller graph for this function:

◆ spi_get_wp_cse_ro_range()

void spi_get_wp_cse_ro_range ( uint32_t base,
uint32_t limit 
)

Definition at line 95 of file spi.c.

References base, spi_bios_gpr0::data, spi_get_wp_cse_ro_limit(), spi_get_wp_cse_ro_start_offset(), and spi_read_bios_gpr0().

Referenced by log_me_ro_write_protection_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_get_wp_cse_ro_start_offset()

static uint32_t spi_get_wp_cse_ro_start_offset ( union spi_bios_gpr0  bios_gpr0)
static

Definition at line 77 of file spi.c.

References spi_bios_gpr0::fields, and spi_bios_gpr0::protect_range_base.

Referenced by spi_get_wp_cse_ro_range().

Here is the caller graph for this function:

◆ spi_read_bar()

static uint32_t spi_read_bar ( pci_devfn_t  dev,
uint32_t  offset 
)
static

Definition at line 67 of file spi.c.

References get_spi_bar(), offset, and read32p().

Referenced by spi_read_bios_gpr0().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_read_bios_gpr0()

static uint32_t spi_read_bios_gpr0 ( void  )
static

Definition at line 72 of file spi.c.

References MMIO_BIOS_GPR0, PCH_DEV_SPI, and spi_read_bar().

Referenced by is_spi_wp_cse_ro_en(), and spi_get_wp_cse_ro_range().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

const struct pci_driver pch_spi __pci_driver
static
Initial value:
= {
.ops = &spi_dev_ops,
.vendor = PCI_VID_INTEL,
.devices = pci_device_ids,
}
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
static struct device_operations spi_dev_ops
Definition: spi.c:113
static const unsigned short pci_device_ids[]
Definition: spi.c:122

Definition at line 122 of file spi.c.

◆ pci_device_ids

const unsigned short pci_device_ids[]
static

Definition at line 122 of file spi.c.

◆ spi_bus_ops

struct spi_bus_operations spi_bus_ops
static
Initial value:
= {
.dev_to_bus = &spi_dev_to_bus,
}
static int spi_dev_to_bus(struct device *dev)
Definition: spi.c:104

Definition at line 104 of file spi.c.

◆ spi_ctrlr_bus_map

const struct spi_ctrlr_buses spi_ctrlr_bus_map[]
Initial value:
= {
{ .ctrlr = &fast_spi_flash_ctrlr, .bus_start = 0, .bus_end = 0 },
}
const struct spi_ctrlr fast_spi_flash_ctrlr

Definition at line 1 of file spi.c.

◆ spi_ctrlr_bus_map_count

const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map)

Definition at line 25 of file spi.c.

◆ spi_dev_ops

struct device_operations spi_dev_ops
static
Initial value:
= {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.scan_bus = scan_generic_bus,
.ops_spi_bus = &spi_bus_ops,
.ops_pci = &pci_dev_ops_pci,
}
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
void scan_generic_bus(struct device *bus)
Definition: root_device.c:52
static struct spi_bus_operations spi_bus_ops
Definition: spi.c:109

Definition at line 104 of file spi.c.