aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/osl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r--drivers/acpi/osl.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 065819ba87c7..a697fb6cf050 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -91,10 +91,6 @@ static DEFINE_SPINLOCK(acpi_res_lock);
91#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ 91#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
92static char osi_additional_string[OSI_STRING_LENGTH_MAX]; 92static char osi_additional_string[OSI_STRING_LENGTH_MAX];
93 93
94#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
95static int acpi_no_initrd_override;
96#endif
97
98/* 94/*
99 * "Ode to _OSI(Linux)" 95 * "Ode to _OSI(Linux)"
100 * 96 *
@@ -324,67 +320,6 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
324 return AE_OK; 320 return AE_OK;
325} 321}
326 322
327#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
328static struct acpi_table_header *acpi_find_dsdt_initrd(void)
329{
330 struct file *firmware_file;
331 mm_segment_t oldfs;
332 unsigned long len, len2;
333 struct acpi_table_header *dsdt_buffer, *ret = NULL;
334 struct kstat stat;
335 char *ramfs_dsdt_name = "/DSDT.aml";
336
337 printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT\n");
338
339 /*
340 * Never do this at home, only the user-space is allowed to open a file.
341 * The clean way would be to use the firmware loader.
342 * But this code must be run before there is any userspace available.
343 * A static/init firmware infrastructure doesn't exist yet...
344 */
345 if (vfs_stat(ramfs_dsdt_name, &stat) < 0)
346 return ret;
347
348 len = stat.size;
349 /* check especially against empty files */
350 if (len <= 4) {
351 printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len);
352 return ret;
353 }
354
355 firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
356 if (IS_ERR(firmware_file)) {
357 printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name);
358 return ret;
359 }
360
361 dsdt_buffer = kmalloc(len, GFP_ATOMIC);
362 if (!dsdt_buffer) {
363 printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len);
364 goto err;
365 }
366
367 oldfs = get_fs();
368 set_fs(KERNEL_DS);
369 len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len,
370 &firmware_file->f_pos);
371 set_fs(oldfs);
372 if (len2 < len) {
373 printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n",
374 len, ramfs_dsdt_name);
375 ACPI_FREE(dsdt_buffer);
376 goto err;
377 }
378
379 printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n",
380 len, ramfs_dsdt_name);
381 ret = dsdt_buffer;
382err:
383 filp_close(firmware_file, NULL);
384 return ret;
385}
386#endif
387
388acpi_status 323acpi_status
389acpi_os_table_override(struct acpi_table_header * existing_table, 324acpi_os_table_override(struct acpi_table_header * existing_table,
390 struct acpi_table_header ** new_table) 325 struct acpi_table_header ** new_table)
@@ -398,16 +333,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
398 if (strncmp(existing_table->signature, "DSDT", 4) == 0) 333 if (strncmp(existing_table->signature, "DSDT", 4) == 0)
399 *new_table = (struct acpi_table_header *)AmlCode; 334 *new_table = (struct acpi_table_header *)AmlCode;
400#endif 335#endif
401#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
402 if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
403 !acpi_no_initrd_override) {
404 struct acpi_table_header *initrd_table;
405
406 initrd_table = acpi_find_dsdt_initrd();
407 if (initrd_table)
408 *new_table = initrd_table;
409 }
410#endif
411 if (*new_table != NULL) { 336 if (*new_table != NULL) {
412 printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " 337 printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
413 "this is unsafe: tainting kernel\n", 338 "this is unsafe: tainting kernel\n",
@@ -418,15 +343,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
418 return AE_OK; 343 return AE_OK;
419} 344}
420 345
421#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
422static int __init acpi_no_initrd_override_setup(char *s)
423{
424 acpi_no_initrd_override = 1;
425 return 1;
426}
427__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
428#endif
429
430static irqreturn_t acpi_irq(int irq, void *dev_id) 346static irqreturn_t acpi_irq(int irq, void *dev_id)
431{ 347{
432 u32 handled; 348 u32 handled;