Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6595 serge 1
 
2
#include 
3
#include 
4
#include 
5
#include 
6
7
 
8
 
9
10
 
11
12
 
13
14
 
15
 
16
{
17
    int result;
18
19
 
20
        return 0;
21
22
 
23
    {
24
        printk("Can't open /tmp0/1/acpi.log\nExit\n");
25
        return 0;
26
    }
27
28
 
29
30
 
31
32
 
33
34
 
35
36
 
37
38
 
39
 
40
//            printk(KERN_INFO PREFIX "Interpreter disabled.\n");
41
//            return -ENODEV;
42
//    }
43
44
 
45
//    result = acpi_bus_init();
46
//    if (result) {
47
//            disable_acpi();
48
//            return result;
49
//    }
50
51
 
52
//    acpi_scan_init();
53
//    acpi_ec_init();
54
//    acpi_debugfs_init();
55
//    acpi_sleep_proc_init();
56
//    acpi_wakeup_device_init();
57
58
 
59
60
 
61
 
62
63
 
64
65
 
66
 
67
68
 
69
70
 
71
{
72
    return AcpiGetRootPtr();
73
}
74
75
 
76
{
77
    return (void *)MapIoMem((addr_t)phys, size, PG_SW);
78
79
 
80
81
 
82
{
83
    u32 ptr = (u32)virt;
84
    ptr &= 0xFFFFF000;
85
86
 
87
}
88
89
 
90
{
91
    acpi_os_unmap_memory(virt, size);
92
}
93
94
 
95
 
96
{
97
    addr_t addr;
98
    void *virt;
99
100
 
101
        return 0;
102
103
 
104
105
 
106
        return -EINVAL;
107
108
 
109
    if (!virt)
110
        return -EIO;
111
112
 
113
}
114
115
 
116
 
117
{
118
    va_list args;
119
    va_start(args, fmt);
120
    acpi_os_vprintf(fmt, args);
121
    va_end(args);
122
}
123
124
 
125
{
126
    static char buffer[512];
127
128
 
129
130
 
131
    if (acpi_in_debugger) {
132
        kdb_printf("%s", buffer);
133
    } else {
134
            printk("%s", buffer);
135
    }
136
#else
137
    printk("%s", buffer);
138
#endif
139
}
140
141
 
142
 
143
{
144
     pr_warn(PREFIX
145
             "Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n",
146
             table->signature, table->oem_table_id);
147
     add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
148
}
149
150
 
151
 
152
 
153
 
154
acpi_os_table_override(struct acpi_table_header * existing_table,
155
                       struct acpi_table_header ** new_table)
156
{
157
    if (!existing_table || !new_table)
158
        return AE_BAD_PARAMETER;
159
160
 
161
162
 
163
    if (strncmp(existing_table->signature, "DSDT", 4) == 0)
164
        *new_table = (struct acpi_table_header *)AmlCode;
165
#endif
166
    if (*new_table != NULL)
167
        acpi_table_taint(existing_table);
168
    return AE_OK;
169
}
170
171
 
172
acpi_os_physical_table_override(struct acpi_table_header *existing_table,
173
                                acpi_physical_address *address,
174
                                u32 *table_length)
175
{
176
#ifndef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
177
        *table_length = 0;
178
        *address = 0;
179
        return AE_OK;
180
#else
181
        int table_offset = 0;
182
        struct acpi_table_header *table;
183
184
 
185
        *address = 0;
186
187
 
188
                return AE_OK;
189
190
 
191
                if (table_offset + ACPI_HEADER_SIZE > all_tables_size) {
192
                        WARN_ON(1);
193
                        return AE_OK;
194
                }
195
196
 
197
                                           ACPI_HEADER_SIZE);
198
199
 
200
                        acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
201
                        WARN_ON(1);
202
                        return AE_OK;
203
                }
204
205
 
206
207
 
208
                        acpi_os_unmap_memory(table,
209
                                     ACPI_HEADER_SIZE);
210
                        continue;
211
                }
212
213
 
214
                if (memcmp(table->oem_table_id, existing_table->oem_table_id,
215
                           ACPI_OEM_TABLE_ID_SIZE)) {
216
                        acpi_os_unmap_memory(table,
217
                                     ACPI_HEADER_SIZE);
218
                        continue;
219
                }
