Deleted Added
full compact
tbutils.c (99146) tbutils.c (99679)
1/******************************************************************************
2 *
3 * Module Name: tbutils - Table manipulation utilities
1/******************************************************************************
2 *
3 * Module Name: tbutils - Table manipulation utilities
4 * $Revision: 51 $
4 * $Revision: 54 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

--- 100 unchanged lines hidden (view full) ---

113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __TBUTILS_C__
118
119#include "acpi.h"
120#include "actables.h"
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

--- 100 unchanged lines hidden (view full) ---

113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __TBUTILS_C__
118
119#include "acpi.h"
120#include "actables.h"
121#include "acinterp.h"
122
123
124#define _COMPONENT ACPI_TABLES
125 ACPI_MODULE_NAME ("tbutils")
126
127
128/*******************************************************************************
129 *

--- 52 unchanged lines hidden (view full) ---

182 * DESCRIPTION: Check an ACPI table header for validity
183 *
184 * NOTE: Table pointers are validated as follows:
185 * 1) Table pointer must point to valid physical memory
186 * 2) Signature must be 4 ASCII chars, even if we don't recognize the
187 * name
188 * 3) Table must be readable for length specified in the header
189 * 4) Table checksum must be valid (with the exception of the FACS
121
122
123#define _COMPONENT ACPI_TABLES
124 ACPI_MODULE_NAME ("tbutils")
125
126
127/*******************************************************************************
128 *

--- 52 unchanged lines hidden (view full) ---

181 * DESCRIPTION: Check an ACPI table header for validity
182 *
183 * NOTE: Table pointers are validated as follows:
184 * 1) Table pointer must point to valid physical memory
185 * 2) Signature must be 4 ASCII chars, even if we don't recognize the
186 * name
187 * 3) Table must be readable for length specified in the header
188 * 4) Table checksum must be valid (with the exception of the FACS
190 * which has no checksum for some odd reason)
189 * which has no checksum because it contains variable fields)
191 *
192 ******************************************************************************/
193
194ACPI_STATUS
195AcpiTbValidateTableHeader (
196 ACPI_TABLE_HEADER *TableHeader)
197{
198 ACPI_NAME Signature;

--- 8 unchanged lines hidden (view full) ---

207 {
208 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
209 "Cannot read table header at %p\n", TableHeader));
210 return (AE_BAD_ADDRESS);
211 }
212
213 /* Ensure that the signature is 4 ASCII characters */
214
190 *
191 ******************************************************************************/
192
193ACPI_STATUS
194AcpiTbValidateTableHeader (
195 ACPI_TABLE_HEADER *TableHeader)
196{
197 ACPI_NAME Signature;

--- 8 unchanged lines hidden (view full) ---

206 {
207 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
208 "Cannot read table header at %p\n", TableHeader));
209 return (AE_BAD_ADDRESS);
210 }
211
212 /* Ensure that the signature is 4 ASCII characters */
213
215 ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, &TableHeader->Signature);
214 ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, TableHeader->Signature);
216 if (!AcpiUtValidAcpiName (Signature))
217 {
218 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
219 "Table signature at %p [%p] has invalid characters\n",
220 TableHeader, &Signature));
221
222 ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", (char *) &Signature));
223 ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));

--- 31 unchanged lines hidden (view full) ---

255 *
256 * DESCRIPTION: Maps the physical address of table into a logical address
257 *
258 ******************************************************************************/
259
260ACPI_STATUS
261AcpiTbMapAcpiTable (
262 ACPI_PHYSICAL_ADDRESS PhysicalAddress,
215 if (!AcpiUtValidAcpiName (Signature))
216 {
217 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
218 "Table signature at %p [%p] has invalid characters\n",
219 TableHeader, &Signature));
220
221 ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", (char *) &Signature));
222 ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));

--- 31 unchanged lines hidden (view full) ---

