Deleted Added
full compact
5c5
< * $Revision: 46 $
---
> * $Revision: 47 $
160a161,174
>
> /*
> * Save the initial state of the ACPI event enable registers, so
> * we can restore them when we exit. We probably won't exit, though.
> *
> * The location of the PM1aEvtBlk enable registers is defined as the
> * base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further
> * fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset
> * for the enable registers is always 2 from the base. It is hard
> * coded here. If this changes in the spec, this code will need to
> * be modified. The PM1bEvtBlk behaves as expected.
> */
> AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead (
> ACPI_MTX_LOCK, PM1_EN);
162d175
< /* Identify current ACPI/legacy mode */
164c177,182
< switch (AcpiGbl_SystemFlags & SYS_MODES_MASK)
---
> /*
> * The GPEs behave similarly, except that the length of the register
> * block is not fixed, so the buffer must be allocated with malloc
> */
> if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
> AcpiGbl_FADT->Gpe0BlkLen)
166c184
< case (SYS_MODE_ACPI):
---
> /* GPE0 specified in FADT */
168,170c186,191
< AcpiGbl_OriginalMode = SYS_MODE_ACPI;
< ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System supports ACPI mode only.\n"));
< break;
---
> AcpiGbl_Gpe0EnableRegisterSave = ACPI_MEM_ALLOCATE (
> DIV_2 (AcpiGbl_FADT->Gpe0BlkLen));
> if (!AcpiGbl_Gpe0EnableRegisterSave)
> {
> return_ACPI_STATUS (AE_NO_MEMORY);
> }
171a193
> /* Save state of GPE0 enable bits */
173,183c195
< case (SYS_MODE_LEGACY):
<
< AcpiGbl_OriginalMode = SYS_MODE_LEGACY;
< ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
< "Tables loaded from buffer, hardware assumed to support LEGACY mode only.\n"));
< break;
<
<
< case (SYS_MODE_ACPI | SYS_MODE_LEGACY):
<
< if (AcpiHwGetMode () == SYS_MODE_ACPI)
---
> for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
185c197,198
< AcpiGbl_OriginalMode = SYS_MODE_ACPI;
---
> AcpiGbl_Gpe0EnableRegisterSave[Index] =
> (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index);
187,190c200
< else
< {
< AcpiGbl_OriginalMode = SYS_MODE_LEGACY;
< }
---
> }
192,198c202,204
< ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
< "System supports both ACPI and LEGACY modes.\n"));
<
< ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
< "System is currently in %s mode.\n",
< (AcpiGbl_OriginalMode == SYS_MODE_ACPI) ? "ACPI" : "LEGACY"));
< break;
---
> else
> {
> AcpiGbl_Gpe0EnableRegisterSave = NULL;
201,202c207,208
<
< if (AcpiGbl_SystemFlags & SYS_MODE_ACPI)
---
> if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
> AcpiGbl_FADT->Gpe1BlkLen)
204c210
< /* Target system supports ACPI mode */
---
> /* GPE1 defined */
206,229c212,214
< /*
< * The purpose of this code is to save the initial state
< * of the ACPI event enable registers. An exit function will be
< * registered which will restore this state when the application
< * exits. The exit function will also clear all of the ACPI event
< * status bits prior to restoring the original mode.
< *
< * The location of the PM1aEvtBlk enable registers is defined as the
< * base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further
< * fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset
< * for the enable registers is always 2 from the base. It is hard
< * coded here. If this changes in the spec, this code will need to
< * be modified. The PM1bEvtBlk behaves as expected.
< */
< AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead (
< ACPI_MTX_LOCK, PM1_EN);
<
<
< /*
< * The GPEs behave similarly, except that the length of the register
< * block is not fixed, so the buffer must be allocated with malloc
< */
< if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
< AcpiGbl_FADT->Gpe0BlkLen)
---
> AcpiGbl_Gpe1EnableRegisterSave = ACPI_MEM_ALLOCATE (
> DIV_2 (AcpiGbl_FADT->Gpe1BlkLen));
> if (!AcpiGbl_Gpe1EnableRegisterSave)
231,246c216
< /* GPE0 specified in FADT */
<
< AcpiGbl_Gpe0EnableRegisterSave = ACPI_MEM_ALLOCATE (
< DIV_2 (AcpiGbl_FADT->Gpe0BlkLen));
< if (!AcpiGbl_Gpe0EnableRegisterSave)
< {
< return_ACPI_STATUS (AE_NO_MEMORY);
< }
<
< /* Save state of GPE0 enable bits */
<
< for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
< {
< AcpiGbl_Gpe0EnableRegisterSave[Index] =
< (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index);
< }
---
> return_ACPI_STATUS (AE_NO_MEMORY);
249,252c219
< else
< {
< AcpiGbl_Gpe0EnableRegisterSave = NULL;
< }
---
> /* save state of GPE1 enable bits */
254,255c221
< if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
< AcpiGbl_FADT->Gpe1BlkLen)
---
> for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
257,272c223,224
< /* GPE1 defined */
<
< AcpiGbl_Gpe1EnableRegisterSave = ACPI_MEM_ALLOCATE (
< DIV_2 (AcpiGbl_FADT->Gpe1BlkLen));
< if (!AcpiGbl_Gpe1EnableRegisterSave)
< {
< return_ACPI_STATUS (AE_NO_MEMORY);
< }
<
< /* save state of GPE1 enable bits */
<
< for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
< {
< AcpiGbl_Gpe1EnableRegisterSave[Index] =
< (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index);
< }
---
> AcpiGbl_Gpe1EnableRegisterSave[Index] =
> (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index);
273a226
> }
275,278c228,230
< else
< {
< AcpiGbl_Gpe1EnableRegisterSave = NULL;
< }
---
> else
> {
> AcpiGbl_Gpe1EnableRegisterSave = NULL;
371,435d322
<
<
< /******************************************************************************
< *
< * FUNCTION: AcpiHwGetModeCapabilities
< *
< * PARAMETERS: none
< *
< * RETURN: logical OR of SYS_MODE_ACPI and SYS_MODE_LEGACY determined at initial
< * system state.
< *
< * DESCRIPTION: Returns capablities of system
< *
< ******************************************************************************/
<
< UINT32
< AcpiHwGetModeCapabilities (void)
< {
<
< FUNCTION_TRACE ("HwGetModeCapabilities");
<
<
< if (!(AcpiGbl_SystemFlags & SYS_MODES_MASK))
< {
< if (AcpiHwGetMode () == SYS_MODE_LEGACY)
< {
< /*
< * Assume that if this call is being made, AcpiInit has been called
< * and ACPI support has been established by the presence of the
< * tables. Therefore since we're in SYS_MODE_LEGACY, the system
< * must support both modes
< */
< AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
< }
<
< else
< {
< /* TBD: [Investigate] !!! this may be unsafe... */
< /*
< * system is is ACPI mode, so try to switch back to LEGACY to see if
< * it is supported
< */
< AcpiHwSetMode (SYS_MODE_LEGACY);
<
< if (AcpiHwGetMode () == SYS_MODE_LEGACY)
< {
< /* Now in SYS_MODE_LEGACY, so both are supported */
<
< AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
< AcpiHwSetMode (SYS_MODE_ACPI);
< }
<
< else
< {
< /* Still in SYS_MODE_ACPI so this must be an ACPI only system */
<
< AcpiGbl_SystemFlags |= SYS_MODE_ACPI;
< }
< }
< }
<
< return_VALUE (AcpiGbl_SystemFlags & SYS_MODES_MASK);
< }
<
<