220
221
 
222
                *table_length = table->length;
223
                acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
224
                *address = acpi_tables_addr + table_offset;
225
                break;
226
        } while (table_offset + ACPI_HEADER_SIZE < all_tables_size);
227
228
 
229
                acpi_table_taint(existing_table);
230
        return AE_OK;
231
#endif
232
}
233
234
 
235
 
236
        unsigned int    enable:1;
237
        unsigned int    dmi:1;
238
        unsigned int    cmdline:1;
239
        unsigned int    default_disabling:1;
240
241
 
242
243
 
244
#define OSI_STRING_ENTRIES_MAX 16       /* arbitrary */
245
246
 
247
    char string[OSI_STRING_LENGTH_MAX];
248
    bool enable;
249
};
250
251
 
252
        osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = {
253
    {"Module Device", true},
254
    {"Processor Device", true},
255
    {"3.0 _SCP Extensions", true},
256
    {"Processor Aggregator Device", true},
257
};
258
void __init acpi_osi_setup(char *str)
259
{
260
        struct osi_setup_entry *osi;
261
        bool enable = true;
262
        int i;
263
264
 
265
                return;
266
267
 
268
                printk(KERN_INFO PREFIX "_OSI method disabled\n");
269
                acpi_gbl_create_osi_method = FALSE;
270
                return;
271
        }
272
273
 
274
                str++;
275
                if (*str == '\0') {
276
                        osi_linux.default_disabling = 1;
277
                        return;
278
                } else if (*str == '*') {
279
                        acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
280
                        for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
281
                                osi = &osi_setup_entries[i];
282
                                osi->enable = false;
283
                        }
284
                        return;
285
                }
286
                enable = false;
287
        }
288
289
 
290
                osi = &osi_setup_entries[i];
291
                if (!strcmp(osi->string, str)) {
292
                        osi->enable = enable;
293
                        break;
294
                } else if (osi->string[0] == '\0') {
295
                        osi->enable = enable;
296
                        strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
297
                        break;
298
                }
299
        }
300
}
301
302
 
303
{
304
    if (osi_linux.enable != enable)
305
        osi_linux.enable = enable;
306
307
 
308
        acpi_osi_setup("Linux");
309
    else
310
        acpi_osi_setup("!Linux");
311
312
 
313
}
314
315
 
316
{
317
    printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
318
319
 
320
        return;
321
322
 
323
    set_osi_linux(enable);
324
325
 
326
}
327
328
 
329
{
330
    void *sem = (void*)handle;
331
332
 
333
        return AE_OK;
334
335
 
336
        return AE_BAD_PARAMETER;
337
338
 
339
        return AE_SUPPORT;
340
341
 
342
                      handle, units, timeout));
343
344
 
345
}
346
347
 
348
{
349
    void *sem = (void*)handle;
350
351
 
352
            return AE_OK;
353
354
 
355
            return AE_BAD_PARAMETER;
356
357
 
358
            return AE_SUPPORT;
359
360
 
361
                      units));
362
363
 
364
365
 
366
}
367
368
 
369
 
370
{
371
//    acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block);
372
//    acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1b_event_block);
373
//    acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe0_block);
374
//    acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe1_block);
375
    if (acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) {
376
            /*
377
             * Use acpi_os_map_generic_address to pre-map the reset
378
             * register if it's in system memory.
379
             */
380
            int rv;
381
382
 
383
            pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv);
384
    }
385
    acpi_os_initialized = true;
386
387
 
388
}
389
390
 
391
{
392
//        kacpid_wq = alloc_workqueue("kacpid", 0, 1);
393
//        kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1);
394
//        kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0);
395
//        BUG_ON(!kacpid_wq);
396
//        BUG_ON(!kacpi_notify_wq);
397
//       BUG_ON(!kacpi_hotplug_wq);
398
//        acpi_install_interface_handler(acpi_osi_handler);
399
//        acpi_osi_setup_late();
400
        return AE_OK;
401
}
402
403
 
404
 
