[coreboot-gerrit] Change in coreboot[master]: commonlib: Move drivers/storage into commonlib/storage

Lee Leahy (Code Review) gerrit at coreboot.org
Fri May 12 00:45:22 CEST 2017


Lee Leahy has uploaded a new change for review. ( https://review.coreboot.org/19672 )

Change subject: commonlib: Move drivers/storage into commonlib/storage
......................................................................

commonlib: Move drivers/storage into commonlib/storage

Move drivers/storage into commonlib/storage to enable access by
libpayload and indirectly by payloads.

* Remove SD/MMC specific include files from include/device
* Remove files from drivers/storage
* Add SD/MMC specific include files to commonlib/include
* Add files to commonlib/storage
* Fix header file references
* Add subdir entry in commonlib/Makefile.inc to build the SD/MMC driver
* Add Kconfig source for commonlib/storage
* Rename *DEVICE* to *COMMONLIB*
* Rename *DRIVERS_STORAGE* to *COMMONLIB_STORAGE*

TEST=Build and run on Galileo Gen2

Change-Id: I4339e4378491db9a0da1f2dc34e1906a5ba31ad6
Signed-off-by: Lee Leahy <Leroy.P.Leahy at intel.com>
---
M src/Kconfig
M src/arch/x86/car.ld
M src/commonlib/Makefile.inc
R src/commonlib/include/commonlib/sd_mmc_ctrlr.h
R src/commonlib/include/commonlib/sdhci.h
R src/commonlib/include/commonlib/storage.h
R src/commonlib/storage/Kconfig
R src/commonlib/storage/Makefile.inc
R src/commonlib/storage/bouncebuf.c
R src/commonlib/storage/bouncebuf.h
R src/commonlib/storage/mmc.c
R src/commonlib/storage/mmc.h
R src/commonlib/storage/pci_sdhci.c
R src/commonlib/storage/sd.c
R src/commonlib/storage/sd_mmc.c
R src/commonlib/storage/sd_mmc.h
R src/commonlib/storage/sdhci.c
R src/commonlib/storage/sdhci.h
R src/commonlib/storage/sdhci_adma.c
R src/commonlib/storage/sdhci_display.c
R src/commonlib/storage/storage.c
R src/commonlib/storage/storage.h
R src/commonlib/storage/storage_erase.c
R src/commonlib/storage/storage_write.c
M src/mainboard/intel/galileo/Kconfig
M src/mainboard/intel/galileo/Makefile.inc
M src/mainboard/intel/galileo/sd.c
M src/soc/intel/quark/Kconfig
M src/soc/intel/quark/include/soc/storage_test.h
M src/soc/intel/quark/sd.c
M src/soc/intel/quark/storage_test.c
31 files changed, 88 insertions(+), 86 deletions(-)


  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/19672/1

diff --git a/src/Kconfig b/src/Kconfig
index ffaf7eb..2ab9861 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -353,6 +353,7 @@
 menu "Generic Drivers"
 source "src/drivers/*/Kconfig"
 source "src/drivers/*/*/Kconfig"
+source "src/commonlib/storage/Kconfig"
 endmenu
 
 source "src/acpi/Kconfig"
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index a9a281e..bfc1b03 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -44,7 +44,7 @@
 	 * to reside in the migrated area (between _car_relocatable_data_start
 	 * and _car_relocatable_data_end). */
 	TIMESTAMP(., 0x100)
-#if IS_ENABLED(CONFIG_DRIVERS_STORAGE)
+#if IS_ENABLED(CONFIG_COMMONLIB_STORAGE)
 	_car_drivers_storage_start = .;
 	. += 256;
 	_car_drivers_storage_end = .;
diff --git a/src/commonlib/Makefile.inc b/src/commonlib/Makefile.inc
index 255a241..edd17c3 100644
--- a/src/commonlib/Makefile.inc
+++ b/src/commonlib/Makefile.inc
@@ -1,3 +1,5 @@
+subdirs-y += storage
+
 bootblock-y += mem_pool.c
 verstage-y += mem_pool.c
 romstage-y += mem_pool.c
diff --git a/src/include/device/sd_mmc_ctrlr.h b/src/commonlib/include/commonlib/sd_mmc_ctrlr.h
similarity index 97%
rename from src/include/device/sd_mmc_ctrlr.h
rename to src/commonlib/include/commonlib/sd_mmc_ctrlr.h
index 2ca2d0f..247c0a5 100644
--- a/src/include/device/sd_mmc_ctrlr.h
+++ b/src/commonlib/include/commonlib/sd_mmc_ctrlr.h
@@ -16,8 +16,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-#ifndef __DEVICE_SD_MMC_CTRLR_H__
-#define __DEVICE_SD_MMC_CTRLR_H__
+#ifndef __COMMONLIB_SD_MMC_CTRLR_H__
+#define __COMMONLIB_SD_MMC_CTRLR_H__
 
 #include <stdint.h>
 
@@ -225,4 +225,4 @@
 void sdhc_log_response(uint32_t entries, uint32_t *response);
 void sdhc_log_ret(int ret);
 
-#endif /* __DEVICE_SD_MMC_CTRLR_H__ */
+#endif /* __COMMONLIB_SD_MMC_CTRLR_H__ */
diff --git a/src/include/device/sdhci.h b/src/commonlib/include/commonlib/sdhci.h
similarity index 93%
rename from src/include/device/sdhci.h
rename to src/commonlib/include/commonlib/sdhci.h
index a86582d..ffeb662 100644
--- a/src/include/device/sdhci.h
+++ b/src/commonlib/include/commonlib/sdhci.h
@@ -16,10 +16,10 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-#ifndef __DEVICE_SDHCI_H__
-#define __DEVICE_SDHCI_H__
+#ifndef __COMMONLIB_SDHCI_H__
+#define __COMMONLIB_SDHCI_H__
 
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
 
 /* Driver specific capabilities */
 #define DRVR_CAP_1V8_VDD			0x00010000
@@ -73,4 +73,4 @@
 /* Add SDHCI controller with memory address */
 struct sd_mmc_ctrlr *new_mem_sdhci_controller(void *ioaddr);
 
-#endif /* __DEVICE_SDHCI_H__ */
+#endif /* __COMMONLIB_SDHCI_H__ */
diff --git a/src/include/device/storage.h b/src/commonlib/include/commonlib/storage.h
similarity index 96%
rename from src/include/device/storage.h
rename to src/commonlib/include/commonlib/storage.h
index ef7e0ff..6ad53dc 100644
--- a/src/include/device/storage.h
+++ b/src/commonlib/include/commonlib/storage.h
@@ -16,10 +16,10 @@
  * GNU General Public License for more details.
  */
 
-#ifndef __DEVICE_STORAGE_H__
-#define __DEVICE_STORAGE_H__
+#ifndef __COMMONLIB_STORAGE_H__
+#define __COMMONLIB_STORAGE_H__
 
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
 
 /*
  * EXT_CSD fields
@@ -148,4 +148,4 @@
 
 void storage_display_setup(struct storage_media *media);
 
-#endif /* __DEVICE_STORAGE_H__ */
+#endif /* __COMMONLIB_STORAGE_H__ */
diff --git a/src/drivers/storage/Kconfig b/src/commonlib/storage/Kconfig
similarity index 94%
rename from src/drivers/storage/Kconfig
rename to src/commonlib/storage/Kconfig
index 497c0ac..c7bb70d 100644
--- a/src/drivers/storage/Kconfig
+++ b/src/commonlib/storage/Kconfig
@@ -13,17 +13,17 @@
 ## GNU General Public License for more details.
 ##
 
-config DRIVERS_STORAGE
+config COMMONLIB_STORAGE
 	bool
 	default n
 
-if DRIVERS_STORAGE
+if COMMONLIB_STORAGE
 
-config DRIVERS_STORAGE_MMC
+config COMMONLIB_STORAGE_MMC
 	bool "Enable MultiMediaCard (MMC) and eMMC device support"
 	default n
 
-config DRIVERS_STORAGE_SD
+config COMMONLIB_STORAGE_SD
 	bool "Enable Secure Digital (SD) memory card support"
 	default n
 
@@ -102,4 +102,4 @@
 	default n
 
 endif # SDHCI_CONTROLLER
-endif # DRIVERS_STORAGE
+endif # COMMONLIB_STORAGE
diff --git a/src/drivers/storage/Makefile.inc b/src/commonlib/storage/Makefile.inc
similarity index 92%
rename from src/drivers/storage/Makefile.inc
rename to src/commonlib/storage/Makefile.inc
index c4f75c7..af5137e 100644
--- a/src/drivers/storage/Makefile.inc
+++ b/src/commonlib/storage/Makefile.inc
@@ -13,7 +13,7 @@
 # GNU General Public License for more details.
 #
 
-ifeq ($(CONFIG_DRIVERS_STORAGE),y)
+ifeq ($(CONFIG_COMMONLIB_STORAGE),y)
 
 bootblock-y += sd_mmc.c
 bootblock-y += storage.c
@@ -69,22 +69,22 @@
 endif # CONFIG_SDHCI_CONTROLLER
 
 # Determine if MultiMediaCards or embedded MMC devices are supported
-ifeq ($(CONFIG_DRIVERS_STORAGE_MMC),y)
+ifeq ($(CONFIG_COMMONLIB_STORAGE_MMC),y)
 bootblock-y += mmc.c
 verstage-y += mmc.c
 romstage-y += mmc.c
 postcar-y += mmc.c
 ramstage-y += mmc.c
-endif # CONFIG_DRIVERS_STORAGE_MMC
+endif # CONFIG_COMMONLIB_STORAGE_MMC
 
 # Determine if Secure Digital cards are supported
-ifeq ($(CONFIG_DRIVERS_STORAGE_SD),y)
+ifeq ($(CONFIG_COMMONLIB_STORAGE_SD),y)
 bootblock-y += sd.c
 verstage-y += sd.c
 romstage-y += sd.c
 postcar-y += sd.c
 ramstage-y += sd.c
-endif # CONFIG_DRIVERS_STORAGE_SD
+endif # CONFIG_COMMONLIB_STORAGE_SD
 
 # Determine if erase operations are supported
 ifeq ($(CONFIG_STORAGE_ERASE),y)
@@ -104,4 +104,4 @@
 ramstage-y += storage_write.c
 endif # CONFIG_STORAGE_WRITE
 
-endif # CONFIG_DRIVERS_STORAGE
+endif # CONFIG_COMMONLIB_STORAGE
diff --git a/src/drivers/storage/bouncebuf.c b/src/commonlib/storage/bouncebuf.c
similarity index 100%
rename from src/drivers/storage/bouncebuf.c
rename to src/commonlib/storage/bouncebuf.c
diff --git a/src/drivers/storage/bouncebuf.h b/src/commonlib/storage/bouncebuf.h
similarity index 96%
rename from src/drivers/storage/bouncebuf.h
rename to src/commonlib/storage/bouncebuf.h
index deea4f8..27d92e8 100644
--- a/src/drivers/storage/bouncebuf.h
+++ b/src/commonlib/storage/bouncebuf.h
@@ -15,8 +15,8 @@
  * GNU General Public License for more details.
  */
 
-#ifndef __DRIVERS_STORAGE_BOUNCEBUF_H__
-#define __DRIVERS_STORAGE_BOUNCEBUF_H__
+#ifndef __COMMONLIB_STORAGE_BOUNCEBUF_H__
+#define __COMMONLIB_STORAGE_BOUNCEBUF_H__
 
 #include <stddef.h>
 #include <stdint.h>
@@ -93,4 +93,4 @@
 #define ARCH_DMA_MINALIGN (DMA_MINALIGN)
 #endif
 
-#endif // __DRIVERS_STORAGE_BOUNCEBUF_H__
+#endif // __COMMONLIB_STORAGE_BOUNCEBUF_H__
diff --git a/src/drivers/storage/mmc.c b/src/commonlib/storage/mmc.c
similarity index 99%
rename from src/drivers/storage/mmc.c
rename to src/commonlib/storage/mmc.c
index 9736723..4289b01 100644
--- a/src/drivers/storage/mmc.c
+++ b/src/commonlib/storage/mmc.c
@@ -19,8 +19,8 @@
  * GNU General Public License for more details.
  */
 
+#include <commonlib/storage.h>
 #include <console/console.h>
-#include <device/storage.h>
 #include "sd_mmc.h"
 #include "mmc.h"
 #include "sd_mmc.h"
diff --git a/src/drivers/storage/mmc.h b/src/commonlib/storage/mmc.h
similarity index 91%
rename from src/drivers/storage/mmc.h
rename to src/commonlib/storage/mmc.h
index 42d7a4a..87d1635 100644
--- a/src/drivers/storage/mmc.h
+++ b/src/commonlib/storage/mmc.h
@@ -16,10 +16,10 @@
  * GNU General Public License for more details.
  */
 
-#ifndef __DRIVER_STORAGE_MMC_H__
-#define __DRIVER_STORAGE_MMC_H__
+#ifndef __COMMONLIB_STORAGE_MMC_H__
+#define __COMMONLIB_STORAGE_MMC_H__
 
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
 
 #define MMC_HS_TIMING		0x00000100
 #define MMC_HS_52MHZ		0x2
@@ -51,4 +51,4 @@
 int storage_block_setup_media(struct storage_media *media,
 	struct sd_mmc_ctrlr *ctrlr);
 
-#endif /* __DRIVER_STORAGE_MMC_H__ */
+#endif /* __COMMONLIB_STORAGE_MMC_H__ */
diff --git a/src/drivers/storage/pci_sdhci.c b/src/commonlib/storage/pci_sdhci.c
similarity index 97%
rename from src/drivers/storage/pci_sdhci.c
rename to src/commonlib/storage/pci_sdhci.c
index 1d3974e..c53ab00 100644
--- a/src/drivers/storage/pci_sdhci.c
+++ b/src/commonlib/storage/pci_sdhci.c
@@ -19,9 +19,9 @@
 #endif
 
 #include <assert.h>
+#include <commonlib/sdhci.h>
 #include <console/console.h>
 #include <device/pci.h>
-#include <device/sdhci.h>
 #include "sd_mmc.h"
 #include "storage.h"
 #include <string.h>
diff --git a/src/drivers/storage/sd.c b/src/commonlib/storage/sd.c
similarity index 98%
rename from src/drivers/storage/sd.c
rename to src/commonlib/storage/sd.c
index 6f4887a..bd23b7f 100644
--- a/src/drivers/storage/sd.c
+++ b/src/commonlib/storage/sd.c
@@ -20,9 +20,9 @@
  */
 
 #include <assert.h>
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/storage.h>
 #include <delay.h>
-#include <device/sd_mmc_ctrlr.h>
-#include <device/storage.h>
 #include <endian.h>
 #include "sd_mmc.h"
 #include "storage.h"
diff --git a/src/drivers/storage/sd_mmc.c b/src/commonlib/storage/sd_mmc.c
similarity index 97%
rename from src/drivers/storage/sd_mmc.c
rename to src/commonlib/storage/sd_mmc.c
index e018c96..0ca53b7 100644
--- a/src/drivers/storage/sd_mmc.c
+++ b/src/commonlib/storage/sd_mmc.c
@@ -21,8 +21,8 @@
  */
 
 #include <assert.h>
+#include <commonlib/storage.h>
 #include <delay.h>
-#include <device/storage.h>
 #include <endian.h>
 #include "mmc.h"
 #include "sd_mmc.h"
@@ -168,7 +168,7 @@
 
 	/* Test for SD version 2 */
 	err = CARD_TIMEOUT;
-	if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD)) {
+	if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD)) {
 		err = sd_send_if_cond(media);
 
 		/* Get SD card operating condition */
@@ -177,7 +177,7 @@
 	}
 
 	/* If the command timed out, we check for an MMC card */
