| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#ifndef __ACPI_ACPI_H__ |
| 8 |
#define __ACPI_ACPI_H__ |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#if CONFIG(ACPI_INTEL_HARDWARE_SLEEP_VALUES) |
| 15 |
#define SLP_EN (1 << 13) |
| 16 |
#define SLP_TYP_SHIFT 10 |
| 17 |
#define SLP_TYP (7 << SLP_TYP_SHIFT) |
| 18 |
#define SLP_TYP_S0 0 |
| 19 |
#define SLP_TYP_S1 1 |
| 20 |
#define SLP_TYP_S3 5 |
| 21 |
#define SLP_TYP_S4 6 |
| 22 |
#define SLP_TYP_S5 7 |
| 23 |
#elif CONFIG(ACPI_AMD_HARDWARE_SLEEP_VALUES) |
| 24 |
#define SLP_EN (1 << 13) |
| 25 |
#define SLP_TYP_SHIFT 10 |
| 26 |
#define SLP_TYP (7 << SLP_TYP_SHIFT) |
| 27 |
#define SLP_TYP_S0 0 |
| 28 |
#define SLP_TYP_S1 1 |
| 29 |
#define SLP_TYP_S3 3 |
| 30 |
#define SLP_TYP_S4 4 |
| 31 |
#define SLP_TYP_S5 5 |
| 32 |
#endif |
| 33 |
|
| 34 |
#define ACPI_TABLE_CREATOR "COREBOOT" |
| 35 |
#define OEM_ID "COREv4" |
| 36 |
#define ACPI_DSDT_REV_1 0x01 |
| 37 |
#define ACPI_DSDT_REV_2 0x02 |
| 38 |
|
| 39 |
#if !defined(__ASSEMBLER__) && !defined(__ACPI__) |
| 40 |
#include <commonlib/helpers.h> |
| 41 |
#include <device/device.h> |
| 42 |
#include <uuid.h> |
| 43 |
#include <cper.h> |
| 44 |
#include <romstage_handoff.h> |
| 45 |
#include <types.h> |
| 46 |
|
| 47 |
enum acpi_device_sleep_states { |
| 48 |
ACPI_DEVICE_SLEEP_D0 = 0, |
| 49 |
ACPI_DEVICE_SLEEP_D1 = 1, |
| 50 |
ACPI_DEVICE_SLEEP_D2 = 2, |
| 51 |
ACPI_DEVICE_SLEEP_D3 = 3, |
| 52 |
ACPI_DEVICE_SLEEP_D3_HOT = ACPI_DEVICE_SLEEP_D3, |
| 53 |
ACPI_DEVICE_SLEEP_D3_COLD = 4, |
| 54 |
ACPI_DEVICE_SLEEP_NONE = 5, |
| 55 |
}; |
| 56 |
|
| 57 |
#define RSDP_SIG "RSD PTR " |
| 58 |
#define ASLC "CORE" |
| 59 |
|
| 60 |
#define ACPI_NAME_BUFFER_SIZE 5 |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
#define COREBOOT_ACPI_ID "BOOT" |
| 67 |
|
| 68 |
|
| 69 |
enum coreboot_acpi_ids { |
| 70 |
COREBOOT_ACPI_ID_CBTABLE = 0x0000, |
| 71 |
COREBOOT_ACPI_ID_IGD_GMBUS_ARB = 0x0001, |
| 72 |
COREBOOT_ACPI_ID_IGD_GMBUS_LINK = 0x0002, |
| 73 |
COREBOOT_ACPI_ID_AMDGFX_ACP = 0x0003, |
| 74 |
COREBOOT_ACPI_ID_MAX = 0xFFFF, |
| 75 |
}; |
| 76 |
|
| 77 |
enum acpi_tables { |
| 78 |
|
| 79 |
BERT, |
| 80 |
CEDT, |
| 81 |
DBG2, |
| 82 |
DMAR, |
| 83 |
DSDT, |
| 84 |
ECDT, |
| 85 |
EINJ, |
| 86 |
FACS, |
| 87 |
FADT, |
| 88 |
GTDT, |
| 89 |
HEST, |
| 90 |
HMAT, |
| 91 |
HPET, |
| 92 |
IVRS, |
| 93 |
LPIT, |
| 94 |
MADT, |
| 95 |
MCFG, |
| 96 |
PPTT, |
| 97 |
RSDP, |
| 98 |
RSDT, |
| 99 |
SLIT, |
| 100 |
SPCR, |
| 101 |
SRAT, |
| 102 |
SSDT, |
| 103 |
TCPA, |
| 104 |
TPM2, |
| 105 |
WDAT, |
| 106 |
XSDT, |
| 107 |
|
| 108 |
CRAT, |
| 109 |
IORT, |
| 110 |
NHLT, |
| 111 |
SPMI, |
| 112 |
VFCT |
| 113 |
}; |
| 114 |
|
| 115 |
|
| 116 |
typedef struct acpi_rsdp { |
| 117 |
char signature[8]; |
| 118 |
u8 checksum; |
| 119 |
char oem_id[6]; |
| 120 |
u8 revision; |
| 121 |
u32 rsdt_address; |
| 122 |
u32 length; |
| 123 |
u64 xsdt_address; |
| 124 |
u8 ext_checksum; |
| 125 |
u8 reserved[3]; |
| 126 |
} __packed acpi_rsdp_t; |
| 127 |
|
| 128 |
|
| 129 |
typedef struct acpi_gen_regaddr { |
| 130 |
u8 space_id; |
| 131 |
u8 bit_width; |
| 132 |
u8 bit_offset; |
| 133 |
u8 access_size; |
| 134 |
u32 addrl; |
| 135 |
u32 addrh; |
| 136 |
} __packed acpi_addr_t; |
| 137 |
|
| 138 |
#define ACPI_ADDRESS_SPACE_MEMORY 0 |
| 139 |
#define ACPI_ADDRESS_SPACE_IO 1 |
| 140 |
#define ACPI_ADDRESS_SPACE_PCI 2 |
| 141 |
#define ACPI_ADDRESS_SPACE_EC 3 |
| 142 |
#define ACPI_ADDRESS_SPACE_SMBUS 4 |
| 143 |
#define ACPI_ADDRESS_SPACE_CMOS 5 |
| 144 |
#define ACPI_ADDRESS_SPACE_PCI_BAR_TARGET 6 |
| 145 |
#define ACPI_ADDRESS_SPACE_IPMI 7 |
| 146 |
#define ACPI_ADDRESS_SPACE_GENERAL_PURPOSE_IO 8 |
| 147 |
#define ACPI_ADDRESS_SPACE_GENERIC_SERIAL_BUS 9 |
| 148 |
#define ACPI_ADDRESS_SPACE_PCC 0x0A |
| 149 |
#define ACPI_ADDRESS_SPACE_FIXED 0x7f |
| 150 |
#define ACPI_FFIXEDHW_VENDOR_INTEL 1 |
| 151 |
#define ACPI_FFIXEDHW_CLASS_HLT 0 |
| 152 |
#define ACPI_FFIXEDHW_CLASS_IO_HLT 1 |
| 153 |
#define ACPI_FFIXEDHW_CLASS_MWAIT 2 |
| 154 |
#define ACPI_FFIXEDHW_FLAG_HW_COORD 1 |
| 155 |
#define ACPI_FFIXEDHW_FLAG_BM_STS 2 |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
#define ACPI_ACCESS_SIZE_UNDEFINED 0 |
| 161 |
#define ACPI_ACCESS_SIZE_BYTE_ACCESS 1 |
| 162 |
#define ACPI_ACCESS_SIZE_WORD_ACCESS 2 |
| 163 |
#define ACPI_ACCESS_SIZE_DWORD_ACCESS 3 |
| 164 |
#define ACPI_ACCESS_SIZE_QWORD_ACCESS 4 |
| 165 |
|
| 166 |
|
| 167 |
#define ACPI_REG_MSR(address, offset, width) \ |
| 168 |
(acpi_addr_t){ \ |
| 169 |
.space_id = ACPI_ADDRESS_SPACE_FIXED, \ |
| 170 |
.access_size = ACPI_ACCESS_SIZE_QWORD_ACCESS, \ |
| 171 |
.addrl = address, \ |
| 172 |
.bit_offset = offset, \ |
| 173 |
.bit_width = width, \ |
| 174 |
} |
| 175 |
|
| 176 |
#define ACPI_REG_UNSUPPORTED (acpi_addr_t){0} |
| 177 |
|
| 178 |
|
| 179 |
#define ACPI_HID_FDC "PNP0700" |
| 180 |
#define ACPI_HID_KEYBOARD "PNP0303" |
| 181 |
#define ACPI_HID_MOUSE "PNP0F03" |
| 182 |
#define ACPI_HID_COM "PNP0501" |
| 183 |
#define ACPI_HID_LPT "PNP0400" |
| 184 |
#define ACPI_HID_PNP "PNP0C02" |
| 185 |
#define ACPI_HID_CONTAINER "PNP0A05" |
| 186 |
|
| 187 |
|
| 188 |
typedef struct acpi_table_header { |
| 189 |
char signature[4]; |
| 190 |
u32 length; |
| 191 |
u8 revision; |
| 192 |
u8 checksum; |
| 193 |
char oem_id[6]; |
| 194 |
char oem_table_id[8]; |
| 195 |
u32 oem_revision; |
| 196 |
char asl_compiler_id[4]; |
| 197 |
u32 asl_compiler_revision; |
| 198 |
} __packed acpi_header_t; |
| 199 |
|
| 200 |
|
| 201 |
#define MAX_ACPI_TABLES 32 |
| 202 |
|
| 203 |
|
| 204 |
typedef struct acpi_rsdt { |
| 205 |
acpi_header_t header; |
| 206 |
u32 entry[MAX_ACPI_TABLES]; |
| 207 |
} __packed acpi_rsdt_t; |
| 208 |
|
| 209 |
|
| 210 |
typedef struct acpi_xsdt { |
| 211 |
acpi_header_t header; |
| 212 |
u64 entry[MAX_ACPI_TABLES]; |
| 213 |
} __packed acpi_xsdt_t; |
| 214 |
|
| 215 |
|
| 216 |
typedef struct acpi_hpet { |
| 217 |
acpi_header_t header; |
| 218 |
u32 id; |
| 219 |
acpi_addr_t addr; |
| 220 |
u8 number; |
| 221 |
u16 min_tick; |
| 222 |
u8 attributes; |
| 223 |
} __packed acpi_hpet_t; |
| 224 |
|
| 225 |
|
| 226 |
typedef struct acpi_mcfg { |
| 227 |
acpi_header_t header; |
| 228 |
u8 reserved[8]; |
| 229 |
} __packed acpi_mcfg_t; |
| 230 |
|
| 231 |
typedef struct acpi_tcpa { |
| 232 |
acpi_header_t header; |
| 233 |
u16 platform_class; |
| 234 |
u32 laml; |
| 235 |
u64 lasa; |
| 236 |
} __packed acpi_tcpa_t; |
| 237 |
|
| 238 |
typedef struct acpi_tpm2 { |
| 239 |
acpi_header_t header; |
| 240 |
u16 platform_class; |
| 241 |
u8 reserved[2]; |
| 242 |
u64 control_area; |
| 243 |
u32 start_method; |
| 244 |
u8 msp[12]; |
| 245 |
u32 laml; |
| 246 |
u64 lasa; |
| 247 |
} __packed acpi_tpm2_t; |
| 248 |
|
| 249 |
typedef struct acpi_mcfg_mmconfig { |
| 250 |
u64 base_address; |
| 251 |
u16 pci_segment_group_number; |
| 252 |
u8 start_bus_number; |
| 253 |
u8 end_bus_number; |
| 254 |
u8 reserved[4]; |
| 255 |
} __packed acpi_mcfg_mmconfig_t; |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
typedef struct acpi_cedt { |
| 262 |
acpi_header_t header; |
| 263 |
|
| 264 |
} __packed acpi_cedt_t; |
| 265 |
|
| 266 |
#define ACPI_CEDT_STRUCTURE_CHBS 0 |
| 267 |
#define ACPI_CEDT_STRUCTURE_CFMWS 1 |
| 268 |
|
| 269 |
#define ACPI_CEDT_CHBS_CXL_VER_1_1 0x00 |
| 270 |
#define ACPI_CEDT_CHBS_CXL_VER_2_0 0x01 |
| 271 |
|
| 272 |
|
| 273 |
typedef struct acpi_cedt_chbs { |
| 274 |
u8 type; |
| 275 |
u8 resv1; |
| 276 |
u16 length; |
| 277 |
u32 uid; |
| 278 |
u32 cxl_ver; |
| 279 |
u32 resv2; |
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
u64 base; |
| 285 |
u64 len; |
| 286 |
} __packed acpi_cedt_chbs_t; |
| 287 |
|
| 288 |
#define ACPI_CEDT_CFMWS_RESTRICTION_TYPE_2_MEM (1 << 0) |
| 289 |
#define ACPI_CEDT_CFMWS_RESTRICTION_TYPE_3_MEM (1 << 1) |
| 290 |
#define ACPI_CEDT_CFMWS_RESTRICTION_VOLATIL (1 << 2) |
| 291 |
#define ACPI_CEDT_CFMWS_RESTRICTION_PERSISTENT (1 << 3) |
| 292 |
#define ACPI_CEDT_CFMWS_RESTRICTION_FIXED (1 << 4) |
| 293 |
|
| 294 |
|
| 295 |
typedef struct acpi_cedt_cfmws { |
| 296 |
u8 type; |
| 297 |
u8 resv1; |
| 298 |
u16 length; |
| 299 |
u32 resv2; |
| 300 |
u64 base_hpa; |
| 301 |
u64 window_size; |
| 302 |
u8 eniw; |
| 303 |
u8 interleave_arithmetic; |
| 304 |
u16 resv3; |
| 305 |
u32 hbig; |
| 306 |
u16 restriction; |
| 307 |
u16 qtg_id; |
| 308 |
u32 interleave_target[]; |
| 309 |
} __packed acpi_cedt_cfmws_t; |
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
typedef struct acpi_hmat { |
| 316 |
acpi_header_t header; |
| 317 |
u32 resv; |
| 318 |
|
| 319 |
} __packed acpi_hmat_t; |
| 320 |
|
| 321 |
|
| 322 |
typedef struct acpi_hmat_mpda { |
| 323 |
u16 type; |
| 324 |
u16 resv; |
| 325 |
u32 length; |
| 326 |
u16 flags; |
| 327 |
u16 resv1; |
| 328 |
u32 proximity_domain_initiator; |
| 329 |
u32 proximity_domain_memory; |
| 330 |
u32 resv2; |
| 331 |
u64 resv3; |
| 332 |
u64 resv4; |
| 333 |
} __packed acpi_hmat_mpda_t; |
| 334 |
|
| 335 |
|
| 336 |
typedef struct acpi_hmat_sllbi { |
| 337 |
u16 type; |
| 338 |
u16 resv; |
| 339 |
u32 length; |
| 340 |
u8 flags; |
| 341 |
u8 data_type; |
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
u8 min_transfer_size; |
| 347 |
u8 resv1; |
| 348 |
u32 num_initiator_domains; |
| 349 |
u32 num_target_domains; |
| 350 |
u32 resv2; |
| 351 |
u64 entry_base_unit; |
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
} __packed acpi_hmat_sllbi_t; |
| 356 |
|
| 357 |
|
| 358 |
typedef struct acpi_hmat_msci { |
| 359 |
u16 type; |
| 360 |
u16 resv; |
| 361 |
u32 length; |
| 362 |
u32 domain; |
| 363 |
u32 resv1; |
| 364 |
u64 cache_size; |
| 365 |
|
| 366 |
u32 cache_attributes; |
| 367 |
u16 resv2; |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
u16 num_handlers; |
| 373 |
|
| 374 |
} __packed acpi_hmat_msci_t; |
| 375 |
|
| 376 |
|
| 377 |
typedef struct acpi_srat { |
| 378 |
acpi_header_t header; |
| 379 |
u32 resv; |
| 380 |
u64 resv1; |
| 381 |
|
| 382 |
} __packed acpi_srat_t; |
| 383 |
|
| 384 |
#define ACPI_SRAT_STRUCTURE_LAPIC 0 |
| 385 |
#define ACPI_SRAT_STRUCTURE_MEM 1 |
| 386 |
#define ACPI_SRAT_STRUCTURE_GIA 5 |
| 387 |
|
| 388 |
|
| 389 |
typedef struct acpi_srat_x2apic { |
| 390 |
u8 type; |
| 391 |
u8 length; |
| 392 |
u16 reserved; |
| 393 |
u32 proximity_domain; |
| 394 |
u32 x2apic_id; |
| 395 |
u32 flags; |
| 396 |
u32 clock_domain; |
| 397 |
u32 reserved1; |
| 398 |
} __packed acpi_srat_x2apic_t; |
| 399 |
|
| 400 |
|
| 401 |
typedef struct acpi_srat_lapic { |
| 402 |
u8 type; |
| 403 |
u8 length; |
| 404 |
u8 proximity_domain_7_0; |
| 405 |
u8 apic_id; |
| 406 |
u32 flags; |
| 407 |
u8 local_sapic_eid; |
| 408 |
u8 proximity_domain_31_8[3]; |
| 409 |
u32 clock_domain; |
| 410 |
} __packed acpi_srat_lapic_t; |
| 411 |
|
| 412 |
#define ACPI_SRAT_MEMORY_ENABLED (1 << 0) |
| 413 |
#define ACPI_SRAT_MEMORY_HOT_PLUGGABLE (1 << 1) |
| 414 |
#define ACPI_SRAT_MEMORY_NONVOLATILE (1 << 2) |
| 415 |
|
| 416 |
|
| 417 |
typedef struct acpi_srat_mem { |
| 418 |
u8 type; |
| 419 |
u8 length; |
| 420 |
u32 proximity_domain; |
| 421 |
u16 resv; |
| 422 |
u32 base_address_low; |
| 423 |
u32 base_address_high; |
| 424 |
u32 length_low; |
| 425 |
u32 length_high; |
| 426 |
u32 resv1; |
| 427 |
u32 flags; |
| 428 |
|
| 429 |
|
| 430 |
u32 resv2[2]; |
| 431 |
} __packed acpi_srat_mem_t; |
| 432 |
|
| 433 |
|
| 434 |
typedef struct acpi_srat_gia { |
| 435 |
u8 type; |
| 436 |
u8 length; |
| 437 |
u8 resv; |
| 438 |
u8 dev_handle_type; |
| 439 |
u32 proximity_domain; |
| 440 |
u8 dev_handle[16]; |
| 441 |
u32 flags; |
| 442 |
u32 resv1; |
| 443 |
} __packed acpi_srat_gia_t; |
| 444 |
|
| 445 |
#define ACPI_SRAT_GIA_DEV_HANDLE_ACPI 0 |
| 446 |
#define ACPI_SRAT_GIA_DEV_HANDLE_PCI 1 |
| 447 |
|
| 448 |
|
| 449 |
typedef struct acpi_slit { |
| 450 |
acpi_header_t header; |
| 451 |
|
| 452 |
} __packed acpi_slit_t; |
| 453 |
|
| 454 |
|
| 455 |
typedef struct acpi_madt { |
| 456 |
acpi_header_t header; |
| 457 |
u32 lapic_addr; |
| 458 |
u32 flags; |
| 459 |
} __packed acpi_madt_t; |
| 460 |
|
| 461 |
|
| 462 |
#define ACPI_MADT_PCAT_COMPAT (1 << 0) |
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
typedef struct acpi_lpit { |
| 469 |
acpi_header_t header; |
| 470 |
} __packed acpi_lpit_t; |
| 471 |
|
| 472 |
|
| 473 |
typedef struct acpi_lpi_flags { |
| 474 |
uint32_t disabled : 1; |
| 475 |
uint32_t counter_not_available : 1; |
| 476 |
uint32_t reserved : 30; |
| 477 |
} __packed acpi_lpi_desc_flags_t; |
| 478 |
|
| 479 |
|
| 480 |
enum acpi_lpi_desc_type { |
| 481 |
ACPI_LPI_DESC_TYPE_NATIVE_CSTATE = 0x00, |
| 482 |
|
| 483 |
}; |
| 484 |
|
| 485 |
|
| 486 |
typedef struct acpi_lpi_desc_hdr { |
| 487 |
uint32_t type; |
| 488 |
uint32_t length; |
| 489 |
uint16_t uid; |
| 490 |
uint16_t reserved; |
| 491 |
} __packed acpi_lpi_desc_hdr_t; |
| 492 |
|
| 493 |
#define ACPI_LPIT_CTR_FREQ_TSC 0 |
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
typedef struct acpi_lpi_desc_ncst { |
| 498 |
acpi_lpi_desc_hdr_t header; |
| 499 |
acpi_lpi_desc_flags_t flags; |
| 500 |
acpi_addr_t entry_trigger; |
| 501 |
uint32_t min_residency; |
| 502 |
uint32_t max_latency; |
| 503 |
acpi_addr_t residency_counter; |
| 504 |
uint64_t counter_frequency; |
| 505 |
} __packed acpi_lpi_desc_ncst_t; |
| 506 |
|
| 507 |
#define VFCT_VBIOS_CHECKSUM_OFFSET 0x21 |
| 508 |
|
| 509 |
|
| 510 |
typedef struct acpi_vfct_image_hdr { |
| 511 |
u32 PCIBus; |
| 512 |
u32 PCIDevice; |
| 513 |
u32 PCIFunction; |
| 514 |
u16 VendorID; |
| 515 |
u16 DeviceID; |
| 516 |
u16 SSVID; |
| 517 |
u16 SSID; |
| 518 |
u32 Revision; |
| 519 |
u32 ImageLength; |
| 520 |
u8 VbiosContent[]; |
| 521 |
} __packed acpi_vfct_image_hdr_t; |
| 522 |
|
| 523 |
|
| 524 |
typedef struct acpi_vfct { |
| 525 |
acpi_header_t header; |
| 526 |
u8 TableUUID[16]; |
| 527 |
u32 VBIOSImageOffset; |
| 528 |
u32 Lib1ImageOffset; |
| 529 |
u32 Reserved[4]; |
| 530 |
acpi_vfct_image_hdr_t image_hdr; |
| 531 |
} __packed acpi_vfct_t; |
| 532 |
|
| 533 |
typedef struct acpi_ivrs_info { |
| 534 |
} __packed acpi_ivrs_info_t; |
| 535 |
|
| 536 |
|
| 537 |
typedef struct acpi_ivrs_ivhd { |
| 538 |
uint8_t type; |
| 539 |
uint8_t flags; |
| 540 |
uint16_t length; |
| 541 |
uint16_t device_id; |
| 542 |
uint16_t capability_offset; |
| 543 |
uint32_t iommu_base_low; |
| 544 |
uint32_t iommu_base_high; |
| 545 |
uint16_t pci_segment_group; |
| 546 |
uint16_t iommu_info; |
| 547 |
uint32_t iommu_feature_info; |
| 548 |
uint8_t entry[]; |
| 549 |
} __packed acpi_ivrs_ivhd_t; |
| 550 |
|
| 551 |
|
| 552 |
typedef struct acpi_ivrs { |
| 553 |
acpi_header_t header; |
| 554 |
uint32_t iv_info; |
| 555 |
uint32_t reserved[2]; |
| 556 |
struct acpi_ivrs_ivhd ivhd; |
| 557 |
} __packed acpi_ivrs_t; |
| 558 |
|
| 559 |
|
| 560 |
struct acpi_crat_header { |
| 561 |
acpi_header_t header; |
| 562 |
uint32_t total_entries; |
| 563 |
uint16_t num_nodes; |
| 564 |
uint8_t reserved[6]; |
| 565 |
} __packed; |
| 566 |
|
| 567 |
|
| 568 |
typedef struct ivhd11_iommu_attr { |
| 569 |
uint32_t reserved1 : 13; |
| 570 |
uint32_t perf_counters : 4; |
| 571 |
uint32_t perf_counter_banks : 6; |
| 572 |
uint32_t msi_num_ppr : 5; |
| 573 |
uint32_t reserved2 : 4; |
| 574 |
} __packed ivhd11_iommu_attr_t; |
| 575 |
|
| 576 |
|
| 577 |
typedef struct acpi_ivrs_ivhd_11 { |
| 578 |
uint8_t type; |
| 579 |
uint8_t flags; |
| 580 |
uint16_t length; |
| 581 |
uint16_t device_id; |
| 582 |
uint16_t capability_offset; |
| 583 |
uint32_t iommu_base_low; |
| 584 |
uint32_t iommu_base_high; |
| 585 |
uint16_t pci_segment_group; |
| 586 |
uint16_t iommu_info; |
| 587 |
struct ivhd11_iommu_attr iommu_attributes; |
| 588 |
uint32_t efr_reg_image_low; |
| 589 |
uint32_t efr_reg_image_high; |
| 590 |
uint32_t reserved[2]; |
| 591 |
uint8_t entry[]; |
| 592 |
} __packed acpi_ivrs_ivhd11_t; |
| 593 |
|
| 594 |
enum dev_scope_type { |
| 595 |
SCOPE_PCI_ENDPOINT = 1, |
| 596 |
SCOPE_PCI_SUB = 2, |
| 597 |
SCOPE_IOAPIC = 3, |
| 598 |
SCOPE_MSI_HPET = 4, |
| 599 |
SCOPE_ACPI_NAMESPACE_DEVICE = 5 |
| 600 |
}; |
| 601 |
|
| 602 |
typedef struct dev_scope { |
| 603 |
u8 type; |
| 604 |
u8 length; |
| 605 |
u8 reserved[2]; |
| 606 |
u8 enumeration; |
| 607 |
u8 start_bus; |
| 608 |
struct { |
| 609 |
u8 dev; |
| 610 |
u8 fn; |
| 611 |
} __packed path[]; |
| 612 |
} __packed dev_scope_t; |
| 613 |
|
| 614 |
enum dmar_type { |
| 615 |
DMAR_DRHD = 0, |
| 616 |
DMAR_RMRR = 1, |
| 617 |
DMAR_ATSR = 2, |
| 618 |
DMAR_RHSA = 3, |
| 619 |
DMAR_ANDD = 4, |
| 620 |
DMAR_SATC = 5 |
| 621 |
}; |
| 622 |
|
| 623 |
enum { |
| 624 |
DRHD_INCLUDE_PCI_ALL = 1 |
| 625 |
}; |
| 626 |
|
| 627 |
enum { |
| 628 |
ATC_REQUIRED = 1 |
| 629 |
}; |
| 630 |
|
| 631 |
enum dmar_flags { |
| 632 |
DMAR_INTR_REMAP = 1 << 0, |
| 633 |
DMAR_X2APIC_OPT_OUT = 1 << 1, |
| 634 |
DMA_CTRL_PLATFORM_OPT_IN_FLAG = 1 << 2, |
| 635 |
}; |
| 636 |
|
| 637 |
typedef struct dmar_entry { |
| 638 |
u16 type; |
| 639 |
u16 length; |
| 640 |
u8 flags; |
| 641 |
u8 size; |
| 642 |
u16 segment; |
| 643 |
u64 bar; |
| 644 |
} __packed dmar_entry_t; |
| 645 |
|
| 646 |
typedef struct dmar_rmrr_entry { |
| 647 |
u16 type; |
| 648 |
u16 length; |
| 649 |
u16 reserved; |
| 650 |
u16 segment; |
| 651 |
u64 bar; |
| 652 |
u64 limit; |
| 653 |
} __packed dmar_rmrr_entry_t; |
| 654 |
|
| 655 |
typedef struct dmar_atsr_entry { |
| 656 |
u16 type; |
| 657 |
u16 length; |
| 658 |
u8 flags; |
| 659 |
u8 reserved; |
| 660 |
u16 segment; |
| 661 |
} __packed dmar_atsr_entry_t; |
| 662 |
|
| 663 |
typedef struct dmar_rhsa_entry { |
| 664 |
u16 type; |
| 665 |
u16 length; |
| 666 |
u32 reserved; |
| 667 |
u64 base_address; |
| 668 |
u32 proximity_domain; |
| 669 |
} __packed dmar_rhsa_entry_t; |
| 670 |
|
| 671 |
typedef struct dmar_andd_entry { |
| 672 |
u16 type; |
| 673 |
u16 length; |
| 674 |
u8 reserved[3]; |
| 675 |
u8 device_number; |
| 676 |
u8 device_name[]; |
| 677 |
} __packed dmar_andd_entry_t; |
| 678 |
|
| 679 |
typedef struct dmar_satc_entry { |
| 680 |
u16 type; |
| 681 |
u16 length; |
| 682 |
u8 flags; |
| 683 |
u8 reserved; |
| 684 |
u16 segment_number; |
| 685 |
} __packed dmar_satc_entry_t; |
| 686 |
|
| 687 |
|
| 688 |
typedef struct acpi_dmar { |
| 689 |
acpi_header_t header; |
| 690 |
u8 host_address_width; |
| 691 |
u8 flags; |
| 692 |
u8 reserved[10]; |
| 693 |
dmar_entry_t structure[]; |
| 694 |
} __packed acpi_dmar_t; |
| 695 |
|
| 696 |
|
| 697 |
enum acpi_apic_types { |
| 698 |
LOCAL_APIC, |
| 699 |
IO_APIC, |
| 700 |
IRQ_SOURCE_OVERRIDE, |
| 701 |
NMI_TYPE, |
| 702 |
LOCAL_APIC_NMI, |
| 703 |
LAPIC_ADDRESS_OVERRIDE, |
| 704 |
IO_SAPIC, |
| 705 |
LOCAL_SAPIC, |
| 706 |
PLATFORM_IRQ_SOURCES, |
| 707 |
LOCAL_X2APIC, |
| 708 |
LOCAL_X2APIC_NMI, |
| 709 |
GICC, |
| 710 |
GICD, |
| 711 |
GIC_MSI_FRAME, |
| 712 |
GICR, |
| 713 |
GIC_ITS, |
| 714 |
|
| 715 |
|
| 716 |
}; |
| 717 |
|
| 718 |
|
| 719 |
typedef struct acpi_madt_lapic { |
| 720 |
u8 type; |
| 721 |
u8 length; |
| 722 |
u8 processor_id; |
| 723 |
u8 apic_id; |
| 724 |
u32 flags; |
| 725 |
} __packed acpi_madt_lapic_t; |
| 726 |
|
| 727 |
#define ACPI_MADT_MAX_LAPIC_ID 0xfe |
| 728 |
|
| 729 |
|
| 730 |
#define ACPI_MADT_LAPIC_ENABLED (1 << 0) |
| 731 |
#define ACPI_MADT_LAPIC_ONLINE_CAPABLE (1 << 1) |
| 732 |
|
| 733 |
|
| 734 |
typedef struct acpi_madt_lapic_nmi { |
| 735 |
u8 type; |
| 736 |
u8 length; |
| 737 |
u8 processor_id; |
| 738 |
u16 flags; |
| 739 |
u8 lint; |
| 740 |
} __packed acpi_madt_lapic_nmi_t; |
| 741 |
|
| 742 |
#define ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS 0xff |
| 743 |
#define ACPI_MADT_LX2APIC_NMI_ALL_PROCESSORS ((u32)-1) |
| 744 |
|
| 745 |
|
| 746 |
typedef struct acpi_madt_ioapic { |
| 747 |
u8 type; |
| 748 |
u8 length; |
| 749 |
u8 ioapic_id; |
| 750 |
u8 reserved; |
| 751 |
u32 ioapic_addr; |
| 752 |
u32 gsi_base; |
| 753 |
} __packed acpi_madt_ioapic_t; |
| 754 |
|
| 755 |
#define MP_IRQ_POLARITY_DEFAULT 0x0 |
| 756 |
#define MP_IRQ_POLARITY_HIGH 0x1 |
| 757 |
#define MP_IRQ_POLARITY_LOW 0x3 |
| 758 |
#define MP_IRQ_POLARITY_MASK 0x3 |
| 759 |
#define MP_IRQ_TRIGGER_DEFAULT 0x0 |
| 760 |
#define MP_IRQ_TRIGGER_EDGE 0x4 |
| 761 |
#define MP_IRQ_TRIGGER_LEVEL 0xc |
| 762 |
#define MP_IRQ_TRIGGER_MASK 0xc |
| 763 |
|
| 764 |
|
| 765 |
typedef struct acpi_madt_irqoverride { |
| 766 |
u8 type; |
| 767 |
u8 length; |
| 768 |
u8 bus; |
| 769 |
u8 source; |
| 770 |
u32 gsirq; |
| 771 |
u16 flags; |
| 772 |
} __packed acpi_madt_irqoverride_t; |
| 773 |
|
| 774 |
|
| 775 |
typedef struct acpi_madt_lx2apic { |
| 776 |
u8 type; |
| 777 |
u8 length; |
| 778 |
u16 reserved; |
| 779 |
u32 x2apic_id; |
| 780 |
u32 flags; |
| 781 |
u32 processor_id; |
| 782 |
} __packed acpi_madt_lx2apic_t; |
| 783 |
|
| 784 |
|
| 785 |
typedef struct acpi_madt_lx2apic_nmi { |
| 786 |
u8 type; |
| 787 |
u8 length; |
| 788 |
u16 flags; |
| 789 |
u32 processor_id; |
| 790 |
u8 lint; |
| 791 |
u8 reserved[3]; |
| 792 |
} __packed acpi_madt_lx2apic_nmi_t; |
| 793 |
|
| 794 |
|
| 795 |
struct gicc_flags { |
| 796 |
uint32_t enabled : 1; |
| 797 |
|
| 798 |
uint32_t performance_interrupt_mode : 1; |
| 799 |
uint32_t vgic_maintenance_interrupt_mode : 1; |
| 800 |
uint32_t online_capable : 1; |
| 801 |
uint32_t reserved : 28; |
| 802 |
}; |
| 803 |
_Static_assert(sizeof(struct gicc_flags) == sizeof(uint32_t), "Wrong gicc_flags size\n"); |
| 804 |
|
| 805 |
typedef struct acpi_gicc { |
| 806 |
uint8_t type; |
| 807 |
uint8_t length; |
| 808 |
uint16_t reserved; |
| 809 |
uint32_t cpu_interface_number; |
| 810 |
uint32_t acpi_processor_uid; |
| 811 |
struct gicc_flags flags; |
| 812 |
uint32_t parking_protocol_version; |
| 813 |
uint32_t performance_interrupt_gsiv; |
| 814 |
uint64_t parked_address; |
| 815 |
uint64_t physical_base_address; |
| 816 |
uint64_t gicv; |
| 817 |
uint64_t gich; |
| 818 |
uint32_t vgic_maintenance_interrupt; |
| 819 |
uint64_t gicr_base_address; |
| 820 |
uint64_t mpidr; |
| 821 |
uint8_t processor_power_efficiency_class; |
| 822 |
uint8_t reserved1; |
| 823 |
uint16_t spe_overflow_interrupt; |
| 824 |
uint16_t trbe_interrupt; |
| 825 |
} __packed acpi_madt_gicc_t; |
| 826 |
_Static_assert(sizeof(acpi_madt_gicc_t) == 82, "Wrong acpi_madt_gicc_t size\n"); |
| 827 |
|
| 828 |
|
| 829 |
typedef struct acpi_gicd { |
| 830 |
uint8_t type; |
| 831 |
uint8_t length; |
| 832 |
uint16_t reserved1; |
| 833 |
uint32_t gic_id; |
| 834 |
uint64_t physical_base_address; |
| 835 |
uint32_t system_vector_base; |
| 836 |
uint8_t gic_version; |
| 837 |
uint8_t reserved2[3]; |
| 838 |
} __packed acpi_madt_gicd_t; |
| 839 |
_Static_assert(sizeof(acpi_madt_gicd_t) == 24, "Wrong acpi_madt_gicd_t size\n"); |
| 840 |
|
| 841 |
|
| 842 |
struct gic_msi_flags { |
| 843 |
uint32_t spi_count_select : 1; |
| 844 |
uint32_t reserved : 31; |
| 845 |
}; |
| 846 |
_Static_assert(sizeof(struct gic_msi_flags) == sizeof(uint32_t), "Wrong gic_msi_flags size\n"); |
| 847 |
|
| 848 |
typedef struct acpi_gic_msi { |
| 849 |
uint8_t type; |
| 850 |
uint8_t length; |
| 851 |
uint16_t reserved; |
| 852 |
uint32_t gic_msi_frame_id; |
| 853 |
uint64_t physical_base_address; |
| 854 |
struct gic_msi_flags flags; |
| 855 |
uint16_t spi_count; |
| 856 |
uint16_t spi_base; |
| 857 |
} __packed acpi_gic_msi_t; |
| 858 |
_Static_assert(sizeof(acpi_gic_msi_t) == 24, "Wrong acpi_gic_msi_t size\n"); |
| 859 |
|
| 860 |
|
| 861 |
typedef struct acpi_girr { |
| 862 |
uint8_t type; |
| 863 |
uint8_t length; |
| 864 |
uint16_t reserved; |
| 865 |
uint64_t discovery_range_base_address; |
| 866 |
uint32_t discovery_range_length; |
| 867 |
} __packed acpi_madt_gicr_t; |
| 868 |
_Static_assert(sizeof(acpi_madt_gicr_t) == 16, "Wrong acpi_madt_gicr_t size\n"); |
| 869 |
|
| 870 |
|
| 871 |
typedef struct acpi_gic_its { |
| 872 |
uint8_t type; |
| 873 |
uint8_t length; |
| 874 |
uint16_t reserved; |
| 875 |
uint32_t gic_its_id; |
| 876 |
uint64_t physical_base_address; |
| 877 |
uint32_t reserved2; |
| 878 |
} __packed acpi_madt_gic_its_t; |
| 879 |
_Static_assert(sizeof(acpi_madt_gic_its_t) == 20, "Wrong MADT acpi_madt_gic_its_t size\n"); |
| 880 |
|
| 881 |
#define ACPI_DBG2_PORT_SERIAL 0x8000 |
| 882 |
#define ACPI_DBG2_PORT_SERIAL_16550_IO_ONLY 0x0000 |
| 883 |
#define ACPI_DBG2_PORT_SERIAL_16550_DBGP 0x0001 |
| 884 |
#define ACPI_DBG2_PORT_SERIAL_ARM_PL011 0x0003 |
| 885 |
#define ACPI_DBG2_PORT_SERIAL_ARM_SBSA 0x000e |
| 886 |
#define ACPI_DBG2_PORT_SERIAL_ARM_DDC 0x000f |
| 887 |
#define ACPI_DBG2_PORT_SERIAL_BCM2835 0x0010 |
| 888 |
#define ACPI_DBG2_PORT_SERIAL_16550 0x0012 |
| 889 |
#define ACPI_DBG2_PORT_IEEE1394 0x8001 |
| 890 |
#define ACPI_DBG2_PORT_IEEE1394_STANDARD 0x0000 |
| 891 |
#define ACPI_DBG2_PORT_USB 0x8002 |
| 892 |
#define ACPI_DBG2_PORT_USB_XHCI 0x0000 |
| 893 |
#define ACPI_DBG2_PORT_USB_EHCI 0x0001 |
| 894 |
#define ACPI_DBG2_PORT_NET 0x8003 |
| 895 |
|
| 896 |
|
| 897 |
typedef struct acpi_dbg2_header { |
| 898 |
acpi_header_t header; |
| 899 |
uint32_t devices_offset; |
| 900 |
uint32_t devices_count; |
| 901 |
} __packed acpi_dbg2_header_t; |
| 902 |
|
| 903 |
|
| 904 |
typedef struct acpi_dbg2_device { |
| 905 |
uint8_t revision; |
| 906 |
uint16_t length; |
| 907 |
uint8_t address_count; |
| 908 |
uint16_t namespace_string_length; |
| 909 |
uint16_t namespace_string_offset; |
| 910 |
uint16_t oem_data_length; |
| 911 |
uint16_t oem_data_offset; |
| 912 |
uint16_t port_type; |
| 913 |
uint16_t port_subtype; |
| 914 |
uint8_t reserved[2]; |
| 915 |
uint16_t base_address_offset; |
| 916 |
uint16_t address_size_offset; |
| 917 |
} __packed acpi_dbg2_device_t; |
| 918 |
|
| 919 |
|
| 920 |
typedef struct acpi_fadt { |
| 921 |
acpi_header_t header; |
| 922 |
u32 firmware_ctrl; |
| 923 |
u32 dsdt; |
| 924 |
u8 reserved; |
| 925 |
u8 preferred_pm_profile; |
| 926 |
u16 sci_int; |
| 927 |
u32 smi_cmd; |
| 928 |
u8 acpi_enable; |
| 929 |
u8 acpi_disable; |
| 930 |
u8 s4bios_req; |
| 931 |
u8 pstate_cnt; |
| 932 |
u32 pm1a_evt_blk; |
| 933 |
u32 pm1b_evt_blk; |
| 934 |
u32 pm1a_cnt_blk; |
| 935 |
u32 pm1b_cnt_blk; |
| 936 |
u32 pm2_cnt_blk; |
| 937 |
u32 pm_tmr_blk; |
| 938 |
u32 gpe0_blk; |
| 939 |
u32 gpe1_blk; |
| 940 |
u8 pm1_evt_len; |
| 941 |
u8 pm1_cnt_len; |
| 942 |
u8 pm2_cnt_len; |
| 943 |
u8 pm_tmr_len; |
| 944 |
u8 gpe0_blk_len; |
| 945 |
u8 gpe1_blk_len; |
| 946 |
u8 gpe1_base; |
| 947 |
u8 cst_cnt; |
| 948 |
u16 p_lvl2_lat; |
| 949 |
u16 p_lvl3_lat; |
| 950 |
u16 flush_size; |
| 951 |
u16 flush_stride; |
| 952 |
u8 duty_offset; |
| 953 |
u8 duty_width; |
| 954 |
u8 day_alrm; |
| 955 |
u8 mon_alrm; |
| 956 |
u8 century; |
| 957 |
u16 iapc_boot_arch; |
| 958 |
u8 res2; |
| 959 |
u32 flags; |
| 960 |
acpi_addr_t reset_reg; |
| 961 |
u8 reset_value; |
| 962 |
u16 ARM_boot_arch; |
| 963 |
u8 FADT_MinorVersion; |
| 964 |
u32 x_firmware_ctl_l; |
| 965 |
u32 x_firmware_ctl_h; |
| 966 |
u32 x_dsdt_l; |
| 967 |
u32 x_dsdt_h; |
| 968 |
acpi_addr_t x_pm1a_evt_blk; |
| 969 |
acpi_addr_t x_pm1b_evt_blk; |
| 970 |
acpi_addr_t x_pm1a_cnt_blk; |
| 971 |
acpi_addr_t x_pm1b_cnt_blk; |
| 972 |
acpi_addr_t x_pm2_cnt_blk; |
| 973 |
acpi_addr_t x_pm_tmr_blk; |
| 974 |
acpi_addr_t x_gpe0_blk; |
| 975 |
acpi_addr_t x_gpe1_blk; |
| 976 |
|
| 977 |
acpi_addr_t sleep_control_reg; |
| 978 |
acpi_addr_t sleep_status_reg; |
| 979 |
|
| 980 |
u64 hypervisor_vendor_identity; |
| 981 |
} __packed acpi_fadt_t; |
| 982 |
|
| 983 |
|
| 984 |
#define ACPI_FADT_REV_ACPI_1 1 |
| 985 |
#define ACPI_FADT_REV_ACPI_2 3 |
| 986 |
#define ACPI_FADT_REV_ACPI_3 4 |
| 987 |
#define ACPI_FADT_REV_ACPI_4 4 |
| 988 |
#define ACPI_FADT_REV_ACPI_5 5 |
| 989 |
#define ACPI_FADT_REV_ACPI_6 6 |
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
#define ACPI_FADT_MINOR_VERSION_0 0 |
| 999 |
|
| 1000 |
|
| 1001 |
#define ACPI_FADT_C2_NOT_SUPPORTED 101 |
| 1002 |
#define ACPI_FADT_C3_NOT_SUPPORTED 1001 |
| 1003 |
|
| 1004 |
|
| 1005 |
#define ACPI_FADT_WBINVD (1 << 0) |
| 1006 |
#define ACPI_FADT_WBINVD_FLUSH (1 << 1) |
| 1007 |
#define ACPI_FADT_C1_SUPPORTED (1 << 2) |
| 1008 |
#define ACPI_FADT_C2_MP_SUPPORTED (1 << 3) |
| 1009 |
#define ACPI_FADT_POWER_BUTTON (1 << 4) |
| 1010 |
#define ACPI_FADT_SLEEP_BUTTON (1 << 5) |
| 1011 |
#define ACPI_FADT_FIXED_RTC (1 << 6) |
| 1012 |
#define ACPI_FADT_S4_RTC_WAKE (1 << 7) |
| 1013 |
#define ACPI_FADT_32BIT_TIMER (1 << 8) |
| 1014 |
#define ACPI_FADT_DOCKING_SUPPORTED (1 << 9) |
| 1015 |
#define ACPI_FADT_RESET_REGISTER (1 << 10) |
| 1016 |
#define ACPI_FADT_SEALED_CASE (1 << 11) |
| 1017 |
#define ACPI_FADT_HEADLESS (1 << 12) |
| 1018 |
#define ACPI_FADT_SLEEP_TYPE (1 << 13) |
| 1019 |
#define ACPI_FADT_PCI_EXPRESS_WAKE (1 << 14) |
| 1020 |
#define ACPI_FADT_PLATFORM_CLOCK (1 << 15) |
| 1021 |
#define ACPI_FADT_S4_RTC_VALID (1 << 16) |
| 1022 |
#define ACPI_FADT_REMOTE_POWER_ON (1 << 17) |
| 1023 |
#define ACPI_FADT_APIC_CLUSTER (1 << 18) |
| 1024 |
#define ACPI_FADT_APIC_PHYSICAL (1 << 19) |
| 1025 |
|
| 1026 |
#define ACPI_FADT_HW_REDUCED_ACPI (1 << 20) |
| 1027 |
#define ACPI_FADT_LOW_PWR_IDLE_S0 (1 << 21) |
| 1028 |
|
| 1029 |
|
| 1030 |
|
| 1031 |
#define ACPI_FADT_LEGACY_DEVICES (1 << 0) |
| 1032 |
#define ACPI_FADT_8042 (1 << 1) |
| 1033 |
#define ACPI_FADT_VGA_NOT_PRESENT (1 << 2) |
| 1034 |
#define ACPI_FADT_MSI_NOT_SUPPORTED (1 << 3) |
| 1035 |
#define ACPI_FADT_NO_PCIE_ASPM_CONTROL (1 << 4) |
| 1036 |
#define ACPI_FADT_NO_CMOS_RTC (1 << 5) |
| 1037 |
#define ACPI_FADT_LEGACY_FREE 0x00 |
| 1038 |
|
| 1039 |
|
| 1040 |
#define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0) |
| 1041 |
#define ACPI_FADT_ARM_PSCI_USE_HVC (1 << 1) |
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
enum acpi_preferred_pm_profiles { |
| 1046 |
PM_UNSPECIFIED = 0, |
| 1047 |
PM_DESKTOP = 1, |
| 1048 |
PM_MOBILE = 2, |
| 1049 |
PM_WORKSTATION = 3, |
| 1050 |
PM_ENTERPRISE_SERVER = 4, |
| 1051 |
PM_SOHO_SERVER = 5, |
| 1052 |
PM_APPLIANCE_PC = 6, |
| 1053 |
PM_PERFORMANCE_SERVER = 7, |
| 1054 |
PM_TABLET = 8, |
| 1055 |
}; |
| 1056 |
|
| 1057 |
|
| 1058 |
typedef struct acpi_facs { |
| 1059 |
char signature[4]; |
| 1060 |
u32 length; |
| 1061 |
u32 hardware_signature; |
| 1062 |
u32 firmware_waking_vector; |
| 1063 |
u32 global_lock; |
| 1064 |
u32 flags; |
| 1065 |
u32 x_firmware_waking_vector_l; |
| 1066 |
u32 x_firmware_waking_vector_h; |
| 1067 |
u8 version; |
| 1068 |
u8 resv1[3]; |
| 1069 |
u32 ospm_flags; |
| 1070 |
u8 resv2[24]; |
| 1071 |
} __packed acpi_facs_t; |
| 1072 |
|
| 1073 |
|
| 1074 |
#define ACPI_FACS_S4BIOS_F (1 << 0) |
| 1075 |
#define ACPI_FACS_64BIT_WAKE_F (1 << 1) |
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
typedef struct acpi_ecdt { |
| 1080 |
acpi_header_t header; |
| 1081 |
acpi_addr_t ec_control; |
| 1082 |
acpi_addr_t ec_data; |
| 1083 |
u32 uid; |
| 1084 |
u8 gpe_bit; |
| 1085 |
u8 ec_id[]; |
| 1086 |
} __packed acpi_ecdt_t; |
| 1087 |
|
| 1088 |
|
| 1089 |
typedef struct acpi_hest { |
| 1090 |
acpi_header_t header; |
| 1091 |
u32 error_source_count; |
| 1092 |
|
| 1093 |
} __packed acpi_hest_t; |
| 1094 |
|
| 1095 |
|
| 1096 |
typedef struct acpi_hest_esd { |
| 1097 |
u16 type; |
| 1098 |
u16 source_id; |
| 1099 |
u16 resv; |
| 1100 |
u8 flags; |
| 1101 |
u8 enabled; |
| 1102 |
u32 prealloc_erecords; |
| 1103 |
|
| 1104 |
|
| 1105 |
u32 max_section_per_record; |
| 1106 |
} __packed acpi_hest_esd_t; |
| 1107 |
|
| 1108 |
|
| 1109 |
typedef struct acpi_hest_hen { |
| 1110 |
u8 type; |
| 1111 |
u8 length; |
| 1112 |
u16 conf_we; |
| 1113 |
u32 poll_interval; |
| 1114 |
u32 vector; |
| 1115 |
u32 sw2poll_threshold_val; |
| 1116 |
u32 sw2poll_threshold_win; |
| 1117 |
u32 error_threshold_val; |
| 1118 |
u32 error_threshold_win; |
| 1119 |
} __packed acpi_hest_hen_t; |
| 1120 |
|
| 1121 |
|
| 1122 |
typedef struct acpi_bert { |
| 1123 |
acpi_header_t header; |
| 1124 |
u32 region_length; |
| 1125 |
u64 error_region; |
| 1126 |
} __packed acpi_bert_t; |
| 1127 |
|
| 1128 |
|
| 1129 |
typedef struct acpi_hest_generic_data { |
| 1130 |
guid_t section_type; |
| 1131 |
u32 error_severity; |
| 1132 |
u16 revision; |
| 1133 |
u8 validation_bits; |
| 1134 |
u8 flags; |
| 1135 |
u32 data_length; |
| 1136 |
guid_t fru_id; |
| 1137 |
u8 fru_text[20]; |
| 1138 |
|
| 1139 |
} __packed acpi_hest_generic_data_t; |
| 1140 |
|
| 1141 |
|
| 1142 |
typedef struct acpi_hest_generic_data_v300 { |
| 1143 |
guid_t section_type; |
| 1144 |
u32 error_severity; |
| 1145 |
u16 revision; |
| 1146 |
u8 validation_bits; |
| 1147 |
u8 flags; |
| 1148 |
u32 data_length; |
| 1149 |
guid_t fru_id; |
| 1150 |
u8 fru_text[20]; |
| 1151 |
cper_timestamp_t timestamp; |
| 1152 |
|
| 1153 |
} __packed acpi_hest_generic_data_v300_t; |
| 1154 |
#define HEST_GENERIC_ENTRY_V300 0x300 |
| 1155 |
|
| 1156 |
|
| 1157 |
#define ACPI_GENERROR_SEV_RECOVERABLE 0 |
| 1158 |
#define ACPI_GENERROR_SEV_FATAL 1 |
| 1159 |
#define ACPI_GENERROR_SEV_CORRECTED 2 |
| 1160 |
#define ACPI_GENERROR_SEV_NONE 3 |
| 1161 |
|
| 1162 |
|
| 1163 |
#define ACPI_GENERROR_VALID_FRUID BIT(0) |
| 1164 |
#define ACPI_GENERROR_VALID_FRUID_TEXT BIT(1) |
| 1165 |
#define ACPI_GENERROR_VALID_TIMESTAMP BIT(2) |
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
|
| 1176 |
typedef struct acpi_generic_error_status { |
| 1177 |
u32 block_status; |
| 1178 |
u32 raw_data_offset; |
| 1179 |
u32 raw_data_length; |
| 1180 |
u32 data_length; |
| 1181 |
u32 error_severity; |
| 1182 |
|
| 1183 |
} __packed acpi_generic_error_status_t; |
| 1184 |
|
| 1185 |
|
| 1186 |
#define GENERIC_ERR_STS_UNCORRECTABLE_VALID BIT(0) |
| 1187 |
#define GENERIC_ERR_STS_CORRECTABLE_VALID BIT(1) |
| 1188 |
#define GENERIC_ERR_STS_MULT_UNCORRECTABLE BIT(2) |
| 1189 |
#define GENERIC_ERR_STS_MULT_CORRECTABLE BIT(3) |
| 1190 |
#define GENERIC_ERR_STS_ENTRY_COUNT_SHIFT 4 |
| 1191 |
#define GENERIC_ERR_STS_ENTRY_COUNT_MAX 0x3ff |
| 1192 |
#define GENERIC_ERR_STS_ENTRY_COUNT_MASK \ |
| 1193 |
(GENERIC_ERR_STS_ENTRY_COUNT_MAX \ |
| 1194 |
<< GENERIC_ERR_STS_ENTRY_COUNT_SHIFT) |
| 1195 |
|
| 1196 |
typedef struct acpi_cstate { |
| 1197 |
u8 ctype; |
| 1198 |
u16 latency; |
| 1199 |
u32 power; |
| 1200 |
acpi_addr_t resource; |
| 1201 |
} __packed acpi_cstate_t; |
| 1202 |
|
| 1203 |
struct acpi_sw_pstate { |
| 1204 |
u32 core_freq; |
| 1205 |
u32 power; |
| 1206 |
u32 transition_latency; |
| 1207 |
u32 bus_master_latency; |
| 1208 |
u32 control_value; |
| 1209 |
u32 status_value; |
| 1210 |
} __packed; |
| 1211 |
|
| 1212 |
struct acpi_xpss_sw_pstate { |
| 1213 |
u64 core_freq; |
| 1214 |
u64 power; |
| 1215 |
u64 transition_latency; |
| 1216 |
u64 bus_master_latency; |
| 1217 |
u64 control_value; |
| 1218 |
u64 status_value; |
| 1219 |
u64 control_mask; |
| 1220 |
u64 status_mask; |
| 1221 |
} __packed; |
| 1222 |
|
| 1223 |
typedef struct acpi_tstate { |
| 1224 |
u32 percent; |
| 1225 |
u32 power; |
| 1226 |
u32 latency; |
| 1227 |
u32 control; |
| 1228 |
u32 status; |
| 1229 |
} __packed acpi_tstate_t; |
| 1230 |
|
| 1231 |
enum acpi_lpi_state_flags { |
| 1232 |
ACPI_LPI_STATE_DISABLED = 0, |
| 1233 |
ACPI_LPI_STATE_ENABLED |
| 1234 |
}; |
| 1235 |
|
| 1236 |
|
| 1237 |
struct acpi_lpi_state { |
| 1238 |
u32 min_residency_us; |
| 1239 |
u32 worst_case_wakeup_latency_us; |
| 1240 |
u32 flags; |
| 1241 |
u32 arch_context_lost_flags; |
| 1242 |
u32 residency_counter_frequency_hz; |
| 1243 |
u32 enabled_parent_state; |
| 1244 |
acpi_addr_t entry_method; |
| 1245 |
acpi_addr_t residency_counter_register; |
| 1246 |
acpi_addr_t usage_counter_register; |
| 1247 |
const char *state_name; |
| 1248 |
}; |
| 1249 |
|
| 1250 |
|
| 1251 |
enum acpi_upc_type { |
| 1252 |
UPC_TYPE_A, |
| 1253 |
UPC_TYPE_MINI_AB, |
| 1254 |
UPC_TYPE_EXPRESSCARD, |
| 1255 |
UPC_TYPE_USB3_A, |
| 1256 |
UPC_TYPE_USB3_B, |
| 1257 |
UPC_TYPE_USB3_MICRO_B, |
| 1258 |
UPC_TYPE_USB3_MICRO_AB, |
| 1259 |
UPC_TYPE_USB3_POWER_B, |
| 1260 |
UPC_TYPE_C_USB2_ONLY, |
| 1261 |
UPC_TYPE_C_USB2_SS_SWITCH, |
| 1262 |
UPC_TYPE_C_USB2_SS, |
| 1263 |
UPC_TYPE_PROPRIETARY = 0xff, |
| 1264 |
|
| 1265 |
|
| 1266 |
|
| 1267 |
|
| 1268 |
UPC_TYPE_INTERNAL = 0xff, |
| 1269 |
UPC_TYPE_UNUSED, |
| 1270 |
UPC_TYPE_HUB |
| 1271 |
}; |
| 1272 |
|
| 1273 |
enum acpi_ipmi_interface_type { |
| 1274 |
IPMI_INTERFACE_RESERVED = 0, |
| 1275 |
IPMI_INTERFACE_KCS, |
| 1276 |
IPMI_INTERFACE_SMIC, |
| 1277 |
IPMI_INTERFACE_BT, |
| 1278 |
IPMI_INTERFACE_SSIF, |
| 1279 |
}; |
| 1280 |
|
| 1281 |
#define ACPI_IPMI_PCI_DEVICE_FLAG (1 << 0) |
| 1282 |
#define ACPI_IPMI_INT_TYPE_SCI (1 << 0) |
| 1283 |
#define ACPI_IPMI_INT_TYPE_APIC (1 << 1) |
| 1284 |
|
| 1285 |
|
| 1286 |
struct acpi_spmi { |
| 1287 |
acpi_header_t header; |
| 1288 |
u8 interface_type; |
| 1289 |
u8 reserved; |
| 1290 |
u16 specification_revision; |
| 1291 |
u8 interrupt_type; |
| 1292 |
u8 gpe; |
| 1293 |
u8 reserved2; |
| 1294 |
u8 pci_device_flag; |
| 1295 |
|
| 1296 |
u32 global_system_interrupt; |
| 1297 |
acpi_addr_t base_address; |
| 1298 |
union { |
| 1299 |
struct { |
| 1300 |
u8 pci_segment_group; |
| 1301 |
u8 pci_bus; |
| 1302 |
u8 pci_device; |
| 1303 |
u8 pci_function; |
| 1304 |
}; |
| 1305 |
u8 uid[4]; |
| 1306 |
}; |
| 1307 |
u8 reserved3; |
| 1308 |
} __packed; |
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
#define ACPI_EINJ_CPU_CE (1 << 0) |
| 1315 |
#define ACPI_EINJ_CPU_UCE (1 << 1) |
| 1316 |
#define ACPI_EINJ_CPU_UCE_FATAL (1 << 2) |
| 1317 |
#define ACPI_EINJ_MEM_CE (1 << 3) |
| 1318 |
#define ACPI_EINJ_MEM_UCE (1 << 4) |
| 1319 |
#define ACPI_EINJ_MEM_UCE_FATAL (1 << 5) |
| 1320 |
#define ACPI_EINJ_PCIE_CE (1 << 6) |
| 1321 |
#define ACPI_EINJ_PCIE_UCE_NON_FATAL (1 << 7) |
| 1322 |
#define ACPI_EINJ_PCIE_UCE_FATAL (1 << 8) |
| 1323 |
#define ACPI_EINJ_PLATFORM_CE (1 << 9) |
| 1324 |
#define ACPI_EINJ_PLATFORM_UCE (1 << 10) |
| 1325 |
#define ACPI_EINJ_PLATFORM_UCE_FATAL (1 << 11) |
| 1326 |
#define ACPI_EINJ_VENDOR_DEFINED (1 << 31) |
| 1327 |
#define ACPI_EINJ_DEFAULT_CAP (ACPI_EINJ_MEM_CE | ACPI_EINJ_MEM_UCE | \ |
| 1328 |
ACPI_EINJ_PCIE_CE | ACPI_EINJ_PCIE_UCE_FATAL) |
| 1329 |
|
| 1330 |
|
| 1331 |
#define ACTION_COUNT 9 |
| 1332 |
#define BEGIN_INJECT_OP 0x00 |
| 1333 |
#define GET_TRIGGER_ACTION_TABLE 0x01 |
| 1334 |
#define SET_ERROR_TYPE 0x02 |
| 1335 |
#define GET_ERROR_TYPE 0x03 |
| 1336 |
#define END_INJECT_OP 0x04 |
| 1337 |
#define EXECUTE_INJECT_OP 0x05 |
| 1338 |
#define CHECK_BUSY_STATUS 0x06 |
| 1339 |
#define GET_CMD_STATUS 0x07 |
| 1340 |
#define SET_ERROR_TYPE_WITH_ADDRESS 0x08 |
| 1341 |
#define TRIGGER_ERROR 0xFF |
| 1342 |
|
| 1343 |
|
| 1344 |
#define READ_REGISTER 0x00 |
| 1345 |
#define READ_REGISTER_VALUE 0x01 |
| 1346 |
#define WRITE_REGISTER 0x02 |
| 1347 |
#define WRITE_REGISTER_VALUE 0x03 |
| 1348 |
#define NO_OP 0x04 |
| 1349 |
|
| 1350 |
|
| 1351 |
typedef struct acpi_gen_regaddr1 { |
| 1352 |
u8 space_id; |
| 1353 |
u8 bit_width; |
| 1354 |
u8 bit_offset; |
| 1355 |
u8 access_size; |
| 1356 |
u64 addr; |
| 1357 |
} __packed acpi_addr64_t; |
| 1358 |
|
| 1359 |
|
| 1360 |
typedef struct acpi_einj_action_table { |
| 1361 |
u8 action; |
| 1362 |
u8 instruction; |
| 1363 |
u16 flags; |
| 1364 |
acpi_addr64_t reg; |
| 1365 |
u64 value; |
| 1366 |
u64 mask; |
| 1367 |
} __packed acpi_einj_action_table_t; |
| 1368 |
|
| 1369 |
typedef struct acpi_injection_header { |
| 1370 |
u32 einj_header_size; |
| 1371 |
u32 flags; |
| 1372 |
u32 entry_count; |
| 1373 |
} __packed acpi_injection_header_t; |
| 1374 |
|
| 1375 |
typedef struct acpi_einj_trigger_table { |
| 1376 |
u32 header_size; |
| 1377 |
u32 revision; |
| 1378 |
u32 table_size; |
| 1379 |
u32 entry_count; |
| 1380 |
acpi_einj_action_table_t trigger_action[]; |
| 1381 |
} __packed acpi_einj_trigger_table_t; |
| 1382 |
|
| 1383 |
typedef struct set_error_type { |
| 1384 |
u32 errtype; |
| 1385 |
u32 vendorerrortype; |
| 1386 |
u32 flags; |
| 1387 |
u32 apicid; |
| 1388 |
u64 memaddr; |
| 1389 |
u64 memrange; |
| 1390 |
u32 pciesbdf; |
| 1391 |
} __packed set_error_type_t; |
| 1392 |
|
| 1393 |
#define EINJ_PARAM_NUM 6 |
| 1394 |
typedef struct acpi_einj_smi { |
| 1395 |
u64 op_state; |
| 1396 |
u64 err_inject[EINJ_PARAM_NUM]; |
| 1397 |
u64 trigger_action_table; |
| 1398 |
u64 err_inj_cap; |
| 1399 |
u64 op_status; |
| 1400 |
u64 cmd_sts; |
| 1401 |
u64 einj_addr; |
| 1402 |
u64 einj_addr_msk; |
| 1403 |
set_error_type_t setaddrtable; |
| 1404 |
u64 reserved[50]; |
| 1405 |
} __packed acpi_einj_smi_t; |
| 1406 |
|
| 1407 |
|
| 1408 |
#define EINJ_DEF_TRIGGER_PORT 0xb2 |
| 1409 |
#define FLAG_PRESERVE 0x01 |
| 1410 |
#define FLAG_IGNORE 0x00 |
| 1411 |
|
| 1412 |
|
| 1413 |
#define EINJ_REG_MEMORY(address) \ |
| 1414 |
{ \ |
| 1415 |
.space_id = ACPI_ADDRESS_SPACE_MEMORY, \ |
| 1416 |
.bit_width = 64, \ |
| 1417 |
.bit_offset = 0, \ |
| 1418 |
.access_size = ACPI_ACCESS_SIZE_QWORD_ACCESS, \ |
| 1419 |
.addr = address} |
| 1420 |
|
| 1421 |
#define EINJ_REG_IO() \ |
| 1422 |
{ \ |
| 1423 |
.space_id = ACPI_ADDRESS_SPACE_IO, \ |
| 1424 |
.bit_width = 0x10, \ |
| 1425 |
.bit_offset = 0, \ |
| 1426 |
.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS, \ |
| 1427 |
.addr = EINJ_DEF_TRIGGER_PORT} |
| 1428 |
|
| 1429 |
typedef struct acpi_einj { |
| 1430 |
acpi_header_t header; |
| 1431 |
acpi_injection_header_t inj_header; |
| 1432 |
acpi_einj_action_table_t action_table[ACTION_COUNT]; |
| 1433 |
} __packed acpi_einj_t; |
| 1434 |
|
| 1435 |
|
| 1436 |
|
| 1437 |
#define PPTT_NODE_TYPE_CPU 0 |
| 1438 |
#define PPTT_NODE_TYPE_CACHE 1 |
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
typedef struct acpi_pptt_cpu_node { |
| 1443 |
u8 type; |
| 1444 |
u8 length; |
| 1445 |
u8 reserved[2]; |
| 1446 |
u32 flags; |
| 1447 |
u32 parent; |
| 1448 |
u32 processor_id; |
| 1449 |
u32 n_resources; |
| 1450 |
u32 resources[]; |
| 1451 |
} acpi_pptt_cpu_node_t; |
| 1452 |
|
| 1453 |
typedef struct acpi_pptt_cache_node { |
| 1454 |
u8 type; |
| 1455 |
u8 length; |
| 1456 |
u8 reserved[2]; |
| 1457 |
u32 flags; |
| 1458 |
u32 next_level; |
| 1459 |
u32 size; |
| 1460 |
u32 n_sets; |
| 1461 |
u8 associativity; |
| 1462 |
u8 attributes; |
| 1463 |
u16 line_size; |
| 1464 |
u32 cache_id; |
| 1465 |
} acpi_pptt_cache_node_t; |
| 1466 |
|
| 1467 |
union acpi_pptt_body { |
| 1468 |
acpi_pptt_cpu_node_t cpu; |
| 1469 |
acpi_pptt_cache_node_t cache; |
| 1470 |
}; |
| 1471 |
|
| 1472 |
typedef struct acpi_pptt { |
| 1473 |
acpi_header_t header; |
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
|
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
union acpi_pptt_body body[]; |
| 1483 |
} __packed acpi_pptt_t; |
| 1484 |
|
| 1485 |
|
| 1486 |
|
| 1487 |
union pptt_cache_flags { |
| 1488 |
struct { |
| 1489 |
u32 size_valid : 1; |
| 1490 |
u32 n_sets_valid : 1; |
| 1491 |
u32 associativity_valid : 1; |
| 1492 |
u32 alloc_type_valid : 1; |
| 1493 |
u32 cache_type_valid : 1; |
| 1494 |
u32 write_policy_valid : 1; |
| 1495 |
u32 line_size_valid : 1; |
| 1496 |
u32 cache_id_valid : 1; |
| 1497 |
u32 reserved : 24; |
| 1498 |
}; |
| 1499 |
|
| 1500 |
u32 raw; |
| 1501 |
}; |
| 1502 |
|
| 1503 |
union pptt_cpu_flags { |
| 1504 |
struct { |
| 1505 |
u32 is_physical_package : 1; |
| 1506 |
u32 processor_id_valid : 1; |
| 1507 |
u32 is_thread : 1; |
| 1508 |
u32 is_leaf : 1; |
| 1509 |
u32 is_identical_impl : 1; |
| 1510 |
u32 reserved : 27; |
| 1511 |
}; |
| 1512 |
|
| 1513 |
u32 raw; |
| 1514 |
}; |
| 1515 |
|
| 1516 |
struct pptt_cache { |
| 1517 |
u32 size; |
| 1518 |
u32 numsets; |
| 1519 |
u8 associativity; |
| 1520 |
u8 attributes; |
| 1521 |
u16 line_size; |
| 1522 |
union pptt_cache_flags flags; |
| 1523 |
struct pptt_cache *next_level; |
| 1524 |
}; |
| 1525 |
|
| 1526 |
struct pptt_cpu_resources { |
| 1527 |
struct pptt_cache *cache; |
| 1528 |
struct pptt_cpu_resources *next; |
| 1529 |
}; |
| 1530 |
|
| 1531 |
struct pptt_topology { |
| 1532 |
u32 processor_id; |
| 1533 |
union pptt_cpu_flags flags; |
| 1534 |
struct pptt_cpu_resources *resources; |
| 1535 |
struct pptt_topology *sibling; |
| 1536 |
struct pptt_topology *child; |
| 1537 |
}; |
| 1538 |
|
| 1539 |
|
| 1540 |
typedef struct acpi_spcr { |
| 1541 |
acpi_header_t header; |
| 1542 |
uint8_t interface_type; |
| 1543 |
uint8_t reserved[3]; |
| 1544 |
acpi_addr_t base_address; |
| 1545 |
uint8_t interrupt_type; |
| 1546 |
uint8_t irq; |
| 1547 |
uint32_t global_system_interrupt; |
| 1548 |
uint8_t configured_baudrate; |
| 1549 |
uint8_t parity; |
| 1550 |
uint8_t stop_bits; |
| 1551 |
uint8_t flow_control; |
| 1552 |
uint8_t terminal_type; |
| 1553 |
uint8_t language; |
| 1554 |
uint16_t pci_did; |
| 1555 |
uint16_t pci_vid; |
| 1556 |
uint8_t pci_bus; |
| 1557 |
uint8_t pci_dev; |
| 1558 |
uint8_t pci_fun; |
| 1559 |
uint32_t pci_flags; |
| 1560 |
uint8_t pci_segment; |
| 1561 |
uint32_t uart_clock; |
| 1562 |
uint32_t precise_baud_rate; |
| 1563 |
uint16_t namespace_string_length; |
| 1564 |
uint16_t namespace_string_offset; |
| 1565 |
char namespacestring[]; |
| 1566 |
} __packed acpi_spcr_t; |
| 1567 |
_Static_assert(sizeof(acpi_spcr_t) == 88, "acpi_spcr_t must have an 88 byte size\n"); |
| 1568 |
|
| 1569 |
#define PC_AT_COMPATIBLE_INTERRUPT (1 << 0) |
| 1570 |
#define IO_APIC_COMPATIBLE_INTERRUPT (1 << 1) |
| 1571 |
#define IO_SAPIC_COMPATIBLE_INTERRUPT (1 << 2) |
| 1572 |
#define ARMH_GIC_COMPATIBLE_INTERRUPT (1 << 3) |
| 1573 |
#define RISCV_PLIC_COMPATIBLE_INTERRUPT (1 << 4) |
| 1574 |
|
| 1575 |
|
| 1576 |
typedef struct acpi_table_gtdt { |
| 1577 |
acpi_header_t header; |
| 1578 |
u64 counter_block_address; |
| 1579 |
u32 reserved; |
| 1580 |
u32 secure_el1_interrupt; |
| 1581 |
u32 secure_el1_flags; |
| 1582 |
u32 non_secure_el1_interrupt; |
| 1583 |
u32 non_secure_el1_flags; |
| 1584 |
u32 virtual_timer_interrupt; |
| 1585 |
u32 virtual_timer_flags; |
| 1586 |
u32 non_secure_el2_interrupt; |
| 1587 |
u32 non_secure_el2_flags; |
| 1588 |
u64 counter_read_block_address; |
| 1589 |
u32 platform_timer_count; |
| 1590 |
u32 platform_timer_offset; |
| 1591 |
} __packed acpi_gtdt_t; |
| 1592 |
|
| 1593 |
|
| 1594 |
|
| 1595 |
#define ACPI_GTDT_INTERRUPT_MODE (1) |
| 1596 |
#define ACPI_GTDT_INTERRUPT_POLARITY (1<<1) |
| 1597 |
#define ACPI_GTDT_ALWAYS_ON (1<<2) |
| 1598 |
|
| 1599 |
struct acpi_gtdt_el2 { |
| 1600 |
u32 virtual_el2_timer_gsiv; |
| 1601 |
u32 virtual_el2_timer_flags; |
| 1602 |
}; |
| 1603 |
|
| 1604 |
|
| 1605 |
|
| 1606 |
struct acpi_gtdt_header { |
| 1607 |
u8 type; |
| 1608 |
u16 length; |
| 1609 |
} __packed; |
| 1610 |
|
| 1611 |
|
| 1612 |
|
| 1613 |
enum acpi_gtdt_type { |
| 1614 |
ACPI_GTDT_TYPE_TIMER_BLOCK = 0, |
| 1615 |
ACPI_GTDT_TYPE_WATCHDOG = 1, |
| 1616 |
ACPI_GTDT_TYPE_RESERVED = 2 |
| 1617 |
}; |
| 1618 |
|
| 1619 |
|
| 1620 |
|
| 1621 |
|
| 1622 |
|
| 1623 |
struct acpi_gtdt_timer_block { |
| 1624 |
struct acpi_gtdt_header header; |
| 1625 |
u8 reserved; |
| 1626 |
u64 block_address; |
| 1627 |
u32 timer_count; |
| 1628 |
u32 timer_offset; |
| 1629 |
} __packed; |
| 1630 |
|
| 1631 |
|
| 1632 |
|
| 1633 |
struct acpi_gtdt_timer_entry { |
| 1634 |
u8 frame_number; |
| 1635 |
u8 reserved[3]; |
| 1636 |
u64 base_address; |
| 1637 |
u64 el0_base_address; |
| 1638 |
u32 timer_interrupt; |
| 1639 |
u32 timer_flags; |
| 1640 |
u32 virtual_timer_interrupt; |
| 1641 |
u32 virtual_timer_flags; |
| 1642 |
u32 common_flags; |
| 1643 |
} __packed; |
| 1644 |
|
| 1645 |
|
| 1646 |
|
| 1647 |
#define ACPI_GTDT_GT_IRQ_MODE (1) |
| 1648 |
#define ACPI_GTDT_GT_IRQ_POLARITY (1<<1) |
| 1649 |
|
| 1650 |
|
| 1651 |
|
| 1652 |
#define ACPI_GTDT_GT_IS_SECURE_TIMER (1) |
| 1653 |
#define ACPI_GTDT_GT_ALWAYS_ON (1<<1) |
| 1654 |
|
| 1655 |
|
| 1656 |
|
| 1657 |
struct acpi_gtdt_watchdog { |
| 1658 |
struct acpi_gtdt_header header; |
| 1659 |
u8 reserved; |
| 1660 |
u64 refresh_frame_address; |
| 1661 |
u64 control_frame_address; |
| 1662 |
u32 timer_interrupt; |
| 1663 |
u32 timer_flags; |
| 1664 |
} __packed; |
| 1665 |
|
| 1666 |
|
| 1667 |
|
| 1668 |
#define ACPI_GTDT_WATCHDOG_IRQ_MODE (1) |
| 1669 |
#define ACPI_GTDT_WATCHDOG_IRQ_POLARITY (1<<1) |
| 1670 |
#define ACPI_GTDT_WATCHDOG_SECURE (1<<2) |
| 1671 |
|
| 1672 |
enum acpi_wdat_actions { |
| 1673 |
ACPI_WDAT_RESET = 1, |
| 1674 |
ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, |
| 1675 |
ACPI_WDAT_GET_COUNTDOWN = 5, |
| 1676 |
ACPI_WDAT_SET_COUNTDOWN = 6, |
| 1677 |
ACPI_WDAT_GET_RUNNING_STATE = 8, |
| 1678 |
ACPI_WDAT_SET_RUNNING_STATE = 9, |
| 1679 |
ACPI_WDAT_GET_STOPPED_STATE = 10, |
| 1680 |
ACPI_WDAT_SET_STOPPED_STATE = 11, |
| 1681 |
ACPI_WDAT_GET_REBOOT = 16, |
| 1682 |
ACPI_WDAT_SET_REBOOT = 17, |
| 1683 |
ACPI_WDAT_GET_SHUTDOWN = 18, |
| 1684 |
ACPI_WDAT_SET_SHUTDOWN = 19, |
| 1685 |
ACPI_WDAT_GET_STATUS = 32, |
| 1686 |
ACPI_WDAT_SET_STATUS = 33, |
| 1687 |
ACPI_WDAT_ACTION_RESERVED = 34 |
| 1688 |
}; |
| 1689 |
|
| 1690 |
enum acpi_wdat_instructions { |
| 1691 |
ACPI_WDAT_READ_VALUE = 0, |
| 1692 |
ACPI_WDAT_READ_COUNTDOWN = 1, |
| 1693 |
ACPI_WDAT_WRITE_VALUE = 2, |
| 1694 |
ACPI_WDAT_WRITE_COUNTDOWN = 3, |
| 1695 |
ACPI_WDAT_INSTRUCTION_RESERVED = 4, |
| 1696 |
ACPI_WDAT_PRESERVE_REGISTER = 0x80 |
| 1697 |
}; |
| 1698 |
|
| 1699 |
enum acpi_wdat_flags { |
| 1700 |
ACPI_WDAT_FLAG_DISABLED = 0, |
| 1701 |
ACPI_WDAT_FLAG_ENABLED = 1 |
| 1702 |
}; |
| 1703 |
|
| 1704 |
enum acpi_wdat_access_size { |
| 1705 |
ACPI_WDAT_ACCESS_SIZE_BYTE = 1, |
| 1706 |
ACPI_WDAT_ACCESS_SIZE_WORD = 2, |
| 1707 |
ACPI_WDAT_ACCESS_SIZE_DWORD = 3 |
| 1708 |
}; |
| 1709 |
|
| 1710 |
|
| 1711 |
typedef struct acpi_wdat_entry { |
| 1712 |
u8 action; |
| 1713 |
u8 instruction; |
| 1714 |
u16 reserved; |
| 1715 |
struct acpi_gen_regaddr register_region; |
| 1716 |
u32 value; |
| 1717 |
u32 mask; |
| 1718 |
} __packed acpi_wdat_entry_t; |
| 1719 |
|
| 1720 |
typedef struct acpi_table_wdat { |
| 1721 |
acpi_header_t header; |
| 1722 |
u32 header_length; |
| 1723 |
u16 pci_segment; |
| 1724 |
u8 pci_bus; |
| 1725 |
u8 pci_device; |
| 1726 |
u8 pci_function; |
| 1727 |
u8 reserved[3]; |
| 1728 |
u32 timer_period; |
| 1729 |
u32 max_count; |
| 1730 |
u32 min_count; |
| 1731 |
u8 flags; |
| 1732 |
u8 reserved2[3]; |
| 1733 |
u32 entries; |
| 1734 |
} __packed acpi_wdat_t; |
| 1735 |
|
| 1736 |
uintptr_t get_coreboot_rsdp(void); |
| 1737 |
void acpi_create_einj(acpi_einj_t *einj, uintptr_t addr, u8 actions); |
| 1738 |
|
| 1739 |
unsigned long fw_cfg_acpi_tables(unsigned long start); |
| 1740 |
|
| 1741 |
|
| 1742 |
unsigned long write_acpi_tables(const unsigned long addr); |
| 1743 |
unsigned long acpi_fill_madt(unsigned long current); |
| 1744 |
unsigned long acpi_arch_fill_madt(acpi_madt_t *madt, unsigned long current); |
| 1745 |
|
| 1746 |
void acpi_fill_fadt(acpi_fadt_t *fadt); |
| 1747 |
void arch_fill_fadt(acpi_fadt_t *fadt); |
| 1748 |
void soc_fill_fadt(acpi_fadt_t *fadt); |
| 1749 |
void mainboard_fill_fadt(acpi_fadt_t *fadt); |
| 1750 |
|
| 1751 |
void fill_fadt_extended_pm_io(acpi_fadt_t *fadt); |
| 1752 |
|
| 1753 |
void acpi_fill_gnvs(void); |
| 1754 |
void acpi_fill_cnvs(void); |
| 1755 |
|
| 1756 |
unsigned long acpi_fill_lpit(unsigned long current); |
| 1757 |
|
| 1758 |
|
| 1759 |
u8 acpi_checksum(u8 *table, u32 length); |
| 1760 |
|
| 1761 |
void acpi_add_table(acpi_rsdp_t *rsdp, void *table); |
| 1762 |
|
| 1763 |
|
| 1764 |
void acpi_create_cedt(acpi_cedt_t *cedt, |
| 1765 |
unsigned long (*acpi_fill_cedt_func)(unsigned long current)); |
| 1766 |
|
| 1767 |
int acpi_create_cedt_chbs(acpi_cedt_chbs_t *chbs, u32 uid, u32 cxl_ver, u64 base); |
| 1768 |
|
| 1769 |
int acpi_create_cedt_cfmws(acpi_cedt_cfmws_t *cfmws, u64 base_hpa, u64 window_size, |
| 1770 |
u8 eniw, u32 hbig, u16 restriction, u16 qtg_id, const u32 *interleave_target); |
| 1771 |
|
| 1772 |
|
| 1773 |
void acpi_create_pptt_body(acpi_pptt_t *pptt); |
| 1774 |
struct pptt_topology *acpi_get_pptt_topology(void); |
| 1775 |
|
| 1776 |
int acpi_create_madt_ioapic_from_hw(acpi_madt_ioapic_t *ioapic, u32 addr); |
| 1777 |
|
| 1778 |
unsigned long acpi_create_madt_one_lapic(unsigned long current, u32 cpu, u32 apic); |
| 1779 |
|
| 1780 |
unsigned long acpi_create_madt_lapic_nmis(unsigned long current); |
| 1781 |
|
| 1782 |
void platform_fill_gicc(acpi_madt_gicc_t *gicc); |
| 1783 |
uintptr_t platform_get_gicd_base(void); |
| 1784 |
uintptr_t platform_get_gicr_base(void); |
| 1785 |
int platform_get_gic_its(uintptr_t **base); |
| 1786 |
|
| 1787 |
int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic); |
| 1788 |
int acpi_create_srat_x2apic(acpi_srat_x2apic_t *x2apic, u32 node, u32 apic); |
| 1789 |
int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, |
| 1790 |
u32 flags); |
| 1791 |
|
| 1792 |
|
| 1793 |
|
| 1794 |
|
| 1795 |
int acpi_create_srat_gia_pci(acpi_srat_gia_t *gia, u32 proximity_domain, |
| 1796 |
struct device *dev, u32 flags); |
| 1797 |
unsigned long acpi_create_srat_lapics(unsigned long current); |
| 1798 |
void acpi_create_srat(acpi_srat_t *srat, |
| 1799 |
unsigned long (*acpi_fill_srat_func)(unsigned long current)); |
| 1800 |
|
| 1801 |
void acpi_create_slit(acpi_slit_t *slit, |
| 1802 |
unsigned long (*acpi_fill_slit_func)(unsigned long current)); |
| 1803 |
|
| 1804 |
|
| 1805 |
|
| 1806 |
|
| 1807 |
|
| 1808 |
|
| 1809 |
int acpi_create_hmat_mpda(acpi_hmat_mpda_t *mpda, u32 initiator, u32 memory); |
| 1810 |
|
| 1811 |
void acpi_create_hmat(acpi_hmat_t *hmat, |
| 1812 |
unsigned long (*acpi_fill_hmat_func)(unsigned long current)); |
| 1813 |
|
| 1814 |
void acpi_create_vfct(const struct device *device, |
| 1815 |
acpi_vfct_t *vfct, |
| 1816 |
unsigned long (*acpi_fill_vfct_func)(const struct device *device, |
| 1817 |
acpi_vfct_t *vfct_struct, |
| 1818 |
unsigned long current)); |
| 1819 |
|
| 1820 |
void acpi_create_ipmi(const struct device *device, |
| 1821 |
struct acpi_spmi *spmi, |
| 1822 |
const u16 ipmi_revision, |
| 1823 |
const acpi_addr_t *addr, |
| 1824 |
const enum acpi_ipmi_interface_type type, |
| 1825 |
const s8 gpe_interrupt, |
| 1826 |
const u32 apic_interrupt, |
| 1827 |
const u32 uid); |
| 1828 |
|
| 1829 |
void acpi_create_ivrs(acpi_ivrs_t *ivrs, |
| 1830 |
unsigned long (*acpi_fill_ivrs_func)(acpi_ivrs_t *ivrs_struct, |
| 1831 |
unsigned long current)); |
| 1832 |
|
| 1833 |
void acpi_create_crat(struct acpi_crat_header *crat, |
| 1834 |
unsigned long (*acpi_fill_crat_func)(struct acpi_crat_header *crat_struct, |
| 1835 |
unsigned long current)); |
| 1836 |
|
| 1837 |
unsigned long acpi_write_hpet(const struct device *device, unsigned long start, |
| 1838 |
acpi_rsdp_t *rsdp); |
| 1839 |
|
| 1840 |
|
| 1841 |
void generate_cpu_entries(const struct device *device); |
| 1842 |
|
| 1843 |
unsigned long acpi_write_dbg2_pci_uart(acpi_rsdp_t *rsdp, unsigned long current, |
| 1844 |
const struct device *dev, uint8_t access_size); |
| 1845 |
unsigned long acpi_pl011_write_dbg2_uart(acpi_rsdp_t *rsdp, unsigned long current, |
| 1846 |
uint64_t base, const char *name); |
| 1847 |
unsigned long acpi_16550_mmio32_write_dbg2_uart(acpi_rsdp_t *rsdp, unsigned long current, |
| 1848 |
uint64_t base, const char *name); |
| 1849 |
|
| 1850 |
void acpi_create_dmar(acpi_dmar_t *dmar, enum dmar_flags flags, |
| 1851 |
unsigned long (*acpi_fill_dmar_func)(unsigned long)); |
| 1852 |
unsigned long acpi_create_dmar_drhd_4k(unsigned long current, u8 flags, |
| 1853 |
u16 segment, u64 bar); |
| 1854 |
unsigned long acpi_create_dmar_drhd(unsigned long current, u8 flags, |
| 1855 |
u16 segment, u64 bar, size_t size); |
| 1856 |
unsigned long acpi_create_dmar_rmrr(unsigned long current, u16 segment, |
| 1857 |
u64 bar, u64 limit); |
| 1858 |
unsigned long acpi_create_dmar_atsr(unsigned long current, u8 flags, |
| 1859 |
u16 segment); |
| 1860 |
unsigned long acpi_create_dmar_rhsa(unsigned long current, u64 base_addr, |
| 1861 |
u32 proximity_domain); |
| 1862 |
unsigned long acpi_create_dmar_andd(unsigned long current, u8 device_number, |
| 1863 |
const char *device_name); |
| 1864 |
unsigned long acpi_create_dmar_satc(unsigned long current, u8 flags, |
| 1865 |
u16 segment); |
| 1866 |
void acpi_dmar_drhd_fixup(unsigned long base, unsigned long current); |
| 1867 |
void acpi_dmar_rmrr_fixup(unsigned long base, unsigned long current); |
| 1868 |
void acpi_dmar_atsr_fixup(unsigned long base, unsigned long current); |
| 1869 |
void acpi_dmar_satc_fixup(unsigned long base, unsigned long current); |
| 1870 |
unsigned long acpi_create_dmar_ds_pci_br(unsigned long current, |
| 1871 |
u8 bus, u8 dev, u8 fn); |
| 1872 |
unsigned long acpi_create_dmar_ds_pci(unsigned long current, |
| 1873 |
u8 bus, u8 dev, u8 fn); |
| 1874 |
unsigned long acpi_create_dmar_ds_ioapic(unsigned long current, |
| 1875 |
u8 enumeration_id, |
| 1876 |
u8 bus, u8 dev, u8 fn); |
| 1877 |
unsigned long acpi_create_dmar_ds_ioapic_from_hw(unsigned long current, |
| 1878 |
u32 addr, u8 bus, u8 dev, u8 fn); |
| 1879 |
unsigned long acpi_create_dmar_ds_msi_hpet(unsigned long current, |
| 1880 |
u8 enumeration_id, |
| 1881 |
u8 bus, u8 dev, u8 fn); |
| 1882 |
void acpi_write_hest(acpi_hest_t *hest, |
| 1883 |
unsigned long (*acpi_fill_hest)(acpi_hest_t *hest)); |
| 1884 |
|
| 1885 |
unsigned long acpi_create_hest_error_source(acpi_hest_t *hest, |
| 1886 |
acpi_hest_esd_t *esd, u16 type, void *data, u16 len); |
| 1887 |
|
| 1888 |
unsigned long acpi_create_lpi_desc_ncst(acpi_lpi_desc_ncst_t *lpi_desc, uint16_t uid); |
| 1889 |
|
| 1890 |
|
| 1891 |
enum cb_err acpi_soc_get_bert_region(void **region, size_t *length); |
| 1892 |
|
| 1893 |
void acpi_soc_fill_gtdt(acpi_gtdt_t *gtdt); |
| 1894 |
unsigned long acpi_soc_gtdt_add_timers(uint32_t *count, unsigned long current); |
| 1895 |
unsigned long acpi_gtdt_add_timer_block(unsigned long current, const uint64_t address, |
| 1896 |
struct acpi_gtdt_timer_entry *timers, size_t number); |
| 1897 |
unsigned long acpi_gtdt_add_watchdog(unsigned long current, uint64_t refresh_frame, |
| 1898 |
uint64_t control_frame, uint32_t gsiv, uint32_t flags); |
| 1899 |
|
| 1900 |
|
| 1901 |
|
| 1902 |
|
| 1903 |
|
| 1904 |
|
| 1905 |
|
| 1906 |
|
| 1907 |
|
| 1908 |
|
| 1909 |
|
| 1910 |
|
| 1911 |
|
| 1912 |
|
| 1913 |
|
| 1914 |
|
| 1915 |
|
| 1916 |
|
| 1917 |
|
| 1918 |
|
| 1919 |
|
| 1920 |
|
| 1921 |
|
| 1922 |
|
| 1923 |
|
| 1924 |
|
| 1925 |
|
| 1926 |
|
| 1927 |
unsigned long acpi_soc_fill_wdat(acpi_wdat_t *wdat, unsigned long current); |
| 1928 |
|
| 1929 |
|
| 1930 |
void __noreturn acpi_resume(void *wake_vec); |
| 1931 |
void mainboard_suspend_resume(void); |
| 1932 |
void *acpi_find_wakeup_vector(void); |
| 1933 |
|
| 1934 |
|
| 1935 |
enum { |
| 1936 |
ACPI_S0 = 0, |
| 1937 |
ACPI_S1 = 1, |
| 1938 |
ACPI_S2 = 2, |
| 1939 |
ACPI_S3 = 3, |
| 1940 |
ACPI_S4 = 4, |
| 1941 |
ACPI_S5 = 5, |
| 1942 |
}; |
| 1943 |
|
| 1944 |
#if CONFIG(ACPI_INTEL_HARDWARE_SLEEP_VALUES) \ |
| 1945 |
|| CONFIG(ACPI_AMD_HARDWARE_SLEEP_VALUES) |
| 1946 |
|
| 1947 |
static inline int acpi_sleep_from_pm1(uint32_t pm1_cnt) |
| 1948 |
{ |
| 1949 |
switch (((pm1_cnt) & SLP_TYP) >> SLP_TYP_SHIFT) { |
| 1950 |
case SLP_TYP_S0: return ACPI_S0; |
| 1951 |
case SLP_TYP_S1: return ACPI_S1; |
| 1952 |
case SLP_TYP_S3: return ACPI_S3; |
| 1953 |
case SLP_TYP_S4: return ACPI_S4; |
| 1954 |
case SLP_TYP_S5: return ACPI_S5; |
| 1955 |
} |
| 1956 |
return -1; |
| 1957 |
} |
| 1958 |
#endif |
| 1959 |
|
| 1960 |
uint8_t acpi_get_preferred_pm_profile(void); |
| 1961 |
|
| 1962 |
|
| 1963 |
int acpi_get_sleep_type(void); |
| 1964 |
|
| 1965 |
|
| 1966 |
int acpi_get_gpe(int gpe); |
| 1967 |
|
| 1968 |
|
| 1969 |
|
| 1970 |
static inline bool permanent_smi_handler(void) |
| 1971 |
{ |
| 1972 |
return CONFIG(HAVE_SMI_HANDLER); |
| 1973 |
} |
| 1974 |
|
| 1975 |
static inline bool acpi_s3_resume_allowed(void) |
| 1976 |
{ |
| 1977 |
return CONFIG(HAVE_ACPI_RESUME); |
| 1978 |
} |
| 1979 |
|
| 1980 |
static inline int acpi_is_wakeup_s3(void) |
| 1981 |
{ |
| 1982 |
if (!acpi_s3_resume_allowed()) |
| 1983 |
return 0; |
| 1984 |
|
| 1985 |
if (ENV_ROMSTAGE_OR_BEFORE) |
| 1986 |
return (acpi_get_sleep_type() == ACPI_S3); |
| 1987 |
|
| 1988 |
return romstage_handoff_is_resume(); |
| 1989 |
} |
| 1990 |
|
| 1991 |
static inline uintptr_t acpi_align_current(uintptr_t current) |
| 1992 |
{ |
| 1993 |
return ALIGN_UP(current, 16); |
| 1994 |
} |
| 1995 |
|
| 1996 |
|
| 1997 |
|
| 1998 |
|
| 1999 |
|
| 2000 |
int get_acpi_table_revision(enum acpi_tables table); |
| 2001 |
u8 get_acpi_fadt_minor_version(void); |
| 2002 |
|
| 2003 |
#endif |
| 2004 |
|
| 2005 |
#endif |