summaryrefslogtreecommitdiff
path: root/drivers/acpi/tables.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-02-17 06:10:32 +0300
committerLen Brown <len.brown@intel.com>2007-02-17 06:10:32 +0300
commitc0cd79d11412969b6b8fa1624cdc1277db82e2fe (patch)
tree100ee9bb6f13fc0fb3d1887516712541a5fc0769 /drivers/acpi/tables.c
parent81450b73dde07f473a4a7208b209b4c8b7251d90 (diff)
parentdb2d4ccdc8f9f3433d3a8566404189f2e9295c23 (diff)
downloadlinux-c0cd79d11412969b6b8fa1624cdc1277db82e2fe.tar.xz
Pull fluff into release branch
Conflicts: arch/x86_64/pci/mmconfig.c drivers/acpi/bay.c Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables.c')
-rw-r--r--drivers/acpi/tables.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 45bd17313c4a..849e2c361804 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -169,40 +169,40 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header * header)
int __init
-acpi_table_parse_madt_family(char *id,
- unsigned long madt_size,
+acpi_table_parse_entries(char *id,
+ unsigned long table_size,
int entry_id,
- acpi_madt_entry_handler handler,
+ acpi_table_entry_handler handler,
unsigned int max_entries)
{
- struct acpi_table_header *madt = NULL;
+ struct acpi_table_header *table_header = NULL;
struct acpi_subtable_header *entry;
unsigned int count = 0;
- unsigned long madt_end;
+ unsigned long table_end;
if (!handler)
return -EINVAL;
- /* Locate the MADT (if exists). There should only be one. */
- acpi_get_table(id, 0, &madt);
+ /* Locate the table (if exists). There should only be one. */
+ acpi_get_table(id, 0, &table_header);
- if (!madt) {
+ if (!table_header) {
printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
return -ENODEV;
}
- madt_end = (unsigned long)madt + madt->length;
+ table_end = (unsigned long)table_header + table_header->length;
/* Parse all entries looking for a match. */
entry = (struct acpi_subtable_header *)
- ((unsigned long)madt + madt_size);
+ ((unsigned long)table_header + table_size);
while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) <
- madt_end) {
+ table_end) {
if (entry->type == entry_id
&& (!max_entries || count++ < max_entries))
- if (handler(entry, madt_end))
+ if (handler(entry, table_end))
return -EINVAL;
entry = (struct acpi_subtable_header *)
@@ -218,13 +218,22 @@ acpi_table_parse_madt_family(char *id,
int __init
acpi_table_parse_madt(enum acpi_madt_type id,
- acpi_madt_entry_handler handler, unsigned int max_entries)
+ acpi_table_entry_handler handler, unsigned int max_entries)
{
- return acpi_table_parse_madt_family(ACPI_SIG_MADT,
+ return acpi_table_parse_entries(ACPI_SIG_MADT,
sizeof(struct acpi_table_madt), id,
handler, max_entries);
}
+/**
+ * acpi_table_parse - find table with @id, run @handler on it
+ *
+ * @id: table id to find
+ * @handler: handler to run
+ *
+ * Scan the ACPI System Descriptor Table (STD) for a table matching @id,
+ * run @handler on it. Return 0 if table found, return on if not.
+ */
int __init acpi_table_parse(char *id, acpi_table_handler handler)
{
struct acpi_table_header *table = NULL;
@@ -234,9 +243,9 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
acpi_get_table(id, 0, &table);
if (table) {
handler(table);
- return 1;
- } else
return 0;
+ } else
+ return 1;
}
/*