-	if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC) && (err == CARD_TIMEOUT)) {
+	if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC) && (err == CARD_TIMEOUT)) {
 		/* Some cards seem to need this */
 		sd_mmc_go_idle(media);
 
diff --git a/src/drivers/storage/sd_mmc.h b/src/commonlib/storage/sd_mmc.h
similarity index 92%
rename from src/drivers/storage/sd_mmc.h
rename to src/commonlib/storage/sd_mmc.h
index 57f78ac..d54bbc7 100644
--- a/src/drivers/storage/sd_mmc.h
+++ b/src/commonlib/storage/sd_mmc.h
@@ -12,11 +12,11 @@
  * GNU General Public License for more details.
  */
 
-#ifndef __DRIVERS_STORAGE_SD_MMC_H__
-#define __DRIVERS_STORAGE_SD_MMC_H__
+#ifndef __COMMONLIB_STORAGE_SD_MMC_H__
+#define __COMMONLIB_STORAGE_SD_MMC_H__
 
-#include <device/sd_mmc_ctrlr.h>
-#include <device/storage.h>
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/storage.h>
 #include <stddef.h>
 
 #define SD_MMC_IO_RETRIES	1000
@@ -49,11 +49,13 @@
 int sd_mmc_set_blocklen(struct sd_mmc_ctrlr *ctrlr, int len);
 
 /* MMC support routines */
+int mmc_change_freq(struct storage_media *media);
 int mmc_complete_op_cond(struct storage_media *media);
 const char *mmc_partition_name(struct storage_media *media,
 	unsigned int partition_number);
 int mmc_send_ext_csd(struct sd_mmc_ctrlr *ctrlr, unsigned char *ext_csd);
 int mmc_send_op_cond(struct storage_media *media);
+int mmc_set_bus_width(struct storage_media *media);
 int mmc_set_partition(struct storage_media *media,
 	unsigned int partition_number);
 int mmc_update_capacity(struct storage_media *media);
@@ -64,13 +66,9 @@
 	unsigned int partition_number);
 int sd_send_if_cond(struct storage_media *media);
 int sd_send_op_cond(struct storage_media *media);
