blob: a362b08df86911f4a70c4655cc15c3689b733016 [file] [log] [blame]
Aamir Bohra6fed4682016-11-08 14:06:17 +05301/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2016 Intel Corporation.
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#include "board_id.h"
16#include <ec/acpi/ec.h>
17#include <stdint.h>
18
19/*
20 * Get Board ID via EC I/O port write/read
21 */
22int get_board_id(void)
23{
24 uint8_t buffer[2];
25 uint8_t index;
26 if (send_ec_command(EC_FAB_ID_CMD) == 0) {
27 for (index = 0; index < sizeof(buffer); index++)
28 buffer[index] = recv_ec_data();
29 return (buffer[1] << 8) | buffer[0];
30 }
31 return -1;
32}