aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 14:08:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 14:08:12 -0400
commit3b29b03a462346473b7d0e6c6013fe093a4ac0d1 (patch)
tree25f6e316344369c9b66010a9d67612488e24aca3 /drivers
parent58ae9c0d54ae3916614fa1f3756dadb954f16e6c (diff)
parent2223af389032425e3d1a70f9cb3a63feaa654ced (diff)
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86/EFI changes from Ingo Molnar: "EFI loader robustness enhancements plus smaller fixes" * 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efi: Fix the ACPI BGRT driver for images located in EFI boot services memory efi: Add a function to look up existing IO memory mappings efi: Defer freeing boot services memory until after ACPI init x86, EFI: Calculate the EFI framebuffer size instead of trusting the firmware efifb: Skip DMI checks if the bootloader knows what it's doing efi: initialize efi.runtime_version to make query_variable_info/update_capsule workable efi: Build EFI stub with EFI-appropriate options X86: Improve GOP detection in the EFI boot stub
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig4
-rw-r--r--drivers/acpi/bgrt.c76
-rw-r--r--drivers/video/efifb.c4
3 files changed, 14 insertions, 70 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 80998958cf45..119d58db8342 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -385,8 +385,8 @@ config ACPI_CUSTOM_METHOD
385 to override that restriction). 385 to override that restriction).
386 386
387config ACPI_BGRT 387config ACPI_BGRT
388 tristate "Boottime Graphics Resource Table support" 388 bool "Boottime Graphics Resource Table support"
389 default n 389 depends on EFI
390 help 390 help
391 This driver adds support for exposing the ACPI Boottime Graphics 391 This driver adds support for exposing the ACPI Boottime Graphics
392 Resource Table, which allows the operating system to obtain 392 Resource Table, which allows the operating system to obtain
diff --git a/drivers/acpi/bgrt.c b/drivers/acpi/bgrt.c
index 6680df36b963..be6039958545 100644
--- a/drivers/acpi/bgrt.c
+++ b/drivers/acpi/bgrt.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright 2012 Red Hat, Inc <mjg@redhat.com> 2 * Copyright 2012 Red Hat, Inc <mjg@redhat.com>
3 * Copyright 2012 Intel Corporation
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
@@ -11,20 +12,10 @@
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/device.h> 13#include <linux/device.h>
13#include <linux/sysfs.h> 14#include <linux/sysfs.h>
14#include <linux/io.h> 15#include <linux/efi-bgrt.h>
15#include <acpi/acpi.h>
16#include <acpi/acpi_bus.h>
17 16
18static struct acpi_table_bgrt *bgrt_tab;
19static struct kobject *bgrt_kobj; 17static struct kobject *bgrt_kobj;
20 18
21struct bmp_header {
22 u16 id;
23 u32 size;
24} __attribute ((packed));
25
26static struct bmp_header bmp_header;
27
28static ssize_t show_version(struct device *dev, 19static ssize_t show_version(struct device *dev,
29 struct device_attribute *attr, char *buf) 20 struct device_attribute *attr, char *buf)
30{ 21{
@@ -63,18 +54,7 @@ static DEVICE_ATTR(yoffset, S_IRUGO, show_yoffset, NULL);
63static ssize_t show_image(struct file *file, struct kobject *kobj, 54static ssize_t show_image(struct file *file, struct kobject *kobj,
64 struct bin_attribute *attr, char *buf, loff_t off, size_t count) 55 struct bin_attribute *attr, char *buf, loff_t off, size_t count)
65{ 56{
66 int size = attr->size; 57 memcpy(buf, attr->private + off, count);
67 void __iomem *image = attr->private;
68
69 if (off >= size) {
70 count = 0;
71 } else {
72 if (off + count > size)
73 count = size - off;
74
75 memcpy_fromio(buf, image+off, count);
76 }
77
78 return count; 58 return count;
79} 59}
80 60
@@ -101,45 +81,18 @@ static struct attribute_group bgrt_attribute_group = {
101 81
102static int __init bgrt_init(void) 82static int __init bgrt_init(void)
103{ 83{
104 acpi_status status;
105 int ret; 84 int ret;
106 void __iomem *bgrt;
107 85
108 if (acpi_disabled) 86 if (!bgrt_image)
109 return -ENODEV;
110
111 status = acpi_get_table("BGRT", 0,
112 (struct acpi_table_header **)&bgrt_tab);
113
114 if (ACPI_FAILURE(status))
115 return -ENODEV; 87 return -ENODEV;
116 88
117 sysfs_bin_attr_init(&image_attr); 89 sysfs_bin_attr_init(&image_attr);
118 90 image_attr.private = bgrt_image;
119 bgrt = ioremap(bgrt_tab->image_address, sizeof(struct bmp_header)); 91 image_attr.size = bgrt_image_size;
120
121 if (!bgrt) {
122 ret = -EINVAL;
123 goto out_err;
124 }
125
126 memcpy_fromio(&bmp_header, bgrt, sizeof(bmp_header));
127 image_attr.size = bmp_header.size;
128 iounmap(bgrt);
129
130 image_attr.private = ioremap(bgrt_tab->image_address, image_attr.size);
131
132 if (!image_attr.private) {
133 ret = -EINVAL;
134 goto out_err;
135 }
136
137 92
138 bgrt_kobj = kobject_create_and_add("bgrt", acpi_kobj); 93 bgrt_kobj = kobject_create_and_add("bgrt", acpi_kobj);
139 if (!bgrt_kobj) { 94 if (!bgrt_kobj)
140 ret = -EINVAL; 95 return -EINVAL;
141 goto out_iounmap;
142 }
143 96
144 ret = sysfs_create_group(bgrt_kobj, &bgrt_attribute_group); 97 ret = sysfs_create_group(bgrt_kobj, &bgrt_attribute_group);
145 if (ret) 98 if (ret)
@@ -155,22 +108,11 @@ out_group:
155 sysfs_remove_group(bgrt_kobj, &bgrt_attribute_group); 108 sysfs_remove_group(bgrt_kobj, &bgrt_attribute_group);
156out_kobject: 109out_kobject:
157 kobject_put(bgrt_kobj); 110 kobject_put(bgrt_kobj);
158out_iounmap:
159 iounmap(image_attr.private);
160out_err:
161 return ret; 111 return ret;
162} 112}
163 113
164static void __exit bgrt_exit(void)
165{
166 iounmap(image_attr.private);
167 sysfs_remove_group(bgrt_kobj, &bgrt_attribute_group);
168 sysfs_remove_bin_file(bgrt_kobj, &image_attr);
169}
170
171module_init(bgrt_init); 114module_init(bgrt_init);
172module_exit(bgrt_exit);
173 115
174MODULE_AUTHOR("Matthew Garrett"); 116MODULE_AUTHOR("Matthew Garrett, Josh Triplett <josh@joshtriplett.org>");
175MODULE_DESCRIPTION("BGRT boot graphic support"); 117MODULE_DESCRIPTION("BGRT boot graphic support");
176MODULE_LICENSE("GPL"); 118MODULE_LICENSE("GPL");
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index b4a632ada401..932abaa58a89 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -553,7 +553,9 @@ static int __init efifb_init(void)
553 int ret; 553 int ret;
554 char *option = NULL; 554 char *option = NULL;
555 555
556 dmi_check_system(dmi_system_table); 556 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
557 !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
558 dmi_check_system(dmi_system_table);
557 559
558 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) 560 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
559 return -ENODEV; 561 return -ENODEV;