diff options
Diffstat (limited to 'drivers/acpi/utilities/utinit.c')
-rw-r--r-- | drivers/acpi/utilities/utinit.c | 135 |
1 files changed, 57 insertions, 78 deletions
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index fd7ceba83229..9dde82b0beaf 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -41,25 +41,18 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | #include <acpi/acevents.h> | 46 | #include <acpi/acevents.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME ("utinit") | 49 | ACPI_MODULE_NAME("utinit") |
51 | 50 | ||
52 | /* Local prototypes */ | 51 | /* Local prototypes */ |
53 | |||
54 | static void | 52 | static void |
55 | acpi_ut_fadt_register_error ( | 53 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); |
56 | char *register_name, | ||
57 | u32 value, | ||
58 | acpi_size offset); | ||
59 | |||
60 | static void acpi_ut_terminate ( | ||
61 | void); | ||
62 | 54 | ||
55 | static void acpi_ut_terminate(void); | ||
63 | 56 | ||
64 | /******************************************************************************* | 57 | /******************************************************************************* |
65 | * | 58 | * |
@@ -76,18 +69,14 @@ static void acpi_ut_terminate ( | |||
76 | ******************************************************************************/ | 69 | ******************************************************************************/ |
77 | 70 | ||
78 | static void | 71 | static void |
79 | acpi_ut_fadt_register_error ( | 72 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) |
80 | char *register_name, | ||
81 | u32 value, | ||
82 | acpi_size offset) | ||
83 | { | 73 | { |
84 | 74 | ||
85 | ACPI_REPORT_WARNING ( | 75 | ACPI_REPORT_WARNING(("Invalid FADT value %s=%X at offset %X FADT=%p\n", |
86 | ("Invalid FADT value %s=%X at offset %X FADT=%p\n", | 76 | register_name, value, (u32) offset, |
87 | register_name, value, (u32) offset, acpi_gbl_FADT)); | 77 | acpi_gbl_FADT)); |
88 | } | 78 | } |
89 | 79 | ||
90 | |||
91 | /****************************************************************************** | 80 | /****************************************************************************** |
92 | * | 81 | * |
93 | * FUNCTION: acpi_ut_validate_fadt | 82 | * FUNCTION: acpi_ut_validate_fadt |
@@ -100,9 +89,7 @@ acpi_ut_fadt_register_error ( | |||
100 | * | 89 | * |
101 | ******************************************************************************/ | 90 | ******************************************************************************/ |
102 | 91 | ||
103 | acpi_status | 92 | acpi_status acpi_ut_validate_fadt(void) |
104 | acpi_ut_validate_fadt ( | ||
105 | void) | ||
106 | { | 93 | { |
107 | 94 | ||
108 | /* | 95 | /* |
@@ -110,64 +97,66 @@ acpi_ut_validate_fadt ( | |||
110 | * but don't abort on any problems, just display error | 97 | * but don't abort on any problems, just display error |
111 | */ | 98 | */ |
112 | if (acpi_gbl_FADT->pm1_evt_len < 4) { | 99 | if (acpi_gbl_FADT->pm1_evt_len < 4) { |
113 | acpi_ut_fadt_register_error ("PM1_EVT_LEN", | 100 | acpi_ut_fadt_register_error("PM1_EVT_LEN", |
114 | (u32) acpi_gbl_FADT->pm1_evt_len, | 101 | (u32) acpi_gbl_FADT->pm1_evt_len, |
115 | ACPI_FADT_OFFSET (pm1_evt_len)); | 102 | ACPI_FADT_OFFSET(pm1_evt_len)); |
116 | } | 103 | } |
117 | 104 | ||
118 | if (!acpi_gbl_FADT->pm1_cnt_len) { | 105 | if (!acpi_gbl_FADT->pm1_cnt_len) { |
119 | acpi_ut_fadt_register_error ("PM1_CNT_LEN", 0, | 106 | acpi_ut_fadt_register_error("PM1_CNT_LEN", 0, |
120 | ACPI_FADT_OFFSET (pm1_cnt_len)); | 107 | ACPI_FADT_OFFSET(pm1_cnt_len)); |
121 | } | 108 | } |
122 | 109 | ||
123 | if (!acpi_gbl_FADT->xpm1a_evt_blk.address) { | 110 | if (!acpi_gbl_FADT->xpm1a_evt_blk.address) { |
124 | acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK", 0, | 111 | acpi_ut_fadt_register_error("X_PM1a_EVT_BLK", 0, |
125 | ACPI_FADT_OFFSET (xpm1a_evt_blk.address)); | 112 | ACPI_FADT_OFFSET(xpm1a_evt_blk. |
113 | address)); | ||
126 | } | 114 | } |
127 | 115 | ||
128 | if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) { | 116 | if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) { |
129 | acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK", 0, | 117 | acpi_ut_fadt_register_error("X_PM1a_CNT_BLK", 0, |
130 | ACPI_FADT_OFFSET (xpm1a_cnt_blk.address)); | 118 | ACPI_FADT_OFFSET(xpm1a_cnt_blk. |
119 | address)); | ||
131 | } | 120 | } |
132 | 121 | ||
133 | if (!acpi_gbl_FADT->xpm_tmr_blk.address) { | 122 | if (!acpi_gbl_FADT->xpm_tmr_blk.address) { |
134 | acpi_ut_fadt_register_error ("X_PM_TMR_BLK", 0, | 123 | acpi_ut_fadt_register_error("X_PM_TMR_BLK", 0, |
135 | ACPI_FADT_OFFSET (xpm_tmr_blk.address)); | 124 | ACPI_FADT_OFFSET(xpm_tmr_blk. |
125 | address)); | ||
136 | } | 126 | } |
137 | 127 | ||
138 | if ((acpi_gbl_FADT->xpm2_cnt_blk.address && | 128 | if ((acpi_gbl_FADT->xpm2_cnt_blk.address && |
139 | !acpi_gbl_FADT->pm2_cnt_len)) { | 129 | !acpi_gbl_FADT->pm2_cnt_len)) { |
140 | acpi_ut_fadt_register_error ("PM2_CNT_LEN", | 130 | acpi_ut_fadt_register_error("PM2_CNT_LEN", |
141 | (u32) acpi_gbl_FADT->pm2_cnt_len, | 131 | (u32) acpi_gbl_FADT->pm2_cnt_len, |
142 | ACPI_FADT_OFFSET (pm2_cnt_len)); | 132 | ACPI_FADT_OFFSET(pm2_cnt_len)); |
143 | } | 133 | } |
144 | 134 | ||
145 | if (acpi_gbl_FADT->pm_tm_len < 4) { | 135 | if (acpi_gbl_FADT->pm_tm_len < 4) { |
146 | acpi_ut_fadt_register_error ("PM_TM_LEN", | 136 | acpi_ut_fadt_register_error("PM_TM_LEN", |
147 | (u32) acpi_gbl_FADT->pm_tm_len, | 137 | (u32) acpi_gbl_FADT->pm_tm_len, |
148 | ACPI_FADT_OFFSET (pm_tm_len)); | 138 | ACPI_FADT_OFFSET(pm_tm_len)); |
149 | } | 139 | } |
150 | 140 | ||
151 | /* Length of GPE blocks must be a multiple of 2 */ | 141 | /* Length of GPE blocks must be a multiple of 2 */ |
152 | 142 | ||
153 | if (acpi_gbl_FADT->xgpe0_blk.address && | 143 | if (acpi_gbl_FADT->xgpe0_blk.address && |
154 | (acpi_gbl_FADT->gpe0_blk_len & 1)) { | 144 | (acpi_gbl_FADT->gpe0_blk_len & 1)) { |
155 | acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN", | 145 | acpi_ut_fadt_register_error("(x)GPE0_BLK_LEN", |
156 | (u32) acpi_gbl_FADT->gpe0_blk_len, | 146 | (u32) acpi_gbl_FADT->gpe0_blk_len, |
157 | ACPI_FADT_OFFSET (gpe0_blk_len)); | 147 | ACPI_FADT_OFFSET(gpe0_blk_len)); |
158 | } | 148 | } |
159 | 149 | ||
160 | if (acpi_gbl_FADT->xgpe1_blk.address && | 150 | if (acpi_gbl_FADT->xgpe1_blk.address && |
161 | (acpi_gbl_FADT->gpe1_blk_len & 1)) { | 151 | (acpi_gbl_FADT->gpe1_blk_len & 1)) { |
162 | acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN", | 152 | acpi_ut_fadt_register_error("(x)GPE1_BLK_LEN", |
163 | (u32) acpi_gbl_FADT->gpe1_blk_len, | 153 | (u32) acpi_gbl_FADT->gpe1_blk_len, |
164 | ACPI_FADT_OFFSET (gpe1_blk_len)); | 154 | ACPI_FADT_OFFSET(gpe1_blk_len)); |
165 | } | 155 | } |
166 | 156 | ||
167 | return (AE_OK); | 157 | return (AE_OK); |
168 | } | 158 | } |
169 | 159 | ||
170 | |||
171 | /****************************************************************************** | 160 | /****************************************************************************** |
172 | * | 161 | * |
173 | * FUNCTION: acpi_ut_terminate | 162 | * FUNCTION: acpi_ut_terminate |
@@ -180,18 +169,14 @@ acpi_ut_validate_fadt ( | |||
180 | * | 169 | * |
181 | ******************************************************************************/ | 170 | ******************************************************************************/ |
182 | 171 | ||
183 | static void | 172 | static void acpi_ut_terminate(void) |
184 | acpi_ut_terminate ( | ||
185 | void) | ||
186 | { | 173 | { |
187 | struct acpi_gpe_block_info *gpe_block; | 174 | struct acpi_gpe_block_info *gpe_block; |
188 | struct acpi_gpe_block_info *next_gpe_block; | 175 | struct acpi_gpe_block_info *next_gpe_block; |
189 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 176 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
190 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; | 177 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; |
191 | |||
192 | |||
193 | ACPI_FUNCTION_TRACE ("ut_terminate"); | ||
194 | 178 | ||
179 | ACPI_FUNCTION_TRACE("ut_terminate"); | ||
195 | 180 | ||
196 | /* Free global tables, etc. */ | 181 | /* Free global tables, etc. */ |
197 | /* Free global GPE blocks and related info structures */ | 182 | /* Free global GPE blocks and related info structures */ |
@@ -201,21 +186,20 @@ acpi_ut_terminate ( | |||
201 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | 186 | gpe_block = gpe_xrupt_info->gpe_block_list_head; |
202 | while (gpe_block) { | 187 | while (gpe_block) { |
203 | next_gpe_block = gpe_block->next; | 188 | next_gpe_block = gpe_block->next; |
204 | ACPI_MEM_FREE (gpe_block->event_info); | 189 | ACPI_MEM_FREE(gpe_block->event_info); |
205 | ACPI_MEM_FREE (gpe_block->register_info); | 190 | ACPI_MEM_FREE(gpe_block->register_info); |
206 | ACPI_MEM_FREE (gpe_block); | 191 | ACPI_MEM_FREE(gpe_block); |
207 | 192 | ||
208 | gpe_block = next_gpe_block; | 193 | gpe_block = next_gpe_block; |
209 | } | 194 | } |
210 | next_gpe_xrupt_info = gpe_xrupt_info->next; | 195 | next_gpe_xrupt_info = gpe_xrupt_info->next; |
211 | ACPI_MEM_FREE (gpe_xrupt_info); | 196 | ACPI_MEM_FREE(gpe_xrupt_info); |
212 | gpe_xrupt_info = next_gpe_xrupt_info; | 197 | gpe_xrupt_info = next_gpe_xrupt_info; |
213 | } | 198 | } |
214 | 199 | ||
215 | return_VOID; | 200 | return_VOID; |
216 | } | 201 | } |
217 | 202 | ||
218 | |||
219 | /******************************************************************************* | 203 | /******************************************************************************* |
220 | * | 204 | * |
221 | * FUNCTION: acpi_ut_subsystem_shutdown | 205 | * FUNCTION: acpi_ut_subsystem_shutdown |
@@ -229,50 +213,45 @@ acpi_ut_terminate ( | |||
229 | * | 213 | * |
230 | ******************************************************************************/ | 214 | ******************************************************************************/ |
231 | 215 | ||
232 | void | 216 | void acpi_ut_subsystem_shutdown(void) |
233 | acpi_ut_subsystem_shutdown ( | ||
234 | void) | ||
235 | { | 217 | { |
236 | 218 | ||
237 | ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown"); | 219 | ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); |
238 | 220 | ||
239 | /* Just exit if subsystem is already shutdown */ | 221 | /* Just exit if subsystem is already shutdown */ |
240 | 222 | ||
241 | if (acpi_gbl_shutdown) { | 223 | if (acpi_gbl_shutdown) { |
242 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 224 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
243 | "ACPI Subsystem is already terminated\n")); | 225 | "ACPI Subsystem is already terminated\n")); |
244 | return_VOID; | 226 | return_VOID; |
245 | } | 227 | } |
246 | 228 | ||
247 | /* Subsystem appears active, go ahead and shut it down */ | 229 | /* Subsystem appears active, go ahead and shut it down */ |
248 | 230 | ||
249 | acpi_gbl_shutdown = TRUE; | 231 | acpi_gbl_shutdown = TRUE; |
250 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 232 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); |
251 | "Shutting down ACPI Subsystem...\n")); | ||
252 | 233 | ||
253 | /* Close the acpi_event Handling */ | 234 | /* Close the acpi_event Handling */ |
254 | 235 | ||
255 | acpi_ev_terminate (); | 236 | acpi_ev_terminate(); |
256 | 237 | ||
257 | /* Close the Namespace */ | 238 | /* Close the Namespace */ |
258 | 239 | ||
259 | acpi_ns_terminate (); | 240 | acpi_ns_terminate(); |
260 | 241 | ||
261 | /* Close the globals */ | 242 | /* Close the globals */ |
262 | 243 | ||
263 | acpi_ut_terminate (); | 244 | acpi_ut_terminate(); |
264 | 245 | ||
265 | /* Purge the local caches */ | 246 | /* Purge the local caches */ |
266 | 247 | ||
267 | (void) acpi_ut_delete_caches (); | 248 | (void)acpi_ut_delete_caches(); |
268 | 249 | ||
269 | /* Debug only - display leftover memory allocation, if any */ | 250 | /* Debug only - display leftover memory allocation, if any */ |
270 | 251 | ||
271 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 252 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
272 | acpi_ut_dump_allocations (ACPI_UINT32_MAX, NULL); | 253 | acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); |
273 | #endif | 254 | #endif |
274 | 255 | ||
275 | return_VOID; | 256 | return_VOID; |
276 | } | 257 | } |
277 | |||
278 | |||