ReactOS 0.4.16-dev-109-gf4cb10f
tbfadt.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "actables.h"
Include dependency graph for tbfadt.c:

Go to the source code of this file.

Classes

struct  acpi_fadt_info
 
struct  acpi_fadt_pm_info
 

Macros

#define _COMPONENT   ACPI_TABLES
 
#define ACPI_FADT_OPTIONAL   0
 
#define ACPI_FADT_REQUIRED   1
 
#define ACPI_FADT_SEPARATE_LENGTH   2
 
#define ACPI_FADT_GPE_REGISTER   4
 
#define ACPI_FADT_INFO_ENTRIES    (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
 
#define ACPI_FADT_PM_INFO_ENTRIES    (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO))
 

Typedefs

typedef struct acpi_fadt_info ACPI_FADT_INFO
 
typedef struct acpi_fadt_pm_info ACPI_FADT_PM_INFO
 

Functions

static void AcpiTbInitGenericAddress (ACPI_GENERIC_ADDRESS *GenericAddress, UINT8 SpaceId, UINT8 ByteWidth, UINT64 Address, const char *RegisterName, UINT8 Flags)
 
static void AcpiTbConvertFadt (void)
 
static void AcpiTbSetupFadtRegisters (void)
 
static UINT64 AcpiTbSelectAddress (char *RegisterName, UINT32 Address32, UINT64 Address64)
 
void AcpiTbParseFadt (void)
 
void AcpiTbCreateLocalFadt (ACPI_TABLE_HEADER *Table, UINT32 Length)
 

Variables

static ACPI_FADT_INFO FadtInfoTable []
 
static ACPI_FADT_PM_INFO FadtPmInfoTable []
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_TABLES

Definition at line 48 of file tbfadt.c.

◆ ACPI_FADT_GPE_REGISTER

#define ACPI_FADT_GPE_REGISTER   4

Definition at line 93 of file tbfadt.c.

◆ ACPI_FADT_INFO_ENTRIES

#define ACPI_FADT_INFO_ENTRIES    (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))

Definition at line 154 of file tbfadt.c.

◆ ACPI_FADT_OPTIONAL

#define ACPI_FADT_OPTIONAL   0

Definition at line 90 of file tbfadt.c.

◆ ACPI_FADT_PM_INFO_ENTRIES

#define ACPI_FADT_PM_INFO_ENTRIES    (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO))

Definition at line 187 of file tbfadt.c.

◆ ACPI_FADT_REQUIRED

#define ACPI_FADT_REQUIRED   1

Definition at line 91 of file tbfadt.c.

◆ ACPI_FADT_SEPARATE_LENGTH

#define ACPI_FADT_SEPARATE_LENGTH   2

Definition at line 92 of file tbfadt.c.

Typedef Documentation

◆ ACPI_FADT_INFO

◆ ACPI_FADT_PM_INFO

Function Documentation

◆ AcpiTbConvertFadt()

static void AcpiTbConvertFadt ( void  )
static

Definition at line 514 of file tbfadt.c.

