Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128041
b: refs/heads/master
c: e97d6bf
h: refs/heads/master
i:
  128039: cd27691
v: v3
  • Loading branch information
Bob Moore authored and Len Brown committed Dec 31, 2008
1 parent 08719d4 commit f1d8245
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 93 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c1e3523ccbeca312e11557d2a75f90632a2fb5c7
refs/heads/master: e97d6bf1a01b7403d98aea95731863aab2e84064
25 changes: 20 additions & 5 deletions trunk/drivers/acpi/events/evgpeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
* FUNCTION: acpi_ev_walk_gpe_list
*
* PARAMETERS: gpe_walk_callback - Routine called for each GPE block
* Context - Value passed to callback
*
* RETURN: Status
*
* DESCRIPTION: Walk the GPE lists.
*
******************************************************************************/

acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
acpi_status
acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context)
{
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
Expand All @@ -154,8 +156,13 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)

/* One callback per GPE block */

status = gpe_walk_callback(gpe_xrupt_info, gpe_block);
status =
gpe_walk_callback(gpe_xrupt_info, gpe_block,
context);
if (ACPI_FAILURE(status)) {
if (status == AE_CTRL_END) { /* Callback abort */
status = AE_OK;
}
goto unlock_and_exit;
}

Expand Down Expand Up @@ -186,7 +193,8 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)

acpi_status
acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block)
struct acpi_gpe_block_info *gpe_block,
void *context)
{
struct acpi_gpe_event_info *gpe_event_info;
u32 i;
Expand Down Expand Up @@ -690,7 +698,8 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)

/* Disable all GPEs in this block */

status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block);
status =
acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block, NULL);

if (!gpe_block->previous && !gpe_block->next) {

Expand All @@ -717,6 +726,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
}

acpi_current_gpe_count -=
gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH;

/* Free the gpe_block */

ACPI_FREE(gpe_block->register_info);
Expand Down Expand Up @@ -958,6 +970,9 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
gpe_device->name.ascii, gpe_block->register_count,
interrupt_number));

/* Update global count of currently available GPEs */

acpi_current_gpe_count += register_count * ACPI_GPE_REGISTER_WIDTH;
return_ACPI_STATUS(AE_OK);
}

Expand Down Expand Up @@ -1057,7 +1072,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,

/* Enable all valid runtime GPEs found above */

status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p",
gpe_block));
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/acpi/events/evmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ void acpi_ev_terminate(void)

/* Disable all GPEs in all GPE blocks */

status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL);

/* Remove SCI handler */

Expand All @@ -606,7 +606,7 @@ void acpi_ev_terminate(void)

/* Deallocate all handler objects installed within GPE info structs */

status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers, NULL);

/* Return to original mode if necessary */

Expand Down
93 changes: 93 additions & 0 deletions trunk/drivers/acpi/events/evxfevnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evxfevnt")

/* Local prototypes */
acpi_status
acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context);

/*******************************************************************************
*
* FUNCTION: acpi_enable
Expand All @@ -60,6 +65,7 @@ ACPI_MODULE_NAME("evxfevnt")
* DESCRIPTION: Transfers the system into ACPI mode.
*
******************************************************************************/

acpi_status acpi_enable(void)
{
acpi_status status = AE_OK;
Expand Down Expand Up @@ -717,3 +723,90 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
}

ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)

/*******************************************************************************
*
* FUNCTION: acpi_get_gpe_device
*
* PARAMETERS: Index - System GPE index (0-current_gpe_count)
* gpe_device - Where the parent GPE Device is returned
*
* RETURN: Status
*
* DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
* gpe device indicates that the gpe number is contained in one of
* the FADT-defined gpe blocks. Otherwise, the GPE block device.
*
******************************************************************************/
acpi_status
acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
{
struct acpi_gpe_device_info info;
acpi_status status;

ACPI_FUNCTION_TRACE(acpi_get_gpe_device);

if (!gpe_device) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}

if (index >= acpi_current_gpe_count) {
return_ACPI_STATUS(AE_NOT_EXIST);
}

/* Setup and walk the GPE list */

info.index = index;
info.status = AE_NOT_EXIST;
info.gpe_device = NULL;
info.next_block_base_index = 0;

status = acpi_ev_walk_gpe_list(acpi_ev_get_gpe_device, &info);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}

*gpe_device = info.gpe_device;
return_ACPI_STATUS(info.status);
}

ACPI_EXPORT_SYMBOL(acpi_get_gpe_device)

