1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ 2/****************************************************************************** 3 * 4 * Module Name: acpidump.h - Include file for acpi_dump utility 5 * 6 * Copyright (C) 2000 - 2023, Intel Corp. 7 * 8 *****************************************************************************/ 9 10/* 11 * Global variables. Defined in main.c only, externed in all other files 12 */ 13#ifdef _DECLARE_GLOBALS 14#define EXTERN 15#define INIT_GLOBAL(a,b) a=b 16#else 17#define EXTERN extern 18#define INIT_GLOBAL(a,b) a 19#endif 20 21#include <acpi/acpi.h> 22#include "accommon.h" 23#include "actables.h" 24#include "acapps.h" 25 26/* Globals */ 27 28EXTERN u8 INIT_GLOBAL(gbl_summary_mode, FALSE); 29EXTERN u8 INIT_GLOBAL(gbl_verbose_mode, FALSE); 30EXTERN u8 INIT_GLOBAL(gbl_binary_mode, FALSE); 31EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, TRUE); 32EXTERN u8 INIT_GLOBAL(gbl_do_not_dump_xsdt, FALSE); 33EXTERN ACPI_FILE INIT_GLOBAL(gbl_output_file, NULL); 34EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL); 35EXTERN u64 INIT_GLOBAL(gbl_rsdp_base, 0); 36 37/* Action table used to defer requested options */ 38 39struct ap_dump_action { 40 char *argument; 41 u32 to_be_done; 42}; 43 44#define AP_MAX_ACTIONS 32 45 46#define AP_DUMP_ALL_TABLES 0 47#define AP_DUMP_TABLE_BY_ADDRESS 1 48#define AP_DUMP_TABLE_BY_NAME 2 49#define AP_DUMP_TABLE_BY_FILE 3 50 51#define AP_MAX_ACPI_FILES 256 /* Prevent infinite loops */ 52 53/* Minimum FADT sizes for various table addresses */ 54 55#define MIN_FADT_FOR_DSDT (ACPI_FADT_OFFSET (dsdt) + sizeof (u32)) 56#define MIN_FADT_FOR_FACS (ACPI_FADT_OFFSET (facs) + sizeof (u32)) 57#define MIN_FADT_FOR_XDSDT (ACPI_FADT_OFFSET (Xdsdt) + sizeof (u64)) 58#define MIN_FADT_FOR_XFACS (ACPI_FADT_OFFSET (Xfacs) + sizeof (u64)) 59 60/* 61 * apdump - Table get/dump routines 62 */ 63int ap_dump_table_from_file(char *pathname); 64 65int ap_dump_table_by_name(char *signature); 66 67int ap_dump_table_by_address(char *ascii_address); 68 69int ap_dump_all_tables(void); 70 71u8 ap_is_valid_header(struct acpi_table_header *table); 72 73u8 ap_is_valid_checksum(struct acpi_table_header *table); 74 75u32 ap_get_table_length(struct acpi_table_header *table); 76 77/* 78 * apfiles - File I/O utilities 79 */ 80int ap_open_output_file(char *pathname); 81 82int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance); 83 84struct acpi_table_header *ap_get_table_from_file(char *pathname, 85 u32 *file_size); 86