+int sd_set_bus_width(struct storage_media *media);
 int sd_set_partition(struct storage_media *media,
 	unsigned int partition_number);
-int sd_set_bus_width(struct storage_media *media);
-
-int mmc_change_freq(struct storage_media *media);
-int mmc_send_status(struct storage_media *media, ssize_t tries);
-int mmc_set_bus_width(struct storage_media *media);
 
 /* Controller debug functions */
 #define sdhc_debug(format...) \
@@ -98,4 +96,4 @@
 	} while (0)
 #define sd_mmc_error(format...) printk(BIOS_ERR, "ERROR: " format)
 
-#endif /* __DRIVERS_STORAGE_SD_MMC_H__ */
+#endif /* __COMMONLIB_STORAGE_SD_MMC_H__ */
diff --git a/src/drivers/storage/sdhci.c b/src/commonlib/storage/sdhci.c
similarity index 99%
rename from src/drivers/storage/sdhci.c
rename to src/commonlib/storage/sdhci.c
index c17aa27..bac510e 100644
--- a/src/drivers/storage/sdhci.c
+++ b/src/commonlib/storage/sdhci.c
@@ -20,10 +20,10 @@
 #include <assert.h>
 #include "bouncebuf.h"
 #include <console/console.h>
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
 #include <delay.h>