254 *
255 * DESCRIPTION: Maps the physical address of table into a logical address
256 *
257 ******************************************************************************/
258
259ACPI_STATUS
260AcpiTbMapAcpiTable (
261 ACPI_PHYSICAL_ADDRESS PhysicalAddress,
263 UINT32 *Size,
262 ACPI_SIZE *Size,
264 ACPI_TABLE_HEADER **LogicalAddress)
265{
266 ACPI_TABLE_HEADER *Table;
263 ACPI_TABLE_HEADER **LogicalAddress)
264{
265 ACPI_TABLE_HEADER *Table;
267 UINT32 TableSize = *Size;
266 ACPI_SIZE TableSize = *Size;
268 ACPI_STATUS Status = AE_OK;
269
270
271 ACPI_FUNCTION_NAME ("TbMapAcpiTable");
272
273
274 /* If size is zero, look at the table header to get the actual size */
275

--- 5 unchanged lines hidden (view full) ---

281 (void **) &Table);
282 if (ACPI_FAILURE (Status))
283 {
284 return (Status);
285 }
286
287 /* Extract the full table length before we delete the mapping */
288
267 ACPI_STATUS Status = AE_OK;
268
269
270 ACPI_FUNCTION_NAME ("TbMapAcpiTable");
271
272
273 /* If size is zero, look at the table header to get the actual size */
274

--- 5 unchanged lines hidden (view full) ---

280 (void **) &Table);
281 if (ACPI_FAILURE (Status))
282 {
283 return (Status);
284 }
285
286 /* Extract the full table length before we delete the mapping */
287
289 TableSize = Table->Length;
288 TableSize = (ACPI_SIZE) Table->Length;
290
289
290#if 0
291/* We don't want to validate the header here. */
291 /*
292 * Validate the header and delete the mapping.
293 * We will create a mapping for the full table below.
294 */
295 Status = AcpiTbValidateTableHeader (Table);
292 /*
293 * Validate the header and delete the mapping.
294 * We will create a mapping for the full table below.
295 */
296 Status = AcpiTbValidateTableHeader (Table);
297#endif
296
297 /* Always unmap the memory for the header */
298
299 AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
300
298
299 /* Always unmap the memory for the header */
300
301 AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
302
303#if 0
301 /* Exit if header invalid */
302
303 if (ACPI_FAILURE (Status))
304 {
305 return (Status);
306 }
304 /* Exit if header invalid */
305
306 if (ACPI_FAILURE (Status))
307 {
308 return (Status);
309 }
310#endif
307 }
308
309 /* Map the physical memory for the correct length */
310
311 Status = AcpiOsMapMemory (PhysicalAddress, TableSize,
312 (void **) &Table);
313 if (ACPI_FAILURE (Status))
314 {

--- 38 unchanged lines hidden (view full) ---

353
354 Checksum = AcpiTbChecksum (TableHeader, TableHeader->Length);
355
356 /* Return the appropriate exception */
357
358 if (Checksum)
359 {
360 ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
311 }
312
313 /* Map the physical memory for the correct length */
314
315 Status = AcpiOsMapMemory (PhysicalAddress, TableSize,
316 (void **) &Table);
317 if (ACPI_FAILURE (Status))
318 {

--- 38 unchanged lines hidden (view full) ---

357
358 Checksum = AcpiTbChecksum (TableHeader, TableHeader->Length);
359
360 /* Return the appropriate exception */
361
362 if (Checksum)
363 {
364 ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
361 Checksum, (char *) &TableHeader->Signature));
365 Checksum, TableHeader->Signature));
362
363 Status = AE_BAD_CHECKSUM;
364 }
365 return_ACPI_STATUS (Status);
366}
367
368
369/*******************************************************************************

--- 37 unchanged lines hidden ---
366
367 Status = AE_BAD_CHECKSUM;
368 }
369 return_ACPI_STATUS (Status);
370}
371
372
373/*******************************************************************************

--- 37 unchanged lines hidden ---