diff options
author | Johnny Lin <johnny_lin@wiwynn.com> | 2019-08-13 15:36:23 +0800 |
---|---|---|
committer | Andrey Petrov <andrey.petrov@gmail.com> | 2019-08-20 18:18:34 +0000 |
commit | 64d8b9decf8fe51e13ef5e5e89c71682f1696608 (patch) | |
tree | 572183771d748af8f46293f1c0c97a878f490547 /src/mainboard/ocp/monolake/ipmi.h | |
parent | a4542990f4cd5d9a18e8b0846b54fcfe5cbd01e5 (diff) |
mb/ocp/monolake: Add IPMI CMOS clear support
coreboot would clear CMOS by request via IPMI command, for example
BMC can issue "bios-util server --boot_order enable --clear_CMOS"
to set the request and reboot the system, then coreboot would clear CMOS
on the next boot.
Tested on Mono Lake
Change-Id: I21d44557896680cfac3c3b6d83e07b755b242cad
Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34857
Reviewed-by: Johnny Lin
Reviewed-by: Andrey Petrov <andrey.petrov@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/ocp/monolake/ipmi.h')
-rw-r--r-- | src/mainboard/ocp/monolake/ipmi.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/mainboard/ocp/monolake/ipmi.h b/src/mainboard/ocp/monolake/ipmi.h new file mode 100644 index 0000000000..5863eb5082 --- /dev/null +++ b/src/mainboard/ocp/monolake/ipmi.h @@ -0,0 +1,53 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 Wiwynn Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef MONOLAKE_IPMI_H +#define MONOLAKE_IPMI_H +#include <types.h> + +#define IPMI_NETFN_OEM 0x30 +#define IPMI_OEM_SET_BIOS_BOOT_ORDER 0x52 +#define IPMI_OEM_GET_BIOS_BOOT_ORDER 0x53 +#define GET_CMOS_BIT(x) ((x) & (1 << 1)) +#define GET_VALID_BIT(x) ((x) & (1 << 7)) +#define CLEAR_CMOS_AND_VALID_BIT(x) ((x) &= 0x7d) + +typedef struct { + u8 BootMode; /* Bit 1:CMOS clear, bit 7:valid bit. */ + u8 Boot0000; + u8 Boot0001; + u8 Boot0002; + u8 Boot0003; + u8 Boot0004; +} __packed ipmi_oem_req_t; + +typedef struct { + u16 KcsRsp; + u8 CompletionCode; + ipmi_oem_req_t Data; +} __packed ipmi_oem_rsp_t; + +/* + * IPMI get response to check if valid and CMOS clear bit + * are both set and store the IPMI response data to the parameter. + */ +int is_ipmi_clear_cmos_set(ipmi_oem_rsp_t *rsp); +/* + * Clear valid bit and CMOS clear bit from the parameter + * and set it back via IPMI. + */ +void clear_ipmi_flags(ipmi_oem_rsp_t *rsp); + +#endif |