516{
517 const char *Name;
518 ACPI_GENERIC_ADDRESS *Address64;
519 UINT32 Address32;
521 UINT8 Flags;
522 UINT32 i;
523
524
525 /*
526 * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
527 * should be zero are indeed zero. This will workaround BIOSs that
528 * inadvertently place values in these fields.
529 *
530 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located
531 * at offset 45, 55, 95, and the word located at offset 109, 110.
532 *
533 * Note: The FADT revision value is unreliable. Only the length can be
534 * trusted.
535 */
536 if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
537 {
538 AcpiGbl_FADT.PreferredProfile = 0;
539 AcpiGbl_FADT.PstateControl = 0;
540 AcpiGbl_FADT.CstControl = 0;
541 AcpiGbl_FADT.BootFlags = 0;
542 }
543
544 /*
545 * Now we can update the local FADT length to the length of the
546 * current FADT version as defined by the ACPI specification.
547 * Thus, we will have a common FADT internally.
548 */
549 AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
550
551 /*
552 * Expand the 32-bit DSDT addresses to 64-bit as necessary.
553 * Later ACPICA code will always use the X 64-bit field.
554 */
555 AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
556 AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
557
558 /* If Hardware Reduced flag is set, we are all done */
559
560 if (AcpiGbl_ReducedHardware)
561 {
562 return;
563 }
564
565 /* Examine all of the 64-bit extended address fields (X fields) */
566
567 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
568 {
569 /*
570 * Get the 32-bit and 64-bit addresses, as well as the register
571 * length and register name.
572 */
573 Address32 = *ACPI_ADD_PTR (UINT32,
574 &AcpiGbl_FADT, FadtInfoTable[i].Address32);
575
577 &AcpiGbl_FADT, FadtInfoTable[i].Address64);
578
580 &AcpiGbl_FADT, FadtInfoTable[i].Length);
581
584
585 /*
586 * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
587 * generic address structures as necessary. Later code will always use
588 * the 64-bit address structures.
589 *
590 * November 2013:
591 * Now always use the 64-bit address if it is valid (non-zero), in
592 * accordance with the ACPI specification which states that a 64-bit
593 * address supersedes the 32-bit version. This behavior can be
594 * overridden by the AcpiGbl_Use32BitFadtAddresses flag.
595 *
596 * During 64-bit address construction and verification,
597 * these cases are handled:
598 *
599 * Address32 zero, Address64 [don't care] - Use Address64
600 *
601 * No override: if AcpiGbl_Use32BitFadtAddresses is FALSE, and:
602 * Address32 non-zero, Address64 zero - Copy/use Address32
603 * Address32 non-zero == Address64 non-zero - Use Address64
604 * Address32 non-zero != Address64 non-zero - Warning, use Address64
605 *
606 * Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and:
607 * Address32 non-zero, Address64 zero - Copy/use Address32
608 * Address32 non-zero == Address64 non-zero - Copy/use Address32
609 * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32
610 *
611 * Note: SpaceId is always I/O for 32-bit legacy address fields
612 */
613 if (Address32)
614 {
615 if (Address64->Address)
616 {
617 if (Address64->Address != (UINT64) Address32)
618 {
619 /* Address mismatch */
620
622 "32/64X address mismatch in FADT/%s: "
623 "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
624 Name, Address32,
625 ACPI_FORMAT_UINT64 (Address64->Address),
626 AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
627 }
628
629 /*
630 * For each extended field, check for length mismatch
631 * between the legacy length field and the corresponding
632 * 64-bit X length field.
633 * Note: If the legacy length field is > 0xFF bits, ignore
634 * this check. (GPE registers can be larger than the
635 * 64-bit GAS structure can accommodate, 0xFF bits).
636 */
637 if ((ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
638 (Address64->BitWidth != ACPI_MUL_8 (Length)))
639 {
641 "32/64X length mismatch in FADT/%s: %u/%u",
642 Name, ACPI_MUL_8 (Length), Address64->BitWidth));
643 }
644 }
645
646 /*
647 * Hardware register access code always uses the 64-bit fields.
648 * So if the 64-bit field is zero or is to be overridden,
649 * initialize it with the 32-bit fields.
650 * Note that when the 32-bit address favor is specified, the
651 * 64-bit fields are always re-initialized so that
652 * AccessSize/BitWidth/BitOffset fields can be correctly
653 * configured to the values to trigger a 32-bit compatible
654 * access mode in the hardware register access code.
655 */
656 if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
657 {
658 AcpiTbInitGenericAddress (Address64,
660 (UINT64) Address32, Name, Flags);
661 }
662 }
663
665 {
666 /*
667 * Field is required (PM1aEvent, PM1aControl).
668 * Both the address and length must be non-zero.
669 */
670 if (!Address64->Address || !Length)
671 {
673 "Required FADT field %s has zero address and/or length: "
674 "0x%8.8X%8.8X/0x%X",
675 Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
676 }
677 }
679 {
680 /*
681 * Field is optional (PM2Control, GPE0, GPE1) AND has its own
682 * length field. If present, both the address and length must
683 * be valid.
684 */
685 if ((Address64->Address && !Length) ||
686 (!Address64->Address && Length))
687 {
689 "Optional FADT field %s has valid %s but zero %s: "
690 "0x%8.8X%8.8X/0x%X", Name,
691 (Length ? "Length" : "Address"),
692 (Length ? "Address": "Length"),
693 ACPI_FORMAT_UINT64 (Address64->Address), Length));
694 }
695 }
696 }
697}
unsigned long long UINT64
unsigned char UINT8
unsigned int UINT32
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_MUL_8(a)
Definition: acmacros.h:215
#define ACPI_BIOS_WARNING(plist)
Definition: acoutput.h:241
#define ACPI_BIOS_ERROR(plist)
Definition: acoutput.h:243
#define AE_INFO
Definition: acoutput.h:230
struct acpi_table_fadt ACPI_TABLE_FADT
#define ACPI_FADT_V2_SIZE
Definition: actbl.h:464
#define ACPI_ADR_SPACE_SYSTEM_IO
Definition: actypes.h:862
#define ACPI_ADD_PTR(t, a, b)
Definition: actypes.h:546
#define ACPI_UINT8_MAX
Definition: actypes.h:64
struct NameRec_ * Name
Definition: cdprocs.h:460
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
const char * Name
Definition: tbfadt.c:81
UINT8 Flags
Definition: tbfadt.c:86
#define ACPI_FADT_INFO_ENTRIES
Definition: tbfadt.c:154
static UINT64 AcpiTbSelectAddress(char *RegisterName, UINT32 Address32, UINT64 Address64)
Definition: tbfadt.c:287
#define ACPI_FADT_REQUIRED
Definition: tbfadt.c:91
#define ACPI_FADT_SEPARATE_LENGTH
Definition: tbfadt.c:92
static ACPI_FADT_INFO FadtInfoTable[]
Definition: tbfadt.c:95
static void AcpiTbInitGenericAddress(ACPI_GENERIC_ADDRESS *GenericAddress, UINT8 SpaceId, UINT8 ByteWidth, UINT64 Address, const char *RegisterName, UINT8 Flags)
Definition: tbfadt.c:210
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by AcpiTbCreateLocalFadt().