405
{
406
//        void *sem = (void*)handle;
407
408
 
409
//            return AE_BAD_PARAMETER;
410
411
 
412
//        sem = NULL;
413
414
 
415
}
416
417
 
418
                         u32 initial_units, acpi_handle * out_handle)
419
{
420
    *out_handle = (acpi_handle) 1;
421
    return (AE_OK);
422
}
423
424
 
425
acpi_os_create_mutex(acpi_handle * handle)
426
{
427
    struct mutex *mtx = NULL;
428
429
 
430
431
 
432
            return AE_NO_MEMORY;
433
434
 
435
436
 
437
438
 
439
}
440
441
 
442
{
443
    struct mutex *mtx = (struct mutex*)handle;
444
445
 
446
        return;
447
448
 
449
}
450
451
 
452
{
453
    struct mutex *mtx = (struct mutex*)handle;
454
455
 
456
        return AE_OK;
457
458
 
459
460
 
461
}
462
463
 
464
{
465
    struct mutex *mtx = (struct mutex*)handle;
466
467
 
468
};
469
470
 
471
{
472
    acpi_cpu_flags flags;
473
    spin_lock_irqsave(lockp, flags);
474
    return flags;
475
}
476
477
 
478
 
479
{
480
    spin_unlock_irqrestore(lockp, flags);
481
}
482
483
 
484
 
485
{
486
        switch (function) {
487
        case ACPI_SIGNAL_FATAL:
488
                printk(KERN_ERR PREFIX "Fatal opcode executed\n");
489
                break;
490
        case ACPI_SIGNAL_BREAKPOINT:
491
                /*
492
                 * AML Breakpoint
493
                 * ACPI spec. says to treat it as a NOP unless
494
                 * you are debugging.  So if/when we integrate
495
                 * AML debugger into the kernel debugger its
496
                 * hook will go here.  But until then it is
497
                 * not useful to print anything on breakpoints.
498
                 */
499
                break;
500
        default:
501
                break;
502
        }
503
504
 
505
}
506
507
 
508
{
509
        msleep(ms);
510
}
511
512
 
513
{
514
        while (us) {
515
                u32 delay = 1000;
516
517
 
518
                        delay = us;
519
                udelay(delay);
520
//                touch_nmi_watchdog();
521
                us -= delay;
522
        }
523
}
524
525
 
526
{
527
    msecs /= 10;
528
    if(!msecs) msecs = 1;
529
530
 
531
     "call *__imp__Delay"
532
     ::"b" (msecs));
533
     __asm__ __volatile__ (
534
     "":::"ebx");
535
536
 
537
538
 
539
                            acpi_osd_exec_callback function, void *context)
540
{
541
542
 
543
}
544
545
 
546
 
547
{
548
    u64 time_ns = ktime_to_ns(ktime_get());
549
    do_div(time_ns, 100);
550
    return time_ns;
551
}
552
553
 
554
{
555
    ktime_t t;
556
557
 
558
559
 
560
}
561
562
 
563
{
564
        asm volatile(
565
                "test %0,%0\n"
566
                "jz 3f\n"
567
                "jmp 1f\n"
568
569
 
570
                "1: jmp 2f\n"
571
572
 
573
                "2: dec %0\n"
574
                " jnz 2b\n"
575
                "3: dec %0\n"
576
577
 
578
                : "a" (loops)
579
        );
580
}
581
582
 
583
 
584
{
585
        int d0;
586
587
 
588
        asm("mull %%edx"
589
                : "=d" (xloops), "=&a" (d0)
590
                : "1" (xloops), ""
591
                (loops_per_jiffy * (HZ/4)));
592
593
 
594
}
595
596
 
597
{
598
        __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
599
}
600
601
 
602
 
603
604
 
605
606
 
607
608
 
609
 
610
acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
611
                            char **new_val)
612
{
613
        if (!init_val || !new_val)
614
                return AE_BAD_PARAMETER;
615
616
 
617
        if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
618
                printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
619
                       acpi_os_name);
620
                *new_val = acpi_os_name;
621
        }
622
623
 
624
                printk(KERN_INFO PREFIX "Overriding _REV return value to 5\n");
625
                *new_val = (char *)5;
626
        }
627
628
 
629
}
630