blob: 69a0a9116a5553d93f21eb9208cce7023b903a23 [file] [log] [blame]
Hannah Williamsd59f62b2017-05-05 16:39:21 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2017 Intel Corp.
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
16#include <baseboard/variants.h>
Karthikeyan Ramasubramanianc80ff842018-09-17 16:19:34 -060017#include <boardid.h>
Hannah Williamsd59f62b2017-05-05 16:39:21 -070018#include <ec/google/chromeec/ec.h>
19
Karthikeyan Ramasubramanianc80ff842018-09-17 16:19:34 -060020int variant_board_id(void)
Hannah Williamsd59f62b2017-05-05 16:39:21 -070021{
Karthikeyan Ramasubramanianc80ff842018-09-17 16:19:34 -060022 MAYBE_STATIC uint32_t id = BOARD_ID_INIT;
23
Julius Wernercd49cce2019-03-05 16:53:33 -080024 if (CONFIG(EC_GOOGLE_CHROMEEC)) {
Karthikeyan Ramasubramanianc80ff842018-09-17 16:19:34 -060025 if (id == BOARD_ID_INIT) {
26 if (google_chromeec_get_board_version(&id))
27 id = BOARD_ID_UNKNOWN;
28 }
29 return id;
30 } else {
Hannah Williamsd59f62b2017-05-05 16:39:21 -070031 return 0;
Karthikeyan Ramasubramanianc80ff842018-09-17 16:19:34 -060032 }
Hannah Williamsd59f62b2017-05-05 16:39:21 -070033}