15229e87dSLen BrownWhat:		/sys/firmware/acpi/interrupts/
25229e87dSLen BrownDate:		February 2008
35229e87dSLen BrownContact:	Len Brown <lenb@kernel.org>
45229e87dSLen BrownDescription:
55229e87dSLen Brown		All ACPI interrupts are handled via a single IRQ,
65229e87dSLen Brown		the System Control Interrupt (SCI), which appears
75229e87dSLen Brown		as "acpi" in /proc/interrupts.
85229e87dSLen Brown
95229e87dSLen Brown		However, one of the main functions of ACPI is to make
105229e87dSLen Brown		the platform understand random hardware without
115229e87dSLen Brown		special driver support.  So while the SCI handles a few
125229e87dSLen Brown		well known (fixed feature) interrupts sources, such
135229e87dSLen Brown		as the power button, it can also handle a variable
145229e87dSLen Brown		number of a "General Purpose Events" (GPE).
155229e87dSLen Brown
165229e87dSLen Brown		A GPE vectors to a specified handler in AML, which
175229e87dSLen Brown		can do a anything the BIOS writer wants from
185229e87dSLen Brown		OS context.  GPE 0x12, for example, would vector
195229e87dSLen Brown		to a level or edge handler called _L12 or _E12.
205229e87dSLen Brown		The handler may do its business and return.
215229e87dSLen Brown		Or the handler may send send a Notify event
225229e87dSLen Brown		to a Linux device driver registered on an ACPI device,
235229e87dSLen Brown		such as a battery, or a processor.
245229e87dSLen Brown
255229e87dSLen Brown		To figure out where all the SCI's are coming from,
265229e87dSLen Brown		/sys/firmware/acpi/interrupts contains a file listing
275229e87dSLen Brown		every possible source, and the count of how many
285229e87dSLen Brown		times it has triggered.
295229e87dSLen Brown
305229e87dSLen Brown		$ cd /sys/firmware/acpi/interrupts
315229e87dSLen Brown		$ grep . *
325229e87dSLen Brown		error:	     0
3371b58cbbSZhang Rui		ff_gbl_lock:	   0   enable
3471b58cbbSZhang Rui		ff_pmtimer:	  0  invalid
3571b58cbbSZhang Rui		ff_pwr_btn:	  0   enable
3671b58cbbSZhang Rui		ff_rt_clk:	 2  disable
3771b58cbbSZhang Rui		ff_slp_btn:	  0  invalid
3871b58cbbSZhang Rui		gpe00:	     0	invalid
3971b58cbbSZhang Rui		gpe01:	     0	 enable
4071b58cbbSZhang Rui		gpe02:	   108	 enable
4171b58cbbSZhang Rui		gpe03:	     0	invalid
4271b58cbbSZhang Rui		gpe04:	     0	invalid
4371b58cbbSZhang Rui		gpe05:	     0	invalid
4471b58cbbSZhang Rui		gpe06:	     0	 enable
4571b58cbbSZhang Rui		gpe07:	     0	 enable
4671b58cbbSZhang Rui		gpe08:	     0	invalid
4771b58cbbSZhang Rui		gpe09:	     0	invalid
4871b58cbbSZhang Rui		gpe0A:	     0	invalid
4971b58cbbSZhang Rui		gpe0B:	     0	invalid
5071b58cbbSZhang Rui		gpe0C:	     0	invalid
5171b58cbbSZhang Rui		gpe0D:	     0	invalid
5271b58cbbSZhang Rui		gpe0E:	     0	invalid
5371b58cbbSZhang Rui		gpe0F:	     0	invalid
5471b58cbbSZhang Rui		gpe10:	     0	invalid
5571b58cbbSZhang Rui		gpe11:	     0	invalid
5671b58cbbSZhang Rui		gpe12:	     0	invalid
5771b58cbbSZhang Rui		gpe13:	     0	invalid
5871b58cbbSZhang Rui		gpe14:	     0	invalid
5971b58cbbSZhang Rui		gpe15:	     0	invalid
6071b58cbbSZhang Rui		gpe16:	     0	invalid
6171b58cbbSZhang Rui		gpe17:	  1084	 enable
6271b58cbbSZhang Rui		gpe18:	     0	 enable
6371b58cbbSZhang Rui		gpe19:	     0	invalid
6471b58cbbSZhang Rui		gpe1A:	     0	invalid
6571b58cbbSZhang Rui		gpe1B:	     0	invalid
6671b58cbbSZhang Rui		gpe1C:	     0	invalid
6771b58cbbSZhang Rui		gpe1D:	     0	invalid
6871b58cbbSZhang Rui		gpe1E:	     0	invalid
6971b58cbbSZhang Rui		gpe1F:	     0	invalid
7071b58cbbSZhang Rui		gpe_all:    1192
7171b58cbbSZhang Rui		sci:	1194
7288bea188SLen Brown		sci_not:     0
735229e87dSLen Brown
7488bea188SLen Brown		sci - The number of times the ACPI SCI
7588bea188SLen Brown		has been called and claimed an interrupt.
7688bea188SLen Brown
7788bea188SLen Brown		sci_not - The number of times the ACPI SCI
7888bea188SLen Brown		has been called and NOT claimed an interrupt.
795229e87dSLen Brown
805229e87dSLen Brown		gpe_all - count of SCI caused by GPEs.
815229e87dSLen Brown
825229e87dSLen Brown		gpeXX - count for individual GPE source
835229e87dSLen Brown
845229e87dSLen Brown		ff_gbl_lock - Global Lock
855229e87dSLen Brown
865229e87dSLen Brown		ff_pmtimer - PM Timer
875229e87dSLen Brown
885229e87dSLen Brown		ff_pwr_btn - Power Button
895229e87dSLen Brown
905229e87dSLen Brown		ff_rt_clk - Real Time Clock
915229e87dSLen Brown
925229e87dSLen Brown		ff_slp_btn - Sleep Button
935229e87dSLen Brown
945229e87dSLen Brown		error - an interrupt that can't be accounted for above.
955229e87dSLen Brown
96ed206facSZhang Rui		invalid: it's either a GPE or a Fixed Event that
9771b58cbbSZhang Rui			doesn't have an event handler.
9871b58cbbSZhang Rui
9971b58cbbSZhang Rui		disable: the GPE/Fixed Event is valid but disabled.
10071b58cbbSZhang Rui
10171b58cbbSZhang Rui		enable: the GPE/Fixed Event is valid and enabled.
10271b58cbbSZhang Rui
1035229e87dSLen Brown		Root has permission to clear any of these counters.  Eg.
1045229e87dSLen Brown		# echo 0 > gpe11
1055229e87dSLen Brown
1065229e87dSLen Brown		All counters can be cleared by clearing the total "sci":
1075229e87dSLen Brown		# echo 0 > sci
1085229e87dSLen Brown
1095229e87dSLen Brown		None of these counters has an effect on the function
1105229e87dSLen Brown		of the system, they are simply statistics.
11171b58cbbSZhang Rui
11271b58cbbSZhang Rui		Besides this, user can also write specific strings to these files
11371b58cbbSZhang Rui		to enable/disable/clear ACPI interrupts in user space, which can be
11471b58cbbSZhang Rui		used to debug some ACPI interrupt storm issues.
11571b58cbbSZhang Rui
11671b58cbbSZhang Rui		Note that only writting to VALID GPE/Fixed Event is allowed,
11771b58cbbSZhang Rui		i.e. user can only change the status of runtime GPE and
11871b58cbbSZhang Rui		Fixed Event with event handler installed.
11971b58cbbSZhang Rui
12071b58cbbSZhang Rui		Let's take power button fixed event for example, please kill acpid
12171b58cbbSZhang Rui		and other user space applications so that the machine won't shutdown
12271b58cbbSZhang Rui		when pressing the power button.
12371b58cbbSZhang Rui		# cat ff_pwr_btn
124ed206facSZhang Rui		0	enabled
12571b58cbbSZhang Rui		# press the power button for 3 times;
12671b58cbbSZhang Rui		# cat ff_pwr_btn
127ed206facSZhang Rui		3	enabled
12871b58cbbSZhang Rui		# echo disable > ff_pwr_btn
12971b58cbbSZhang Rui		# cat ff_pwr_btn
130ed206facSZhang Rui		3	disabled
13171b58cbbSZhang Rui		# press the power button for 3 times;
13271b58cbbSZhang Rui		# cat ff_pwr_btn
133ed206facSZhang Rui		3	disabled
13471b58cbbSZhang Rui		# echo enable > ff_pwr_btn
13571b58cbbSZhang Rui		# cat ff_pwr_btn
136ed206facSZhang Rui		4	enabled
13771b58cbbSZhang Rui		/*
13871b58cbbSZhang Rui		 * this is because the status bit is set even if the enable bit is cleared,
13971b58cbbSZhang Rui		 * and it triggers an ACPI fixed event when the enable bit is set again
14071b58cbbSZhang Rui		 */
14171b58cbbSZhang Rui		# press the power button for 3 times;
14271b58cbbSZhang Rui		# cat ff_pwr_btn
143ed206facSZhang Rui		7	enabled
14471b58cbbSZhang Rui		# echo disable > ff_pwr_btn
14571b58cbbSZhang Rui		# press the power button for 3 times;
14671b58cbbSZhang Rui		# echo clear > ff_pwr_btn	/* clear the status bit */
14771b58cbbSZhang Rui		# echo disable > ff_pwr_btn
14871b58cbbSZhang Rui		# cat ff_pwr_btn
149ed206facSZhang Rui		7	enabled
15071b58cbbSZhang Rui
151