hwacpi.c (151937) | hwacpi.c (167802) |
---|---|
1 2/****************************************************************************** 3 * 4 * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface | 1 2/****************************************************************************** 3 * 4 * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface |
5 * $Revision: 1.70 $ | 5 * $Revision: 1.78 $ |
6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * | 6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * |
13 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. | 13 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. |
14 * All rights reserved. 15 * 16 * 2. License 17 * 18 * 2.1. This is your license from Intel Corp. under its intellectual property 19 * rights. You may have additional license terms from the party that provided 20 * you this software, covering your right to use that party's intellectual 21 * property rights. --- 99 unchanged lines hidden (view full) --- 121 122 123#define _COMPONENT ACPI_HARDWARE 124 ACPI_MODULE_NAME ("hwacpi") 125 126 127/****************************************************************************** 128 * | 14 * All rights reserved. 15 * 16 * 2. License 17 * 18 * 2.1. This is your license from Intel Corp. under its intellectual property 19 * rights. You may have additional license terms from the party that provided 20 * you this software, covering your right to use that party's intellectual 21 * property rights. --- 99 unchanged lines hidden (view full) --- 121 122 123#define _COMPONENT ACPI_HARDWARE 124 ACPI_MODULE_NAME ("hwacpi") 125 126 127/****************************************************************************** 128 * |
129 * FUNCTION: AcpiHwInitialize 130 * 131 * PARAMETERS: None 132 * 133 * RETURN: Status 134 * 135 * DESCRIPTION: Initialize and validate the various ACPI registers defined in 136 * the FADT. 137 * 138 ******************************************************************************/ 139 140ACPI_STATUS 141AcpiHwInitialize ( 142 void) 143{ 144 ACPI_STATUS Status; 145 146 147 ACPI_FUNCTION_TRACE ("HwInitialize"); 148 149 150 /* We must have the ACPI tables by the time we get here */ 151 152 if (!AcpiGbl_FADT) 153 { 154 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n")); 155 156 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 157 } 158 159 /* Sanity check the FADT for valid values */ 160 161 Status = AcpiUtValidateFadt (); 162 if (ACPI_FAILURE (Status)) 163 { 164 return_ACPI_STATUS (Status); 165 } 166 167 return_ACPI_STATUS (AE_OK); 168} 169 170 171/****************************************************************************** 172 * | |
173 * FUNCTION: AcpiHwSetMode 174 * 175 * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY 176 * 177 * RETURN: Status 178 * 179 * DESCRIPTION: Transitions the system into the requested mode. 180 * 181 ******************************************************************************/ 182 183ACPI_STATUS 184AcpiHwSetMode ( 185 UINT32 Mode) 186{ 187 188 ACPI_STATUS Status; 189 UINT32 Retry; 190 191 | 129 * FUNCTION: AcpiHwSetMode 130 * 131 * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY 132 * 133 * RETURN: Status 134 * 135 * DESCRIPTION: Transitions the system into the requested mode. 136 * 137 ******************************************************************************/ 138 139ACPI_STATUS 140AcpiHwSetMode ( 141 UINT32 Mode) 142{ 143 144 ACPI_STATUS Status; 145 UINT32 Retry; 146 147 |
192 ACPI_FUNCTION_TRACE ("HwSetMode"); | 148 ACPI_FUNCTION_TRACE (HwSetMode); |
193 194 /* 195 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, 196 * system does not support mode transition. 197 */ | 149 150 /* 151 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, 152 * system does not support mode transition. 153 */ |
198 if (!AcpiGbl_FADT->SmiCmd) | 154 if (!AcpiGbl_FADT.SmiCommand) |
199 { | 155 { |
200 ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n")); | 156 ACPI_ERROR ((AE_INFO, "No SMI_CMD in FADT, mode transition failed")); |
201 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); 202 } 203 204 /* 205 * ACPI 2.0 clarified the meaning of ACPI_ENABLE and ACPI_DISABLE 206 * in FADT: If it is zero, enabling or disabling is not supported. 207 * As old systems may have used zero for mode transition, 208 * we make sure both the numbers are zero to determine these 209 * transitions are not supported. 210 */ | 157 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); 158 } 159 160 /* 161 * ACPI 2.0 clarified the meaning of ACPI_ENABLE and ACPI_DISABLE 162 * in FADT: If it is zero, enabling or disabling is not supported. 163 * As old systems may have used zero for mode transition, 164 * we make sure both the numbers are zero to determine these 165 * transitions are not supported. 166 */ |
211 if (!AcpiGbl_FADT->AcpiEnable && !AcpiGbl_FADT->AcpiDisable) | 167 if (!AcpiGbl_FADT.AcpiEnable && !AcpiGbl_FADT.AcpiDisable) |
212 { | 168 { |
213 ACPI_REPORT_ERROR (( 214 "No ACPI mode transition supported in this system (enable/disable both zero)\n")); | 169 ACPI_ERROR ((AE_INFO, 170 "No ACPI mode transition supported in this system (enable/disable both zero)")); |
215 return_ACPI_STATUS (AE_OK); 216 } 217 218 switch (Mode) 219 { 220 case ACPI_SYS_MODE_ACPI: 221 222 /* BIOS should have disabled ALL fixed and GP events */ 223 | 171 return_ACPI_STATUS (AE_OK); 172 } 173 174 switch (Mode) 175 { 176 case ACPI_SYS_MODE_ACPI: 177 178 /* BIOS should have disabled ALL fixed and GP events */ 179 |
224 Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, 225 (UINT32) AcpiGbl_FADT->AcpiEnable, 8); | 180 Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, 181 (UINT32) AcpiGbl_FADT.AcpiEnable, 8); |
226 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); 227 break; 228 229 case ACPI_SYS_MODE_LEGACY: 230 231 /* 232 * BIOS should clear all fixed status bits and restore fixed event 233 * enable bits to default 234 */ | 182 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); 183 break; 184 185 case ACPI_SYS_MODE_LEGACY: 186 187 /* 188 * BIOS should clear all fixed status bits and restore fixed event 189 * enable bits to default 190 */ |
235 Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, 236 (UINT32) AcpiGbl_FADT->AcpiDisable, 8); | 191 Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, 192 (UINT32) AcpiGbl_FADT.AcpiDisable, 8); |
237 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 238 "Attempting to enable Legacy (non-ACPI) mode\n")); 239 break; 240 241 default: 242 return_ACPI_STATUS (AE_BAD_PARAMETER); 243 } 244 245 if (ACPI_FAILURE (Status)) 246 { | 193 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 194 "Attempting to enable Legacy (non-ACPI) mode\n")); 195 break; 196 197 default: 198 return_ACPI_STATUS (AE_BAD_PARAMETER); 199 } 200 201 if (ACPI_FAILURE (Status)) 202 { |
247 ACPI_REPORT_ERROR (("Could not write mode change, %s\n", 248 AcpiFormatException (Status))); | 203 ACPI_EXCEPTION ((AE_INFO, Status, 204 "Could not write ACPI mode change")); |
249 return_ACPI_STATUS (Status); 250 } 251 252 /* 253 * Some hardware takes a LONG time to switch modes. Give them 3 sec to 254 * do so, but allow faster systems to proceed more quickly. 255 */ 256 Retry = 3000; --- 4 unchanged lines hidden (view full) --- 261 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", 262 Mode)); 263 return_ACPI_STATUS (AE_OK); 264 } 265 AcpiOsStall(1000); 266 Retry--; 267 } 268 | 205 return_ACPI_STATUS (Status); 206 } 207 208 /* 209 * Some hardware takes a LONG time to switch modes. Give them 3 sec to 210 * do so, but allow faster systems to proceed more quickly. 211 */ 212 Retry = 3000; --- 4 unchanged lines hidden (view full) --- 217 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", 218 Mode)); 219 return_ACPI_STATUS (AE_OK); 220 } 221 AcpiOsStall(1000); 222 Retry--; 223 } 224 |
269 ACPI_REPORT_ERROR (("Hardware never changed modes\n")); | 225 ACPI_ERROR ((AE_INFO, "Hardware did not change modes")); |
270 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); 271} 272 273 274/******************************************************************************* 275 * 276 * FUNCTION: AcpiHwGetMode 277 * --- 9 unchanged lines hidden (view full) --- 287UINT32 288AcpiHwGetMode ( 289 void) 290{ 291 ACPI_STATUS Status; 292 UINT32 Value; 293 294 | 226 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); 227} 228 229 230/******************************************************************************* 231 * 232 * FUNCTION: AcpiHwGetMode 233 * --- 9 unchanged lines hidden (view full) --- 243UINT32 244AcpiHwGetMode ( 245 void) 246{ 247 ACPI_STATUS Status; 248 UINT32 Value; 249 250 |
295 ACPI_FUNCTION_TRACE ("HwGetMode"); | 251 ACPI_FUNCTION_TRACE (HwGetMode); |
296 297 298 /* 299 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, 300 * system does not support mode transition. 301 */ | 252 253 254 /* 255 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, 256 * system does not support mode transition. 257 */ |
302 if (!AcpiGbl_FADT->SmiCmd) | 258 if (!AcpiGbl_FADT.SmiCommand) |
303 { 304 return_UINT32 (ACPI_SYS_MODE_ACPI); 305 } 306 | 259 { 260 return_UINT32 (ACPI_SYS_MODE_ACPI); 261 } 262 |
307 Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK); | 263 Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value); |
308 if (ACPI_FAILURE (Status)) 309 { 310 return_UINT32 (ACPI_SYS_MODE_LEGACY); 311 } 312 313 if (Value) 314 { 315 return_UINT32 (ACPI_SYS_MODE_ACPI); 316 } 317 else 318 { 319 return_UINT32 (ACPI_SYS_MODE_LEGACY); 320 } 321} | 264 if (ACPI_FAILURE (Status)) 265 { 266 return_UINT32 (ACPI_SYS_MODE_LEGACY); 267 } 268 269 if (Value) 270 { 271 return_UINT32 (ACPI_SYS_MODE_ACPI); 272 } 273 else 274 { 275 return_UINT32 (ACPI_SYS_MODE_LEGACY); 276 } 277} |