Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8269c734 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'acpica'

* acpica:
  ACPICA: Update version to 20170303
  ACPICA: iasl: add ASL conversion tool
  ACPICA: Local cache support: Allow small cache objects
  ACPICA: Disassembler: Do not unconditionally remove temporary names
  ACPICA: iasl: Fix IORT SMMU GSI disassembling
  ACPICA: Cleanup AML opcode definitions, no functional change
  ACPICA: Debugger: Add interpreter blocking mark for single-step mode
  ACPICA: debugger: fix memory leak on Pathname
  ACPICA: Update for automatic repair code for objects returned by evaluate_object
  ACPICA: Namespace: fix operand cache leak
  ACPICA: Fix several incorrect invocations of ACPICA return macro
  ACPICA: Fix a module for excessive debug output
  ACPICA: Update some function headers, no funtional change
  ACPICA: Disassembler: Enhance resource descriptor detection
  ACPICA: Add non-linux host build support
parents 08be8810 bc5150ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
# Makefile for ACPICA Core interpreter
#

ccflags-y			:= -Os -DBUILDING_ACPICA
ccflags-y			:= -Os -D_LINUX -DBUILDING_ACPICA
ccflags-$(CONFIG_ACPI_DEBUG)	+= -DACPI_DEBUG_OUTPUT

# use acpi.o to put all files here into acpi.o modparam namespace
+144 −0
Original line number Diff line number Diff line
/******************************************************************************
 *
 * Module Name: acapps - common include for ACPI applications/tools
 *
 *****************************************************************************/

/*
 * Copyright (C) 2000 - 2017, Intel Corp.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

#ifndef _ACCONVERT
#define _ACCONVERT

/* Definitions for comment state */

#define ASL_COMMENT_STANDARD    1
#define ASLCOMMENT_INLINE       2
#define ASL_COMMENT_OPEN_PAREN  3
#define ASL_COMMENT_CLOSE_PAREN 4
#define ASL_COMMENT_CLOSE_BRACE 5

/* Definitions for comment print function*/

#define AML_COMMENT_STANDARD    1
#define AMLCOMMENT_INLINE       2
#define AML_COMMENT_END_NODE    3
#define AML_NAMECOMMENT         4
#define AML_COMMENT_CLOSE_BRACE 5
#define AML_COMMENT_ENDBLK      6
#define AML_COMMENT_INCLUDE     7

#ifdef ACPI_ASL_COMPILER
/*
 * cvcompiler
 */
void
cv_process_comment(struct asl_comment_state current_state,
		   char *string_buffer, int c1);

void
cv_process_comment_type2(struct asl_comment_state current_state,
			 char *string_buffer);

u32 cv_calculate_comment_lengths(union acpi_parse_object *op);

void cv_process_comment_state(char input);

char *cv_append_inline_comment(char *inline_comment, char *to_add);

void cv_add_to_comment_list(char *to_add);

void cv_place_comment(u8 type, char *comment_string);

u32 cv_parse_op_block_type(union acpi_parse_object *op);

struct acpi_comment_node *cv_comment_node_calloc(void);

void cg_write_aml_def_block_comment(union acpi_parse_object *op);

void
cg_write_one_aml_comment(union acpi_parse_object *op,
			 char *comment_to_print, u8 input_option);

void cg_write_aml_comment(union acpi_parse_object *op);

/*
 * cvparser
 */
void
cv_init_file_tree(struct acpi_table_header *table,
		  u8 *aml_start, u32 aml_length);

void cv_clear_op_comments(union acpi_parse_object *op);

struct acpi_file_node *cv_filename_exists(char *filename,
					  struct acpi_file_node *head);

void cv_label_file_node(union acpi_parse_object *op);

void
cv_capture_list_comments(struct acpi_parse_state *parser_state,
			 struct acpi_comment_node *list_head,
			 struct acpi_comment_node *list_tail);

void cv_capture_comments_only(struct acpi_parse_state *parser_state);

void cv_capture_comments(struct acpi_walk_state *walk_state);

void cv_transfer_comments(union acpi_parse_object *op);

/*
 * cvdisasm
 */
void cv_switch_files(u32 level, union acpi_parse_object *op);

u8 cv_file_has_switched(union acpi_parse_object *op);

void cv_close_paren_write_comment(union acpi_parse_object *op, u32 level);

void cv_close_brace_write_comment(union acpi_parse_object *op, u32 level);

