1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Core ACPI (Advanced Configuration and Power Interface) support
5 * Copyright 2019 Google LLC
7 * Modified from coreboot file acpigen.h
10 #ifndef __ACPI_ACPIGEN_H
11 #define __ACPI_ACPIGEN_H
13 #include <acpi/acpi_table.h>
14 #include <linux/types.h>
18 struct acpi_gen_regaddr;
21 /* Top 4 bits of the value used to indicate a three-byte length value */
22 #define ACPI_PKG_LEN_3_BYTES 0x80
24 #define ACPI_METHOD_NARGS_MASK 0x7
25 #define ACPI_METHOD_SERIALIZED_MASK BIT(3)
27 #define ACPI_END_TAG 0x79
29 /* ACPI Op/Prefix codes */
44 DUAL_NAME_PREFIX = 0x2e,
45 MULTI_NAME_PREFIX = 0x2f,
81 * enum psd_coord - Coordination types for P-states
83 * The type of coordination that exists (hardware) or is required (software) as
84 * a result of the underlying hardware dependency
93 * enum csd_coord - Coordination types for C-states
95 * The type of coordination that exists (hardware) or is required (software) as
96 * a result of the underlying hardware dependency
103 * struct acpi_cstate - Information about a C-State
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
114 struct acpi_gen_regaddr resource;
118 * struct acpi_tstate - Information about a Throttling Supported State
120 * See ACPI v6.3 section 8.4.5.2: _TSS (Throttling Supported States)
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
140 * acpigen_get_current() - Get the current ACPI code output pointer
142 * @ctx: ACPI context pointer
143 * Return: output pointer
145 u8 *acpigen_get_current(struct acpi_ctx *ctx);
148 * acpigen_emit_byte() - Emit a byte to the ACPI code
150 * @ctx: ACPI context pointer
151 * @data: Value to output
153 void acpigen_emit_byte(struct acpi_ctx *ctx, uint data);
156 * acpigen_emit_word() - Emit a 16-bit word to the ACPI code
158 * @ctx: ACPI context pointer
159 * @data: Value to output
161 void acpigen_emit_word(struct acpi_ctx *ctx, uint data);
164 * acpigen_emit_dword() - Emit a 32-bit 'double word' to the ACPI code
166 * @ctx: ACPI context pointer
167 * @data: Value to output
169 void acpigen_emit_dword(struct acpi_ctx *ctx, uint data);
172 * acpigen_emit_stream() - Emit a stream of bytes
174 * @ctx: ACPI context pointer
175 * @data: Data to output
176 * @size: Size of data in bytes
178 void acpigen_emit_stream(struct acpi_ctx *ctx, const char *data, int size);
181 * acpigen_emit_string() - Emit a string
183 * Emit a string with a null terminator
185 * @ctx: ACPI context pointer
186 * @str: String to output, or NULL for an empty string
188 void acpigen_emit_string(struct acpi_ctx *ctx, const char *str);
191 * acpigen_write_len_f() - Write a 'forward' length placeholder
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.
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() ----------/
209 * See ACPI 6.3 section 20.2.4 Package Length Encoding
211 * This implementation always uses a 3-byte packet length for simplicity. It
212 * could be adjusted to support other lengths.
214 * @ctx: ACPI context pointer
216 void acpigen_write_len_f(struct acpi_ctx *ctx);
219 * acpigen_pop_len() - Update the previously stacked length placeholder
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.
224 * @ctx: ACPI context pointer
226 void acpigen_pop_len(struct acpi_ctx *ctx);
229 * acpigen_write_package() - Start writing a package
231 * A package collects together a number of elements in the ACPI code. To write
234 * acpigen_write_package(ctx, 3);
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:
241 * char *num_elements = acpigen_write_package(ctx, 0);
243 * *num_elements += 1;
245 * *num_elements += 1;
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
253 char *acpigen_write_package(struct acpi_ctx *ctx, int nr_el);
256 * acpigen_write_byte() - Write a byte
258 * @ctx: ACPI context pointer
259 * @data: Value to write
261 void acpigen_write_byte(struct acpi_ctx *ctx, unsigned int data);
264 * acpigen_write_word() - Write a word
266 * @ctx: ACPI context pointer
267 * @data: Value to write
269 void acpigen_write_word(struct acpi_ctx *ctx, unsigned int data);
272 * acpigen_write_dword() - Write a dword
274 * @ctx: ACPI context pointer
275 * @data: Value to write
277 void acpigen_write_dword(struct acpi_ctx *ctx, unsigned int data);
280 * acpigen_write_qword() - Write a qword
282 * @ctx: ACPI context pointer
283 * @data: Value to write
285 void acpigen_write_qword(struct acpi_ctx *ctx, u64 data);
288 * acpigen_write_zero() - Write zero
290 * @ctx: ACPI context pointer
292 void acpigen_write_zero(struct acpi_ctx *ctx);
295 * acpigen_write_one() - Write one
297 * @ctx: ACPI context pointer
299 void acpigen_write_one(struct acpi_ctx *ctx);
302 * acpigen_write_integer() - Write an integer
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.
307 * @ctx: ACPI context pointer
308 * @data: Integer to write
310 void acpigen_write_integer(struct acpi_ctx *ctx, u64 data);
313 * acpigen_write_name_zero() - Write a named zero value
315 * @ctx: ACPI context pointer
316 * @name: Name of the value
318 void acpigen_write_name_zero(struct acpi_ctx *ctx, const char *name);
321 * acpigen_write_name_one() - Write a named one value
323 * @ctx: ACPI context pointer
324 * @name: Name of the value
326 void acpigen_write_name_one(struct acpi_ctx *ctx, const char *name);
329 * acpigen_write_name_byte() - Write a named byte value
331 * @ctx: ACPI context pointer
332 * @name: Name of the value
333 * @val: Value to write
335 void acpigen_write_name_byte(struct acpi_ctx *ctx, const char *name, uint val);
338 * acpigen_write_name_word() - Write a named word value
340 * @ctx: ACPI context pointer
341 * @name: Name of the value
342 * @val: Value to write
344 void acpigen_write_name_word(struct acpi_ctx *ctx, const char *name, uint val);
347 * acpigen_write_name_dword() - Write a named dword value
349 * @ctx: ACPI context pointer
350 * @name: Name of the value
351 * @val: Value to write
353 void acpigen_write_name_dword(struct acpi_ctx *ctx, const char *name, uint val);
356 * acpigen_write_name_qword() - Write a named qword value
358 * @ctx: ACPI context pointer
359 * @name: Name of the value
360 * @val: Value to write
362 void acpigen_write_name_qword(struct acpi_ctx *ctx, const char *name, u64 val);
365 * acpigen_write_name_integer() - Write a named integer value
367 * @ctx: ACPI context pointer
368 * @name: Name of the value
369 * @val: Value to write
371 void acpigen_write_name_integer(struct acpi_ctx *ctx, const char *name,
375 * acpigen_write_name_string() - Write a named string value
377 * @ctx: ACPI context pointer
378 * @name: Name of the value
379 * @string: String to write
381 void acpigen_write_name_string(struct acpi_ctx *ctx, const char *name,
385 * acpigen_write_string() - Write a string
387 * This writes a STRING_PREFIX followed by a null-terminated string
389 * @ctx: ACPI context pointer
390 * @str: String to write
392 void acpigen_write_string(struct acpi_ctx *ctx, const char *str);
395 * acpigen_emit_namestring() - Emit an ACPI name
397 * This writes out an ACPI name or path in the required special format. It does
398 * not add the NAME_OP prefix.
400 * @ctx: ACPI context pointer
401 * @namepath: Name / path to emit
403 void acpigen_emit_namestring(struct acpi_ctx *ctx, const char *namepath);
406 * acpigen_write_name() - Write out an ACPI name
408 * This writes out an ACPI name or path in the required special format with a
411 * @ctx: ACPI context pointer
412 * @namepath: Name / path to emit
414 void acpigen_write_name(struct acpi_ctx *ctx, const char *namepath);
417 * acpigen_write_scope() - Write a scope
419 * @ctx: ACPI context pointer
420 * @scope: Scope to write (e.g. "\\_SB.ABCD")
422 void acpigen_write_scope(struct acpi_ctx *ctx, const char *scope);
425 * acpigen_write_uuid() - Write a UUID
427 * This writes out a UUID in the format used by ACPI, with a BUFFER_OP prefix.
429 * @ctx: ACPI context pointer
430 * @uuid: UUID to write in the form aabbccdd-eeff-gghh-iijj-kkllmmnnoopp
431 * Return: 0 if OK, -EINVAL if the format is incorrect
433 int acpigen_write_uuid(struct acpi_ctx *ctx, const char *uuid);
436 * acpigen_emit_ext_op() - Emit an extended op with the EXT_OP_PREFIX prefix
438 * @ctx: ACPI context pointer
439 * @op: Operation code (e.g. SLEEP_OP)
441 void acpigen_emit_ext_op(struct acpi_ctx *ctx, uint op);
444 * acpigen_write_method() - Write a method header
446 * @ctx: ACPI context pointer
447 * @name: Method name (4 characters)
448 * @nargs: Number of method arguments (0 if none)
450 void acpigen_write_method(struct acpi_ctx *ctx, const char *name, int nargs);
453 * acpigen_write_method_serialized() - Write a method header
455 * This sets the 'serialized' flag so that the method is thread-safe
457 * @ctx: ACPI context pointer
458 * @name: Method name (4 characters)
459 * @nargs: Number of method arguments (0 if none)
461 void acpigen_write_method_serialized(struct acpi_ctx *ctx, const char *name,
465 * acpigen_write_device() - Write an ACPI device
467 * @ctx: ACPI context pointer
468 * @name: Device name to write
470 void acpigen_write_device(struct acpi_ctx *ctx, const char *name);
473 * acpigen_write_sta() - Write a _STA method
475 * @ctx: ACPI context pointer
476 * @status: Status value to return
478 void acpigen_write_sta(struct acpi_ctx *ctx, uint status);
481 * acpigen_write_resourcetemplate_header() - Write a ResourceTemplate header
483 * @ctx: ACPI context pointer
485 void acpigen_write_resourcetemplate_header(struct acpi_ctx *ctx);
488 * acpigen_write_resourcetemplate_footer() - Write a ResourceTemplate footer
490 * @ctx: ACPI context pointer
492 void acpigen_write_resourcetemplate_footer(struct acpi_ctx *ctx);
495 * acpigen_write_register_resource() - Write a register resource
497 * This writes a header, the address information and a footer
499 * @ctx: ACPI context pointer
500 * @addr: Address to write
502 void acpigen_write_register_resource(struct acpi_ctx *ctx,
503 const struct acpi_gen_regaddr *addr);
506 * acpigen_write_sleep() - Write a sleep operation
508 * @ctx: ACPI context pointer
509 * @sleep_ms: Number of milliseconds to sleep for
511 void acpigen_write_sleep(struct acpi_ctx *ctx, u64 sleep_ms);
514 * acpigen_write_store() - Write a store operation
516 * @ctx: ACPI context pointer
518 void acpigen_write_store(struct acpi_ctx *ctx);
521 * acpigen_write_debug_string() - Write a debug string
523 * This writes a debug operation with an associated string
525 * @ctx: ACPI context pointer
526 * @str: String to write
528 void acpigen_write_debug_string(struct acpi_ctx *ctx, const char *str);
531 * acpigen_write_or() - Write a bitwise OR operation
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)
540 void acpigen_write_or(struct acpi_ctx *ctx, u8 arg1, u8 arg2, u8 res);
543 * acpigen_write_and() - Write a bitwise AND operation
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)
552 void acpigen_write_and(struct acpi_ctx *ctx, u8 arg1, u8 arg2, u8 res);
555 * acpigen_write_not() - Write a bitwise NOT operation
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)
563 void acpigen_write_not(struct acpi_ctx *ctx, u8 arg, u8 res);
566 * acpigen_write_power_res() - Write a power resource
568 * Name (_PRx, Package(One) { name })
570 * PowerResource (name, level, order)
572 * The caller should fill in the rest of the power resource and then call
573 * acpigen_pop_len() to close it off
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
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);
587 * acpigen_set_enable_tx_gpio() - Emit ACPI code to enable/disable a GPIO
589 * This emits code to either enable to disable a Tx GPIO. It takes account of
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
600 * Example code (-- means comment):
602 * -- Get Pad Configuration DW0 register value
603 * Method (GPC0, 0x1, Serialized)
605 * -- Arg0 - GPIO DW0 address
606 * Store (Arg0, Local0)
607 * OperationRegion (PDW0, SystemMemory, Local0, 4)
608 * Field (PDW0, AnyAcc, NoLock, Preserve) {
614 * -- Set Pad Configuration DW0 register value
615 * Method (SPC0, 0x2, Serialized)
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) {
628 * @ctx: ACPI context pointer
629 * @tx_state_val: Mask to use to toggle the TX state on the GPIO pin, e,g.
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.
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);
642 * acpigen_write_prw() - Write a power resource for wake (_PRW)
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
649 void acpigen_write_prw(struct acpi_ctx *ctx, uint wake, uint level);
652 * acpigen_write_if() - Write an If block
654 * This requires a call to acpigen_pop_len() to complete the block
656 * @ctx: ACPI context pointer
658 void acpigen_write_if(struct acpi_ctx *ctx);
661 * acpigen_write_if_lequal_op_int() - Write comparison between op and integer
663 * Generates ACPI code for checking if operand1 and operand2 are equal
665 * If (Lequal (op, val))
667 * @ctx: ACPI context pointer
668 * @op: Operand to check
669 * @val: Value to check against
671 void acpigen_write_if_lequal_op_int(struct acpi_ctx *ctx, uint op, u64 val);
674 * acpigen_write_else() - Write an Ef block
676 * This requires a call to acpigen_pop_len() to complete the block
678 * @ctx: ACPI context pointer
680 void acpigen_write_else(struct acpi_ctx *ctx);
683 * acpigen_write_to_buffer() - Write a ToBuffer operation
685 * E.g.: to generate: ToBuffer (Arg0, Local0)
686 * use acpigen_write_to_buffer(ctx, ARG0_OP, LOCAL0_OP)
688 * @ctx: ACPI context pointer
689 * @src: Source argument
690 * @dst: Destination argument
692 void acpigen_write_to_buffer(struct acpi_ctx *ctx, uint src, uint dst);
695 * acpigen_write_to_integer() - Write a ToInteger operation
697 * E.g.: to generate: ToInteger (Arg0, Local0)
698 * use acpigen_write_to_integer(ctx, ARG0_OP, LOCAL0_OP)
700 * @ctx: ACPI context pointer
701 * @src: Source argument
702 * @dst: Destination argument
704 void acpigen_write_to_integer(struct acpi_ctx *ctx, uint src, uint dst);
707 * acpigen_write_return_byte_buffer() - Write a return of a byte buffer
709 * @ctx: ACPI context pointer
710 * @arr: Array of bytes to return
711 * @size: Number of bytes
713 void acpigen_write_return_byte_buffer(struct acpi_ctx *ctx, u8 *arr,
717 * acpigen_write_return_singleton_buffer() - Write a return of a 1-byte buffer
719 * @ctx: ACPI context pointer
720 * @arg: Byte to return
722 void acpigen_write_return_singleton_buffer(struct acpi_ctx *ctx, uint arg);
725 * acpigen_write_return_byte() - Write a return of a byte
727 * @ctx: ACPI context pointer
728 * @arg: Byte to return
730 void acpigen_write_return_byte(struct acpi_ctx *ctx, uint arg);
733 * acpigen_write_dsm_start() - Start a _DSM method
735 * Generate ACPI AML code to start the _DSM method.
737 * The functions need to be called in the correct sequence as below.
739 * Within the <generate-code-here> region, Local0 and Local1 must be are left
740 * untouched, but Local2-Local7 can be used
742 * Arguments passed into _DSM method:
745 * Arg2 = Function index
746 * Arg3 = Function-specific arguments
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
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
763 * If (LEqual (Local0, ToUUID(uuidn))) {
766 * Return (Buffer (One) { 0x0 }) -- acpigen_write_dsm_end
769 * @ctx: ACPI context pointer
771 void acpigen_write_dsm_start(struct acpi_ctx *ctx);
774 * acpigen_write_dsm_uuid_start() - Start a new UUID block
776 * This starts generation of code to handle a particular UUID:
778 * If (LEqual (Local0, ToUUID(uuid))) {
779 * ToInteger (Arg2, Local1)
781 * @ctx: ACPI context pointer
783 int acpigen_write_dsm_uuid_start(struct acpi_ctx *ctx, const char *uuid);
786 * acpigen_write_dsm_uuid_start_cond() - Start a new condition block
788 * This starts generation of condition-checking code to handle a particular
791 * If (LEqual (Local1, i))
793 * @ctx: ACPI context pointer
795 void acpigen_write_dsm_uuid_start_cond(struct acpi_ctx *ctx, int seq);
798 * acpigen_write_dsm_uuid_end_cond() - Start a new condition block
800 * This ends generation of condition-checking code to handle a particular
805 * @ctx: ACPI context pointer
807 void acpigen_write_dsm_uuid_end_cond(struct acpi_ctx *ctx);
810 * acpigen_write_dsm_uuid_end() - End a UUID block
812 * This ends generation of code to handle a particular UUID:
814 * Return (Buffer (One) { 0x0 })
816 * @ctx: ACPI context pointer
818 void acpigen_write_dsm_uuid_end(struct acpi_ctx *ctx);
821 * acpigen_write_dsm_end() - End a _DSM method
823 * This ends generates of the _DSM block:
825 * Return (Buffer (One) { 0x0 })
827 * @ctx: ACPI context pointer
829 void acpigen_write_dsm_end(struct acpi_ctx *ctx);
832 * acpigen_write_processor() - Write a Processor package
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 * Deprecated since ACPI 6.0.
838 * @ctx: ACPI context pointer
839 * @cpuindex: CPU number
840 * @pblock_addr: PBlk system IO address
841 * @pblock_len: PBlk length
843 void acpigen_write_processor(struct acpi_ctx *ctx, uint cpuindex,
844 u32 pblock_addr, uint pblock_len);
847 * acpigen_write_processor_device() - Write a Processor device
849 * Write a device with _HID ACPI0007 identifying a processor.
850 * Replacement for the Processor OpCode.
852 * @ctx: ACPI context pointer
853 * @cpuindex: CPU number
855 void acpigen_write_processor_device(struct acpi_ctx *ctx, uint cpuindex);
858 * acpigen_write_processor_package() - Write a package containing the processors
860 * The package containins the name of each processor in the SoC
862 * @ctx: ACPI context pointer
863 * @name: Package name (.e.g "PPKG")
864 * @first_core: Number of the first core (e.g. 0)
865 * @core_count: Number of cores (e.g. 4)
867 void acpigen_write_processor_package(struct acpi_ctx *ctx, const char *name,
868 uint first_core, uint core_count);
871 * acpigen_write_processor_cnot() - Write a processor notification method
873 * This writes a method that notifies all CPU cores
875 * @ctx: ACPI context pointer
876 * @num_cores: Number of CPU cores
878 void acpigen_write_processor_cnot(struct acpi_ctx *ctx, const uint num_cores);
881 * acpigen_write_ppc() - generates a function returning max P-states
883 * @ctx: ACPI context pointer
884 * @num_pstates: Number of pstates to return
886 void acpigen_write_ppc(struct acpi_ctx *ctx, uint num_pstates);
889 * acpigen_write_ppc() - generates a function returning PPCM
891 * This returns the maximum number of supported P-states, as saved in the
894 * @ctx: ACPI context pointer
896 void acpigen_write_ppc_nvs(struct acpi_ctx *ctx);
899 * acpigen_write_tpc() - Write a _TPC method that returns the TPC limit
901 * @ctx: ACPI context pointer
902 * @gnvs_tpc_limit: Variable that holds the TPC limit
904 void acpigen_write_tpc(struct acpi_ctx *ctx, const char *gnvs_tpc_limit);
907 * acpigen_write_pss_package() - Write a PSS package
909 * See ACPI v6.3 section 8.4.6: Processor Performance Control
911 * @ctx: ACPI context pointer
912 * @corefreq: CPU core frequency in MHz
913 * @translat: worst-case latency in uS that the CPU is unavailable during a
914 * transition from any performance state to this performance state
915 * @busmlat: worst-case latency in microseconds that Bus Masters are prevented
916 * from accessing memory during a transition from any performance state to
917 * this performance state
918 * @control: Value to write to PERF_CTRL to move to this performance state
919 * @status: Expected PERF_STATUS value when in this state
921 void acpigen_write_pss_package(struct acpi_ctx *ctx, uint corefreq, uint power,
922 uint translat, uint busmlat, uint control,
926 * acpigen_write_psd_package() - Write a PSD package
928 * Writes a P-State dependency package
930 * See ACPI v6.3 section 8.4.6.5: _PSD (P-State Dependency)
932 * @ctx: ACPI context pointer
933 * @domain: Dependency domain number to which this P state entry belongs
934 * @numprocs: Number of processors belonging to the domain for this logical
935 * processor's P-states
936 * @coordtype: Coordination type
938 void acpigen_write_psd_package(struct acpi_ctx *ctx, uint domain, uint numprocs,
939 enum psd_coord coordtype);
942 * acpigen_write_cst_package() - Write a _CST package
944 * See ACPI v6.3 section 8.4.2.1: _CST (C States)
946 * @ctx: ACPI context pointer
947 * @entry: Array of entries
948 * @nentries; Number of entries
950 void acpigen_write_cst_package(struct acpi_ctx *ctx,
951 const struct acpi_cstate *entry, int nentries);
954 * acpigen_write_csd_package() - Write a _CSD Package
956 * See ACPI v6.3 section 8.4.2.2: _CSD (C-State Dependency)
958 * @ctx: ACPI context pointer
959 * @domain: dependency domain number to which this C state entry belongs
960 * @numprocs: number of processors belonging to the domain for the particular
962 * @coordtype: Co-ordination type
963 * @index: Index of the C-State entry in the _CST object for which the
966 void acpigen_write_csd_package(struct acpi_ctx *ctx, uint domain, uint numprocs,
967 enum csd_coord coordtype, uint index);
970 * acpigen_write_tss_package() - Write a _TSS package
972 * @ctx: ACPI context pointer
973 * @entry: Entries to write
974 * @nentries: Number of entries to write
976 void acpigen_write_tss_package(struct acpi_ctx *ctx,
977 struct acpi_tstate *entry, int nentries);
980 * acpigen_write_tsd_package() - Write a _TSD package
982 * See ACPI v6.3 section 8.4.5.4: _TSD (T-State Dependency)
984 * @ctx: ACPI context pointer
985 * @domain: dependency domain number to which this T state entry belongs
986 * @numprocs: Number of processors belonging to the domain for this logical
987 * processor's T-states
988 * @coordtype: Coordination type
990 void acpigen_write_tsd_package(struct acpi_ctx *ctx, uint domain, uint numprocs,
991 enum psd_coord coordtype);