blob: 8599af46720d0c7f9258235123893fab11b5d4fd [file] [log] [blame]
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001/*
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
19enum ipmi_fb_net_fns
20{
21 NETFN_OEM_USB_DBG_REQ = 0x3C,
22 NETFN_OEM_USB_DBG_RES = 0x3D,
23};
24
25// OEM Command Codes for USB basded Debug Card
26enum oem_usb_dbg_cmds
27{
28 CMD_OEM_USB_DBG_GET_FRAME_INFO = 0x1,
29 CMD_OEM_USB_DBG_GET_UPDATED_FRAMES = 0x2,
30 CMD_OEM_USB_DBG_GET_POST_DESC = 0x3,
31 CMD_OEM_USB_DBG_GET_GPIO_DESC = 0x4,
32 CMD_OEM_USB_DBG_GET_FRAME_DATA = 0x5,
33 CMD_OEM_USB_DBG_CTRL_PANEL = 0x6,
34};
35
36// OEM Command Codes for FB 1S/2S servers
37enum fb_oem_cmds
38{
39 CMD_OEM_ADD_RAS_SEL = 0x10,
40 CMD_OEM_ADD_IMC_LOG = 0x11,
41 CMD_OEM_SET_MAC_ADDR = 0x18,
42 CMD_OEM_GET_MAC_ADDR = 0x19,
43 CMD_OEM_SET_PROC_INFO = 0x1A,
44 CMD_OEM_GET_PROC_INFO = 0x1B,
45 CMD_OEM_SET_DIMM_INFO = 0x1C,
46 CMD_OEM_GET_DIMM_INFO = 0x1D,
47 CMD_OEM_BYPASS_CMD = 0x34,
48 CMD_OEM_GET_BOARD_ID = 0x37,
49 CMD_OEM_GET_80PORT_RECORD = 0x49,
50 CMD_OEM_SET_BOOT_ORDER = 0x52,
51 CMD_OEM_GET_BOOT_ORDER = 0x53,
52 CMD_OEM_SET_MACHINE_CONFIG_INFO = 0x6A,
53 CMD_OEM_LEGACY_SET_PPR = 0x6E,
54 CMD_OEM_LEGACY_GET_PPR = 0x6F,
55 CMD_OEM_SET_POST_START = 0x73,
56 CMD_OEM_SET_POST_END = 0x74,
57 CMD_OEM_SET_PPIN_INFO = 0x77,
58 CMD_OEM_SET_ADR_TRIGGER = 0x7A,
59 CMD_OEM_GET_PLAT_INFO = 0x7E,
60 CMD_OEM_SET_SYSTEM_GUID = 0xEF,
61 CMD_OEM_GET_FW_INFO = 0xF2,
62 CMD_OEM_SLED_AC_CYCLE = 0xF3,
63 CMD_OEM_GET_PCIE_CONFIG = 0xF4,
64 CMD_OEM_SET_IMC_VERSION = 0xF5,
65 CMD_OEM_SET_FW_UPDATE_STATE = 0xF6,
66 CMD_OEM_GET_BIOS_FLASH_INFO = 0x55,
67 CMD_OEM_GET_PCIE_PORT_CONFIG = 0x80,
68 CMD_OEM_SET_PCIE_PORT_CONFIG = 0x81,
69 CMD_OEM_GET_TPM_PRESENCE = 0x82,
70 CMD_OEM_SET_TPM_PRESENCE = 0x83,
71 CMD_OEM_SET_BIOS_FLASH_INFO = 0x87,
72 CMD_OEM_SET_PPR = 0x90,
73 CMD_OEM_GET_PPR = 0x91,
74 CMD_OEM_SET_IPMB_OFFONLINE = 0xE6,
75 CMD_OEM_RISER_SENSOR_MON_CRL = 0xE7,
76 CMD_OEM_BBV_POWER_CYCLE = 0xE9,
77 CMD_OEM_ADD_CPER_LOG = 0x70,
78
79};
Vijay Khemka1d4a0692019-04-09 15:20:28 -070080
81// OEM Command Codes for QC
82enum fb_oem_qc_cmds
83{
84 CMD_OEM_Q_SET_PROC_INFO = 0x10,
85 CMD_OEM_Q_GET_PROC_INFO = 0x11,
86 CMD_OEM_Q_SET_DIMM_INFO = 0x12,
87 CMD_OEM_Q_GET_DIMM_INFO = 0x13,
88 CMD_OEM_Q_SET_DRIVE_INFO = 0x14,
89 CMD_OEM_Q_GET_DRIVE_INFO = 0x15,
90};
91
92#define SIZE_CPU_PPIN 8
93#define SIZE_BOOT_ORDER 6
94#define BOOT_MODE_UEFI 0x01
95#define BOOT_MODE_CMOS_CLR 0x02
96#define BOOT_MODE_FORCE_BOOT 0x04
97#define BOOT_MODE_BOOT_FLAG 0x80
98#define BIT_0 0x01
99#define BIT_1 0x02
100#define BIT_2 0x04
101#define BIT_3 0x08
102
103#define JSON_OEM_DATA_FILE "/etc/oemData.json"
104#define KEY_PPIN_INFO "mb_cpu_ppin"
105#define KEY_MC_CONFIG "mb_machine_config"
106#define KEY_MC_CHAS_TYPE "chassis_type"
107#define KEY_MC_MB_TYPE "mb_type"
108#define KEY_MC_PROC_CNT "processor_count"
109#define KEY_MC_MEM_CNT "memory_count"
110#define KEY_MC_HDD35_CNT "hdd35_count"
111#define KEY_MC_HDD25_CNT "hdd25_count"
112#define KEY_MC_RSR_TYPE "riser_type"
113#define KEY_MC_PCIE_LOC "pcie_card_loc"
114#define KEY_MC_SLOT1_TYPE "slot1_pcie_type"
115#define KEY_MC_SLOT2_TYPE "slot2_pcie_type"
116#define KEY_MC_SLOT3_TYPE "slot3_pcie_type"
117#define KEY_MC_SLOT4_TYPE "slot4_pcie_type"
118#define KEY_MC_AEP_CNT "aep_mem_count"
119
120#define KEY_TS_SLED "timestamp_sled"
121#define KEY_BOOT_ORDER "server_boot_order"
122#define KEY_BOOT_MODE "boot_mode"
123#define KEY_BOOT_SEQ "boot_sequence"
124#define KEY_SYS_CONFIG "sys_config"
125#define KEY_DIMM_INDEX "dimm_index"
126#define KEY_DIMM_TYPE "dimm_type"
127#define KEY_DIMM_SPEED "dimm_speed"
128#define KEY_DIMM_SIZE "dimm_size"
129#define KEY_PPR "ppr"
130#define KEY_PPR_ACTION "ppr_row_action"
131#define KEY_PPR_ROW_COUNT "ppr_row_count"
132#define KEY_PPR_INDEX "ppr_index"
133#define KEY_PPR_ROW_ADDR "ppr_row_addr"
134#define KEY_PPR_HST_DATA "ppr_history_data"
135#define CC_PARAM_NOT_SUPP_IN_CURR_STATE 0xD5
136#define PPR_ROW_ADDR_LEN 8
137#define PPR_HST_DATA_LEN 17
138
Vijay Khemka877d5dd2019-12-16 14:46:21 -0800139#define BOOT_SEQ_ARRAY_SIZE 10
140
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700141const char *bootSeq[] = {"USB_DEV", "NET_IPV4", "SATA_HDD", "SATA_CD",
142 "OTHER", "", "", "",
143 "", "NET_IPV6"};
144std::map<std::string, int> bootMap = {{"USB_DEV", 0}, {"NET_IPV4", 1},
145 {"NET_IPV6", 9}, {"SATA_HDD", 2},
146 {"SATA_CD", 3}, {"OTHER", 4}};
147
148const char *chassisType[] = {"ORV1", "ORV2"};
149const char *mbType[] = {"SS", "DS", "TYPE3"};
150const char *riserType[] = {"NO_CARD", "2_SLOT", "3_SLOT"};
151const char *pcieType[] = {"ABSENT", "AVA1", "AVA2", "AVA3",
152 "AVA4", "Re-timer", "HBA", "OTHER"};
153
154enum fb_ppr_sel
155{
156 PPR_ACTION = 1,
157 PPR_ROW_COUNT,
158 PPR_ROW_ADDR,
159 PPR_HISTORY_DATA,
160};
161
162typedef struct
163{
164 uint8_t chassis_type; // 00 - ORv1, 01 - ORv2 (FBTP)
165 uint8_t mb_type; // 00 - SS, 01 - DS, 02 - Type3
166 uint8_t proc_cnt;
167 uint8_t mem_cnt;
168 uint8_t hdd35_cnt; // 0/1 in FBTP, ff - unknown
169 uint8_t hdd25_cnt; // 0 for FBTP
170 uint8_t riser_type; // 00 - not installed, 01 - 2 slot, 02 - 3 slot
171 uint8_t pcie_card_loc; // Bit0 - Slot1 Present/Absent, Bit1 - Slot 2
172 // Present/Absent etc.
173 uint8_t slot1_pcie_type; // Always NIC for FBTP
174 uint8_t slot2_pcie_type; // 2-4: 00 - Absent, 01 - AVA 2 x m.2, 02 - AVA
175 // 3x m.2,
176 uint8_t slot3_pcie_type; // 03 - AVA 4 x m.2, 04 - Re-timer, 05 - HBA
177 uint8_t slot4_pcie_type; // 06 - Other flash cards (Intel, HGST),
178 // 80 - Unknown
179 uint8_t aep_mem_cnt;
180} machineConfigInfo_t;
181
182/* FB OEM QC commands data structures */
183
184#define NETFUN_FB_OEM_QC 0x36
185
186#define KEY_Q_PROC_INFO "q_proc_info"
187#define KEY_PROC_INDEX "proc_index"
188#define KEY_Q_DIMM_INFO "q_dimm_info"
189#define KEY_DIMM_INDEX "dimm_index"
190#define KEY_Q_DRIVE_INFO "q_drive_info"
191#define KEY_HDD_CTRL_TYPE "hdd_ctrl_type"
192#define KEY_HDD_INDEX "hdd_index"
193
194typedef struct
195{
196 uint8_t mfrId[3];
197 uint8_t procIndex;
198 uint8_t paramSel;
199 uint8_t data[];
200} qProcInfo_t;
201
202typedef struct
203{
204 uint8_t mfrId[3];
205 uint8_t dimmIndex;
206 uint8_t paramSel;
207 uint8_t data[];
208} qDimmInfo_t;
209
210typedef struct
211{
212 uint8_t mfrId[3];
213 uint8_t hddCtrlType;
214 uint8_t hddIndex;
215 uint8_t paramSel;
216 uint8_t data[];
217} qDriveInfo_t;
218
219const char *cpuInfoKey[] = {"", "product_name", "basic_info",
220 "type", "micro_code", "turbo_mode"};
221
222const char *dimmInfoKey[] = {
223 "", "location", "type", "speed", "part_name",
224 "serial_num", "manufacturer_id", "status", "present_bit"};
225
226const char *driveInfoKey[] = {"location", "serial_num", "model_name",
227 "fw_version", "capacity", "quantity",
228 "type", "wwn"};
229
230const char *ctrlTypeKey[] = {"bios", "expander", "lsi"};