blob: 2fad797ab5ccebe3126f470b700db2025231093a [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,
Jason M. Bills127609c2024-04-01 12:57:08 -070036 iceLake = 0x000606A0,
Jason M. Bills127609c2024-04-01 12:57:08 -070037 iceLakeD = 0x000606C0,
Jason M. Bills127609c2024-04-01 12:57:08 -070038 sapphireRapids = 0x000806F0,
Jason M. Bills127609c2024-04-01 12:57:08 -070039 emeraldRapids = 0x000C06F0,
Jason M. Bills127609c2024-04-01 12:57:08 -070040 graniteRapids = 0x000A06D0,
Jason M. Bills127609c2024-04-01 12:57:08 -070041 graniteRapidsD = 0x000A06E0,
Jason M. Bills127609c2024-04-01 12:57:08 -070042 sierraForest = 0x000A06F0,
Patrick Williams0621dc02023-10-20 11:19:59 -050043} 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
Manojkiran Eda5302b932024-06-17 11:03:46 +053067// VCU Index and Sequence Parameters
Jason M. Bills7ef5a552020-04-06 14:58:44 -070068#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
Patrick Williamsc96261e2024-08-16 15:22:05 -0400116EPECIStatus peci_RdPkgConfig_dom(
117 uint8_t target, uint8_t domainId, uint8_t u8Index, uint16_t u16Value,
118 uint8_t u8ReadLen, uint8_t* pPkgConfig, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500119
120// Allows sequential RdPkgConfig with the provided peci file descriptor
121EPECIStatus peci_RdPkgConfig_seq(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700122 uint16_t u16Value, uint8_t u8ReadLen,
Patrick Williams0621dc02023-10-20 11:19:59 -0500123 uint8_t* pPkgConfig, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700124
Patrick Williams0621dc02023-10-20 11:19:59 -0500125// Allows sequential RdPkgConfig with the provided peci file descriptor in
126// the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400127EPECIStatus peci_RdPkgConfig_seq_dom(
128 uint8_t target, uint8_t domainId, uint8_t u8Index, uint16_t u16Value,
129 uint8_t u8ReadLen, uint8_t* pPkgConfig, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800130
Patrick Williams0621dc02023-10-20 11:19:59 -0500131// Provides write access to the package configuration space within the
132// processor
133EPECIStatus peci_WrPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Param,
134 uint32_t u32Value, uint8_t u8WriteLen,
135 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700136
Patrick Williams0621dc02023-10-20 11:19:59 -0500137// Provides write access to the package configuration space within the
138// processor in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400139EPECIStatus peci_WrPkgConfig_dom(
140 uint8_t target, uint8_t domainId, uint8_t u8Index, uint16_t u16Param,
141 uint32_t u32Value, uint8_t u8WriteLen, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800142
Patrick Williams0621dc02023-10-20 11:19:59 -0500143// Allows sequential WrPkgConfig with the provided peci file descriptor
144EPECIStatus peci_WrPkgConfig_seq(uint8_t target, uint8_t u8Index,
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700145 uint16_t u16Param, uint32_t u32Value,
Patrick Williams0621dc02023-10-20 11:19:59 -0500146 uint8_t u8WriteLen, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700147
Patrick Williams0621dc02023-10-20 11:19:59 -0500148// Allows sequential WrPkgConfig with the provided peci file descriptor in
149// the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400150EPECIStatus peci_WrPkgConfig_seq_dom(
151 uint8_t target, uint8_t domainId, uint8_t u8Index, uint16_t u16Param,
152 uint32_t u32Value, uint8_t u8WriteLen, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800153
Patrick Williams0621dc02023-10-20 11:19:59 -0500154// Provides read access to Model Specific Registers
155EPECIStatus peci_RdIAMSR(uint8_t target, uint8_t threadID, uint16_t MSRAddress,
156 uint64_t* u64MsrVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700157
Patrick Williams0621dc02023-10-20 11:19:59 -0500158// Provides read access to Model Specific Registers in the specified domain
159EPECIStatus peci_RdIAMSR_dom(uint8_t target, uint8_t domainId, uint8_t threadID,
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800160 uint16_t MSRAddress, uint64_t* u64MsrVal,
161 uint8_t* cc);
162
Patrick Williams0621dc02023-10-20 11:19:59 -0500163// Provides read access to PCI Configuration space
164EPECIStatus peci_RdPCIConfig(uint8_t target, uint8_t u8Bus, uint8_t u8Device,
165 uint8_t u8Fcn, uint16_t u16Reg, uint8_t* pPCIReg,
166 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700167
Patrick Williams0621dc02023-10-20 11:19:59 -0500168// Provides read access to PCI Configuration space in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400169EPECIStatus peci_RdPCIConfig_dom(
170 uint8_t target, uint8_t domainId, uint8_t u8Bus, uint8_t u8Device,
171 uint8_t u8Fcn, uint16_t u16Reg, uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800172
Patrick Williams0621dc02023-10-20 11:19:59 -0500173// Allows sequential RdPCIConfig with the provided peci file descriptor
Patrick Williamsc96261e2024-08-16 15:22:05 -0400174EPECIStatus peci_RdPCIConfig_seq(
175 uint8_t target, uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn,
176 uint16_t u16Reg, uint8_t* pPCIData, int peci_fd, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500177
178// Allows sequential RdPCIConfig with the provided peci file descriptor in
179// the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400180EPECIStatus
181 peci_RdPCIConfig_seq_dom(uint8_t target, uint8_t domainId, uint8_t u8Bus,
182 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg,
183 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800184
Patrick Williams0621dc02023-10-20 11:19:59 -0500185// Provides read access to the local PCI Configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400186EPECIStatus peci_RdPCIConfigLocal(
187 uint8_t target, uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn,
188 uint16_t u16Reg, uint8_t u8ReadLen, uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700189
Patrick Williams0621dc02023-10-20 11:19:59 -0500190// Provides read access to the local PCI Configuration space in the
191// specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400192EPECIStatus
193 peci_RdPCIConfigLocal_dom(uint8_t target, uint8_t domainId, uint8_t u8Bus,
194 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg,
195 uint8_t u8ReadLen, uint8_t* pPCIReg, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800196
Patrick Williams0621dc02023-10-20 11:19:59 -0500197// Allows sequential RdPCIConfigLocal with the provided peci file descriptor
Patrick Williamsc96261e2024-08-16 15:22:05 -0400198EPECIStatus
199 peci_RdPCIConfigLocal_seq(uint8_t target, uint8_t u8Bus, uint8_t u8Device,
200 uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
201 uint8_t* pPCIReg, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700202
Patrick Williams0621dc02023-10-20 11:19:59 -0500203// Allows sequential RdPCIConfigLocal with the provided peci file descriptor
204// in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400205EPECIStatus peci_RdPCIConfigLocal_seq_dom(
206 uint8_t target, uint8_t domainId, uint8_t u8Bus, uint8_t u8Device,
207 uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen, uint8_t* pPCIReg,
208 int peci_fd, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500209
210// Provides write access to the local PCI Configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400211EPECIStatus peci_WrPCIConfigLocal(
212 uint8_t target, uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn,
213 uint16_t u16Reg, uint8_t DataLen, uint32_t DataVal, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500214
215// Provides write access to the local PCI Configuration space in the
216// specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400217EPECIStatus
218 peci_WrPCIConfigLocal_dom(uint8_t target, uint8_t domainId, uint8_t u8Bus,
219 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg,
220 uint8_t DataLen, uint32_t DataVal, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500221
222// Provides read access to PCI configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400223EPECIStatus
224 peci_RdEndPointConfigPci(uint8_t target, uint8_t u8Seg, uint8_t u8Bus,
225 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg,
226 uint8_t u8ReadLen, uint8_t* pPCIData, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500227
228// Provides read access to PCI configuration space in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400229EPECIStatus peci_RdEndPointConfigPci_dom(
230 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
231 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
232 uint8_t* pPCIData, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500233
234// Allows sequential RdEndPointConfig to PCI Configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400235EPECIStatus peci_RdEndPointConfigPci_seq(
236 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
237 uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen, uint8_t* pPCIData,
238 int peci_fd, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500239
240// Allows sequential RdEndPointConfig to PCI Configuration space in the
241// specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400242EPECIStatus peci_RdEndPointConfigPci_seq_dom(
243 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
244 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
245 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500246
247// Provides read access to the local PCI configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400248EPECIStatus peci_RdEndPointConfigPciLocal(
249 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
250 uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen, uint8_t* pPCIData,
251 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700252
Patrick Williams0621dc02023-10-20 11:19:59 -0500253// Provides read access to the local PCI configuration space in the
254// specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400255EPECIStatus peci_RdEndPointConfigPciLocal_dom(
256 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
257 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
258 uint8_t* pPCIData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800259
Patrick Williams0621dc02023-10-20 11:19:59 -0500260// Allows sequential RdEndPointConfig to the local PCI Configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400261EPECIStatus peci_RdEndPointConfigPciLocal_seq(
262 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
263 uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen, uint8_t* pPCIData,
264 int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700265
Patrick Williams0621dc02023-10-20 11:19:59 -0500266// Allows sequential RdEndPointConfig to the local PCI Configuration space
267// in the specified domain
268EPECIStatus peci_RdEndPointConfigPciLocal_seq_dom(
269 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
270 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen,
271 uint8_t* pPCIData, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800272
Patrick Williams0621dc02023-10-20 11:19:59 -0500273// Provides read access to PCI MMIO space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400274EPECIStatus peci_RdEndPointConfigMmio(
275 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
276 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
277 uint8_t u8ReadLen, uint8_t* pMmioData, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500278
279// Provides read access to PCI MMIO space in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400280EPECIStatus peci_RdEndPointConfigMmio_dom(
281 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
282 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
283 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, uint8_t* cc);
Patrick Williams0621dc02023-10-20 11:19:59 -0500284
285// Allows sequential RdEndPointConfig to PCI MMIO space
286EPECIStatus peci_RdEndPointConfigMmio_seq(
287 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
288 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
289 uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd, uint8_t* cc);
290
291// Allows sequential RdEndPointConfig to PCI MMIO space in the specified
292// domain
293EPECIStatus peci_RdEndPointConfigMmio_seq_dom(
294 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
295 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
296 uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd,
297 uint8_t* cc);
298
299// Provides write access to the EP local PCI Configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400300EPECIStatus peci_WrEndPointPCIConfigLocal(
301 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
302 uint8_t u8Fcn, uint16_t u16Reg, uint8_t DataLen, uint32_t DataVal,
303 uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700304
Patrick Williams0621dc02023-10-20 11:19:59 -0500305// Provides write access to the EP local PCI Configuration space in the
306// specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400307EPECIStatus peci_WrEndPointPCIConfigLocal_dom(
308 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
309 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t DataLen,
310 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800311
Patrick Williams0621dc02023-10-20 11:19:59 -0500312// Provides write access to the EP PCI Configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400313EPECIStatus
314 peci_WrEndPointPCIConfig(uint8_t target, uint8_t u8Seg, uint8_t u8Bus,
315 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg,
316 uint8_t DataLen, uint32_t DataVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700317
Patrick Williams0621dc02023-10-20 11:19:59 -0500318// Provides write access to the EP PCI Configuration space in the specified
319// domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400320EPECIStatus peci_WrEndPointPCIConfig_dom(
321 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
322 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t DataLen,
323 uint32_t DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800324
Patrick Williams0621dc02023-10-20 11:19:59 -0500325// Allows sequential write access to the EP PCI Configuration space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400326EPECIStatus peci_WrEndPointConfig_seq(
327 uint8_t target, uint8_t u8MsgType, uint8_t u8Seg, uint8_t u8Bus,
328 uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t DataLen,
329 uint32_t DataVal, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700330
Patrick Williams0621dc02023-10-20 11:19:59 -0500331// Allows sequential write access to the EP PCI Configuration space in the
332// specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400333EPECIStatus peci_WrEndPointConfig_seq_dom(
334 uint8_t target, uint8_t domainId, uint8_t u8MsgType, uint8_t u8Seg,
335 uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg,
336 uint8_t DataLen, uint32_t DataVal, int peci_fd, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800337
Patrick Williams0621dc02023-10-20 11:19:59 -0500338// Provides write access to the EP PCI MMIO space
Patrick Williamsc96261e2024-08-16 15:22:05 -0400339EPECIStatus peci_WrEndPointConfigMmio(
340 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
341 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
342 uint8_t u8DataLen, uint64_t u64DataVal, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700343
Patrick Williams0621dc02023-10-20 11:19:59 -0500344// Provides write access to the EP PCI MMIO space in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400345EPECIStatus peci_WrEndPointConfigMmio_dom(
346 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
347 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
348 uint64_t u64Offset, uint8_t u8DataLen, uint64_t u64DataVal, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800349
Patrick Williams0621dc02023-10-20 11:19:59 -0500350// Allows sequential write access to the EP PCI MMIO space
351EPECIStatus peci_WrEndPointConfigMmio_seq(
352 uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device,
353 uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset,
354 uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700355
Patrick Williams0621dc02023-10-20 11:19:59 -0500356// Allows sequential write access to the EP PCI MMIO space in the specified
357// domain
358EPECIStatus peci_WrEndPointConfigMmio_seq_dom(
359 uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus,
360 uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType,
361 uint64_t u64Offset, uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd,
362 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800363
Patrick Williams0621dc02023-10-20 11:19:59 -0500364// Provides access to the Crashdump Discovery API
Patrick Williamsc96261e2024-08-16 15:22:05 -0400365EPECIStatus peci_CrashDump_Discovery(
366 uint8_t target, uint8_t subopcode, uint8_t param0, uint16_t param1,
367 uint8_t param2, uint8_t u8ReadLen, uint8_t* pData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700368
Patrick Williams0621dc02023-10-20 11:19:59 -0500369// Provides access to the Crashdump Discovery API in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400370EPECIStatus peci_CrashDump_Discovery_dom(
371 uint8_t target, uint8_t domainId, uint8_t subopcode, uint8_t param0,
372 uint16_t param1, uint8_t param2, uint8_t u8ReadLen, uint8_t* pData,
373 uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800374
Patrick Williams0621dc02023-10-20 11:19:59 -0500375// Provides access to the Crashdump GetFrame API
Patrick Williamsc96261e2024-08-16 15:22:05 -0400376EPECIStatus peci_CrashDump_GetFrame(
377 uint8_t target, uint16_t param0, uint16_t param1, uint16_t param2,
378 uint8_t u8ReadLen, uint8_t* pData, uint8_t* cc);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700379
Patrick Williams0621dc02023-10-20 11:19:59 -0500380// Provides access to the Crashdump GetFrame API in the specified domain
Patrick Williamsc96261e2024-08-16 15:22:05 -0400381EPECIStatus peci_CrashDump_GetFrame_dom(
382 uint8_t target, uint8_t domainId, uint16_t param0, uint16_t param1,
383 uint16_t param2, uint8_t u8ReadLen, uint8_t* pData, uint8_t* cc);
Jason M. Bills8bb8f372022-03-01 16:04:44 -0800384
Patrick Williams0621dc02023-10-20 11:19:59 -0500385// Provides raw PECI command access
386EPECIStatus peci_raw(uint8_t target, uint8_t u8ReadLen, const uint8_t* pRawCmd,
387 const uint32_t cmdSize, uint8_t* pRawResp,
388 uint32_t respSize);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700389
Zbigniew Kurzynskif2a5fa22023-11-06 13:48:11 +0100390// Provides sequential raw PECI command access
391EPECIStatus peci_raw_seq(uint8_t target, uint8_t u8ReadLen,
392 const uint8_t* pRawCmd, const uint32_t cmdSize,
393 uint8_t* pRawResp, uint32_t respSize, int peci_fd);
394
Patrick Williams0621dc02023-10-20 11:19:59 -0500395EPECIStatus peci_Lock(int* peci_fd, int timeout_ms);
396void peci_Unlock(int peci_fd);
397EPECIStatus peci_Ping(uint8_t target);
398EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd);
399EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel,
400 uint8_t* stepping, uint8_t* cc);
401void peci_SetDevName(char* peci_dev);
Jason M. Bills7ef5a552020-04-06 14:58:44 -0700402
403#ifdef __cplusplus
404}
405#endif