blob: eef85332c02b6899721f4ec80cd967f68a29727e [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,
41 srf = 0x000A06F0,
42 } CPUModel;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070043
Patrick Williams7169faa2023-05-10 07:51:24 -050044 // PECI Status Codes
45 typedef enum
46 {
47 PECI_CC_SUCCESS = 0,
48 PECI_CC_INVALID_REQ,
49 PECI_CC_HW_ERR,
50 PECI_CC_DRIVER_ERR,
51 PECI_CC_CPU_NOT_PRESENT,
52 PECI_CC_MEM_ERR,
53 PECI_CC_TIMEOUT,
54 } EPECIStatus;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070055
Patrick Williams7169faa2023-05-10 07:51:24 -050056 // PECI Timeout Options
57 typedef enum
58 {
59 PECI_WAIT_FOREVER = -1,
60 PECI_NO_WAIT = 0,
61 } EPECITimeout;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070062
63#define PECI_TIMEOUT_RESOLUTION_MS 10 // 10 ms
64#define PECI_TIMEOUT_MS 100 // 100 ms
65
66// VCU Index and Sequence Paramaters
67#define VCU_SET_PARAM 0x0001
68#define VCU_READ 0x0002
69#define VCU_OPEN_SEQ 0x0003
70#define VCU_CLOSE_SEQ 0x0004
71#define VCU_ABORT_SEQ 0x0005
72#define VCU_VERSION 0x0009
73
Patrick Williams7169faa2023-05-10 07:51:24 -050074 typedef enum
75 {
76 VCU_READ_LOCAL_CSR_SEQ = 0x2,
77 VCU_READ_LOCAL_MMIO_SEQ = 0x6,
78 VCU_EN_SECURE_DATA_SEQ = 0x14,
79 VCU_CORE_MCA_SEQ = 0x10000,
80 VCU_UNCORE_MCA_SEQ = 0x10000,
81 VCU_IOT_BRKPT_SEQ = 0x10010,
82 VCU_MBP_CONFIG_SEQ = 0x10026,
83 VCU_PWR_MGT_SEQ = 0x1002a,
84 VCU_CRASHDUMP_SEQ = 0x10038,
85 VCU_ARRAY_DUMP_SEQ = 0x20000,
86 VCU_SCAN_DUMP_SEQ = 0x20008,
87 VCU_TOR_DUMP_SEQ = 0x30002,
88 VCU_SQ_DUMP_SEQ = 0x30004,
89 VCU_UNCORE_CRASHDUMP_SEQ = 0x30006,
90 } EPECISequence;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070091
92#define MBX_INDEX_VCU 128 // VCU Index
93
Patrick Williams7169faa2023-05-10 07:51:24 -050094 typedef enum
95 {
96 MMIO_DWORD_OFFSET = 0x05,
97 MMIO_QWORD_OFFSET = 0x06,
98 } EEndPtMmioAddrType;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070099
Patrick Williams7169faa2023-05-10 07:51:24 -0500100 // Find the specified PCI bus number value
101 EPECIStatus FindBusNumber(uint8_t u8Bus, uint8_t u8Cpu,
102 uint8_t* pu8BusValue);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700103
Patrick Williams7169faa2023-05-10 07:51:24 -0500104 // Gets the temperature from the target
105 // Expressed in signed fixed point value of 1/64 degrees celsius
106 EPECIStatus peci_GetTemp(uint8_t target, int16_t* temperature);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700107
Patrick Williams7169faa2023-05-10 07:51:24 -0500108 // Provides read access to the package configuration space within the
109 // processor
110 EPECIStatus peci_RdPkgConfig(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700111 uint16_t u16Value, uint8_t u8ReadLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500112 uint8_t* pPkgConfig, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700113
Patrick Williams7169faa2023-05-10 07:51:24 -0500114 // Provides read access to the package configuration space within the
115 // processor in the specified domain
116 EPECIStatus peci_RdPkgConfig_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800117 uint8_t u8Index, uint16_t u16Value,
118 uint8_t u8ReadLen, uint8_t* pPkgConfig,
Patrick Williams7169faa2023-05-10 07:51:24 -0500119 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800120
Patrick Williams7169faa2023-05-10 07:51:24 -0500121 // Allows sequential RdPkgConfig with the provided peci file descriptor
122 EPECIStatus peci_RdPkgConfig_seq(uint8_t target, uint8_t u8Index,
123 uint16_t u16Value, uint8_t u8ReadLen,
124 uint8_t* pPkgConfig, int peci_fd,
125 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700126
Patrick Williams7169faa2023-05-10 07:51:24 -0500127 // Allows sequential RdPkgConfig with the provided peci file descriptor in
128 // the specified domain
129 EPECIStatus peci_RdPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
130 uint8_t u8Index, uint16_t u16Value,
131 uint8_t u8ReadLen, uint8_t* pPkgConfig,
132 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800133
Patrick Williams7169faa2023-05-10 07:51:24 -0500134 // Provides write access to the package configuration space within the
135 // processor
136 EPECIStatus peci_WrPkgConfig(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700137 uint16_t u16Param, uint32_t u32Value,
Patrick Williams7169faa2023-05-10 07:51:24 -0500138 uint8_t u8WriteLen, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700139
Patrick Williams7169faa2023-05-10 07:51:24 -0500140 // Provides write access to the package configuration space within the
141 // processor in the specified domain
142 EPECIStatus peci_WrPkgConfig_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800143 uint8_t u8Index, uint16_t u16Param,
144 uint32_t u32Value, uint8_t u8WriteLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500145 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800146
Patrick Williams7169faa2023-05-10 07:51:24 -0500147 // Allows sequential WrPkgConfig with the provided peci file descriptor
148 EPECIStatus peci_WrPkgConfig_seq(uint8_t target, uint8_t u8Index,
149 uint16_t u16Param, uint32_t u32Value,
150 uint8_t u8WriteLen, int peci_fd,
151 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700152
Patrick Williams7169faa2023-05-10 07:51:24 -0500153 // Allows sequential WrPkgConfig with the provided peci file descriptor in
154 // the specified domain
155 EPECIStatus peci_WrPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
156 uint8_t u8Index, uint16_t u16Param,
157 uint32_t u32Value, uint8_t u8WriteLen,
158 int peci_fd, uint8_t* cc);
159
160 // Provides read access to Model Specific Registers
161 EPECIStatus peci_RdIAMSR(uint8_t target, uint8_t threadID,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800162 uint16_t MSRAddress, uint64_t* u64MsrVal,
163 uint8_t* cc);
164
Patrick Williams7169faa2023-05-10 07:51:24 -0500165 // Provides read access to Model Specific Registers in the specified domain
166 EPECIStatus peci_RdIAMSR_dom(uint8_t target, uint8_t domainId,
167 uint8_t threadID, uint16_t MSRAddress,
168 uint64_t* u64MsrVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700169
Patrick Williams7169faa2023-05-10 07:51:24 -0500170 // Provides read access to PCI Configuration space
171 EPECIStatus peci_RdPCIConfig(uint8_t target, uint8_t u8Bus,
172 uint8_t u8Device, uint8_t u8Fcn,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800173 uint16_t u16Reg, uint8_t* pPCIReg,
174 uint8_t* cc);
175
Patrick Williams7169faa2023-05-10 07:51:24 -0500176 // Provides read access to PCI Configuration space in the specified domain
177 EPECIStatus peci_RdPCIConfig_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800178 uint8_t u8Bus, uint8_t u8Device,
179 uint8_t u8Fcn, uint16_t u16Reg,
Patrick Williams7169faa2023-05-10 07:51:24 -0500180 uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800181
Patrick Williams7169faa2023-05-10 07:51:24 -0500182 // Allows sequential RdPCIConfig with the provided peci file descriptor
183 EPECIStatus peci_RdPCIConfig_seq(uint8_t target, uint8_t u8Bus,
184 uint8_t u8Device, uint8_t u8Fcn,
185 uint16_t u16Reg, uint8_t* pPCIData,
186 int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700187
Patrick Williams7169faa2023-05-10 07:51:24 -0500188 // Allows sequential RdPCIConfig with the provided peci file descriptor in
189 // the specified domain
190 EPECIStatus peci_RdPCIConfig_seq_dom(uint8_t target, uint8_t domainId,
191 uint8_t u8Bus, uint8_t u8Device,
192 uint8_t u8Fcn, uint16_t u16Reg,
193 uint8_t* pPCIData, int peci_fd,
194 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800195
Patrick Williams7169faa2023-05-10 07:51:24 -0500196 // Provides read access to the local PCI Configuration space
197 EPECIStatus peci_RdPCIConfigLocal(uint8_t target, uint8_t u8Bus,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700198 uint8_t u8Device, uint8_t u8Fcn,
199 uint16_t u16Reg, uint8_t u8ReadLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500200 uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700201
Patrick Williams7169faa2023-05-10 07:51:24 -0500202 // Provides read access to the local PCI Configuration space in the
203 // specified domain
204 EPECIStatus peci_RdPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800205 uint8_t u8Bus, uint8_t u8Device,
206 uint8_t u8Fcn, uint16_t u16Reg,
207 uint8_t u8ReadLen, uint8_t* pPCIReg,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700208 uint8_t* cc);
209
Patrick Williams7169faa2023-05-10 07:51:24 -0500210 // Allows sequential RdPCIConfigLocal with the provided peci file descriptor
211 EPECIStatus peci_RdPCIConfigLocal_seq(uint8_t target, uint8_t u8Bus,
212 uint8_t u8Device, uint8_t u8Fcn,
213 uint16_t u16Reg, uint8_t u8ReadLen,
214 uint8_t* pPCIReg, int peci_fd,
215 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800216
Patrick Williams7169faa2023-05-10 07:51:24 -0500217 // Allows sequential RdPCIConfigLocal with the provided peci file descriptor
218 // in the specified domain
219 EPECIStatus peci_RdPCIConfigLocal_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700220 uint8_t u8Bus, uint8_t u8Device,
221 uint8_t u8Fcn, uint16_t u16Reg,
222 uint8_t u8ReadLen,
Patrick Williams7169faa2023-05-10 07:51:24 -0500223 uint8_t* pPCIReg, int peci_fd,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700224 uint8_t* cc);
225
Patrick Williams7169faa2023-05-10 07:51:24 -0500226 // Provides write access to the local PCI Configuration space
227 EPECIStatus peci_WrPCIConfigLocal(uint8_t target, uint8_t u8Bus,
228 uint8_t u8Device, uint8_t u8Fcn,
229 uint16_t u16Reg, uint8_t DataLen,
230 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800231
Patrick Williams7169faa2023-05-10 07:51:24 -0500232 // Provides write access to the local PCI Configuration space in the
233 // specified domain
234 EPECIStatus peci_WrPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700235 uint8_t u8Bus, uint8_t u8Device,
236 uint8_t u8Fcn, uint16_t u16Reg,
237 uint8_t DataLen, uint32_t DataVal,
238 uint8_t* cc);
239
Patrick Williams7169faa2023-05-10 07:51:24 -0500240 // Provides read access to PCI configuration space
241 EPECIStatus peci_RdEndPointConfigPci(uint8_t target, uint8_t u8Seg,
242 uint8_t u8Bus, uint8_t u8Device,
243 uint8_t u8Fcn, uint16_t u16Reg,
244 uint8_t u8ReadLen, uint8_t* pPCIData,
245 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800246
Patrick Williams7169faa2023-05-10 07:51:24 -0500247 // Provides read access to PCI configuration space in the specified domain
248 EPECIStatus peci_RdEndPointConfigPci_dom(uint8_t target, uint8_t domainId,
249 uint8_t u8Seg, uint8_t u8Bus,
250 uint8_t u8Device, uint8_t u8Fcn,
251 uint16_t u16Reg, uint8_t u8ReadLen,
252 uint8_t* pPCIData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700253
Patrick Williams7169faa2023-05-10 07:51:24 -0500254 // Allows sequential RdEndPointConfig to PCI Configuration space
255 EPECIStatus peci_RdEndPointConfigPci_seq(uint8_t target, uint8_t u8Seg,
256 uint8_t u8Bus, uint8_t u8Device,
257 uint8_t u8Fcn, uint16_t u16Reg,
258 uint8_t u8ReadLen,
259 uint8_t* pPCIData, int peci_fd,
260 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800261
Patrick Williams7169faa2023-05-10 07:51:24 -0500262 // Allows sequential RdEndPointConfig to PCI Configuration space in the
263 // specified domain
264 EPECIStatus peci_RdEndPointConfigPci_seq_dom(
265 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
266 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
267 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700268
Patrick Williams7169faa2023-05-10 07:51:24 -0500269 // Provides read access to the local PCI configuration space
270 EPECIStatus peci_RdEndPointConfigPciLocal(uint8_t target, uint8_t u8Seg,
271 uint8_t u8Bus, uint8_t u8Device,
272 uint8_t u8Fcn, uint16_t u16Reg,
273 uint8_t u8ReadLen,
274 uint8_t* pPCIData, uint8_t* cc);
275
276 // Provides read access to the local PCI configuration space in the
277 // specified domain
278 EPECIStatus peci_RdEndPointConfigPciLocal_dom(
279 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
280 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
281 uint8_t* pPCIData, uint8_t* cc);
282
283 // Allows sequential RdEndPointConfig to the local PCI Configuration space
284 EPECIStatus peci_RdEndPointConfigPciLocal_seq(
285 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
286 uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen, uint8_t* pPCIData,
287 int peci_fd, uint8_t* cc);
288
289 // Allows sequential RdEndPointConfig to the local PCI Configuration space
290 // in the specified domain
291 EPECIStatus peci_RdEndPointConfigPciLocal_seq_dom(
292 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
293 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
294 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
295
296 // Provides read access to PCI MMIO space
297 EPECIStatus peci_RdEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800298 uint8_t u8Bus, uint8_t u8Device,
Patrick Williams7169faa2023-05-10 07:51:24 -0500299 uint8_t u8Fcn, uint8_t u8Bar,
300 uint8_t u8AddrType,
301 uint64_t u64Offset, uint8_t u8ReadLen,
302 uint8_t* pMmioData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800303
Patrick Williams7169faa2023-05-10 07:51:24 -0500304 // Provides read access to PCI MMIO space in the specified domain
305 EPECIStatus peci_RdEndPointConfigMmio_dom(
306 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
307 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
308 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700309
Patrick Williams7169faa2023-05-10 07:51:24 -0500310 // Allows sequential RdEndPointConfig to PCI MMIO space
311 EPECIStatus peci_RdEndPointConfigMmio_seq(
312 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
313 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
314 uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd, uint8_t* cc);
315
316 // Allows sequential RdEndPointConfig to PCI MMIO space in the specified
317 // domain
318 EPECIStatus peci_RdEndPointConfigMmio_seq_dom(
319 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
320 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
321 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd,
322 uint8_t* cc);
323
324 // Provides write access to the EP local PCI Configuration space
325 EPECIStatus peci_WrEndPointPCIConfigLocal(uint8_t target, uint8_t u8Seg,
326 uint8_t u8Bus, uint8_t u8Device,
327 uint8_t u8Fcn, uint16_t u16Reg,
328 uint8_t DataLen, uint32_t DataVal,
329 uint8_t* cc);
330
331 // Provides write access to the EP local PCI Configuration space in the
332 // specified domain
333 EPECIStatus peci_WrEndPointPCIConfigLocal_dom(
334 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
335 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t DataLen,
336 uint32_t DataVal, uint8_t* cc);
337
338 // Provides write access to the EP PCI Configuration space
339 EPECIStatus peci_WrEndPointPCIConfig(uint8_t target, uint8_t u8Seg,
340 uint8_t u8Bus, uint8_t u8Device,
341 uint8_t u8Fcn, uint16_t u16Reg,
342 uint8_t DataLen, uint32_t DataVal,
343 uint8_t* cc);
344
345 // Provides write access to the EP PCI Configuration space in the specified
346 // domain
347 EPECIStatus peci_WrEndPointPCIConfig_dom(uint8_t target, uint8_t domainId,
348 uint8_t u8Seg, uint8_t u8Bus,
349 uint8_t u8Device, uint8_t u8Fcn,
350 uint16_t u16Reg, uint8_t DataLen,
351 uint32_t DataVal, uint8_t* cc);
352
353 // Allows sequential write access to the EP PCI Configuration space
354 EPECIStatus peci_WrEndPointConfig_seq(uint8_t target, uint8_t u8MsgType,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800355 uint8_t u8Seg, uint8_t u8Bus,
356 uint8_t u8Device, uint8_t u8Fcn,
Patrick Williams7169faa2023-05-10 07:51:24 -0500357 uint16_t u16Reg, uint8_t DataLen,
358 uint32_t DataVal, int peci_fd,
359 uint8_t* cc);
360
361 // Allows sequential write access to the EP PCI Configuration space in the
362 // specified domain
363 EPECIStatus peci_WrEndPointConfig_seq_dom(uint8_t target, uint8_t domainId,
364 uint8_t u8MsgType, uint8_t u8Seg,
365 uint8_t u8Bus, uint8_t u8Device,
366 uint8_t u8Fcn, uint16_t u16Reg,
367 uint8_t DataLen, uint32_t DataVal,
368 int peci_fd, uint8_t* cc);
369
370 // Provides write access to the EP PCI MMIO space
371 EPECIStatus peci_WrEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
372 uint8_t u8Bus, uint8_t u8Device,
373 uint8_t u8Fcn, uint8_t u8Bar,
374 uint8_t u8AddrType,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800375 uint64_t u64Offset, uint8_t u8DataLen,
376 uint64_t u64DataVal, uint8_t* cc);
377
Patrick Williams7169faa2023-05-10 07:51:24 -0500378 // Provides write access to the EP PCI MMIO space in the specified domain
379 EPECIStatus peci_WrEndPointConfigMmio_dom(uint8_t target, uint8_t domainId,
380 uint8_t u8Seg, uint8_t u8Bus,
381 uint8_t u8Device, uint8_t u8Fcn,
382 uint8_t u8Bar, uint8_t u8AddrType,
383 uint64_t u64Offset,
384 uint8_t u8DataLen,
385 uint64_t u64DataVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700386
Patrick Williams7169faa2023-05-10 07:51:24 -0500387 // Allows sequential write access to the EP PCI MMIO space
388 EPECIStatus peci_WrEndPointConfigMmio_seq(
389 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
390 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
391 uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800392
Patrick Williams7169faa2023-05-10 07:51:24 -0500393 // Allows sequential write access to the EP PCI MMIO space in the specified
394 // domain
395 EPECIStatus peci_WrEndPointConfigMmio_seq_dom(
396 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
397 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
398 uint64_t u64Offset, uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd,
399 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700400
Patrick Williams7169faa2023-05-10 07:51:24 -0500401 // Provides access to the Crashdump Discovery API
402 EPECIStatus peci_CrashDump_Discovery(uint8_t target, uint8_t subopcode,
403 uint8_t param0, uint16_t param1,
404 uint8_t param2, uint8_t u8ReadLen,
405 uint8_t* pData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800406
Patrick Williams7169faa2023-05-10 07:51:24 -0500407 // Provides access to the Crashdump Discovery API in the specified domain
408 EPECIStatus peci_CrashDump_Discovery_dom(uint8_t target, uint8_t domainId,
409 uint8_t subopcode, uint8_t param0,
410 uint16_t param1, uint8_t param2,
411 uint8_t u8ReadLen, uint8_t* pData,
412 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700413
Patrick Williams7169faa2023-05-10 07:51:24 -0500414 // Provides access to the Crashdump GetFrame API
415 EPECIStatus peci_CrashDump_GetFrame(uint8_t target, uint16_t param0,
416 uint16_t param1, uint16_t param2,
417 uint8_t u8ReadLen, uint8_t* pData,
418 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800419
Patrick Williams7169faa2023-05-10 07:51:24 -0500420 // Provides access to the Crashdump GetFrame API in the specified domain
421 EPECIStatus peci_CrashDump_GetFrame_dom(uint8_t target, uint8_t domainId,
422 uint16_t param0, uint16_t param1,
423 uint16_t param2, uint8_t u8ReadLen,
424 uint8_t* pData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700425
Patrick Williams7169faa2023-05-10 07:51:24 -0500426 // Provides raw PECI command access
427 EPECIStatus peci_raw(uint8_t target, uint8_t u8ReadLen,
428 const uint8_t* pRawCmd, const uint32_t cmdSize,
429 uint8_t* pRawResp, uint32_t respSize);
430
431 EPECIStatus peci_Lock(int* peci_fd, int timeout_ms);
432 void peci_Unlock(int peci_fd);
433 EPECIStatus peci_Ping(uint8_t target);
434 EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd);
435 EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel,
436 uint8_t* stepping, uint8_t* cc);
437 void peci_SetDevName(char* peci_dev);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700438
439#ifdef __cplusplus
440}
441#endif