◆ AcpiTbCreateLocalFadt()

void AcpiTbCreateLocalFadt ( ACPI_TABLE_HEADER Table,
UINT32  Length 
)

Definition at line 423 of file tbfadt.c.

426{
427
428 /*
429 * Check if the FADT is larger than the largest table that we expect
430 * (typically the current ACPI specification version). If so, truncate
431 * the table, and issue a warning.
432 */
433 if (Length > sizeof (ACPI_TABLE_FADT))
434 {
436 "FADT (revision %u) is longer than %s length, "
437 "truncating length %u to %u",
440 }
441
442 /* Clear the entire local FADT */
443
444 memset (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT));
445
446 /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
447
448 memcpy (&AcpiGbl_FADT, Table,
449 ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
450
451 /* Take a copy of the Hardware Reduced flag */
452
453 AcpiGbl_ReducedHardware = FALSE;
454 if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED)
455 {
456 AcpiGbl_ReducedHardware = TRUE;
457 }
458
459 /* Convert the local copy of the FADT to the common internal format */
460
462
463 /* Initialize the global ACPI register structures */
464
466}
#define ACPI_FADT_CONFORMANCE
Definition: actbl.h:469
#define ACPI_FADT_HW_REDUCED
Definition: actbl.h:356
#define ACPI_MIN(a, b)
Definition: actypes.h:535
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ASMGENDATA Table[]
Definition: genincdata.c:61
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memset(x, y, z)
Definition: compat.h:39
static void AcpiTbSetupFadtRegisters(void)
Definition: tbfadt.c:714
static void AcpiTbConvertFadt(void)
Definition: tbfadt.c:514
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by AcpiTbParseFadt().

◆ AcpiTbInitGenericAddress()

static void AcpiTbInitGenericAddress ( ACPI_GENERIC_ADDRESS GenericAddress,
UINT8  SpaceId,
UINT8  ByteWidth,
UINT64  Address,
const char RegisterName,
UINT8  Flags 
)
static

Definition at line 210 of file tbfadt.c.

