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 |
Patrick Williams | 7169faa | 2023-05-10 07:51:24 -0500 | [diff] [blame] | 18 | extern "C" |
| 19 | { |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 20 | #endif |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 21 | #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. Bills | a2ceec2 | 2020-05-05 13:16:00 -0700 | [diff] [blame] | 29 | // 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 Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 33 | typedef enum |
| 34 | { |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 35 | skylake = 0x00050650, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 36 | skx = 0x00050650, |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 37 | iceLake = 0x000606A0, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 38 | icx = 0x000606A0, |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 39 | iceLakeD = 0x000606C0, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 40 | icxd = 0x000606C0, |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 41 | sapphireRapids = 0x000806F0, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 42 | spr = 0x000806F0, |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 43 | emeraldRapids = 0x000C06F0, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 44 | emr = 0x000C06F0, |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 45 | graniteRapids = 0x000A06D0, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 46 | gnr = 0x000A06D0, |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 47 | graniteRapidsD = 0x000A06E0, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 48 | gnrd = 0x000A06E0, |
Jason M. Bills | 127609c | 2024-04-01 12:57:08 -0700 | [diff] [blame^] | 49 | sierraForest = 0x000A06F0, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 50 | srf = 0x000A06F0, |
| 51 | } CPUModel; |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 52 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 53 | // PECI Status Codes |
| 54 | typedef 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 64 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 65 | // PECI Timeout Options |
| 66 | typedef enum |
| 67 | { |
| 68 | PECI_WAIT_FOREVER = -1, |
| 69 | PECI_NO_WAIT = 0, |
| 70 | } EPECITimeout; |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 71 | |
| 72 | #define PECI_TIMEOUT_RESOLUTION_MS 10 // 10 ms |
| 73 | #define PECI_TIMEOUT_MS 100 // 100 ms |
| 74 | |
| 75 | // VCU Index and Sequence Paramaters |
| 76 | #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 Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 83 | typedef 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 100 | |
| 101 | #define MBX_INDEX_VCU 128 // VCU Index |
| 102 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 103 | typedef enum |
| 104 | { |
| 105 | MMIO_DWORD_OFFSET = 0x05, |
| 106 | MMIO_QWORD_OFFSET = 0x06, |
| 107 | } EEndPtMmioAddrType; |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 108 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 109 | // Find the specified PCI bus number value |
| 110 | EPECIStatus FindBusNumber(uint8_t u8Bus, uint8_t u8Cpu, uint8_t* pu8BusValue); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 111 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 112 | // Gets the temperature from the target |
| 113 | // Expressed in signed fixed point value of 1/64 degrees celsius |
| 114 | EPECIStatus peci_GetTemp(uint8_t target, int16_t* temperature); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 115 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 116 | // Provides read access to the package configuration space within the |
| 117 | // processor |
| 118 | EPECIStatus 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 |
| 124 | EPECIStatus 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 |
| 130 | EPECIStatus peci_RdPkgConfig_seq(uint8_t target, uint8_t u8Index, |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 131 | uint16_t u16Value, uint8_t u8ReadLen, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 132 | uint8_t* pPkgConfig, int peci_fd, uint8_t* cc); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 133 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 134 | // Allows sequential RdPkgConfig with the provided peci file descriptor in |
| 135 | // the specified domain |
| 136 | EPECIStatus peci_RdPkgConfig_seq_dom(uint8_t target, uint8_t domainId, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 137 | uint8_t u8Index, uint16_t u16Value, |
| 138 | uint8_t u8ReadLen, uint8_t* pPkgConfig, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 139 | int peci_fd, uint8_t* cc); |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 140 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 141 | // Provides write access to the package configuration space within the |
| 142 | // processor |
| 143 | EPECIStatus peci_WrPkgConfig(uint8_t target, uint8_t u8Index, uint16_t u16Param, |
| 144 | uint32_t u32Value, uint8_t u8WriteLen, |
| 145 | uint8_t* cc); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 146 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 147 | // Provides write access to the package configuration space within the |
| 148 | // processor in the specified domain |
| 149 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 153 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 154 | // Allows sequential WrPkgConfig with the provided peci file descriptor |
| 155 | EPECIStatus peci_WrPkgConfig_seq(uint8_t target, uint8_t u8Index, |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 156 | uint16_t u16Param, uint32_t u32Value, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 157 | uint8_t u8WriteLen, int peci_fd, uint8_t* cc); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 158 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 159 | // Allows sequential WrPkgConfig with the provided peci file descriptor in |
| 160 | // the specified domain |
| 161 | EPECIStatus peci_WrPkgConfig_seq_dom(uint8_t target, uint8_t domainId, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 162 | uint8_t u8Index, uint16_t u16Param, |
| 163 | uint32_t u32Value, uint8_t u8WriteLen, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 164 | int peci_fd, uint8_t* cc); |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 165 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 166 | // Provides read access to Model Specific Registers |
| 167 | EPECIStatus peci_RdIAMSR(uint8_t target, uint8_t threadID, uint16_t MSRAddress, |
| 168 | uint64_t* u64MsrVal, uint8_t* cc); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 169 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 170 | // Provides read access to Model Specific Registers in the specified domain |
| 171 | EPECIStatus peci_RdIAMSR_dom(uint8_t target, uint8_t domainId, uint8_t threadID, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 172 | uint16_t MSRAddress, uint64_t* u64MsrVal, |
| 173 | uint8_t* cc); |
| 174 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 175 | // Provides read access to PCI Configuration space |
| 176 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 179 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 180 | // Provides read access to PCI Configuration space in the specified domain |
| 181 | EPECIStatus peci_RdPCIConfig_dom(uint8_t target, uint8_t domainId, |
| 182 | uint8_t u8Bus, uint8_t u8Device, uint8_t u8Fcn, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 183 | uint16_t u16Reg, uint8_t* pPCIReg, |
| 184 | uint8_t* cc); |
| 185 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 186 | // Allows sequential RdPCIConfig with the provided peci file descriptor |
| 187 | EPECIStatus 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 |
| 194 | EPECIStatus peci_RdPCIConfig_seq_dom(uint8_t target, uint8_t domainId, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 195 | uint8_t u8Bus, uint8_t u8Device, |
| 196 | uint8_t u8Fcn, uint16_t u16Reg, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 197 | uint8_t* pPCIData, int peci_fd, |
| 198 | uint8_t* cc); |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 199 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 200 | // Provides read access to the local PCI Configuration space |
| 201 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 205 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 206 | // Provides read access to the local PCI Configuration space in the |
| 207 | // specified domain |
| 208 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 213 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 214 | // Allows sequential RdPCIConfigLocal with the provided peci file descriptor |
| 215 | EPECIStatus peci_RdPCIConfigLocal_seq(uint8_t target, uint8_t u8Bus, |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 216 | uint8_t u8Device, uint8_t u8Fcn, |
| 217 | uint16_t u16Reg, uint8_t u8ReadLen, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 218 | uint8_t* pPCIReg, int peci_fd, |
| 219 | uint8_t* cc); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 220 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 221 | // Allows sequential RdPCIConfigLocal with the provided peci file descriptor |
| 222 | // in the specified domain |
| 223 | EPECIStatus peci_RdPCIConfigLocal_seq_dom(uint8_t target, uint8_t domainId, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 224 | uint8_t u8Bus, uint8_t u8Device, |
| 225 | uint8_t u8Fcn, uint16_t u16Reg, |
| 226 | uint8_t u8ReadLen, uint8_t* pPCIReg, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 227 | int peci_fd, uint8_t* cc); |
| 228 | |
| 229 | // Provides write access to the local PCI Configuration space |
| 230 | EPECIStatus 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 |
| 237 | EPECIStatus 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 |
| 244 | EPECIStatus 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 |
| 251 | EPECIStatus 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 |
| 258 | EPECIStatus 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 |
| 266 | EPECIStatus 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 |
| 274 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 278 | uint8_t* cc); |
| 279 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 280 | // Provides read access to the local PCI configuration space in the |
| 281 | // specified domain |
| 282 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 288 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 289 | // Allows sequential RdEndPointConfig to the local PCI Configuration space |
| 290 | EPECIStatus peci_RdEndPointConfigPciLocal_seq(uint8_t target, uint8_t u8Seg, |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 291 | uint8_t u8Bus, uint8_t u8Device, |
| 292 | uint8_t u8Fcn, uint16_t u16Reg, |
| 293 | uint8_t u8ReadLen, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 294 | uint8_t* pPCIData, int peci_fd, |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 295 | uint8_t* cc); |
| 296 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 297 | // Allows sequential RdEndPointConfig to the local PCI Configuration space |
| 298 | // in the specified domain |
| 299 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 303 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 304 | // Provides read access to PCI MMIO space |
| 305 | EPECIStatus 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 |
| 313 | EPECIStatus 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 |
| 321 | EPECIStatus 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 |
| 328 | EPECIStatus 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 |
| 335 | EPECIStatus peci_WrEndPointPCIConfigLocal(uint8_t target, uint8_t u8Seg, |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 336 | 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 Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 341 | // Provides write access to the EP local PCI Configuration space in the |
| 342 | // specified domain |
| 343 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 348 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 349 | // Provides write access to the EP PCI Configuration space |
| 350 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 355 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 356 | // Provides write access to the EP PCI Configuration space in the specified |
| 357 | // domain |
| 358 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 363 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 364 | // Allows sequential write access to the EP PCI Configuration space |
| 365 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 371 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 372 | // Allows sequential write access to the EP PCI Configuration space in the |
| 373 | // specified domain |
| 374 | EPECIStatus peci_WrEndPointConfig_seq_dom(uint8_t target, uint8_t domainId, |
| 375 | uint8_t u8MsgType, uint8_t u8Seg, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 376 | uint8_t u8Bus, uint8_t u8Device, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 377 | uint8_t u8Fcn, uint16_t u16Reg, |
| 378 | uint8_t DataLen, uint32_t DataVal, |
| 379 | int peci_fd, uint8_t* cc); |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 380 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 381 | // Provides write access to the EP PCI MMIO space |
| 382 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 388 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 389 | // Provides write access to the EP PCI MMIO space in the specified domain |
| 390 | EPECIStatus peci_WrEndPointConfigMmio_dom(uint8_t target, uint8_t domainId, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 391 | uint8_t u8Seg, uint8_t u8Bus, |
| 392 | uint8_t u8Device, uint8_t u8Fcn, |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 393 | uint8_t u8Bar, uint8_t u8AddrType, |
Jason M. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 394 | uint64_t u64Offset, uint8_t u8DataLen, |
| 395 | uint64_t u64DataVal, uint8_t* cc); |
| 396 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 397 | // Allows sequential write access to the EP PCI MMIO space |
| 398 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 402 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 403 | // Allows sequential write access to the EP PCI MMIO space in the specified |
| 404 | // domain |
| 405 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 410 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 411 | // Provides access to the Crashdump Discovery API |
| 412 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 416 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 417 | // Provides access to the Crashdump Discovery API in the specified domain |
| 418 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 423 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 424 | // Provides access to the Crashdump GetFrame API |
| 425 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 429 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 430 | // Provides access to the Crashdump GetFrame API in the specified domain |
| 431 | EPECIStatus 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. Bills | 8bb8f37 | 2022-03-01 16:04:44 -0800 | [diff] [blame] | 435 | |
Patrick Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 436 | // Provides raw PECI command access |
| 437 | EPECIStatus 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. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 440 | |
Zbigniew Kurzynski | f2a5fa2 | 2023-11-06 13:48:11 +0100 | [diff] [blame] | 441 | // Provides sequential raw PECI command access |
| 442 | EPECIStatus 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 Williams | 0621dc0 | 2023-10-20 11:19:59 -0500 | [diff] [blame] | 446 | EPECIStatus peci_Lock(int* peci_fd, int timeout_ms); |
| 447 | void peci_Unlock(int peci_fd); |
| 448 | EPECIStatus peci_Ping(uint8_t target); |
| 449 | EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd); |
| 450 | EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel, |
| 451 | uint8_t* stepping, uint8_t* cc); |
| 452 | void peci_SetDevName(char* peci_dev); |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 453 | |
| 454 | #ifdef __cplusplus |
| 455 | } |
| 456 | #endif |