blob: c2e02004202a9e4c9cce603ee64bba6b582094a7 [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 Williams0621dc02023-10-20 11:19:59 -050033typedef enum
34{
35 skx = 0x00050650,
36 icx = 0x000606A0,
37 icxd = 0x000606C0,
38 spr = 0x000806F0,
39 emr = 0x000C06F0,
40 gnr = 0x000A06D0,
41 gnrd = 0x000A06E0,
42 srf = 0x000A06F0,
43} CPUModel;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070044
Patrick Williams0621dc02023-10-20 11:19:59 -050045// PECI Status Codes
46typedef 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 Williams0621dc02023-10-20 11:19:59 -050057// PECI Timeout Options
58typedef 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 Williams0621dc02023-10-20 11:19:59 -050075typedef 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 Williams0621dc02023-10-20 11:19:59 -050095typedef enum
96{
97 MMIO_DWORD_OFFSET = 0x05,
98 MMIO_QWORD_OFFSET = 0x06,
99} EEndPtMmioAddrType;
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700100
Patrick Williams0621dc02023-10-20 11:19:59 -0500101// Find the specified PCI bus number value
102EPECIStatus FindBusNumber(uint8_t u8Bus, uint8_t u8Cpu, uint8_t* pu8BusValue);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700103
Patrick Williams0621dc02023-10-20 11:19:59 -0500104// Gets the temperature from the target
105// Expressed in signed fixed point value of 1/64 degrees celsius
106EPECIStatus peci_GetTemp(uint8_t target, int16_t* temperature);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700107
Patrick Williams0621dc02023-10-20 11:19:59 -0500108// Provides read access to the package configuration space within the
109// processor
110EPECIStatus peci_RdPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Value,
111 uint8_t u8ReadLen, uint8_t* pPkgConfig,
112 uint8_t* cc);
113
114// Provides read access to the package configuration space within the
115// processor in the specified domain
116EPECIStatus peci_RdPkgConfig_dom(uint8_t target, uint8_t domainId,
117 uint8_t u8Index, uint16_t u16Value,
118 uint8_t u8ReadLen, uint8_t* pPkgConfig,
119 uint8_t* cc);
120
121// Allows sequential RdPkgConfig with the provided peci file descriptor
122EPECIStatus peci_RdPkgConfig_seq(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700123 uint16_t u16Value, uint8_t u8ReadLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500124 uint8_t* pPkgConfig, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700125
Patrick Williams0621dc02023-10-20 11:19:59 -0500126// Allows sequential RdPkgConfig with the provided peci file descriptor in
127// the specified domain
128EPECIStatus peci_RdPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800129 uint8_t u8Index, uint16_t u16Value,
130 uint8_t u8ReadLen, uint8_t* pPkgConfig,
Patrick Williams0621dc02023-10-20 11:19:59 -0500131 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800132
Patrick Williams0621dc02023-10-20 11:19:59 -0500133// Provides write access to the package configuration space within the
134// processor
135EPECIStatus peci_WrPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Param,
136 uint32_t u32Value, uint8_t u8WriteLen,
137 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700138
Patrick Williams0621dc02023-10-20 11:19:59 -0500139// Provides write access to the package configuration space within the
140// processor in the specified domain
141EPECIStatus peci_WrPkgConfig_dom(uint8_t target, uint8_t domainId,
142 uint8_t u8Index, uint16_t u16Param,
143 uint32_t u32Value, uint8_t u8WriteLen,
144 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800145
Patrick Williams0621dc02023-10-20 11:19:59 -0500146// Allows sequential WrPkgConfig with the provided peci file descriptor
147EPECIStatus peci_WrPkgConfig_seq(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700148 uint16_t u16Param, uint32_t u32Value,
Patrick Williams0621dc02023-10-20 11:19:59 -0500149 uint8_t u8WriteLen, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700150
Patrick Williams0621dc02023-10-20 11:19:59 -0500151// Allows sequential WrPkgConfig with the provided peci file descriptor in
152// the specified domain
153EPECIStatus peci_WrPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800154 uint8_t u8Index, uint16_t u16Param,
155 uint32_t u32Value, uint8_t u8WriteLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500156 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800157
Patrick Williams0621dc02023-10-20 11:19:59 -0500158// Provides read access to Model Specific Registers
159EPECIStatus peci_RdIAMSR(uint8_t target, uint8_t threadID, uint16_t MSRAddress,
160 uint64_t* u64MsrVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700161
Patrick Williams0621dc02023-10-20 11:19:59 -0500162// Provides read access to Model Specific Registers in the specified domain
163EPECIStatus peci_RdIAMSR_dom(uint8_t target, uint8_t domainId, uint8_t threadID,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800164 uint16_t MSRAddress, uint64_t* u64MsrVal,
165 uint8_t* cc);
166
Patrick Williams0621dc02023-10-20 11:19:59 -0500167// Provides read access to PCI Configuration space
168EPECIStatus peci_RdPCIConfig(uint8_t target, uint8_t u8Bus, uint8_t u8Device,
169 uint8_t u8Fcn, uint16_t u16Reg, uint8_t* pPCIReg,
170 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700171
Patrick Williams0621dc02023-10-20 11:19:59 -0500172// Provides read access to PCI Configuration space in the specified domain
173EPECIStatus peci_RdPCIConfig_dom(uint8_t target, uint8_t domainId,
174 uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800175 uint16_t u16Reg, uint8_t* pPCIReg,
176 uint8_t* cc);
177
Patrick Williams0621dc02023-10-20 11:19:59 -0500178// Allows sequential RdPCIConfig with the provided peci file descriptor
179EPECIStatus peci_RdPCIConfig_seq(uint8_t target, uint8_t u8Bus,
180 uint8_t u8Device, uint8_t u8Fcn,
181 uint16_t u16Reg, uint8_t* pPCIData,
182 int peci_fd, uint8_t* cc);
183
184// Allows sequential RdPCIConfig with the provided peci file descriptor in
185// the specified domain
186EPECIStatus peci_RdPCIConfig_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800187 uint8_t u8Bus, uint8_t u8Device,
188 uint8_t u8Fcn, uint16_t u16Reg,
Patrick Williams0621dc02023-10-20 11:19:59 -0500189 uint8_t* pPCIData, int peci_fd,
190 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800191
Patrick Williams0621dc02023-10-20 11:19:59 -0500192// Provides read access to the local PCI Configuration space
193EPECIStatus peci_RdPCIConfigLocal(uint8_t target, uint8_t u8Bus,
194 uint8_t u8Device, uint8_t u8Fcn,
195 uint16_t u16Reg, uint8_t u8ReadLen,
196 uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700197
Patrick Williams0621dc02023-10-20 11:19:59 -0500198// Provides read access to the local PCI Configuration space in the
199// specified domain
200EPECIStatus peci_RdPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
201 uint8_t u8Bus, uint8_t u8Device,
202 uint8_t u8Fcn, uint16_t u16Reg,
203 uint8_t u8ReadLen, uint8_t* pPCIReg,
204 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800205
Patrick Williams0621dc02023-10-20 11:19:59 -0500206// Allows sequential RdPCIConfigLocal with the provided peci file descriptor
207EPECIStatus peci_RdPCIConfigLocal_seq(uint8_t target, uint8_t u8Bus,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700208 uint8_t u8Device, uint8_t u8Fcn,
209 uint16_t u16Reg, uint8_t u8ReadLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500210 uint8_t* pPCIReg, int peci_fd,
211 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700212
Patrick Williams0621dc02023-10-20 11:19:59 -0500213// Allows sequential RdPCIConfigLocal with the provided peci file descriptor
214// in the specified domain
215EPECIStatus peci_RdPCIConfigLocal_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800216 uint8_t u8Bus, uint8_t u8Device,
217 uint8_t u8Fcn, uint16_t u16Reg,
218 uint8_t u8ReadLen, uint8_t* pPCIReg,
Patrick Williams0621dc02023-10-20 11:19:59 -0500219 int peci_fd, uint8_t* cc);
220
221// Provides write access to the local PCI Configuration space
222EPECIStatus peci_WrPCIConfigLocal(uint8_t target, uint8_t u8Bus,
223 uint8_t u8Device, uint8_t u8Fcn,
224 uint16_t u16Reg, uint8_t DataLen,
225 uint32_t DataVal, uint8_t* cc);
226
227// Provides write access to the local PCI Configuration space in the
228// specified domain
229EPECIStatus peci_WrPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
230 uint8_t u8Bus, uint8_t u8Device,
231 uint8_t u8Fcn, uint16_t u16Reg,
232 uint8_t DataLen, uint32_t DataVal,
233 uint8_t* cc);
234
235// Provides read access to PCI configuration space
236EPECIStatus peci_RdEndPointConfigPci(uint8_t target, uint8_t u8Seg,
237 uint8_t u8Bus, uint8_t u8Device,
238 uint8_t u8Fcn, uint16_t u16Reg,
239 uint8_t u8ReadLen, uint8_t* pPCIData,
240 uint8_t* cc);
241
242// Provides read access to PCI configuration space in the specified domain
243EPECIStatus peci_RdEndPointConfigPci_dom(uint8_t target, uint8_t domainId,
244 uint8_t u8Seg, uint8_t u8Bus,
245 uint8_t u8Device, uint8_t u8Fcn,
246 uint16_t u16Reg, uint8_t u8ReadLen,
247 uint8_t* pPCIData, uint8_t* cc);
248
249// Allows sequential RdEndPointConfig to PCI Configuration space
250EPECIStatus peci_RdEndPointConfigPci_seq(uint8_t target, uint8_t u8Seg,
251 uint8_t u8Bus, uint8_t u8Device,
252 uint8_t u8Fcn, uint16_t u16Reg,
253 uint8_t u8ReadLen, uint8_t* pPCIData,
254 int peci_fd, uint8_t* cc);
255
256// Allows sequential RdEndPointConfig to PCI Configuration space in the
257// specified domain
258EPECIStatus peci_RdEndPointConfigPci_seq_dom(uint8_t target, uint8_t domainId,
259 uint8_t u8Seg, uint8_t u8Bus,
260 uint8_t u8Device, uint8_t u8Fcn,
261 uint16_t u16Reg, uint8_t u8ReadLen,
262 uint8_t* pPCIData, int peci_fd,
263 uint8_t* cc);
264
265// Provides read access to the local PCI configuration space
266EPECIStatus peci_RdEndPointConfigPciLocal(uint8_t target, uint8_t u8Seg,
267 uint8_t u8Bus, uint8_t u8Device,
268 uint8_t u8Fcn, uint16_t u16Reg,
269 uint8_t u8ReadLen, uint8_t* pPCIData,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700270 uint8_t* cc);
271
Patrick Williams0621dc02023-10-20 11:19:59 -0500272// Provides read access to the local PCI configuration space in the
273// specified domain
274EPECIStatus peci_RdEndPointConfigPciLocal_dom(uint8_t target, uint8_t domainId,
275 uint8_t u8Seg, uint8_t u8Bus,
276 uint8_t u8Device, uint8_t u8Fcn,
277 uint16_t u16Reg,
278 uint8_t u8ReadLen,
279 uint8_t* pPCIData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800280
Patrick Williams0621dc02023-10-20 11:19:59 -0500281// Allows sequential RdEndPointConfig to the local PCI Configuration space
282EPECIStatus peci_RdEndPointConfigPciLocal_seq(uint8_t target, uint8_t u8Seg,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700283 uint8_t u8Bus, uint8_t u8Device,
284 uint8_t u8Fcn, uint16_t u16Reg,
285 uint8_t u8ReadLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500286 uint8_t* pPCIData, int peci_fd,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700287 uint8_t* cc);
288
Patrick Williams0621dc02023-10-20 11:19:59 -0500289// Allows sequential RdEndPointConfig to the local PCI Configuration space
290// in the specified domain
291EPECIStatus 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);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800295
Patrick Williams0621dc02023-10-20 11:19:59 -0500296// Provides read access to PCI MMIO space
297EPECIStatus peci_RdEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
298 uint8_t u8Bus, uint8_t u8Device,
299 uint8_t u8Fcn, uint8_t u8Bar,
300 uint8_t u8AddrType, uint64_t u64Offset,
301 uint8_t u8ReadLen, uint8_t* pMmioData,
302 uint8_t* cc);
303
304// Provides read access to PCI MMIO space in the specified domain
305EPECIStatus peci_RdEndPointConfigMmio_dom(uint8_t target, uint8_t domainId,
306 uint8_t u8Seg, uint8_t u8Bus,
307 uint8_t u8Device, uint8_t u8Fcn,
308 uint8_t u8Bar, uint8_t u8AddrType,
309 uint64_t u64Offset, uint8_t u8ReadLen,
310 uint8_t* pMmioData, uint8_t* cc);
311
312// Allows sequential RdEndPointConfig to PCI MMIO space
313EPECIStatus peci_RdEndPointConfigMmio_seq(
314 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
315 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
316 uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd, uint8_t* cc);
317
318// Allows sequential RdEndPointConfig to PCI MMIO space in the specified
319// domain
320EPECIStatus peci_RdEndPointConfigMmio_seq_dom(
321 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
322 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
323 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd,
324 uint8_t* cc);
325
326// Provides write access to the EP local PCI Configuration space
327EPECIStatus peci_WrEndPointPCIConfigLocal(uint8_t target, uint8_t u8Seg,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700328 uint8_t u8Bus, uint8_t u8Device,
329 uint8_t u8Fcn, uint16_t u16Reg,
330 uint8_t DataLen, uint32_t DataVal,
331 uint8_t* cc);
332
Patrick Williams0621dc02023-10-20 11:19:59 -0500333// Provides write access to the EP local PCI Configuration space in the
334// specified domain
335EPECIStatus peci_WrEndPointPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
336 uint8_t u8Seg, uint8_t u8Bus,
337 uint8_t u8Device, uint8_t u8Fcn,
338 uint16_t u16Reg, uint8_t DataLen,
339 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800340
Patrick Williams0621dc02023-10-20 11:19:59 -0500341// Provides write access to the EP PCI Configuration space
342EPECIStatus peci_WrEndPointPCIConfig(uint8_t target, uint8_t u8Seg,
343 uint8_t u8Bus, uint8_t u8Device,
344 uint8_t u8Fcn, uint16_t u16Reg,
345 uint8_t DataLen, uint32_t DataVal,
346 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700347
Patrick Williams0621dc02023-10-20 11:19:59 -0500348// Provides write access to the EP PCI Configuration space in the specified
349// domain
350EPECIStatus peci_WrEndPointPCIConfig_dom(uint8_t target, uint8_t domainId,
351 uint8_t u8Seg, uint8_t u8Bus,
352 uint8_t u8Device, uint8_t u8Fcn,
353 uint16_t u16Reg, uint8_t DataLen,
354 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800355
Patrick Williams0621dc02023-10-20 11:19:59 -0500356// Allows sequential write access to the EP PCI Configuration space
357EPECIStatus peci_WrEndPointConfig_seq(uint8_t target, uint8_t u8MsgType,
358 uint8_t u8Seg, uint8_t u8Bus,
359 uint8_t u8Device, uint8_t u8Fcn,
360 uint16_t u16Reg, uint8_t DataLen,
361 uint32_t DataVal, int peci_fd,
362 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700363
Patrick Williams0621dc02023-10-20 11:19:59 -0500364// Allows sequential write access to the EP PCI Configuration space in the
365// specified domain
366EPECIStatus peci_WrEndPointConfig_seq_dom(uint8_t target, uint8_t domainId,
367 uint8_t u8MsgType, uint8_t u8Seg,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800368 uint8_t u8Bus, uint8_t u8Device,
Patrick Williams0621dc02023-10-20 11:19:59 -0500369 uint8_t u8Fcn, uint16_t u16Reg,
370 uint8_t DataLen, uint32_t DataVal,
371 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800372
Patrick Williams0621dc02023-10-20 11:19:59 -0500373// Provides write access to the EP PCI MMIO space
374EPECIStatus peci_WrEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
375 uint8_t u8Bus, uint8_t u8Device,
376 uint8_t u8Fcn, uint8_t u8Bar,
377 uint8_t u8AddrType, uint64_t u64Offset,
378 uint8_t u8DataLen, uint64_t u64DataVal,
379 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700380
Patrick Williams0621dc02023-10-20 11:19:59 -0500381// Provides write access to the EP PCI MMIO space in the specified domain
382EPECIStatus peci_WrEndPointConfigMmio_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800383 uint8_t u8Seg, uint8_t u8Bus,
384 uint8_t u8Device, uint8_t u8Fcn,
Patrick Williams0621dc02023-10-20 11:19:59 -0500385 uint8_t u8Bar, uint8_t u8AddrType,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800386 uint64_t u64Offset, uint8_t u8DataLen,
387 uint64_t u64DataVal, uint8_t* cc);
388
Patrick Williams0621dc02023-10-20 11:19:59 -0500389// Allows sequential write access to the EP PCI MMIO space
390EPECIStatus peci_WrEndPointConfigMmio_seq(
391 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
392 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
393 uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700394
Patrick Williams0621dc02023-10-20 11:19:59 -0500395// Allows sequential write access to the EP PCI MMIO space in the specified
396// domain
397EPECIStatus peci_WrEndPointConfigMmio_seq_dom(
398 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
399 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
400 uint64_t u64Offset, uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd,
401 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800402
Patrick Williams0621dc02023-10-20 11:19:59 -0500403// Provides access to the Crashdump Discovery API
404EPECIStatus peci_CrashDump_Discovery(uint8_t target, uint8_t subopcode,
405 uint8_t param0, uint16_t param1,
406 uint8_t param2, uint8_t u8ReadLen,
407 uint8_t* pData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700408
Patrick Williams0621dc02023-10-20 11:19:59 -0500409// Provides access to the Crashdump Discovery API in the specified domain
410EPECIStatus peci_CrashDump_Discovery_dom(uint8_t target, uint8_t domainId,
411 uint8_t subopcode, uint8_t param0,
412 uint16_t param1, uint8_t param2,
413 uint8_t u8ReadLen, uint8_t* pData,
414 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800415
Patrick Williams0621dc02023-10-20 11:19:59 -0500416// Provides access to the Crashdump GetFrame API
417EPECIStatus peci_CrashDump_GetFrame(uint8_t target, uint16_t param0,
418 uint16_t param1, uint16_t param2,
419 uint8_t u8ReadLen, uint8_t* pData,
420 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700421
Patrick Williams0621dc02023-10-20 11:19:59 -0500422// Provides access to the Crashdump GetFrame API in the specified domain
423EPECIStatus peci_CrashDump_GetFrame_dom(uint8_t target, uint8_t domainId,
424 uint16_t param0, uint16_t param1,
425 uint16_t param2, uint8_t u8ReadLen,
426 uint8_t* pData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800427
Patrick Williams0621dc02023-10-20 11:19:59 -0500428// Provides raw PECI command access
429EPECIStatus peci_raw(uint8_t target, uint8_t u8ReadLen, const uint8_t* pRawCmd,
430 const uint32_t cmdSize, uint8_t* pRawResp,
431 uint32_t respSize);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700432
Patrick Williams0621dc02023-10-20 11:19:59 -0500433EPECIStatus peci_Lock(int* peci_fd, int timeout_ms);
434void peci_Unlock(int peci_fd);
435EPECIStatus peci_Ping(uint8_t target);
436EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd);
437EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel,
438 uint8_t* stepping, uint8_t* cc);
439void peci_SetDevName(char* peci_dev);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700440
441#ifdef __cplusplus
442}
443#endif