OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. |
| 4 * |
| 5 * Architecture-specific APIs for crossystem |
| 6 */ |
| 7 |
| 8 #ifndef VBOOT_REFERENCE_CROSSYSTEM_ARCH_H_ |
| 9 #define VBOOT_REFERENCE_CROSSYSTEM_ARCH_H_ |
| 10 |
| 11 #include "vboot_nvstorage.h" |
| 12 #include "vboot_struct.h" |
| 13 |
| 14 |
| 15 /* INTERNAL APIS FOR CROSSYSTEM AVAILABLE TO ARCH-SPECIFIC FUNCTIONS */ |
| 16 |
| 17 /* Read an integer property from VbNvStorage. |
| 18 * |
| 19 * Returns the parameter value, or -1 if error. */ |
| 20 int VbGetNvStorage(VbNvParam param); |
| 21 |
| 22 /* Write an integer property to VbNvStorage. |
| 23 * |
| 24 * Returns 0 if success, -1 if error. */ |
| 25 int VbSetNvStorage(VbNvParam param, int value); |
| 26 |
| 27 /* Return true if the FWID starts with the specified string. */ |
| 28 int FwidStartsWith(const char *start); |
| 29 |
| 30 |
| 31 /* APIS WITH ARCH-SPECIFIC IMPLEMENTATIONS */ |
| 32 |
| 33 /* Read the non-volatile context from NVRAM. |
| 34 * |
| 35 * Returns 0 if success, -1 if error. */ |
| 36 int VbReadNvStorage(VbNvContext* vnc); |
| 37 |
| 38 /* Write the non-volatile context to NVRAM. |
| 39 * |
| 40 * Returns 0 if success, -1 if error. */ |
| 41 int VbWriteNvStorage(VbNvContext* vnc); |
| 42 |
| 43 /* Read the VbSharedData buffer. |
| 44 * |
| 45 * Verifies the buffer contains at least enough data for the |
| 46 * VbSharedDataHeader; if not, this is an error. |
| 47 * |
| 48 * If less data is read than expected, sets the returned structure's data_size |
| 49 * to the actual amount of data read. If this is less than data_used, then |
| 50 * some data was not returned; callers must handle this; this is not considered |
| 51 * an error. |
| 52 * |
| 53 * Returns the data buffer, which must be freed by the caller, or NULL if |
| 54 * error. */ |
| 55 VbSharedDataHeader* VbSharedDataRead(void); |
| 56 |
| 57 /* Read an architecture-specific system property integer. |
| 58 * |
| 59 * Returns the property value, or -1 if error. */ |
| 60 int VbGetArchPropertyInt(const char* name); |
| 61 |
| 62 /* Read an architecture-specific system property string into a |
| 63 * destination buffer of the specified size. Returned string will be |
| 64 * null-terminated. If the buffer is too small, the returned string |
| 65 * will be truncated. |
| 66 * |
| 67 * Returns the passed buffer, or NULL if error. */ |
| 68 const char* VbGetArchPropertyString(const char* name, char* dest, int size); |
| 69 |
| 70 /* Set an architecture-specific system property integer. |
| 71 * |
| 72 * Returns 0 if success, -1 if error. */ |
| 73 int VbSetArchPropertyInt(const char* name, int value); |
| 74 |
| 75 /* Set an architecture-specific system property string. |
| 76 * |
| 77 * Returns 0 if success, -1 if error. */ |
| 78 int VbSetArchPropertyString(const char* name, const char* value); |
| 79 |
| 80 #endif /* VBOOT_REFERENCE__CROSSYSTEM_ARCH_H_ */ |
OLD | NEW |