diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-03-29 11:09:30 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-02 14:12:52 -0700 |
commit | 0c3ba249abb1dc60f5ebabccf84ff13206440b83 (patch) | |
tree | 81cd2ada3845b8bb4b83fde6e27050483d5b941e /host/lib/include/crossystem_arch.h | |
parent | 28b65ca99f4042fcc1218a4c18297f7ffb32ea15 (diff) | |
download | vboot-0c3ba249abb1dc60f5ebabccf84ff13206440b83.tar.gz |
Massive refactoring of external header files.
This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.
BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023
sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-$BOARD \
vboot_reference \
chromeos-cryptohome \
chromeos-installer \
chromeos-u-boot \
peach-u-boot \
depthcharge
Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'host/lib/include/crossystem_arch.h')
-rw-r--r-- | host/lib/include/crossystem_arch.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/host/lib/include/crossystem_arch.h b/host/lib/include/crossystem_arch.h new file mode 100644 index 00000000..4044c749 --- /dev/null +++ b/host/lib/include/crossystem_arch.h @@ -0,0 +1,91 @@ +/* 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. + * + * Architecture-specific APIs for crossystem + */ + +#ifndef VBOOT_REFERENCE_CROSSYSTEM_ARCH_H_ +#define VBOOT_REFERENCE_CROSSYSTEM_ARCH_H_ + +#include "vboot_nvstorage.h" +#include "vboot_struct.h" + +/* Firmware types from BINF.3. Placed in the common file because both x86 and + * arm use this. The constants are defined in "Chrome OS Main Processor + * Firmware Spec" + */ +#define BINF3_RECOVERY 0 +#define BINF3_NORMAL 1 +#define BINF3_DEVELOPER 2 +#define BINF3_NETBOOT 3 + + +/* INTERNAL APIS FOR CROSSYSTEM AVAILABLE TO ARCH-SPECIFIC FUNCTIONS */ + +/* Read an integer property from VbNvStorage. + * + * Returns the parameter value, or -1 if error. */ +int VbGetNvStorage(VbNvParam param); + +/* Write an integer property to VbNvStorage. + * + * Returns 0 if success, -1 if error. */ +int VbSetNvStorage(VbNvParam param, int value); + +/* Return true if the FWID starts with the specified string. */ +int FwidStartsWith(const char *start); + +/* Return version of VbSharedData struct or -1 if not found. */ +int VbSharedDataVersion(void); + +/* Apis WITH ARCH-SPECIFIC IMPLEMENTATIONS */ + +/* Read the non-volatile context from NVRAM. + * + * Returns 0 if success, -1 if error. */ +int VbReadNvStorage(VbNvContext* vnc); + +/* Write the non-volatile context to NVRAM. + * + * Returns 0 if success, -1 if error. */ +int VbWriteNvStorage(VbNvContext* vnc); + +/* Read the VbSharedData buffer. + * + * Verifies the buffer contains at least enough data for the + * VbSharedDataHeader; if not, this is an error. + * + * If less data is read than expected, sets the returned structure's data_size + * to the actual amount of data read. If this is less than data_used, then + * some data was not returned; callers must handle this; this is not considered + * an error. + * + * Returns the data buffer, which must be freed by the caller using + * free(), or NULL if error. */ +VbSharedDataHeader* VbSharedDataRead(void); + +/* Read an architecture-specific system property integer. + * + * Returns the property value, or -1 if error. */ +int VbGetArchPropertyInt(const char* name); + +/* Read an architecture-specific system property string into a + * destination buffer of the specified size. Returned string will be + * null-terminated. If the buffer is too small, the returned string + * will be truncated. + * + * Returns the passed buffer, or NULL if error. */ +const char* VbGetArchPropertyString(const char* name, char* dest, int size); + +/* Set an architecture-specific system property integer. + * + * Returns 0 if success, -1 if error. */ +int VbSetArchPropertyInt(const char* name, int value); + +/* Set an architecture-specific system property string. + * + * Returns 0 if success, -1 if error. */ +int VbSetArchPropertyString(const char* name, const char* value); + +#endif /* VBOOT_REFERENCE__CROSSYSTEM_ARCH_H_ */ |