12 #include <soc/pci_devs.h>
19 #define rom_base ((void *)(uintptr_t)(0x100000000ULL - CONFIG_ROM_SIZE))
67 static bool can_use_dma(
void *destination,
size_t source,
size_t size)
73 const size_t warning_size = 1024;
79 if (size > warning_size)
85 if (size > warning_size)
97 printk(
BIOS_SPEW,
"%s: dest: %p, source: %#zx, remaining: %zu\n", __func__,
150 printk(
BIOS_ERR,
"SPI DMA failure: dest: %p, source: %#zx, size: %zu\n",
181 size_t source,
size_t size)
190 printk(
BIOS_SPEW,
"%s: start: dest: %p, source: %#zx, size: %zu\n", __func__,
212 return transaction.
size;
244 table->
size = CONFIG_ROM_SIZE;
void * memcpy(void *dest, const void *src, size_t n)
#define assert(statement)
static struct mmap_helper_region_device mdev
#define printk(level,...)
static struct region_device rdev
#define container_of(ptr, type, member)
container_of - cast a member of a structure out to the containing structure
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
void thread_mutex_unlock(struct thread_mutex *mutex)
void thread_mutex_lock(struct thread_mutex *mutex)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define REGION_DEV_INIT(ops_, offset_, size_)
#define LPC_ROM_DMA_MIN_ALIGNMENT
#define LPC_ROM_DMA_CTRL_START
#define LPC_ROM_DMA_CTRL_DW_COUNT(bytes)
#define LPC_ROM_DMA_EC_HOST_CONTROL
#define LPC_ROM_DMA_DST_ADDR
#define LPC_ROM_DMA_SRC_ADDR
#define LPC_ROM_DMA_CTRL_MAX_BYTES
#define LPC_ROM_DMA_CTRL_DW_COUNT_MASK
#define LPC_ROM_DMA_CTRL_ERROR
struct thread_mutex spi_hw_mutex
void spi_write8(uint8_t reg, uint8_t val)
uint8_t spi_read8(uint8_t reg)
static bool spi_dma_is_busy(void)
static bool continue_spi_dma_transaction(const struct region_device *rd, struct spi_dma_transaction *transaction)
static ssize_t spi_dma_readat(const struct region_device *rd, void *b, size_t offset, size_t size)
const struct region_device_ops spi_dma_rdev_ro_ops
uint32_t spi_flash_get_mmap_windows(struct flash_mmap_window *table)
static ssize_t spi_dma_readat_dma(const struct region_device *rd, void *destination, size_t source, size_t size)
const struct region_device * boot_device_ro(void)
static void * spi_dma_mmap(const struct region_device *rd, size_t offset, size_t size __unused)
static ssize_t spi_dma_readat_mmap(const struct region_device *rd, void *b, size_t offset, size_t size)
static int spi_dma_munmap(const struct region_device *rd __unused, void *mapping __unused)
static bool spi_dma_has_error(void)
static bool can_use_dma(void *destination, size_t source, size_t size)
static void spi_dma_fix(void)
static void start_spi_dma_transaction(struct spi_dma_transaction *transaction)
static struct thread_mutex spi_dma_hw_mutex
void boot_device_init(void)
static const struct mem_region_device boot_dev
struct region_device rdev
void *(* mmap)(const struct region_device *, size_t, size_t)