Deleted Added
sdiff udiff text old ( 80062 ) new ( 82367 )
full compact
1/******************************************************************************
2 *
3 * Module Name: evevent - Fixed and General Purpose AcpiEvent
4 * handling and dispatch
5 * $Revision: 46 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

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

147
148 FUNCTION_TRACE ("EvInitialize");
149
150
151 /* Make sure we have ACPI tables */
152
153 if (!AcpiGbl_DSDT)
154 {
155 DEBUG_PRINTP (ACPI_WARN, ("No ACPI tables present!\n"));
156 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
157 }
158
159
160 /* Make sure the BIOS supports ACPI mode */
161
162 if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities())
163 {
164 DEBUG_PRINTP (ACPI_WARN, ("ACPI Mode is not supported!\n"));
165 return_ACPI_STATUS (AE_ERROR);
166 }
167
168
169 AcpiGbl_OriginalMode = AcpiHwGetMode();
170
171 /*
172 * Initialize the Fixed and General Purpose AcpiEvents prior. This is
173 * done prior to enabling SCIs to prevent interrupts from occuring
174 * before handers are installed.
175 */
176
177 Status = AcpiEvFixedEventInitialize ();
178 if (ACPI_FAILURE (Status))
179 {
180 DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize fixed events.\n"));
181 return_ACPI_STATUS (Status);
182 }
183
184 Status = AcpiEvGpeInitialize ();
185 if (ACPI_FAILURE (Status))
186 {
187 DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize general purpose events.\n"));
188 return_ACPI_STATUS (Status);
189 }
190
191 /* Install the SCI handler */
192
193 Status = AcpiEvInstallSciHandler ();
194 if (ACPI_FAILURE (Status))
195 {
196 DEBUG_PRINTP (ACPI_FATAL, ("Unable to install System Control Interrupt Handler\n"));
197 return_ACPI_STATUS (Status);
198 }
199
200
201 /* Install handlers for control method GPE handlers (_Lxx, _Exx) */
202
203 Status = AcpiEvInitGpeControlMethods ();
204 if (ACPI_FAILURE (Status))
205 {
206 DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize Gpe control methods\n"));
207 return_ACPI_STATUS (Status);
208 }
209
210 /* Install the handler for the Global Lock */
211
212 Status = AcpiEvInitGlobalLockHandler ();
213 if (ACPI_FAILURE (Status))
214 {
215 DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize Global Lock handler\n"));
216 return_ACPI_STATUS (Status);
217 }
218
219
220 return_ACPI_STATUS (Status);
221}
222
223

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

