From 6f1155916a8b2f5409d0992963a1c16178794a48 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 11 Aug 2016 18:24:54 -0500 Subject: drivers/spi: provide optional implementation of boot_device_rw() On many x86 platforms the boot device is SPI which is memory mapped. However, in order to write to the boot device one needs to use the SPI api. Therefore, provide a common implementation of boot_device_rw() which has no mmap() functionality. It only reads, writes, and erases. This will be used in the existing infrastructure but in a SPI agnostic way. Two options are added: 1. BOOT_DEVICE_SPI_FLASH_RW_NOMMAP 2. BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY The former is auto-selected when COMMON_CBFS_SPI_WRAPPER is not selected. The latter can be used to include the implementation in the early stages such as bootblock, verstage, and romstage. BUG=chrome-os-partner:56151 Change-Id: I2aa75f88409309e3f9b9bd79b52d27c0061139c8 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/16200 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Martin Roth --- src/drivers/spi/Makefile.inc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/drivers/spi/Makefile.inc') diff --git a/src/drivers/spi/Makefile.inc b/src/drivers/spi/Makefile.inc index 8fd59846dc..92baf62bc3 100644 --- a/src/drivers/spi/Makefile.inc +++ b/src/drivers/spi/Makefile.inc @@ -9,6 +9,7 @@ endif bootblock-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c bootblock-$(CONFIG_SPI_FLASH) += spi_flash.c +bootblock-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY) += boot_device_rw_nommap.c bootblock-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c bootblock-$(CONFIG_SPI_FLASH_AMIC) += amic.c bootblock-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c @@ -23,6 +24,7 @@ bootblock-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c romstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c romstage-$(CONFIG_SPI_FLASH) += spi_flash.c +romstage-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY) += boot_device_rw_nommap.c romstage-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c romstage-$(CONFIG_SPI_FLASH_AMIC) += amic.c romstage-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c @@ -37,6 +39,7 @@ romstage-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c verstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c verstage-$(CONFIG_SPI_FLASH) += spi_flash.c +verstage-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY) += boot_device_rw_nommap.c verstage-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c verstage-$(CONFIG_SPI_FLASH_AMIC) += amic.c verstage-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c @@ -51,6 +54,7 @@ verstage-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c ramstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c ramstage-$(CONFIG_SPI_FLASH) += spi_flash.c +ramstage-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP) += boot_device_rw_nommap.c ramstage-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c ramstage-$(CONFIG_SPI_FLASH_AMIC) += amic.c ramstage-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c @@ -66,6 +70,7 @@ ramstage-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c ifeq ($(CONFIG_SPI_FLASH_SMM),y) # SPI flash driver interface smm-$(CONFIG_SPI_FLASH) += spi_flash.c +smm-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP) += boot_device_rw_nommap.c # drivers smm-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c -- cgit v1.2.3