summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2015-09-08 09:00:33 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-08 18:43:47 -0700
commit490e8a482f07ce8c39d6a40bcff5abb24a38449a (patch)
treede1e826c9f779287c4e9c5afe40375da8bcbb995
parent96093145cb6549a6058627a7aa196e86ac3911f4 (diff)
downloadchrome-ec-490e8a482f07ce8c39d6a40bcff5abb24a38449a.tar.gz
eoption: Remove unused eeprom option storage code
Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I2174a904df160d19d47f1aa2d053349356cb4291 Reviewed-on: https://chromium-review.googlesource.com/297805 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--board/bds/board.h2
-rw-r--r--board/cyan/board.h1
-rw-r--r--board/glower/board.h1
-rw-r--r--board/mec1322_evb/board.h1
-rw-r--r--board/strago/board.h1
-rw-r--r--common/build.mk1
-rw-r--r--common/eoption.c189
-rw-r--r--common/main.c4
-rw-r--r--include/config.h6
-rw-r--r--include/eoption.h41
10 files changed, 0 insertions, 247 deletions
diff --git a/board/bds/board.h b/board/bds/board.h
index c4af34d253..e4b48c55de 100644
--- a/board/bds/board.h
+++ b/board/bds/board.h
@@ -13,7 +13,6 @@
/* LM4 modules we don't use on link but still want to keep compiling */
#define CONFIG_EEPROM
-#define CONFIG_EOPTION
#define CONFIG_PSTORE
/* Modules we want to exclude */
@@ -46,7 +45,6 @@ enum pwm_channel {
#include "gpio_signal.h"
/* EEPROM blocks */
-#define EEPROM_BLOCK_EOPTION 1 /* EC persistent options */
#define EEPROM_BLOCK_START_PSTORE 16 /* Host persistent storage */
#define EEPROM_BLOCK_COUNT_PSTORE 16
diff --git a/board/cyan/board.h b/board/cyan/board.h
index 670859a0ff..4425d01c8c 100644
--- a/board/cyan/board.h
+++ b/board/cyan/board.h
@@ -68,7 +68,6 @@
/* Modules we want to exclude */
#undef CONFIG_EEPROM
-#undef CONFIG_EOPTION
#undef CONFIG_PSTORE
#undef CONFIG_PECI
#undef CONFIG_PWM
diff --git a/board/glower/board.h b/board/glower/board.h
index 982c205501..5a1179bd31 100644
--- a/board/glower/board.h
+++ b/board/glower/board.h
@@ -63,7 +63,6 @@
/* Modules we want to exclude */
#undef CONFIG_ADC
#undef CONFIG_EEPROM
-#undef CONFIG_EOPTION
#undef CONFIG_PECI
#undef CONFIG_PSTORE
#undef CONFIG_PWM
diff --git a/board/mec1322_evb/board.h b/board/mec1322_evb/board.h
index 25b20618f7..4c566e7e9e 100644
--- a/board/mec1322_evb/board.h
+++ b/board/mec1322_evb/board.h
@@ -19,7 +19,6 @@
/* Modules we want to exclude */
#undef CONFIG_EEPROM
-#undef CONFIG_EOPTION
#undef CONFIG_PSTORE
#undef CONFIG_LID_SWITCH
#undef CONFIG_PECI
diff --git a/board/strago/board.h b/board/strago/board.h
index 9fc6dd8b8e..5939013fe7 100644
--- a/board/strago/board.h
+++ b/board/strago/board.h
@@ -106,7 +106,6 @@
#undef CONFIG_CONSOLE_CMDHELP
#undef CONFIG_CONSOLE_HISTORY
#undef CONFIG_EEPROM
-#undef CONFIG_EOPTION
#undef CONFIG_FANS
#undef CONFIG_PSTORE
#undef CONFIG_PECI
diff --git a/common/build.mk b/common/build.mk
index 2006cb8c69..1679ed4487 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -42,7 +42,6 @@ common-$(CONFIG_COMMON_TIMER)+=timer.o
common-$(CONFIG_CRC8)+= crc8.o
common-$(CONFIG_PMU_POWERINFO)+=pmu_tps65090_powerinfo.o
common-$(CONFIG_PMU_TPS65090)+=pmu_tps65090.o
-common-$(CONFIG_EOPTION)+=eoption.o
common-$(CONFIG_EXTPOWER_GPIO)+=extpower_gpio.o
common-$(CONFIG_FANS)+=fan.o
common-$(CONFIG_FLASH)+=flash.o
diff --git a/common/eoption.c b/common/eoption.c
deleted file mode 100644
index 2a3f64f846..0000000000
--- a/common/eoption.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Persistent EC options stored in EEPROM */
-
-#include "console.h"
-#include "eeprom.h"
-#include "eoption.h"
-#include "util.h"
-
-#define EOPTION_MAGIC 0x456f /* Magic number for header 'Eo' */
-#define EOPTION_VERSION_CURRENT 1 /* Current version of options data */
-
-struct eoption_bool_data {
- int offset; /* Word offset of option */
- int mask; /* Option mask within byte */
- const char *name; /* Option name */
-};
-
-
-/* Word offsets inside the EOPTION EEPROM block */
-enum block_offsets {
- OFFSET_HEADER = 0,
- OFFSET_BOOL0,
-};
-
-/*
- * Boolean options. Must be in the same order as enum eoption_bool, and must
- * be terminated by an entry with a NULL name.
- */
-static const struct eoption_bool_data bool_opts[] = {
- {OFFSET_BOOL0, (1 << 0), "bool_test"},
- {0, 0, NULL},
-};
-
-/**
- * Read a uint32_t from the specified EEPROM word offset.
- */
-static int read32(int offset, uint32_t *dest)
-{
- return eeprom_read(EEPROM_BLOCK_EOPTION, offset * 4, sizeof(uint32_t),
- (char *)dest);
-}
-
-
-/**
- * Write a uint32_t to the specified EEPROM word offset.
- */
-static int write32(int offset, uint32_t v)
-{
- return eeprom_write(EEPROM_BLOCK_EOPTION, offset * 4, sizeof(v),
- (char *)&v);
-}
-
-int eoption_get_bool(enum eoption_bool opt)
-{
- const struct eoption_bool_data *d = bool_opts + opt;
- uint32_t v = 0;
-
- read32(d->offset, &v);
- return v & d->mask ? 1 : 0;
-}
-
-int eoption_set_bool(enum eoption_bool opt, int value)
-{
- const struct eoption_bool_data *d = bool_opts + opt;
- uint32_t v;
- int rv;
-
- rv = read32(d->offset, &v);
- if (rv != EC_SUCCESS)
- return rv;
-
- if (value)
- v |= d->mask;
- else
- v &= ~d->mask;
-
- return write32(d->offset, v);
-}
-
-/**
- * Find an option by name.
- *
- * @return The option index, or -1 if no match.
- */
-static int find_option_by_name(const char *name,
- const struct eoption_bool_data *d)
-{
- int i;
-
- if (!name || !*name)
- return -1;
-
- for (i = 0; d->name; i++, d++) {
- if (!strcasecmp(name, d->name))
- return i;
- }
-
- return -1;
-}
-
-void eoption_init(void)
-{
- uint32_t v;
- int version;
-
- /* Initialize EEPROM if necessary */
- read32(OFFSET_HEADER, &v);
-
- /* Check header */
- if (v >> 16 != EOPTION_MAGIC)
- v = EOPTION_MAGIC << 16; /* (implicitly sets version=0) */
-
- version = (v >> 8) & 0xff;
- if (version == EOPTION_VERSION_CURRENT)
- return;
-
- /*
- * TODO(crosbug.com/p/23558): The header should really have a checksum
- * field, so that we can detect uninitialized/corrupt data.
- */
-
- /* Initialize fields which weren't set in previous versions */
- if (version < 1)
- write32(OFFSET_BOOL0, 0);
-
- /* Update the header */
- v = (v & ~0xff00) | (EOPTION_VERSION_CURRENT << 8);
- write32(OFFSET_HEADER, v);
-}
-
-/*****************************************************************************/
-/* Console commands */
-
-static int command_eoption_get(int argc, char **argv)
-{
- const struct eoption_bool_data *d;
- int i;
-
- /* If a signal is specified, print only that one */
- if (argc == 2) {
- i = find_option_by_name(argv[1], bool_opts);
- if (i == -1)
- return EC_ERROR_PARAM1;
- d = bool_opts + i;
- ccprintf(" %d %s\n", eoption_get_bool(i), d->name);
- return EC_SUCCESS;
- }
-
- /* Otherwise print them all */
- for (i = 0, d = bool_opts; d->name; i++, d++) {
- ccprintf(" %d %s\n", eoption_get_bool(i), d->name);
-
- /* We have enough options that we'll overflow the output buffer
- * without flushing */
- cflush();
- }
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(optget, command_eoption_get,
- "[name]",
- "Print EC option(s)",
- NULL);
-
-static int command_eoption_set(int argc, char **argv)
-{
- char *e;
- int v, i;
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- v = strtoi(argv[2], &e, 0);
- if (*e)
- return EC_ERROR_PARAM2;
-
- i = find_option_by_name(argv[1], bool_opts);
- if (i == -1)
- return EC_ERROR_PARAM1;
-
- return eoption_set_bool(i, v);
-}
-DECLARE_CONSOLE_COMMAND(optset, command_eoption_set,
- "name value",
- "Set EC option",
- NULL);
diff --git a/common/main.c b/common/main.c
index d70d987d43..016d4f6279 100644
--- a/common/main.c
+++ b/common/main.c
@@ -12,7 +12,6 @@
#include "cpu.h"
#include "dma.h"
#include "eeprom.h"
-#include "eoption.h"
#include "flash.h"
#include "gpio.h"
#include "hooks.h"
@@ -145,9 +144,6 @@ test_mockable __keep int main(void)
#ifdef CONFIG_EEPROM
eeprom_init();
#endif
-#ifdef CONFIG_EOPTION
- eoption_init();
-#endif
#ifdef HAS_TASK_KEYSCAN
keyboard_scan_init();
#endif
diff --git a/include/config.h b/include/config.h
index 946e9dcf5b..0da8f46b9e 100644
--- a/include/config.h
+++ b/include/config.h
@@ -651,12 +651,6 @@
/* Support EC chip internal data EEPROM */
#undef CONFIG_EEPROM
-/*
- * Compile the eoption module, which provides a higher-level interface to
- * options stored in internal data EEPROM.
- */
-#undef CONFIG_EOPTION
-
/* Include code for handling external power */
#define CONFIG_EXTPOWER
diff --git a/include/eoption.h b/include/eoption.h
deleted file mode 100644
index e1810f3f60..0000000000
--- a/include/eoption.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Persistent EC options stored in EEPROM */
-
-#ifndef __CROS_EC_EOPTION_H
-#define __CROS_EC_EOPTION_H
-
-#include "common.h"
-
-/* Boolean options */
-enum eoption_bool {
- EOPTION_BOOL_TEST = 0, /* Test option */
-};
-
-/**
- * Initialize the module.
- */
-void eoption_init(void);
-
-/**
- * Return the current value of a boolean option.
- *
- * @param opt Option to return
- * @return 0 if option is false, 1 if true.
- */
-int eoption_get_bool(enum eoption_bool opt);
-
-/**
- * Set the value of a boolean option
- *
- * @param opt Option to set
- * @param value New value for option
- *
- * @return EC_SUCCESS, or non-zero if error.
- */
-int eoption_set_bool(enum eoption_bool opt, int value);
-
-#endif /* __CROS_EC_EOPTION_H */