Deleted Added
sdiff udiff text old ( 83174 ) new ( 84491 )
full compact
1/*******************************************************************************
2 *
3 * Module Name: dbfileio - Debugger file I/O commands. These can't usually
4 * be used when running the debugger in Ring 0 (Kernel mode)
5 * $Revision: 52 $
6 *
7 ******************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

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

124#include "actables.h"
125
126#ifdef ENABLE_DEBUGGER
127
128#define _COMPONENT ACPI_DEBUGGER
129 MODULE_NAME ("dbfileio")
130
131
132/*
133 * NOTE: this is here for lack of a better place. It is used in all
134 * flavors of the debugger, need LCD file
135 */
136#ifdef ACPI_APPLICATION
137#include <stdio.h>
138FILE *AcpiGbl_DebugFile = NULL;
139#endif
140
141
142ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr = NULL;
143
144
145/*******************************************************************************
146 *
147 * FUNCTION: AcpiDbMatchArgument
148 *
149 * PARAMETERS: UserArgument - User command line
150 * Arguments - Array of commands to match against
151 *
152 * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found

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

266
267ACPI_STATUS
268AcpiDbLoadTable(
269 FILE *fp,
270 ACPI_TABLE_HEADER **TablePtr,
271 UINT32 *TableLength)
272{
273 ACPI_TABLE_HEADER TableHeader;
274 UINT8 *AmlStart;
275 UINT32 AmlLength;
276 UINT32 Actual;
277 ACPI_STATUS Status;
278
279
280 /* Read the table header */
281
282 if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != sizeof (ACPI_TABLE_HEADER))

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

306 AcpiOsPrintf ("Table signature is invalid\n");
307 DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
308 return (AE_ERROR);
309 }
310
311 /* Allocate a buffer for the table */
312
313 *TableLength = TableHeader.Length;
314 *TablePtr = AcpiOsAllocate ((size_t) *TableLength);
315 if (!*TablePtr)
316 {
317 AcpiOsPrintf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
318 TableHeader.Signature, TableHeader.Length);
319 return (AE_NO_MEMORY);
320 }
321
322
323 AmlStart = (UINT8 *) *TablePtr + sizeof (TableHeader);
324 AmlLength = *TableLength - sizeof (TableHeader);
325
326 /* Copy the header to the buffer */
327
328 MEMCPY (*TablePtr, &TableHeader, sizeof (TableHeader));
329
330 /* Get the rest of the table */
331
332 Actual = fread (AmlStart, 1, (size_t) AmlLength, fp);
333 if (Actual == AmlLength)
334 {
335 return (AE_OK);
336 }
337
338 if (Actual > 0)
339 {
340 AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", AmlLength, Actual);
341 return (AE_OK);
342 }
343
344
345 AcpiOsPrintf ("Error - could not read the table file\n");
346 AcpiOsFree (*TablePtr);
347 *TablePtr = NULL;
348 *TableLength = 0;
349
350 return (AE_ERROR);
351}
352#endif
353
354

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

400
401
402#ifndef PARSER_ONLY
403 Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
404 if (ACPI_FAILURE (Status))
405 {
406 /* Uninstall table and free the buffer */
407
408 AcpiTbDeleteAcpiTable (ACPI_TABLE_DSDT);
409 return_ACPI_STATUS (Status);
410 }
411#endif
412
413 return_ACPI_STATUS (Status);
414}
415
416

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

428
429ACPI_STATUS
430AcpiDbLoadAcpiTable (
431 NATIVE_CHAR *Filename)
432{
433#ifdef ACPI_APPLICATION
434 FILE *fp;
435 ACPI_STATUS Status;
436 UINT32 TableLength;
437
438
439 /* Open the file */
440
441 fp = fopen (Filename, "rb");
442 if (!fp)
443 {
444 AcpiOsPrintf ("Could not open file %s\n", Filename);
445 return (AE_ERROR);
446 }
447
448
449 /* Get the entire file */
450
451 AcpiOsPrintf ("Loading Acpi table from file %s\n", Filename);
452 Status = AcpiDbLoadTable (fp, &AcpiGbl_DbTablePtr, &TableLength);
453 fclose(fp);
454
455 if (ACPI_FAILURE (Status))
456 {
457 AcpiOsPrintf ("Couldn't get table from the file\n");
458 return (Status);
459 }
460
461 /* Attempt to recognize and install the table */
462
463 Status = AeLocalLoadTable (AcpiGbl_DbTablePtr);
464 if (ACPI_FAILURE (Status))
465 {
466 if (Status == AE_EXIST)
467 {
468 AcpiOsPrintf ("Table %4.4s is already installed\n",
469 &AcpiGbl_DbTablePtr->Signature);
470 }
471 else
472 {
473 AcpiOsPrintf ("Could not install table, %s\n",
474 AcpiFormatException (Status));
475 }
476
477 ACPI_MEM_FREE (AcpiGbl_DbTablePtr);
478 return (Status);
479 }
480
481 AcpiOsPrintf ("%4.4s at %p successfully installed and loaded\n",
482 &AcpiGbl_DbTablePtr->Signature, AcpiGbl_DbTablePtr);
483
484 AcpiGbl_AcpiHardwarePresent = FALSE;
485
486#endif /* ACPI_APPLICATION */
487 return (AE_OK);
488}
489
490
491#endif /* ENABLE_DEBUGGER */
492