Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Core ACPI (Advanced Configuration and Power Interface) support |
| 4 | * |
| 5 | * Copyright 2019 Google LLC |
| 6 | * |
| 7 | * Modified from coreboot file acpigen.h |
| 8 | */ |
| 9 | |
| 10 | #ifndef __ACPI_ACPIGEN_H |
| 11 | #define __ACPI_ACPIGEN_H |
| 12 | |
Simon Glass | 350c7f5 | 2020-09-22 12:45:13 -0600 | [diff] [blame] | 13 | #include <acpi/acpi_table.h> |
Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 14 | #include <linux/types.h> |
| 15 | |
Simon Glass | 350c7f5 | 2020-09-22 12:45:13 -0600 | [diff] [blame] | 16 | struct acpi_cstate; |
Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 17 | struct acpi_ctx; |
Simon Glass | d7d631d | 2020-07-07 21:32:11 -0600 | [diff] [blame] | 18 | struct acpi_gen_regaddr; |
Simon Glass | f8054dd | 2020-07-07 13:12:01 -0600 | [diff] [blame] | 19 | struct acpi_gpio; |
Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 20 | |
Simon Glass | 7e148f2 | 2020-07-07 13:11:50 -0600 | [diff] [blame] | 21 | /* Top 4 bits of the value used to indicate a three-byte length value */ |
| 22 | #define ACPI_PKG_LEN_3_BYTES 0x80 |
| 23 | |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 24 | #define ACPI_METHOD_NARGS_MASK 0x7 |
| 25 | #define ACPI_METHOD_SERIALIZED_MASK BIT(3) |
| 26 | |
Simon Glass | d7d631d | 2020-07-07 21:32:11 -0600 | [diff] [blame] | 27 | #define ACPI_END_TAG 0x79 |
| 28 | |
Simon Glass | 03967ce | 2020-07-07 13:11:51 -0600 | [diff] [blame] | 29 | /* ACPI Op/Prefix codes */ |
| 30 | enum { |
Simon Glass | 83b2bd5 | 2020-07-07 13:11:52 -0600 | [diff] [blame] | 31 | ZERO_OP = 0x00, |
| 32 | ONE_OP = 0x01, |
Simon Glass | 7aed90d | 2020-07-07 13:11:54 -0600 | [diff] [blame] | 33 | NAME_OP = 0x08, |
Simon Glass | 83b2bd5 | 2020-07-07 13:11:52 -0600 | [diff] [blame] | 34 | BYTE_PREFIX = 0x0a, |
| 35 | WORD_PREFIX = 0x0b, |
| 36 | DWORD_PREFIX = 0x0c, |
Simon Glass | 3df33bd | 2020-07-07 13:11:53 -0600 | [diff] [blame] | 37 | STRING_PREFIX = 0x0d, |
Simon Glass | 83b2bd5 | 2020-07-07 13:11:52 -0600 | [diff] [blame] | 38 | QWORD_PREFIX = 0x0e, |
Simon Glass | 82659cc | 2020-07-07 21:32:10 -0600 | [diff] [blame] | 39 | SCOPE_OP = 0x10, |
Simon Glass | 29df845 | 2020-07-07 13:11:55 -0600 | [diff] [blame] | 40 | BUFFER_OP = 0x11, |
Simon Glass | 03967ce | 2020-07-07 13:11:51 -0600 | [diff] [blame] | 41 | PACKAGE_OP = 0x12, |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 42 | METHOD_OP = 0x14, |
| 43 | SLEEP_OP = 0x22, |
Simon Glass | 7aed90d | 2020-07-07 13:11:54 -0600 | [diff] [blame] | 44 | DUAL_NAME_PREFIX = 0x2e, |
| 45 | MULTI_NAME_PREFIX = 0x2f, |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 46 | DEBUG_OP = 0x31, |
| 47 | EXT_OP_PREFIX = 0x5b, |
Simon Glass | 0e5a0a0 | 2020-07-07 13:11:56 -0600 | [diff] [blame] | 48 | ROOT_PREFIX = 0x5c, |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 49 | LOCAL0_OP = 0x60, |
| 50 | LOCAL1_OP = 0x61, |
| 51 | LOCAL2_OP = 0x62, |
| 52 | LOCAL3_OP = 0x63, |
| 53 | LOCAL4_OP = 0x64, |
| 54 | LOCAL5_OP = 0x65, |
| 55 | LOCAL6_OP = 0x66, |
| 56 | LOCAL7_OP = 0x67, |
Simon Glass | da7cff3 | 2020-09-22 12:44:57 -0600 | [diff] [blame] | 57 | ARG0_OP = 0x68, |
| 58 | ARG1_OP = 0x69, |
| 59 | ARG2_OP = 0x6a, |
| 60 | ARG3_OP = 0x6b, |
| 61 | ARG4_OP = 0x6c, |
| 62 | ARG5_OP = 0x6d, |
| 63 | ARG6_OP = 0x6e, |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 64 | STORE_OP = 0x70, |
| 65 | AND_OP = 0x7b, |
| 66 | OR_OP = 0x7d, |
| 67 | NOT_OP = 0x80, |
Simon Glass | 91c2f9c | 2020-07-07 21:32:14 -0600 | [diff] [blame] | 68 | DEVICE_OP = 0x82, |
Simon Glass | 1540328 | 2020-09-22 12:45:11 -0600 | [diff] [blame] | 69 | PROCESSOR_OP = 0x83, |
Simon Glass | f9189d5 | 2020-07-07 13:12:00 -0600 | [diff] [blame] | 70 | POWER_RES_OP = 0x84, |
Simon Glass | 1540328 | 2020-09-22 12:45:11 -0600 | [diff] [blame] | 71 | NOTIFY_OP = 0x86, |
Simon Glass | da7cff3 | 2020-09-22 12:44:57 -0600 | [diff] [blame] | 72 | LEQUAL_OP = 0x93, |
| 73 | TO_BUFFER_OP = 0x96, |
| 74 | TO_INTEGER_OP = 0x99, |
| 75 | IF_OP = 0xa0, |
| 76 | ELSE_OP = 0xa1, |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 77 | RETURN_OP = 0xa4, |
Simon Glass | 03967ce | 2020-07-07 13:11:51 -0600 | [diff] [blame] | 78 | }; |
| 79 | |
Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 80 | /** |
Simon Glass | 6c0da2d | 2020-09-22 12:45:08 -0600 | [diff] [blame] | 81 | * enum psd_coord - Coordination types for P-states |
| 82 | * |
| 83 | * The type of coordination that exists (hardware) or is required (software) as |
| 84 | * a result of the underlying hardware dependency |
| 85 | */ |
| 86 | enum psd_coord { |
| 87 | SW_ALL = 0xfc, |
| 88 | SW_ANY = 0xfd, |
| 89 | HW_ALL = 0xfe |
| 90 | }; |
| 91 | |
| 92 | /** |
Simon Glass | 350c7f5 | 2020-09-22 12:45:13 -0600 | [diff] [blame] | 93 | * enum csd_coord - Coordination types for C-states |
| 94 | * |
| 95 | * The type of coordination that exists (hardware) or is required (software) as |
| 96 | * a result of the underlying hardware dependency |
| 97 | */ |
| 98 | enum csd_coord { |
| 99 | CSD_HW_ALL = 0xfe, |
| 100 | }; |
| 101 | |
| 102 | /** |
| 103 | * struct acpi_cstate - Information about a C-State |
| 104 | * |
| 105 | * @ctype: C State type (1=C1, 2=C2, 3=C3) |
| 106 | * @latency: Worst-case latency to enter and exit the C State (in uS) |
| 107 | * @power: Average power consumption of the processor when in this C-State (mW) |
| 108 | * @resource: Register to read to place the processor in this state |
| 109 | */ |
| 110 | struct acpi_cstate { |
| 111 | uint ctype; |
| 112 | uint latency; |
| 113 | uint power; |
| 114 | struct acpi_gen_regaddr resource; |
| 115 | }; |
| 116 | |
| 117 | /** |
| 118 | * struct acpi_tstate - Information about a Throttling Supported State |
| 119 | * |
| 120 | * See ACPI v6.3 section 8.4.5.2: _TSS (Throttling Supported States) |
| 121 | * |
| 122 | * @percent: Percent of the core CPU operating frequency that will be |
| 123 | * available when this throttling state is invoked |
| 124 | * @power: Throttling state’s maximum power dissipation (mw) |
| 125 | * @latency: Worst-case latency (uS) that the CPU is unavailable during a |
| 126 | * transition from any throttling state to this throttling state |
| 127 | * @control: Value to be written to the Processor Control Register |
| 128 | * (THROTTLE_CTRL) to initiate a transition to this throttling state |
| 129 | * @status: Value in THROTTLE_STATUS when in this state |
| 130 | */ |
| 131 | struct acpi_tstate { |
| 132 | uint percent; |
| 133 | uint power; |
| 134 | uint latency; |
| 135 | uint control; |
| 136 | uint status; |
| 137 | }; |
| 138 | |
| 139 | /** |
Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 140 | * acpigen_get_current() - Get the current ACPI code output pointer |
| 141 | * |
| 142 | * @ctx: ACPI context pointer |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 143 | * Return: output pointer |
Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 144 | */ |
| 145 | u8 *acpigen_get_current(struct acpi_ctx *ctx); |
| 146 | |
| 147 | /** |
| 148 | * acpigen_emit_byte() - Emit a byte to the ACPI code |
| 149 | * |
| 150 | * @ctx: ACPI context pointer |
| 151 | * @data: Value to output |
| 152 | */ |
| 153 | void acpigen_emit_byte(struct acpi_ctx *ctx, uint data); |
| 154 | |
| 155 | /** |
| 156 | * acpigen_emit_word() - Emit a 16-bit word to the ACPI code |
| 157 | * |
| 158 | * @ctx: ACPI context pointer |
| 159 | * @data: Value to output |
| 160 | */ |
| 161 | void acpigen_emit_word(struct acpi_ctx *ctx, uint data); |
| 162 | |
| 163 | /** |
| 164 | * acpigen_emit_dword() - Emit a 32-bit 'double word' to the ACPI code |
| 165 | * |
| 166 | * @ctx: ACPI context pointer |
| 167 | * @data: Value to output |
| 168 | */ |
| 169 | void acpigen_emit_dword(struct acpi_ctx *ctx, uint data); |
| 170 | |
Simon Glass | 7fb8da4 | 2020-07-07 13:11:45 -0600 | [diff] [blame] | 171 | /** |
| 172 | * acpigen_emit_stream() - Emit a stream of bytes |
| 173 | * |
| 174 | * @ctx: ACPI context pointer |
| 175 | * @data: Data to output |
| 176 | * @size: Size of data in bytes |
| 177 | */ |
| 178 | void acpigen_emit_stream(struct acpi_ctx *ctx, const char *data, int size); |
| 179 | |
| 180 | /** |
| 181 | * acpigen_emit_string() - Emit a string |
| 182 | * |
| 183 | * Emit a string with a null terminator |
| 184 | * |
| 185 | * @ctx: ACPI context pointer |
| 186 | * @str: String to output, or NULL for an empty string |
| 187 | */ |
| 188 | void acpigen_emit_string(struct acpi_ctx *ctx, const char *str); |
| 189 | |
Simon Glass | 7e148f2 | 2020-07-07 13:11:50 -0600 | [diff] [blame] | 190 | /** |
| 191 | * acpigen_write_len_f() - Write a 'forward' length placeholder |
| 192 | * |
| 193 | * This adds space for a length value in the ACPI stream and pushes the current |
| 194 | * position (before the length) on the stack. After calling this you can write |
| 195 | * some data and then call acpigen_pop_len() to update the length value. |
| 196 | * |
| 197 | * Usage: |
| 198 | * |
| 199 | * acpigen_write_len_f() ------\ |
| 200 | * acpigen_write...() | |
| 201 | * acpigen_write...() | |
| 202 | * acpigen_write_len_f() --\ | |
| 203 | * acpigen_write...() | | |
| 204 | * acpigen_write...() | | |
| 205 | * acpigen_pop_len() ------/ | |
| 206 | * acpigen_write...() | |
| 207 | * acpigen_pop_len() ----------/ |
| 208 | * |
| 209 | * See ACPI 6.3 section 20.2.4 Package Length Encoding |
| 210 | * |
| 211 | * This implementation always uses a 3-byte packet length for simplicity. It |
| 212 | * could be adjusted to support other lengths. |
| 213 | * |
| 214 | * @ctx: ACPI context pointer |
| 215 | */ |
| 216 | void acpigen_write_len_f(struct acpi_ctx *ctx); |
| 217 | |
| 218 | /** |
| 219 | * acpigen_pop_len() - Update the previously stacked length placeholder |
| 220 | * |
| 221 | * Call this after the data for the block has been written. It updates the |
| 222 | * top length value in the stack and pops it off. |
| 223 | * |
| 224 | * @ctx: ACPI context pointer |
| 225 | */ |
| 226 | void acpigen_pop_len(struct acpi_ctx *ctx); |
| 227 | |
Simon Glass | 03967ce | 2020-07-07 13:11:51 -0600 | [diff] [blame] | 228 | /** |
| 229 | * acpigen_write_package() - Start writing a package |
| 230 | * |
| 231 | * A package collects together a number of elements in the ACPI code. To write |
| 232 | * a package use: |
| 233 | * |
| 234 | * acpigen_write_package(ctx, 3); |
| 235 | * ...write things |
| 236 | * acpigen_pop_len() |
| 237 | * |
| 238 | * If you don't know the number of elements in advance, acpigen_write_package() |
| 239 | * returns a pointer to the value so you can update it later: |
| 240 | * |
| 241 | * char *num_elements = acpigen_write_package(ctx, 0); |
| 242 | * ...write things |
| 243 | * *num_elements += 1; |
| 244 | * ...write things |
| 245 | * *num_elements += 1; |
| 246 | * acpigen_pop_len() |
| 247 | * |
| 248 | * @ctx: ACPI context pointer |
| 249 | * @nr_el: Number of elements (0 if not known) |
| 250 | * @returns pointer to the number of elements, which can be updated by the |
| 251 | * caller if needed |
| 252 | */ |
| 253 | char *acpigen_write_package(struct acpi_ctx *ctx, int nr_el); |
| 254 | |
Simon Glass | 83b2bd5 | 2020-07-07 13:11:52 -0600 | [diff] [blame] | 255 | /** |
Simon Glass | fea9651 | 2020-07-07 21:32:09 -0600 | [diff] [blame] | 256 | * acpigen_write_byte() - Write a byte |
| 257 | * |
| 258 | * @ctx: ACPI context pointer |
| 259 | * @data: Value to write |
| 260 | */ |
| 261 | void acpigen_write_byte(struct acpi_ctx *ctx, unsigned int data); |
| 262 | |
| 263 | /** |
| 264 | * acpigen_write_word() - Write a word |
| 265 | * |
| 266 | * @ctx: ACPI context pointer |
| 267 | * @data: Value to write |
| 268 | */ |
| 269 | void acpigen_write_word(struct acpi_ctx *ctx, unsigned int data); |
| 270 | |
| 271 | /** |
| 272 | * acpigen_write_dword() - Write a dword |
| 273 | * |
| 274 | * @ctx: ACPI context pointer |
| 275 | * @data: Value to write |
| 276 | */ |
| 277 | void acpigen_write_dword(struct acpi_ctx *ctx, unsigned int data); |
| 278 | |
| 279 | /** |
| 280 | * acpigen_write_qword() - Write a qword |
| 281 | * |
| 282 | * @ctx: ACPI context pointer |
| 283 | * @data: Value to write |
| 284 | */ |
| 285 | void acpigen_write_qword(struct acpi_ctx *ctx, u64 data); |
| 286 | |
| 287 | /** |
| 288 | * acpigen_write_zero() - Write zero |
| 289 | * |
| 290 | * @ctx: ACPI context pointer |
| 291 | */ |
| 292 | void acpigen_write_zero(struct acpi_ctx *ctx); |
| 293 | |
| 294 | /** |
| 295 | * acpigen_write_one() - Write one |
| 296 | * |
| 297 | * @ctx: ACPI context pointer |
| 298 | */ |
| 299 | void acpigen_write_one(struct acpi_ctx *ctx); |
| 300 | |
| 301 | /** |
Simon Glass | 83b2bd5 | 2020-07-07 13:11:52 -0600 | [diff] [blame] | 302 | * acpigen_write_integer() - Write an integer |
| 303 | * |
| 304 | * This writes an operation (BYTE_OP, WORD_OP, DWORD_OP, QWORD_OP depending on |
| 305 | * the integer size) and an integer value. Note that WORD means 16 bits in ACPI. |
| 306 | * |
| 307 | * @ctx: ACPI context pointer |
| 308 | * @data: Integer to write |
| 309 | */ |
| 310 | void acpigen_write_integer(struct acpi_ctx *ctx, u64 data); |
| 311 | |
Simon Glass | 3df33bd | 2020-07-07 13:11:53 -0600 | [diff] [blame] | 312 | /** |
Simon Glass | bb6772c | 2020-07-07 21:32:15 -0600 | [diff] [blame] | 313 | * acpigen_write_name_zero() - Write a named zero value |
| 314 | * |
| 315 | * @ctx: ACPI context pointer |
| 316 | * @name: Name of the value |
| 317 | */ |
| 318 | void acpigen_write_name_zero(struct acpi_ctx *ctx, const char *name); |
| 319 | |
| 320 | /** |
| 321 | * acpigen_write_name_one() - Write a named one value |
| 322 | * |
| 323 | * @ctx: ACPI context pointer |
| 324 | * @name: Name of the value |
| 325 | */ |
| 326 | void acpigen_write_name_one(struct acpi_ctx *ctx, const char *name); |
| 327 | |
| 328 | /** |
| 329 | * acpigen_write_name_byte() - Write a named byte value |
| 330 | * |
| 331 | * @ctx: ACPI context pointer |
| 332 | * @name: Name of the value |
| 333 | * @val: Value to write |
| 334 | */ |
| 335 | void acpigen_write_name_byte(struct acpi_ctx *ctx, const char *name, uint val); |
| 336 | |
| 337 | /** |
| 338 | * acpigen_write_name_word() - Write a named word value |
| 339 | * |
| 340 | * @ctx: ACPI context pointer |
| 341 | * @name: Name of the value |
| 342 | * @val: Value to write |
| 343 | */ |
| 344 | void acpigen_write_name_word(struct acpi_ctx *ctx, const char *name, uint val); |
| 345 | |
| 346 | /** |
| 347 | * acpigen_write_name_dword() - Write a named dword value |
| 348 | * |
| 349 | * @ctx: ACPI context pointer |
| 350 | * @name: Name of the value |
| 351 | * @val: Value to write |
| 352 | */ |
| 353 | void acpigen_write_name_dword(struct acpi_ctx *ctx, const char *name, uint val); |
| 354 | |
| 355 | /** |
| 356 | * acpigen_write_name_qword() - Write a named qword value |
| 357 | * |
| 358 | * @ctx: ACPI context pointer |
| 359 | * @name: Name of the value |
| 360 | * @val: Value to write |
| 361 | */ |
| 362 | void acpigen_write_name_qword(struct acpi_ctx *ctx, const char *name, u64 val); |
| 363 | |
| 364 | /** |
| 365 | * acpigen_write_name_integer() - Write a named integer value |
| 366 | * |
| 367 | * @ctx: ACPI context pointer |
| 368 | * @name: Name of the value |
| 369 | * @val: Value to write |
| 370 | */ |
| 371 | void acpigen_write_name_integer(struct acpi_ctx *ctx, const char *name, |
| 372 | u64 val); |
| 373 | |
| 374 | /** |
| 375 | * acpigen_write_name_string() - Write a named string value |
| 376 | * |
| 377 | * @ctx: ACPI context pointer |
| 378 | * @name: Name of the value |
| 379 | * @string: String to write |
| 380 | */ |
| 381 | void acpigen_write_name_string(struct acpi_ctx *ctx, const char *name, |
| 382 | const char *string); |
| 383 | |
| 384 | /** |
Simon Glass | 3df33bd | 2020-07-07 13:11:53 -0600 | [diff] [blame] | 385 | * acpigen_write_string() - Write a string |
| 386 | * |
| 387 | * This writes a STRING_PREFIX followed by a null-terminated string |
| 388 | * |
| 389 | * @ctx: ACPI context pointer |
| 390 | * @str: String to write |
| 391 | */ |
| 392 | void acpigen_write_string(struct acpi_ctx *ctx, const char *str); |
Simon Glass | 7aed90d | 2020-07-07 13:11:54 -0600 | [diff] [blame] | 393 | |
| 394 | /** |
| 395 | * acpigen_emit_namestring() - Emit an ACPI name |
| 396 | * |
| 397 | * This writes out an ACPI name or path in the required special format. It does |
| 398 | * not add the NAME_OP prefix. |
| 399 | * |
| 400 | * @ctx: ACPI context pointer |
| 401 | * @namepath: Name / path to emit |
| 402 | */ |
| 403 | void acpigen_emit_namestring(struct acpi_ctx *ctx, const char *namepath); |
| 404 | |
| 405 | /** |
| 406 | * acpigen_write_name() - Write out an ACPI name |
| 407 | * |
| 408 | * This writes out an ACPI name or path in the required special format with a |
| 409 | * NAME_OP prefix. |
| 410 | * |
| 411 | * @ctx: ACPI context pointer |
| 412 | * @namepath: Name / path to emit |
| 413 | */ |
| 414 | void acpigen_write_name(struct acpi_ctx *ctx, const char *namepath); |
Simon Glass | 29df845 | 2020-07-07 13:11:55 -0600 | [diff] [blame] | 415 | |
| 416 | /** |
Simon Glass | 82659cc | 2020-07-07 21:32:10 -0600 | [diff] [blame] | 417 | * acpigen_write_scope() - Write a scope |
| 418 | * |
| 419 | * @ctx: ACPI context pointer |
| 420 | * @scope: Scope to write (e.g. "\\_SB.ABCD") |
| 421 | */ |
| 422 | void acpigen_write_scope(struct acpi_ctx *ctx, const char *scope); |
| 423 | |
| 424 | /** |
Simon Glass | 29df845 | 2020-07-07 13:11:55 -0600 | [diff] [blame] | 425 | * acpigen_write_uuid() - Write a UUID |
| 426 | * |
| 427 | * This writes out a UUID in the format used by ACPI, with a BUFFER_OP prefix. |
| 428 | * |
| 429 | * @ctx: ACPI context pointer |
| 430 | * @uuid: UUID to write in the form aabbccdd-eeff-gghh-iijj-kkllmmnnoopp |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 431 | * Return: 0 if OK, -EINVAL if the format is incorrect |
Simon Glass | 29df845 | 2020-07-07 13:11:55 -0600 | [diff] [blame] | 432 | */ |
| 433 | int acpigen_write_uuid(struct acpi_ctx *ctx, const char *uuid); |
| 434 | |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 435 | /** |
| 436 | * acpigen_emit_ext_op() - Emit an extended op with the EXT_OP_PREFIX prefix |
| 437 | * |
| 438 | * @ctx: ACPI context pointer |
| 439 | * @op: Operation code (e.g. SLEEP_OP) |
| 440 | */ |
| 441 | void acpigen_emit_ext_op(struct acpi_ctx *ctx, uint op); |
| 442 | |
| 443 | /** |
| 444 | * acpigen_write_method() - Write a method header |
| 445 | * |
| 446 | * @ctx: ACPI context pointer |
| 447 | * @name: Method name (4 characters) |
| 448 | * @nargs: Number of method arguments (0 if none) |
| 449 | */ |
| 450 | void acpigen_write_method(struct acpi_ctx *ctx, const char *name, int nargs); |
| 451 | |
| 452 | /** |
| 453 | * acpigen_write_method_serialized() - Write a method header |
| 454 | * |
| 455 | * This sets the 'serialized' flag so that the method is thread-safe |
| 456 | * |
| 457 | * @ctx: ACPI context pointer |
| 458 | * @name: Method name (4 characters) |
| 459 | * @nargs: Number of method arguments (0 if none) |
| 460 | */ |
| 461 | void acpigen_write_method_serialized(struct acpi_ctx *ctx, const char *name, |
| 462 | int nargs); |
| 463 | |
| 464 | /** |
Simon Glass | 91c2f9c | 2020-07-07 21:32:14 -0600 | [diff] [blame] | 465 | * acpigen_write_device() - Write an ACPI device |
| 466 | * |
| 467 | * @ctx: ACPI context pointer |
| 468 | * @name: Device name to write |
| 469 | */ |
| 470 | void acpigen_write_device(struct acpi_ctx *ctx, const char *name); |
| 471 | |
| 472 | /** |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 473 | * acpigen_write_sta() - Write a _STA method |
| 474 | * |
| 475 | * @ctx: ACPI context pointer |
| 476 | * @status: Status value to return |
| 477 | */ |
| 478 | void acpigen_write_sta(struct acpi_ctx *ctx, uint status); |
| 479 | |
| 480 | /** |
Simon Glass | d7d631d | 2020-07-07 21:32:11 -0600 | [diff] [blame] | 481 | * acpigen_write_resourcetemplate_header() - Write a ResourceTemplate header |
| 482 | * |
| 483 | * @ctx: ACPI context pointer |
| 484 | */ |
| 485 | void acpigen_write_resourcetemplate_header(struct acpi_ctx *ctx); |
| 486 | |
| 487 | /** |
| 488 | * acpigen_write_resourcetemplate_footer() - Write a ResourceTemplate footer |
| 489 | * |
| 490 | * @ctx: ACPI context pointer |
| 491 | */ |
| 492 | void acpigen_write_resourcetemplate_footer(struct acpi_ctx *ctx); |
| 493 | |
| 494 | /** |
| 495 | * acpigen_write_register_resource() - Write a register resource |
| 496 | * |
| 497 | * This writes a header, the address information and a footer |
| 498 | * |
| 499 | * @ctx: ACPI context pointer |
| 500 | * @addr: Address to write |
| 501 | */ |
| 502 | void acpigen_write_register_resource(struct acpi_ctx *ctx, |
| 503 | const struct acpi_gen_regaddr *addr); |
| 504 | |
| 505 | /** |
Simon Glass | 9c70e7e | 2020-07-07 13:11:59 -0600 | [diff] [blame] | 506 | * acpigen_write_sleep() - Write a sleep operation |
| 507 | * |
| 508 | * @ctx: ACPI context pointer |
| 509 | * @sleep_ms: Number of milliseconds to sleep for |
| 510 | */ |
| 511 | void acpigen_write_sleep(struct acpi_ctx *ctx, u64 sleep_ms); |
| 512 | |
| 513 | /** |
| 514 | * acpigen_write_store() - Write a store operation |
| 515 | * |
| 516 | * @ctx: ACPI context pointer |
| 517 | */ |
| 518 | void acpigen_write_store(struct acpi_ctx *ctx); |
| 519 | |
| 520 | /** |
| 521 | * acpigen_write_debug_string() - Write a debug string |
| 522 | * |
| 523 | * This writes a debug operation with an associated string |
| 524 | * |
| 525 | * @ctx: ACPI context pointer |
| 526 | * @str: String to write |
| 527 | */ |
| 528 | void acpigen_write_debug_string(struct acpi_ctx *ctx, const char *str); |
| 529 | |
| 530 | /** |
| 531 | * acpigen_write_or() - Write a bitwise OR operation |
| 532 | * |
| 533 | * res = arg1 | arg2 |
| 534 | * |
| 535 | * @ctx: ACPI context pointer |
| 536 | * @arg1: ACPI opcode for operand 1 (e.g. LOCAL0_OP) |
| 537 | * @arg2: ACPI opcode for operand 2 (e.g. LOCAL1_OP) |
| 538 | * @res: ACPI opcode for result (e.g. LOCAL2_OP) |
| 539 | */ |
| 540 | void acpigen_write_or(struct acpi_ctx *ctx, u8 arg1, u8 arg2, u8 res); |
| 541 | |
| 542 | /** |
| 543 | * acpigen_write_and() - Write a bitwise AND operation |
| 544 | * |
| 545 | * res = arg1 & arg2 |
| 546 | * |
| 547 | * @ctx: ACPI context pointer |
| 548 | * @arg1: ACPI opcode for operand 1 (e.g. LOCAL0_OP) |
| 549 | * @arg2: ACPI opcode for operand 2 (e.g. LOCAL1_OP) |
| 550 | * @res: ACPI opcode for result (e.g. LOCAL2_OP) |
| 551 | */ |
| 552 | void acpigen_write_and(struct acpi_ctx *ctx, u8 arg1, u8 arg2, u8 res); |
| 553 | |
| 554 | /** |
| 555 | * acpigen_write_not() - Write a bitwise NOT operation |
| 556 | * |
| 557 | * res = ~arg1 |
| 558 | * |
| 559 | * @ctx: ACPI context pointer |
| 560 | * @arg: ACPI opcode for operand (e.g. LOCAL0_OP) |
| 561 | * @res: ACPI opcode for result (e.g. LOCAL2_OP) |
| 562 | */ |
| 563 | void acpigen_write_not(struct acpi_ctx *ctx, u8 arg, u8 res); |
| 564 | |
Simon Glass | f9189d5 | 2020-07-07 13:12:00 -0600 | [diff] [blame] | 565 | /** |
| 566 | * acpigen_write_power_res() - Write a power resource |
| 567 | * |
| 568 | * Name (_PRx, Package(One) { name }) |
| 569 | * ... |
| 570 | * PowerResource (name, level, order) |
| 571 | * |
| 572 | * The caller should fill in the rest of the power resource and then call |
| 573 | * acpigen_pop_len() to close it off |
| 574 | * |
| 575 | * @ctx: ACPI context pointer |
| 576 | * @name: Name of power resource (e.g. "PRIC") |
| 577 | * @level: Deepest sleep level that this resource must be kept on (0=S0, 3=S3) |
| 578 | * @order: Order that this must be enabled/disabled (e.g. 0) |
| 579 | * @dev_stats: List of states to define, e.g. {"_PR0", "_PR3"} |
| 580 | * @dev_states_count: Number of dev states |
| 581 | */ |
| 582 | void acpigen_write_power_res(struct acpi_ctx *ctx, const char *name, uint level, |
| 583 | uint order, const char *const dev_states[], |
| 584 | size_t dev_states_count); |
| 585 | |
Simon Glass | f8054dd | 2020-07-07 13:12:01 -0600 | [diff] [blame] | 586 | /** |
| 587 | * acpigen_set_enable_tx_gpio() - Emit ACPI code to enable/disable a GPIO |
| 588 | * |
| 589 | * This emits code to either enable to disable a Tx GPIO. It takes account of |
| 590 | * the GPIO polarity. |
| 591 | * |
| 592 | * The code needs access to the DW0 register for the pad being used. This is |
| 593 | * provided by gpio->pin0_addr and ACPI methods must be defined for the board |
| 594 | * which can read and write the pad's DW0 register given this address: |
| 595 | * @dw0_read: takes a single argument, the DW0 address |
| 596 | * returns the DW0 value |
| 597 | * @dw0:write: takes two arguments, the DW0 address and the value to write |
| 598 | * no return value |
| 599 | * |
| 600 | * Example code (-- means comment): |
| 601 | * |
| 602 | * -- Get Pad Configuration DW0 register value |
| 603 | * Method (GPC0, 0x1, Serialized) |
| 604 | * { |
| 605 | * -- Arg0 - GPIO DW0 address |
| 606 | * Store (Arg0, Local0) |
| 607 | * OperationRegion (PDW0, SystemMemory, Local0, 4) |
| 608 | * Field (PDW0, AnyAcc, NoLock, Preserve) { |
| 609 | * TEMP, 32 |
| 610 | * } |
| 611 | * Return (TEMP) |
| 612 | * } |
| 613 | * |
| 614 | * -- Set Pad Configuration DW0 register value |
| 615 | * Method (SPC0, 0x2, Serialized) |
| 616 | * { |
| 617 | * -- Arg0 - GPIO DW0 address |
| 618 | * -- Arg1 - Value for DW0 register |
| 619 | * Store (Arg0, Local0) |
| 620 | * OperationRegion (PDW0, SystemMemory, Local0, 4) |
| 621 | * Field (PDW0, AnyAcc, NoLock, Preserve) { |
| 622 | * TEMP,32 |
| 623 | * } |
| 624 | * Store (Arg1, TEMP) |
| 625 | * } |
| 626 | * |
| 627 | * |
| 628 | * @ctx: ACPI context pointer |
| 629 | * @tx_state_val: Mask to use to toggle the TX state on the GPIO pin, e,g. |
| 630 | * PAD_CFG0_TX_STATE |
| 631 | * @dw0_read: Method name to use to read dw0, e.g. "\\_SB.GPC0" |
| 632 | * @dw0_write: Method name to use to read dw0, e.g. "\\_SB.SPC0" |
| 633 | * @gpio: GPIO to change |
| 634 | * @enable: true to enable GPIO, false to disable |
| 635 | * Returns 0 on success, -ve on error. |
| 636 | */ |
| 637 | int acpigen_set_enable_tx_gpio(struct acpi_ctx *ctx, u32 tx_state_val, |
| 638 | const char *dw0_read, const char *dw0_write, |
| 639 | struct acpi_gpio *gpio, bool enable); |
| 640 | |
Simon Glass | e0a896b | 2020-09-22 12:44:56 -0600 | [diff] [blame] | 641 | /** |
| 642 | * acpigen_write_prw() - Write a power resource for wake (_PRW) |
| 643 | * |
| 644 | * @ctx: ACPI context pointer |
| 645 | * @wake: GPE that wakes up the device |
| 646 | * @level: Deepest power system sleeping state that can be entered while still |
| 647 | * providing wake functionality |
| 648 | */ |
| 649 | void acpigen_write_prw(struct acpi_ctx *ctx, uint wake, uint level); |
| 650 | |
Simon Glass | da7cff3 | 2020-09-22 12:44:57 -0600 | [diff] [blame] | 651 | /** |
| 652 | * acpigen_write_if() - Write an If block |
| 653 | * |
| 654 | * This requires a call to acpigen_pop_len() to complete the block |
| 655 | * |
| 656 | * @ctx: ACPI context pointer |
| 657 | */ |
| 658 | void acpigen_write_if(struct acpi_ctx *ctx); |
| 659 | |
| 660 | /** |
| 661 | * acpigen_write_if_lequal_op_int() - Write comparison between op and integer |
| 662 | * |
| 663 | * Generates ACPI code for checking if operand1 and operand2 are equal |
| 664 | * |
| 665 | * If (Lequal (op, val)) |
| 666 | * |
| 667 | * @ctx: ACPI context pointer |
| 668 | * @op: Operand to check |
| 669 | * @val: Value to check against |
| 670 | */ |
| 671 | void acpigen_write_if_lequal_op_int(struct acpi_ctx *ctx, uint op, u64 val); |
| 672 | |
| 673 | /** |
| 674 | * acpigen_write_else() - Write an Ef block |
| 675 | * |
| 676 | * This requires a call to acpigen_pop_len() to complete the block |
| 677 | * |
| 678 | * @ctx: ACPI context pointer |
| 679 | */ |
| 680 | void acpigen_write_else(struct acpi_ctx *ctx); |
| 681 | |
| 682 | /** |
| 683 | * acpigen_write_to_buffer() - Write a ToBuffer operation |
| 684 | * |
| 685 | * E.g.: to generate: ToBuffer (Arg0, Local0) |
| 686 | * use acpigen_write_to_buffer(ctx, ARG0_OP, LOCAL0_OP) |
| 687 | * |
| 688 | * @ctx: ACPI context pointer |
| 689 | * @src: Source argument |
| 690 | * @dst: Destination argument |
| 691 | */ |
| 692 | void acpigen_write_to_buffer(struct acpi_ctx *ctx, uint src, uint dst); |
| 693 | |
| 694 | /** |
| 695 | * acpigen_write_to_integer() - Write a ToInteger operation |
| 696 | * |
| 697 | * E.g.: to generate: ToInteger (Arg0, Local0) |
| 698 | * use acpigen_write_to_integer(ctx, ARG0_OP, LOCAL0_OP) |
| 699 | * |
| 700 | * @ctx: ACPI context pointer |
| 701 | * @src: Source argument |
| 702 | * @dst: Destination argument |
| 703 | */ |
| 704 | void acpigen_write_to_integer(struct acpi_ctx *ctx, uint src, uint dst); |
| 705 | |
| 706 | /** |
| 707 | * acpigen_write_return_byte_buffer() - Write a return of a byte buffer |
| 708 | * |
| 709 | * @ctx: ACPI context pointer |
| 710 | * @arr: Array of bytes to return |
| 711 | * @size: Number of bytes |
| 712 | */ |
| 713 | void acpigen_write_return_byte_buffer(struct acpi_ctx *ctx, u8 *arr, |
| 714 | size_t size); |
| 715 | |
| 716 | /** |
| 717 | * acpigen_write_return_singleton_buffer() - Write a return of a 1-byte buffer |
| 718 | * |
| 719 | * @ctx: ACPI context pointer |
| 720 | * @arg: Byte to return |
| 721 | */ |
| 722 | void acpigen_write_return_singleton_buffer(struct acpi_ctx *ctx, uint arg); |
| 723 | |
| 724 | /** |
| 725 | * acpigen_write_return_byte() - Write a return of a byte |
| 726 | * |
| 727 | * @ctx: ACPI context pointer |
| 728 | * @arg: Byte to return |
| 729 | */ |
| 730 | void acpigen_write_return_byte(struct acpi_ctx *ctx, uint arg); |
| 731 | |
Simon Glass | 88490e1 | 2020-09-22 12:44:58 -0600 | [diff] [blame] | 732 | /** |
| 733 | * acpigen_write_dsm_start() - Start a _DSM method |
| 734 | * |
| 735 | * Generate ACPI AML code to start the _DSM method. |
| 736 | * |
| 737 | * The functions need to be called in the correct sequence as below. |
| 738 | * |
| 739 | * Within the <generate-code-here> region, Local0 and Local1 must be are left |
| 740 | * untouched, but Local2-Local7 can be used |
| 741 | * |
| 742 | * Arguments passed into _DSM method: |
| 743 | * Arg0 = UUID |
| 744 | * Arg1 = Revision |
| 745 | * Arg2 = Function index |
| 746 | * Arg3 = Function-specific arguments |
| 747 | * |
| 748 | * AML code generated looks like this: |
| 749 | * Method (_DSM, 4, Serialized) { -- acpigen_write_dsm_start) |
| 750 | * ToBuffer (Arg0, Local0) |
| 751 | * If (LEqual (Local0, ToUUID(uuid))) { -- acpigen_write_dsm_uuid_start |
| 752 | * ToInteger (Arg2, Local1) |
| 753 | * If (LEqual (Local1, 0)) { -- acpigen_write_dsm_uuid_start_cond |
| 754 | * <generate-code-here> |
| 755 | * } -- acpigen_write_dsm_uuid_end_cond |
| 756 | * ... |
| 757 | * If (LEqual (Local1, n)) { -- acpigen_write_dsm_uuid_start_cond |
| 758 | * <generate-code-here> |
| 759 | * } -- acpigen_write_dsm_uuid_end_cond |
| 760 | * Return (Buffer (One) { 0x0 }) |
| 761 | * } -- acpigen_write_dsm_uuid_end |
| 762 | * ... |
| 763 | * If (LEqual (Local0, ToUUID(uuidn))) { |
| 764 | * ... |
| 765 | * } |
| 766 | * Return (Buffer (One) { 0x0 }) -- acpigen_write_dsm_end |
| 767 | * } |
| 768 | * |
| 769 | * @ctx: ACPI context pointer |
| 770 | */ |
| 771 | void acpigen_write_dsm_start(struct acpi_ctx *ctx); |
| 772 | |
| 773 | /** |
| 774 | * acpigen_write_dsm_uuid_start() - Start a new UUID block |
| 775 | * |
| 776 | * This starts generation of code to handle a particular UUID: |
| 777 | * |
| 778 | * If (LEqual (Local0, ToUUID(uuid))) { |
| 779 | * ToInteger (Arg2, Local1) |
| 780 | * |
| 781 | * @ctx: ACPI context pointer |
| 782 | */ |
| 783 | int acpigen_write_dsm_uuid_start(struct acpi_ctx *ctx, const char *uuid); |
| 784 | |
| 785 | /** |
| 786 | * acpigen_write_dsm_uuid_start_cond() - Start a new condition block |
| 787 | * |
| 788 | * This starts generation of condition-checking code to handle a particular |
| 789 | * function: |
| 790 | * |
| 791 | * If (LEqual (Local1, i)) |
| 792 | * |
| 793 | * @ctx: ACPI context pointer |
| 794 | */ |
| 795 | void acpigen_write_dsm_uuid_start_cond(struct acpi_ctx *ctx, int seq); |
| 796 | |
| 797 | /** |
| 798 | * acpigen_write_dsm_uuid_end_cond() - Start a new condition block |
| 799 | * |
| 800 | * This ends generation of condition-checking code to handle a particular |
| 801 | * function: |
| 802 | * |
| 803 | * } |
| 804 | * |
| 805 | * @ctx: ACPI context pointer |
| 806 | */ |
| 807 | void acpigen_write_dsm_uuid_end_cond(struct acpi_ctx *ctx); |
| 808 | |
| 809 | /** |
| 810 | * acpigen_write_dsm_uuid_end() - End a UUID block |
| 811 | * |
| 812 | * This ends generation of code to handle a particular UUID: |
| 813 | * |
| 814 | * Return (Buffer (One) { 0x0 }) |
| 815 | * |
| 816 | * @ctx: ACPI context pointer |
| 817 | */ |
| 818 | void acpigen_write_dsm_uuid_end(struct acpi_ctx *ctx); |
| 819 | |
| 820 | /** |
| 821 | * acpigen_write_dsm_end() - End a _DSM method |
| 822 | * |
| 823 | * This ends generates of the _DSM block: |
| 824 | * |
| 825 | * Return (Buffer (One) { 0x0 }) |
| 826 | * |
| 827 | * @ctx: ACPI context pointer |
| 828 | */ |
| 829 | void acpigen_write_dsm_end(struct acpi_ctx *ctx); |
| 830 | |
Simon Glass | 1540328 | 2020-09-22 12:45:11 -0600 | [diff] [blame] | 831 | /** |
| 832 | * acpigen_write_processor() - Write a Processor package |
| 833 | * |
| 834 | * This emits a Processor package header with the required information. The |
| 835 | * caller must complete the information and call acpigen_pop_len() at the end |
| 836 | * |
| 837 | * @ctx: ACPI context pointer |
| 838 | * @cpuindex: CPU number |
| 839 | * @pblock_addr: PBlk system IO address |
| 840 | * @pblock_len: PBlk length |
| 841 | */ |
| 842 | void acpigen_write_processor(struct acpi_ctx *ctx, uint cpuindex, |
| 843 | u32 pblock_addr, uint pblock_len); |
| 844 | |
| 845 | /** |
| 846 | * acpigen_write_processor_package() - Write a package containing the processors |
| 847 | * |
| 848 | * The package containins the name of each processor in the SoC |
| 849 | * |
| 850 | * @ctx: ACPI context pointer |
| 851 | * @name: Package name (.e.g "PPKG") |
| 852 | * @first_core: Number of the first core (e.g. 0) |
| 853 | * @core_count: Number of cores (e.g. 4) |
| 854 | */ |
| 855 | void acpigen_write_processor_package(struct acpi_ctx *ctx, const char *name, |
| 856 | uint first_core, uint core_count); |
| 857 | |
| 858 | /** |
| 859 | * acpigen_write_processor_cnot() - Write a processor notification method |
| 860 | * |
| 861 | * This writes a method that notifies all CPU cores |
| 862 | * |
| 863 | * @ctx: ACPI context pointer |
| 864 | * @num_cores: Number of CPU cores |
| 865 | */ |
| 866 | void acpigen_write_processor_cnot(struct acpi_ctx *ctx, const uint num_cores); |
| 867 | |
Simon Glass | 350c7f5 | 2020-09-22 12:45:13 -0600 | [diff] [blame] | 868 | /** |
| 869 | * acpigen_write_ppc() - generates a function returning max P-states |
| 870 | * |
| 871 | * @ctx: ACPI context pointer |
| 872 | * @num_pstates: Number of pstates to return |
| 873 | */ |
| 874 | void acpigen_write_ppc(struct acpi_ctx *ctx, uint num_pstates); |
| 875 | |
| 876 | /** |
| 877 | * acpigen_write_ppc() - generates a function returning PPCM |
| 878 | * |
| 879 | * This returns the maximum number of supported P-states, as saved in the |
| 880 | * variable PPCM |
| 881 | * |
| 882 | * @ctx: ACPI context pointer |
| 883 | */ |
| 884 | void acpigen_write_ppc_nvs(struct acpi_ctx *ctx); |
| 885 | |
| 886 | /** |
| 887 | * acpigen_write_tpc() - Write a _TPC method that returns the TPC limit |
| 888 | * |
| 889 | * @ctx: ACPI context pointer |
| 890 | * @gnvs_tpc_limit: Variable that holds the TPC limit |
| 891 | */ |
| 892 | void acpigen_write_tpc(struct acpi_ctx *ctx, const char *gnvs_tpc_limit); |
| 893 | |
| 894 | /** |
| 895 | * acpigen_write_pss_package() - Write a PSS package |
| 896 | * |
| 897 | * See ACPI v6.3 section 8.4.6: Processor Performance Control |
| 898 | * |
| 899 | * @ctx: ACPI context pointer |
| 900 | * @corefreq: CPU core frequency in MHz |
| 901 | * @translat: worst-case latency in uS that the CPU is unavailable during a |
| 902 | * transition from any performance state to this performance state |
| 903 | * @busmlat: worst-case latency in microseconds that Bus Masters are prevented |
| 904 | * from accessing memory during a transition from any performance state to |
| 905 | * this performance state |
| 906 | * @control: Value to write to PERF_CTRL to move to this performance state |
| 907 | * @status: Expected PERF_STATUS value when in this state |
| 908 | */ |
| 909 | void acpigen_write_pss_package(struct acpi_ctx *ctx, uint corefreq, uint power, |
| 910 | uint translat, uint busmlat, uint control, |
| 911 | uint status); |
| 912 | |
| 913 | /** |
| 914 | * acpigen_write_psd_package() - Write a PSD package |
| 915 | * |
| 916 | * Writes a P-State dependency package |
| 917 | * |
| 918 | * See ACPI v6.3 section 8.4.6.5: _PSD (P-State Dependency) |
| 919 | * |
| 920 | * @ctx: ACPI context pointer |
| 921 | * @domain: Dependency domain number to which this P state entry belongs |
| 922 | * @numprocs: Number of processors belonging to the domain for this logical |
| 923 | * processor’s P-states |
| 924 | * @coordtype: Coordination type |
| 925 | */ |
| 926 | void acpigen_write_psd_package(struct acpi_ctx *ctx, uint domain, uint numprocs, |
| 927 | enum psd_coord coordtype); |
| 928 | |
| 929 | /** |
| 930 | * acpigen_write_cst_package() - Write a _CST package |
| 931 | * |
| 932 | * See ACPI v6.3 section 8.4.2.1: _CST (C States) |
| 933 | * |
| 934 | * @ctx: ACPI context pointer |
| 935 | * @entry: Array of entries |
| 936 | * @nentries; Number of entries |
| 937 | */ |
| 938 | void acpigen_write_cst_package(struct acpi_ctx *ctx, |
| 939 | const struct acpi_cstate *entry, int nentries); |
| 940 | |
| 941 | /** |
| 942 | * acpigen_write_csd_package() - Write a _CSD Package |
| 943 | * |
| 944 | * See ACPI v6.3 section 8.4.2.2: _CSD (C-State Dependency) |
| 945 | * |
| 946 | * @ctx: ACPI context pointer |
| 947 | * @domain: dependency domain number to which this C state entry belongs |
| 948 | * @numprocs: number of processors belonging to the domain for the particular |
| 949 | * C-state |
| 950 | * @coordtype: Co-ordination type |
| 951 | * @index: Index of the C-State entry in the _CST object for which the |
| 952 | * dependency applies |
| 953 | */ |
| 954 | void acpigen_write_csd_package(struct acpi_ctx *ctx, uint domain, uint numprocs, |
| 955 | enum csd_coord coordtype, uint index); |
| 956 | |
| 957 | /** |
| 958 | * acpigen_write_tss_package() - Write a _TSS package |
| 959 | * |
| 960 | * @ctx: ACPI context pointer |
| 961 | * @entry: Entries to write |
| 962 | * @nentries: Number of entries to write |
| 963 | */ |
| 964 | void acpigen_write_tss_package(struct acpi_ctx *ctx, |
| 965 | struct acpi_tstate *entry, int nentries); |
| 966 | |
| 967 | /** |
| 968 | * acpigen_write_tsd_package() - Write a _TSD package |
| 969 | * |
| 970 | * See ACPI v6.3 section 8.4.5.4: _TSD (T-State Dependency) |
| 971 | * |
| 972 | * @ctx: ACPI context pointer |
| 973 | * @domain: dependency domain number to which this T state entry belongs |
| 974 | * @numprocs: Number of processors belonging to the domain for this logical |
| 975 | * processor’s T-states |
| 976 | * @coordtype: Coordination type |
| 977 | */ |
| 978 | void acpigen_write_tsd_package(struct acpi_ctx *ctx, uint domain, uint numprocs, |
| 979 | enum psd_coord coordtype); |
| 980 | |
Simon Glass | 61cc933 | 2020-07-07 13:11:42 -0600 | [diff] [blame] | 981 | #endif |