Duncan Laurie | b0bf280 | 2018-10-15 02:18:03 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2018 Google LLC |
| 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 <console/console.h> |
| 17 | #include <stdint.h> |
| 18 | #include <string.h> |
| 19 | |
| 20 | #include "ec.h" |
| 21 | #include "commands.h" |
| 22 | |
| 23 | int wilco_ec_get_info(enum get_ec_info_cmd type, char *info) |
| 24 | { |
| 25 | struct ec_response_get_ec_info rsp; |
| 26 | |
| 27 | if (!info) |
| 28 | return -1; |
| 29 | if (wilco_ec_sendrecv(KB_EC_INFO, type, &rsp, sizeof(rsp)) < 0) |
| 30 | return -1; |
| 31 | |
| 32 | /* Copy returned string */ |
| 33 | strncpy(info, rsp.data, sizeof(rsp.data)); |
| 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | void wilco_ec_print_all_info(void) |
| 38 | { |
| 39 | char info[EC_INFO_MAX_SIZE]; |
| 40 | |
| 41 | if (!wilco_ec_get_info(GET_EC_LABEL, info)) |
| 42 | printk(BIOS_INFO, "EC Label : %s\n", info); |
| 43 | |
| 44 | if (!wilco_ec_get_info(GET_EC_SVN_REV, info)) |
| 45 | printk(BIOS_INFO, "EC Revision : %s\n", info); |
| 46 | |
| 47 | if (!wilco_ec_get_info(GET_EC_MODEL_NO, info)) |
| 48 | printk(BIOS_INFO, "EC Model Num : %s\n", info); |
| 49 | |
| 50 | if (!wilco_ec_get_info(GET_EC_BUILD_DATE, info)) |
| 51 | printk(BIOS_INFO, "EC Build Date : %s\n", info); |
| 52 | } |