/*******************************************************************************
*
* FUNCTION: acpi_ev_get_gpe_device
*
* PARAMETERS: GPE_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Matches the input GPE index (0-current_gpe_count) with a GPE
* block device. NULL if the GPE is one of the FADT-defined GPEs.
*
******************************************************************************/
acpi_status
acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context)
{
struct acpi_gpe_device_info *info = context;

/* Increment Index by the number of GPEs in this block */

info->next_block_base_index +=
(gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH);

if (info->index < info->next_block_base_index) {
/*
* The GPE index is within this block, get the node. Leave the node
* NULL for the FADT-defined GPEs
*/
if ((gpe_block->node)->type == ACPI_TYPE_DEVICE) {
info->gpe_device = gpe_block->node;
}

info->status = AE_OK;
return (AE_CTRL_END);
}

return (AE_OK);
}
26 changes: 14 additions & 12 deletions trunk/drivers/acpi/hardware/hwgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ ACPI_MODULE_NAME("hwgpe")
/* Local prototypes */
static acpi_status
acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block);
struct acpi_gpe_block_info *gpe_block,
void *context);

/******************************************************************************
*
Expand Down Expand Up @@ -260,8 +261,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
******************************************************************************/

acpi_status
acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
struct acpi_gpe_block_info * gpe_block)
acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context)
{
u32 i;
acpi_status status;
Expand Down Expand Up @@ -297,8 +298,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
******************************************************************************/

acpi_status
acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
struct acpi_gpe_block_info * gpe_block)
acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context)
{
u32 i;
acpi_status status;
Expand Down Expand Up @@ -335,8 +336,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
******************************************************************************/

acpi_status
acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
struct acpi_gpe_block_info * gpe_block)
acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context)
{
u32 i;
acpi_status status;
Expand Down Expand Up @@ -382,7 +383,8 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,

static acpi_status
acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block)
struct acpi_gpe_block_info *gpe_block,
void *context)
{
u32 i;
acpi_status status;
Expand Down Expand Up @@ -427,8 +429,8 @@ acpi_status acpi_hw_disable_all_gpes(void)

ACPI_FUNCTION_TRACE(hw_disable_all_gpes);

status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL);
status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);
return_ACPI_STATUS(status);
}

Expand All @@ -450,7 +452,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void)

ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes);

status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block, NULL);
return_ACPI_STATUS(status);
}

Expand All @@ -472,6 +474,6 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void)

ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes);

status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block, NULL);
return_ACPI_STATUS(status);
}
2 changes: 1 addition & 1 deletion trunk/drivers/acpi/hardware/hwregs.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ acpi_status acpi_hw_clear_acpi_status(void)

/* Clear the GPE Bits in all GPE registers in all GPE blocks */

status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);

unlock_and_exit:
acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
Expand Down
63 changes: 2 additions & 61 deletions trunk/drivers/acpi/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,65 +192,6 @@ static struct attribute_group interrupt_stats_attr_group = {
};
static struct kobj_attribute *counter_attrs;

static int count_num_gpes(void)
{
int count = 0;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
struct acpi_gpe_block_info *gpe_block;
acpi_cpu_flags flags;

flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);

gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
while (gpe_xrupt_info) {
gpe_block = gpe_xrupt_info->gpe_block_list_head;
while (gpe_block) {
count += gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH;
gpe_block = gpe_block->next;
}
gpe_xrupt_info = gpe_xrupt_info->next;
}
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);

return count;
}

static int get_gpe_device(int index, acpi_handle *handle)
{
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
struct acpi_gpe_block_info *gpe_block;
acpi_cpu_flags flags;
struct acpi_namespace_node *node;

flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);

gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
while (gpe_xrupt_info) {
gpe_block = gpe_xrupt_info->gpe_block_list_head;
node = gpe_block->node;
while (gpe_block) {
index -= gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH;
if (index < 0) {
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
/* return NULL if it's FADT GPE */
if (node->type != ACPI_TYPE_DEVICE)
*handle = NULL;
else
*handle = node;
return 0;
}
node = gpe_block->node;
gpe_block = gpe_block->next;
}
gpe_xrupt_info = gpe_xrupt_info->next;
}
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);

return -ENODEV;
}

static void delete_gpe_attr_array(void)
{
struct event_counter *tmp = all_counters;
Expand Down Expand Up @@ -309,7 +250,7 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle)
goto end;

if (index < num_gpes) {
result = get_gpe_device(index, handle);
result = acpi_get_gpe_device(index, handle);
if (result) {
ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND,
"Invalid GPE 0x%x\n", index));
Expand Down Expand Up @@ -436,7 +377,7 @@ void acpi_irq_stats_init(void)
if (all_counters)
return;

num_gpes = count_num_gpes();
num_gpes = acpi_current_gpe_count;
num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA;

all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1),
Expand Down
Loading

0 comments on commit f1d8245

Please sign in to comment.