Deleted Added
sdiff udiff text old ( 85756 ) new ( 87031 )
full compact
1
2/******************************************************************************
3 *
4 * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
5 * $Revision: 47 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

--- 139 unchanged lines hidden (view full) ---

153 if (!AcpiGbl_FADT)
154 {
155 AcpiGbl_RestoreAcpiChipset = FALSE;
156
157 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT!\n"));
158
159 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
160 }
161
162 /*
163 * Save the initial state of the ACPI event enable registers, so
164 * we can restore them when we exit. We probably won't exit, though.
165 *
166 * The location of the PM1aEvtBlk enable registers is defined as the
167 * base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further
168 * fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset
169 * for the enable registers is always 2 from the base. It is hard
170 * coded here. If this changes in the spec, this code will need to
171 * be modified. The PM1bEvtBlk behaves as expected.
172 */
173 AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead (
174 ACPI_MTX_LOCK, PM1_EN);
175
176
177 /*
178 * The GPEs behave similarly, except that the length of the register
179 * block is not fixed, so the buffer must be allocated with malloc
180 */
181 if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
182 AcpiGbl_FADT->Gpe0BlkLen)
183 {
184 /* GPE0 specified in FADT */
185
186 AcpiGbl_Gpe0EnableRegisterSave = ACPI_MEM_ALLOCATE (
187 DIV_2 (AcpiGbl_FADT->Gpe0BlkLen));
188 if (!AcpiGbl_Gpe0EnableRegisterSave)
189 {
190 return_ACPI_STATUS (AE_NO_MEMORY);
191 }
192
193 /* Save state of GPE0 enable bits */
194
195 for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
196 {
197 AcpiGbl_Gpe0EnableRegisterSave[Index] =
198 (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index);
199 }
200 }
201
202 else
203 {
204 AcpiGbl_Gpe0EnableRegisterSave = NULL;
205 }
206
207 if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
208 AcpiGbl_FADT->Gpe1BlkLen)
209 {
210 /* GPE1 defined */
211
212 AcpiGbl_Gpe1EnableRegisterSave = ACPI_MEM_ALLOCATE (
213 DIV_2 (AcpiGbl_FADT->Gpe1BlkLen));
214 if (!AcpiGbl_Gpe1EnableRegisterSave)
215 {
216 return_ACPI_STATUS (AE_NO_MEMORY);
217 }
218
219 /* save state of GPE1 enable bits */
220
221 for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
222 {
223 AcpiGbl_Gpe1EnableRegisterSave[Index] =
224 (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index);
225 }
226 }
227
228 else
229 {
230 AcpiGbl_Gpe1EnableRegisterSave = NULL;
231 }
232
233 return_ACPI_STATUS (Status);
234}
235
236
237/******************************************************************************
238 *

--- 76 unchanged lines hidden (view full) ---

315 {
316 return_VALUE (SYS_MODE_ACPI);
317 }
318 else
319 {
320 return_VALUE (SYS_MODE_LEGACY);
321 }
322}