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
29 #define _COMPONENT ACPI_HARDWARE
33 /******************************************************************************
35 * FUNCTION: Acpi_hw_enable_gpe
37 * PARAMETERS: Gpe_number - The GPE
41 * DESCRIPTION: Enable a single GPE.
43 ******************************************************************************/
54 * Translate GPE number to index into global registers array.
56 register_index
= acpi_gbl_gpe_valid
[gpe_number
];
59 * Figure out the bit offset for this GPE within the target register.
61 bit_mask
= acpi_gbl_decode_to8bit
[MOD_8 (gpe_number
)];
64 * Read the current value of the register, set the appropriate bit
65 * to enable the GPE, and write out the new register.
67 in_byte
= acpi_os_in8 (acpi_gbl_gpe_registers
[register_index
].enable_addr
);
68 acpi_os_out8 (acpi_gbl_gpe_registers
[register_index
].enable_addr
,
69 (u8
)(in_byte
| bit_mask
));
73 /******************************************************************************
75 * FUNCTION: Acpi_hw_disable_gpe
77 * PARAMETERS: Gpe_number - The GPE
81 * DESCRIPTION: Disable a single GPE.
83 ******************************************************************************/
94 * Translate GPE number to index into global registers array.
96 register_index
= acpi_gbl_gpe_valid
[gpe_number
];
99 * Figure out the bit offset for this GPE within the target register.
101 bit_mask
= acpi_gbl_decode_to8bit
[MOD_8 (gpe_number
)];
104 * Read the current value of the register, clear the appropriate bit,
105 * and write out the new register value to disable the GPE.
107 in_byte
= acpi_os_in8 (acpi_gbl_gpe_registers
[register_index
].enable_addr
);
108 acpi_os_out8 (acpi_gbl_gpe_registers
[register_index
].enable_addr
,
109 (u8
)(in_byte
& ~bit_mask
));
113 /******************************************************************************
115 * FUNCTION: Acpi_hw_clear_gpe
117 * PARAMETERS: Gpe_number - The GPE
121 * DESCRIPTION: Clear a single GPE.
123 ******************************************************************************/
133 * Translate GPE number to index into global registers array.
135 register_index
= acpi_gbl_gpe_valid
[gpe_number
];
138 * Figure out the bit offset for this GPE within the target register.
140 bit_mask
= acpi_gbl_decode_to8bit
[MOD_8 (gpe_number
)];
143 * Write a one to the appropriate bit in the status register to
146 acpi_os_out8 (acpi_gbl_gpe_registers
[register_index
].status_addr
, bit_mask
);
150 /******************************************************************************
152 * FUNCTION: Acpi_hw_get_gpe_status
154 * PARAMETERS: Gpe_number - The GPE
158 * DESCRIPTION: Return the status of a single GPE.
160 ******************************************************************************/
163 acpi_hw_get_gpe_status (
165 ACPI_EVENT_STATUS
*event_status
)
168 u32 register_index
= 0;
178 * Translate GPE number to index into global registers array.
180 register_index
= acpi_gbl_gpe_valid
[gpe_number
];
183 * Figure out the bit offset for this GPE within the target register.
185 bit_mask
= acpi_gbl_decode_to8bit
[MOD_8 (gpe_number
)];
190 in_byte
= acpi_os_in8 (acpi_gbl_gpe_registers
[register_index
].enable_addr
);
192 if (bit_mask
& in_byte
) {
193 (*event_status
) |= ACPI_EVENT_FLAG_ENABLED
;
199 in_byte
= acpi_os_in8 (acpi_gbl_gpe_registers
[register_index
].status_addr
);
201 if (bit_mask
& in_byte
) {
202 (*event_status
) |= ACPI_EVENT_FLAG_SET
;