Stefan Reinauer | 9aea04a | 2012-03-30 12:01:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 17 | * Foundation, Inc. |
Stefan Reinauer | 9aea04a | 2012-03-30 12:01:06 -0700 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #ifndef __CHROMEOS_H__ |
| 21 | #define __CHROMEOS_H__ |
| 22 | |
Aaron Durbin | 790e3ad | 2014-01-27 15:08:27 -0600 | [diff] [blame] | 23 | #include <stddef.h> |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 24 | #include <stdint.h> |
Kyösti Mälkki | 5687fc9 | 2013-11-28 18:11:49 +0200 | [diff] [blame] | 25 | #include <bootmode.h> |
Aaron Durbin | 818e928 | 2015-04-21 15:23:41 -0500 | [diff] [blame] | 26 | #include <rules.h> |
Daisuke Nojiri | 742fc8d | 2014-10-10 10:51:06 -0700 | [diff] [blame] | 27 | #include "vboot_common.h" |
| 28 | #include "vboot2/misc.h" |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 29 | |
Aaron Durbin | 818e928 | 2015-04-21 15:23:41 -0500 | [diff] [blame] | 30 | #if ENV_ROMSTAGE |
| 31 | void save_chromeos_gpios(void); |
| 32 | #endif |
| 33 | |
Stefan Reinauer | 9aea04a | 2012-03-30 12:01:06 -0700 | [diff] [blame] | 34 | /* functions implemented in vbnv.c: */ |
| 35 | int get_recovery_mode_from_vbnv(void); |
Bill Richardson | 0a405ba | 2012-06-26 16:33:45 -0700 | [diff] [blame] | 36 | int vboot_wants_oprom(void); |
Stefan Reinauer | 9aea04a | 2012-03-30 12:01:06 -0700 | [diff] [blame] | 37 | |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 38 | void read_vbnv(uint8_t *vbnv_copy); |
| 39 | void save_vbnv(const uint8_t *vbnv_copy); |
| 40 | |
Duncan Laurie | 203e8ce | 2014-04-22 10:52:31 -0700 | [diff] [blame] | 41 | #if CONFIG_CHROMEOS |
David Hendricks | 739e6a8 | 2014-05-13 20:28:49 -0700 | [diff] [blame] | 42 | /* functions implemented in elog.c */ |
| 43 | void elog_add_boot_reason(void); |
Julius Werner | 105f5b7 | 2015-01-21 17:39:49 -0800 | [diff] [blame] | 44 | |
| 45 | /* functions implemented in watchdog.c */ |
| 46 | void elog_add_watchdog_reset(void); |
| 47 | void reboot_from_watchdog(void); |
Patrick Georgi | b69b05d | 2015-04-22 15:10:59 +0200 | [diff] [blame] | 48 | |
| 49 | int vboot_enable_developer(void); |
| 50 | int vboot_enable_recovery(void); |
| 51 | int vboot_skip_display_init(void); |
Duncan Laurie | 203e8ce | 2014-04-22 10:52:31 -0700 | [diff] [blame] | 52 | #else |
David Hendricks | 739e6a8 | 2014-05-13 20:28:49 -0700 | [diff] [blame] | 53 | static inline void elog_add_boot_reason(void) { return; } |
Julius Werner | 105f5b7 | 2015-01-21 17:39:49 -0800 | [diff] [blame] | 54 | static inline void elog_add_watchdog_reset(void) { return; } |
| 55 | static inline void reboot_from_watchdog(void) { return; } |
Patrick Georgi | b69b05d | 2015-04-22 15:10:59 +0200 | [diff] [blame] | 56 | static inline int vboot_skip_display_init(void) { return 0; } |
Duncan Laurie | 203e8ce | 2014-04-22 10:52:31 -0700 | [diff] [blame] | 57 | #endif /* CONFIG_CHROMEOS */ |
Stefan Reinauer | 9aea04a | 2012-03-30 12:01:06 -0700 | [diff] [blame] | 58 | |
Aaron Durbin | 168b0f9 | 2013-10-10 20:58:57 -0500 | [diff] [blame] | 59 | struct romstage_handoff; |
Shawn Nematbakhsh | 229ad27 | 2014-03-14 13:57:32 -0700 | [diff] [blame] | 60 | |
Aaron Durbin | 1124cec | 2015-04-22 10:41:42 -0500 | [diff] [blame] | 61 | #if CONFIG_VBOOT_VERIFY_FIRMWARE |
Aaron Durbin | dd32a31 | 2013-03-07 23:15:06 -0600 | [diff] [blame] | 62 | /* Returns 0 on success < 0 on error. */ |
| 63 | int vboot_get_handoff_info(void **addr, uint32_t *size); |
Aaron Durbin | 1124cec | 2015-04-22 10:41:42 -0500 | [diff] [blame] | 64 | #else /* CONFIG_VBOOT_VERIFY_FIRMWARE */ |
Aaron Durbin | e742dda | 2014-02-04 12:38:41 -0600 | [diff] [blame] | 65 | static inline int vboot_get_handoff_info(void **addr, uint32_t *size) |
| 66 | { |
| 67 | return -1; |
| 68 | } |
Aaron Durbin | 1124cec | 2015-04-22 10:41:42 -0500 | [diff] [blame] | 69 | #endif /* CONFIG_VBOOT_VERIFY_FIRMWARE */ |
Daisuke Nojiri | bcc1d42 | 2014-06-19 19:16:24 -0700 | [diff] [blame] | 70 | |
Shawn Nematbakhsh | 229ad27 | 2014-03-14 13:57:32 -0700 | [diff] [blame] | 71 | int vboot_get_sw_write_protect(void); |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 72 | |
Aaron Durbin | 06ece7d | 2014-02-14 00:30:04 -0600 | [diff] [blame] | 73 | #include "gnvs.h" |
| 74 | struct device; |
| 75 | |
Aaron Durbin | 59674d2 | 2014-03-05 17:25:22 -0600 | [diff] [blame] | 76 | #if CONFIG_CHROMEOS_RAMOOPS |
Aaron Durbin | 06ece7d | 2014-02-14 00:30:04 -0600 | [diff] [blame] | 77 | void chromeos_ram_oops_init(chromeos_acpi_t *chromeos); |
| 78 | #if CONFIG_CHROMEOS_RAMOOPS_DYNAMIC |
| 79 | static inline void chromeos_reserve_ram_oops(struct device *dev, int idx) {} |
| 80 | #else /* CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */ |
| 81 | void chromeos_reserve_ram_oops(struct device *dev, int idx); |
| 82 | #endif /* CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */ |
| 83 | #else /* !CONFIG_CHROMEOS_RAMOOPS */ |
| 84 | static inline void chromeos_ram_oops_init(chromeos_acpi_t *chromeos) {} |
| 85 | static inline void chromeos_reserve_ram_oops(struct device *dev, int idx) {} |
| 86 | #endif /* CONFIG_CHROMEOS_RAMOOPS */ |
| 87 | |
Vadim Bendebury | 318708d | 2014-10-23 16:02:51 -0700 | [diff] [blame] | 88 | void cbmem_add_vpd_calibration_data(void); |
Vadim Bendebury | c83687d | 2015-04-10 17:50:11 -0700 | [diff] [blame] | 89 | void vboot_reboot(void); |
Vadim Bendebury | 318708d | 2014-10-23 16:02:51 -0700 | [diff] [blame] | 90 | |
Daisuke Nojiri | 742fc8d | 2014-10-10 10:51:06 -0700 | [diff] [blame] | 91 | #endif /* __CHROMEOS_H__ */ |