Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 1 | /* |
| 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 |
| 18 | extern "C" { |
| 19 | #endif |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 20 | #include <inttypes.h> |
| 21 | #include <stdbool.h> |
| 22 | |
| 23 | // PECI Client Address List |
| 24 | #define MIN_CLIENT_ADDR 0x30 |
| 25 | #define MAX_CLIENT_ADDR 0x37 |
| 26 | #define MAX_CPUS (MAX_CLIENT_ADDR - MIN_CLIENT_ADDR + 1) |
| 27 | |
Jason M. Bills | a2ceec2 | 2020-05-05 13:16:00 -0700 | [diff] [blame] | 28 | // PECI completion codes from peci-ioctl.h |
| 29 | #define PECI_DEV_CC_SUCCESS 0x40 |
| 30 | #define PECI_DEV_CC_FATAL_MCA_DETECTED 0x94 |
| 31 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 32 | typedef enum |
| 33 | { |
| 34 | skx = 0x00050650, |
| 35 | icx = 0x000606A0, |
Jonathan Doman | 6a00e9a | 2021-11-03 13:55:45 -0700 | [diff] [blame] | 36 | icxd = 0x000606C0, |
| 37 | spr = 0x000806F0, |
Jonathan Doman | 50959a2 | 2023-03-10 11:38:01 -0800 | [diff] [blame^] | 38 | emr = 0x000C06F0, |
| 39 | gnr = 0x000A06D0, |
| 40 | srf = 0x000A06F0, |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 41 | } CPUModel; |
| 42 | |
| 43 | // PECI Status Codes |
| 44 | typedef enum |
| 45 | { |
| 46 | PECI_CC_SUCCESS = 0, |
| 47 | PECI_CC_INVALID_REQ, |
| 48 | PECI_CC_HW_ERR, |
| 49 | PECI_CC_DRIVER_ERR, |
| 50 | PECI_CC_CPU_NOT_PRESENT, |
| 51 | PECI_CC_MEM_ERR, |
| 52 | PECI_CC_TIMEOUT, |
| 53 | } EPECIStatus; |
| 54 | |
| 55 | // PECI Timeout Options |
| 56 | typedef enum |
| 57 | { |
| 58 | PECI_WAIT_FOREVER = -1, |
| 59 | PECI_NO_WAIT = 0, |
| 60 | } EPECITimeout; |
| 61 | |
| 62 | #define PECI_TIMEOUT_RESOLUTION_MS 10 // 10 ms |
| 63 | #define PECI_TIMEOUT_MS 100 // 100 ms |
| 64 | |
| 65 | // VCU Index and Sequence Paramaters |
| 66 | #define VCU_SET_PARAM 0x0001 |
| 67 | #define VCU_READ 0x0002 |
| 68 | #define VCU_OPEN_SEQ 0x0003 |
| 69 | #define VCU_CLOSE_SEQ 0x0004 |
| 70 | #define VCU_ABORT_SEQ 0x0005 |
| 71 | #define VCU_VERSION 0x0009 |
| 72 | |
| 73 | typedef enum |
| 74 | { |
| 75 | VCU_READ_LOCAL_CSR_SEQ = 0x2, |
| 76 | VCU_READ_LOCAL_MMIO_SEQ = 0x6, |
| 77 | VCU_EN_SECURE_DATA_SEQ = 0x14, |
| 78 | VCU_CORE_MCA_SEQ = 0x10000, |
| 79 | VCU_UNCORE_MCA_SEQ = 0x10000, |
| 80 | VCU_IOT_BRKPT_SEQ = 0x10010, |
| 81 | VCU_MBP_CONFIG_SEQ = 0x10026, |
| 82 | VCU_PWR_MGT_SEQ = 0x1002a, |
| 83 | VCU_CRASHDUMP_SEQ = 0x10038, |
| 84 | VCU_ARRAY_DUMP_SEQ = 0x20000, |
| 85 | VCU_SCAN_DUMP_SEQ = 0x20008, |
| 86 | VCU_TOR_DUMP_SEQ = 0x30002, |
| 87 | VCU_SQ_DUMP_SEQ = 0x30004, |
| 88 | VCU_UNCORE_CRASHDUMP_SEQ = 0x30006, |
| 89 | } EPECISequence; |
| 90 | |
| 91 | #define MBX_INDEX_VCU 128 // VCU Index |
| 92 | |
| 93 | typedef enum |
| 94 | { |
| 95 | MMIO_DWORD_OFFSET = 0x05, |
| 96 | MMIO_QWORD_OFFSET = 0x06, |
| 97 | } EEndPtMmioAddrType; |
| 98 | |
| 99 | // Find the specified PCI bus number value |
| 100 | EPECIStatus FindBusNumber(uint8_t u8Bus, uint8_t u8Cpu, uint8_t* pu8BusValue); |
| 101 | |
| 102 | // Gets the temperature from the target |
| 103 | // Expressed in signed fixed point value of 1/64 degrees celsius |
| 104 | EPECIStatus peci_GetTemp(uint8_t target, int16_t* temperature); |
| 105 | |
| 106 | // Provides read access to the package configuration space within the processor |
| 107 | EPECIStatus peci_RdPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Value, |
| 108 | uint8_t u8ReadLen, uint8_t* pPkgConfig, |
| 109 | uint8_t* cc); |
| 110 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 111 | // Provides read access to the package configuration space within the processor |
| 112 | // in the specified domain |
| 113 | EPECIStatus peci_RdPkgConfig_dom(uint8_t target, uint8_t domainId, |
| 114 | uint8_t u8Index, uint16_t u16Value, |
| 115 | uint8_t u8ReadLen, uint8_t* pPkgConfig, |
| 116 | uint8_t* cc); |
| 117 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 118 | // Allows sequential RdPkgConfig with the provided peci file descriptor |
| 119 | EPECIStatus peci_RdPkgConfig_seq(uint8_t target, uint8_t u8Index, |
| 120 | uint16_t u16Value, uint8_t u8ReadLen, |
| 121 | uint8_t* pPkgConfig, int peci_fd, uint8_t* cc); |
| 122 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 123 | // Allows sequential RdPkgConfig with the provided peci file descriptor in the |
| 124 | // specified domain |
| 125 | EPECIStatus peci_RdPkgConfig_seq_dom(uint8_t target, uint8_t domainId, |
| 126 | uint8_t u8Index, uint16_t u16Value, |
| 127 | uint8_t u8ReadLen, uint8_t* pPkgConfig, |
| 128 | int peci_fd, uint8_t* cc); |
| 129 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 130 | // Provides write access to the package configuration space within the processor |
| 131 | EPECIStatus peci_WrPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Param, |
| 132 | uint32_t u32Value, uint8_t u8WriteLen, |
| 133 | uint8_t* cc); |
| 134 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 135 | // Provides write access to the package configuration space within the processor |
| 136 | // in the specified domain |
| 137 | EPECIStatus peci_WrPkgConfig_dom(uint8_t target, uint8_t domainId, |
| 138 | uint8_t u8Index, uint16_t u16Param, |
| 139 | uint32_t u32Value, uint8_t u8WriteLen, |
| 140 | uint8_t* cc); |
| 141 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 142 | // Allows sequential WrPkgConfig with the provided peci file descriptor |
| 143 | EPECIStatus peci_WrPkgConfig_seq(uint8_t target, uint8_t u8Index, |
| 144 | uint16_t u16Param, uint32_t u32Value, |
| 145 | uint8_t u8WriteLen, int peci_fd, uint8_t* cc); |
| 146 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 147 | // Allows sequential WrPkgConfig with the provided peci file descriptor in the |
| 148 | // specified domain |
| 149 | EPECIStatus peci_WrPkgConfig_seq_dom(uint8_t target, uint8_t domainId, |
| 150 | uint8_t u8Index, uint16_t u16Param, |
| 151 | uint32_t u32Value, uint8_t u8WriteLen, |
| 152 | int peci_fd, uint8_t* cc); |
| 153 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 154 | // Provides read access to Model Specific Registers |
| 155 | EPECIStatus peci_RdIAMSR(uint8_t target, uint8_t threadID, uint16_t MSRAddress, |
| 156 | uint64_t* u64MsrVal, uint8_t* cc); |
| 157 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 158 | // Provides read access to Model Specific Registers in the specified domain |
| 159 | EPECIStatus peci_RdIAMSR_dom(uint8_t target, uint8_t domainId, uint8_t threadID, |
| 160 | uint16_t MSRAddress, uint64_t* u64MsrVal, |
| 161 | uint8_t* cc); |
| 162 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 163 | // Provides read access to PCI Configuration space |
| 164 | EPECIStatus 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); |
| 167 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 168 | // Provides read access to PCI Configuration space in the specified domain |
| 169 | EPECIStatus peci_RdPCIConfig_dom(uint8_t target, uint8_t domainId, |
| 170 | uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn, |
| 171 | uint16_t u16Reg, uint8_t* pPCIReg, |
| 172 | uint8_t* cc); |
| 173 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 174 | // Allows sequential RdPCIConfig with the provided peci file descriptor |
| 175 | EPECIStatus peci_RdPCIConfig_seq(uint8_t target, uint8_t u8Bus, |
| 176 | uint8_t u8Device, uint8_t u8Fcn, |
| 177 | uint16_t u16Reg, uint8_t* pPCIData, |
| 178 | int peci_fd, uint8_t* cc); |
| 179 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 180 | // Allows sequential RdPCIConfig with the provided peci file descriptor in the |
| 181 | // specified domain |
| 182 | EPECIStatus peci_RdPCIConfig_seq_dom(uint8_t target, uint8_t domainId, |
| 183 | uint8_t u8Bus, uint8_t u8Device, |
| 184 | uint8_t u8Fcn, uint16_t u16Reg, |
| 185 | uint8_t* pPCIData, int peci_fd, |
| 186 | uint8_t* cc); |
| 187 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 188 | // Provides read access to the local PCI Configuration space |
| 189 | EPECIStatus peci_RdPCIConfigLocal(uint8_t target, uint8_t u8Bus, |
| 190 | uint8_t u8Device, uint8_t u8Fcn, |
| 191 | uint16_t u16Reg, uint8_t u8ReadLen, |
| 192 | uint8_t* pPCIReg, uint8_t* cc); |
| 193 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 194 | // Provides read access to the local PCI Configuration space in the specified |
| 195 | // domain |
| 196 | EPECIStatus peci_RdPCIConfigLocal_dom(uint8_t target, uint8_t domainId, |
| 197 | uint8_t u8Bus, uint8_t u8Device, |
| 198 | uint8_t u8Fcn, uint16_t u16Reg, |
| 199 | uint8_t u8ReadLen, uint8_t* pPCIReg, |
| 200 | uint8_t* cc); |
| 201 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 202 | // Allows sequential RdPCIConfigLocal with the provided peci file descriptor |
| 203 | EPECIStatus peci_RdPCIConfigLocal_seq(uint8_t target, uint8_t u8Bus, |
| 204 | uint8_t u8Device, uint8_t u8Fcn, |
| 205 | uint16_t u16Reg, uint8_t u8ReadLen, |
| 206 | uint8_t* pPCIReg, int peci_fd, |
| 207 | uint8_t* cc); |
| 208 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 209 | // Allows sequential RdPCIConfigLocal with the provided peci file descriptor in |
| 210 | // the specified domain |
| 211 | EPECIStatus peci_RdPCIConfigLocal_seq_dom(uint8_t target, uint8_t domainId, |
| 212 | uint8_t u8Bus, uint8_t u8Device, |
| 213 | uint8_t u8Fcn, uint16_t u16Reg, |
| 214 | uint8_t u8ReadLen, uint8_t* pPCIReg, |
| 215 | int peci_fd, uint8_t* cc); |
| 216 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 217 | // Provides write access to the local PCI Configuration space |
| 218 | EPECIStatus peci_WrPCIConfigLocal(uint8_t target, uint8_t u8Bus, |
| 219 | uint8_t u8Device, uint8_t u8Fcn, |
| 220 | uint16_t u16Reg, uint8_t DataLen, |
| 221 | uint32_t DataVal, uint8_t* cc); |
| 222 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 223 | // Provides write access to the local PCI Configuration space in the specified |
| 224 | // domain |
| 225 | EPECIStatus peci_WrPCIConfigLocal_dom(uint8_t target, uint8_t domainId, |
| 226 | uint8_t u8Bus, uint8_t u8Device, |
| 227 | uint8_t u8Fcn, uint16_t u16Reg, |
| 228 | uint8_t DataLen, uint32_t DataVal, |
| 229 | uint8_t* cc); |
| 230 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 231 | // Provides read access to PCI configuration space |
| 232 | EPECIStatus peci_RdEndPointConfigPci(uint8_t target, uint8_t u8Seg, |
| 233 | uint8_t u8Bus, uint8_t u8Device, |
| 234 | uint8_t u8Fcn, uint16_t u16Reg, |
| 235 | uint8_t u8ReadLen, uint8_t* pPCIData, |
| 236 | uint8_t* cc); |
| 237 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 238 | // Provides read access to PCI configuration space in the specified domain |
| 239 | EPECIStatus peci_RdEndPointConfigPci_dom(uint8_t target, uint8_t domainId, |
| 240 | uint8_t u8Seg, uint8_t u8Bus, |
| 241 | uint8_t u8Device, uint8_t u8Fcn, |
| 242 | uint16_t u16Reg, uint8_t u8ReadLen, |
| 243 | uint8_t* pPCIData, uint8_t* cc); |
| 244 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 245 | // Allows sequential RdEndPointConfig to PCI Configuration space |
| 246 | EPECIStatus peci_RdEndPointConfigPci_seq(uint8_t target, uint8_t u8Seg, |
| 247 | uint8_t u8Bus, uint8_t u8Device, |
| 248 | uint8_t u8Fcn, uint16_t u16Reg, |
| 249 | uint8_t u8ReadLen, uint8_t* pPCIData, |
| 250 | int peci_fd, uint8_t* cc); |
| 251 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 252 | // Allows sequential RdEndPointConfig to PCI Configuration space in the |
| 253 | // specified domain |
| 254 | EPECIStatus peci_RdEndPointConfigPci_seq_dom(uint8_t target, uint8_t domainId, |
| 255 | uint8_t u8Seg, uint8_t u8Bus, |
| 256 | uint8_t u8Device, uint8_t u8Fcn, |
| 257 | uint16_t u16Reg, uint8_t u8ReadLen, |
| 258 | uint8_t* pPCIData, int peci_fd, |
| 259 | uint8_t* cc); |
| 260 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 261 | // Provides read access to the local PCI configuration space |
| 262 | EPECIStatus peci_RdEndPointConfigPciLocal(uint8_t target, uint8_t u8Seg, |
| 263 | uint8_t u8Bus, uint8_t u8Device, |
| 264 | uint8_t u8Fcn, uint16_t u16Reg, |
| 265 | uint8_t u8ReadLen, uint8_t* pPCIData, |
| 266 | uint8_t* cc); |
| 267 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 268 | // Provides read access to the local PCI configuration space in the specified |
| 269 | // domain |
| 270 | EPECIStatus peci_RdEndPointConfigPciLocal_dom(uint8_t target, uint8_t domainId, |
| 271 | uint8_t u8Seg, uint8_t u8Bus, |
| 272 | uint8_t u8Device, uint8_t u8Fcn, |
| 273 | uint16_t u16Reg, |
| 274 | uint8_t u8ReadLen, |
| 275 | uint8_t* pPCIData, uint8_t* cc); |
| 276 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 277 | // Allows sequential RdEndPointConfig to the local PCI Configuration space |
| 278 | EPECIStatus peci_RdEndPointConfigPciLocal_seq(uint8_t target, uint8_t u8Seg, |
| 279 | uint8_t u8Bus, uint8_t u8Device, |
| 280 | uint8_t u8Fcn, uint16_t u16Reg, |
| 281 | uint8_t u8ReadLen, |
| 282 | uint8_t* pPCIData, int peci_fd, |
| 283 | uint8_t* cc); |
| 284 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 285 | // Allows sequential RdEndPointConfig to the local PCI Configuration space in |
| 286 | // the specified domain |
| 287 | EPECIStatus peci_RdEndPointConfigPciLocal_seq_dom( |
| 288 | uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus, |
| 289 | uint8_t u8Device, uint8_t u8Fcn, uint16_t u16Reg, uint8_t u8ReadLen, |
| 290 | uint8_t* pPCIData, int peci_fd, uint8_t* cc); |
| 291 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 292 | // Provides read access to PCI MMIO space |
| 293 | EPECIStatus peci_RdEndPointConfigMmio(uint8_t target, uint8_t u8Seg, |
| 294 | uint8_t u8Bus, uint8_t u8Device, |
| 295 | uint8_t u8Fcn, uint8_t u8Bar, |
| 296 | uint8_t u8AddrType, uint64_t u64Offset, |
| 297 | uint8_t u8ReadLen, uint8_t* pMmioData, |
| 298 | uint8_t* cc); |
| 299 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 300 | // Provides read access to PCI MMIO space in the specified domain |
| 301 | EPECIStatus peci_RdEndPointConfigMmio_dom(uint8_t target, uint8_t domainId, |
| 302 | uint8_t u8Seg, uint8_t u8Bus, |
| 303 | uint8_t u8Device, uint8_t u8Fcn, |
| 304 | uint8_t u8Bar, uint8_t u8AddrType, |
| 305 | uint64_t u64Offset, uint8_t u8ReadLen, |
| 306 | uint8_t* pMmioData, uint8_t* cc); |
| 307 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 308 | // Allows sequential RdEndPointConfig to PCI MMIO space |
| 309 | EPECIStatus peci_RdEndPointConfigMmio_seq( |
| 310 | uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device, |
| 311 | uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset, |
| 312 | uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd, uint8_t* cc); |
| 313 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 314 | // Allows sequential RdEndPointConfig to PCI MMIO space in the specified domain |
| 315 | EPECIStatus peci_RdEndPointConfigMmio_seq_dom( |
| 316 | uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus, |
| 317 | uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, |
| 318 | uint64_t u64Offset, uint8_t u8ReadLen, uint8_t* pMmioData, int peci_fd, |
| 319 | uint8_t* cc); |
| 320 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 321 | // Provides write access to the EP local PCI Configuration space |
| 322 | EPECIStatus peci_WrEndPointPCIConfigLocal(uint8_t target, uint8_t u8Seg, |
| 323 | uint8_t u8Bus, uint8_t u8Device, |
| 324 | uint8_t u8Fcn, uint16_t u16Reg, |
| 325 | uint8_t DataLen, uint32_t DataVal, |
| 326 | uint8_t* cc); |
| 327 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 328 | // Provides write access to the EP local PCI Configuration space in the |
| 329 | // specified domain |
| 330 | EPECIStatus peci_WrEndPointPCIConfigLocal_dom(uint8_t target, uint8_t domainId, |
| 331 | uint8_t u8Seg, uint8_t u8Bus, |
| 332 | uint8_t u8Device, uint8_t u8Fcn, |
| 333 | uint16_t u16Reg, uint8_t DataLen, |
| 334 | uint32_t DataVal, uint8_t* cc); |
| 335 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 336 | // Provides write access to the EP PCI Configuration space |
| 337 | EPECIStatus peci_WrEndPointPCIConfig(uint8_t target, uint8_t u8Seg, |
| 338 | uint8_t u8Bus, uint8_t u8Device, |
| 339 | uint8_t u8Fcn, uint16_t u16Reg, |
| 340 | uint8_t DataLen, uint32_t DataVal, |
| 341 | uint8_t* cc); |
| 342 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 343 | // Provides write access to the EP PCI Configuration space in the specified |
| 344 | // domain |
| 345 | EPECIStatus peci_WrEndPointPCIConfig_dom(uint8_t target, uint8_t domainId, |
| 346 | uint8_t u8Seg, uint8_t u8Bus, |
| 347 | uint8_t u8Device, uint8_t u8Fcn, |
| 348 | uint16_t u16Reg, uint8_t DataLen, |
| 349 | uint32_t DataVal, uint8_t* cc); |
| 350 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 351 | // Allows sequential write access to the EP PCI Configuration space |
| 352 | EPECIStatus peci_WrEndPointConfig_seq(uint8_t target, uint8_t u8MsgType, |
| 353 | uint8_t u8Seg, uint8_t u8Bus, |
| 354 | uint8_t u8Device, uint8_t u8Fcn, |
| 355 | uint16_t u16Reg, uint8_t DataLen, |
| 356 | uint32_t DataVal, int peci_fd, |
| 357 | uint8_t* cc); |
| 358 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 359 | // Allows sequential write access to the EP PCI Configuration space in the |
| 360 | // specified domain |
| 361 | EPECIStatus peci_WrEndPointConfig_seq_dom(uint8_t target, uint8_t domainId, |
| 362 | uint8_t u8MsgType, uint8_t u8Seg, |
| 363 | uint8_t u8Bus, uint8_t u8Device, |
| 364 | uint8_t u8Fcn, uint16_t u16Reg, |
| 365 | uint8_t DataLen, uint32_t DataVal, |
| 366 | int peci_fd, uint8_t* cc); |
| 367 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 368 | // Provides write access to the EP PCI MMIO space |
| 369 | EPECIStatus peci_WrEndPointConfigMmio(uint8_t target, uint8_t u8Seg, |
| 370 | uint8_t u8Bus, uint8_t u8Device, |
| 371 | uint8_t u8Fcn, uint8_t u8Bar, |
| 372 | uint8_t u8AddrType, uint64_t u64Offset, |
| 373 | uint8_t u8DataLen, uint64_t u64DataVal, |
| 374 | uint8_t* cc); |
| 375 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 376 | // Provides write access to the EP PCI MMIO space in the specified domain |
| 377 | EPECIStatus peci_WrEndPointConfigMmio_dom(uint8_t target, uint8_t domainId, |
| 378 | uint8_t u8Seg, uint8_t u8Bus, |
| 379 | uint8_t u8Device, uint8_t u8Fcn, |
| 380 | uint8_t u8Bar, uint8_t u8AddrType, |
| 381 | uint64_t u64Offset, uint8_t u8DataLen, |
| 382 | uint64_t u64DataVal, uint8_t* cc); |
| 383 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 384 | // Allows sequential write access to the EP PCI MMIO space |
| 385 | EPECIStatus peci_WrEndPointConfigMmio_seq( |
| 386 | uint8_t target, uint8_t u8Seg, uint8_t u8Bus, uint8_t u8Device, |
| 387 | uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, uint64_t u64Offset, |
| 388 | uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd, uint8_t* cc); |
| 389 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 390 | // Allows sequential write access to the EP PCI MMIO space in the specified |
| 391 | // domain |
| 392 | EPECIStatus peci_WrEndPointConfigMmio_seq_dom( |
| 393 | uint8_t target, uint8_t domainId, uint8_t u8Seg, uint8_t u8Bus, |
| 394 | uint8_t u8Device, uint8_t u8Fcn, uint8_t u8Bar, uint8_t u8AddrType, |
| 395 | uint64_t u64Offset, uint8_t u8DataLen, uint64_t u64DataVal, int peci_fd, |
| 396 | uint8_t* cc); |
| 397 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 398 | // Provides access to the Crashdump Discovery API |
| 399 | EPECIStatus peci_CrashDump_Discovery(uint8_t target, uint8_t subopcode, |
| 400 | uint8_t param0, uint16_t param1, |
| 401 | uint8_t param2, uint8_t u8ReadLen, |
| 402 | uint8_t* pData, uint8_t* cc); |
| 403 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 404 | // Provides access to the Crashdump Discovery API in the specified domain |
| 405 | EPECIStatus peci_CrashDump_Discovery_dom(uint8_t target, uint8_t domainId, |
| 406 | uint8_t subopcode, uint8_t param0, |
| 407 | uint16_t param1, uint8_t param2, |
| 408 | uint8_t u8ReadLen, uint8_t* pData, |
| 409 | uint8_t* cc); |
| 410 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 411 | // Provides access to the Crashdump GetFrame API |
| 412 | EPECIStatus peci_CrashDump_GetFrame(uint8_t target, uint16_t param0, |
| 413 | uint16_t param1, uint16_t param2, |
| 414 | uint8_t u8ReadLen, uint8_t* pData, |
| 415 | uint8_t* cc); |
| 416 | |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 417 | // Provides access to the Crashdump GetFrame API in the specified domain |
| 418 | EPECIStatus peci_CrashDump_GetFrame_dom(uint8_t target, uint8_t domainId, |
| 419 | uint16_t param0, uint16_t param1, |
| 420 | uint16_t param2, uint8_t u8ReadLen, |
| 421 | uint8_t* pData, uint8_t* cc); |
| 422 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 423 | // Provides raw PECI command access |
| 424 | EPECIStatus peci_raw(uint8_t target, uint8_t u8ReadLen, const uint8_t* pRawCmd, |
| 425 | const uint32_t cmdSize, uint8_t* pRawResp, |
| 426 | uint32_t respSize); |
| 427 | |
| 428 | EPECIStatus peci_Lock(int* peci_fd, int timeout_ms); |
| 429 | void peci_Unlock(int peci_fd); |
| 430 | EPECIStatus peci_Ping(uint8_t target); |
| 431 | EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd); |
| 432 | EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel, |
| 433 | uint8_t* stepping, uint8_t* cc); |
Anna Platash | 03d7dae | 2021-02-05 13:52:05 +0100 | [diff] [blame] | 434 | void peci_SetDevName(char* peci_dev); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 435 | |
| 436 | #ifdef __cplusplus |
| 437 | } |
| 438 | #endif |