linux/drivers/acpi/acpica/amlresrc.h

/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
/******************************************************************************
 *
 * Module Name: amlresrc.h - AML resource descriptors
 *
 * Copyright (C) 2000 - 2023, Intel Corp.
 *
 *****************************************************************************/

/* acpisrc:struct_defs -- for acpisrc conversion */

#ifndef __AMLRESRC_H
#define __AMLRESRC_H

/*
 * Resource descriptor tags, as defined in the ACPI specification.
 * Used to symbolically reference fields within a descriptor.
 */
#define ACPI_RESTAG_ADDRESS
#define ACPI_RESTAG_ALIGNMENT
#define ACPI_RESTAG_ADDRESSSPACE
#define ACPI_RESTAG_ACCESSSIZE
#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES
#define ACPI_RESTAG_BASEADDRESS
#define ACPI_RESTAG_BUSMASTER
#define ACPI_RESTAG_DEBOUNCETIME
#define ACPI_RESTAG_DECODE
#define ACPI_RESTAG_DEVICEPOLARITY
#define ACPI_RESTAG_DMA
#define ACPI_RESTAG_DMATYPE
#define ACPI_RESTAG_DRIVESTRENGTH
#define ACPI_RESTAG_ENDIANNESS
#define ACPI_RESTAG_FLOWCONTROL
#define ACPI_RESTAG_FUNCTION
#define ACPI_RESTAG_GRANULARITY
#define ACPI_RESTAG_INTERRUPT
#define ACPI_RESTAG_INTERRUPTLEVEL
#define ACPI_RESTAG_INTERRUPTSHARE
#define ACPI_RESTAG_INTERRUPTTYPE
#define ACPI_RESTAG_IORESTRICTION
#define ACPI_RESTAG_LENGTH
#define ACPI_RESTAG_LINE
#define ACPI_RESTAG_LOCALPORT
#define ACPI_RESTAG_MEMATTRIBUTES
#define ACPI_RESTAG_MEMTYPE
#define ACPI_RESTAG_MAXADDR
#define ACPI_RESTAG_MINADDR
#define ACPI_RESTAG_MAXTYPE
#define ACPI_RESTAG_MINTYPE
#define ACPI_RESTAG_MODE
#define ACPI_RESTAG_PARITY
#define ACPI_RESTAG_PHASE
#define ACPI_RESTAG_PHYTYPE
#define ACPI_RESTAG_PIN
#define ACPI_RESTAG_PINCONFIG
#define ACPI_RESTAG_PINCONFIG_TYPE
#define ACPI_RESTAG_PINCONFIG_VALUE
#define ACPI_RESTAG_POLARITY
#define ACPI_RESTAG_REGISTERBITOFFSET
#define ACPI_RESTAG_REGISTERBITWIDTH
#define ACPI_RESTAG_RANGETYPE
#define ACPI_RESTAG_READWRITETYPE
#define ACPI_RESTAG_LENGTH_RX
#define ACPI_RESTAG_LENGTH_TX
#define ACPI_RESTAG_SLAVEMODE
#define ACPI_RESTAG_SPEED
#define ACPI_RESTAG_STOPBITS
#define ACPI_RESTAG_TRANSLATION
#define ACPI_RESTAG_TRANSTYPE
#define ACPI_RESTAG_TYPE
#define ACPI_RESTAG_XFERTYPE
#define ACPI_RESTAG_VENDORDATA
#define ACPI_RESTAG_FQN
#define ACPI_RESTAG_FQD

/* Default sizes for "small" resource descriptors */

#define ASL_RDESC_IRQ_SIZE
#define ASL_RDESC_DMA_SIZE
#define ASL_RDESC_ST_DEPEND_SIZE
#define ASL_RDESC_END_DEPEND_SIZE
#define ASL_RDESC_IO_SIZE
#define ASL_RDESC_FIXED_IO_SIZE
#define ASL_RDESC_FIXED_DMA_SIZE
#define ASL_RDESC_END_TAG_SIZE

struct asl_resource_node {};

struct asl_resource_info {};

/* Macros used to generate AML resource length fields */

#define ACPI_AML_SIZE_LARGE(r)
#define ACPI_AML_SIZE_SMALL(r)

/*
 * Resource descriptors defined in the ACPI specification.
 *
 * Packing/alignment must be BYTE because these descriptors
 * are used to overlay the raw AML byte stream.
 */
#pragma pack(1)

/*
 * SMALL descriptors
 */
#define AML_RESOURCE_SMALL_HEADER_COMMON

struct aml_resource_small_header {};

struct aml_resource_irq {};

struct aml_resource_irq_noflags {};

struct aml_resource_dma {};

struct aml_resource_start_dependent {};

