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.c97
1 files changed, 68 insertions, 29 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 57ae1e5cde0a..0f6f3bcbc8eb 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -36,6 +36,7 @@
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38#include <linux/nmi.h> 38#include <linux/nmi.h>
39#include <linux/acpi.h>
39#include <acpi/acpi.h> 40#include <acpi/acpi.h>
40#include <asm/io.h> 41#include <asm/io.h>
41#include <acpi/acpi_bus.h> 42#include <acpi/acpi_bus.h>
@@ -75,6 +76,54 @@ static acpi_osd_handler acpi_irq_handler;
75static void *acpi_irq_context; 76static void *acpi_irq_context;
76static struct workqueue_struct *kacpid_wq; 77static struct workqueue_struct *kacpid_wq;
77 78
79static void __init acpi_request_region (struct acpi_generic_address *addr,
80 unsigned int length, char *desc)
81{
82 struct resource *res;
83
84 if (!addr->address || !length)
85 return;
86
87 if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
88 res = request_region(addr->address, length, desc);
89 else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
90 res = request_mem_region(addr->address, length, desc);
91}
92
93static int __init acpi_reserve_resources(void)
94{
95 acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
96 "ACPI PM1a_EVT_BLK");
97
98 acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length,
99 "ACPI PM1b_EVT_BLK");
100
101 acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length,
102 "ACPI PM1a_CNT_BLK");
103
104 acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length,
105 "ACPI PM1b_CNT_BLK");
106
107 if (acpi_gbl_FADT.pm_timer_length == 4)
108 acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
109
110 acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length,
111 "ACPI PM2_CNT_BLK");
112
113 /* Length of GPE blocks must be a non-negative multiple of 2 */
114
115 if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
116 acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
117 acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
118
119 if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
120 acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
121 acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
122
123 return 0;
124}
125device_initcall(acpi_reserve_resources);
126
78acpi_status acpi_os_initialize(void) 127acpi_status acpi_os_initialize(void)
79{ 128{
80 return AE_OK; 129 return AE_OK;
@@ -136,53 +185,43 @@ void acpi_os_vprintf(const char *fmt, va_list args)
136#endif 185#endif
137} 186}
138 187
139acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) 188acpi_physical_address __init acpi_os_get_root_pointer(void)
140{ 189{
141 if (efi_enabled) { 190 if (efi_enabled) {
142 addr->pointer_type = ACPI_PHYSICAL_POINTER;
143 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) 191 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
144 addr->pointer.physical = efi.acpi20; 192 return efi.acpi20;
145 else if (efi.acpi != EFI_INVALID_TABLE_ADDR) 193 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
146 addr->pointer.physical = efi.acpi; 194 return efi.acpi;
147 else { 195 else {
148 printk(KERN_ERR PREFIX 196 printk(KERN_ERR PREFIX
149 "System description tables not found\n"); 197 "System description tables not found\n");
150 return AE_NOT_FOUND; 198 return 0;
151 } 199 }
152 } else { 200 } else
153 if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) { 201 return acpi_find_rsdp();
154 printk(KERN_ERR PREFIX
155 "System description tables not found\n");
156 return AE_NOT_FOUND;
157 }
158 }
159
160 return AE_OK;
161} 202}
162 203
163acpi_status 204void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
164acpi_os_map_memory(acpi_physical_address phys, acpi_size size,
165 void __iomem ** virt)
166{ 205{
167 if (phys > ULONG_MAX) { 206 if (phys > ULONG_MAX) {
168 printk(KERN_ERR PREFIX "Cannot map memory that high\n"); 207 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
169 return AE_BAD_PARAMETER; 208 return 0;
170 } 209 }
171 /* 210 if (acpi_gbl_permanent_mmap)
172 * ioremap checks to ensure this is in reserved space 211 /*
173 */ 212 * ioremap checks to ensure this is in reserved space
174 *virt = ioremap((unsigned long)phys, size); 213 */
175 214 return ioremap((unsigned long)phys, size);
176 if (!*virt) 215 else
177 return AE_NO_MEMORY; 216 return __acpi_map_table((unsigned long)phys, size);
178
179 return AE_OK;
180} 217}
181EXPORT_SYMBOL_GPL(acpi_os_map_memory); 218EXPORT_SYMBOL_GPL(acpi_os_map_memory);
182 219
183void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) 220void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
184{ 221{
185 iounmap(virt); 222 if (acpi_gbl_permanent_mmap) {
223 iounmap(virt);
224 }
186} 225}
187EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); 226EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
188 227
@@ -254,7 +293,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
254 * FADT. It may not be the same if an interrupt source override exists 293 * FADT. It may not be the same if an interrupt source override exists
255 * for the SCI. 294 * for the SCI.
256 */ 295 */
257 gsi = acpi_fadt.sci_int; 296 gsi = acpi_gbl_FADT.sci_interrupt;
258 if (acpi_gsi_to_irq(gsi, &irq) < 0) { 297 if (acpi_gsi_to_irq(gsi, &irq) < 0) {
259 printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n", 298 printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n",
260 gsi); 299 gsi);