-#include <device/sd_mmc_ctrlr.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
 #include <endian.h>
 #include <halt.h>
 #include "sdhci.h"
diff --git a/src/drivers/storage/sdhci.h b/src/commonlib/storage/sdhci.h
similarity index 97%
rename from src/drivers/storage/sdhci.h
rename to src/commonlib/storage/sdhci.h
index 34a2972..5dd5391 100644
--- a/src/drivers/storage/sdhci.h
+++ b/src/commonlib/storage/sdhci.h
@@ -14,11 +14,11 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-#ifndef __DRIVERS_STORAGE_SDHCI_H__
-#define __DRIVERS_STORAGE_SDHCI_H__
+#ifndef __COMMONLIB_STORAGE_SDHCI_H__
+#define __COMMONLIB_STORAGE_SDHCI_H__
 
 #include <arch/io.h>
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
 
 /*
  * Controller registers
@@ -278,4 +278,4 @@
 int sdhci_complete_adma(struct sdhci_ctrlr *sdhci_ctrlr,
 	struct mmc_command *cmd);
 
-#endif /* __DRIVERS_STORAGE_SDHCI_H__ */
+#endif /* __COMMONLIB_STORAGE_SDHCI_H__ */
diff --git a/src/drivers/storage/sdhci_adma.c b/src/commonlib/storage/sdhci_adma.c
similarity index 98%
rename from src/drivers/storage/sdhci_adma.c
rename to src/commonlib/storage/sdhci_adma.c
index 9a945c6..e95742b 100644
--- a/src/drivers/storage/sdhci_adma.c
+++ b/src/commonlib/storage/sdhci_adma.c
@@ -18,9 +18,9 @@
  */
 
 #include <assert.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
 #include <delay.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
 #include <endian.h>
 #include "sdhci.h"
 #include "sd_mmc.h"
