soc/intel/alderlake: Add ADL-P 4+4 with 28W TDP
[coreboot.git] / src / drivers / ipmi / supermicro_oem.c
blobc63da5f02086f6ad991bb614cad9ef8813049ae1
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <types.h>
5 #include <console/console.h>
6 #include <drivers/ipmi/ipmi_if.h>
7 #include <string.h>
8 #include <build.h>
9 #include "ipmi_supermicro_oem.h"
11 #define IPMI_NETFN_OEM 0x30
12 #define IPMI_LUN0_AC_SET_BIOS_VER 0x100
13 #define IPMI_LUN0_AC_SET_BIOS_DATE 0x101
14 #define IPMI_LUN0_SET_BIOS_STRING 0xac
16 struct ipmi_oem_set_bios_str {
17 uint16_t ver;
18 char str[16]; // NULL terminated string
19 } __packed;
21 static void set_coreboot_ver(const uint16_t kcs_port)
23 const char *coreboot_ver = COREBOOT_VERSION;
24 struct ipmi_oem_set_bios_str bios_ver;
25 struct ipmi_rsp rsp;
26 int ret;
27 size_t i;
29 /* Only 8 characters are visible in UI. Cut of on first dash */
30 for (i = 0; i < 15; i++) {
31 if (coreboot_ver[i] == '-')
32 break;
33 bios_ver.str[i] = coreboot_ver[i];
35 bios_ver.str[i] = 0;
36 bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_VER;
38 ret = ipmi_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING,
39 (const unsigned char *)&bios_ver, sizeof(bios_ver),
40 (unsigned char *)&rsp, sizeof(rsp));
41 if (ret < sizeof(rsp) || rsp.completion_code) {
42 printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n",
43 __func__, ret, rsp.completion_code);
47 static void set_coreboot_date(const uint16_t kcs_port)
49 struct ipmi_oem_set_bios_str bios_ver;
50 struct ipmi_rsp rsp;
51 int ret;
53 strncpy(bios_ver.str, COREBOOT_DMI_DATE, 15);
54 bios_ver.str[15] = 0;
55 bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_DATE;
57 ret = ipmi_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING,
58 (const unsigned char *)&bios_ver, sizeof(bios_ver),
59 (unsigned char *)&rsp, sizeof(rsp));
60 if (ret < sizeof(rsp) || rsp.completion_code) {
61 printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n",
62 __func__, ret, rsp.completion_code);
66 void supermicro_ipmi_oem(const uint16_t kcs_port)
68 set_coreboot_ver(kcs_port);
69 set_coreboot_date(kcs_port);