1 /*
2  * Copyright (c)  2018-present Facebook. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 enum fb_app_cmds
20 {
21     CMD_APP_GET_SELFTEST_RESULTS = 0x04,
22     CMD_APP_MFR_TEST_ON = 0x05,
23     CMD_APP_SET_ACPI = 0x06,
24     CMD_APP_GET_ACPI = 0x07,
25     CMD_APP_GET_DEV_GUID = 0x08,
26     CMD_APP_SET_GLOBAL_ENABLES = 0x2E,
27     CMD_APP_GET_GLOBAL_ENABLES = 0x2F,
28     CMD_APP_CLEAR_MESSAGE_FLAGS = 0x30,
29     CMD_APP_GET_SYS_GUID = 0x37,
30     CMD_APP_SET_SYS_INFO_PARAMS = 0x58,
31     CMD_APP_GET_SYS_INFO_PARAMS = 0x59,
32 
33 };
34 
35 #define SIZE_SYSFW_VER 17
36 #define SIZE_SYS_NAME 17
37 #define SIZE_OS_NAME 17
38 #define SIZE_OS_VER 17
39 #define SIZE_BMC_URL 17
40 #define SIZE_OS_HV_URL 17
41 #define SIZE_BIOS_CURRENT_BOOT_LIST 250
42 #define SIZE_BIOS_FIXED_BOOT_DEVICE 1
43 #define SIZE_BIOS_RSTR_DFLT_SETTING 1
44 #define SIZE_LAST_BOOT_TIME 4
45 #define SIZE_PCIE_PORT_CONFIG 2
46 
47 #define JSON_APP_DATA_FILE "/var/lib/fb-ipmi-oem/appData.json"
48 #define KEY_SYSFW_VER "sysfw_ver_server"
49 #define KEY_BIOS_BOOT_LEN "bios_boot_list_len"
50 
51 // System Info Parameters (IPMI/Table 22-16c)
52 enum SysInfoParams
53 {
54     SYS_INFO_PARAM_SET_IN_PROG,
55     SYS_INFO_PARAM_SYSFW_VER,
56     SYS_INFO_PARAM_SYS_NAME,
57     SYS_INFO_PARAM_PRI_OS_NAME,
58     SYS_INFO_PARAM_PRESENT_OS_NAME,
59     SYS_INFO_PARAM_PRESENT_OS_VER,
60     SYS_INFO_PARAM_BMC_URL,
61     SYS_INFO_PARAM_OS_HV_URL,
62     SYS_INFO_PARAM_BIOS_CURRENT_BOOT_LIST = 0xC1,
63     SYS_INFO_PARAM_BIOS_FIXED_BOOT_DEVICE = 0xC2,
64     SYS_INFO_PARAM_BIOS_RSTR_DFLT_SETTING = 0xC3,
65     SYS_INFO_PARAM_LAST_BOOT_TIME = 0xC4,
66 };
67 
68 // Structure for System Info Params (IPMI/Section 22.14a)
69 struct SysInfoParam
70 {
71     uint8_t set_in_prog;
72     uint8_t sysfw_ver[SIZE_SYSFW_VER];
73     uint8_t sys_name[SIZE_SYS_NAME];
74     uint8_t pri_os_name[SIZE_OS_NAME];
75     uint8_t present_os_name[SIZE_OS_NAME];
76     uint8_t present_os_ver[SIZE_OS_VER];
77     uint8_t bmc_url[SIZE_BMC_URL];
78     uint8_t os_hv_url[SIZE_OS_HV_URL];
79     uint8_t bios_current_boot_list[SIZE_BIOS_CURRENT_BOOT_LIST];
80     uint8_t bios_fixed_boot_device[SIZE_BIOS_FIXED_BOOT_DEVICE];
81     uint8_t bios_rstr_dflt_setting[SIZE_BIOS_RSTR_DFLT_SETTING];
82     uint8_t last_boot_time[SIZE_LAST_BOOT_TIME];
83 
84 } __attribute__((packed));
85