diff --git a/src/drivers/storage/sdhci_display.c b/src/commonlib/storage/sdhci_display.c
similarity index 96%
rename from src/drivers/storage/sdhci_display.c
rename to src/commonlib/storage/sdhci_display.c
index a1c1828..d05e35a 100644
--- a/src/drivers/storage/sdhci_display.c
+++ b/src/commonlib/storage/sdhci_display.c
@@ -17,10 +17,10 @@
  * GNU General Public License for more details.
  */
 
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
 #include <console/console.h>
-#include <device/sd_mmc_ctrlr.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
 #include "sdhci.h"
 #include "sd_mmc.h"
 #include "storage.h"
diff --git a/src/drivers/storage/storage.c b/src/commonlib/storage/storage.c
similarity index 94%
rename from src/drivers/storage/storage.c
rename to src/commonlib/storage/storage.c
index 8d7692c..d2b566f 100644
--- a/src/drivers/storage/storage.c
+++ b/src/commonlib/storage/storage.c
@@ -22,7 +22,7 @@
  */
 
 #include <assert.h>
-#include <device/storage.h>
+#include <commonlib/storage.h>
 #include "sd_mmc.h"
 #include "storage.h"
 #include <string.h>
@@ -70,7 +70,7 @@
 	capacity = media->capacity[partition_number];
 	name = storage_partition_name(media, partition_number);
 	separator = "";