217{
218 UINT8 BitWidth;
219
220
221 /*
222 * Bit width field in the GAS is only one byte long, 255 max.
223 * Check for BitWidth overflow in GAS.
224 */
225 BitWidth = (UINT8) (ByteWidth * 8);
226 if (ByteWidth > 31) /* (31*8)=248, (32*8)=256 */
227 {
228 /*
229 * No error for GPE blocks, because we do not use the BitWidth
230 * for GPEs, the legacy length (ByteWidth) is used instead to
231 * allow for a large number of GPEs.
232 */
234 {
236 "%s - 32-bit FADT register is too long (%u bytes, %u bits) "
237 "to convert to GAS struct - 255 bits max, truncating",
238 RegisterName, ByteWidth, (ByteWidth * 8)));
239 }
240
241 BitWidth = 255;
242 }
243
244 /*
245 * The 64-bit Address field is non-aligned in the byte packed
246 * GAS struct.
247 */
248 ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
249
250 /* All other fields are byte-wide */
251
252 GenericAddress->SpaceId = SpaceId;
253 GenericAddress->BitWidth = BitWidth;
254 GenericAddress->BitOffset = 0;
255 GenericAddress->AccessWidth = 0; /* Access width ANY */
256}
#define ACPI_MOVE_64_TO_64(d, s)
Definition: acmacros.h:155
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:832
static WCHAR Address[46]
Definition: ping.c:68
#define ACPI_FADT_GPE_REGISTER
Definition: tbfadt.c:93

Referenced by AcpiTbConvertFadt(), and AcpiTbSetupFadtRegisters().

◆ AcpiTbParseFadt()

void AcpiTbParseFadt ( void  )

Definition at line 339 of file tbfadt.c.

