Home | History | Annotate | Line # | Download | only in tables
tbfadt.c revision 1.1.1.4
      1      1.1    jruoho /******************************************************************************
      2      1.1    jruoho  *
      3      1.1    jruoho  * Module Name: tbfadt   - FADT table utilities
      4      1.1    jruoho  *
      5      1.1    jruoho  *****************************************************************************/
      6      1.1    jruoho 
      7  1.1.1.2    jruoho /*
      8  1.1.1.4  christos  * Copyright (C) 2000 - 2014, Intel Corp.
      9      1.1    jruoho  * All rights reserved.
     10      1.1    jruoho  *
     11  1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12  1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13  1.1.1.2    jruoho  * are met:
     14  1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15  1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16  1.1.1.2    jruoho  *    without modification.
     17  1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21  1.1.1.2    jruoho  *    binary redistribution.
     22  1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24  1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25  1.1.1.2    jruoho  *
     26  1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27  1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1.1.2    jruoho  * Software Foundation.
     29  1.1.1.2    jruoho  *
     30  1.1.1.2    jruoho  * NO WARRANTY
     31  1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1.1.2    jruoho  */
     43      1.1    jruoho 
     44      1.1    jruoho #define __TBFADT_C__
     45      1.1    jruoho 
     46      1.1    jruoho #include "acpi.h"
     47      1.1    jruoho #include "accommon.h"
     48      1.1    jruoho #include "actables.h"
     49      1.1    jruoho 
     50      1.1    jruoho #define _COMPONENT          ACPI_TABLES
     51      1.1    jruoho         ACPI_MODULE_NAME    ("tbfadt")
     52      1.1    jruoho 
     53      1.1    jruoho /* Local prototypes */
     54      1.1    jruoho 
     55  1.1.1.3  christos static void
     56      1.1    jruoho AcpiTbInitGenericAddress (
     57      1.1    jruoho     ACPI_GENERIC_ADDRESS    *GenericAddress,
     58      1.1    jruoho     UINT8                   SpaceId,
     59      1.1    jruoho     UINT8                   ByteWidth,
     60  1.1.1.3  christos     UINT64                  Address,
     61  1.1.1.4  christos     char                    *RegisterName,
     62  1.1.1.4  christos     UINT8                   Flags);
     63      1.1    jruoho 
     64      1.1    jruoho static void
     65      1.1    jruoho AcpiTbConvertFadt (
     66      1.1    jruoho     void);
     67      1.1    jruoho 
     68      1.1    jruoho static void
     69      1.1    jruoho AcpiTbSetupFadtRegisters (
     70      1.1    jruoho     void);
     71      1.1    jruoho 
     72  1.1.1.3  christos static UINT64
     73  1.1.1.3  christos AcpiTbSelectAddress (
     74  1.1.1.3  christos     char                    *RegisterName,
     75  1.1.1.3  christos     UINT32                  Address32,
     76  1.1.1.3  christos     UINT64                  Address64);
     77  1.1.1.3  christos 
     78      1.1    jruoho 
     79      1.1    jruoho /* Table for conversion of FADT to common internal format and FADT validation */
     80      1.1    jruoho 
     81      1.1    jruoho typedef struct acpi_fadt_info
     82      1.1    jruoho {
     83      1.1    jruoho     char                    *Name;
     84  1.1.1.3  christos     UINT16                  Address64;
     85  1.1.1.3  christos     UINT16                  Address32;
     86  1.1.1.3  christos     UINT16                  Length;
     87      1.1    jruoho     UINT8                   DefaultLength;
     88  1.1.1.4  christos     UINT8                   Flags;
     89      1.1    jruoho 
     90      1.1    jruoho } ACPI_FADT_INFO;
     91      1.1    jruoho 
     92  1.1.1.3  christos #define ACPI_FADT_OPTIONAL          0
     93      1.1    jruoho #define ACPI_FADT_REQUIRED          1
     94      1.1    jruoho #define ACPI_FADT_SEPARATE_LENGTH   2
     95  1.1.1.4  christos #define ACPI_FADT_GPE_REGISTER      4
     96      1.1    jruoho 
     97      1.1    jruoho static ACPI_FADT_INFO     FadtInfoTable[] =
     98      1.1    jruoho {
     99      1.1    jruoho     {"Pm1aEventBlock",
    100      1.1    jruoho         ACPI_FADT_OFFSET (XPm1aEventBlock),
    101      1.1    jruoho         ACPI_FADT_OFFSET (Pm1aEventBlock),
    102      1.1    jruoho         ACPI_FADT_OFFSET (Pm1EventLength),
    103      1.1    jruoho         ACPI_PM1_REGISTER_WIDTH * 2,        /* Enable + Status register */
    104      1.1    jruoho         ACPI_FADT_REQUIRED},
    105      1.1    jruoho 
    106      1.1    jruoho     {"Pm1bEventBlock",
    107      1.1    jruoho         ACPI_FADT_OFFSET (XPm1bEventBlock),
    108      1.1    jruoho         ACPI_FADT_OFFSET (Pm1bEventBlock),
    109      1.1    jruoho         ACPI_FADT_OFFSET (Pm1EventLength),
    110      1.1    jruoho         ACPI_PM1_REGISTER_WIDTH * 2,        /* Enable + Status register */
    111  1.1.1.3  christos         ACPI_FADT_OPTIONAL},
    112      1.1    jruoho 
    113      1.1    jruoho     {"Pm1aControlBlock",
    114      1.1    jruoho         ACPI_FADT_OFFSET (XPm1aControlBlock),
    115      1.1    jruoho         ACPI_FADT_OFFSET (Pm1aControlBlock),
    116      1.1    jruoho         ACPI_FADT_OFFSET (Pm1ControlLength),
    117      1.1    jruoho         ACPI_PM1_REGISTER_WIDTH,
    118      1.1    jruoho         ACPI_FADT_REQUIRED},
    119      1.1    jruoho 
    120      1.1    jruoho     {"Pm1bControlBlock",
    121      1.1    jruoho         ACPI_FADT_OFFSET (XPm1bControlBlock),
    122      1.1    jruoho         ACPI_FADT_OFFSET (Pm1bControlBlock),
    123      1.1    jruoho         ACPI_FADT_OFFSET (Pm1ControlLength),
    124      1.1    jruoho         ACPI_PM1_REGISTER_WIDTH,
    125  1.1.1.3  christos         ACPI_FADT_OPTIONAL},
    126      1.1    jruoho 
    127      1.1    jruoho     {"Pm2ControlBlock",
    128      1.1    jruoho         ACPI_FADT_OFFSET (XPm2ControlBlock),
    129      1.1    jruoho         ACPI_FADT_OFFSET (Pm2ControlBlock),
    130      1.1    jruoho         ACPI_FADT_OFFSET (Pm2ControlLength),
    131      1.1    jruoho         ACPI_PM2_REGISTER_WIDTH,
    132      1.1    jruoho         ACPI_FADT_SEPARATE_LENGTH},
    133      1.1    jruoho 
    134      1.1    jruoho     {"PmTimerBlock",
    135      1.1    jruoho         ACPI_FADT_OFFSET (XPmTimerBlock),
    136      1.1    jruoho         ACPI_FADT_OFFSET (PmTimerBlock),
    137      1.1    jruoho         ACPI_FADT_OFFSET (PmTimerLength),
    138      1.1    jruoho         ACPI_PM_TIMER_WIDTH,
    139  1.1.1.3  christos         ACPI_FADT_SEPARATE_LENGTH},         /* ACPI 5.0A: Timer is optional */
    140      1.1    jruoho 
    141      1.1    jruoho     {"Gpe0Block",
    142      1.1    jruoho         ACPI_FADT_OFFSET (XGpe0Block),
    143      1.1    jruoho         ACPI_FADT_OFFSET (Gpe0Block),
    144      1.1    jruoho         ACPI_FADT_OFFSET (Gpe0BlockLength),
    145      1.1    jruoho         0,
    146  1.1.1.4  christos         ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER},
    147      1.1    jruoho 
    148      1.1    jruoho     {"Gpe1Block",
    149      1.1    jruoho         ACPI_FADT_OFFSET (XGpe1Block),
    150      1.1    jruoho         ACPI_FADT_OFFSET (Gpe1Block),
    151      1.1    jruoho         ACPI_FADT_OFFSET (Gpe1BlockLength),
    152      1.1    jruoho         0,
    153  1.1.1.4  christos         ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}
    154      1.1    jruoho };
    155      1.1    jruoho 
    156      1.1    jruoho #define ACPI_FADT_INFO_ENTRIES \
    157      1.1    jruoho             (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
    158      1.1    jruoho 
    159      1.1    jruoho 
    160      1.1    jruoho /* Table used to split Event Blocks into separate status/enable registers */
    161      1.1    jruoho 
    162      1.1    jruoho typedef struct acpi_fadt_pm_info
    163      1.1    jruoho {
    164      1.1    jruoho     ACPI_GENERIC_ADDRESS    *Target;
    165  1.1.1.3  christos     UINT16                  Source;
    166      1.1    jruoho     UINT8                   RegisterNum;
    167      1.1    jruoho 
    168      1.1    jruoho } ACPI_FADT_PM_INFO;
    169      1.1    jruoho 
    170      1.1    jruoho static ACPI_FADT_PM_INFO    FadtPmInfoTable[] =
    171      1.1    jruoho {
    172      1.1    jruoho     {&AcpiGbl_XPm1aStatus,
    173      1.1    jruoho         ACPI_FADT_OFFSET (XPm1aEventBlock),
    174      1.1    jruoho         0},
    175      1.1    jruoho 
    176      1.1    jruoho     {&AcpiGbl_XPm1aEnable,
    177      1.1    jruoho         ACPI_FADT_OFFSET (XPm1aEventBlock),
    178      1.1    jruoho         1},
    179      1.1    jruoho 
    180      1.1    jruoho     {&AcpiGbl_XPm1bStatus,
    181      1.1    jruoho         ACPI_FADT_OFFSET (XPm1bEventBlock),
    182      1.1    jruoho         0},
    183      1.1    jruoho 
    184      1.1    jruoho     {&AcpiGbl_XPm1bEnable,
    185      1.1    jruoho         ACPI_FADT_OFFSET (XPm1bEventBlock),
    186      1.1    jruoho         1}
    187      1.1    jruoho };
    188      1.1    jruoho 
    189      1.1    jruoho #define ACPI_FADT_PM_INFO_ENTRIES \
    190      1.1    jruoho             (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO))
    191      1.1    jruoho 
    192      1.1    jruoho 
    193      1.1    jruoho /*******************************************************************************
    194      1.1    jruoho  *
    195      1.1    jruoho  * FUNCTION:    AcpiTbInitGenericAddress
    196      1.1    jruoho  *
    197      1.1    jruoho  * PARAMETERS:  GenericAddress      - GAS struct to be initialized
    198      1.1    jruoho  *              SpaceId             - ACPI Space ID for this register
    199  1.1.1.3  christos  *              ByteWidth           - Width of this register
    200      1.1    jruoho  *              Address             - Address of the register
    201  1.1.1.3  christos  *              RegisterName        - ASCII name of the ACPI register
    202      1.1    jruoho  *
    203      1.1    jruoho  * RETURN:      None
    204      1.1    jruoho  *
    205      1.1    jruoho  * DESCRIPTION: Initialize a Generic Address Structure (GAS)
    206      1.1    jruoho  *              See the ACPI specification for a full description and
    207      1.1    jruoho  *              definition of this structure.
    208      1.1    jruoho  *
    209      1.1    jruoho  ******************************************************************************/
    210      1.1    jruoho 
    211  1.1.1.3  christos static void
    212      1.1    jruoho AcpiTbInitGenericAddress (
    213      1.1    jruoho     ACPI_GENERIC_ADDRESS    *GenericAddress,
    214      1.1    jruoho     UINT8                   SpaceId,
    215      1.1    jruoho     UINT8                   ByteWidth,
    216  1.1.1.3  christos     UINT64                  Address,
    217  1.1.1.4  christos     char                    *RegisterName,
    218  1.1.1.4  christos     UINT8                   Flags)
    219      1.1    jruoho {
    220  1.1.1.3  christos     UINT8                   BitWidth;
    221  1.1.1.3  christos 
    222  1.1.1.3  christos 
    223  1.1.1.4  christos     /*
    224  1.1.1.4  christos      * Bit width field in the GAS is only one byte long, 255 max.
    225  1.1.1.4  christos      * Check for BitWidth overflow in GAS.
    226  1.1.1.4  christos      */
    227  1.1.1.3  christos     BitWidth = (UINT8) (ByteWidth * 8);
    228  1.1.1.4  christos     if (ByteWidth > 31)     /* (31*8)=248, (32*8)=256 */
    229  1.1.1.3  christos     {
    230  1.1.1.4  christos         /*
    231  1.1.1.4  christos          * No error for GPE blocks, because we do not use the BitWidth
    232  1.1.1.4  christos          * for GPEs, the legacy length (ByteWidth) is used instead to
    233  1.1.1.4  christos          * allow for a large number of GPEs.
    234  1.1.1.4  christos          */
    235  1.1.1.4  christos         if (!(Flags & ACPI_FADT_GPE_REGISTER))
    236  1.1.1.4  christos         {
    237  1.1.1.4  christos             ACPI_ERROR ((AE_INFO,
    238  1.1.1.4  christos                 "%s - 32-bit FADT register is too long (%u bytes, %u bits) "
    239  1.1.1.4  christos                 "to convert to GAS struct - 255 bits max, truncating",
    240  1.1.1.4  christos                 RegisterName, ByteWidth, (ByteWidth * 8)));
    241  1.1.1.4  christos         }
    242  1.1.1.3  christos 
    243  1.1.1.3  christos         BitWidth = 255;
    244  1.1.1.3  christos     }
    245      1.1    jruoho 
    246      1.1    jruoho     /*
    247      1.1    jruoho      * The 64-bit Address field is non-aligned in the byte packed
    248      1.1    jruoho      * GAS struct.
    249      1.1    jruoho      */
    250      1.1    jruoho     ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
    251      1.1    jruoho 
    252      1.1    jruoho     /* All other fields are byte-wide */
    253      1.1    jruoho 
    254      1.1    jruoho     GenericAddress->SpaceId = SpaceId;
    255  1.1.1.3  christos     GenericAddress->BitWidth = BitWidth;
    256      1.1    jruoho     GenericAddress->BitOffset = 0;
    257      1.1    jruoho     GenericAddress->AccessWidth = 0; /* Access width ANY */
    258      1.1    jruoho }
    259      1.1    jruoho 
    260      1.1    jruoho 
    261      1.1    jruoho /*******************************************************************************
    262      1.1    jruoho  *
    263  1.1.1.3  christos  * FUNCTION:    AcpiTbSelectAddress
    264  1.1.1.3  christos  *
    265  1.1.1.3  christos  * PARAMETERS:  RegisterName        - ASCII name of the ACPI register
    266  1.1.1.3  christos  *              Address32           - 32-bit address of the register
    267  1.1.1.3  christos  *              Address64           - 64-bit address of the register
    268  1.1.1.3  christos  *
    269  1.1.1.3  christos  * RETURN:      The resolved 64-bit address
    270  1.1.1.3  christos  *
    271  1.1.1.3  christos  * DESCRIPTION: Select between 32-bit and 64-bit versions of addresses within
    272  1.1.1.3  christos  *              the FADT. Used for the FACS and DSDT addresses.
    273  1.1.1.3  christos  *
    274  1.1.1.3  christos  * NOTES:
    275  1.1.1.3  christos  *
    276  1.1.1.3  christos  * Check for FACS and DSDT address mismatches. An address mismatch between
    277  1.1.1.3  christos  * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and
    278  1.1.1.3  christos  * DSDT/X_DSDT) could be a corrupted address field or it might indicate
    279  1.1.1.3  christos  * the presence of two FACS or two DSDT tables.
    280  1.1.1.3  christos  *
    281  1.1.1.3  christos  * November 2013:
    282  1.1.1.3  christos  * By default, as per the ACPICA specification, a valid 64-bit address is
    283  1.1.1.3  christos  * used regardless of the value of the 32-bit address. However, this
    284  1.1.1.3  christos  * behavior can be overridden via the AcpiGbl_Use32BitFadtAddresses flag.
    285  1.1.1.3  christos  *
    286  1.1.1.3  christos  ******************************************************************************/
    287  1.1.1.3  christos 
    288  1.1.1.3  christos static UINT64
    289  1.1.1.3  christos AcpiTbSelectAddress (
    290  1.1.1.3  christos     char                    *RegisterName,
    291  1.1.1.3  christos     UINT32                  Address32,
    292  1.1.1.3  christos     UINT64                  Address64)
    293  1.1.1.3  christos {
    294  1.1.1.3  christos 
    295  1.1.1.3  christos     if (!Address64)
    296  1.1.1.3  christos     {
    297  1.1.1.3  christos         /* 64-bit address is zero, use 32-bit address */
    298  1.1.1.3  christos 
    299  1.1.1.3  christos         return ((UINT64) Address32);
    300  1.1.1.3  christos     }
    301  1.1.1.3  christos 
    302  1.1.1.3  christos     if (Address32 &&
    303  1.1.1.3  christos        (Address64 != (UINT64) Address32))
    304  1.1.1.3  christos     {
    305  1.1.1.3  christos         /* Address mismatch between 32-bit and 64-bit versions */
    306  1.1.1.3  christos 
    307  1.1.1.3  christos         ACPI_BIOS_WARNING ((AE_INFO,
    308  1.1.1.3  christos             "32/64X %s address mismatch in FADT: "
    309  1.1.1.3  christos             "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
    310  1.1.1.3  christos             RegisterName, Address32, ACPI_FORMAT_UINT64 (Address64),
    311  1.1.1.3  christos             AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
    312  1.1.1.3  christos 
    313  1.1.1.3  christos         /* 32-bit address override */
    314  1.1.1.3  christos 
    315  1.1.1.3  christos         if (AcpiGbl_Use32BitFadtAddresses)
    316  1.1.1.3  christos         {
    317  1.1.1.3  christos             return ((UINT64) Address32);
    318  1.1.1.3  christos         }
    319  1.1.1.3  christos     }
    320  1.1.1.3  christos 
    321  1.1.1.3  christos     /* Default is to use the 64-bit address */
    322  1.1.1.3  christos 
    323  1.1.1.3  christos     return (Address64);
    324  1.1.1.3  christos }
    325  1.1.1.3  christos 
    326  1.1.1.3  christos 
    327  1.1.1.3  christos /*******************************************************************************
    328  1.1.1.3  christos  *
    329      1.1    jruoho  * FUNCTION:    AcpiTbParseFadt
    330      1.1    jruoho  *
    331      1.1    jruoho  * PARAMETERS:  TableIndex          - Index for the FADT
    332      1.1    jruoho  *
    333      1.1    jruoho  * RETURN:      None
    334      1.1    jruoho  *
    335      1.1    jruoho  * DESCRIPTION: Initialize the FADT, DSDT and FACS tables
    336      1.1    jruoho  *              (FADT contains the addresses of the DSDT and FACS)
    337      1.1    jruoho  *
    338      1.1    jruoho  ******************************************************************************/
    339      1.1    jruoho 
    340      1.1    jruoho void
    341      1.1    jruoho AcpiTbParseFadt (
    342      1.1    jruoho     UINT32                  TableIndex)
    343      1.1    jruoho {
    344      1.1    jruoho     UINT32                  Length;
    345      1.1    jruoho     ACPI_TABLE_HEADER       *Table;
    346      1.1    jruoho 
    347      1.1    jruoho 
    348      1.1    jruoho     /*
    349      1.1    jruoho      * The FADT has multiple versions with different lengths,
    350      1.1    jruoho      * and it contains pointers to both the DSDT and FACS tables.
    351      1.1    jruoho      *
    352      1.1    jruoho      * Get a local copy of the FADT and convert it to a common format
    353      1.1    jruoho      * Map entire FADT, assumed to be smaller than one page.
    354      1.1    jruoho      */
    355      1.1    jruoho     Length = AcpiGbl_RootTableList.Tables[TableIndex].Length;
    356      1.1    jruoho 
    357      1.1    jruoho     Table = AcpiOsMapMemory (
    358      1.1    jruoho                 AcpiGbl_RootTableList.Tables[TableIndex].Address, Length);
    359      1.1    jruoho     if (!Table)
    360      1.1    jruoho     {
    361      1.1    jruoho         return;
    362      1.1    jruoho     }
    363      1.1    jruoho 
    364      1.1    jruoho     /*
    365      1.1    jruoho      * Validate the FADT checksum before we copy the table. Ignore
    366      1.1    jruoho      * checksum error as we want to try to get the DSDT and FACS.
    367      1.1    jruoho      */
    368      1.1    jruoho     (void) AcpiTbVerifyChecksum (Table, Length);
    369      1.1    jruoho 
    370      1.1    jruoho     /* Create a local copy of the FADT in common ACPI 2.0+ format */
    371      1.1    jruoho 
    372      1.1    jruoho     AcpiTbCreateLocalFadt (Table, Length);
    373      1.1    jruoho 
    374      1.1    jruoho     /* All done with the real FADT, unmap it */
    375      1.1    jruoho 
    376      1.1    jruoho     AcpiOsUnmapMemory (Table, Length);
    377      1.1    jruoho 
    378      1.1    jruoho     /* Obtain the DSDT and FACS tables via their addresses within the FADT */
    379      1.1    jruoho 
    380  1.1.1.4  christos     AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
    381      1.1    jruoho         ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
    382      1.1    jruoho 
    383  1.1.1.3  christos     /* If Hardware Reduced flag is set, there is no FACS */
    384  1.1.1.3  christos 
    385  1.1.1.3  christos     if (!AcpiGbl_ReducedHardware)
    386  1.1.1.3  christos     {
    387  1.1.1.4  christos         AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
    388  1.1.1.3  christos             ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
    389  1.1.1.3  christos     }
    390      1.1    jruoho }
    391      1.1    jruoho 
    392      1.1    jruoho 
    393      1.1    jruoho /*******************************************************************************
    394      1.1    jruoho  *
    395      1.1    jruoho  * FUNCTION:    AcpiTbCreateLocalFadt
    396      1.1    jruoho  *
    397      1.1    jruoho  * PARAMETERS:  Table               - Pointer to BIOS FADT
    398      1.1    jruoho  *              Length              - Length of the table
    399      1.1    jruoho  *
    400      1.1    jruoho  * RETURN:      None
    401      1.1    jruoho  *
    402      1.1    jruoho  * DESCRIPTION: Get a local copy of the FADT and convert it to a common format.
    403      1.1    jruoho  *              Performs validation on some important FADT fields.
    404      1.1    jruoho  *
    405      1.1    jruoho  * NOTE:        We create a local copy of the FADT regardless of the version.
    406      1.1    jruoho  *
    407      1.1    jruoho  ******************************************************************************/
    408      1.1    jruoho 
    409      1.1    jruoho void
    410      1.1    jruoho AcpiTbCreateLocalFadt (
    411      1.1    jruoho     ACPI_TABLE_HEADER       *Table,
    412      1.1    jruoho     UINT32                  Length)
    413      1.1    jruoho {
    414      1.1    jruoho 
    415      1.1    jruoho     /*
    416      1.1    jruoho      * Check if the FADT is larger than the largest table that we expect
    417  1.1.1.3  christos      * (the ACPI 5.0 version). If so, truncate the table, and issue
    418      1.1    jruoho      * a warning.
    419      1.1    jruoho      */
    420      1.1    jruoho     if (Length > sizeof (ACPI_TABLE_FADT))
    421      1.1    jruoho     {
    422  1.1.1.3  christos         ACPI_BIOS_WARNING ((AE_INFO,
    423  1.1.1.3  christos             "FADT (revision %u) is longer than ACPI 5.0 version, "
    424      1.1    jruoho             "truncating length %u to %u",
    425      1.1    jruoho             Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT)));
    426      1.1    jruoho     }
    427      1.1    jruoho 
    428      1.1    jruoho     /* Clear the entire local FADT */
    429      1.1    jruoho 
    430      1.1    jruoho     ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT));
    431      1.1    jruoho 
    432      1.1    jruoho     /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
    433      1.1    jruoho 
    434      1.1    jruoho     ACPI_MEMCPY (&AcpiGbl_FADT, Table,
    435      1.1    jruoho         ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
    436      1.1    jruoho 
    437  1.1.1.3  christos     /* Take a copy of the Hardware Reduced flag */
    438      1.1    jruoho 
    439  1.1.1.3  christos     AcpiGbl_ReducedHardware = FALSE;
    440  1.1.1.3  christos     if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED)
    441  1.1.1.3  christos     {
    442  1.1.1.3  christos         AcpiGbl_ReducedHardware = TRUE;
    443  1.1.1.3  christos     }
    444      1.1    jruoho 
    445  1.1.1.3  christos     /* Convert the local copy of the FADT to the common internal format */
    446      1.1    jruoho 
    447  1.1.1.3  christos     AcpiTbConvertFadt ();
    448      1.1    jruoho 
    449      1.1    jruoho     /* Initialize the global ACPI register structures */
    450      1.1    jruoho 
    451      1.1    jruoho     AcpiTbSetupFadtRegisters ();
    452      1.1    jruoho }
    453      1.1    jruoho 
    454      1.1    jruoho 
    455      1.1    jruoho /*******************************************************************************
    456      1.1    jruoho  *
    457      1.1    jruoho  * FUNCTION:    AcpiTbConvertFadt
    458      1.1    jruoho  *
    459  1.1.1.3  christos  * PARAMETERS:  None - AcpiGbl_FADT is used.
    460      1.1    jruoho  *
    461      1.1    jruoho  * RETURN:      None
    462      1.1    jruoho  *
    463      1.1    jruoho  * DESCRIPTION: Converts all versions of the FADT to a common internal format.
    464  1.1.1.3  christos  *              Expand 32-bit addresses to 64-bit as necessary. Also validate
    465  1.1.1.3  christos  *              important fields within the FADT.
    466      1.1    jruoho  *
    467  1.1.1.3  christos  * NOTE:        AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), and must
    468  1.1.1.3  christos  *              contain a copy of the actual BIOS-provided FADT.
    469      1.1    jruoho  *
    470      1.1    jruoho  * Notes on 64-bit register addresses:
    471      1.1    jruoho  *
    472      1.1    jruoho  * After this FADT conversion, later ACPICA code will only use the 64-bit "X"
    473      1.1    jruoho  * fields of the FADT for all ACPI register addresses.
    474      1.1    jruoho  *
    475  1.1.1.3  christos  * The 64-bit X fields are optional extensions to the original 32-bit FADT
    476      1.1    jruoho  * V1.0 fields. Even if they are present in the FADT, they are optional and
    477      1.1    jruoho  * are unused if the BIOS sets them to zero. Therefore, we must copy/expand
    478  1.1.1.3  christos  * 32-bit V1.0 fields to the 64-bit X fields if the the 64-bit X field is
    479  1.1.1.3  christos  * originally zero.
    480      1.1    jruoho  *
    481  1.1.1.3  christos  * For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address
    482  1.1.1.3  christos  * fields are expanded to the corresponding 64-bit X fields in the internal
    483  1.1.1.3  christos  * common FADT.
    484      1.1    jruoho  *
    485      1.1    jruoho  * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded
    486  1.1.1.3  christos  * to the corresponding 64-bit X fields, if the 64-bit field is originally
    487  1.1.1.3  christos  * zero. Adhering to the ACPI specification, we completely ignore the 32-bit
    488  1.1.1.3  christos  * field if the 64-bit field is valid, regardless of whether the host OS is
    489  1.1.1.3  christos  * 32-bit or 64-bit.
    490  1.1.1.3  christos  *
    491  1.1.1.3  christos  * Possible additional checks:
    492  1.1.1.3  christos  *  (AcpiGbl_FADT.Pm1EventLength >= 4)
    493  1.1.1.3  christos  *  (AcpiGbl_FADT.Pm1ControlLength >= 2)
    494  1.1.1.3  christos  *  (AcpiGbl_FADT.PmTimerLength >= 4)
    495  1.1.1.3  christos  *  Gpe block lengths must be multiple of 2
    496      1.1    jruoho  *
    497      1.1    jruoho  ******************************************************************************/
    498      1.1    jruoho 
    499      1.1    jruoho static void
    500      1.1    jruoho AcpiTbConvertFadt (
    501      1.1    jruoho     void)
    502      1.1    jruoho {
    503  1.1.1.3  christos     char                    *Name;
    504      1.1    jruoho     ACPI_GENERIC_ADDRESS    *Address64;
    505      1.1    jruoho     UINT32                  Address32;
    506  1.1.1.3  christos     UINT8                   Length;
    507  1.1.1.4  christos     UINT8                   Flags;
    508      1.1    jruoho     UINT32                  i;
    509      1.1    jruoho 
    510      1.1    jruoho 
    511      1.1    jruoho     /*
    512      1.1    jruoho      * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
    513      1.1    jruoho      * should be zero are indeed zero. This will workaround BIOSs that
    514      1.1    jruoho      * inadvertently place values in these fields.
    515      1.1    jruoho      *
    516      1.1    jruoho      * The ACPI 1.0 reserved fields that will be zeroed are the bytes located
    517      1.1    jruoho      * at offset 45, 55, 95, and the word located at offset 109, 110.
    518  1.1.1.2    jruoho      *
    519  1.1.1.2    jruoho      * Note: The FADT revision value is unreliable. Only the length can be
    520  1.1.1.2    jruoho      * trusted.
    521      1.1    jruoho      */
    522  1.1.1.2    jruoho     if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
    523      1.1    jruoho     {
    524      1.1    jruoho         AcpiGbl_FADT.PreferredProfile = 0;
    525      1.1    jruoho         AcpiGbl_FADT.PstateControl = 0;
    526      1.1    jruoho         AcpiGbl_FADT.CstControl = 0;
    527      1.1    jruoho         AcpiGbl_FADT.BootFlags = 0;
    528      1.1    jruoho     }
    529      1.1    jruoho 
    530      1.1    jruoho     /*
    531  1.1.1.3  christos      * Now we can update the local FADT length to the length of the
    532  1.1.1.3  christos      * current FADT version as defined by the ACPI specification.
    533  1.1.1.3  christos      * Thus, we will have a common FADT internally.
    534      1.1    jruoho      */
    535  1.1.1.3  christos     AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
    536      1.1    jruoho 
    537      1.1    jruoho     /*
    538  1.1.1.3  christos      * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
    539  1.1.1.3  christos      * Later ACPICA code will always use the X 64-bit field.
    540      1.1    jruoho      */
    541  1.1.1.3  christos     AcpiGbl_FADT.XFacs = AcpiTbSelectAddress ("FACS",
    542  1.1.1.3  christos         AcpiGbl_FADT.Facs, AcpiGbl_FADT.XFacs);
    543      1.1    jruoho 
    544  1.1.1.3  christos     AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
    545  1.1.1.3  christos         AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
    546      1.1    jruoho 
    547  1.1.1.3  christos     /* If Hardware Reduced flag is set, we are all done */
    548      1.1    jruoho 
    549  1.1.1.3  christos     if (AcpiGbl_ReducedHardware)
    550  1.1.1.3  christos     {
    551  1.1.1.3  christos         return;
    552      1.1    jruoho     }
    553      1.1    jruoho 
    554      1.1    jruoho     /* Examine all of the 64-bit extended address fields (X fields) */
    555      1.1    jruoho 
    556      1.1    jruoho     for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
    557      1.1    jruoho     {
    558      1.1    jruoho         /*
    559  1.1.1.3  christos          * Get the 32-bit and 64-bit addresses, as well as the register
    560  1.1.1.3  christos          * length and register name.
    561      1.1    jruoho          */
    562  1.1.1.3  christos         Address32 = *ACPI_ADD_PTR (UINT32,
    563  1.1.1.3  christos             &AcpiGbl_FADT, FadtInfoTable[i].Address32);
    564  1.1.1.3  christos 
    565      1.1    jruoho         Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,
    566  1.1.1.3  christos             &AcpiGbl_FADT, FadtInfoTable[i].Address64);
    567  1.1.1.3  christos 
    568      1.1    jruoho         Length = *ACPI_ADD_PTR (UINT8,
    569  1.1.1.3  christos             &AcpiGbl_FADT, FadtInfoTable[i].Length);
    570  1.1.1.3  christos 
    571      1.1    jruoho         Name = FadtInfoTable[i].Name;
    572  1.1.1.4  christos         Flags = FadtInfoTable[i].Flags;
    573      1.1    jruoho 
    574      1.1    jruoho         /*
    575  1.1.1.3  christos          * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
    576  1.1.1.3  christos          * generic address structures as necessary. Later code will always use
    577  1.1.1.3  christos          * the 64-bit address structures.
    578  1.1.1.3  christos          *
    579  1.1.1.3  christos          * November 2013:
    580  1.1.1.3  christos          * Now always use the 64-bit address if it is valid (non-zero), in
    581  1.1.1.3  christos          * accordance with the ACPI specification which states that a 64-bit
    582  1.1.1.3  christos          * address supersedes the 32-bit version. This behavior can be
    583  1.1.1.3  christos          * overridden by the AcpiGbl_Use32BitFadtAddresses flag.
    584  1.1.1.3  christos          *
    585  1.1.1.3  christos          * During 64-bit address construction and verification,
    586  1.1.1.3  christos          * these cases are handled:
    587  1.1.1.3  christos          *
    588  1.1.1.3  christos          * Address32 zero, Address64 [don't care]   - Use Address64
    589  1.1.1.3  christos          *
    590  1.1.1.3  christos          * Address32 non-zero, Address64 zero       - Copy/use Address32
    591  1.1.1.3  christos          * Address32 non-zero == Address64 non-zero - Use Address64
    592  1.1.1.3  christos          * Address32 non-zero != Address64 non-zero - Warning, use Address64
    593  1.1.1.3  christos          *
    594  1.1.1.3  christos          * Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and:
    595  1.1.1.3  christos          * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32
    596  1.1.1.3  christos          *
    597  1.1.1.3  christos          * Note: SpaceId is always I/O for 32-bit legacy address fields
    598  1.1.1.3  christos          */
    599  1.1.1.3  christos         if (Address32)
    600  1.1.1.3  christos         {
    601  1.1.1.3  christos             if (!Address64->Address)
    602  1.1.1.3  christos             {
    603  1.1.1.3  christos                 /* 64-bit address is zero, use 32-bit address */
    604  1.1.1.3  christos 
    605  1.1.1.3  christos                 AcpiTbInitGenericAddress (Address64,
    606  1.1.1.3  christos                     ACPI_ADR_SPACE_SYSTEM_IO,
    607  1.1.1.3  christos                     *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
    608  1.1.1.3  christos                         FadtInfoTable[i].Length),
    609  1.1.1.4  christos                     (UINT64) Address32, Name, Flags);
    610  1.1.1.3  christos             }
    611  1.1.1.3  christos             else if (Address64->Address != (UINT64) Address32)
    612  1.1.1.3  christos             {
    613  1.1.1.3  christos                 /* Address mismatch */
    614  1.1.1.3  christos 
    615  1.1.1.3  christos                 ACPI_BIOS_WARNING ((AE_INFO,
    616  1.1.1.3  christos                     "32/64X address mismatch in FADT/%s: "
    617  1.1.1.3  christos                     "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
    618  1.1.1.3  christos                     Name, Address32,
    619  1.1.1.3  christos                     ACPI_FORMAT_UINT64 (Address64->Address),
    620  1.1.1.3  christos                     AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
    621  1.1.1.3  christos 
    622  1.1.1.3  christos                 if (AcpiGbl_Use32BitFadtAddresses)
    623  1.1.1.3  christos                 {
    624  1.1.1.3  christos                     /* 32-bit address override */
    625  1.1.1.3  christos 
    626  1.1.1.3  christos                     AcpiTbInitGenericAddress (Address64,
    627  1.1.1.3  christos                         ACPI_ADR_SPACE_SYSTEM_IO,
    628  1.1.1.3  christos                         *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
    629  1.1.1.3  christos                             FadtInfoTable[i].Length),
    630  1.1.1.4  christos                         (UINT64) Address32, Name, Flags);
    631  1.1.1.3  christos                 }
    632  1.1.1.3  christos             }
    633  1.1.1.3  christos         }
    634  1.1.1.3  christos 
    635  1.1.1.3  christos         /*
    636      1.1    jruoho          * For each extended field, check for length mismatch between the
    637      1.1    jruoho          * legacy length field and the corresponding 64-bit X length field.
    638  1.1.1.3  christos          * Note: If the legacy length field is > 0xFF bits, ignore this
    639  1.1.1.3  christos          * check. (GPE registers can be larger than the 64-bit GAS structure
    640  1.1.1.3  christos          * can accomodate, 0xFF bits).
    641      1.1    jruoho          */
    642      1.1    jruoho         if (Address64->Address &&
    643  1.1.1.3  christos            (ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
    644      1.1    jruoho            (Address64->BitWidth != ACPI_MUL_8 (Length)))
    645      1.1    jruoho         {
    646  1.1.1.3  christos             ACPI_BIOS_WARNING ((AE_INFO,
    647  1.1.1.3  christos                 "32/64X length mismatch in FADT/%s: %u/%u",
    648      1.1    jruoho                 Name, ACPI_MUL_8 (Length), Address64->BitWidth));
    649      1.1    jruoho         }
    650      1.1    jruoho 
    651  1.1.1.4  christos         if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED)
    652      1.1    jruoho         {
    653      1.1    jruoho             /*
    654  1.1.1.3  christos              * Field is required (PM1aEvent, PM1aControl).
    655      1.1    jruoho              * Both the address and length must be non-zero.
    656      1.1    jruoho              */
    657      1.1    jruoho             if (!Address64->Address || !Length)
    658      1.1    jruoho             {
    659  1.1.1.3  christos                 ACPI_BIOS_ERROR ((AE_INFO,
    660  1.1.1.3  christos                     "Required FADT field %s has zero address and/or length: "
    661  1.1.1.3  christos                     "0x%8.8X%8.8X/0x%X",
    662      1.1    jruoho                     Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
    663      1.1    jruoho             }
    664      1.1    jruoho         }
    665  1.1.1.4  christos         else if (FadtInfoTable[i].Flags & ACPI_FADT_SEPARATE_LENGTH)
    666      1.1    jruoho         {
    667      1.1    jruoho             /*
    668      1.1    jruoho              * Field is optional (PM2Control, GPE0, GPE1) AND has its own
    669      1.1    jruoho              * length field. If present, both the address and length must
    670      1.1    jruoho              * be valid.
    671      1.1    jruoho              */
    672      1.1    jruoho             if ((Address64->Address && !Length) ||
    673      1.1    jruoho                 (!Address64->Address && Length))
    674      1.1    jruoho             {
    675  1.1.1.3  christos                 ACPI_BIOS_WARNING ((AE_INFO,
    676  1.1.1.3  christos                     "Optional FADT field %s has zero address or length: "
    677      1.1    jruoho                     "0x%8.8X%8.8X/0x%X",
    678      1.1    jruoho                     Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
    679      1.1    jruoho             }
    680      1.1    jruoho         }
    681      1.1    jruoho     }
    682      1.1    jruoho }
    683      1.1    jruoho 
    684      1.1    jruoho 
    685      1.1    jruoho /*******************************************************************************
    686      1.1    jruoho  *
    687      1.1    jruoho  * FUNCTION:    AcpiTbSetupFadtRegisters
    688      1.1    jruoho  *
    689      1.1    jruoho  * PARAMETERS:  None, uses AcpiGbl_FADT.
    690      1.1    jruoho  *
    691      1.1    jruoho  * RETURN:      None
    692      1.1    jruoho  *
    693      1.1    jruoho  * DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally,
    694      1.1    jruoho  *              force FADT register definitions to their default lengths.
    695      1.1    jruoho  *
    696      1.1    jruoho  ******************************************************************************/
    697      1.1    jruoho 
    698      1.1    jruoho static void
    699      1.1    jruoho AcpiTbSetupFadtRegisters (
    700      1.1    jruoho     void)
    701      1.1    jruoho {
    702      1.1    jruoho     ACPI_GENERIC_ADDRESS    *Target64;
    703      1.1    jruoho     ACPI_GENERIC_ADDRESS    *Source64;
    704      1.1    jruoho     UINT8                   Pm1RegisterByteWidth;
    705      1.1    jruoho     UINT32                  i;
    706      1.1    jruoho 
    707      1.1    jruoho 
    708      1.1    jruoho     /*
    709      1.1    jruoho      * Optionally check all register lengths against the default values and
    710      1.1    jruoho      * update them if they are incorrect.
    711      1.1    jruoho      */
    712      1.1    jruoho     if (AcpiGbl_UseDefaultRegisterWidths)
    713      1.1    jruoho     {
    714      1.1    jruoho         for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
    715      1.1    jruoho         {
    716      1.1    jruoho             Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
    717      1.1    jruoho                 FadtInfoTable[i].Address64);
    718      1.1    jruoho 
    719      1.1    jruoho             /*
    720      1.1    jruoho              * If a valid register (Address != 0) and the (DefaultLength > 0)
    721      1.1    jruoho              * (Not a GPE register), then check the width against the default.
    722      1.1    jruoho              */
    723      1.1    jruoho             if ((Target64->Address) &&
    724      1.1    jruoho                 (FadtInfoTable[i].DefaultLength > 0) &&
    725      1.1    jruoho                 (FadtInfoTable[i].DefaultLength != Target64->BitWidth))
    726      1.1    jruoho             {
    727  1.1.1.3  christos                 ACPI_BIOS_WARNING ((AE_INFO,
    728  1.1.1.3  christos                     "Invalid length for FADT/%s: %u, using default %u",
    729      1.1    jruoho                     FadtInfoTable[i].Name, Target64->BitWidth,
    730      1.1    jruoho                     FadtInfoTable[i].DefaultLength));
    731      1.1    jruoho 
    732      1.1    jruoho                 /* Incorrect size, set width to the default */
    733      1.1    jruoho 
    734      1.1    jruoho                 Target64->BitWidth = FadtInfoTable[i].DefaultLength;
    735      1.1    jruoho             }
    736      1.1    jruoho         }
    737      1.1    jruoho     }
    738      1.1    jruoho 
    739      1.1    jruoho     /*
    740      1.1    jruoho      * Get the length of the individual PM1 registers (enable and status).
    741      1.1    jruoho      * Each register is defined to be (event block length / 2). Extra divide
    742      1.1    jruoho      * by 8 converts bits to bytes.
    743      1.1    jruoho      */
    744      1.1    jruoho     Pm1RegisterByteWidth = (UINT8)
    745      1.1    jruoho         ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth);
    746      1.1    jruoho 
    747      1.1    jruoho     /*
    748      1.1    jruoho      * Calculate separate GAS structs for the PM1x (A/B) Status and Enable
    749      1.1    jruoho      * registers. These addresses do not appear (directly) in the FADT, so it
    750      1.1    jruoho      * is useful to pre-calculate them from the PM1 Event Block definitions.
    751      1.1    jruoho      *
    752      1.1    jruoho      * The PM event blocks are split into two register blocks, first is the
    753      1.1    jruoho      * PM Status Register block, followed immediately by the PM Enable
    754      1.1    jruoho      * Register block. Each is of length (Pm1EventLength/2)
    755      1.1    jruoho      *
    756      1.1    jruoho      * Note: The PM1A event block is required by the ACPI specification.
    757      1.1    jruoho      * However, the PM1B event block is optional and is rarely, if ever,
    758      1.1    jruoho      * used.
    759      1.1    jruoho      */
    760      1.1    jruoho 
    761      1.1    jruoho     for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++)
    762      1.1    jruoho     {
    763      1.1    jruoho         Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
    764      1.1    jruoho             FadtPmInfoTable[i].Source);
    765      1.1    jruoho 
    766      1.1    jruoho         if (Source64->Address)
    767      1.1    jruoho         {
    768      1.1    jruoho             AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
    769      1.1    jruoho                 Source64->SpaceId, Pm1RegisterByteWidth,
    770      1.1    jruoho                 Source64->Address +
    771  1.1.1.3  christos                     (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
    772  1.1.1.4  christos                 "PmRegisters", 0);
    773      1.1    jruoho         }
    774      1.1    jruoho     }
    775      1.1    jruoho }
    776