-	if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC) && !IS_SD(media))
+	if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC) && !IS_SD(media))
 		separator = ": ";
 
 	/* Determine the decimal divisor for the capacity */
@@ -175,9 +175,9 @@
 		return err;
 
 	/* Increase the bus frequency */
-	if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+	if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
 		err = sd_change_freq(media);
-	else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC)) {
+	else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC)) {
 		err = mmc_change_freq(media);
 		if (!err)
 			mmc_update_capacity(media);
@@ -189,9 +189,9 @@
 	media->caps &= ctrlr->caps;
 
 	/* Increase the bus width if possible */
-	if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+	if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
 		err = sd_set_bus_width(media);
-	else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC))
+	else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC))
 		err = mmc_set_bus_width(media);
 	if (err)
 		return err;
@@ -329,9 +329,9 @@
 
 	/* Select the partition */
 	err = -1;
-	if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+	if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
 		err = sd_set_partition(media, partition_number);
-	else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC))
+	else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC))
 		err = mmc_set_partition(media, partition_number);
 	if (err)
 		sd_mmc_error("Invalid partition number!\n");
@@ -345,9 +345,9 @@
 
 	/* Get the partition name */
 	name = NULL;
-	if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+	if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
 		name = sd_partition_name(media, partition_number);
-	else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC))
+	else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC))
 		name = mmc_partition_name(media, partition_number);
 	return name;
 }
diff --git a/src/drivers/storage/storage.h b/src/commonlib/storage/storage.h
similarity index 88%
rename from src/drivers/storage/storage.h
rename to src/commonlib/storage/storage.h
index b24b12d..645b6c1 100644
--- a/src/drivers/storage/storage.h
+++ b/src/commonlib/storage/storage.h
@@ -12,11 +12,11 @@
  * GNU General Public License for more details.
  */
 
-#ifndef __DRIVERS_STORAGE_STORAGE_H__
-#define __DRIVERS_STORAGE_STORAGE_H__
+#ifndef __COMMONLIB_STORAGE_STORAGE_H__
+#define __COMMONLIB_STORAGE_STORAGE_H__
 
 #include <stdint.h>
-#include <device/storage.h>
+#include <commonlib/storage.h>
 
 #define DMA_MINALIGN (64)
 #define ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
@@ -34,4 +34,4 @@
 int storage_block_setup(struct storage_media *media, uint64_t start,
 	uint64_t count, int is_read);
 
-#endif /* __DRIVERS_STORAGE_STORAGE_H__ */
+#endif /* __COMMONLIB_STORAGE_STORAGE_H__ */
diff --git a/src/drivers/storage/storage_erase.c b/src/commonlib/storage/storage_erase.c
similarity index 100%
rename from src/drivers/storage/storage_erase.c
rename to src/commonlib/storage/storage_erase.c
diff --git a/src/drivers/storage/storage_write.c b/src/commonlib/storage/storage_write.c
similarity index 100%
rename from src/drivers/storage/storage_write.c
rename to src/commonlib/storage/storage_write.c
diff --git a/src/mainboard/intel/galileo/Kconfig b/src/mainboard/intel/galileo/Kconfig
index 4ae412f..12cbb6c 100644
--- a/src/mainboard/intel/galileo/Kconfig
+++ b/src/mainboard/intel/galileo/Kconfig
@@ -182,7 +182,7 @@
 config ENABLE_SD_TESTING
 	bool "Enable SD card testing"
 	default y