void
cv_print_one_comment_list(struct acpi_comment_node *comment_list, u32 level);

void
cv_print_one_comment_type(union acpi_parse_object *op,
			  u8 comment_type, char *end_str, u32 level);

#endif

#endif				/* _ACCONVERT */
+53 −0
Original line number Diff line number Diff line
@@ -370,6 +370,59 @@ ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);

#endif

/*
 * Meant for the -ca option.
 */
ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL);
ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL);
ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL);
ACPI_INIT_GLOBAL(char *, acpi_gbl_current_close_brace_comment, NULL);

ACPI_INIT_GLOBAL(char *, acpi_gbl_root_filename, NULL);
ACPI_INIT_GLOBAL(char *, acpi_gbl_current_filename, NULL);
ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL);
ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL);

ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);

ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head,
		 NULL);
ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail,
		 NULL);

ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head,
		 NULL);
ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail,
		 NULL);

ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head,
		 NULL);
ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail,
		 NULL);

ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head,
		 NULL);
ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail,
		 NULL);

ACPI_INIT_GLOBAL(struct acpi_comment_addr_node,
		 *acpi_gbl_comment_addr_list_head, NULL);

ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);

ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL);

ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache);
ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache);
ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache);

ACPI_INIT_GLOBAL(u8, gbl_capture_comments, FALSE);

ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE);
ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL);

ACPI_GLOBAL(char, acpi_gbl_table_sig[4]);

/*****************************************************************************
 *
 * Application globals
+88 −18
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ typedef u32 acpi_mutex_handle;

/* Total number of aml opcodes defined */

#define AML_NUM_OPCODES                 0x82
#define AML_NUM_OPCODES                 0x83

/* Forward declarations */

@@ -754,6 +754,12 @@ union acpi_parse_value {
#define ACPI_DISASM_ONLY_MEMBERS(a)
#endif

#if defined(ACPI_ASL_COMPILER)
#define ACPI_CONVERTER_ONLY_MEMBERS(a)  a;
#else
#define ACPI_CONVERTER_ONLY_MEMBERS(a)
#endif

#define ACPI_PARSE_COMMON \
	union acpi_parse_object         *parent;            /* Parent op */\
	u8                              descriptor_type;    /* To differentiate various internal objs */\
@@ -768,7 +774,32 @@ union acpi_parse_value {
	u16                             disasm_flags;       /* Used during AML disassembly */\
	u8                              disasm_opcode;      /* Subtype used for disassembly */\
	char                            *operator_symbol;   /* Used for C-style operator name strings */\
	char                            aml_op_name[16])	/* Op name (debug only) */
	char                            aml_op_name[16])    /* Op name (debug only) */\
	 ACPI_CONVERTER_ONLY_MEMBERS (\
	char                            *inline_comment;    /* Inline comment */\
	char                            *end_node_comment;  /* End of node comment */\
	char                            *name_comment;      /* Comment associated with the first parameter of the name node */\
	char                            *close_brace_comment; /* Comments that come after } on the same as } */\
	struct acpi_comment_node        *comment_list;      /* comments that appears before this node */\
	struct acpi_comment_node        *end_blk_comment;   /* comments that at the end of a block but before ) or } */\
	char                            *cv_filename;       /* Filename associated with this node. Used for ASL/ASL+ converter */\
	char                            *cv_parent_filename)	/* Parent filename associated with this node. Used for ASL/ASL+ converter */

/* categories of comments */

typedef enum {
	STANDARD_COMMENT = 1,
	INLINE_COMMENT,
	ENDNODE_COMMENT,
	OPENBRACE_COMMENT,
	CLOSE_BRACE_COMMENT,
	STD_DEFBLK_COMMENT,
	END_DEFBLK_COMMENT,
	FILENAME_COMMENT,
	PARENTFILENAME_COMMENT,
	ENDBLK_COMMENT,
	INCLUDE_COMMENT
} asl_comment_types;

/* Internal opcodes for disasm_opcode field above */