struct aml_resource_start_dependent_noprio {};

struct aml_resource_end_dependent {};

struct aml_resource_io {};

struct aml_resource_fixed_io {};

struct aml_resource_vendor_small {};

struct aml_resource_end_tag {};

struct aml_resource_fixed_dma {};

/*
 * LARGE descriptors
 */
#define AML_RESOURCE_LARGE_HEADER_COMMON

struct aml_resource_large_header {};

/* General Flags for address space resource descriptors */

#define ACPI_RESOURCE_FLAG_DEC
#define ACPI_RESOURCE_FLAG_MIF
#define ACPI_RESOURCE_FLAG_MAF

struct aml_resource_memory24 {};

struct aml_resource_vendor_large {};

struct aml_resource_memory32 {};

struct aml_resource_fixed_memory32 {};

#define AML_RESOURCE_ADDRESS_COMMON

struct aml_resource_address {};

struct aml_resource_extended_address64 {};

#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION

struct aml_resource_address64 {};

struct aml_resource_address32 {};

struct aml_resource_address16 {};

struct aml_resource_extended_irq {};

struct aml_resource_generic_register {};

/* Common descriptor for gpio_int and gpio_io (ACPI 5.0) */

struct aml_resource_gpio {};

#define AML_RESOURCE_GPIO_REVISION

/* Values for connection_type above */

#define AML_RESOURCE_GPIO_TYPE_INT
#define AML_RESOURCE_GPIO_TYPE_IO
#define AML_RESOURCE_MAX_GPIOTYPE

/* Common preamble for all serial descriptors (ACPI 5.0) */

#define AML_RESOURCE_SERIAL_COMMON \

/* Values for the type field above */

#define AML_RESOURCE_I2C_SERIALBUSTYPE
#define AML_RESOURCE_SPI_SERIALBUSTYPE
#define AML_RESOURCE_UART_SERIALBUSTYPE
#define AML_RESOURCE_CSI2_SERIALBUSTYPE
#define AML_RESOURCE_MAX_SERIALBUSTYPE
#define AML_RESOURCE_VENDOR_SERIALBUSTYPE

struct aml_resource_common_serialbus {};

struct aml_resource_csi2_serialbus {};

#define AML_RESOURCE_CSI2_REVISION
#define AML_RESOURCE_CSI2_TYPE_REVISION
#define AML_RESOURCE_CSI2_MIN_DATA_LEN

struct aml_resource_i2c_serialbus {};

#define AML_RESOURCE_I2C_REVISION
#define AML_RESOURCE_I2C_TYPE_REVISION
#define AML_RESOURCE_I2C_MIN_DATA_LEN

struct aml_resource_spi_serialbus {};

#define AML_RESOURCE_SPI_REVISION
#define AML_RESOURCE_SPI_TYPE_REVISION
#define AML_RESOURCE_SPI_MIN_DATA_LEN

struct aml_resource_uart_serialbus {};

#define AML_RESOURCE_UART_REVISION
#define AML_RESOURCE_UART_TYPE_REVISION
#define AML_RESOURCE_UART_MIN_DATA_LEN

struct aml_resource_pin_function {};

#define AML_RESOURCE_PIN_FUNCTION_REVISION

struct aml_resource_pin_config {};

#define AML_RESOURCE_CLOCK_INPUT_REVISION

struct aml_resource_clock_input {};

#define AML_RESOURCE_PIN_CONFIG_REVISION

struct aml_resource_pin_group {};

#define AML_RESOURCE_PIN_GROUP_REVISION

struct aml_resource_pin_group_function {};

#define AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION

struct aml_resource_pin_group_config {};

#define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION

/* restore default alignment */

#pragma pack()

/* Union of all resource descriptors, so we can allocate the worst case */

aml_resource;

/* Interfaces used by both the disassembler and compiler */

void
mp_save_gpio_info(union acpi_parse_object *op,
		  union aml_resource *resource,
		  u32 pin_count, u16 *pin_list, char *device_name);

void
mp_save_serial_info(union acpi_parse_object *op,
		    union aml_resource *resource, char *device_name);

char *mp_get_hid_from_parse_tree(struct acpi_namespace_node *hid_node);

char *mp_get_hid_via_namestring(char *device_name);

char *mp_get_connection_info(union acpi_parse_object *op,
			     u32 pin_index,
			     struct acpi_namespace_node **target_node,
			     char **target_name);

char *mp_get_parent_device_hid(union acpi_parse_object *op,
			       struct acpi_namespace_node **target_node,
			       char **parent_device_name);

char *mp_get_ddn_value(char *device_name);

char *mp_get_hid_value(struct acpi_namespace_node *device_node);

#endif