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: 47 $
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#ifdef ACPI_APPLICATION
133#include <stdio.h>
134FILE *AcpiGbl_DebugFile = NULL;
135#endif
136
137
138/*
139 * NOTE: this is here for lack of a better place. It is used in all
140 * flavors of the debugger, need LCD file
141 */
142
143/*******************************************************************************
144 *
145 * FUNCTION: AcpiDbMatchArgument
146 *
147 * PARAMETERS: UserArgument - User command line
148 * Arguments - Array of commands to match against
149 *
150 * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found

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

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

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

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

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

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

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

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