diff options
author | Len Brown <len.brown@intel.com> | 2007-02-16 22:10:32 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-16 22:10:32 -0500 |
commit | c0cd79d11412969b6b8fa1624cdc1277db82e2fe (patch) | |
tree | 100ee9bb6f13fc0fb3d1887516712541a5fc0769 /drivers/acpi/tables.c | |
parent | 81450b73dde07f473a4a7208b209b4c8b7251d90 (diff) | |
parent | db2d4ccdc8f9f3433d3a8566404189f2e9295c23 (diff) |
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.c | 41 |
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) | |||
169 | 169 | ||
170 | 170 | ||
171 | int __init | 171 | int __init |
172 | acpi_table_parse_madt_family(char *id, | 172 | acpi_table_parse_entries(char *id, |
173 | unsigned long madt_size, | 173 | unsigned long table_size, |
174 | int entry_id, | 174 | int entry_id, |
175 | acpi_madt_entry_handler handler, | 175 | acpi_table_entry_handler handler, |
176 | unsigned int max_entries) | 176 | unsigned int max_entries) |
177 | { | 177 | { |
178 | struct acpi_table_header *madt = NULL; | 178 | struct acpi_table_header *table_header = NULL; |
179 | struct acpi_subtable_header *entry; | 179 | struct acpi_subtable_header *entry; |
180 | unsigned int count = 0; | 180 | unsigned int count = 0; |
181 | unsigned long madt_end; | 181 | unsigned long table_end; |
182 | 182 | ||
183 | if (!handler) | 183 | if (!handler) |
184 | return -EINVAL; | 184 | return -EINVAL; |
185 | 185 | ||
186 | /* Locate the MADT (if exists). There should only be one. */ | 186 | /* Locate the table (if exists). There should only be one. */ |
187 | acpi_get_table(id, 0, &madt); | 187 | acpi_get_table(id, 0, &table_header); |
188 | 188 | ||
189 | if (!madt) { | 189 | if (!table_header) { |
190 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); | 190 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); |
191 | return -ENODEV; | 191 | return -ENODEV; |
192 | } | 192 | } |
193 | 193 | ||
194 | madt_end = (unsigned long)madt + madt->length; | 194 | table_end = (unsigned long)table_header + table_header->length; |
195 | 195 | ||
196 | /* Parse all entries looking for a match. */ | 196 | /* Parse all entries looking for a match. */ |
197 | 197 | ||
198 | entry = (struct acpi_subtable_header *) | 198 | entry = (struct acpi_subtable_header *) |
199 | ((unsigned long)madt + madt_size); | 199 | ((unsigned long)table_header + table_size); |
200 | 200 | ||
201 | while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) < | 201 | while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) < |
202 | madt_end) { | 202 | table_end) { |
203 | if (entry->type == entry_id | 203 | if (entry->type == entry_id |
204 | && (!max_entries || count++ < max_entries)) | 204 | && (!max_entries || count++ < max_entries)) |
205 | if (handler(entry, madt_end)) | 205 | if (handler(entry, table_end)) |
206 | return -EINVAL; | 206 | return -EINVAL; |
207 | 207 | ||
208 | entry = (struct acpi_subtable_header *) | 208 | entry = (struct acpi_subtable_header *) |
@@ -218,13 +218,22 @@ acpi_table_parse_madt_family(char *id, | |||
218 | 218 | ||
219 | int __init | 219 | int __init |
220 | acpi_table_parse_madt(enum acpi_madt_type id, | 220 | acpi_table_parse_madt(enum acpi_madt_type id, |
221 | acpi_madt_entry_handler handler, unsigned int max_entries) | 221 | acpi_table_entry_handler handler, unsigned int max_entries) |
222 | { | 222 | { |
223 | return acpi_table_parse_madt_family(ACPI_SIG_MADT, | 223 | return acpi_table_parse_entries(ACPI_SIG_MADT, |
224 | sizeof(struct acpi_table_madt), id, | 224 | sizeof(struct acpi_table_madt), id, |
225 | handler, max_entries); | 225 | handler, max_entries); |
226 | } | 226 | } |
227 | 227 | ||
228 | /** | ||
229 | * acpi_table_parse - find table with @id, run @handler on it | ||
230 | * | ||
231 | * @id: table id to find | ||
232 | * @handler: handler to run | ||
233 | * | ||
234 | * Scan the ACPI System Descriptor Table (STD) for a table matching @id, | ||
235 | * run @handler on it. Return 0 if table found, return on if not. | ||
236 | */ | ||
228 | int __init acpi_table_parse(char *id, acpi_table_handler handler) | 237 | int __init acpi_table_parse(char *id, acpi_table_handler handler) |
229 | { | 238 | { |
230 | struct acpi_table_header *table = NULL; | 239 | struct acpi_table_header *table = NULL; |
@@ -234,9 +243,9 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler) | |||
234 | acpi_get_table(id, 0, &table); | 243 | acpi_get_table(id, 0, &table); |
235 | if (table) { | 244 | if (table) { |
236 | handler(table); | 245 | handler(table); |
237 | return 1; | ||
238 | } else | ||
239 | return 0; | 246 | return 0; |
247 | } else | ||
248 | return 1; | ||
240 | } | 249 | } |
241 | 250 | ||
242 | /* | 251 | /* |