| 1 |
|
| 2 |
|
| 3 |
#ifndef __ACPI_ACPIGEN_H__ |
| 4 |
#define __ACPI_ACPIGEN_H__ |
| 5 |
|
| 6 |
#include <stddef.h> |
| 7 |
#include <stdint.h> |
| 8 |
#include <acpi/acpi.h> |
| 9 |
#include <acpi/acpi_device.h> |
| 10 |
#include <acpi/acpi_pld.h> |
| 11 |
#include <device/pci_type.h> |
| 12 |
|
| 13 |
|
| 14 |
#define ACPI_STATUS_DEVICE_PRESENT (1 << 0) |
| 15 |
#define ACPI_STATUS_DEVICE_ENABLED (1 << 1) |
| 16 |
#define ACPI_STATUS_DEVICE_SHOW_IN_UI (1 << 2) |
| 17 |
#define ACPI_STATUS_DEVICE_STATE_OK (1 << 3) |
| 18 |
|
| 19 |
#define ACPI_STATUS_DEVICE_ALL_OFF 0 |
| 20 |
#define ACPI_STATUS_DEVICE_ALL_ON (ACPI_STATUS_DEVICE_PRESENT |\ |
| 21 |
ACPI_STATUS_DEVICE_ENABLED |\ |
| 22 |
ACPI_STATUS_DEVICE_SHOW_IN_UI |\ |
| 23 |
ACPI_STATUS_DEVICE_STATE_OK) |
| 24 |
#define ACPI_STATUS_DEVICE_HIDDEN_ON (ACPI_STATUS_DEVICE_PRESENT |\ |
| 25 |
ACPI_STATUS_DEVICE_ENABLED |\ |
| 26 |
ACPI_STATUS_DEVICE_STATE_OK) |
| 27 |
|
| 28 |
|
| 29 |
enum { |
| 30 |
ZERO_OP = 0x00, |
| 31 |
ONE_OP = 0x01, |
| 32 |
ALIAS_OP = 0x06, |
| 33 |
NAME_OP = 0x08, |
| 34 |
BYTE_PREFIX = 0x0A, |
| 35 |
WORD_PREFIX = 0x0B, |
| 36 |
DWORD_PREFIX = 0x0C, |
| 37 |
STRING_PREFIX = 0x0D, |
| 38 |
QWORD_PREFIX = 0x0E, |
| 39 |
SCOPE_OP = 0x10, |
| 40 |
BUFFER_OP = 0x11, |
| 41 |
PACKAGE_OP = 0x12, |
| 42 |
VARIABLE_PACKAGE_OP = 0x13, |
| 43 |
METHOD_OP = 0x14, |
| 44 |
EXTERNAL_OP = 0x15, |
| 45 |
DUAL_NAME_PREFIX = 0x2E, |
| 46 |
MULTI_NAME_PREFIX = 0x2F, |
| 47 |
EXT_OP_PREFIX = 0x5B, |
| 48 |
MUTEX_OP = 0x01, |
| 49 |
EVENT_OP = 0x02, |
| 50 |
SF_RIGHT_OP = 0x10, |
| 51 |
SF_LEFT_OP = 0x11, |
| 52 |
COND_REFOF_OP = 0x12, |
| 53 |
CREATEFIELD_OP = 0x13, |
| 54 |
LOAD_TABLE_OP = 0x1f, |
| 55 |
LOAD_OP = 0x20, |
| 56 |
STALL_OP = 0x21, |
| 57 |
SLEEP_OP = 0x22, |
| 58 |
ACQUIRE_OP = 0x23, |
| 59 |
SIGNAL_OP = 0x24, |
| 60 |
WAIT_OP = 0x25, |
| 61 |
RST_OP = 0x26, |
| 62 |
RELEASE_OP = 0x27, |
| 63 |
FROM_BCD_OP = 0x28, |
| 64 |
TO_BCD_OP = 0x29, |
| 65 |
UNLOAD_OP = 0x2A, |
| 66 |
REVISON_OP = 0x30, |
| 67 |
DEBUG_OP = 0x31, |
| 68 |
FATAL_OP = 0x32, |
| 69 |
TIMER_OP = 0x33, |
| 70 |
OPREGION_OP = 0x80, |
| 71 |
FIELD_OP = 0x81, |
| 72 |
DEVICE_OP = 0x82, |
| 73 |
PROCESSOR_OP = 0x83, |
| 74 |
POWER_RES_OP = 0x84, |
| 75 |
THERMAL_ZONE_OP = 0x85, |
| 76 |
INDEX_FIELD_OP = 0x86, |
| 77 |
BANK_FIELD_OP = 0x87, |
| 78 |
DATA_REGION_OP = 0x88, |
| 79 |
ROOT_PREFIX = 0x5C, |
| 80 |
PARENT_PREFIX = 0x5E, |
| 81 |
LOCAL0_OP = 0x60, |
| 82 |
LOCAL1_OP = 0x61, |
| 83 |
LOCAL2_OP = 0x62, |
| 84 |
LOCAL3_OP = 0x63, |
| 85 |
LOCAL4_OP = 0x64, |
| 86 |
LOCAL5_OP = 0x65, |
| 87 |
LOCAL6_OP = 0x66, |
| 88 |
LOCAL7_OP = 0x67, |
| 89 |
ARG0_OP = 0x68, |
| 90 |
ARG1_OP = 0x69, |
| 91 |
ARG2_OP = 0x6A, |
| 92 |
ARG3_OP = 0x6B, |
| 93 |
ARG4_OP = 0x6C, |
| 94 |
ARG5_OP = 0x6D, |
| 95 |
ARG6_OP = 0x6E, |
| 96 |
STORE_OP = 0x70, |
| 97 |
REF_OF_OP = 0x71, |
| 98 |
ADD_OP = 0x72, |
| 99 |
CONCATENATE_OP = 0x73, |
| 100 |
SUBTRACT_OP = 0x74, |
| 101 |
INCREMENT_OP = 0x75, |
| 102 |
DECREMENT_OP = 0x76, |
| 103 |
MULTIPLY_OP = 0x77, |
| 104 |
DIVIDE_OP = 0x78, |
| 105 |
SHIFT_LEFT_OP = 0x79, |
| 106 |
SHIFT_RIGHT_OP = 0x7A, |
| 107 |
AND_OP = 0x7B, |
| 108 |
NAND_OP = 0x7C, |
| 109 |
OR_OP = 0x7D, |
| 110 |
NOR_OP = 0x7E, |
| 111 |
XOR_OP = 0x7F, |
| 112 |
NOT_OP = 0x80, |
| 113 |
FD_SHIFT_LEFT_BIT_OR = 0x81, |
| 114 |
FD_SHIFT_RIGHT_BIT_OR = 0x82, |
| 115 |
DEREF_OP = 0x83, |
| 116 |
CONCATENATE_TEMP_OP = 0x84, |
| 117 |
MOD_OP = 0x85, |
| 118 |
NOTIFY_OP = 0x86, |
| 119 |
SIZEOF_OP = 0x87, |
| 120 |
INDEX_OP = 0x88, |
| 121 |
MATCH_OP = 0x89, |
| 122 |
CREATE_DWORD_OP = 0x8A, |
| 123 |
CREATE_WORD_OP = 0x8B, |
| 124 |
CREATE_BYTE_OP = 0x8C, |
| 125 |
CREATE_BIT_OP = 0x8D, |
| 126 |
OBJ_TYPE_OP = 0x8E, |
| 127 |
CREATE_QWORD_OP = 0x8F, |
| 128 |
LAND_OP = 0x90, |
| 129 |
LOR_OP = 0x91, |
| 130 |
LNOT_OP = 0x92, |
| 131 |
LEQUAL_OP = 0x93, |
| 132 |
LGREATER_OP = 0x94, |
| 133 |
LLESS_OP = 0x95, |
| 134 |
TO_BUFFER_OP = 0x96, |
| 135 |
TO_DEC_STRING_OP = 0x97, |
| 136 |
TO_HEX_STRING_OP = 0x98, |
| 137 |
TO_INTEGER_OP = 0x99, |
| 138 |
TO_STRING_OP = 0x9C, |
| 139 |
CP_OBJ_OP = 0x9D, |
| 140 |
MID_OP = 0x9E, |
| 141 |
CONTINUE_OP = 0x9F, |
| 142 |
IF_OP = 0xA0, |
| 143 |
ELSE_OP = 0xA1, |
| 144 |
WHILE_OP = 0xA2, |
| 145 |
NOOP_OP = 0xA3, |
| 146 |
RETURN_OP = 0xA4, |
| 147 |
BREAK_OP = 0xA5, |
| 148 |
COMMENT_OP = 0xA9, |
| 149 |
BREAKPIONT_OP = 0xCC, |
| 150 |
ONES_OP = 0xFF, |
| 151 |
}; |
| 152 |
|
| 153 |
#define FIELDLIST_OFFSET(X) { .type = OFFSET, \ |
| 154 |
.name = "",\ |
| 155 |
.bits = X * 8, \ |
| 156 |
} |
| 157 |
#define FIELDLIST_NAMESTR(X, Y) { .type = NAME_STRING, \ |
| 158 |
.name = X, \ |
| 159 |
.bits = Y, \ |
| 160 |
} |
| 161 |
#define FIELDLIST_RESERVED(X) { .type = RESERVED, \ |
| 162 |
.name = "", \ |
| 163 |
.bits = X, \ |
| 164 |
} |
| 165 |
|
| 166 |
#define FIELD_ANYACC 0 |
| 167 |
#define FIELD_BYTEACC 1 |
| 168 |
#define FIELD_WORDACC 2 |
| 169 |
#define FIELD_DWORDACC 3 |
| 170 |
#define FIELD_QWORDACC 4 |
| 171 |
#define FIELD_BUFFERACC 5 |
| 172 |
#define FIELD_NOLOCK (0<<4) |
| 173 |
#define FIELD_LOCK (1<<4) |
| 174 |
#define FIELD_PRESERVE (0<<5) |
| 175 |
#define FIELD_WRITEASONES (1<<5) |
| 176 |
#define FIELD_WRITEASZEROS (2<<5) |
| 177 |
|
| 178 |
enum field_type { |
| 179 |
OFFSET, |
| 180 |
NAME_STRING, |
| 181 |
RESERVED, |
| 182 |
FIELD_TYPE_MAX, |
| 183 |
}; |
| 184 |
|
| 185 |
struct fieldlist { |
| 186 |
enum field_type type; |
| 187 |
const char *name; |
| 188 |
u32 bits; |
| 189 |
}; |
| 190 |
|
| 191 |
#define OPREGION(rname, space, offset, len) {.name = rname, \ |
| 192 |
.regionspace = space, \ |
| 193 |
.regionoffset = offset, \ |
| 194 |
.regionlen = len, \ |
| 195 |
} |
| 196 |
|
| 197 |
enum region_space { |
| 198 |
SYSTEMMEMORY, |
| 199 |
SYSTEMIO, |
| 200 |
PCI_CONFIG, |
| 201 |
EMBEDDEDCONTROL, |
| 202 |
SMBUS, |
| 203 |
CMOS, |
| 204 |
PCIBARTARGET, |
| 205 |
IPMI, |
| 206 |
GPIO_REGION, |
| 207 |
GPSERIALBUS, |
| 208 |
PCC, |
| 209 |
FIXED_HARDWARE = 0x7F, |
| 210 |
REGION_SPACE_MAX, |
| 211 |
}; |
| 212 |
|
| 213 |
enum acpi_resource_type { |
| 214 |
RSRC_TYPE_MEM = 0, |
| 215 |
RSRC_TYPE_IO = 1, |
| 216 |
RSRC_TYPE_BUS = 2 |
| 217 |
}; |
| 218 |
|
| 219 |
enum acpi_decode_type { |
| 220 |
DECODE_10, |
| 221 |
DECODE_16 |
| 222 |
}; |
| 223 |
|
| 224 |
enum acpi_read_write_type { |
| 225 |
READ_ONLY, |
| 226 |
READ_WRITE |
| 227 |
}; |
| 228 |
|
| 229 |
enum acpi_cacheable_type { |
| 230 |
NON_CACHEABLE, |
| 231 |
CACHEABLE |
| 232 |
}; |
| 233 |
|
| 234 |
enum acpi_resource_subtype { |
| 235 |
DWORD_IO, |
| 236 |
DWORD_MEMORY, |
| 237 |
IO, |
| 238 |
MEMORY_32_FIXED, |
| 239 |
QWORD_MEMORY, |
| 240 |
WORD_BUS_NUMBER |
| 241 |
}; |
| 242 |
|
| 243 |
|
| 244 |
#define MEM_RSRC_FLAG_TRNSL_TYPE_STATIC 0x0 |
| 245 |
#define MEM_RSRC_FLAG_TRNSL_TYPE_TRANSLATION (0x1 << 5) |
| 246 |
#define MEM_RSRC_FLAG_ADDR_RNG_MEM 0x0 |
| 247 |
#define MEM_RSRC_FLAG_ADDR_RNG_RSV (0x1 << 3) |
| 248 |
#define MEM_RSRC_FLAG_ADDR_RNG_ACPI (0x2 << 3) |
| 249 |
#define MEM_RSRC_FLAG_ADDR_RNG_NVA (0x3 << 3) |
| 250 |
#define MEM_RSRC_FLAG_MEM_ATTR_NON_CACHE 0x0 |
| 251 |
#define MEM_RSRC_FLAG_MEM_ATTR_CACHE (0x1 << 1) |
| 252 |
#define MEM_RSRC_FLAG_MEM_ATTR_CACHE_WRT (0x2 << 1) |
| 253 |
#define MEM_RSRC_FLAG_MEM_ATTR_CACHE_PREFETCH (0x3 << 1) |
| 254 |
#define MEM_RSRC_FLAG_MEM_READ_ONLY 0x0 |
| 255 |
#define MEM_RSRC_FLAG_MEM_READ_WRITE 0x1 |
| 256 |
|
| 257 |
|
| 258 |
#define IO_RSRC_FLAG_ENTIRE_RANGE 0x3 |
| 259 |
#define IO_RSRC_FLAG_ISA_ONLY 0x2 |
| 260 |
#define IO_RSRC_FLAG_NON_ISA_ONLY 0x1 |
| 261 |
#define IO_RSRC_FLAG_TRASL_TYPE_STATIC 0x0 |
| 262 |
#define IO_RSRC_FLAG_TRNSL_TYPE_TRANSLATION (0x1 << 4) |
| 263 |
#define IO_RSRC_FLAG_SPRS_TRASL_DENSE 0x0 |
| 264 |
#define IO_RSRC_FLAG_SPRS_TRNSL_SPARSE (0x1 << 5) |
| 265 |
|
| 266 |
|
| 267 |
#define BUS_NUM_RANGE_RESOURCE_FLAG 0x0 // reserved |
| 268 |
|
| 269 |
|
| 270 |
#define ADDR_SPACE_GENERAL_FLAG_MAX_FIXED (0x1 << 3) |
| 271 |
#define ADDR_SPACE_GENERAL_FLAG_MAX_NOT_FIXED 0x0 |
| 272 |
#define ADDR_SPACE_GENERAL_FLAG_MIN_FIXED (0x1 << 2) |
| 273 |
#define ADDR_SPACE_GENERAL_FLAG_MIN_NOT_FIXED 0x0 |
| 274 |
#define ADDR_SPACE_GENERAL_FLAG_DEC_SUB (0x1 << 1) |
| 275 |
#define ADDR_SPACE_GENERAL_FLAG_DEC_POS 0x0 |
| 276 |
#define ADDR_SPACE_GENERAL_FLAG_CONSUMER 0x10 |
| 277 |
#define ADDR_SPACE_GENERAL_FLAG_PRODUCER 0x0 |
| 278 |
|
| 279 |
struct opregion { |
| 280 |
const char *name; |
| 281 |
enum region_space regionspace; |
| 282 |
unsigned long regionoffset; |
| 283 |
unsigned long regionlen; |
| 284 |
}; |
| 285 |
|
| 286 |
#define DSM_UUID(DSM_UUID, DSM_CALLBACKS, DSM_COUNT, DSM_ARG) \ |
| 287 |
{ .uuid = DSM_UUID, \ |
| 288 |
.callbacks = DSM_CALLBACKS, \ |
| 289 |
.count = DSM_COUNT, \ |
| 290 |
.arg = DSM_ARG, \ |
| 291 |
} |
| 292 |
|
| 293 |
struct dsm_uuid { |
| 294 |
const char *uuid; |
| 295 |
void (**callbacks)(void *); |
| 296 |
size_t count; |
| 297 |
void *arg; |
| 298 |
}; |
| 299 |
|
| 300 |
#define CPPC_VERSION_1 1 |
| 301 |
#define CPPC_VERSION_2 2 |
| 302 |
#define CPPC_VERSION_3 3 |
| 303 |
|
| 304 |
#define CPPC_PACKAGE_NAME "GCPC" |
| 305 |
|
| 306 |
|
| 307 |
enum cppc_fields { |
| 308 |
CPPC_HIGHEST_PERF, |
| 309 |
CPPC_NOMINAL_PERF, |
| 310 |
CPPC_LOWEST_NONL_PERF, |
| 311 |
CPPC_LOWEST_PERF, |
| 312 |
CPPC_GUARANTEED_PERF, |
| 313 |
CPPC_DESIRED_PERF, |
| 314 |
CPPC_MIN_PERF, |
| 315 |
CPPC_MAX_PERF, |
| 316 |
CPPC_PERF_REDUCE_TOLERANCE, |
| 317 |
CPPC_TIME_WINDOW, |
| 318 |
CPPC_COUNTER_WRAP, |
| 319 |
CPPC_REF_PERF_COUNTER, |
| 320 |
CPPC_DELIVERED_PERF_COUNTER, |
| 321 |
CPPC_PERF_LIMITED, |
| 322 |
CPPC_ENABLE, |
| 323 |
CPPC_MAX_FIELDS_VER_1, |
| 324 |
CPPC_AUTO_SELECT = |
| 325 |
CPPC_MAX_FIELDS_VER_1, |
| 326 |
CPPC_AUTO_ACTIVITY_WINDOW, |
| 327 |
CPPC_PERF_PREF, |
| 328 |
CPPC_REF_PERF, |
| 329 |
CPPC_MAX_FIELDS_VER_2, |
| 330 |
CPPC_LOWEST_FREQ = |
| 331 |
CPPC_MAX_FIELDS_VER_2, |
| 332 |
CPPC_NOMINAL_FREQ, |
| 333 |
CPPC_MAX_FIELDS_VER_3, |
| 334 |
}; |
| 335 |
|
| 336 |
typedef struct cppc_entry { |
| 337 |
enum { CPPC_TYPE_REG, CPPC_TYPE_DWORD } type; |
| 338 |
union { |
| 339 |
acpi_addr_t reg; |
| 340 |
uint32_t dword; |
| 341 |
}; |
| 342 |
} cppc_entry_t; |
| 343 |
|
| 344 |
#define CPPC_DWORD(_dword) \ |
| 345 |
(cppc_entry_t){ \ |
| 346 |
.type = CPPC_TYPE_DWORD, \ |
| 347 |
.dword = _dword, \ |
| 348 |
} |
| 349 |
|
| 350 |
#define CPPC_REG(_reg) \ |
| 351 |
(cppc_entry_t){ \ |
| 352 |
.type = CPPC_TYPE_REG, \ |
| 353 |
.reg = _reg, \ |
| 354 |
} |
| 355 |
|
| 356 |
#define CPPC_REG_MSR(address, offset, width) CPPC_REG(ACPI_REG_MSR(address, offset, width)) |
| 357 |
#define CPPC_UNSUPPORTED CPPC_REG(ACPI_REG_UNSUPPORTED) |
| 358 |
|
| 359 |
struct cppc_config { |
| 360 |
u32 version; |
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
cppc_entry_t entries[CPPC_MAX_FIELDS_VER_3]; |
| 367 |
}; |
| 368 |
|
| 369 |
#define ACPI_MUTEX_NO_TIMEOUT 0xffff |
| 370 |
|
| 371 |
void acpigen_write_return_integer(uint64_t arg); |
| 372 |
void acpigen_write_return_namestr(const char *arg); |
| 373 |
void acpigen_write_return_string(const char *arg); |
| 374 |
void acpigen_write_len_f(void); |
| 375 |
void acpigen_pop_len(void); |
| 376 |
void acpigen_set_current(char *curr); |
| 377 |
char *acpigen_get_current(void); |
| 378 |
char *acpigen_write_package(int nr_el); |
| 379 |
__always_inline void acpigen_write_package_end(void) |
| 380 |
{ |
| 381 |
acpigen_pop_len(); |
| 382 |
} |
| 383 |
void acpigen_write_zero(void); |
| 384 |
void acpigen_write_one(void); |
| 385 |
void acpigen_write_ones(void); |
| 386 |
void acpigen_write_byte(unsigned int data); |
| 387 |
void acpigen_emit_byte(unsigned char data); |
| 388 |
void acpigen_emit_ext_op(uint8_t op); |
| 389 |
void acpigen_emit_word(unsigned int data); |
| 390 |
void acpigen_emit_dword(unsigned int data); |
| 391 |
void acpigen_emit_stream(const char *data, int size); |
| 392 |
void acpigen_emit_string(const char *string); |
| 393 |
void acpigen_emit_namestring(const char *namepath); |
| 394 |
void acpigen_emit_eisaid(const char *eisaid); |
| 395 |
void acpigen_write_word(unsigned int data); |
| 396 |
void acpigen_write_dword(unsigned int data); |
| 397 |
void acpigen_write_qword(uint64_t data); |
| 398 |
void acpigen_write_integer(uint64_t data); |
| 399 |
void acpigen_write_string(const char *string); |
| 400 |
void acpigen_write_name_unicode(const char *name, const char *string); |
| 401 |
void acpigen_write_name(const char *name); |
| 402 |
void acpigen_write_name_string(const char *name, const char *string); |
| 403 |
void acpigen_write_name_dword(const char *name, uint32_t val); |
| 404 |
void acpigen_write_name_qword(const char *name, uint64_t val); |
| 405 |
void acpigen_write_name_byte(const char *name, uint8_t val); |
| 406 |
void acpigen_write_name_integer(const char *name, uint64_t val); |
| 407 |
void acpigen_write_coreboot_hid(enum coreboot_acpi_ids id); |
| 408 |
void acpigen_write_scope(const char *name); |
| 409 |
__always_inline void acpigen_write_scope_end(void) |
| 410 |
{ |
| 411 |
acpigen_pop_len(); |
| 412 |
} |
| 413 |
void acpigen_write_method(const char *name, int nargs); |
| 414 |
void acpigen_write_method_serialized(const char *name, int nargs); |
| 415 |
__always_inline void acpigen_write_method_end(void) |
| 416 |
{ |
| 417 |
acpigen_pop_len(); |
| 418 |
} |
| 419 |
void acpigen_write_device(const char *name); |
| 420 |
__always_inline void acpigen_write_device_end(void) |
| 421 |
{ |
| 422 |
acpigen_pop_len(); |
| 423 |
} |
| 424 |
void acpigen_write_thermal_zone(const char *name); |
| 425 |
__always_inline void acpigen_write_thermal_zone_end(void) |
| 426 |
{ |
| 427 |
acpigen_pop_len(); |
| 428 |
} |
| 429 |
void acpigen_write_LPI_package(u64 level, const struct acpi_lpi_state *states, u16 nentries); |
| 430 |
void acpigen_write_PPC(u8 nr); |
| 431 |
void acpigen_write_PPC_NVS(void); |
| 432 |
void acpigen_write_empty_PCT(void); |
| 433 |
void acpigen_write_empty_PTC(void); |
| 434 |
void acpigen_write_PTC(uint8_t duty_width, uint8_t duty_offset, uint16_t p_cnt); |
| 435 |
void acpigen_write_PRW(u32 wake, u32 level); |
| 436 |
void acpigen_write_STA(uint8_t status); |
| 437 |
void acpigen_write_STA_ext(const char *namestring); |
| 438 |
void acpigen_write_BBN(uint8_t base_bus_number); |
| 439 |
void acpigen_write_SEG(uint8_t segment_group_number); |
| 440 |
void acpigen_write_TPC(const char *gnvs_tpc_limit); |
| 441 |
void acpigen_write_PSS_package(u32 coreFreq, u32 power, u32 transLat, |
| 442 |
u32 busmLat, u32 control, u32 status); |
| 443 |
void acpigen_write_pss_object(const struct acpi_sw_pstate *pstate_values, size_t nentries); |
| 444 |
typedef enum { SW_ALL = 0xfc, SW_ANY = 0xfd, HW_ALL = 0xfe } PSD_coord; |
| 445 |
void acpigen_write_PSD_package(u32 domain, u32 numprocs, PSD_coord coordtype); |
| 446 |
void acpigen_write_CST_package_entry(const acpi_cstate_t *cstate); |
| 447 |
void acpigen_write_CST_package(const acpi_cstate_t *entry, int nentries); |
| 448 |
typedef enum { CSD_HW_ALL = 0xfe } CSD_coord; |
| 449 |
void acpigen_write_CSD_package(u32 domain, u32 numprocs, CSD_coord coordtype, |
| 450 |
u32 index); |
| 451 |
void acpigen_write_pct_package(const acpi_addr_t *perf_ctrl, const acpi_addr_t *perf_sts); |
| 452 |
void acpigen_write_xpss_package(const struct acpi_xpss_sw_pstate *pstate_value); |
| 453 |
void acpigen_write_xpss_object(const struct acpi_xpss_sw_pstate *pstate_values, |
| 454 |
size_t nentries); |
| 455 |
void acpigen_write_processor_namestring(unsigned int cpu_index); |
| 456 |
void acpigen_write_processor(u8 cpuindex, u32 pblock_addr, u8 pblock_len); |
| 457 |
__always_inline void acpigen_write_processor_end(void) |
| 458 |
{ |
| 459 |
acpigen_pop_len(); |
| 460 |
} |
| 461 |
void acpigen_write_processor_device(unsigned int cpu_index); |
| 462 |
__always_inline void acpigen_write_processor_device_end(void) |
| 463 |
{ |
| 464 |
acpigen_pop_len(); |
| 465 |
} |
| 466 |
void acpigen_write_processor_package(const char *name, |
| 467 |
unsigned int first_core, |
| 468 |
unsigned int core_count); |
| 469 |
void acpigen_write_processor_cnot(const unsigned int number_of_cores); |
| 470 |
void acpigen_write_TSS_package(int entries, acpi_tstate_t *tstate_list); |
| 471 |
void acpigen_write_TSD_package(u32 domain, u32 numprocs, PSD_coord coordtype); |
| 472 |
void acpigen_write_mem32fixed(int readwrite, u32 base, u32 size); |
| 473 |
void acpigen_write_io16(u16 min, u16 max, u8 align, u8 len, u8 decode16); |
| 474 |
void acpigen_write_register_resource(const acpi_addr_t *addr); |
| 475 |
void acpigen_write_resourcetemplate_header(void); |
| 476 |
void acpigen_write_resourcetemplate_footer(void); |
| 477 |
void acpigen_write_mainboard_resource_template(void); |
| 478 |
void acpigen_write_mainboard_resources(const char *scope, const char *name); |
| 479 |
void acpigen_write_irq(u16 mask); |
| 480 |
void acpigen_write_uuid(const char *uuid); |
| 481 |
void acpigen_write_power_res(const char *name, uint8_t level, uint16_t order, |
| 482 |
const char * const dev_states[], size_t dev_states_count); |
| 483 |
__always_inline void acpigen_write_power_res_end(void) |
| 484 |
{ |
| 485 |
acpigen_pop_len(); |
| 486 |
} |
| 487 |
void acpigen_write_sleep(uint64_t sleep_ms); |
| 488 |
void acpigen_write_store(void); |
| 489 |
void acpigen_write_store_int_to_namestr(uint64_t src, const char *dst); |
| 490 |
void acpigen_write_store_int_to_op(uint64_t src, uint8_t dst); |
| 491 |
void acpigen_write_store_ops(uint8_t src, uint8_t dst); |
| 492 |
void acpigen_write_store_op_to_namestr(uint8_t src, const char *dst); |
| 493 |
void acpigen_write_store_namestr_to_op(const char *src, uint8_t dst); |
| 494 |
void acpigen_write_store_namestr_to_namestr(const char *src, const char *dst); |
| 495 |
void acpigen_write_or(uint8_t arg1, uint8_t arg2, uint8_t res); |
| 496 |
void acpigen_write_xor(uint8_t arg1, uint8_t arg2, uint8_t res); |
| 497 |
void acpigen_write_and(uint8_t arg1, uint8_t arg2, uint8_t res); |
| 498 |
void acpigen_write_not(uint8_t arg, uint8_t res); |
| 499 |
void acpigen_concatenate_string_op(const char *str, uint8_t src_res, uint8_t dest_res); |
| 500 |
void acpigen_write_debug_string(const char *str); |
| 501 |
void acpigen_write_debug_namestr(const char *str); |
| 502 |
void acpigen_write_debug_integer(uint64_t val); |
| 503 |
void acpigen_write_debug_op(uint8_t op); |
| 504 |
void acpigen_write_debug_concatenate_string_op(const char *str1, uint8_t res, uint8_t tmp_res); |
| 505 |
void acpigen_write_debug_sprintf(const char *fmt, ...) __printf(1, 2); |
| 506 |
void acpigen_write_if(void); |
| 507 |
void acpigen_write_if_and(uint8_t arg1, uint8_t arg2); |
| 508 |
void acpigen_write_if_lequal_op_op(uint8_t op, uint8_t val); |
| 509 |
void acpigen_write_if_lnotequal_op_op(uint8_t op, uint8_t val); |
| 510 |
void acpigen_write_if_lgreater_op_op(uint8_t op1, uint8_t op2); |
| 511 |
void acpigen_write_if_lequal_op_int(uint8_t op, uint64_t val); |
| 512 |
void acpigen_write_if_lnotequal_op_int(uint8_t op, uint64_t val); |
| 513 |
void acpigen_write_if_lgreater_op_int(uint8_t op, uint64_t val); |
| 514 |
void acpigen_write_if_lequal_namestr_int(const char *namestr, uint64_t val); |
| 515 |
void acpigen_write_if_lnotequal_namestr_int(const char *namestr, uint64_t val); |
| 516 |
void acpigen_write_if_lgreater_namestr_int(const char *namestr, uint64_t val); |
| 517 |
__always_inline void acpigen_write_if_end(void) |
| 518 |
{ |
| 519 |
acpigen_pop_len(); |
| 520 |
} |
| 521 |
|
| 522 |
void acpigen_write_if_cond_ref_of(const char *namestring); |
| 523 |
void acpigen_write_else(void); |
| 524 |
void acpigen_write_shiftleft_op_int(uint8_t src_result, uint64_t count); |
| 525 |
void acpigen_write_to_buffer(uint8_t src, uint8_t dst); |
| 526 |
void acpigen_write_to_integer(uint8_t src, uint8_t dst); |
| 527 |
void acpigen_write_to_integer_from_namestring(const char *source, uint8_t dst_op); |
| 528 |
void acpigen_write_byte_buffer(uint8_t *arr, size_t size); |
| 529 |
void acpigen_write_return_byte_buffer(uint8_t *arr, size_t size); |
| 530 |
void acpigen_write_return_singleton_buffer(uint8_t arg); |
| 531 |
void acpigen_write_return_op(uint8_t arg); |
| 532 |
void acpigen_write_return_byte(uint8_t arg); |
| 533 |
void acpigen_write_upc(enum acpi_upc_type type); |
| 534 |
void acpigen_write_pld(const struct acpi_pld *pld); |
| 535 |
void acpigen_write_ADR(uint64_t adr); |
| 536 |
struct soundwire_address; |
| 537 |
void acpigen_write_ADR_soundwire_device(const struct soundwire_address *address); |
| 538 |
void acpigen_write_create_bit_field(uint8_t op, size_t bit_offset, const char *name); |
| 539 |
void acpigen_write_create_byte_field(uint8_t op, size_t byte_offset, const char *name); |
| 540 |
void acpigen_write_create_word_field(uint8_t op, size_t byte_offset, const char *name); |
| 541 |
void acpigen_write_create_dword_field(uint8_t op, size_t byte_offset, const char *name); |
| 542 |
void acpigen_write_create_qword_field(uint8_t op, size_t byte_offset, const char *name); |
| 543 |
void acpigen_write_create_buffer_bit_field(const char *src_buf, size_t bit_offset, const char *field); |
| 544 |
void acpigen_write_create_buffer_byte_field(const char *src_buf, size_t byte_offset, const char *name); |
| 545 |
void acpigen_write_create_buffer_word_field(const char *src_buf, size_t byte_offset, const char *name); |
| 546 |
void acpigen_write_create_buffer_dword_field(const char *src_buf, size_t byte_offset, const char *name); |
| 547 |
void acpigen_write_create_buffer_qword_field(const char *src_buf, size_t byte_offset, const char *name); |
| 548 |
void acpigen_write_field_name(const char *name, uint32_t size); |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
void acpigen_write_dsm(const char *uuid, void (**callbacks)(void *), |
| 559 |
size_t count, void *arg); |
| 560 |
|
| 561 |
void acpigen_write_dsm_uuid_arr(struct dsm_uuid *ids, size_t count); |
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
void acpigen_write_CPPC_package(const struct cppc_config *config); |
| 569 |
void acpigen_write_CPPC_method(void); |
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
void acpigen_write_rom(void *bios, const size_t length); |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
void acpigen_write_opregion(const struct opregion *opreg); |
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
void acpigen_write_mutex(const char *name, const uint8_t flags); |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
void acpigen_write_acquire(const char *name, const uint16_t val); |
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
void acpigen_write_release(const char *name); |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
void acpigen_write_field(const char *name, const struct fieldlist *l, size_t count, |
| 604 |
uint8_t flags); |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
void acpigen_write_indexfield(const char *idx, const char *data, |
| 610 |
struct fieldlist *l, size_t count, uint8_t flags); |
| 611 |
|
| 612 |
int get_cst_entries(const acpi_cstate_t **); |
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
void acpigen_get_package_op_element(uint8_t package_op, unsigned int element, uint8_t dest_op); |
| 623 |
|
| 624 |
|
| 625 |
void acpigen_set_package_op_element_int(uint8_t package_op, unsigned int element, uint64_t src); |
| 626 |
|
| 627 |
|
| 628 |
void acpigen_get_package_element(const char *package, unsigned int element, uint8_t dest_op); |
| 629 |
|
| 630 |
|
| 631 |
void acpigen_set_package_element_int(const char *package, unsigned int element, uint64_t src); |
| 632 |
|
| 633 |
|
| 634 |
void acpigen_set_package_element_namestr(const char *package, unsigned int element, |
| 635 |
const char *src); |
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
void acpigen_write_delay_until_namestr_int(uint32_t wait_ms, const char *name, uint64_t value); |
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
int acpigen_soc_read_rx_gpio(unsigned int gpio_num); |
| 655 |
|
| 656 |
|
| 657 |
int acpigen_soc_get_tx_gpio(unsigned int gpio_num); |
| 658 |
|
| 659 |
|
| 660 |
int acpigen_soc_set_tx_gpio(unsigned int gpio_num); |
| 661 |
|
| 662 |
|
| 663 |
int acpigen_soc_clear_tx_gpio(unsigned int gpio_num); |
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
int acpigen_enable_tx_gpio(const struct acpi_gpio *gpio); |
| 673 |
int acpigen_disable_tx_gpio(const struct acpi_gpio *gpio); |
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
void acpigen_get_rx_gpio(const struct acpi_gpio *gpio); |
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
void acpigen_get_tx_gpio(const struct acpi_gpio *gpio); |
| 690 |
|
| 691 |
|
| 692 |
void acpigen_resource_word(u16 res_type, u16 gen_flags, u16 type_flags, u16 gran, |
| 693 |
u16 range_min, u16 range_max, u16 translation, u16 length); |
| 694 |
|
| 695 |
void acpigen_resource_dword(u16 res_type, u16 gen_flags, u16 type_flags, |
| 696 |
u32 gran, u32 range_min, u32 range_max, u32 translation, u32 length); |
| 697 |
|
| 698 |
void acpigen_resource_qword(u16 res_type, u16 gen_flags, u16 type_flags, |
| 699 |
u64 gran, u64 range_min, u64 range_max, u64 translation, u64 length); |
| 700 |
|
| 701 |
void acpigen_resource_producer_bus_number(u16 bus_base, u16 bus_limit); |
| 702 |
void acpigen_resource_producer_io(u16 io_base, u16 io_limit); |
| 703 |
void acpigen_resource_producer_mmio(u64 mmio_base, u64 mmio_limit, u16 type_flags); |
| 704 |
void acpigen_resource_consumer_mmio(u64 mmio_base, u64 mmio_limit, u16 type_flags); |
| 705 |
|
| 706 |
|
| 707 |
void acpigen_notify(const char *namestr, int value); |
| 708 |
|
| 709 |
|
| 710 |
void acpigen_ssdt_override_sleep_states(bool enable_s1, bool enable_s2, bool enable_s3, |
| 711 |
bool enable_s4); |
| 712 |
|
| 713 |
#endif |