Fixed compatibility of output.
[AROS.git] / arch / all-pc / acpica / source / components / tables / tbfadt.c
blobeb4e0e5695d5120992c825b2c78f34dd8bea046f
1 /******************************************************************************
3 * Module Name: tbfadt - FADT table utilities
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
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.
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.
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #define __TBFADT_C__
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "actables.h"
50 #define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbfadt")
53 /* Local prototypes */
55 static void
56 AcpiTbInitGenericAddress (
57 ACPI_GENERIC_ADDRESS *GenericAddress,
58 UINT8 SpaceId,
59 UINT8 ByteWidth,
60 UINT64 Address,
61 char *RegisterName);
63 static void
64 AcpiTbConvertFadt (
65 void);
67 static void
68 AcpiTbValidateFadt (
69 void);
71 static void
72 AcpiTbSetupFadtRegisters (
73 void);
76 /* Table for conversion of FADT to common internal format and FADT validation */
78 typedef struct acpi_fadt_info
80 char *Name;
81 UINT16 Address64;
82 UINT16 Address32;
83 UINT16 Length;
84 UINT8 DefaultLength;
85 UINT8 Type;
87 } ACPI_FADT_INFO;
89 #define ACPI_FADT_OPTIONAL 0
90 #define ACPI_FADT_REQUIRED 1
91 #define ACPI_FADT_SEPARATE_LENGTH 2
93 static ACPI_FADT_INFO FadtInfoTable[] =
95 {"Pm1aEventBlock",
96 ACPI_FADT_OFFSET (XPm1aEventBlock),
97 ACPI_FADT_OFFSET (Pm1aEventBlock),
98 ACPI_FADT_OFFSET (Pm1EventLength),
99 ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
100 ACPI_FADT_REQUIRED},
102 {"Pm1bEventBlock",
103 ACPI_FADT_OFFSET (XPm1bEventBlock),
104 ACPI_FADT_OFFSET (Pm1bEventBlock),
105 ACPI_FADT_OFFSET (Pm1EventLength),
106 ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
107 ACPI_FADT_OPTIONAL},
109 {"Pm1aControlBlock",
110 ACPI_FADT_OFFSET (XPm1aControlBlock),
111 ACPI_FADT_OFFSET (Pm1aControlBlock),
112 ACPI_FADT_OFFSET (Pm1ControlLength),
113 ACPI_PM1_REGISTER_WIDTH,
114 ACPI_FADT_REQUIRED},
116 {"Pm1bControlBlock",
117 ACPI_FADT_OFFSET (XPm1bControlBlock),
118 ACPI_FADT_OFFSET (Pm1bControlBlock),
119 ACPI_FADT_OFFSET (Pm1ControlLength),
120 ACPI_PM1_REGISTER_WIDTH,
121 ACPI_FADT_OPTIONAL},
123 {"Pm2ControlBlock",
124 ACPI_FADT_OFFSET (XPm2ControlBlock),
125 ACPI_FADT_OFFSET (Pm2ControlBlock),
126 ACPI_FADT_OFFSET (Pm2ControlLength),
127 ACPI_PM2_REGISTER_WIDTH,
128 ACPI_FADT_SEPARATE_LENGTH},
130 {"PmTimerBlock",
131 ACPI_FADT_OFFSET (XPmTimerBlock),
132 ACPI_FADT_OFFSET (PmTimerBlock),
133 ACPI_FADT_OFFSET (PmTimerLength),
134 ACPI_PM_TIMER_WIDTH,
135 ACPI_FADT_SEPARATE_LENGTH}, /* ACPI 5.0A: Timer is optional */
137 {"Gpe0Block",
138 ACPI_FADT_OFFSET (XGpe0Block),
139 ACPI_FADT_OFFSET (Gpe0Block),
140 ACPI_FADT_OFFSET (Gpe0BlockLength),
142 ACPI_FADT_SEPARATE_LENGTH},
144 {"Gpe1Block",
145 ACPI_FADT_OFFSET (XGpe1Block),
146 ACPI_FADT_OFFSET (Gpe1Block),
147 ACPI_FADT_OFFSET (Gpe1BlockLength),
149 ACPI_FADT_SEPARATE_LENGTH}
152 #define ACPI_FADT_INFO_ENTRIES \
153 (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
156 /* Table used to split Event Blocks into separate status/enable registers */
158 typedef struct acpi_fadt_pm_info
160 ACPI_GENERIC_ADDRESS *Target;
161 UINT16 Source;
162 UINT8 RegisterNum;
164 } ACPI_FADT_PM_INFO;
166 static ACPI_FADT_PM_INFO FadtPmInfoTable[] =
168 {&AcpiGbl_XPm1aStatus,
169 ACPI_FADT_OFFSET (XPm1aEventBlock),
172 {&AcpiGbl_XPm1aEnable,
173 ACPI_FADT_OFFSET (XPm1aEventBlock),
176 {&AcpiGbl_XPm1bStatus,
177 ACPI_FADT_OFFSET (XPm1bEventBlock),
180 {&AcpiGbl_XPm1bEnable,
181 ACPI_FADT_OFFSET (XPm1bEventBlock),
185 #define ACPI_FADT_PM_INFO_ENTRIES \
186 (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO))
189 /*******************************************************************************
191 * FUNCTION: AcpiTbInitGenericAddress
193 * PARAMETERS: GenericAddress - GAS struct to be initialized
194 * SpaceId - ACPI Space ID for this register
195 * ByteWidth - Width of this register
196 * Address - Address of the register
198 * RETURN: None
200 * DESCRIPTION: Initialize a Generic Address Structure (GAS)
201 * See the ACPI specification for a full description and
202 * definition of this structure.
204 ******************************************************************************/
206 static void
207 AcpiTbInitGenericAddress (
208 ACPI_GENERIC_ADDRESS *GenericAddress,
209 UINT8 SpaceId,
210 UINT8 ByteWidth,
211 UINT64 Address,
212 char *RegisterName)
214 UINT8 BitWidth;
217 /* Bit width field in the GAS is only one byte long, 255 max */
219 BitWidth = (UINT8) (ByteWidth * 8);
221 if (ByteWidth > 31) /* (31*8)=248 */
223 ACPI_ERROR ((AE_INFO,
224 "%s - 32-bit FADT register is too long (%u bytes, %u bits) "
225 "to convert to GAS struct - 255 bits max, truncating",
226 RegisterName, ByteWidth, (ByteWidth * 8)));
228 BitWidth = 255;
232 * The 64-bit Address field is non-aligned in the byte packed
233 * GAS struct.
235 ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
237 /* All other fields are byte-wide */
239 GenericAddress->SpaceId = SpaceId;
240 GenericAddress->BitWidth = BitWidth;
241 GenericAddress->BitOffset = 0;
242 GenericAddress->AccessWidth = 0; /* Access width ANY */
246 /*******************************************************************************
248 * FUNCTION: AcpiTbParseFadt
250 * PARAMETERS: TableIndex - Index for the FADT
252 * RETURN: None
254 * DESCRIPTION: Initialize the FADT, DSDT and FACS tables
255 * (FADT contains the addresses of the DSDT and FACS)
257 ******************************************************************************/
259 void
260 AcpiTbParseFadt (
261 UINT32 TableIndex)
263 UINT32 Length;
264 ACPI_TABLE_HEADER *Table;
268 * The FADT has multiple versions with different lengths,
269 * and it contains pointers to both the DSDT and FACS tables.
271 * Get a local copy of the FADT and convert it to a common format
272 * Map entire FADT, assumed to be smaller than one page.
274 Length = AcpiGbl_RootTableList.Tables[TableIndex].Length;
276 Table = AcpiOsMapMemory (
277 AcpiGbl_RootTableList.Tables[TableIndex].Address, Length);
278 if (!Table)
280 return;
284 * Validate the FADT checksum before we copy the table. Ignore
285 * checksum error as we want to try to get the DSDT and FACS.
287 (void) AcpiTbVerifyChecksum (Table, Length);
289 /* Create a local copy of the FADT in common ACPI 2.0+ format */
291 AcpiTbCreateLocalFadt (Table, Length);
293 /* All done with the real FADT, unmap it */
295 AcpiOsUnmapMemory (Table, Length);
297 /* Obtain the DSDT and FACS tables via their addresses within the FADT */
299 AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
300 ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
302 /* If Hardware Reduced flag is set, there is no FACS */
304 if (!AcpiGbl_ReducedHardware)
306 AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
307 ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
312 /*******************************************************************************
314 * FUNCTION: AcpiTbCreateLocalFadt
316 * PARAMETERS: Table - Pointer to BIOS FADT
317 * Length - Length of the table
319 * RETURN: None
321 * DESCRIPTION: Get a local copy of the FADT and convert it to a common format.
322 * Performs validation on some important FADT fields.
324 * NOTE: We create a local copy of the FADT regardless of the version.
326 ******************************************************************************/
328 void
329 AcpiTbCreateLocalFadt (
330 ACPI_TABLE_HEADER *Table,
331 UINT32 Length)
335 * Check if the FADT is larger than the largest table that we expect
336 * (the ACPI 5.0 version). If so, truncate the table, and issue
337 * a warning.
339 if (Length > sizeof (ACPI_TABLE_FADT))
341 ACPI_BIOS_WARNING ((AE_INFO,
342 "FADT (revision %u) is longer than ACPI 5.0 version, "
343 "truncating length %u to %u",
344 Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT)));
347 /* Clear the entire local FADT */
349 ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT));
351 /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
353 ACPI_MEMCPY (&AcpiGbl_FADT, Table,
354 ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
356 /* Take a copy of the Hardware Reduced flag */
358 AcpiGbl_ReducedHardware = FALSE;
359 if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED)
361 AcpiGbl_ReducedHardware = TRUE;
364 /* Convert the local copy of the FADT to the common internal format */
366 AcpiTbConvertFadt ();
368 /* Validate FADT values now, before we make any changes */
370 AcpiTbValidateFadt ();
372 /* Initialize the global ACPI register structures */
374 AcpiTbSetupFadtRegisters ();
378 /*******************************************************************************
380 * FUNCTION: AcpiTbConvertFadt
382 * PARAMETERS: None, uses AcpiGbl_FADT
384 * RETURN: None
386 * DESCRIPTION: Converts all versions of the FADT to a common internal format.
387 * Expand 32-bit addresses to 64-bit as necessary.
389 * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT),
390 * and must contain a copy of the actual FADT.
392 * Notes on 64-bit register addresses:
394 * After this FADT conversion, later ACPICA code will only use the 64-bit "X"
395 * fields of the FADT for all ACPI register addresses.
397 * The 64-bit "X" fields are optional extensions to the original 32-bit FADT
398 * V1.0 fields. Even if they are present in the FADT, they are optional and
399 * are unused if the BIOS sets them to zero. Therefore, we must copy/expand
400 * 32-bit V1.0 fields if the corresponding X field is zero.
402 * For ACPI 1.0 FADTs, all 32-bit address fields are expanded to the
403 * corresponding "X" fields in the internal FADT.
405 * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded
406 * to the corresponding 64-bit X fields. For compatibility with other ACPI
407 * implementations, we ignore the 64-bit field if the 32-bit field is valid,
408 * regardless of whether the host OS is 32-bit or 64-bit.
410 ******************************************************************************/
412 static void
413 AcpiTbConvertFadt (
414 void)
416 ACPI_GENERIC_ADDRESS *Address64;
417 UINT32 Address32;
418 UINT32 i;
422 * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
423 * Later code will always use the X 64-bit field.
425 if (!AcpiGbl_FADT.XFacs)
427 AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;
429 if (!AcpiGbl_FADT.XDsdt)
431 AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
435 * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
436 * should be zero are indeed zero. This will workaround BIOSs that
437 * inadvertently place values in these fields.
439 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located
440 * at offset 45, 55, 95, and the word located at offset 109, 110.
442 * Note: The FADT revision value is unreliable. Only the length can be
443 * trusted.
445 if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
447 AcpiGbl_FADT.PreferredProfile = 0;
448 AcpiGbl_FADT.PstateControl = 0;
449 AcpiGbl_FADT.CstControl = 0;
450 AcpiGbl_FADT.BootFlags = 0;
454 * Now we can update the local FADT length to the length of the
455 * current FADT version as defined by the ACPI specification.
456 * Thus, we will have a common FADT internally.
458 AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
461 * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
462 * generic address structures as necessary. Later code will always use
463 * the 64-bit address structures.
465 * March 2009:
466 * We now always use the 32-bit address if it is valid (non-null). This
467 * is not in accordance with the ACPI specification which states that
468 * the 64-bit address supersedes the 32-bit version, but we do this for
469 * compatibility with other ACPI implementations. Most notably, in the
470 * case where both the 32 and 64 versions are non-null, we use the 32-bit
471 * version. This is the only address that is guaranteed to have been
472 * tested by the BIOS manufacturer.
474 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
476 Address32 = *ACPI_ADD_PTR (UINT32,
477 &AcpiGbl_FADT, FadtInfoTable[i].Address32);
479 Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,
480 &AcpiGbl_FADT, FadtInfoTable[i].Address64);
483 * If both 32- and 64-bit addresses are valid (non-zero),
484 * they must match.
486 if (Address64->Address && Address32 &&
487 (Address64->Address != (UINT64) Address32))
489 ACPI_BIOS_ERROR ((AE_INFO,
490 "32/64X address mismatch in FADT/%s: "
491 "0x%8.8X/0x%8.8X%8.8X, using 32",
492 FadtInfoTable[i].Name, Address32,
493 ACPI_FORMAT_UINT64 (Address64->Address)));
496 /* Always use 32-bit address if it is valid (non-null) */
498 if (Address32)
501 * Copy the 32-bit address to the 64-bit GAS structure. The
502 * Space ID is always I/O for 32-bit legacy address fields
504 AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO,
505 *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),
506 (UINT64) Address32, FadtInfoTable[i].Name);
512 /*******************************************************************************
514 * FUNCTION: AcpiTbValidateFadt
516 * PARAMETERS: Table - Pointer to the FADT to be validated
518 * RETURN: None
520 * DESCRIPTION: Validate various important fields within the FADT. If a problem
521 * is found, issue a message, but no status is returned.
522 * Used by both the table manager and the disassembler.
524 * Possible additional checks:
525 * (AcpiGbl_FADT.Pm1EventLength >= 4)
526 * (AcpiGbl_FADT.Pm1ControlLength >= 2)
527 * (AcpiGbl_FADT.PmTimerLength >= 4)
528 * Gpe block lengths must be multiple of 2
530 ******************************************************************************/
532 static void
533 AcpiTbValidateFadt (
534 void)
536 char *Name;
537 ACPI_GENERIC_ADDRESS *Address64;
538 UINT8 Length;
539 UINT32 i;
543 * Check for FACS and DSDT address mismatches. An address mismatch between
544 * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and
545 * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables.
547 if (AcpiGbl_FADT.Facs &&
548 (AcpiGbl_FADT.XFacs != (UINT64) AcpiGbl_FADT.Facs))
550 ACPI_BIOS_WARNING ((AE_INFO,
551 "32/64X FACS address mismatch in FADT - "
552 "0x%8.8X/0x%8.8X%8.8X, using 32",
553 AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs)));
555 AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;
558 if (AcpiGbl_FADT.Dsdt &&
559 (AcpiGbl_FADT.XDsdt != (UINT64) AcpiGbl_FADT.Dsdt))
561 ACPI_BIOS_WARNING ((AE_INFO,
562 "32/64X DSDT address mismatch in FADT - "
563 "0x%8.8X/0x%8.8X%8.8X, using 32",
564 AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt)));
566 AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
569 /* If Hardware Reduced flag is set, we are all done */
571 if (AcpiGbl_ReducedHardware)
573 return;
576 /* Examine all of the 64-bit extended address fields (X fields) */
578 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
581 * Generate pointer to the 64-bit address, get the register
582 * length (width) and the register name
584 Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,
585 &AcpiGbl_FADT, FadtInfoTable[i].Address64);
586 Length = *ACPI_ADD_PTR (UINT8,
587 &AcpiGbl_FADT, FadtInfoTable[i].Length);
588 Name = FadtInfoTable[i].Name;
591 * For each extended field, check for length mismatch between the
592 * legacy length field and the corresponding 64-bit X length field.
593 * Note: If the legacy length field is > 0xFF bits, ignore this
594 * check. (GPE registers can be larger than the 64-bit GAS structure
595 * can accomodate, 0xFF bits).
597 if (Address64->Address &&
598 (ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
599 (Address64->BitWidth != ACPI_MUL_8 (Length)))
601 ACPI_BIOS_WARNING ((AE_INFO,
602 "32/64X length mismatch in FADT/%s: %u/%u",
603 Name, ACPI_MUL_8 (Length), Address64->BitWidth));
606 if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED)
609 * Field is required (PM1aEvent, PM1aControl).
610 * Both the address and length must be non-zero.
612 if (!Address64->Address || !Length)
614 ACPI_BIOS_ERROR ((AE_INFO,
615 "Required FADT field %s has zero address and/or length: "
616 "0x%8.8X%8.8X/0x%X",
617 Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
620 else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH)
623 * Field is optional (PM2Control, GPE0, GPE1) AND has its own
624 * length field. If present, both the address and length must
625 * be valid.
627 if ((Address64->Address && !Length) ||
628 (!Address64->Address && Length))
630 ACPI_BIOS_WARNING ((AE_INFO,
631 "Optional FADT field %s has zero address or length: "
632 "0x%8.8X%8.8X/0x%X",
633 Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
640 /*******************************************************************************
642 * FUNCTION: AcpiTbSetupFadtRegisters
644 * PARAMETERS: None, uses AcpiGbl_FADT.
646 * RETURN: None
648 * DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally,
649 * force FADT register definitions to their default lengths.
651 ******************************************************************************/
653 static void
654 AcpiTbSetupFadtRegisters (
655 void)
657 ACPI_GENERIC_ADDRESS *Target64;
658 ACPI_GENERIC_ADDRESS *Source64;
659 UINT8 Pm1RegisterByteWidth;
660 UINT32 i;
664 * Optionally check all register lengths against the default values and
665 * update them if they are incorrect.
667 if (AcpiGbl_UseDefaultRegisterWidths)
669 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
671 Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
672 FadtInfoTable[i].Address64);
675 * If a valid register (Address != 0) and the (DefaultLength > 0)
676 * (Not a GPE register), then check the width against the default.
678 if ((Target64->Address) &&
679 (FadtInfoTable[i].DefaultLength > 0) &&
680 (FadtInfoTable[i].DefaultLength != Target64->BitWidth))
682 ACPI_BIOS_WARNING ((AE_INFO,
683 "Invalid length for FADT/%s: %u, using default %u",
684 FadtInfoTable[i].Name, Target64->BitWidth,
685 FadtInfoTable[i].DefaultLength));
687 /* Incorrect size, set width to the default */
689 Target64->BitWidth = FadtInfoTable[i].DefaultLength;
695 * Get the length of the individual PM1 registers (enable and status).
696 * Each register is defined to be (event block length / 2). Extra divide
697 * by 8 converts bits to bytes.
699 Pm1RegisterByteWidth = (UINT8)
700 ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth);
703 * Calculate separate GAS structs for the PM1x (A/B) Status and Enable
704 * registers. These addresses do not appear (directly) in the FADT, so it
705 * is useful to pre-calculate them from the PM1 Event Block definitions.
707 * The PM event blocks are split into two register blocks, first is the
708 * PM Status Register block, followed immediately by the PM Enable
709 * Register block. Each is of length (Pm1EventLength/2)
711 * Note: The PM1A event block is required by the ACPI specification.
712 * However, the PM1B event block is optional and is rarely, if ever,
713 * used.
716 for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++)
718 Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
719 FadtPmInfoTable[i].Source);
721 if (Source64->Address)
723 AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
724 Source64->SpaceId, Pm1RegisterByteWidth,
725 Source64->Address +
726 (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
727 "PmRegisters");