diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2010-11-05 11:40:49 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-24 10:00:08 -0700 |
commit | f0766d8872efdefc4b67d0a8cd31bd7d540b9124 (patch) | |
tree | eded590cea589484beb2e974a6c447198b3c4981 /lib_generic | |
parent | f5273560625a9c677cb2c56f5a3b76e38fc1b5d2 (diff) |
Move lib_generic/chromeos/ to lib/chromeos/
lib_generic/ is renamed to lib/ in newer version u-boot.
Change-Id: I07ed1eb650c83db1533ac24209b4129db7068c08
BUG=None
TEST=Run 'VBOOT_DEBUG=1 make all' successfully
Review URL: http://codereview.chromium.org/4410003
Diffstat (limited to 'lib_generic')
-rw-r--r-- | lib_generic/chromeos/Makefile | 56 | ||||
-rw-r--r-- | lib_generic/chromeos/boot_device.c | 119 | ||||
-rw-r--r-- | lib_generic/chromeos/utility.c | 107 |
3 files changed, 0 insertions, 282 deletions
diff --git a/lib_generic/chromeos/Makefile b/lib_generic/chromeos/Makefile deleted file mode 100644 index 8884f4ba13..0000000000 --- a/lib_generic/chromeos/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2010, Google Inc. -# All rights reserved. -# -# 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 $(TOPDIR)/config.mk - -LIB = $(obj)libchromeos.a - -COBJS-$(CONFIG_CHROMEOS) += boot_device.o -COBJS-$(CONFIG_CHROMEOS) += utility.o - -COBJS := $(COBJS-y) -OBJS := $(addprefix $(obj),$(COBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/lib_generic/chromeos/boot_device.c b/lib_generic/chromeos/boot_device.c deleted file mode 100644 index 5a57e6d856..0000000000 --- a/lib_generic/chromeos/boot_device.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2010, Google Inc. - * All rights reserved. - * - * 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 <config.h> -#include <common.h> -#include <part.h> -#include <boot_device.h> - -static struct { - block_dev_desc_t *dev_desc; - ulong offset, limit; -} bootdev_config = { - .dev_desc = NULL, - .offset = 0u, - .limit = 0u -}; - -block_dev_desc_t *get_bootdev(void) -{ - return bootdev_config.dev_desc; -} - -int set_bootdev(char *ifname, int dev, int part) -{ - disk_partition_t part_info; - - if ((bootdev_config.dev_desc = get_dev(ifname, dev)) == NULL) - goto cleanup; /* block device not supported */ - - /* largest address not available in block_dev_desc_t */ - if (part == 0) { - bootdev_config.limit = ~0; - return 0; - } - - if (get_partition_info(bootdev_config.dev_desc, part, &part_info)) - goto cleanup; /* cannot find partition */ - - bootdev_config.offset = part_info.start; - bootdev_config.limit = part_info.size; - - return 0; - -cleanup: - bootdev_config.dev_desc = NULL; - bootdev_config.offset = 0; - bootdev_config.limit = 0; - - return 1; -} - -int BootDeviceReadLBA(uint64_t lba_start, uint64_t lba_count, void *buffer) -{ - block_dev_desc_t *dev_desc; - - if ((dev_desc = bootdev_config.dev_desc) == NULL) - return 1; /* No boot device configured */ - - if (lba_start + lba_count > bootdev_config.limit) - return 1; /* read out of range */ - - if (dev_desc->block_read(dev_desc->dev, - bootdev_config.offset + lba_start, lba_count, - buffer) < 0) - return 1; /* error reading blocks */ - - return 0; -} - -int BootDeviceWriteLBA(uint64_t lba_start, uint64_t lba_count, - const void *buffer) -{ - block_dev_desc_t *dev_desc; - - if ((dev_desc = bootdev_config.dev_desc) == NULL) - return 1; /* No boot device configured */ - - if (lba_start + lba_count > bootdev_config.limit) - return 1; /* read out of range */ - - if (dev_desc->block_write(dev_desc->dev, - bootdev_config.offset + lba_start, lba_count, - buffer) < 0) - return 1; /* error reading blocks */ - - return 0; -} diff --git a/lib_generic/chromeos/utility.c b/lib_generic/chromeos/utility.c deleted file mode 100644 index d90b822296..0000000000 --- a/lib_generic/chromeos/utility.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2010, Google Inc. - * All rights reserved. - * - * 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 helper functions/wrappers for memory allocations, - * manipulation and comparison for vboot library. - */ - -#include <config.h> -#include <common.h> -#include <malloc.h> - -/* HACK: Get rid of U-Boots debug and assert macros */ -#undef error -#undef debug -#undef assert - -/* HACK: We want to use malloc, free, memcmp, memcpy, memset */ -#define _STUB_IMPLEMENTATION_ - -/* Import interface of vboot's helper functions */ -#include <utility.h> - -/* Is it defined in lib_generic/string.c? */ -int memcmp(const void *cs, const void *ct, size_t count); - -void abort(void) -{ - reset_cpu(0); -} - -#define exit(retcode) abort() - -void error(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - puts("ERROR: "); - vprintf(format, ap); - va_end(ap); - exit(1); -} - -void debug(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - puts("DEBUG: "); - vprintf(format, ap); - va_end(ap); -} - -void *Malloc(size_t size) -{ - void *p = malloc(size); - if (!p) { - /* Fatal Error. We must abort. */ - abort(); - } - return p; -} - -void Free(void *p) -{ - free(p); -} - -int Memcmp(const void *src1, const void *src2, size_t n) -{ - return memcmp(src1, src2, n); -} - -void *Memcpy(void *dest, const void *src, uint64_t n) -{ - return memcpy(dest, src, (size_t) n); -} |