aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/osl.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/osl.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r--drivers/acpi/osl.c567
1 files changed, 251 insertions, 316 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f3a807c342c0..9127760d36c5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -45,16 +45,12 @@
45 45
46#include <linux/efi.h> 46#include <linux/efi.h>
47 47
48
49#define _COMPONENT ACPI_OS_SERVICES 48#define _COMPONENT ACPI_OS_SERVICES
50ACPI_MODULE_NAME ("osl") 49ACPI_MODULE_NAME("osl")
51
52#define PREFIX "ACPI: " 50#define PREFIX "ACPI: "
53 51struct acpi_os_dpc {
54struct acpi_os_dpc 52 acpi_osd_exec_callback function;
55{ 53 void *context;
56 acpi_osd_exec_callback function;
57 void *context;
58}; 54};
59 55
60#ifdef CONFIG_ACPI_CUSTOM_DSDT 56#ifdef CONFIG_ACPI_CUSTOM_DSDT
@@ -69,7 +65,7 @@ int acpi_in_debugger;
69EXPORT_SYMBOL(acpi_in_debugger); 65EXPORT_SYMBOL(acpi_in_debugger);
70 66
71extern char line_buf[80]; 67extern char line_buf[80];
72#endif /*ENABLE_DEBUGGER*/ 68#endif /*ENABLE_DEBUGGER */
73 69
74int acpi_specific_hotkey_enabled; 70int acpi_specific_hotkey_enabled;
75EXPORT_SYMBOL(acpi_specific_hotkey_enabled); 71EXPORT_SYMBOL(acpi_specific_hotkey_enabled);
@@ -79,14 +75,12 @@ static acpi_osd_handler acpi_irq_handler;
79static void *acpi_irq_context; 75static void *acpi_irq_context;
80static struct workqueue_struct *kacpid_wq; 76static struct workqueue_struct *kacpid_wq;
81 77
82acpi_status 78acpi_status acpi_os_initialize(void)
83acpi_os_initialize(void)
84{ 79{
85 return AE_OK; 80 return AE_OK;
86} 81}
87 82
88acpi_status 83acpi_status acpi_os_initialize1(void)
89acpi_os_initialize1(void)
90{ 84{
91 /* 85 /*
92 * Initialize PCI configuration space access, as we'll need to access 86 * Initialize PCI configuration space access, as we'll need to access
@@ -94,7 +88,8 @@ acpi_os_initialize1(void)
94 */ 88 */
95#ifdef CONFIG_ACPI_PCI 89#ifdef CONFIG_ACPI_PCI
96 if (!raw_pci_ops) { 90 if (!raw_pci_ops) {
97 printk(KERN_ERR PREFIX "Access to PCI configuration space unavailable\n"); 91 printk(KERN_ERR PREFIX
92 "Access to PCI configuration space unavailable\n");
98 return AE_NULL_ENTRY; 93 return AE_NULL_ENTRY;
99 } 94 }
100#endif 95#endif
@@ -104,8 +99,7 @@ acpi_os_initialize1(void)
104 return AE_OK; 99 return AE_OK;
105} 100}
106 101
107acpi_status 102acpi_status acpi_os_terminate(void)
108acpi_os_terminate(void)
109{ 103{
110 if (acpi_irq_handler) { 104 if (acpi_irq_handler) {
111 acpi_os_remove_interrupt_handler(acpi_irq_irq, 105 acpi_os_remove_interrupt_handler(acpi_irq_irq,
@@ -117,21 +111,20 @@ acpi_os_terminate(void)
117 return AE_OK; 111 return AE_OK;
118} 112}
119 113
120void 114void acpi_os_printf(const char *fmt, ...)
121acpi_os_printf(const char *fmt,...)
122{ 115{
123 va_list args; 116 va_list args;
124 va_start(args, fmt); 117 va_start(args, fmt);
125 acpi_os_vprintf(fmt, args); 118 acpi_os_vprintf(fmt, args);
126 va_end(args); 119 va_end(args);
127} 120}
121
128EXPORT_SYMBOL(acpi_os_printf); 122EXPORT_SYMBOL(acpi_os_printf);
129 123
130void 124void acpi_os_vprintf(const char *fmt, va_list args)
131acpi_os_vprintf(const char *fmt, va_list args)
132{ 125{
133 static char buffer[512]; 126 static char buffer[512];
134 127
135 vsprintf(buffer, fmt, args); 128 vsprintf(buffer, fmt, args);
136 129
137#ifdef ENABLE_DEBUGGER 130#ifdef ENABLE_DEBUGGER
@@ -146,8 +139,7 @@ acpi_os_vprintf(const char *fmt, va_list args)
146} 139}
147 140
148extern int acpi_in_resume; 141extern int acpi_in_resume;
149void * 142void *acpi_os_allocate(acpi_size size)
150acpi_os_allocate(acpi_size size)
151{ 143{
152 if (acpi_in_resume) 144 if (acpi_in_resume)
153 return kmalloc(size, GFP_ATOMIC); 145 return kmalloc(size, GFP_ATOMIC);
@@ -155,31 +147,32 @@ acpi_os_allocate(acpi_size size)
155 return kmalloc(size, GFP_KERNEL); 147 return kmalloc(size, GFP_KERNEL);
156} 148}
157 149
158void 150void acpi_os_free(void *ptr)
159acpi_os_free(void *ptr)
160{ 151{
161 kfree(ptr); 152 kfree(ptr);
162} 153}
154
163EXPORT_SYMBOL(acpi_os_free); 155EXPORT_SYMBOL(acpi_os_free);
164 156
165acpi_status 157acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
166acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
167{ 158{
168 if (efi_enabled) { 159 if (efi_enabled) {
169 addr->pointer_type = ACPI_PHYSICAL_POINTER; 160 addr->pointer_type = ACPI_PHYSICAL_POINTER;
170 if (efi.acpi20) 161 if (efi.acpi20)
171 addr->pointer.physical = 162 addr->pointer.physical =
172 (acpi_physical_address) virt_to_phys(efi.acpi20); 163 (acpi_physical_address) virt_to_phys(efi.acpi20);
173 else if (efi.acpi) 164 else if (efi.acpi)
174 addr->pointer.physical = 165 addr->pointer.physical =
175 (acpi_physical_address) virt_to_phys(efi.acpi); 166 (acpi_physical_address) virt_to_phys(efi.acpi);
176 else { 167 else {
177 printk(KERN_ERR PREFIX "System description tables not found\n"); 168 printk(KERN_ERR PREFIX
169 "System description tables not found\n");
178 return AE_NOT_FOUND; 170 return AE_NOT_FOUND;
179 } 171 }
180 } else { 172 } else {
181 if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) { 173 if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) {
182 printk(KERN_ERR PREFIX "System description tables not found\n"); 174 printk(KERN_ERR PREFIX
175 "System description tables not found\n");
183 return AE_NOT_FOUND; 176 return AE_NOT_FOUND;
184 } 177 }
185 } 178 }
@@ -188,11 +181,12 @@ acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
188} 181}
189 182
190acpi_status 183acpi_status
191acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **virt) 184acpi_os_map_memory(acpi_physical_address phys, acpi_size size,
185 void __iomem ** virt)
192{ 186{
193 if (efi_enabled) { 187 if (efi_enabled) {
194 if (EFI_MEMORY_WB & efi_mem_attributes(phys)) { 188 if (EFI_MEMORY_WB & efi_mem_attributes(phys)) {
195 *virt = (void __iomem *) phys_to_virt(phys); 189 *virt = (void __iomem *)phys_to_virt(phys);
196 } else { 190 } else {
197 *virt = ioremap(phys, size); 191 *virt = ioremap(phys, size);
198 } 192 }
@@ -202,9 +196,9 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **vi
202 return AE_BAD_PARAMETER; 196 return AE_BAD_PARAMETER;
203 } 197 }
204 /* 198 /*
205 * ioremap checks to ensure this is in reserved space 199 * ioremap checks to ensure this is in reserved space
206 */ 200 */
207 *virt = ioremap((unsigned long) phys, size); 201 *virt = ioremap((unsigned long)phys, size);
208 } 202 }
209 203
210 if (!*virt) 204 if (!*virt)
@@ -213,17 +207,16 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **vi
213 return AE_OK; 207 return AE_OK;
214} 208}
215 209
216void 210void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
217acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
218{ 211{
219 iounmap(virt); 212 iounmap(virt);
220} 213}
221 214
222#ifdef ACPI_FUTURE_USAGE 215#ifdef ACPI_FUTURE_USAGE
223acpi_status 216acpi_status
224acpi_os_get_physical_address(void *virt, acpi_physical_address *phys) 217acpi_os_get_physical_address(void *virt, acpi_physical_address * phys)
225{ 218{
226 if(!phys || !virt) 219 if (!phys || !virt)
227 return AE_BAD_PARAMETER; 220 return AE_BAD_PARAMETER;
228 221
229 *phys = virt_to_phys(virt); 222 *phys = virt_to_phys(virt);
@@ -237,16 +230,16 @@ acpi_os_get_physical_address(void *virt, acpi_physical_address *phys)
237static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN]; 230static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
238 231
239acpi_status 232acpi_status
240acpi_os_predefined_override (const struct acpi_predefined_names *init_val, 233acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
241 acpi_string *new_val) 234 acpi_string * new_val)
242{ 235{
243 if (!init_val || !new_val) 236 if (!init_val || !new_val)
244 return AE_BAD_PARAMETER; 237 return AE_BAD_PARAMETER;
245 238
246 *new_val = NULL; 239 *new_val = NULL;
247 if (!memcmp (init_val->name, "_OS_", 4) && strlen(acpi_os_name)) { 240 if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
248 printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n", 241 printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
249 acpi_os_name); 242 acpi_os_name);
250 *new_val = acpi_os_name; 243 *new_val = acpi_os_name;
251 } 244 }
252 245
@@ -254,15 +247,15 @@ acpi_os_predefined_override (const struct acpi_predefined_names *init_val,
254} 247}
255 248
256acpi_status 249acpi_status
257acpi_os_table_override (struct acpi_table_header *existing_table, 250acpi_os_table_override(struct acpi_table_header * existing_table,
258 struct acpi_table_header **new_table) 251 struct acpi_table_header ** new_table)
259{ 252{
260 if (!existing_table || !new_table) 253 if (!existing_table || !new_table)
261 return AE_BAD_PARAMETER; 254 return AE_BAD_PARAMETER;
262 255
263#ifdef CONFIG_ACPI_CUSTOM_DSDT 256#ifdef CONFIG_ACPI_CUSTOM_DSDT
264 if (strncmp(existing_table->signature, "DSDT", 4) == 0) 257 if (strncmp(existing_table->signature, "DSDT", 4) == 0)
265 *new_table = (struct acpi_table_header*)AmlCode; 258 *new_table = (struct acpi_table_header *)AmlCode;
266 else 259 else
267 *new_table = NULL; 260 *new_table = NULL;
268#else 261#else
@@ -271,14 +264,14 @@ acpi_os_table_override (struct acpi_table_header *existing_table,
271 return AE_OK; 264 return AE_OK;
272} 265}
273 266
274static irqreturn_t 267static irqreturn_t acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
275acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
276{ 268{
277 return (*acpi_irq_handler)(acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE; 269 return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
278} 270}
279 271
280acpi_status 272acpi_status
281acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *context) 273acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
274 void *context)
282{ 275{
283 unsigned int irq; 276 unsigned int irq;
284 277
@@ -305,8 +298,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *conte
305 return AE_OK; 298 return AE_OK;
306} 299}
307 300
308acpi_status 301acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
309acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
310{ 302{
311 if (irq) { 303 if (irq) {
312 free_irq(irq, acpi_irq); 304 free_irq(irq, acpi_irq);
@@ -321,16 +313,15 @@ acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
321 * Running in interpreter thread context, safe to sleep 313 * Running in interpreter thread context, safe to sleep
322 */ 314 */
323 315
324void 316void acpi_os_sleep(acpi_integer ms)
325acpi_os_sleep(acpi_integer ms)
326{ 317{
327 current->state = TASK_INTERRUPTIBLE; 318 current->state = TASK_INTERRUPTIBLE;
328 schedule_timeout(((signed long) ms * HZ) / 1000); 319 schedule_timeout(((signed long)ms * HZ) / 1000);
329} 320}
321
330EXPORT_SYMBOL(acpi_os_sleep); 322EXPORT_SYMBOL(acpi_os_sleep);
331 323
332void 324void acpi_os_stall(u32 us)
333acpi_os_stall(u32 us)
334{ 325{
335 while (us) { 326 while (us) {
336 u32 delay = 1000; 327 u32 delay = 1000;
@@ -342,6 +333,7 @@ acpi_os_stall(u32 us)
342 us -= delay; 333 us -= delay;
343 } 334 }
344} 335}
336
345EXPORT_SYMBOL(acpi_os_stall); 337EXPORT_SYMBOL(acpi_os_stall);
346 338
347/* 339/*
@@ -349,8 +341,7 @@ EXPORT_SYMBOL(acpi_os_stall);
349 * Returns 64-bit free-running, monotonically increasing timer 341 * Returns 64-bit free-running, monotonically increasing timer
350 * with 100ns granularity 342 * with 100ns granularity
351 */ 343 */
352u64 344u64 acpi_os_get_timer(void)
353acpi_os_get_timer (void)
354{ 345{
355 static u64 t; 346 static u64 t;
356 347
@@ -367,27 +358,22 @@ acpi_os_get_timer (void)
367 return ++t; 358 return ++t;
368} 359}
369 360
370acpi_status 361acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
371acpi_os_read_port(
372 acpi_io_address port,
373 u32 *value,
374 u32 width)
375{ 362{
376 u32 dummy; 363 u32 dummy;
377 364
378 if (!value) 365 if (!value)
379 value = &dummy; 366 value = &dummy;
380 367
381 switch (width) 368 switch (width) {
382 {
383 case 8: 369 case 8:
384 *(u8*) value = inb(port); 370 *(u8 *) value = inb(port);
385 break; 371 break;
386 case 16: 372 case 16:
387 *(u16*) value = inw(port); 373 *(u16 *) value = inw(port);
388 break; 374 break;
389 case 32: 375 case 32:
390 *(u32*) value = inl(port); 376 *(u32 *) value = inl(port);
391 break; 377 break;
392 default: 378 default:
393 BUG(); 379 BUG();
@@ -395,16 +381,12 @@ acpi_os_read_port(
395 381
396 return AE_OK; 382 return AE_OK;
397} 383}
384
398EXPORT_SYMBOL(acpi_os_read_port); 385EXPORT_SYMBOL(acpi_os_read_port);
399 386
400acpi_status 387acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
401acpi_os_write_port(
402 acpi_io_address port,
403 u32 value,
404 u32 width)
405{ 388{
406 switch (width) 389 switch (width) {
407 {
408 case 8: 390 case 8:
409 outb(value, port); 391 outb(value, port);
410 break; 392 break;
@@ -420,40 +402,38 @@ acpi_os_write_port(
420 402
421 return AE_OK; 403 return AE_OK;
422} 404}
405
423EXPORT_SYMBOL(acpi_os_write_port); 406EXPORT_SYMBOL(acpi_os_write_port);
424 407
425acpi_status 408acpi_status
426acpi_os_read_memory( 409acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
427 acpi_physical_address phys_addr,
428 u32 *value,
429 u32 width)
430{ 410{
431 u32 dummy; 411 u32 dummy;
432 void __iomem *virt_addr; 412 void __iomem *virt_addr;
433 int iomem = 0; 413 int iomem = 0;
434 414
435 if (efi_enabled) { 415 if (efi_enabled) {
436 if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { 416 if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) {
437 /* HACK ALERT! We can use readb/w/l on real memory too.. */ 417 /* HACK ALERT! We can use readb/w/l on real memory too.. */
438 virt_addr = (void __iomem *) phys_to_virt(phys_addr); 418 virt_addr = (void __iomem *)phys_to_virt(phys_addr);
439 } else { 419 } else {
440 iomem = 1; 420 iomem = 1;
441 virt_addr = ioremap(phys_addr, width); 421 virt_addr = ioremap(phys_addr, width);
442 } 422 }
443 } else 423 } else
444 virt_addr = (void __iomem *) phys_to_virt(phys_addr); 424 virt_addr = (void __iomem *)phys_to_virt(phys_addr);
445 if (!value) 425 if (!value)
446 value = &dummy; 426 value = &dummy;
447 427
448 switch (width) { 428 switch (width) {
449 case 8: 429 case 8:
450 *(u8*) value = readb(virt_addr); 430 *(u8 *) value = readb(virt_addr);
451 break; 431 break;
452 case 16: 432 case 16:
453 *(u16*) value = readw(virt_addr); 433 *(u16 *) value = readw(virt_addr);
454 break; 434 break;
455 case 32: 435 case 32:
456 *(u32*) value = readl(virt_addr); 436 *(u32 *) value = readl(virt_addr);
457 break; 437 break;
458 default: 438 default:
459 BUG(); 439 BUG();
@@ -468,24 +448,21 @@ acpi_os_read_memory(
468} 448}
469 449
470acpi_status 450acpi_status
471acpi_os_write_memory( 451acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
472 acpi_physical_address phys_addr,
473 u32 value,
474 u32 width)
475{ 452{
476 void __iomem *virt_addr; 453 void __iomem *virt_addr;
477 int iomem = 0; 454 int iomem = 0;
478 455
479 if (efi_enabled) { 456 if (efi_enabled) {
480 if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { 457 if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) {
481 /* HACK ALERT! We can use writeb/w/l on real memory too */ 458 /* HACK ALERT! We can use writeb/w/l on real memory too */
482 virt_addr = (void __iomem *) phys_to_virt(phys_addr); 459 virt_addr = (void __iomem *)phys_to_virt(phys_addr);
483 } else { 460 } else {
484 iomem = 1; 461 iomem = 1;
485 virt_addr = ioremap(phys_addr, width); 462 virt_addr = ioremap(phys_addr, width);
486 } 463 }
487 } else 464 } else
488 virt_addr = (void __iomem *) phys_to_virt(phys_addr); 465 virt_addr = (void __iomem *)phys_to_virt(phys_addr);
489 466
490 switch (width) { 467 switch (width) {
491 case 8: 468 case 8:
@@ -510,7 +487,8 @@ acpi_os_write_memory(
510#ifdef CONFIG_ACPI_PCI 487#ifdef CONFIG_ACPI_PCI
511 488
512acpi_status 489acpi_status
513acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value, u32 width) 490acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
491 void *value, u32 width)
514{ 492{
515 int result, size; 493 int result, size;
516 494
@@ -534,15 +512,17 @@ acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value
534 BUG_ON(!raw_pci_ops); 512 BUG_ON(!raw_pci_ops);
535 513
536 result = raw_pci_ops->read(pci_id->segment, pci_id->bus, 514 result = raw_pci_ops->read(pci_id->segment, pci_id->bus,
537 PCI_DEVFN(pci_id->device, pci_id->function), 515 PCI_DEVFN(pci_id->device, pci_id->function),
538 reg, size, value); 516 reg, size, value);
539 517
540 return (result ? AE_ERROR : AE_OK); 518 return (result ? AE_ERROR : AE_OK);
541} 519}
520
542EXPORT_SYMBOL(acpi_os_read_pci_configuration); 521EXPORT_SYMBOL(acpi_os_read_pci_configuration);
543 522
544acpi_status 523acpi_status
545acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integer value, u32 width) 524acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
525 acpi_integer value, u32 width)
546{ 526{
547 int result, size; 527 int result, size;
548 528
@@ -563,56 +543,62 @@ acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integ
563 BUG_ON(!raw_pci_ops); 543 BUG_ON(!raw_pci_ops);
564 544
565 result = raw_pci_ops->write(pci_id->segment, pci_id->bus, 545 result = raw_pci_ops->write(pci_id->segment, pci_id->bus,
566 PCI_DEVFN(pci_id->device, pci_id->function), 546 PCI_DEVFN(pci_id->device, pci_id->function),
567 reg, size, value); 547 reg, size, value);
568 548
569 return (result ? AE_ERROR : AE_OK); 549 return (result ? AE_ERROR : AE_OK);
570} 550}
571 551
572/* TODO: Change code to take advantage of driver model more */ 552/* TODO: Change code to take advantage of driver model more */
573static void 553static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
574acpi_os_derive_pci_id_2 ( 554 acpi_handle chandle, /* current node */
575 acpi_handle rhandle, /* upper bound */ 555 struct acpi_pci_id **id,
576 acpi_handle chandle, /* current node */ 556 int *is_bridge, u8 * bus_number)
577 struct acpi_pci_id **id,
578 int *is_bridge,
579 u8 *bus_number)
580{ 557{
581 acpi_handle handle; 558 acpi_handle handle;
582 struct acpi_pci_id *pci_id = *id; 559 struct acpi_pci_id *pci_id = *id;
583 acpi_status status; 560 acpi_status status;
584 unsigned long temp; 561 unsigned long temp;
585 acpi_object_type type; 562 acpi_object_type type;
586 u8 tu8; 563 u8 tu8;
587 564
588 acpi_get_parent(chandle, &handle); 565 acpi_get_parent(chandle, &handle);
589 if (handle != rhandle) { 566 if (handle != rhandle) {
590 acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, bus_number); 567 acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge,
568 bus_number);
591 569
592 status = acpi_get_type(handle, &type); 570 status = acpi_get_type(handle, &type);
593 if ( (ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE) ) 571 if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
594 return; 572 return;
595 573
596 status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &temp); 574 status =
575 acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
576 &temp);
597 if (ACPI_SUCCESS(status)) { 577 if (ACPI_SUCCESS(status)) {
598 pci_id->device = ACPI_HIWORD (ACPI_LODWORD (temp)); 578 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
599 pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp)); 579 pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
600 580
601 if (*is_bridge) 581 if (*is_bridge)
602 pci_id->bus = *bus_number; 582 pci_id->bus = *bus_number;
603 583
604 /* any nicer way to get bus number of bridge ? */ 584 /* any nicer way to get bus number of bridge ? */
605 status = acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 8); 585 status =
606 if (ACPI_SUCCESS(status) && 586 acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8,
607 ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) { 587 8);
608 status = acpi_os_read_pci_configuration(pci_id, 0x18, &tu8, 8); 588 if (ACPI_SUCCESS(status)
589 && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
590 status =
591 acpi_os_read_pci_configuration(pci_id, 0x18,
592 &tu8, 8);
609 if (!ACPI_SUCCESS(status)) { 593 if (!ACPI_SUCCESS(status)) {
610 /* Certainly broken... FIX ME */ 594 /* Certainly broken... FIX ME */
611 return; 595 return;
612 } 596 }
613 *is_bridge = 1; 597 *is_bridge = 1;
614 pci_id->bus = tu8; 598 pci_id->bus = tu8;
615 status = acpi_os_read_pci_configuration(pci_id, 0x19, &tu8, 8); 599 status =
600 acpi_os_read_pci_configuration(pci_id, 0x19,
601 &tu8, 8);
616 if (ACPI_SUCCESS(status)) { 602 if (ACPI_SUCCESS(status)) {
617 *bus_number = tu8; 603 *bus_number = tu8;
618 } 604 }
@@ -622,11 +608,9 @@ acpi_os_derive_pci_id_2 (
622 } 608 }
623} 609}
624 610
625void 611void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
626acpi_os_derive_pci_id ( 612 acpi_handle chandle, /* current node */
627 acpi_handle rhandle, /* upper bound */ 613 struct acpi_pci_id **id)
628 acpi_handle chandle, /* current node */
629 struct acpi_pci_id **id)
630{ 614{
631 int is_bridge = 1; 615 int is_bridge = 1;
632 u8 bus_number = (*id)->bus; 616 u8 bus_number = (*id)->bus;
@@ -634,49 +618,39 @@ acpi_os_derive_pci_id (
634 acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number); 618 acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number);
635} 619}
636 620
637#else /*!CONFIG_ACPI_PCI*/ 621#else /*!CONFIG_ACPI_PCI */
638 622
639acpi_status 623acpi_status
640acpi_os_write_pci_configuration ( 624acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id,
641 struct acpi_pci_id *pci_id, 625 u32 reg, acpi_integer value, u32 width)
642 u32 reg,
643 acpi_integer value,
644 u32 width)
645{ 626{
646 return AE_SUPPORT; 627 return AE_SUPPORT;
647} 628}
648 629
649acpi_status 630acpi_status
650acpi_os_read_pci_configuration ( 631acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id,
651 struct acpi_pci_id *pci_id, 632 u32 reg, void *value, u32 width)
652 u32 reg,
653 void *value,
654 u32 width)
655{ 633{
656 return AE_SUPPORT; 634 return AE_SUPPORT;
657} 635}
658 636
659void 637void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
660acpi_os_derive_pci_id ( 638 acpi_handle chandle, /* current node */
661 acpi_handle rhandle, /* upper bound */ 639 struct acpi_pci_id **id)
662 acpi_handle chandle, /* current node */
663 struct acpi_pci_id **id)
664{ 640{
665} 641}
666 642
667#endif /*CONFIG_ACPI_PCI*/ 643#endif /*CONFIG_ACPI_PCI */
668 644
669static void 645static void acpi_os_execute_deferred(void *context)
670acpi_os_execute_deferred (
671 void *context)
672{ 646{
673 struct acpi_os_dpc *dpc = NULL; 647 struct acpi_os_dpc *dpc = NULL;
674 648
675 ACPI_FUNCTION_TRACE ("os_execute_deferred"); 649 ACPI_FUNCTION_TRACE("os_execute_deferred");
676 650
677 dpc = (struct acpi_os_dpc *) context; 651 dpc = (struct acpi_os_dpc *)context;
678 if (!dpc) { 652 if (!dpc) {
679 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); 653 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
680 return_VOID; 654 return_VOID;
681 } 655 }
682 656
@@ -688,21 +662,21 @@ acpi_os_execute_deferred (
688} 662}
689 663
690acpi_status 664acpi_status
691acpi_os_queue_for_execution( 665acpi_os_queue_for_execution(u32 priority,
692 u32 priority, 666 acpi_osd_exec_callback function, void *context)
693 acpi_osd_exec_callback function,
694 void *context)
695{ 667{
696 acpi_status status = AE_OK; 668 acpi_status status = AE_OK;
697 struct acpi_os_dpc *dpc; 669 struct acpi_os_dpc *dpc;
698 struct work_struct *task; 670 struct work_struct *task;
699 671
700 ACPI_FUNCTION_TRACE ("os_queue_for_execution"); 672 ACPI_FUNCTION_TRACE("os_queue_for_execution");
701 673
702 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Scheduling function [%p(%p)] for deferred execution.\n", function, context)); 674 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
675 "Scheduling function [%p(%p)] for deferred execution.\n",
676 function, context));
703 677
704 if (!function) 678 if (!function)
705 return_ACPI_STATUS (AE_BAD_PARAMETER); 679 return_ACPI_STATUS(AE_BAD_PARAMETER);
706 680
707 /* 681 /*
708 * Allocate/initialize DPC structure. Note that this memory will be 682 * Allocate/initialize DPC structure. Note that this memory will be
@@ -715,67 +689,65 @@ acpi_os_queue_for_execution(
715 * from the same memory. 689 * from the same memory.
716 */ 690 */
717 691
718 dpc = kmalloc(sizeof(struct acpi_os_dpc)+sizeof(struct work_struct), GFP_ATOMIC); 692 dpc =
693 kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct),
694 GFP_ATOMIC);
719 if (!dpc) 695 if (!dpc)
720 return_ACPI_STATUS (AE_NO_MEMORY); 696 return_ACPI_STATUS(AE_NO_MEMORY);
721 697
722 dpc->function = function; 698 dpc->function = function;
723 dpc->context = context; 699 dpc->context = context;
724 700
725 task = (void *)(dpc+1); 701 task = (void *)(dpc + 1);
726 INIT_WORK(task, acpi_os_execute_deferred, (void*)dpc); 702 INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);
727 703
728 if (!queue_work(kacpid_wq, task)) { 704 if (!queue_work(kacpid_wq, task)) {
729 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to queue_work() failed.\n")); 705 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
706 "Call to queue_work() failed.\n"));
730 kfree(dpc); 707 kfree(dpc);
731 status = AE_ERROR; 708 status = AE_ERROR;
732 } 709 }
733 710
734 return_ACPI_STATUS (status); 711 return_ACPI_STATUS(status);
735} 712}
713
736EXPORT_SYMBOL(acpi_os_queue_for_execution); 714EXPORT_SYMBOL(acpi_os_queue_for_execution);
737 715
738void 716void acpi_os_wait_events_complete(void *context)
739acpi_os_wait_events_complete(
740 void *context)
741{ 717{
742 flush_workqueue(kacpid_wq); 718 flush_workqueue(kacpid_wq);
743} 719}
720
744EXPORT_SYMBOL(acpi_os_wait_events_complete); 721EXPORT_SYMBOL(acpi_os_wait_events_complete);
745 722
746/* 723/*
747 * Allocate the memory for a spinlock and initialize it. 724 * Allocate the memory for a spinlock and initialize it.
748 */ 725 */
749acpi_status 726acpi_status acpi_os_create_lock(acpi_handle * out_handle)
750acpi_os_create_lock (
751 acpi_handle *out_handle)
752{ 727{
753 spinlock_t *lock_ptr; 728 spinlock_t *lock_ptr;
754 729
755 ACPI_FUNCTION_TRACE ("os_create_lock"); 730 ACPI_FUNCTION_TRACE("os_create_lock");
756 731
757 lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); 732 lock_ptr = acpi_os_allocate(sizeof(spinlock_t));
758 733
759 spin_lock_init(lock_ptr); 734 spin_lock_init(lock_ptr);
760 735
761 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr)); 736 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr));
762 737
763 *out_handle = lock_ptr; 738 *out_handle = lock_ptr;
764 739
765 return_ACPI_STATUS (AE_OK); 740 return_ACPI_STATUS(AE_OK);
766} 741}
767 742
768
769/* 743/*
770 * Deallocate the memory for a spinlock. 744 * Deallocate the memory for a spinlock.
771 */ 745 */
772void 746void acpi_os_delete_lock(acpi_handle handle)
773acpi_os_delete_lock (
774 acpi_handle handle)
775{ 747{
776 ACPI_FUNCTION_TRACE ("os_create_lock"); 748 ACPI_FUNCTION_TRACE("os_create_lock");
777 749
778 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); 750 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle));
779 751
780 acpi_os_free(handle); 752 acpi_os_free(handle);
781 753
@@ -783,30 +755,28 @@ acpi_os_delete_lock (
783} 755}
784 756
785acpi_status 757acpi_status
786acpi_os_create_semaphore( 758acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
787 u32 max_units,
788 u32 initial_units,
789 acpi_handle *handle)
790{ 759{
791 struct semaphore *sem = NULL; 760 struct semaphore *sem = NULL;
792 761
793 ACPI_FUNCTION_TRACE ("os_create_semaphore"); 762 ACPI_FUNCTION_TRACE("os_create_semaphore");
794 763
795 sem = acpi_os_allocate(sizeof(struct semaphore)); 764 sem = acpi_os_allocate(sizeof(struct semaphore));
796 if (!sem) 765 if (!sem)
797 return_ACPI_STATUS (AE_NO_MEMORY); 766 return_ACPI_STATUS(AE_NO_MEMORY);
798 memset(sem, 0, sizeof(struct semaphore)); 767 memset(sem, 0, sizeof(struct semaphore));
799 768
800 sema_init(sem, initial_units); 769 sema_init(sem, initial_units);
801 770
802 *handle = (acpi_handle*)sem; 771 *handle = (acpi_handle *) sem;
803 772
804 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", *handle, initial_units)); 773 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
774 *handle, initial_units));
805 775
806 return_ACPI_STATUS (AE_OK); 776 return_ACPI_STATUS(AE_OK);
807} 777}
808EXPORT_SYMBOL(acpi_os_create_semaphore);
809 778
779EXPORT_SYMBOL(acpi_os_create_semaphore);
810 780
811/* 781/*
812 * TODO: A better way to delete semaphores? Linux doesn't have a 782 * TODO: A better way to delete semaphores? Linux doesn't have a
@@ -815,25 +785,24 @@ EXPORT_SYMBOL(acpi_os_create_semaphore);
815 * we at least check for blocked threads and signal/cancel them? 785 * we at least check for blocked threads and signal/cancel them?
816 */ 786 */
817 787
818acpi_status 788acpi_status acpi_os_delete_semaphore(acpi_handle handle)
819acpi_os_delete_semaphore(
820 acpi_handle handle)
821{ 789{
822 struct semaphore *sem = (struct semaphore*) handle; 790 struct semaphore *sem = (struct semaphore *)handle;
823 791
824 ACPI_FUNCTION_TRACE ("os_delete_semaphore"); 792 ACPI_FUNCTION_TRACE("os_delete_semaphore");
825 793
826 if (!sem) 794 if (!sem)
827 return_ACPI_STATUS (AE_BAD_PARAMETER); 795 return_ACPI_STATUS(AE_BAD_PARAMETER);
828 796
829 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); 797 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
830 798
831 acpi_os_free(sem); sem = NULL; 799 acpi_os_free(sem);
800 sem = NULL;
832 801
833 return_ACPI_STATUS (AE_OK); 802 return_ACPI_STATUS(AE_OK);
834} 803}
835EXPORT_SYMBOL(acpi_os_delete_semaphore);
836 804
805EXPORT_SYMBOL(acpi_os_delete_semaphore);
837 806
838/* 807/*
839 * TODO: The kernel doesn't have a 'down_timeout' function -- had to 808 * TODO: The kernel doesn't have a 'down_timeout' function -- had to
@@ -844,31 +813,27 @@ EXPORT_SYMBOL(acpi_os_delete_semaphore);
844 * 813 *
845 * TODO: Support for units > 1? 814 * TODO: Support for units > 1?
846 */ 815 */
847acpi_status 816acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
848acpi_os_wait_semaphore(
849 acpi_handle handle,
850 u32 units,
851 u16 timeout)
852{ 817{
853 acpi_status status = AE_OK; 818 acpi_status status = AE_OK;
854 struct semaphore *sem = (struct semaphore*)handle; 819 struct semaphore *sem = (struct semaphore *)handle;
855 int ret = 0; 820 int ret = 0;
856 821
857 ACPI_FUNCTION_TRACE ("os_wait_semaphore"); 822 ACPI_FUNCTION_TRACE("os_wait_semaphore");
858 823
859 if (!sem || (units < 1)) 824 if (!sem || (units < 1))
860 return_ACPI_STATUS (AE_BAD_PARAMETER); 825 return_ACPI_STATUS(AE_BAD_PARAMETER);
861 826
862 if (units > 1) 827 if (units > 1)
863 return_ACPI_STATUS (AE_SUPPORT); 828 return_ACPI_STATUS(AE_SUPPORT);
864 829
865 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout)); 830 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
831 handle, units, timeout));
866 832
867 if (in_atomic()) 833 if (in_atomic())
868 timeout = 0; 834 timeout = 0;
869 835
870 switch (timeout) 836 switch (timeout) {
871 {
872 /* 837 /*
873 * No Wait: 838 * No Wait:
874 * -------- 839 * --------
@@ -876,8 +841,8 @@ acpi_os_wait_semaphore(
876 * acquire the semaphore if available otherwise return AE_TIME 841 * acquire the semaphore if available otherwise return AE_TIME
877 * (a.k.a. 'would block'). 842 * (a.k.a. 'would block').
878 */ 843 */
879 case 0: 844 case 0:
880 if(down_trylock(sem)) 845 if (down_trylock(sem))
881 status = AE_TIME; 846 status = AE_TIME;
882 break; 847 break;
883 848
@@ -885,7 +850,7 @@ acpi_os_wait_semaphore(
885 * Wait Indefinitely: 850 * Wait Indefinitely:
886 * ------------------ 851 * ------------------
887 */ 852 */
888 case ACPI_WAIT_FOREVER: 853 case ACPI_WAIT_FOREVER:
889 down(sem); 854 down(sem);
890 break; 855 break;
891 856
@@ -893,11 +858,11 @@ acpi_os_wait_semaphore(
893 * Wait w/ Timeout: 858 * Wait w/ Timeout:
894 * ---------------- 859 * ----------------
895 */ 860 */
896 default: 861 default:
897 // TODO: A better timeout algorithm? 862 // TODO: A better timeout algorithm?
898 { 863 {
899 int i = 0; 864 int i = 0;
900 static const int quantum_ms = 1000/HZ; 865 static const int quantum_ms = 1000 / HZ;
901 866
902 ret = down_trylock(sem); 867 ret = down_trylock(sem);
903 for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) { 868 for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) {
@@ -905,7 +870,7 @@ acpi_os_wait_semaphore(
905 schedule_timeout(1); 870 schedule_timeout(1);
906 ret = down_trylock(sem); 871 ret = down_trylock(sem);
907 } 872 }
908 873
909 if (ret != 0) 874 if (ret != 0)
910 status = AE_TIME; 875 status = AE_TIME;
911 } 876 }
@@ -913,47 +878,48 @@ acpi_os_wait_semaphore(
913 } 878 }
914 879
915 if (ACPI_FAILURE(status)) { 880 if (ACPI_FAILURE(status)) {
916 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to acquire semaphore[%p|%d|%d], %s\n", 881 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
917 handle, units, timeout, acpi_format_exception(status))); 882 "Failed to acquire semaphore[%p|%d|%d], %s\n",
918 } 883 handle, units, timeout,
919 else { 884 acpi_format_exception(status)));
920 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout)); 885 } else {
886 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
887 "Acquired semaphore[%p|%d|%d]\n", handle,
888 units, timeout));
921 } 889 }
922 890
923 return_ACPI_STATUS (status); 891 return_ACPI_STATUS(status);
924} 892}
925EXPORT_SYMBOL(acpi_os_wait_semaphore);
926 893
894EXPORT_SYMBOL(acpi_os_wait_semaphore);
927 895
928/* 896/*
929 * TODO: Support for units > 1? 897 * TODO: Support for units > 1?
930 */ 898 */
931acpi_status 899acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
932acpi_os_signal_semaphore(
933 acpi_handle handle,
934 u32 units)
935{ 900{
936 struct semaphore *sem = (struct semaphore *) handle; 901 struct semaphore *sem = (struct semaphore *)handle;
937 902
938 ACPI_FUNCTION_TRACE ("os_signal_semaphore"); 903 ACPI_FUNCTION_TRACE("os_signal_semaphore");
939 904
940 if (!sem || (units < 1)) 905 if (!sem || (units < 1))
941 return_ACPI_STATUS (AE_BAD_PARAMETER); 906 return_ACPI_STATUS(AE_BAD_PARAMETER);
942 907
943 if (units > 1) 908 if (units > 1)
944 return_ACPI_STATUS (AE_SUPPORT); 909 return_ACPI_STATUS(AE_SUPPORT);
945 910
946 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, units)); 911 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
912 units));
947 913
948 up(sem); 914 up(sem);
949 915
950 return_ACPI_STATUS (AE_OK); 916 return_ACPI_STATUS(AE_OK);
951} 917}
918
952EXPORT_SYMBOL(acpi_os_signal_semaphore); 919EXPORT_SYMBOL(acpi_os_signal_semaphore);
953 920
954#ifdef ACPI_FUTURE_USAGE 921#ifdef ACPI_FUTURE_USAGE
955u32 922u32 acpi_os_get_line(char *buffer)
956acpi_os_get_line(char *buffer)
957{ 923{
958 924
959#ifdef ENABLE_DEBUGGER 925#ifdef ENABLE_DEBUGGER
@@ -970,22 +936,21 @@ acpi_os_get_line(char *buffer)
970 936
971 return 0; 937 return 0;
972} 938}
973#endif /* ACPI_FUTURE_USAGE */ 939#endif /* ACPI_FUTURE_USAGE */
974 940
975/* Assumes no unreadable holes inbetween */ 941/* Assumes no unreadable holes inbetween */
976u8 942u8 acpi_os_readable(void *ptr, acpi_size len)
977acpi_os_readable(void *ptr, acpi_size len)
978{ 943{
979#if defined(__i386__) || defined(__x86_64__) 944#if defined(__i386__) || defined(__x86_64__)
980 char tmp; 945 char tmp;
981 return !__get_user(tmp, (char __user *)ptr) && !__get_user(tmp, (char __user *)ptr + len - 1); 946 return !__get_user(tmp, (char __user *)ptr)
947 && !__get_user(tmp, (char __user *)ptr + len - 1);
982#endif 948#endif
983 return 1; 949 return 1;
984} 950}
985 951
986#ifdef ACPI_FUTURE_USAGE 952#ifdef ACPI_FUTURE_USAGE
987u8 953u8 acpi_os_writable(void *ptr, acpi_size len)
988acpi_os_writable(void *ptr, acpi_size len)
989{ 954{
990 /* could do dummy write (racy) or a kernel page table lookup. 955 /* could do dummy write (racy) or a kernel page table lookup.
991 The later may be difficult at early boot when kmap doesn't work yet. */ 956 The later may be difficult at early boot when kmap doesn't work yet. */
@@ -993,8 +958,7 @@ acpi_os_writable(void *ptr, acpi_size len)
993} 958}
994#endif 959#endif
995 960
996u32 961u32 acpi_os_get_thread_id(void)
997acpi_os_get_thread_id (void)
998{ 962{
999 if (!in_atomic()) 963 if (!in_atomic())
1000 return current->pid; 964 return current->pid;
@@ -1002,13 +966,9 @@ acpi_os_get_thread_id (void)
1002 return 0; 966 return 0;
1003} 967}
1004 968
1005acpi_status 969acpi_status acpi_os_signal(u32 function, void *info)
1006acpi_os_signal (
1007 u32 function,
1008 void *info)
1009{ 970{
1010 switch (function) 971 switch (function) {
1011 {
1012 case ACPI_SIGNAL_FATAL: 972 case ACPI_SIGNAL_FATAL:
1013 printk(KERN_ERR PREFIX "Fatal opcode executed\n"); 973 printk(KERN_ERR PREFIX "Fatal opcode executed\n");
1014 break; 974 break;
@@ -1028,13 +988,13 @@ acpi_os_signal (
1028 988
1029 return AE_OK; 989 return AE_OK;
1030} 990}
991
1031EXPORT_SYMBOL(acpi_os_signal); 992EXPORT_SYMBOL(acpi_os_signal);
1032 993
1033static int __init 994static int __init acpi_os_name_setup(char *str)
1034acpi_os_name_setup(char *str)
1035{ 995{
1036 char *p = acpi_os_name; 996 char *p = acpi_os_name;
1037 int count = ACPI_MAX_OVERRIDE_LEN-1; 997 int count = ACPI_MAX_OVERRIDE_LEN - 1;
1038 998
1039 if (!str || !*str) 999 if (!str || !*str)
1040 return 0; 1000 return 0;
@@ -1050,7 +1010,7 @@ acpi_os_name_setup(char *str)
1050 *p = 0; 1010 *p = 0;
1051 1011
1052 return 1; 1012 return 1;
1053 1013
1054} 1014}
1055 1015
1056__setup("acpi_os_name=", acpi_os_name_setup); 1016__setup("acpi_os_name=", acpi_os_name_setup);
@@ -1060,16 +1020,15 @@ __setup("acpi_os_name=", acpi_os_name_setup);
1060 * empty string disables _OSI 1020 * empty string disables _OSI
1061 * TBD additional string adds to _OSI 1021 * TBD additional string adds to _OSI
1062 */ 1022 */
1063static int __init 1023static int __init acpi_osi_setup(char *str)
1064acpi_osi_setup(char *str)
1065{ 1024{
1066 if (str == NULL || *str == '\0') { 1025 if (str == NULL || *str == '\0') {
1067 printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1026 printk(KERN_INFO PREFIX "_OSI method disabled\n");
1068 acpi_gbl_create_osi_method = FALSE; 1027 acpi_gbl_create_osi_method = FALSE;
1069 } else 1028 } else {
1070 {
1071 /* TBD */ 1029 /* TBD */
1072 printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", str); 1030 printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n",
1031 str);
1073 } 1032 }
1074 1033
1075 return 1; 1034 return 1;
@@ -1078,8 +1037,7 @@ acpi_osi_setup(char *str)
1078__setup("acpi_osi=", acpi_osi_setup); 1037__setup("acpi_osi=", acpi_osi_setup);
1079 1038
1080/* enable serialization to combat AE_ALREADY_EXISTS errors */ 1039/* enable serialization to combat AE_ALREADY_EXISTS errors */
1081static int __init 1040static int __init acpi_serialize_setup(char *str)
1082acpi_serialize_setup(char *str)
1083{ 1041{
1084 printk(KERN_INFO PREFIX "serialize enabled\n"); 1042 printk(KERN_INFO PREFIX "serialize enabled\n");
1085 1043
@@ -1099,8 +1057,7 @@ __setup("acpi_serialize", acpi_serialize_setup);
1099 * Run-time events on the same GPE this flag is available 1057 * Run-time events on the same GPE this flag is available
1100 * to tell Linux to keep the wake-time GPEs enabled at run-time. 1058 * to tell Linux to keep the wake-time GPEs enabled at run-time.
1101 */ 1059 */
1102static int __init 1060static int __init acpi_wake_gpes_always_on_setup(char *str)
1103acpi_wake_gpes_always_on_setup(char *str)
1104{ 1061{
1105 printk(KERN_INFO PREFIX "wake GPEs not disabled\n"); 1062 printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
1106 1063
@@ -1111,8 +1068,7 @@ acpi_wake_gpes_always_on_setup(char *str)
1111 1068
1112__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); 1069__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
1113 1070
1114int __init 1071int __init acpi_hotkey_setup(char *str)
1115acpi_hotkey_setup(char *str)
1116{ 1072{
1117 acpi_specific_hotkey_enabled = TRUE; 1073 acpi_specific_hotkey_enabled = TRUE;
1118 return 1; 1074 return 1;
@@ -1126,7 +1082,6 @@ __setup("acpi_specific_hotkey", acpi_hotkey_setup);
1126 */ 1082 */
1127unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER; 1083unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
1128 1084
1129
1130EXPORT_SYMBOL(max_cstate); 1085EXPORT_SYMBOL(max_cstate);
1131 1086
1132/* 1087/*
@@ -1137,12 +1092,10 @@ EXPORT_SYMBOL(max_cstate);
1137 * that indicates whether we are at interrupt level. 1092 * that indicates whether we are at interrupt level.
1138 */ 1093 */
1139 1094
1140unsigned long 1095unsigned long acpi_os_acquire_lock(acpi_handle handle)
1141acpi_os_acquire_lock (
1142 acpi_handle handle)
1143{ 1096{
1144 unsigned long flags; 1097 unsigned long flags;
1145 spin_lock_irqsave((spinlock_t *)handle, flags); 1098 spin_lock_irqsave((spinlock_t *) handle, flags);
1146 return flags; 1099 return flags;
1147} 1100}
1148 1101
@@ -1150,15 +1103,11 @@ acpi_os_acquire_lock (
1150 * Release a spinlock. See above. 1103 * Release a spinlock. See above.
1151 */ 1104 */
1152 1105
1153void 1106void acpi_os_release_lock(acpi_handle handle, unsigned long flags)
1154acpi_os_release_lock (
1155 acpi_handle handle,
1156 unsigned long flags)
1157{ 1107{
1158 spin_unlock_irqrestore((spinlock_t *)handle, flags); 1108 spin_unlock_irqrestore((spinlock_t *) handle, flags);
1159} 1109}
1160 1110
1161
1162#ifndef ACPI_USE_LOCAL_CACHE 1111#ifndef ACPI_USE_LOCAL_CACHE
1163 1112
1164/******************************************************************************* 1113/*******************************************************************************
@@ -1177,13 +1126,9 @@ acpi_os_release_lock (
1177 ******************************************************************************/ 1126 ******************************************************************************/
1178 1127
1179acpi_status 1128acpi_status
1180acpi_os_create_cache ( 1129acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
1181 char *name,
1182 u16 size,
1183 u16 depth,
1184 acpi_cache_t **cache)
1185{ 1130{
1186 *cache = kmem_cache_create (name, size, 0, 0, NULL, NULL); 1131 *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL);
1187 return AE_OK; 1132 return AE_OK;
1188} 1133}
1189 1134
@@ -1199,12 +1144,10 @@ acpi_os_create_cache (
1199 * 1144 *
1200 ******************************************************************************/ 1145 ******************************************************************************/
1201 1146
1202acpi_status 1147acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
1203acpi_os_purge_cache (
1204 acpi_cache_t *cache)
1205{ 1148{
1206 (void) kmem_cache_shrink(cache); 1149 (void)kmem_cache_shrink(cache);
1207 return (AE_OK); 1150 return (AE_OK);
1208} 1151}
1209 1152
1210/******************************************************************************* 1153/*******************************************************************************
@@ -1220,12 +1163,10 @@ acpi_os_purge_cache (
1220 * 1163 *
1221 ******************************************************************************/ 1164 ******************************************************************************/
1222 1165
1223acpi_status 1166acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
1224acpi_os_delete_cache (
1225 acpi_cache_t *cache)
1226{ 1167{
1227 (void)kmem_cache_destroy(cache); 1168 (void)kmem_cache_destroy(cache);
1228 return (AE_OK); 1169 return (AE_OK);
1229} 1170}
1230 1171
1231/******************************************************************************* 1172/*******************************************************************************
@@ -1242,13 +1183,10 @@ acpi_os_delete_cache (
1242 * 1183 *
1243 ******************************************************************************/ 1184 ******************************************************************************/
1244 1185
1245acpi_status 1186acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1246acpi_os_release_object (
1247 acpi_cache_t *cache,
1248 void *object)
1249{ 1187{
1250 kmem_cache_free(cache, object); 1188 kmem_cache_free(cache, object);
1251 return (AE_OK); 1189 return (AE_OK);
1252} 1190}
1253 1191
1254/******************************************************************************* 1192/*******************************************************************************
@@ -1265,14 +1203,11 @@ acpi_os_release_object (
1265 * 1203 *
1266 ******************************************************************************/ 1204 ******************************************************************************/
1267 1205
1268void * 1206void *acpi_os_acquire_object(acpi_cache_t * cache)
1269acpi_os_acquire_object (
1270 acpi_cache_t *cache)
1271{ 1207{
1272 void *object = kmem_cache_alloc(cache, GFP_KERNEL); 1208 void *object = kmem_cache_alloc(cache, GFP_KERNEL);
1273 WARN_ON(!object); 1209 WARN_ON(!object);
1274 return object; 1210 return object;
1275} 1211}
1276 1212
1277#endif 1213#endif
1278