/root/src/xen/xen/drivers/acpi/utilities/utglobal.c
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Module Name: utglobal - Global variables for the ACPI subsystem |
4 | | * |
5 | | *****************************************************************************/ |
6 | | |
7 | | /* |
8 | | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | | * All rights reserved. |
10 | | * |
11 | | * Redistribution and use in source and binary forms, with or without |
12 | | * modification, are permitted provided that the following conditions |
13 | | * are met: |
14 | | * 1. Redistributions of source code must retain the above copyright |
15 | | * notice, this list of conditions, and the following disclaimer, |
16 | | * without modification. |
17 | | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
18 | | * substantially similar to the "NO WARRANTY" disclaimer below |
19 | | * ("Disclaimer") and any redistribution must be conditioned upon |
20 | | * including a substantially similar Disclaimer requirement for further |
21 | | * binary redistribution. |
22 | | * 3. Neither the names of the above-listed copyright holders nor the names |
23 | | * of any contributors may be used to endorse or promote products derived |
24 | | * from this software without specific prior written permission. |
25 | | * |
26 | | * Alternatively, this software may be distributed under the terms of the |
27 | | * GNU General Public License ("GPL") version 2 as published by the Free |
28 | | * Software Foundation. |
29 | | * |
30 | | * NO WARRANTY |
31 | | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
32 | | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
33 | | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
34 | | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
35 | | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
36 | | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
37 | | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
38 | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
39 | | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
40 | | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
41 | | * POSSIBILITY OF SUCH DAMAGES. |
42 | | */ |
43 | | |
44 | | #define DEFINE_ACPI_GLOBALS |
45 | | |
46 | | #include <xen/init.h> |
47 | | #include <xen/lib.h> |
48 | | #include <asm/processor.h> |
49 | | #include <acpi/acpi.h> |
50 | | |
51 | | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) |
52 | | #define _COMPONENT ACPI_UTILITIES |
53 | | ACPI_MODULE_NAME("utglobal") |
54 | | |
55 | | /******************************************************************************* |
56 | | * |
57 | | * FUNCTION: acpi_format_exception |
58 | | * |
59 | | * PARAMETERS: Status - The acpi_status code to be formatted |
60 | | * |
61 | | * RETURN: A string containing the exception text. A valid pointer is |
62 | | * always returned. |
63 | | * |
64 | | * DESCRIPTION: This function translates an ACPI exception into an ASCII string |
65 | | * It is here instead of utxface.c so it is always present. |
66 | | * |
67 | | ******************************************************************************/ |
68 | | |
69 | | const char *__init acpi_format_exception(acpi_status status) |
70 | 0 | { |
71 | 0 | const char *exception = NULL; |
72 | 0 |
|
73 | 0 | ACPI_FUNCTION_ENTRY(); |
74 | 0 |
|
75 | 0 | exception = acpi_ut_validate_exception(status); |
76 | 0 | if (!exception) { |
77 | 0 |
|
78 | 0 | /* Exception code was not recognized */ |
79 | 0 |
|
80 | 0 | ACPI_ERROR((AE_INFO, |
81 | 0 | "Unknown exception code: %#X", status)); |
82 | 0 |
|
83 | 0 | exception = "UNKNOWN_STATUS_CODE"; |
84 | 0 | dump_execution_state(); |
85 | 0 | } |
86 | 0 |
|
87 | 0 | return (ACPI_CAST_PTR(const char, exception)); |
88 | 0 | } |
89 | | |
90 | | /****************************************************************************** |
91 | | * |
92 | | * Event and Hardware globals |
93 | | * |
94 | | ******************************************************************************/ |
95 | | |
96 | | struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { |
97 | | /* Name Parent Register Register Bit Position Register Bit Mask */ |
98 | | |
99 | | /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
100 | | ACPI_BITPOSITION_TIMER_STATUS, |
101 | | ACPI_BITMASK_TIMER_STATUS}, |
102 | | /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
103 | | ACPI_BITPOSITION_BUS_MASTER_STATUS, |
104 | | ACPI_BITMASK_BUS_MASTER_STATUS}, |
105 | | /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
106 | | ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, |
107 | | ACPI_BITMASK_GLOBAL_LOCK_STATUS}, |
108 | | /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
109 | | ACPI_BITPOSITION_POWER_BUTTON_STATUS, |
110 | | ACPI_BITMASK_POWER_BUTTON_STATUS}, |
111 | | /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
112 | | ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, |
113 | | ACPI_BITMASK_SLEEP_BUTTON_STATUS}, |
114 | | /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
115 | | ACPI_BITPOSITION_RT_CLOCK_STATUS, |
116 | | ACPI_BITMASK_RT_CLOCK_STATUS}, |
117 | | /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
118 | | ACPI_BITPOSITION_WAKE_STATUS, |
119 | | ACPI_BITMASK_WAKE_STATUS}, |
120 | | /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
121 | | ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, |
122 | | ACPI_BITMASK_PCIEXP_WAKE_STATUS}, |
123 | | |
124 | | /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
125 | | ACPI_BITPOSITION_TIMER_ENABLE, |
126 | | ACPI_BITMASK_TIMER_ENABLE}, |
127 | | /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
128 | | ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, |
129 | | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, |
130 | | /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
131 | | ACPI_BITPOSITION_POWER_BUTTON_ENABLE, |
132 | | ACPI_BITMASK_POWER_BUTTON_ENABLE}, |
133 | | /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
134 | | ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, |
135 | | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, |
136 | | /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
137 | | ACPI_BITPOSITION_RT_CLOCK_ENABLE, |
138 | | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
139 | | /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, |
140 | | /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, |
141 | | ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, |
142 | | ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, |
143 | | |
144 | | /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
145 | | ACPI_BITPOSITION_SCI_ENABLE, |
146 | | ACPI_BITMASK_SCI_ENABLE}, |
147 | | /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, |
148 | | ACPI_BITPOSITION_BUS_MASTER_RLD, |
149 | | ACPI_BITMASK_BUS_MASTER_RLD}, |
150 | | /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, |
151 | | ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, |
152 | | ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, |
153 | | /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, |
154 | | ACPI_BITPOSITION_SLEEP_TYPE_X, |
155 | | ACPI_BITMASK_SLEEP_TYPE_X}, |
156 | | /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, |
157 | | ACPI_BITPOSITION_SLEEP_TYPE_X, |
158 | | ACPI_BITMASK_SLEEP_TYPE_X}, |
159 | | /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
160 | | ACPI_BITPOSITION_SLEEP_ENABLE, |
161 | | ACPI_BITMASK_SLEEP_ENABLE}, |
162 | | |
163 | | /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, |
164 | | ACPI_BITPOSITION_ARB_DISABLE, |
165 | | ACPI_BITMASK_ARB_DISABLE} |
166 | | }; |
167 | | |
168 | | #ifdef ACPI_DEBUG_OUTPUT |
169 | | |
170 | | /******************************************************************************* |
171 | | * |
172 | | * FUNCTION: acpi_ut_get_region_name |
173 | | * |
174 | | * PARAMETERS: None. |
175 | | * |
176 | | * RETURN: Status |
177 | | * |
178 | | * DESCRIPTION: Translate a Space ID into a name string (Debug only) |
179 | | * |
180 | | ******************************************************************************/ |
181 | | |
182 | | /* Region type decoding */ |
183 | | |
184 | | static const char *const acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { |
185 | | "SystemMemory", |
186 | | "SystemIO", |
187 | | "PCI_Config", |
188 | | "EmbeddedControl", |
189 | | "SMBus", |
190 | | "CMOS", |
191 | | "PCIBARTarget", |
192 | | "DataTable" |
193 | | }; |
194 | | |
195 | | const char *acpi_ut_get_region_name(u8 space_id) |
196 | | { |
197 | | |
198 | | if (space_id >= ACPI_USER_REGION_BEGIN) { |
199 | | return ("UserDefinedRegion"); |
200 | | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { |
201 | | return ("InvalidSpaceId"); |
202 | | } |
203 | | |
204 | | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); |
205 | | } |
206 | | |
207 | | #endif |