341{
344 ACPI_TABLE_DESC *FadtDesc;
346
347
348 /*
349 * The FADT has multiple versions with different lengths,
350 * and it contains pointers to both the DSDT and FACS tables.
351 *
352 * Get a local copy of the FADT and convert it to a common format
353 * Map entire FADT, assumed to be smaller than one page.
354 */
355 FadtDesc = &AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex];
356 Status = AcpiTbGetTable (FadtDesc, &Table);
357 if (ACPI_FAILURE (Status))
358 {
359 return;
360 }
361 Length = FadtDesc->Length;
362
363 /*
364 * Validate the FADT checksum before we copy the table. Ignore
365 * checksum error as we want to try to get the DSDT and FACS.
366 */
368
369 /* Create a local copy of the FADT in common ACPI 2.0+ format */
370
372
373 /* All done with the real FADT, unmap it */
374
375 AcpiTbPutTable (FadtDesc);
376
377 /* Obtain the DSDT and FACS tables via their addresses within the FADT */
378
380 (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
382 &AcpiGbl_DsdtIndex);
383
384 /* If Hardware Reduced flag is set, there is no FACS */
385
386 if (!AcpiGbl_ReducedHardware)
387 {
388 if (AcpiGbl_FADT.Facs)
389 {
391 (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
393 &AcpiGbl_FacsIndex);
394 }
395 if (AcpiGbl_FADT.XFacs)
396 {
398 (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
400 &AcpiGbl_XFacsIndex);
401 }
402 }
403}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiTbGetTable(ACPI_TABLE_DESC *TableDesc, ACPI_TABLE_HEADER **OutTable)
Definition: tbutils.c:434
void AcpiTbPutTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbutils.c:491
ACPI_STATUS AcpiTbInstallStandardTable(ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table, BOOLEAN Reload, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbinstal.c:139
#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL
Definition: actbl.h:430
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiUtVerifyChecksum(ACPI_TABLE_HEADER *Table, UINT32 Length)
Definition: utcksum.c:74
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
UINT32 Length
Definition: actbl.h:405
void AcpiTbCreateLocalFadt(ACPI_TABLE_HEADER *Table, UINT32 Length)
Definition: tbfadt.c:423

Referenced by AcpiTbParseRootTable().

◆ AcpiTbSelectAddress()

static UINT64 AcpiTbSelectAddress ( char RegisterName,
UINT32  Address32,
UINT64  Address64 
)
static

Definition at line 287 of file tbfadt.c.

291{
292
293 if (!Address64)
294 {
295 /* 64-bit address is zero, use 32-bit address */
296
297 return ((UINT64) Address32);
298 }
299
300 if (Address32 &&
301 (Address64 != (UINT64) Address32))
302 {
303 /* Address mismatch between 32-bit and 64-bit versions */
304
306 "32/64X %s address mismatch in FADT: "
307 "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
308 RegisterName, Address32, ACPI_FORMAT_UINT64 (Address64),
309 AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
310
311 /* 32-bit address override */
312
313 if (AcpiGbl_Use32BitFadtAddresses)
314 {
315 return ((UINT64) Address32);
316 }
317 }
318
319 /* Default is to use the 64-bit address */
320
321 return (Address64);
322}

Referenced by AcpiTbConvertFadt().

◆ AcpiTbSetupFadtRegisters()

static void AcpiTbSetupFadtRegisters ( void  )
static

Definition at line 714 of file tbfadt.c.

716{
717 ACPI_GENERIC_ADDRESS *Target64;
718 ACPI_GENERIC_ADDRESS *Source64;
719 UINT8 Pm1RegisterByteWidth;
720 UINT32 i;
721
722
723 /*
724 * Optionally check all register lengths against the default values and
725 * update them if they are incorrect.
726 */
727 if (AcpiGbl_UseDefaultRegisterWidths)
728 {
729 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
730 {
731 Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
732 FadtInfoTable[i].Address64);
733
734 /*
735 * If a valid register (Address != 0) and the (DefaultLength > 0)
736 * (Not a GPE register), then check the width against the default.
737 */
738 if ((Target64->Address) &&
740 (FadtInfoTable[i].DefaultLength != Target64->BitWidth))
741 {
743 "Invalid length for FADT/%s: %u, using default %u",
744 FadtInfoTable[i].Name, Target64->BitWidth,
746
747 /* Incorrect size, set width to the default */
748
750 }
751 }
752 }
753
754 /*
755 * Get the length of the individual PM1 registers (enable and status).
756 * Each register is defined to be (event block length / 2). Extra divide
757 * by 8 converts bits to bytes.
758 */
759 Pm1RegisterByteWidth = (UINT8)
760 ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth);
761
762 /*
763 * Calculate separate GAS structs for the PM1x (A/B) Status and Enable
764 * registers. These addresses do not appear (directly) in the FADT, so it
765 * is useful to pre-calculate them from the PM1 Event Block definitions.
766 *
767 * The PM event blocks are split into two register blocks, first is the
768 * PM Status Register block, followed immediately by the PM Enable
769 * Register block. Each is of length (Pm1EventLength/2)
770 *
771 * Note: The PM1A event block is required by the ACPI specification.
772 * However, the PM1B event block is optional and is rarely, if ever,
773 * used.
774 */
775
776 for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++)
777 {
778 Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
780
781 if (Source64->Address)
782 {
784 Source64->SpaceId, Pm1RegisterByteWidth,
785 Source64->Address +
786 (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
787 "PmRegisters", 0);
788 }
789 }
790}
#define ACPI_DIV_16(a)
Definition: acmacros.h:218
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
UINT8 DefaultLength
Definition: tbfadt.c:85
UINT8 RegisterNum
Definition: tbfadt.c:164
#define ACPI_FADT_PM_INFO_ENTRIES
Definition: tbfadt.c:187
static ACPI_FADT_PM_INFO FadtPmInfoTable[]
Definition: tbfadt.c:168
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by AcpiTbCreateLocalFadt().

Variable Documentation

◆ FadtInfoTable

ACPI_FADT_INFO FadtInfoTable[]
static

Definition at line 95 of file tbfadt.c.

Referenced by AcpiTbConvertFadt(), and AcpiTbSetupFadtRegisters().

◆ FadtPmInfoTable

ACPI_FADT_PM_INFO FadtPmInfoTable[]
static
Initial value:
=
{
{&AcpiGbl_XPm1aStatus,
ACPI_FADT_OFFSET (XPm1aEventBlock),
0},
{&AcpiGbl_XPm1aEnable,
ACPI_FADT_OFFSET (XPm1aEventBlock),
1},
{&AcpiGbl_XPm1bStatus,
ACPI_FADT_OFFSET (XPm1bEventBlock),
0},
{&AcpiGbl_XPm1bEnable,
ACPI_FADT_OFFSET (XPm1bEventBlock),
1}
}
#define ACPI_FADT_OFFSET(f)
Definition: actbl.h:446

Definition at line 168 of file tbfadt.c.

Referenced by AcpiTbSetupFadtRegisters().