blob: 308305518bcc71744c4bbc4db9411ca65fae70d4 [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{
Jason M. Bills127609c2024-04-01 12:57:08 -070035 skylake = 0x00050650,
Patrick Williams0621dc02023-10-20 11:19:59 -050036 skx = 0x00050650,
Jason M. Bills127609c2024-04-01 12:57:08 -070037 iceLake = 0x000606A0,
Patrick Williams0621dc02023-10-20 11:19:59 -050038 icx = 0x000606A0,
Jason M. Bills127609c2024-04-01 12:57:08 -070039 iceLakeD = 0x000606C0,
Patrick Williams0621dc02023-10-20 11:19:59 -050040 icxd = 0x000606C0,
Jason M. Bills127609c2024-04-01 12:57:08 -070041 sapphireRapids = 0x000806F0,
Patrick Williams0621dc02023-10-20 11:19:59 -050042 spr = 0x000806F0,
Jason M. Bills127609c2024-04-01 12:57:08 -070043 emeraldRapids = 0x000C06F0,
Patrick Williams0621dc02023-10-20 11:19:59 -050044 emr = 0x000C06F0,
Jason M. Bills127609c2024-04-01 12:57:08 -070045 graniteRapids = 0x000A06D0,
Patrick Williams0621dc02023-10-20 11:19:59 -050046 gnr = 0x000A06D0,
Jason M. Bills127609c2024-04-01 12:57:08 -070047 graniteRapidsD = 0x000A06E0,
Patrick Williams0621dc02023-10-20 11:19:59 -050048 gnrd = 0x000A06E0,
Jason M. Bills127609c2024-04-01 12:57:08 -070049 sierraForest = 0x000A06F0,
Patrick Williams0621dc02023-10-20 11:19:59 -050050 srf = 0x000A06F0,
51} CPUModel;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070052
Patrick Williams0621dc02023-10-20 11:19:59 -050053// PECI Status Codes
54typedef enum
55{
56 PECI_CC_SUCCESS = 0,
57 PECI_CC_INVALID_REQ,
58 PECI_CC_HW_ERR,
59 PECI_CC_DRIVER_ERR,
60 PECI_CC_CPU_NOT_PRESENT,
61 PECI_CC_MEM_ERR,
62 PECI_CC_TIMEOUT,
63} EPECIStatus;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070064
Patrick Williams0621dc02023-10-20 11:19:59 -050065// PECI Timeout Options
66typedef enum
67{
68 PECI_WAIT_FOREVER = -1,
69 PECI_NO_WAIT = 0,
70} EPECITimeout;
Jason M. Bills7ef5a552020-04-06 14:58:44 -070071
72#define PECI_TIMEOUT_RESOLUTION_MS 10 // 10 ms
73#define PECI_TIMEOUT_MS 100 // 100 ms
74
Manojkiran Eda5302b932024-06-17 11:03:46 +053075// VCU Index and Sequence Parameters
Jason M. Bills7ef5a552020-04-06 14:58:44 -070076#define VCU_SET_PARAM 0x0001
77#define VCU_READ 0x0002
78#define VCU_OPEN_SEQ 0x0003
79#define VCU_CLOSE_SEQ 0x0004
80#define VCU_ABORT_SEQ 0x0005
81#define VCU_VERSION 0x0009
82
Patrick Williams0621dc02023-10-20 11:19:59 -050083typedef enum
84{
85 VCU_READ_LOCAL_CSR_SEQ = 0x2,
86 VCU_READ_LOCAL_MMIO_SEQ = 0x6,
87 VCU_EN_SECURE_DATA_SEQ = 0x14,
88 VCU_CORE_MCA_SEQ = 0x10000,
89 VCU_UNCORE_MCA_SEQ = 0x10000,
90 VCU_IOT_BRKPT_SEQ = 0x10010,
91 VCU_MBP_CONFIG_SEQ = 0x10026,
92 VCU_PWR_MGT_SEQ = 0x1002a,
93 VCU_CRASHDUMP_SEQ = 0x10038,
94 VCU_ARRAY_DUMP_SEQ = 0x20000,
95 VCU_SCAN_DUMP_SEQ = 0x20008,
96 VCU_TOR_DUMP_SEQ = 0x30002,
97 VCU_SQ_DUMP_SEQ = 0x30004,
98 VCU_UNCORE_CRASHDUMP_SEQ = 0x30006,
99} EPECISequence;
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700100
101#define MBX_INDEX_VCU 128 // VCU Index
102
Patrick Williams0621dc02023-10-20 11:19:59 -0500103typedef enum
104{
105 MMIO_DWORD_OFFSET = 0x05,
106 MMIO_QWORD_OFFSET = 0x06,
107} EEndPtMmioAddrType;
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700108
Patrick Williams0621dc02023-10-20 11:19:59 -0500109// Find the specified PCI bus number value
110EPECIStatus FindBusNumber(uint8_t u8Bus, uint8_t u8Cpu, uint8_t* pu8BusValue);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700111
Patrick Williams0621dc02023-10-20 11:19:59 -0500112// Gets the temperature from the target
113// Expressed in signed fixed point value of 1/64 degrees celsius
114EPECIStatus peci_GetTemp(uint8_t target, int16_t* temperature);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700115
Patrick Williams0621dc02023-10-20 11:19:59 -0500116// Provides read access to the package configuration space within the
117// processor
118EPECIStatus peci_RdPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Value,
119 uint8_t u8ReadLen, uint8_t* pPkgConfig,
120 uint8_t* cc);
121
122// Provides read access to the package configuration space within the
123// processor in the specified domain
124EPECIStatus peci_RdPkgConfig_dom(uint8_t target, uint8_t domainId,
125 uint8_t u8Index, uint16_t u16Value,
126 uint8_t u8ReadLen, uint8_t* pPkgConfig,
127 uint8_t* cc);
128
129// Allows sequential RdPkgConfig with the provided peci file descriptor
130EPECIStatus peci_RdPkgConfig_seq(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700131 uint16_t u16Value, uint8_t u8ReadLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500132 uint8_t* pPkgConfig, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700133
Patrick Williams0621dc02023-10-20 11:19:59 -0500134// Allows sequential RdPkgConfig with the provided peci file descriptor in
135// the specified domain
136EPECIStatus peci_RdPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800137 uint8_t u8Index, uint16_t u16Value,
138 uint8_t u8ReadLen, uint8_t* pPkgConfig,
Patrick Williams0621dc02023-10-20 11:19:59 -0500139 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800140
Patrick Williams0621dc02023-10-20 11:19:59 -0500141// Provides write access to the package configuration space within the
142// processor
143EPECIStatus peci_WrPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Param,
144 uint32_t u32Value, uint8_t u8WriteLen,
145 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700146
Patrick Williams0621dc02023-10-20 11:19:59 -0500147// Provides write access to the package configuration space within the
148// processor in the specified domain
149EPECIStatus peci_WrPkgConfig_dom(uint8_t target, uint8_t domainId,
150 uint8_t u8Index, uint16_t u16Param,
151 uint32_t u32Value, uint8_t u8WriteLen,
152 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800153
Patrick Williams0621dc02023-10-20 11:19:59 -0500154// Allows sequential WrPkgConfig with the provided peci file descriptor
155EPECIStatus peci_WrPkgConfig_seq(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700156 uint16_t u16Param, uint32_t u32Value,
Patrick Williams0621dc02023-10-20 11:19:59 -0500157 uint8_t u8WriteLen, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700158
Patrick Williams0621dc02023-10-20 11:19:59 -0500159// Allows sequential WrPkgConfig with the provided peci file descriptor in
160// the specified domain
161EPECIStatus peci_WrPkgConfig_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800162 uint8_t u8Index, uint16_t u16Param,
163 uint32_t u32Value, uint8_t u8WriteLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500164 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800165
Patrick Williams0621dc02023-10-20 11:19:59 -0500166// Provides read access to Model Specific Registers
167EPECIStatus peci_RdIAMSR(uint8_t target, uint8_t threadID, uint16_t MSRAddress,
168 uint64_t* u64MsrVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700169
Patrick Williams0621dc02023-10-20 11:19:59 -0500170// Provides read access to Model Specific Registers in the specified domain
171EPECIStatus peci_RdIAMSR_dom(uint8_t target, uint8_t domainId, uint8_t threadID,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800172 uint16_t MSRAddress, uint64_t* u64MsrVal,
173 uint8_t* cc);
174
Patrick Williams0621dc02023-10-20 11:19:59 -0500175// Provides read access to PCI Configuration space
176EPECIStatus peci_RdPCIConfig(uint8_t target, uint8_t u8Bus, uint8_t u8Device,
177 uint8_t u8Fcn, uint16_t u16Reg, uint8_t* pPCIReg,
178 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700179
Patrick Williams0621dc02023-10-20 11:19:59 -0500180// Provides read access to PCI Configuration space in the specified domain
181EPECIStatus peci_RdPCIConfig_dom(uint8_t target, uint8_t domainId,
182 uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800183 uint16_t u16Reg, uint8_t* pPCIReg,
184 uint8_t* cc);
185
Patrick Williams0621dc02023-10-20 11:19:59 -0500186// Allows sequential RdPCIConfig with the provided peci file descriptor
187EPECIStatus peci_RdPCIConfig_seq(uint8_t target, uint8_t u8Bus,
188 uint8_t u8Device, uint8_t u8Fcn,
189 uint16_t u16Reg, uint8_t* pPCIData,
190 int peci_fd, uint8_t* cc);
191
192// Allows sequential RdPCIConfig with the provided peci file descriptor in
193// the specified domain
194EPECIStatus peci_RdPCIConfig_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800195 uint8_t u8Bus, uint8_t u8Device,
196 uint8_t u8Fcn, uint16_t u16Reg,
Patrick Williams0621dc02023-10-20 11:19:59 -0500197 uint8_t* pPCIData, int peci_fd,
198 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800199
Patrick Williams0621dc02023-10-20 11:19:59 -0500200// Provides read access to the local PCI Configuration space
201EPECIStatus peci_RdPCIConfigLocal(uint8_t target, uint8_t u8Bus,
202 uint8_t u8Device, uint8_t u8Fcn,
203 uint16_t u16Reg, uint8_t u8ReadLen,
204 uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700205
Patrick Williams0621dc02023-10-20 11:19:59 -0500206// Provides read access to the local PCI Configuration space in the
207// specified domain
208EPECIStatus peci_RdPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
209 uint8_t u8Bus, uint8_t u8Device,
210 uint8_t u8Fcn, uint16_t u16Reg,
211 uint8_t u8ReadLen, uint8_t* pPCIReg,
212 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800213
Patrick Williams0621dc02023-10-20 11:19:59 -0500214// Allows sequential RdPCIConfigLocal with the provided peci file descriptor
215EPECIStatus peci_RdPCIConfigLocal_seq(uint8_t target, uint8_t u8Bus,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700216 uint8_t u8Device, uint8_t u8Fcn,
217 uint16_t u16Reg, uint8_t u8ReadLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500218 uint8_t* pPCIReg, int peci_fd,
219 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700220
Patrick Williams0621dc02023-10-20 11:19:59 -0500221// Allows sequential RdPCIConfigLocal with the provided peci file descriptor
222// in the specified domain
223EPECIStatus peci_RdPCIConfigLocal_seq_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800224 uint8_t u8Bus, uint8_t u8Device,
225 uint8_t u8Fcn, uint16_t u16Reg,
226 uint8_t u8ReadLen, uint8_t* pPCIReg,
Patrick Williams0621dc02023-10-20 11:19:59 -0500227 int peci_fd, uint8_t* cc);
228
229// Provides write access to the local PCI Configuration space
230EPECIStatus peci_WrPCIConfigLocal(uint8_t target, uint8_t u8Bus,
231 uint8_t u8Device, uint8_t u8Fcn,
232 uint16_t u16Reg, uint8_t DataLen,
233 uint32_t DataVal, uint8_t* cc);
234
235// Provides write access to the local PCI Configuration space in the
236// specified domain
237EPECIStatus peci_WrPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
238 uint8_t u8Bus, uint8_t u8Device,
239 uint8_t u8Fcn, uint16_t u16Reg,
240 uint8_t DataLen, uint32_t DataVal,
241 uint8_t* cc);
242
243// Provides read access to PCI configuration space
244EPECIStatus peci_RdEndPointConfigPci(uint8_t target, uint8_t u8Seg,
245 uint8_t u8Bus, uint8_t u8Device,
246 uint8_t u8Fcn, uint16_t u16Reg,
247 uint8_t u8ReadLen, uint8_t* pPCIData,
248 uint8_t* cc);
249
250// Provides read access to PCI configuration space in the specified domain
251EPECIStatus peci_RdEndPointConfigPci_dom(uint8_t target, uint8_t domainId,
252 uint8_t u8Seg, uint8_t u8Bus,
253 uint8_t u8Device, uint8_t u8Fcn,
254 uint16_t u16Reg, uint8_t u8ReadLen,
255 uint8_t* pPCIData, uint8_t* cc);
256
257// Allows sequential RdEndPointConfig to PCI Configuration space
258EPECIStatus peci_RdEndPointConfigPci_seq(uint8_t target, uint8_t u8Seg,
259 uint8_t u8Bus, uint8_t u8Device,
260 uint8_t u8Fcn, uint16_t u16Reg,
261 uint8_t u8ReadLen, uint8_t* pPCIData,
262 int peci_fd, uint8_t* cc);
263
264// Allows sequential RdEndPointConfig to PCI Configuration space in the
265// specified domain
266EPECIStatus peci_RdEndPointConfigPci_seq_dom(uint8_t target, uint8_t domainId,
267 uint8_t u8Seg, uint8_t u8Bus,
268 uint8_t u8Device, uint8_t u8Fcn,
269 uint16_t u16Reg, uint8_t u8ReadLen,
270 uint8_t* pPCIData, int peci_fd,
271 uint8_t* cc);
272
273// Provides read access to the local PCI configuration space
274EPECIStatus peci_RdEndPointConfigPciLocal(uint8_t target, uint8_t u8Seg,
275 uint8_t u8Bus, uint8_t u8Device,
276 uint8_t u8Fcn, uint16_t u16Reg,
277 uint8_t u8ReadLen, uint8_t* pPCIData,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700278 uint8_t* cc);
279
Patrick Williams0621dc02023-10-20 11:19:59 -0500280// Provides read access to the local PCI configuration space in the
281// specified domain
282EPECIStatus peci_RdEndPointConfigPciLocal_dom(uint8_t target, uint8_t domainId,
283 uint8_t u8Seg, uint8_t u8Bus,
284 uint8_t u8Device, uint8_t u8Fcn,
285 uint16_t u16Reg,
286 uint8_t u8ReadLen,
287 uint8_t* pPCIData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800288
Patrick Williams0621dc02023-10-20 11:19:59 -0500289// Allows sequential RdEndPointConfig to the local PCI Configuration space
290EPECIStatus peci_RdEndPointConfigPciLocal_seq(uint8_t target, uint8_t u8Seg,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700291 uint8_t u8Bus, uint8_t u8Device,
292 uint8_t u8Fcn, uint16_t u16Reg,
293 uint8_t u8ReadLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500294 uint8_t* pPCIData, int peci_fd,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700295 uint8_t* cc);
296
Patrick Williams0621dc02023-10-20 11:19:59 -0500297// Allows sequential RdEndPointConfig to the local PCI Configuration space
298// in the specified domain
299EPECIStatus peci_RdEndPointConfigPciLocal_seq_dom(
300 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
301 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
302 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800303
Patrick Williams0621dc02023-10-20 11:19:59 -0500304// Provides read access to PCI MMIO space
305EPECIStatus peci_RdEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
306 uint8_t u8Bus, uint8_t u8Device,
307 uint8_t u8Fcn, uint8_t u8Bar,
308 uint8_t u8AddrType, uint64_t u64Offset,
309 uint8_t u8ReadLen, uint8_t* pMmioData,
310 uint8_t* cc);
311
312// Provides read access to PCI MMIO space in the specified domain
313EPECIStatus peci_RdEndPointConfigMmio_dom(uint8_t target, uint8_t domainId,
314 uint8_t u8Seg, uint8_t u8Bus,
315 uint8_t u8Device, uint8_t u8Fcn,
316 uint8_t u8Bar, uint8_t u8AddrType,
317 uint64_t u64Offset, uint8_t u8ReadLen,
318 uint8_t* pMmioData, uint8_t* cc);
319
320// Allows sequential RdEndPointConfig to PCI MMIO space
321EPECIStatus peci_RdEndPointConfigMmio_seq(
322 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
323 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
324 uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd, uint8_t* cc);
325
326// Allows sequential RdEndPointConfig to PCI MMIO space in the specified
327// domain
328EPECIStatus peci_RdEndPointConfigMmio_seq_dom(
329 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
330 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
331 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd,
332 uint8_t* cc);
333
334// Provides write access to the EP local PCI Configuration space
335EPECIStatus peci_WrEndPointPCIConfigLocal(uint8_t target, uint8_t u8Seg,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700336 uint8_t u8Bus, uint8_t u8Device,
337 uint8_t u8Fcn, uint16_t u16Reg,
338 uint8_t DataLen, uint32_t DataVal,
339 uint8_t* cc);
340
Patrick Williams0621dc02023-10-20 11:19:59 -0500341// Provides write access to the EP local PCI Configuration space in the
342// specified domain
343EPECIStatus peci_WrEndPointPCIConfigLocal_dom(uint8_t target, uint8_t domainId,
344 uint8_t u8Seg, uint8_t u8Bus,
345 uint8_t u8Device, uint8_t u8Fcn,
346 uint16_t u16Reg, uint8_t DataLen,
347 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800348
Patrick Williams0621dc02023-10-20 11:19:59 -0500349// Provides write access to the EP PCI Configuration space
350EPECIStatus peci_WrEndPointPCIConfig(uint8_t target, uint8_t u8Seg,
351 uint8_t u8Bus, uint8_t u8Device,
352 uint8_t u8Fcn, uint16_t u16Reg,
353 uint8_t DataLen, uint32_t DataVal,
354 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700355
Patrick Williams0621dc02023-10-20 11:19:59 -0500356// Provides write access to the EP PCI Configuration space in the specified
357// domain
358EPECIStatus peci_WrEndPointPCIConfig_dom(uint8_t target, uint8_t domainId,
359 uint8_t u8Seg, uint8_t u8Bus,
360 uint8_t u8Device, uint8_t u8Fcn,
361 uint16_t u16Reg, uint8_t DataLen,
362 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800363
Patrick Williams0621dc02023-10-20 11:19:59 -0500364// Allows sequential write access to the EP PCI Configuration space
365EPECIStatus peci_WrEndPointConfig_seq(uint8_t target, uint8_t u8MsgType,
366 uint8_t u8Seg, uint8_t u8Bus,
367 uint8_t u8Device, uint8_t u8Fcn,
368 uint16_t u16Reg, uint8_t DataLen,
369 uint32_t DataVal, int peci_fd,
370 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700371
Patrick Williams0621dc02023-10-20 11:19:59 -0500372// Allows sequential write access to the EP PCI Configuration space in the
373// specified domain
374EPECIStatus peci_WrEndPointConfig_seq_dom(uint8_t target, uint8_t domainId,
375 uint8_t u8MsgType, uint8_t u8Seg,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800376 uint8_t u8Bus, uint8_t u8Device,
Patrick Williams0621dc02023-10-20 11:19:59 -0500377 uint8_t u8Fcn, uint16_t u16Reg,
378 uint8_t DataLen, uint32_t DataVal,
379 int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800380
Patrick Williams0621dc02023-10-20 11:19:59 -0500381// Provides write access to the EP PCI MMIO space
382EPECIStatus peci_WrEndPointConfigMmio(uint8_t target, uint8_t u8Seg,
383 uint8_t u8Bus, uint8_t u8Device,
384 uint8_t u8Fcn, uint8_t u8Bar,
385 uint8_t u8AddrType, uint64_t u64Offset,
386 uint8_t u8DataLen, uint64_t u64DataVal,
387 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700388
Patrick Williams0621dc02023-10-20 11:19:59 -0500389// Provides write access to the EP PCI MMIO space in the specified domain
390EPECIStatus peci_WrEndPointConfigMmio_dom(uint8_t target, uint8_t domainId,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800391 uint8_t u8Seg, uint8_t u8Bus,
392 uint8_t u8Device, uint8_t u8Fcn,
Patrick Williams0621dc02023-10-20 11:19:59 -0500393 uint8_t u8Bar, uint8_t u8AddrType,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800394 uint64_t u64Offset, uint8_t u8DataLen,
395 uint64_t u64DataVal, uint8_t* cc);
396
Patrick Williams0621dc02023-10-20 11:19:59 -0500397// Allows sequential write access to the EP PCI MMIO space
398EPECIStatus peci_WrEndPointConfigMmio_seq(
399 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
400 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
401 uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700402
Patrick Williams0621dc02023-10-20 11:19:59 -0500403// Allows sequential write access to the EP PCI MMIO space in the specified
404// domain
405EPECIStatus peci_WrEndPointConfigMmio_seq_dom(
406 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
407 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
408 uint64_t u64Offset, uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd,
409 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800410
Patrick Williams0621dc02023-10-20 11:19:59 -0500411// Provides access to the Crashdump Discovery API
412EPECIStatus peci_CrashDump_Discovery(uint8_t target, uint8_t subopcode,
413 uint8_t param0, uint16_t param1,
414 uint8_t param2, uint8_t u8ReadLen,
415 uint8_t* pData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700416
Patrick Williams0621dc02023-10-20 11:19:59 -0500417// Provides access to the Crashdump Discovery API in the specified domain
418EPECIStatus peci_CrashDump_Discovery_dom(uint8_t target, uint8_t domainId,
419 uint8_t subopcode, uint8_t param0,
420 uint16_t param1, uint8_t param2,
421 uint8_t u8ReadLen, uint8_t* pData,
422 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800423
Patrick Williams0621dc02023-10-20 11:19:59 -0500424// Provides access to the Crashdump GetFrame API
425EPECIStatus peci_CrashDump_GetFrame(uint8_t target, uint16_t param0,
426 uint16_t param1, uint16_t param2,
427 uint8_t u8ReadLen, uint8_t* pData,
428 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700429
Patrick Williams0621dc02023-10-20 11:19:59 -0500430// Provides access to the Crashdump GetFrame API in the specified domain
431EPECIStatus peci_CrashDump_GetFrame_dom(uint8_t target, uint8_t domainId,
432 uint16_t param0, uint16_t param1,
433 uint16_t param2, uint8_t u8ReadLen,
434 uint8_t* pData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800435
Patrick Williams0621dc02023-10-20 11:19:59 -0500436// Provides raw PECI command access
437EPECIStatus peci_raw(uint8_t target, uint8_t u8ReadLen, const uint8_t* pRawCmd,
438 const uint32_t cmdSize, uint8_t* pRawResp,
439 uint32_t respSize);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700440
Zbigniew Kurzynskif2a5fa22023-11-06 13:48:11 +0100441// Provides sequential raw PECI command access
442EPECIStatus peci_raw_seq(uint8_t target, uint8_t u8ReadLen,
443 const uint8_t* pRawCmd, const uint32_t cmdSize,
444 uint8_t* pRawResp, uint32_t respSize, int peci_fd);
445
Patrick Williams0621dc02023-10-20 11:19:59 -0500446EPECIStatus peci_Lock(int* peci_fd, int timeout_ms);
447void peci_Unlock(int peci_fd);
448EPECIStatus peci_Ping(uint8_t target);
449EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd);
450EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel,
451 uint8_t* stepping, uint8_t* cc);
452void peci_SetDevName(char* peci_dev);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700453
454#ifdef __cplusplus
455}
456#endif