blob: f146d89694aeaf405b48297048569b1f7e0f1df7 [file] [log] [blame]
Jason M. Bills7ef5a552020-04-06 14:58:44 -07001/*
2// Copyright (c) 2019 Intel Corporation
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#pragma once
17#ifdef __cplusplus
Patrick Williams7169faa2023-05-10 07:51:24 -050018extern "C"
19{
Jason M. Bills7ef5a552020-04-06 14:58:44 -070020#endif
Jason M. Bills7ef5a552020-04-06 14:58:44 -070021#include <inttypes.h>
22#include <stdbool.h>
23
24// PECI Client Address List
25#define MIN_CLIENT_ADDR 0x30
26#define MAX_CLIENT_ADDR 0x37
27#define MAX_CPUS (MAX_CLIENT_ADDR - MIN_CLIENT_ADDR + 1)
28
Jason M. Billsa2ceec22020-05-05 13:16:00 -070029// PECI completion codes from peci-ioctl.h
30#define PECI_DEV_CC_SUCCESS 0x40
31#define PECI_DEV_CC_FATAL_MCA_DETECTED 0x94
32
Patrick Williams7169faa2023-05-10 07:51:24 -050033 typedef enum
34 {
35 skx = 0x00050650,
36 icx = 0x000606A0,
37 icxd = 0x000606C0,
38 spr = 0x000806F0,
39 emr = 0x000C06F0,
40 gnr = 0x000A06D0,
Saitwal, Meghanb33f5932023-07-19 15:52:48 +000041 gnrd = 0x000A06E0,
Patrick Williams7169faa2023-05-10 07:51:24 -050042 srf = 0x000A06F0,
43 } CPUModel;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070044
Patrick Williams7169faa2023-05-10 07:51:24 -050045 // PECI Status Codes
46 typedef enum
47 {
48 PECI_CC_SUCCESS = 0,
49 PECI_CC_INVALID_REQ,
50 PECI_CC_HW_ERR,
51 PECI_CC_DRIVER_ERR,
52 PECI_CC_CPU_NOT_PRESENT,
53 PECI_CC_MEM_ERR,
54 PECI_CC_TIMEOUT,
55 } EPECIStatus;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070056
Patrick Williams7169faa2023-05-10 07:51:24 -050057 // PECI Timeout Options
58 typedef enum
59 {
60 PECI_WAIT_FOREVER = -1,
61 PECI_NO_WAIT = 0,
62 } EPECITimeout;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070063
64#define PECI_TIMEOUT_RESOLUTION_MS 10 // 10 ms
65#define PECI_TIMEOUT_MS 100 // 100 ms
66
67// VCU Index and Sequence Paramaters
68#define VCU_SET_PARAM 0x0001
69#define VCU_READ 0x0002
70#define VCU_OPEN_SEQ 0x0003
71#define VCU_CLOSE_SEQ 0x0004
72#define VCU_ABORT_SEQ 0x0005
73#define VCU_VERSION 0x0009
74
Patrick Williams7169faa2023-05-10 07:51:24 -050075 typedef enum
76 {
77 VCU_READ_LOCAL_CSR_SEQ = 0x2,
78 VCU_READ_LOCAL_MMIO_SEQ = 0x6,
79 VCU_EN_SECURE_DATA_SEQ = 0x14,
80 VCU_CORE_MCA_SEQ = 0x10000,
81 VCU_UNCORE_MCA_SEQ = 0x10000,
82 VCU_IOT_BRKPT_SEQ = 0x10010,
83 VCU_MBP_CONFIG_SEQ = 0x10026,
84 VCU_PWR_MGT_SEQ = 0x1002a,
85 VCU_CRASHDUMP_SEQ = 0x10038,
86 VCU_ARRAY_DUMP_SEQ = 0x20000,
87 VCU_SCAN_DUMP_SEQ = 0x20008,
88 VCU_TOR_DUMP_SEQ = 0x30002,
89 VCU_SQ_DUMP_SEQ = 0x30004,
90 VCU_UNCORE_CRASHDUMP_SEQ = 0x30006,
91 } EPECISequence;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070092
93#define MBX_INDEX_VCU 128 // VCU Index
94
Patrick Williams7169faa2023-05-10 07:51:24 -050095 typedef enum
96 {
97 MMIO_DWORD_OFFSET = 0x05,
98 MMIO_QWORD_OFFSET = 0x06,
99 } EEndPtMmioAddrType;
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700100
Patrick Williams7169faa2023-05-10 07:51:24 -0500101 // Find the specified PCI bus number value
102 EPECIStatus FindBusNumber(uint8_t u8Bus, uint8_t u8Cpu,
103 uint8_t* pu8BusValue);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700104
Patrick Williams7169faa2023-05-10 07:51:24 -0500105 // Gets the temperature from the target
106 // Expressed in signed fixed point value of 1/64 degrees celsius
107 EPECIStatus peci_GetTemp(uint8_t target, int16_t* temperature);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700108
Patrick Williams7169faa2023-05-10 07:51:24 -0500109 // Provides read access to the package configuration space within the
110 // processor
111 EPECIStatus peci_RdPkgConfig(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700112 uint16_t u16Value, uint8_t u8ReadLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500113 uint8_t* pPkgConfig, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700114
Patrick Williams7169faa2023-05-10 07:51:24 -0500115 // Provides read access to the package configuration space within the
116 // processor in the specified domain
117 EPECIStatus peci_RdPkgConfig_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800118 uint8_t u8Index, uint16_t u16Value,
119 uint8_t u8ReadLen, uint8_t* pPkgConfig,
Patrick Williams7169faa2023-05-10 07:51:24 -0500120 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800121
Patrick Williams7169faa2023-05-10 07:51:24 -0500122 // Allows sequential RdPkgConfig with the provided peci file descriptor
123 EPECIStatus peci_RdPkgConfig_seq(uint8_t target, uint8_t u8Index,
124 uint16_t u16Value, uint8_t u8ReadLen,
125 uint8_t* pPkgConfig, int peci_fd,
126 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700127
Patrick Williams7169faa2023-05-10 07:51:24 -0500128 // Allows sequential RdPkgConfig with the provided peci file descriptor in
129 // the specified domain
130 EPECIStatus peci_RdPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
131 uint8_t u8Index, uint16_t u16Value,
132 uint8_t u8ReadLen, uint8_t* pPkgConfig,
133 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800134
Patrick Williams7169faa2023-05-10 07:51:24 -0500135 // Provides write access to the package configuration space within the
136 // processor
137 EPECIStatus peci_WrPkgConfig(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700138 uint16_t u16Param, uint32_t u32Value,
Patrick Williams7169faa2023-05-10 07:51:24 -0500139 uint8_t u8WriteLen, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700140
Patrick Williams7169faa2023-05-10 07:51:24 -0500141 // Provides write access to the package configuration space within the
142 // processor in the specified domain
143 EPECIStatus peci_WrPkgConfig_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800144 uint8_t u8Index, uint16_t u16Param,
145 uint32_t u32Value, uint8_t u8WriteLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500146 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800147
Patrick Williams7169faa2023-05-10 07:51:24 -0500148 // Allows sequential WrPkgConfig with the provided peci file descriptor
149 EPECIStatus peci_WrPkgConfig_seq(uint8_t target, uint8_t u8Index,
150 uint16_t u16Param, uint32_t u32Value,
151 uint8_t u8WriteLen, int peci_fd,
152 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700153
Patrick Williams7169faa2023-05-10 07:51:24 -0500154 // Allows sequential WrPkgConfig with the provided peci file descriptor in
155 // the specified domain
156 EPECIStatus peci_WrPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
157 uint8_t u8Index, uint16_t u16Param,
158 uint32_t u32Value, uint8_t u8WriteLen,
159 int peci_fd, uint8_t* cc);
160
161 // Provides read access to Model Specific Registers
162 EPECIStatus peci_RdIAMSR(uint8_t target, uint8_t threadID,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800163 uint16_t MSRAddress, uint64_t* u64MsrVal,
164 uint8_t* cc);
165
Patrick Williams7169faa2023-05-10 07:51:24 -0500166 // Provides read access to Model Specific Registers in the specified domain
167 EPECIStatus peci_RdIAMSR_dom(uint8_t target, uint8_t domainId,
168 uint8_t threadID, uint16_t MSRAddress,
169 uint64_t* u64MsrVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700170
Patrick Williams7169faa2023-05-10 07:51:24 -0500171 // Provides read access to PCI Configuration space
172 EPECIStatus peci_RdPCIConfig(uint8_t target, uint8_t u8Bus,
173 uint8_t u8Device, uint8_t u8Fcn,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800174 uint16_t u16Reg, uint8_t* pPCIReg,
175 uint8_t* cc);
176
Patrick Williams7169faa2023-05-10 07:51:24 -0500177 // Provides read access to PCI Configuration space in the specified domain
178 EPECIStatus peci_RdPCIConfig_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800179 uint8_t u8Bus, uint8_t u8Device,
180 uint8_t u8Fcn, uint16_t u16Reg,
Patrick Williams7169faa2023-05-10 07:51:24 -0500181 uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800182
Patrick Williams7169faa2023-05-10 07:51:24 -0500183 // Allows sequential RdPCIConfig with the provided peci file descriptor
184 EPECIStatus peci_RdPCIConfig_seq(uint8_t target, uint8_t u8Bus,
185 uint8_t u8Device, uint8_t u8Fcn,
186 uint16_t u16Reg, uint8_t* pPCIData,
187 int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700188
Patrick Williams7169faa2023-05-10 07:51:24 -0500189 // Allows sequential RdPCIConfig with the provided peci file descriptor in
190 // the specified domain
191 EPECIStatus peci_RdPCIConfig_seq_dom(uint8_t target, uint8_t domainId,
192 uint8_t u8Bus, uint8_t u8Device,
193 uint8_t u8Fcn, uint16_t u16Reg,
194 uint8_t* pPCIData, int peci_fd,
195 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800196
Patrick Williams7169faa2023-05-10 07:51:24 -0500197 // Provides read access to the local PCI Configuration space
198 EPECIStatus peci_RdPCIConfigLocal(uint8_t target, uint8_t u8Bus,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700199 uint8_t u8Device, uint8_t u8Fcn,
200 uint16_t u16Reg, uint8_t u8ReadLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500201 uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700202
Patrick Williams7169faa2023-05-10 07:51:24 -0500203 // Provides read access to the local PCI Configuration space in the
204 // specified domain
205 EPECIStatus peci_RdPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800206 uint8_t u8Bus, uint8_t u8Device,
207 uint8_t u8Fcn, uint16_t u16Reg,
208 uint8_t u8ReadLen, uint8_t* pPCIReg,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700209 uint8_t* cc);
210
Patrick Williams7169faa2023-05-10 07:51:24 -0500211 // Allows sequential RdPCIConfigLocal with the provided peci file descriptor
212 EPECIStatus peci_RdPCIConfigLocal_seq(uint8_t target, uint8_t u8Bus,
213 uint8_t u8Device, uint8_t u8Fcn,
214 uint16_t u16Reg, uint8_t u8ReadLen,
215 uint8_t* pPCIReg, int peci_fd,
216 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800217
Patrick Williams7169faa2023-05-10 07:51:24 -0500218 // Allows sequential RdPCIConfigLocal with the provided peci file descriptor
219 // in the specified domain
220 EPECIStatus peci_RdPCIConfigLocal_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700221 uint8_t u8Bus, uint8_t u8Device,
222 uint8_t u8Fcn, uint16_t u16Reg,
223 uint8_t u8ReadLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500224 uint8_t* pPCIReg, int peci_fd,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700225 uint8_t* cc);
226
Patrick Williams7169faa2023-05-10 07:51:24 -0500227 // Provides write access to the local PCI Configuration space
228 EPECIStatus peci_WrPCIConfigLocal(uint8_t target, uint8_t u8Bus,
229 uint8_t u8Device, uint8_t u8Fcn,
230 uint16_t u16Reg, uint8_t DataLen,
231 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800232
Patrick Williams7169faa2023-05-10 07:51:24 -0500233 // Provides write access to the local PCI Configuration space in the
234 // specified domain
235 EPECIStatus peci_WrPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700236 uint8_t u8Bus, uint8_t u8Device,
237 uint8_t u8Fcn, uint16_t u16Reg,
238 uint8_t DataLen, uint32_t DataVal,
239 uint8_t* cc);
240
Patrick Williams7169faa2023-05-10 07:51:24 -0500241 // Provides read access to PCI configuration space
242 EPECIStatus peci_RdEndPointConfigPci(uint8_t target, uint8_t u8Seg,
243 uint8_t u8Bus, uint8_t u8Device,
244 uint8_t u8Fcn, uint16_t u16Reg,
245 uint8_t u8ReadLen, uint8_t* pPCIData,
246 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800247
Patrick Williams7169faa2023-05-10 07:51:24 -0500248 // Provides read access to PCI configuration space in the specified domain
249 EPECIStatus peci_RdEndPointConfigPci_dom(uint8_t target, uint8_t domainId,
250 uint8_t u8Seg, uint8_t u8Bus,
251 uint8_t u8Device, uint8_t u8Fcn,
252 uint16_t u16Reg, uint8_t u8ReadLen,
253 uint8_t* pPCIData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700254
Patrick Williams7169faa2023-05-10 07:51:24 -0500255 // Allows sequential RdEndPointConfig to PCI Configuration space
256 EPECIStatus peci_RdEndPointConfigPci_seq(uint8_t target, uint8_t u8Seg,
257 uint8_t u8Bus, uint8_t u8Device,
258 uint8_t u8Fcn, uint16_t u16Reg,
259 uint8_t u8ReadLen,
260 uint8_t* pPCIData, int peci_fd,
261 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800262
Patrick Williams7169faa2023-05-10 07:51:24 -0500263 // Allows sequential RdEndPointConfig to PCI Configuration space in the
264 // specified domain
265 EPECIStatus peci_RdEndPointConfigPci_seq_dom(
266 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
267 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
268 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700269
Patrick Williams7169faa2023-05-10 07:51:24 -0500270 // Provides read access to the local PCI configuration space
271 EPECIStatus peci_RdEndPointConfigPciLocal(uint8_t target, uint8_t u8Seg,
272 uint8_t u8Bus, uint8_t u8Device,
273 uint8_t u8Fcn, uint16_t u16Reg,
274 uint8_t u8ReadLen,
275 uint8_t* pPCIData, uint8_t* cc);
276
277 // Provides read access to the local PCI configuration space in the
278 // specified domain
279 EPECIStatus peci_RdEndPointConfigPciLocal_dom(
280 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
281 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
282 uint8_t* pPCIData, uint8_t* cc);
283
284 // Allows sequential RdEndPointConfig to the local PCI Configuration space
285 EPECIStatus peci_RdEndPointConfigPciLocal_seq(
286 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
287 uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen, uint8_t* pPCIData,
288 int peci_fd, uint8_t* cc);
289
290 // Allows sequential RdEndPointConfig to the local PCI Configuration space
291 // in the specified domain
292 EPECIStatus peci_RdEndPointConfigPciLocal_seq_dom(
293 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
294 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
295 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
296
297 // Provides read access to PCI MMIO space
298 EPECIStatus peci_RdEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800299 uint8_t u8Bus, uint8_t u8Device,
Patrick Williams7169faa2023-05-10 07:51:24 -0500300 uint8_t u8Fcn, uint8_t u8Bar,
301 uint8_t u8AddrType,
302 uint64_t u64Offset, uint8_t u8ReadLen,
303 uint8_t* pMmioData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800304
Patrick Williams7169faa2023-05-10 07:51:24 -0500305 // Provides read access to PCI MMIO space in the specified domain
306 EPECIStatus peci_RdEndPointConfigMmio_dom(
307 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
308 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
309 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700310
Patrick Williams7169faa2023-05-10 07:51:24 -0500311 // Allows sequential RdEndPointConfig to PCI MMIO space
312 EPECIStatus peci_RdEndPointConfigMmio_seq(
313 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
314 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
315 uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd, uint8_t* cc);
316
317 // Allows sequential RdEndPointConfig to PCI MMIO space in the specified
318 // domain
319 EPECIStatus peci_RdEndPointConfigMmio_seq_dom(
320 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
321 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
322 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd,
323 uint8_t* cc);
324
325 // Provides write access to the EP local PCI Configuration space
326 EPECIStatus peci_WrEndPointPCIConfigLocal(uint8_t target, uint8_t u8Seg,
327 uint8_t u8Bus, uint8_t u8Device,
328 uint8_t u8Fcn, uint16_t u16Reg,
329 uint8_t DataLen, uint32_t DataVal,
330 uint8_t* cc);
331
332 // Provides write access to the EP local PCI Configuration space in the
333 // specified domain
334 EPECIStatus peci_WrEndPointPCIConfigLocal_dom(
335 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
336 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t DataLen,
337 uint32_t DataVal, uint8_t* cc);
338
339 // Provides write access to the EP PCI Configuration space
340 EPECIStatus peci_WrEndPointPCIConfig(uint8_t target, uint8_t u8Seg,
341 uint8_t u8Bus, uint8_t u8Device,
342 uint8_t u8Fcn, uint16_t u16Reg,
343 uint8_t DataLen, uint32_t DataVal,
344 uint8_t* cc);
345
346 // Provides write access to the EP PCI Configuration space in the specified
347 // domain
348 EPECIStatus peci_WrEndPointPCIConfig_dom(uint8_t target, uint8_t domainId,
349 uint8_t u8Seg, uint8_t u8Bus,
350 uint8_t u8Device, uint8_t u8Fcn,
351 uint16_t u16Reg, uint8_t DataLen,
352 uint32_t DataVal, uint8_t* cc);
353
354 // Allows sequential write access to the EP PCI Configuration space
355 EPECIStatus peci_WrEndPointConfig_seq(uint8_t target, uint8_t u8MsgType,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800356 uint8_t u8Seg, uint8_t u8Bus,
357 uint8_t u8Device, uint8_t u8Fcn,
Patrick Williams7169faa2023-05-10 07:51:24 -0500358 uint16_t u16Reg, uint8_t DataLen,
359 uint32_t DataVal, int peci_fd,
360 uint8_t* cc);
361
362 // Allows sequential write access to the EP PCI Configuration space in the
363 // specified domain
364 EPECIStatus peci_WrEndPointConfig_seq_dom(uint8_t target, uint8_t domainId,
365 uint8_t u8MsgType, uint8_t u8Seg,
366 uint8_t u8Bus, uint8_t u8Device,
367 uint8_t u8Fcn, uint16_t u16Reg,
368 uint8_t DataLen, uint32_t DataVal,
369 int peci_fd, uint8_t* cc);
370
371 // Provides write access to the EP PCI MMIO space
372 EPECIStatus peci_WrEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
373 uint8_t u8Bus, uint8_t u8Device,
374 uint8_t u8Fcn, uint8_t u8Bar,
375 uint8_t u8AddrType,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800376 uint64_t u64Offset, uint8_t u8DataLen,
377 uint64_t u64DataVal, uint8_t* cc);
378
Patrick Williams7169faa2023-05-10 07:51:24 -0500379 // Provides write access to the EP PCI MMIO space in the specified domain
380 EPECIStatus peci_WrEndPointConfigMmio_dom(uint8_t target, uint8_t domainId,
381 uint8_t u8Seg, uint8_t u8Bus,
382 uint8_t u8Device, uint8_t u8Fcn,
383 uint8_t u8Bar, uint8_t u8AddrType,
384 uint64_t u64Offset,
385 uint8_t u8DataLen,
386 uint64_t u64DataVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700387
Patrick Williams7169faa2023-05-10 07:51:24 -0500388 // Allows sequential write access to the EP PCI MMIO space
389 EPECIStatus peci_WrEndPointConfigMmio_seq(
390 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
391 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
392 uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800393
Patrick Williams7169faa2023-05-10 07:51:24 -0500394 // Allows sequential write access to the EP PCI MMIO space in the specified
395 // domain
396 EPECIStatus peci_WrEndPointConfigMmio_seq_dom(
397 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
398 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
399 uint64_t u64Offset, uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd,
400 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700401
Patrick Williams7169faa2023-05-10 07:51:24 -0500402 // Provides access to the Crashdump Discovery API
403 EPECIStatus peci_CrashDump_Discovery(uint8_t target, uint8_t subopcode,
404 uint8_t param0, uint16_t param1,
405 uint8_t param2, uint8_t u8ReadLen,
406 uint8_t* pData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800407
Patrick Williams7169faa2023-05-10 07:51:24 -0500408 // Provides access to the Crashdump Discovery API in the specified domain
409 EPECIStatus peci_CrashDump_Discovery_dom(uint8_t target, uint8_t domainId,
410 uint8_t subopcode, uint8_t param0,
411 uint16_t param1, uint8_t param2,
412 uint8_t u8ReadLen, uint8_t* pData,
413 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700414
Patrick Williams7169faa2023-05-10 07:51:24 -0500415 // Provides access to the Crashdump GetFrame API
416 EPECIStatus peci_CrashDump_GetFrame(uint8_t target, uint16_t param0,
417 uint16_t param1, uint16_t param2,
418 uint8_t u8ReadLen, uint8_t* pData,
419 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800420
Patrick Williams7169faa2023-05-10 07:51:24 -0500421 // Provides access to the Crashdump GetFrame API in the specified domain
422 EPECIStatus peci_CrashDump_GetFrame_dom(uint8_t target, uint8_t domainId,
423 uint16_t param0, uint16_t param1,
424 uint16_t param2, uint8_t u8ReadLen,
425 uint8_t* pData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700426
Patrick Williams7169faa2023-05-10 07:51:24 -0500427 // Provides raw PECI command access
428 EPECIStatus peci_raw(uint8_t target, uint8_t u8ReadLen,
429 const uint8_t* pRawCmd, const uint32_t cmdSize,
430 uint8_t* pRawResp, uint32_t respSize);
431
432 EPECIStatus peci_Lock(int* peci_fd, int timeout_ms);
433 void peci_Unlock(int peci_fd);
434 EPECIStatus peci_Ping(uint8_t target);
435 EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd);
436 EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel,
437 uint8_t* stepping, uint8_t* cc);
438 void peci_SetDevName(char* peci_dev);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700439
440#ifdef __cplusplus
441}
442#endif