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