@@ -784,9 +815,38 @@ union acpi_parse_value {
#define ACPI_DASM_LNOT_SUFFIX           0x09	/* End  of a Lnot_equal (etc.) pair of opcodes */
#define ACPI_DASM_HID_STRING            0x0A	/* String is a _HID or _CID */
#define ACPI_DASM_IGNORE_SINGLE         0x0B	/* Ignore the opcode but not it's children */
#define ACPI_DASM_SWITCH_PREDICATE      0x0C	/* Object is a predicate for a Switch or Case block */
#define ACPI_DASM_CASE                  0x0D	/* If/Else is a Case in a Switch/Case block */
#define ACPI_DASM_DEFAULT               0x0E	/* Else is a Default in a Switch/Case block */
#define ACPI_DASM_SWITCH                0x0C	/* While is a Switch */
#define ACPI_DASM_SWITCH_PREDICATE      0x0D	/* Object is a predicate for a Switch or Case block */
#define ACPI_DASM_CASE                  0x0E	/* If/Else is a Case in a Switch/Case block */
#define ACPI_DASM_DEFAULT               0x0F	/* Else is a Default in a Switch/Case block */

/*
 * List struct used in the -ca option
 */
struct acpi_comment_node {
	char *comment;
	struct acpi_comment_node *next;
};

struct acpi_comment_addr_node {
	u8 *addr;
	struct acpi_comment_addr_node *next;
};

/*
 * File node - used for "Include" operator file stack and
 * depdendency tree for the -ca option
 */
struct acpi_file_node {
	void *file;
	char *filename;
	char *file_start;	/* Points to AML and indicates when the AML for this particular file starts. */
	char *file_end;		/* Points to AML and indicates when the AML for this particular file ends. */
	struct acpi_file_node *next;
	struct acpi_file_node *parent;
	u8 include_written;
	struct acpi_comment_node *include_comment;
};

/*
 * Generic operation (for example:  If, While, Store)
@@ -813,6 +873,8 @@ struct acpi_parse_obj_asl {
	ACPI_PARSE_COMMON union acpi_parse_object *child;
	union acpi_parse_object *parent_method;
	char *filename;
	u8 file_changed;
	char *parent_filename;
	char *external_name;
	char *namepath;
	char name_seg[4];
@@ -842,6 +904,14 @@ union acpi_parse_object {
	struct acpi_parse_obj_asl asl;
};

struct asl_comment_state {
	u8 comment_type;
	u32 spaces_before;
	union acpi_parse_object *latest_parse_node;
	union acpi_parse_object *parsing_paren_brace_node;
	u8 capture_comments;
};

/*
 * Parse state - one state per parser invocation and each control
 * method.
+35 −0
Original line number Diff line number Diff line
@@ -493,4 +493,39 @@

#define ACPI_IS_OCTAL_DIGIT(d)              (((char)(d) >= '0') && ((char)(d) <= '7'))

/*
 * Macors used for the ASL-/ASL+ converter utility
 */
#ifdef ACPI_ASL_COMPILER

#define ASL_CV_LABEL_FILENODE(a)         cv_label_file_node(a);
#define ASL_CV_CAPTURE_COMMENTS_ONLY(a)   cv_capture_comments_only (a);
#define ASL_CV_CAPTURE_COMMENTS(a)       cv_capture_comments (a);
#define ASL_CV_TRANSFER_COMMENTS(a)      cv_transfer_comments (a);
#define ASL_CV_CLOSE_PAREN(a,b)          cv_close_paren_write_comment(a,b);
#define ASL_CV_CLOSE_BRACE(a,b)          cv_close_brace_write_comment(a,b);
#define ASL_CV_SWITCH_FILES(a,b)         cv_switch_files(a,b);
#define ASL_CV_CLEAR_OP_COMMENTS(a)       cv_clear_op_comments(a);
#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) cv_print_one_comment_type (a,b,c,d);
#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) cv_print_one_comment_list (a,b);
#define ASL_CV_FILE_HAS_SWITCHED(a)       cv_file_has_switched(a)
#define ASL_CV_INIT_FILETREE(a,b,c)      cv_init_file_tree(a,b,c);

#else

#define ASL_CV_LABEL_FILENODE(a)
#define ASL_CV_CAPTURE_COMMENTS_ONLY(a)
#define ASL_CV_CAPTURE_COMMENTS(a)
#define ASL_CV_TRANSFER_COMMENTS(a)
#define ASL_CV_CLOSE_PAREN(a,b)          acpi_os_printf (")");
#define ASL_CV_CLOSE_BRACE(a,b)          acpi_os_printf ("}");
#define ASL_CV_SWITCH_FILES(a,b)
#define ASL_CV_CLEAR_OP_COMMENTS(a)
#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d)
#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b)
#define ASL_CV_FILE_HAS_SWITCHED(a)       0
#define ASL_CV_INIT_FILETREE(a,b,c)

#endif

#endif				/* ACMACROS_H */
Loading