-	select DRIVERS_STORAGE_SD
+	select COMMONLIB_STORAGE_SD
 	select SDHC_DEBUG
 	select STORAGE_LOG
 	select STORAGE_TEST
diff --git a/src/mainboard/intel/galileo/Makefile.inc b/src/mainboard/intel/galileo/Makefile.inc
index 25f672e..60c0ee0 100644
--- a/src/mainboard/intel/galileo/Makefile.inc
+++ b/src/mainboard/intel/galileo/Makefile.inc
@@ -26,7 +26,7 @@
 
 romstage-y += gpio.c
 romstage-y += reg_access.c
-romstage-$(CONFIG_DRIVERS_STORAGE_SD) += sd.c
+romstage-$(CONFIG_COMMONLIB_STORAGE_SD) += sd.c
 romstage-$(CONFIG_VBOOT) += vboot.c
 
 postcar-y += gpio.c
@@ -34,4 +34,4 @@
 
 ramstage-y += gpio.c
 ramstage-y += reg_access.c
-ramstage-$(CONFIG_DRIVERS_STORAGE_SD) += sd.c
+ramstage-$(CONFIG_COMMONLIB_STORAGE_SD) += sd.c
diff --git a/src/mainboard/intel/galileo/sd.c b/src/mainboard/intel/galileo/sd.c
index d13b318..0c0e58b 100644
--- a/src/mainboard/intel/galileo/sd.c
+++ b/src/mainboard/intel/galileo/sd.c
@@ -13,9 +13,9 @@
  * GNU General Public License for more details.
  */
 
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
 #include <console/console.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
 
 void soc_sd_mmc_controller_quirks(struct sd_mmc_ctrlr *ctrlr)
 {
diff --git a/src/soc/intel/quark/Kconfig b/src/soc/intel/quark/Kconfig
index 7f95b71..cb0a1bc 100644
--- a/src/soc/intel/quark/Kconfig
+++ b/src/soc/intel/quark/Kconfig
@@ -311,11 +311,12 @@
 config STORAGE_TEST
 	bool "Test SD/MMC/eMMC card or device access"
 	default n
-	select DRIVERS_STORAGE
+	select COMMONLIB_STORAGE
 	select SDHCI_CONTROLLER
 	help
-	  Read block 0 from each parition of the storage device.  User must
-	  also enable one or both of DRIVERS_STORAGE_SD or DRIVERS_STORAGE_MMC.
+	  Read block 0 from each parition of the storage device.  User
+	  must also enable one or both of COMMONLIB_STORAGE_SD or
+	  COMMONLIB_STORAGE_MMC.
 
 config STORAGE_LOG
 	bool "Log and display SD/MMC commands"
diff --git a/src/soc/intel/quark/include/soc/storage_test.h b/src/soc/intel/quark/include/soc/storage_test.h
index 6e970cc..cae296f 100644
--- a/src/soc/intel/quark/include/soc/storage_test.h
+++ b/src/soc/intel/quark/include/soc/storage_test.h
@@ -16,9 +16,9 @@
 #ifndef __STORAGE_TEST_H__
 #define __STORAGE_TEST_H__
 
+#include <commonlib/sd_mmc_ctrlr.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/sd_mmc_ctrlr.h>
 #include <timer.h>
 
 #ifdef __SIMPLE_DEVICE__
diff --git a/src/soc/intel/quark/sd.c b/src/soc/intel/quark/sd.c
index 7b96001..e41afa4 100644
--- a/src/soc/intel/quark/sd.c
+++ b/src/soc/intel/quark/sd.c
@@ -14,12 +14,12 @@
  */
 
 #include <arch/io.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
 #include <soc/storage_test.h>
 
 static void init(struct device *dev)
diff --git a/src/soc/intel/quark/storage_test.c b/src/soc/intel/quark/storage_test.c
index 4c83dbe..507fa92 100644
--- a/src/soc/intel/quark/storage_test.c
+++ b/src/soc/intel/quark/storage_test.c
@@ -18,9 +18,9 @@
 #include <assert.h>
 #include <cbmem.h>
 #include <commonlib/cbmem_id.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
 #include <console/console.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
 #include <lib.h>
 #include <soc/iomap.h>
 #include <soc/pci_devs.h>

-- 
To view, visit https://review.coreboot.org/19672
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4339e4378491db9a0da1f2dc34e1906a5ba31ad6
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Lee Leahy <leroy.p.leahy at intel.com>



More information about the coreboot-gerrit mailing list