Question about the code in source/components/hardware/hwxfsleep.c
A message that is not in the archive (sent off-list or not yet received): [email protected]
Kein Yuan
Hi ACPICA experts, A quick question,
File: source/components/hardware/hwxfsleep.cFunction: AcpiHwSetFirmwareWakingVector
static ACPI_STATUSAcpiHwSetFirmwareWakingVector ( ACPI_TABLE_FACS *Facs, ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_PHYSICAL_ADDRESS PhysicalAddress64){ ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector);
/* * According to the ACPI specification 2.0c and later, the 64-bit * waking vector should be cleared and the 32-bit waking vector should * be used, unless we want the wake-up code to be called by the BIOS in * Protected Mode. Some systems (for example HP dv5-1004nr) are known * to fail to resume if the 64-bit vector is used. */
/* Set the 32-bit vector */
Facs->FirmwareWakingVector = (UINT32) PhysicalAddress;
if (Facs->Length > 32) // ---------------------> Question for this compare { if (Facs->Version >= 1) { /* Set the 64-bit vector */
Facs->XFirmwareWakingVector = PhysicalAddress64; } else { /* Clear the 64-bit vector if it exists */
Facs->XFirmwareWakingVector = 0; } }
return_ACPI_STATUS (AE_OK);}
Since the FACS structure defined as:typedef struct acpi_table_facs{ char Signature[4]; /* ASCII table signature */ UINT32 Length; /* Length of structure, in bytes */ UINT32 HardwareSignature; /* Hardware configuration signature */ UINT32 FirmwareWakingVector; /* 32-bit physical address of the Firmware Waking Vector */ UINT32 GlobalLock; /* Global Lock for shared hardware resources */ UINT32 Flags; UINT64 XFirmwareWakingVector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ UINT8 Version; /* Version of this table (ACPI 2.0+) */ UINT8 Reserved[3]; /* Reserved, must be zero */ UINT32 OspmFlags; /* Flags to be set by OSPM (ACPI 4.0) */ UINT8 Reserved1[24]; /* Reserved, must be zero */ } ACPI_TABLE_FACS;
May I know in what case Facs->Length < 32?
If looks to me that Facs->XFirmwareWakingVector = PhysicalAddress64; will always be executed? Thanks,Kein
Al Stone
Quoted 71 lines · Kein Yuan
Hi ACPICA experts,
A quick question,File:
source/components/hardware/hwxfsleep.c
Function: AcpiHwSetFirmwareWakingVectorstatic
ACPI_STATUS
AcpiHwSetFirmwareWakingVector (ACPI_TABLE_FACS *Facs, ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_PHYSICAL_ADDRESS PhysicalAddress64) { ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector); /* * According to the ACPI specification 2.0c and later, the 64-bit * waking vector should be cleared and the 32-bit waking vector should * be used, unless we want the wake-up code to be called by the BIOS in * Protected Mode. Some systems (for example HP dv5-1004nr) are known * to fail to resume if the 64-bit vector is used. */ /* Set the 32-bit vector */ Facs->FirmwareWakingVector = (UINT32) PhysicalAddress; if (Facs->Length > 32) // ---------------------> Question for this compare { if (Facs->Version >= 1) { /* Set the 64-bit vector */ Facs->XFirmwareWakingVector = PhysicalAddress64; } else { /* Clear the 64-bit vector if it exists */ Facs->XFirmwareWakingVector = 0; } } return_ACPI_STATUS (AE_OK); }Since the FACS structure defined as:
typedef structacpi_table_facs
{char Signature[4]; /* ASCII table signature */ UINT32 Length; /* Length of structure, inbytes */
UINT32 HardwareSignature; /* Hardware configuration
signature */
UINT32 FirmwareWakingVector; /* 32-bit physical address
of the Firmware Waking Vector */
UINT32 GlobalLock; /* Global Lock for shared
hardware resources */
UINT32 Flags;
UINT64 XFirmwareWakingVector; /* 64-bit version of the
Firmware Waking Vector (ACPI 2.0+) */
UINT8 Version; /* Version of this table
(ACPI 2.0+) */UINT8 Reserved[3]; /* Reserved, must be zero */ UINT32 OspmFlags; /* Flags to be set by OSPM(ACPI 4.0) */
UINT8 Reserved1[24]; /* Reserved, must be zero */}
ACPI_TABLE_FACS;
Quoted 7 lines
May I know in what case
Facs->Length< 32?If looks to me that
Facs->XFirmwareWakingVector= PhysicalAddress64; will always be executed?Thanks,
Kein
IIRC, very old versions of the FACS were < 32 bytes long; those old versions did not have a XFirmwareWakingVector field, or a proper Version field. For that case, the function just returns after doing nothing. If the FACS is larger than 32 bytes, it should have a Version field, but it looks like version 1 does not have a usable XFirmwareWakingVector field -- i.e., it is defined in the struct, but is not valid until a later version of the ACPI specification where Facs->Version >= 2. So, for Version == 1, ignore the field, but for versions > 1, set the field.
Does that help?
Signature · 8 lines
ciao, al ----------------------------------- Al Stone Software Engineer Red Hat, Inc. ahs3(a)redhat.com -----------------------------------