diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-06-15 09:08:21 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:26 -0700 |
commit | ac78029b3a9fe2875d06c03badeb4f0858c0b923 (patch) | |
tree | 0478b8897fe1fbc7cc131126bb66cad1a04ef9bc | |
parent | 5a4e8697a6abfd08f5b842fb3c5b15a48fc6b759 (diff) |
CHROMIUM: [1/7] fix to merely compilable; delete obsolete files
The compiler warnings and errors due to cherry-picking verified boot
integration library into new u-boot codebase are fixed here.
This and the following six commits only give you a compilable
repository, and do not give you a working verified boot; neither onestop
nor the old four-variants style of verified boot are supposed to be
functioning.
Changes in this commit:
* delete obsolete files:
- cpu_state.c
- eeprom_driver.c
* delete unused firmware storage device:
- firmware_storage_{nand,ram}.c
BUG=chromium-os:16508
TEST=manual
After all seven commits are checked in, you should be able to run:
make ARCH=arm \
CROSS_COMPILE=armv7a-cros-linux-gnueabi- \
USE_PRIVATE_LIBGCC=yes \
VBOOT=/build/tegra2_seaboard/usr \
chromeos_seaboard_onestop_config
make ARCH=arm \
CROSS_COMPILE=armv7a-cros-linux-gnueabi- \
USE_PRIVATE_LIBGCC=yes \
VBOOT=/build/tegra2_seaboard/usr \
all
Change-Id: I8a73e5536277a7c22dad3f95c1a33da90689a6f3
Reviewed-on: http://gerrit.chromium.org/gerrit/2676
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | board/nvidia/chromeos/cpu_state.c | 41 | ||||
-rw-r--r-- | board/nvidia/chromeos/eeprom_driver.c | 123 | ||||
-rw-r--r-- | lib/chromeos/Makefile | 4 | ||||
-rw-r--r-- | lib/chromeos/firmware_storage.c | 46 | ||||
-rw-r--r-- | lib/chromeos/firmware_storage_nand.c | 21 | ||||
-rw-r--r-- | lib/chromeos/firmware_storage_ram.c | 114 |
6 files changed, 1 insertions, 348 deletions
diff --git a/board/nvidia/chromeos/cpu_state.c b/board/nvidia/chromeos/cpu_state.c deleted file mode 100644 index bb1bb01bd8d..00000000000 --- a/board/nvidia/chromeos/cpu_state.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011 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. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - */ - -#include <common.h> - -#include <chromeos/hardware_interface.h> - -int is_s3_resume(void) { return 0; } diff --git a/board/nvidia/chromeos/eeprom_driver.c b/board/nvidia/chromeos/eeprom_driver.c deleted file mode 100644 index ef3f6200325..00000000000 --- a/board/nvidia/chromeos/eeprom_driver.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2011 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. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - */ - -/* Implementation of per-board EEPROM driver functions */ - -#include <common.h> -#include <malloc.h> -#include <chromeos/firmware_storage.h> - -/* TODO Replace mem_seek/read with spi_seek/read when moving firmware storage - * from NAND to SPI Flash */ - -struct context_t { - void *begin, *cur, *end; -}; - -static off_t mem_seek(void *context, off_t offset, enum whence_t whence) -{ - void *begin, *cur, *end; - - begin = ((struct context_t *) context)->begin; - cur = ((struct context_t *) context)->cur; - end = ((struct context_t *) context)->end; - - if (whence == SEEK_SET) - cur = begin + offset; - else if (whence == SEEK_CUR) - cur = cur + offset; - else if (whence == SEEK_END) - cur = end + offset; - else { - debug("mem_seek: unknown whence value: %d\n", whence); - return -1; - } - - if (cur < begin) { - debug("mem_seek: offset underflow: %p < %p\n", cur, begin); - return -1; - } - - if (cur >= end) { - debug("mem_seek: offset exceeds size: %p >= %p\n", cur, end); - return -1; - } - - ((struct context_t *) context)->cur = cur; - return cur - begin; -} - -static ssize_t mem_read(void *context, void *buf, size_t count) -{ - void *begin, *cur, *end; - - if (count == 0) - return 0; - - begin = ((struct context_t *) context)->begin; - cur = ((struct context_t *) context)->cur; - end = ((struct context_t *) context)->end; - - if (count > end - cur) - count = end - cur; - - memcpy(buf, cur, count); - ((struct context_t *) context)->cur += count; - - return count; -} - -int init_firmware_storage(firmware_storage_t *f) -{ - struct context_t *context; - - context = (struct context_t *) malloc(sizeof(struct context_t)); - context->begin = (void *) TEXT_BASE; - context->cur = (void *) TEXT_BASE; - context->end = (void *) TEXT_BASE + CONFIG_FIRMWARE_SIZE; - - f->seek = mem_seek; - f->read = mem_read; - f->context = (void *) context; - - return 0; -} - -int release_firmware_storage(firmware_storage_t *f) -{ - free(f->context); - return 0; -} diff --git a/lib/chromeos/Makefile b/lib/chromeos/Makefile index 8f967301c30..dbf2dfb7db1 100644 --- a/lib/chromeos/Makefile +++ b/lib/chromeos/Makefile @@ -23,9 +23,7 @@ COBJS-$(CONFIG_CHROMEOS) += tlcl_stub.o COBJS-$(CONFIG_CHROMEOS) += utility.o COBJS-$(CONFIG_CHROMEOS) += vboot_nvstorage_helper.o COBJS-$(CONFIG_CHROMEOS_BMPBLK) += gbb_bmpblk.o -COBJS-$(CONFIG_CHROMEOS_FIRMWARE_STORAGE_NAND) += firmware_storage_nand.o -COBJS-$(CONFIG_CHROMEOS_FIRMWARE_STORAGE_RAM) += firmware_storage_ram.o -COBJS-$(CONFIG_CHROMEOS_FIRMWARE_STORAGE_SPI) += firmware_storage_spi.o +COBJS-$(CONFIG_CHROMEOS) += firmware_storage_spi.o COBJS := $(COBJS-y) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/lib/chromeos/firmware_storage.c b/lib/chromeos/firmware_storage.c index c6ad803a00d..1283fa31502 100644 --- a/lib/chromeos/firmware_storage.c +++ b/lib/chromeos/firmware_storage.c @@ -12,55 +12,9 @@ #include <chromeos/common.h> #include <chromeos/firmware_storage.h> -#if defined CONFIG_CHROMEOS_DEFAULT_FIRMWARE_STORAGE_SPI && \ - defined CONFIG_CHROMEOS_DEFAULT_FIRMWARE_STORAGE_NAND -#error "You can only set one as your default storage" -#endif - -#if defined CONFIG_CHROMEOS_DEFAULT_FIRMWARE_STORAGE_NAND -# ifndef CONFIG_CHROMEOS_FIRMWARE_STORAGE_NAND -# error "You set NAND as default device, but did not define NAND storage" -# endif -int (*const firmware_storage_init)(firmware_storage_t *file) = - firmware_storage_init_nand; - -#elif defined CONFIG_CHROMEOS_DEFAULT_FIRMWARE_STORAGE_SPI -# ifndef CONFIG_CHROMEOS_FIRMWARE_STORAGE_SPI -# error "You set SPI as default device, but did not define SPI storage" -# endif int (*const firmware_storage_init)(firmware_storage_t *file) = firmware_storage_init_spi; -#else -#error "No default firmware storage device are set" -#endif - -#define PREFIX "firmware_storage_init: " - -#ifndef CONFIG_CHROMEOS_FIRMWARE_STORAGE_NAND -int firmware_storage_init_nand(firmware_storage_t *file) -{ - VBDEBUG(PREFIX "NAND is not supported\n"); - return -1; -} -#endif - -#ifndef CONFIG_CHROMEOS_FIRMWARE_STORAGE_SPI -int firmware_storage_init_spi(firmware_storage_t *file) -{ - VBDEBUG(PREFIX "SPI is not supported\n"); - return -1; -} -#endif - -#ifndef CONFIG_CHROMEOS_FIRMWARE_STORAGE_RAM -int firmware_storage_init_ram(firmware_storage_t *file, void *beg, void *end) -{ - VBDEBUG(PREFIX "RAM is not supported\n"); - return -1; -} -#endif - #undef PREFIX #define PREFIX "firmware_storage_read: " diff --git a/lib/chromeos/firmware_storage_nand.c b/lib/chromeos/firmware_storage_nand.c deleted file mode 100644 index 03110d2dc76..00000000000 --- a/lib/chromeos/firmware_storage_nand.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2011 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. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - */ - -/* Implementation of firmware storage access interface for NAND */ - -#include <common.h> -#include <chromeos/common.h> -#include <chromeos/firmware_storage.h> - -int firmware_storage_init_nand(firmware_storage_t *file) -{ - /* TODO Implement interface to NAND */ - return -1; -} diff --git a/lib/chromeos/firmware_storage_ram.c b/lib/chromeos/firmware_storage_ram.c deleted file mode 100644 index a95df374c4d..00000000000 --- a/lib/chromeos/firmware_storage_ram.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2011 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. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - */ - -/* Implementation of firmware storage access interface for NAND */ - -#include <common.h> -#include <malloc.h> -#include <chromeos/common.h> -#include <chromeos/firmware_storage.h> - -struct context_t { - void *beg, *cur, *end; -}; - -static off_t seek_ram(void *context, off_t offset, enum whence_t whence) -{ - struct context_t *cxt = (struct context_t *) context; - void *cur; - - if (whence == SEEK_SET) - cur = cxt->beg + offset; - else if (whence == SEEK_CUR) - cur = cxt->cur + offset; - else if (whence == SEEK_END) - cur = cxt->end + offset; - else { - VBDEBUG("seek_ram: unknown whence value: %d\n", whence); - return -1; - } - - if (cur < cxt->beg) { - VBDEBUG("seek_ram: offset underflow: %p < %p\n", cur, cxt->beg); - return -1; - } - - if (cur >= cxt->end) { - VBDEBUG("seek_ram: offset exceeds size: %p >= %p\n", cur, - cxt->end); - return -1; - } - - cxt->cur = cur; - return cur - cxt->beg; -} - -static ssize_t read_ram(void *context, void *buf, size_t count) -{ - struct context_t *cxt = (struct context_t *) context; - - if (count == 0) - return 0; - - if (count > cxt->end - cxt->cur) - count = cxt->end - cxt->cur; - - memcpy(buf, cxt->cur, count); - cxt->cur += count; - - return count; -} - -static ssize_t write_ram(void *context, const void *buf, size_t count) -{ - struct context_t *cxt = (struct context_t *) context; - - if (count == 0) - return 0; - - if (count > cxt->end - cxt->cur) - count = cxt->end - cxt->cur; - - memcpy(cxt->cur, buf, count); - cxt->cur += count; - - return count; -} - -static int close_ram(void *context) -{ - free(context); - return 0; -} - -static int lock_ram(void *context) -{ - /* TODO Implement lock device */ - return 0; -} - -int firmware_storage_init_ram(firmware_storage_t *file, void *beg, void *end) -{ - struct context_t *cxt; - - cxt = malloc(sizeof(*cxt)); - cxt->beg = beg; - cxt->cur = beg; - cxt->end = end; - - file->seek = seek_ram; - file->read = read_ram; - file->write = write_ram; - file->close = close_ram; - file->lock_device = lock_ram; - file->context = (void*) cxt; - - return 0; -} |