264 *
265 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
266 *
267 * DESCRIPTION: Checks the PM status register for fixed events
268 *
269 ******************************************************************************/
270
271UINT32
272AcpiEvFixedEventDetect(void)
273{
274 UINT32 IntStatus = INTERRUPT_NOT_HANDLED;
275 UINT32 StatusRegister;
276 UINT32 EnableRegister;
277
278 /*
279 * Read the fixed feature status and enable registers, as all the cases
280 * depend on their values.
281 */
282
283 StatusRegister = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
284 EnableRegister = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
285
286 DEBUG_PRINT (TRACE_INTERRUPTS,
287 ("Fixed AcpiEvent Block: Enable %08X Status %08X\n",
288 EnableRegister, StatusRegister));
289
290
291 /* power management timer roll over */
292
293 if ((StatusRegister & ACPI_STATUS_PMTIMER) &&
294 (EnableRegister & ACPI_ENABLE_PMTIMER))
295 {

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

454 /*
455 * Allocate the Gpe information block
456 */
457
458 AcpiGbl_GpeRegisters = ACPI_MEM_CALLOCATE (AcpiGbl_GpeRegisterCount *
459 sizeof (ACPI_GPE_REGISTERS));
460 if (!AcpiGbl_GpeRegisters)
461 {
462 DEBUG_PRINTP (ACPI_ERROR,
463 ("Could not allocate the GpeRegisters block\n"));
464 return_ACPI_STATUS (AE_NO_MEMORY);
465 }
466
467 /*
468 * Allocate the Gpe dispatch handler block
469 * There are eight distinct GP events per register.
470 * Initialization to zeros is sufficient
471 */
472
473 AcpiGbl_GpeInfo = ACPI_MEM_CALLOCATE (MUL_8 (AcpiGbl_GpeRegisterCount) *
474 sizeof (ACPI_GPE_LEVEL_INFO));
475 if (!AcpiGbl_GpeInfo)
476 {
477 ACPI_MEM_FREE (AcpiGbl_GpeRegisters);
478 DEBUG_PRINTP (ACPI_ERROR, ("Could not allocate the GpeInfo block\n"));
479 return_ACPI_STATUS (AE_NO_MEMORY);
480 }
481
482 /* Set the Gpe validation table to GPE_INVALID */
483
484 MEMSET (AcpiGbl_GpeValid, (int) ACPI_GPE_INVALID, ACPI_NUM_GPE);
485
486 /*

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

546 * by writing a '0'.
547 */
548 AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00, 8);
549 AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF, 8);
550
551 RegisterIndex++;
552 }
553
554 DEBUG_PRINTP (ACPI_INFO, ("GPE registers: %X@%p (Blk0) %X@%p (Blk1)\n",
555 Gpe0RegisterCount, AcpiGbl_FADT->XGpe0Blk.Address, Gpe1RegisterCount,
556 AcpiGbl_FADT->XGpe1Blk.Address));
557
558 return_ACPI_STATUS (AE_OK);
559}
560
561
562/*******************************************************************************

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

611 else if (Name[1] == 'E')
612 {
613 Type = ACPI_EVENT_EDGE_TRIGGERED;
614 }
615 else
616 {
617 /* Unknown method type, just ignore it! */
618
619 DEBUG_PRINTP (ACPI_ERROR,
620 ("Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
621 Name));
622 return (AE_OK);
623 }
624
625 /* Convert the last two characters of the name to the Gpe Number */
626
627 GpeNumber = STRTOUL (&Name[2], NULL, 16);
628 if (GpeNumber == ACPI_UINT32_MAX)
629 {
630 /* Conversion failed; invalid method, just ignore it */
631
632 DEBUG_PRINTP (ACPI_ERROR,
633 ("Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n",
634 Name));
635 return (AE_OK);
636 }
637
638 /* Ensure that we have a valid GPE number */
639
640 if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
641 {

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

654
655
656 /*
657 * Enable the GPE (SCIs should be disabled at this point)
658 */
659
660 AcpiHwEnableGpe (GpeNumber);
661
662 DEBUG_PRINTP (ACPI_INFO, ("Registered GPE method %s as GPE number %X\n",
663 Name, GpeNumber));
664 return (AE_OK);
665}
666
667
668/*******************************************************************************
669 *
670 * FUNCTION: AcpiEvInitGpeControlMethods

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

723{
724 UINT32 IntStatus = INTERRUPT_NOT_HANDLED;
725 UINT32 i;
726 UINT32 j;
727 UINT8 EnabledStatusByte;
728 UINT8 BitMask;
729
730
731 /*
732 * Read all of the 8-bit GPE status and enable registers
733 * in both of the register blocks, saving all of it.
734 * Find all currently active GP events.
735 */
736 for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
737 {
738 AcpiOsReadPort (AcpiGbl_GpeRegisters[i].StatusAddr,
739 &AcpiGbl_GpeRegisters[i].Status, 8);
740
741 AcpiOsReadPort (AcpiGbl_GpeRegisters[i].EnableAddr,
742 &AcpiGbl_GpeRegisters[i].Enable, 8);
743
744 DEBUG_PRINT (TRACE_INTERRUPTS,
745 ("GPE block at %X - Enable %08X Status %08X\n",
746 AcpiGbl_GpeRegisters[i].EnableAddr,
747 AcpiGbl_GpeRegisters[i].Status,
748 AcpiGbl_GpeRegisters[i].Enable));
749
750 /* First check if there is anything active at all in this register */
751
752 EnabledStatusByte = (UINT8) (AcpiGbl_GpeRegisters[i].Status &
753 AcpiGbl_GpeRegisters[i].Enable);

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

871 FUNCTION_TRACE ("EvGpeDispatch");
872
873
874 /*
875 * Valid GPE number?
876 */
877 if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
878 {
879 DEBUG_PRINTP (ACPI_ERROR, ("Invalid GPE bit [%X].\n", GpeNumber));
880 return_VALUE (INTERRUPT_NOT_HANDLED);
881 }
882
883 /*
884 * Disable the GPE.
885 */
886 AcpiHwDisableGpe (GpeNumber);
887

--- 67 unchanged lines hidden ---