ReactOS 0.4.15-dev-7897-g78dc504
tbprint.c
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Module Name: tbprint - Table output utilities
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include "acpi.h"
45#include "accommon.h"
46#include "actables.h"
47#include "acdisasm.h"
48#include "acutils.h"
49
50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbprint")
52
53
54/* Local prototypes */
55
56static void
58 char *String,
59 ACPI_SIZE Length);
60
61static void
63 ACPI_TABLE_HEADER *OutHeader,
65
66
67/*******************************************************************************
68 *
69 * FUNCTION: AcpiTbFixString
70 *
71 * PARAMETERS: String - String to be repaired
72 * Length - Maximum length
73 *
74 * RETURN: None
75 *
76 * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
77 * with a question mark '?'.
78 *
79 ******************************************************************************/
80
81static void
83 char *String,
84 ACPI_SIZE Length)
85{
86
87 while (Length && *String)
88 {
89 if (!isprint ((int) (UINT8) *String))
90 {
91 *String = '?';
92 }
93
94 String++;
95 Length--;
96 }
97}
98
99
100/*******************************************************************************
101 *
102 * FUNCTION: AcpiTbCleanupTableHeader
103 *
104 * PARAMETERS: OutHeader - Where the cleaned header is returned
105 * Header - Input ACPI table header
106 *
107 * RETURN: Returns the cleaned header in OutHeader
108 *
109 * DESCRIPTION: Copy the table header and ensure that all "string" fields in
110 * the header consist of printable characters.
111 *
112 ******************************************************************************/
113
114static void
116 ACPI_TABLE_HEADER *OutHeader,
118{
119
120 memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER));
121
126}
127
128
129/*******************************************************************************
130 *
131 * FUNCTION: AcpiTbPrintTableHeader
132 *
133 * PARAMETERS: Address - Table physical address
134 * Header - Table header
135 *
136 * RETURN: None
137 *
138 * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
139 *
140 ******************************************************************************/
141
142void
144 ACPI_PHYSICAL_ADDRESS Address,
146{
147 ACPI_TABLE_HEADER LocalHeader;
148
149
150 if (ACPI_COMPARE_NAMESEG (Header->Signature, ACPI_SIG_FACS))
151 {
152 /* FACS only has signature and length fields */
153
154 ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
155 Header->Signature, ACPI_FORMAT_UINT64 (Address),
156 Header->Length));
157 }
159 Header)->Signature))
160 {
161 /* RSDP has no common fields */
162
164 Header)->OemId, ACPI_OEM_ID_SIZE);
166
167 ACPI_INFO (("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
172 LocalHeader.OemId));
173 }
174 else
175 {
176 /* Standard ACPI table with full common header */
177
178 AcpiTbCleanupTableHeader (&LocalHeader, Header);
179
180 ACPI_INFO ((
181 "%-4.4s 0x%8.8X%8.8X"
182 " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
183 LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
184 LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
185 LocalHeader.OemTableId, LocalHeader.OemRevision,
186 LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
187 }
188}
189
unsigned char UINT8
#define isprint(c)
Definition: acclib.h:73
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_MODULE_NAME(Name)
Definition: acoutput.h:216
#define ACPI_INFO(plist)
Definition: acoutput.h:237
#define ACPI_SIG_FACS
Definition: actbl.h:69
#define ACPI_VALIDATE_RSDP_SIG(a)
Definition: actypes.h:573
#define ACPI_OEM_ID_SIZE
Definition: actypes.h:421
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_OEM_TABLE_ID_SIZE
Definition: actypes.h:422
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
Definition: Header.h:9
static const WCHAR Signature[]
Definition: parser.c:141
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_In_ ULONG Revision
Definition: rtlfuncs.h:1130
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
static WCHAR Address[46]
Definition: ping.c:68
UINT32 OemRevision
Definition: actbl.h:114
UINT8 Revision
Definition: actbl.h:110
char OemTableId[ACPI_OEM_TABLE_ID_SIZE]
Definition: actbl.h:113
char AslCompilerId[ACPI_NAMESEG_SIZE]
Definition: actbl.h:115
char OemId[ACPI_OEM_ID_SIZE]
Definition: actbl.h:112
UINT32 AslCompilerRevision
Definition: actbl.h:116
char Signature[ACPI_NAMESEG_SIZE]
Definition: actbl.h:108
UINT32 Length
Definition: actbl.h:109
void AcpiTbPrintTableHeader(ACPI_PHYSICAL_ADDRESS Address, ACPI_TABLE_HEADER *Header)
Definition: tbprint.c:143
static void AcpiTbCleanupTableHeader(ACPI_TABLE_HEADER *OutHeader, ACPI_TABLE_HEADER *Header)
Definition: tbprint.c:115
static void AcpiTbFixString(char *String, ACPI_SIZE Length)
Definition: tbprint.c:82
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433