summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2019-11-20 22:00:57 +0100
committerPatrick Georgi <pgeorgi@google.com>2019-11-29 11:01:23 +0000
commitd20b0a842bec15e65549db75d2b19e456db0ac50 (patch)
tree1842f1c6648e249867fcdb5c3c580eb4322d0d24 /src/drivers
parent91eb2816faa4b2689f30ca47ff2585cf79ac53f3 (diff)
downloadcoreboot-d20b0a842bec15e65549db75d2b19e456db0ac50.tar.xz
drivers/spi/boot_device_rw_nommap.c: Drop CAR_GLOBAL_MIGRATION support
Change-Id: I613c28a2d06f5f0216deb75960ab660941ef8057 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37044 Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/spi/boot_device_rw_nommap.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/src/drivers/spi/boot_device_rw_nommap.c b/src/drivers/spi/boot_device_rw_nommap.c
index 47683144a8..5de9a71ceb 100644
--- a/src/drivers/spi/boot_device_rw_nommap.c
+++ b/src/drivers/spi/boot_device_rw_nommap.c
@@ -11,24 +11,18 @@
* GNU General Public License for more details.
*/
-#include <arch/early_variables.h>
#include <boot_device.h>
#include <spi_flash.h>
#include <spi-generic.h>
#include <stdint.h>
-static struct spi_flash sfg CAR_GLOBAL;
-static bool sfg_init_done CAR_GLOBAL;
+static struct spi_flash sfg;
+static bool sfg_init_done;
static ssize_t spi_readat(const struct region_device *rd, void *b,
size_t offset, size_t size)
{
- struct spi_flash *sf = car_get_var_ptr(&sfg);
-
- if (sf == NULL)
- return -1;
-
- if (spi_flash_read(sf, offset, size, b))
+ if (spi_flash_read(&sfg, offset, size, b))
return -1;
return size;
@@ -37,12 +31,7 @@ static ssize_t spi_readat(const struct region_device *rd, void *b,
static ssize_t spi_writeat(const struct region_device *rd, const void *b,
size_t offset, size_t size)
{
- struct spi_flash *sf = car_get_var_ptr(&sfg);
-
- if (sf == NULL)
- return -1;
-
- if (spi_flash_write(sf, offset, size, b))
+ if (spi_flash_write(&sfg, offset, size, b))
return -1;
return size;
@@ -51,12 +40,7 @@ static ssize_t spi_writeat(const struct region_device *rd, const void *b,
static ssize_t spi_eraseat(const struct region_device *rd,
size_t offset, size_t size)
{
- struct spi_flash *sf = car_get_var_ptr(&sfg);
-
- if (sf == NULL)
- return -1;
-
- if (spi_flash_erase(sf, offset, size))
+ if (spi_flash_erase(&sfg, offset, size))
return -1;
return size;
@@ -76,14 +60,14 @@ static void boot_device_rw_init(void)
const int bus = CONFIG_BOOT_DEVICE_SPI_FLASH_BUS;
const int cs = 0;
- if (car_get_var(sfg_init_done) == true)
+ if (sfg_init_done == true)
return;
/* Ensure any necessary setup is performed by the drivers. */
spi_init();
- if (!spi_flash_probe(bus, cs, car_get_var_ptr(&sfg)))
- car_set_var(sfg_init_done, true);
+ if (!spi_flash_probe(bus, cs, &sfg))
+ sfg_init_done = true;
}
const struct region_device *boot_device_rw(void)
@@ -91,7 +75,7 @@ const struct region_device *boot_device_rw(void)
/* Probe for the SPI flash device if not already done. */
boot_device_rw_init();
- if (car_get_var(sfg_init_done) != true)
+ if (sfg_init_done != true)
return NULL;
return &spi_rw;
@@ -101,10 +85,10 @@ const struct spi_flash *boot_device_spi_flash(void)
{
boot_device_rw_init();
- if (car_get_var(sfg_init_done) != true)
+ if (sfg_init_done != true)
return NULL;
- return car_get_var_ptr(&sfg);
+ return &sfg;
}
int boot_device_wp_region(const struct region_device *rd,
@@ -122,7 +106,7 @@ int boot_device_wp_region(const struct region_device *rd,
if (type == MEDIA_WP) {
if (spi_flash_is_write_protected(boot_dev,
- region_device_region(rd)) != 1) {
+ region_device_region(rd)) != 1) {
return spi_flash_set_write_protected(boot_dev,
region_device_region(rd), true,
SPI_WRITE_PROTECTION_REBOOT);