Deleted Added
full compact
dbfileio.c (83174) dbfileio.c (84491)
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)
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 $
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
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 */
132#ifdef ACPI_APPLICATION
133#include <stdio.h>
134FILE *AcpiGbl_DebugFile = NULL;
135#endif
136
137
136#ifdef ACPI_APPLICATION
137#include <stdio.h>
138FILE *AcpiGbl_DebugFile = NULL;
139#endif
140
141
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 */
142ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr = NULL;
142
143
144
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;
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;
272 UINT8 *AmlPtr;
274 UINT8 *AmlStart;
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;
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;
312 *TablePtr = ACPI_MEM_ALLOCATE ((size_t) *TableLength);
314 *TablePtr = AcpiOsAllocate ((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
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
321 AmlPtr = (UINT8 *) *TablePtr + sizeof (TableHeader);
322 AmlLength = *TableLength - sizeof (TableHeader);
323 AmlStart = (UINT8 *) *TablePtr + sizeof (TableHeader);
324 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
325
326 /* Copy the header to the buffer */
327
328 MEMCPY (*TablePtr, &TableHeader, sizeof (TableHeader));
329
330 /* Get the rest of the table */
331
330 Actual = fread (AmlPtr, 1, (size_t) AmlLength, fp);
332 Actual = fread (AmlStart, 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);
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);
339 return (AE_OK);
341 return (AE_OK);
340 }
341
342
343 AcpiOsPrintf ("Error - could not read the table file\n");
342 }
343
344
345 AcpiOsPrintf ("Error - could not read the table file\n");
344 ACPI_MEM_FREE (*TablePtr);
346 AcpiOsFree (*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
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
406 AcpiTbUninstallTable (TableInfo.InstalledDesc);
408 AcpiTbDeleteAcpiTable (ACPI_TABLE_DSDT);
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;
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;
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);
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);
451 Status = AcpiDbLoadTable (fp, &TablePtr, &TableLength);
452 Status = AcpiDbLoadTable (fp, &AcpiGbl_DbTablePtr, &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
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
460
461 /* Attempt to recognize and install the table */
461 /* Attempt to recognize and install the table */
462 Status = AeLocalLoadTable (TablePtr);
463
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",
464 if (ACPI_FAILURE (Status))
465 {
466 if (Status == AE_EXIST)
467 {
468 AcpiOsPrintf ("Table %4.4s is already installed\n",
469 &TablePtr->Signature);
469 &AcpiGbl_DbTablePtr->Signature);
470 }
470 }
471
472 else
473 {
474 AcpiOsPrintf ("Could not install table, %s\n",
475 AcpiFormatException (Status));
476 }
477
471 else
472 {
473 AcpiOsPrintf ("Could not install table, %s\n",
474 AcpiFormatException (Status));
475 }
476
478 ACPI_MEM_FREE (TablePtr);
477 ACPI_MEM_FREE (AcpiGbl_DbTablePtr);
479 return (Status);
480 }
481
482 AcpiOsPrintf ("%4.4s at %p successfully installed and loaded\n",
478 return (Status);
479 }
480
481 AcpiOsPrintf ("%4.4s at %p successfully installed and loaded\n",
483 &TablePtr->Signature, TablePtr);
482 &AcpiGbl_DbTablePtr->Signature, AcpiGbl_DbTablePtr);
484
485 AcpiGbl_AcpiHardwarePresent = FALSE;
486
487#endif /* ACPI_APPLICATION */
488 return (AE_OK);
489}
490
491
492#endif /* ENABLE_DEBUGGER */
493
483
484 AcpiGbl_AcpiHardwarePresent = FALSE;
485
486#endif /* ACPI_APPLICATION */
487 return (AE_OK);
488}
489
490
491#endif /* ENABLE_DEBUGGER */
492