1 /* Copyright (c) 2014 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 
6 #include <string.h>
7 
8 #include "vboot_common.h"
9 #include "vboot_nvstorage.h"
10 #include "host_common.h"
11 #include "crossystem.h"
12 #include "crossystem_arch.h"
13 
14 // TODO: Currently these are stub implementations providing reasonable defaults
15 // wherever possible. They will need real implementation as part of of MIPS
16 // firmware bringup.
17 
VbReadNvStorage(VbNvContext * vnc)18 int VbReadNvStorage(VbNvContext* vnc) {
19   return -1;
20 }
21 
VbWriteNvStorage(VbNvContext * vnc)22 int VbWriteNvStorage(VbNvContext* vnc) {
23   return -1;
24 }
25 
VbSharedDataRead(void)26 VbSharedDataHeader *VbSharedDataRead(void) {
27   return NULL;
28 }
29 
VbGetArchPropertyInt(const char * name)30 int VbGetArchPropertyInt(const char* name) {
31   if (!strcasecmp(name,"devsw_cur")) {
32     return 1;
33   } else if (!strcasecmp(name,"recoverysw_cur")) {
34     return 0;
35   } else if (!strcasecmp(name,"wpsw_cur")) {
36     return 1;
37   } else if (!strcasecmp(name,"devsw_boot")) {
38     return 1;
39   } else if (!strcasecmp(name,"recoverysw_boot")) {
40     return 0;
41   } else if (!strcasecmp(name,"recoverysw_ec_boot")) {
42     return 0;
43   } else if (!strcasecmp(name,"wpsw_boot")) {
44     return 1;
45   }
46   return -1;
47 }
48 
VbGetArchPropertyString(const char * name,char * dest,size_t size)49 const char* VbGetArchPropertyString(const char* name, char* dest, size_t size) {
50   if (!strcasecmp(name,"hwid")) {
51     return StrCopy(dest, "UnknownMipsHwid", size);
52   } else if (!strcasecmp(name,"fwid")) {
53     return StrCopy(dest, "UnknownMipsFwid", size);
54   } else if (!strcasecmp(name,"ro_fwid")) {
55     return StrCopy(dest, "UnknownMipsRoFwid", size);
56   } else if (!strcasecmp(name,"mainfw_act")) {
57     return StrCopy(dest, "A", size);
58   } else if (!strcasecmp(name,"mainfw_type")) {
59     return StrCopy(dest, "developer", size);
60   } else if (!strcasecmp(name,"ecfw_act")) {
61     return StrCopy(dest, "RO", size);
62   }
63   return NULL;
64 }
65 
VbSetArchPropertyInt(const char * name,int value)66 int VbSetArchPropertyInt(const char* name, int value) {
67   /* All is handled in arch independent fashion */
68   return -1;
69 }
70 
VbSetArchPropertyString(const char * name,const char * value)71 int VbSetArchPropertyString(const char* name, const char* value) {
72   /* All is handled in arch independent fashion */
73   return -1;
74 }
75