1/******************************************************************************
2 *
3 * Module Name: tbfadt - FADT table utilities
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
--- 38 unchanged lines hidden (view full) ---
47#include <contrib/dev/acpica/include/accommon.h>
48#include <contrib/dev/acpica/include/actables.h>
49
50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbfadt")
52
53/* Local prototypes */
54
55static void
56AcpiTbInitGenericAddress (
57 ACPI_GENERIC_ADDRESS *GenericAddress,
58 UINT8 SpaceId,
59 UINT8 ByteWidth,
60 UINT64 Address,
61 char *RegisterName);
62
63static void
64AcpiTbConvertFadt (
65 void);
66
67static void
68AcpiTbValidateFadt (
69 void);
--- 128 unchanged lines hidden (view full) ---
198 * RETURN: None
199 *
200 * DESCRIPTION: Initialize a Generic Address Structure (GAS)
201 * See the ACPI specification for a full description and
202 * definition of this structure.
203 *
204 ******************************************************************************/
205
206static void
207AcpiTbInitGenericAddress (
208 ACPI_GENERIC_ADDRESS *GenericAddress,
209 UINT8 SpaceId,
210 UINT8 ByteWidth,
211 UINT64 Address,
212 char *RegisterName)
213{
214 UINT8 BitWidth;
215
216
217 /* Bit width field in the GAS is only one byte long, 255 max */
218
219 BitWidth = (UINT8) (ByteWidth * 8);
220
221 if (ByteWidth > 31) /* (31*8)=248 */
222 {
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)));
227
228 BitWidth = 255;
229 }
230
231 /*
232 * The 64-bit Address field is non-aligned in the byte packed
233 * GAS struct.
234 */
235 ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
236
237 /* All other fields are byte-wide */
238
239 GenericAddress->SpaceId = SpaceId;
240 GenericAddress->BitWidth = BitWidth;
241 GenericAddress->BitOffset = 0;
242 GenericAddress->AccessWidth = 0; /* Access width ANY */
243}
244
245
246/*******************************************************************************
247 *
248 * FUNCTION: AcpiTbParseFadt
--- 248 unchanged lines hidden (view full) ---
497 if (Address32)
498 {
499 /*
500 * Copy the 32-bit address to the 64-bit GAS structure. The
501 * Space ID is always I/O for 32-bit legacy address fields
502 */
503 AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO,
504 *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),
505 (UINT64) Address32, FadtInfoTable[i].Name);
506 }
507 }
508}
509
510
511/*******************************************************************************
512 *
513 * FUNCTION: AcpiTbValidateFadt
--- 199 unchanged lines hidden (view full) ---
713 Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
714 FadtPmInfoTable[i].Source);
715
716 if (Source64->Address)
717 {
718 AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
719 Source64->SpaceId, Pm1RegisterByteWidth,
720 Source64->Address +
721 (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
722 "PmRegisters");
723 }
724 }
725}
726
2 *
3 * Module Name: tbfadt - FADT table utilities
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
--- 38 unchanged lines hidden (view full) ---
47#include <contrib/dev/acpica/include/accommon.h>
48#include <contrib/dev/acpica/include/actables.h>
49
50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbfadt")
52
53/* Local prototypes */
54
55static void
56AcpiTbInitGenericAddress (
57 ACPI_GENERIC_ADDRESS *GenericAddress,
58 UINT8 SpaceId,
59 UINT8 ByteWidth,
60 UINT64 Address,
61 char *RegisterName);
62
63static void
64AcpiTbConvertFadt (
65 void);
66
67static void
68AcpiTbValidateFadt (
69 void);
--- 128 unchanged lines hidden (view full) ---
198 * RETURN: None
199 *
200 * DESCRIPTION: Initialize a Generic Address Structure (GAS)
201 * See the ACPI specification for a full description and
202 * definition of this structure.
203 *
204 ******************************************************************************/
205
206static void
207AcpiTbInitGenericAddress (
208 ACPI_GENERIC_ADDRESS *GenericAddress,
209 UINT8 SpaceId,
210 UINT8 ByteWidth,
211 UINT64 Address,
212 char *RegisterName)
213{
214 UINT8 BitWidth;
215
216
217 /* Bit width field in the GAS is only one byte long, 255 max */
218
219 BitWidth = (UINT8) (ByteWidth * 8);
220
221 if (ByteWidth > 31) /* (31*8)=248 */
222 {
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)));
227
228 BitWidth = 255;
229 }
230
231 /*
232 * The 64-bit Address field is non-aligned in the byte packed
233 * GAS struct.
234 */
235 ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
236
237 /* All other fields are byte-wide */
238
239 GenericAddress->SpaceId = SpaceId;
240 GenericAddress->BitWidth = BitWidth;
241 GenericAddress->BitOffset = 0;
242 GenericAddress->AccessWidth = 0; /* Access width ANY */
243}
244
245
246/*******************************************************************************
247 *
248 * FUNCTION: AcpiTbParseFadt
--- 248 unchanged lines hidden (view full) ---
497 if (Address32)
498 {
499 /*
500 * Copy the 32-bit address to the 64-bit GAS structure. The
501 * Space ID is always I/O for 32-bit legacy address fields
502 */
503 AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO,
504 *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),
505 (UINT64) Address32, FadtInfoTable[i].Name);
506 }
507 }
508}
509
510
511/*******************************************************************************
512 *
513 * FUNCTION: AcpiTbValidateFadt
--- 199 unchanged lines hidden (view full) ---
713 Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
714 FadtPmInfoTable[i].Source);
715
716 if (Source64->Address)
717 {
718 AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
719 Source64->SpaceId, Pm1RegisterByteWidth,
720 Source64->Address +
721 (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
722 "PmRegisters");
723 }
724 }
725}
726