1 | /** @file
|
---|
2 | * VBoxAcpi - Virtual Box ACPI maniputation functionality.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
17 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
18 | * additional information or have any questions.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #if !defined(IN_RING3)
|
---|
22 | #error Pure R3 code
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #include <VBox/pdmdev.h>
|
---|
26 | #include <VBox/pgm.h>
|
---|
27 | #include <VBox/log.h>
|
---|
28 | #include <VBox/param.h>
|
---|
29 | #include <iprt/assert.h>
|
---|
30 | #include <iprt/alloc.h>
|
---|
31 | #include <iprt/string.h>
|
---|
32 |
|
---|
33 | #ifdef VBOX_WITH_DYNAMIC_DSDT
|
---|
34 | /* vbox.dsl - input to generate proper DSDT on the fly */
|
---|
35 | # include <vboxdsl.hex>
|
---|
36 | #else
|
---|
37 | /* Statically compiled AML */
|
---|
38 | # include <vboxaml.hex>
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #ifdef VBOX_WITH_DYNAMIC_DSDT
|
---|
42 | static int prepareDynamicDsdt(PPDMDEVINS pDevIns,
|
---|
43 | void* *ppPtr,
|
---|
44 | size_t *puDsdtLen)
|
---|
45 | {
|
---|
46 | //LogRel(("file is %s\n", g_abVboxDslSource));
|
---|
47 | *ppPtr = NULL;
|
---|
48 | *puDsdtLen = 0;
|
---|
49 | return 0;
|
---|
50 | }
|
---|
51 |
|
---|
52 | static int cleanupDynamicDsdt(PPDMDEVINS pDevIns,
|
---|
53 | void* pPtr)
|
---|
54 | {
|
---|
55 | return 0;
|
---|
56 | }
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | /* Two only public functions */
|
---|
60 | int acpiPrepareDsdt(PPDMDEVINS pDevIns, void * *ppPtr, size_t *puDsdtLen)
|
---|
61 | {
|
---|
62 | #ifdef VBOX_WITH_DYNAMIC_DSDT
|
---|
63 | return prepareDynamicDsdt(pDevIns, ppPtr, puDsdtLen);
|
---|
64 | #else
|
---|
65 | *ppPtr = AmlCode;
|
---|
66 | *puDsdtLen = sizeof(AmlCode);
|
---|
67 | return 0;
|
---|
68 | #endif
|
---|
69 | }
|
---|
70 |
|
---|
71 | int acpiCleanupDsdt(PPDMDEVINS pDevIns, void * pPtr)
|
---|
72 | {
|
---|
73 | #ifdef VBOX_WITH_DYNAMIC_DSDT
|
---|
74 | return cleanupDynamicDsdt(pDevIns, pPtr);
|
---|
75 | #else
|
---|
76 | /* Do nothing */
|
---|
77 | return 0;
|
---|
78 | #endif
|
---|
79 | }
|
---|