Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Module Name: tbfind   - find table
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, 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.


  69  ******************************************************************************/
  70 
  71 ACPI_STATUS
  72 AcpiTbFindTable (
  73     char                    *Signature,
  74     char                    *OemId,
  75     char                    *OemTableId,
  76     UINT32                  *TableIndex)
  77 {
  78     UINT32                  i;
  79     ACPI_STATUS             Status;
  80     ACPI_TABLE_HEADER       Header;
  81 
  82 
  83     ACPI_FUNCTION_TRACE (TbFindTable);
  84 
  85 
  86     /* Normalize the input strings */
  87 
  88     ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER));
  89     ACPI_STRNCPY (Header.Signature, Signature, ACPI_NAME_SIZE);
  90     ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
  91     ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);
  92 
  93     /* Search for the table */
  94 
  95     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
  96     {
  97         if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
  98                             Header.Signature, ACPI_NAME_SIZE))
  99         {
 100             /* Not the requested table */
 101 
 102             continue;
 103         }
 104 
 105         /* Table with matching signature has been found */
 106 
 107         if (!AcpiGbl_RootTableList.Tables[i].Pointer)
 108         {
 109             /* Table is not currently mapped, map it */


   1 /******************************************************************************
   2  *
   3  * Module Name: tbfind   - find table
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, 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.


  69  ******************************************************************************/
  70 
  71 ACPI_STATUS
  72 AcpiTbFindTable (
  73     char                    *Signature,
  74     char                    *OemId,
  75     char                    *OemTableId,
  76     UINT32                  *TableIndex)
  77 {
  78     UINT32                  i;
  79     ACPI_STATUS             Status;
  80     ACPI_TABLE_HEADER       Header;
  81 
  82 
  83     ACPI_FUNCTION_TRACE (TbFindTable);
  84 
  85 
  86     /* Normalize the input strings */
  87 
  88     ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER));
  89     ACPI_MOVE_NAME (Header.Signature, Signature);
  90     ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
  91     ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);
  92 
  93     /* Search for the table */
  94 
  95     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
  96     {
  97         if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
  98                             Header.Signature, ACPI_NAME_SIZE))
  99         {
 100             /* Not the requested table */
 101 
 102             continue;
 103         }
 104 
 105         /* Table with matching signature has been found */
 106 
 107         if (!AcpiGbl_RootTableList.Tables[i].Pointer)
 108         {
 109             /* Table is not currently mapped, map it */