2 /******************************************************************************
4 * Module Name: hwgpe - Low level GPE enable/disable/clear functions
7 *****************************************************************************/
10 * Copyright (C) 2000, 2001 R. Byron Moore
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #define _COMPONENT ACPI_HARDWARE
36 /******************************************************************************
38 * FUNCTION: Acpi_hw_enable_gpe
40 * PARAMETERS: Gpe_number - The GPE
44 * DESCRIPTION: Enable a single GPE.
46 ******************************************************************************/
57 * Translate GPE number to index into global registers array.
59 register_index = acpi_gbl_gpe_valid[gpe_number];
62 * Figure out the bit offset for this GPE within the target register.
64 bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
67 * Read the current value of the register, set the appropriate bit
68 * to enable the GPE, and write out the new register.
70 in_byte = acpi_os_in8 (acpi_gbl_gpe_registers[register_index].enable_addr);
71 acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr,
72 (u8)(in_byte | bit_mask));
76 /******************************************************************************
78 * FUNCTION: Acpi_hw_disable_gpe
80 * PARAMETERS: Gpe_number - The GPE
84 * DESCRIPTION: Disable a single GPE.
86 ******************************************************************************/
97 * Translate GPE number to index into global registers array.
99 register_index = acpi_gbl_gpe_valid[gpe_number];
102 * Figure out the bit offset for this GPE within the target register.
104 bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
107 * Read the current value of the register, clear the appropriate bit,
108 * and write out the new register value to disable the GPE.
110 in_byte = acpi_os_in8 (acpi_gbl_gpe_registers[register_index].enable_addr);
111 acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr,
112 (u8)(in_byte & ~bit_mask));
116 /******************************************************************************
118 * FUNCTION: Acpi_hw_clear_gpe
120 * PARAMETERS: Gpe_number - The GPE
124 * DESCRIPTION: Clear a single GPE.
126 ******************************************************************************/
136 * Translate GPE number to index into global registers array.
138 register_index = acpi_gbl_gpe_valid[gpe_number];
141 * Figure out the bit offset for this GPE within the target register.
143 bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
146 * Write a one to the appropriate bit in the status register to
149 acpi_os_out8 (acpi_gbl_gpe_registers[register_index].status_addr, bit_mask);
153 /******************************************************************************
155 * FUNCTION: Acpi_hw_get_gpe_status
157 * PARAMETERS: Gpe_number - The GPE
161 * DESCRIPTION: Return the status of a single GPE.
163 ******************************************************************************/
166 acpi_hw_get_gpe_status (
168 ACPI_EVENT_STATUS *event_status)
171 u32 register_index = 0;
181 * Translate GPE number to index into global registers array.
183 register_index = acpi_gbl_gpe_valid[gpe_number];
186 * Figure out the bit offset for this GPE within the target register.
188 bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
193 in_byte = acpi_os_in8 (acpi_gbl_gpe_registers[register_index].enable_addr);
195 if (bit_mask & in_byte) {
196 (*event_status) |= ACPI_EVENT_FLAG_ENABLED;
202 in_byte = acpi_os_in8 (acpi_gbl_gpe_registers[register_index].status_addr);
204 if (bit_mask & in_byte) {
205 (*event_status) |= ACPI_EVENT_FLAG_SET;