diff options
Diffstat (limited to 'drivers/acpi/tables/tbrsdt.c')
-rw-r--r-- | drivers/acpi/tables/tbrsdt.c | 190 |
1 files changed, 83 insertions, 107 deletions
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 069d498465d0..ad0252c2f7db 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -41,14 +41,11 @@ | |||
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/actables.h> | 45 | #include <acpi/actables.h> |
47 | 46 | ||
48 | |||
49 | #define _COMPONENT ACPI_TABLES | 47 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbrsdt") | 48 | ACPI_MODULE_NAME("tbrsdt") |
51 | |||
52 | 49 | ||
53 | /******************************************************************************* | 50 | /******************************************************************************* |
54 | * | 51 | * |
@@ -61,18 +58,13 @@ | |||
61 | * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table) | 58 | * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table) |
62 | * | 59 | * |
63 | ******************************************************************************/ | 60 | ******************************************************************************/ |
64 | 61 | acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |
65 | acpi_status | ||
66 | acpi_tb_verify_rsdp ( | ||
67 | struct acpi_pointer *address) | ||
68 | { | 62 | { |
69 | struct acpi_table_desc table_info; | 63 | struct acpi_table_desc table_info; |
70 | acpi_status status; | 64 | acpi_status status; |
71 | struct rsdp_descriptor *rsdp; | 65 | struct rsdp_descriptor *rsdp; |
72 | |||
73 | |||
74 | ACPI_FUNCTION_TRACE ("tb_verify_rsdp"); | ||
75 | 66 | ||
67 | ACPI_FUNCTION_TRACE("tb_verify_rsdp"); | ||
76 | 68 | ||
77 | switch (address->pointer_type) { | 69 | switch (address->pointer_type) { |
78 | case ACPI_LOGICAL_POINTER: | 70 | case ACPI_LOGICAL_POINTER: |
@@ -84,54 +76,53 @@ acpi_tb_verify_rsdp ( | |||
84 | /* | 76 | /* |
85 | * Obtain access to the RSDP structure | 77 | * Obtain access to the RSDP structure |
86 | */ | 78 | */ |
87 | status = acpi_os_map_memory (address->pointer.physical, | 79 | status = acpi_os_map_memory(address->pointer.physical, |
88 | sizeof (struct rsdp_descriptor), | 80 | sizeof(struct rsdp_descriptor), |
89 | (void *) &rsdp); | 81 | (void *)&rsdp); |
90 | if (ACPI_FAILURE (status)) { | 82 | if (ACPI_FAILURE(status)) { |
91 | return_ACPI_STATUS (status); | 83 | return_ACPI_STATUS(status); |
92 | } | 84 | } |
93 | break; | 85 | break; |
94 | 86 | ||
95 | default: | 87 | default: |
96 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 88 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
97 | } | 89 | } |
98 | 90 | ||
99 | /* Verify RSDP signature and checksum */ | 91 | /* Verify RSDP signature and checksum */ |
100 | 92 | ||
101 | status = acpi_tb_validate_rsdp (rsdp); | 93 | status = acpi_tb_validate_rsdp(rsdp); |
102 | if (ACPI_FAILURE (status)) { | 94 | if (ACPI_FAILURE(status)) { |
103 | goto cleanup; | 95 | goto cleanup; |
104 | } | 96 | } |
105 | 97 | ||
106 | /* The RSDP supplied is OK */ | 98 | /* The RSDP supplied is OK */ |
107 | 99 | ||
108 | table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp); | 100 | table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); |
109 | table_info.length = sizeof (struct rsdp_descriptor); | 101 | table_info.length = sizeof(struct rsdp_descriptor); |
110 | table_info.allocation = ACPI_MEM_MAPPED; | 102 | table_info.allocation = ACPI_MEM_MAPPED; |
111 | 103 | ||
112 | /* Save the table pointers and allocation info */ | 104 | /* Save the table pointers and allocation info */ |
113 | 105 | ||
114 | status = acpi_tb_init_table_descriptor (ACPI_TABLE_RSDP, &table_info); | 106 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info); |
115 | if (ACPI_FAILURE (status)) { | 107 | if (ACPI_FAILURE(status)) { |
116 | goto cleanup; | 108 | goto cleanup; |
117 | } | 109 | } |
118 | 110 | ||
119 | /* Save the RSDP in a global for easy access */ | 111 | /* Save the RSDP in a global for easy access */ |
120 | 112 | ||
121 | acpi_gbl_RSDP = ACPI_CAST_PTR (struct rsdp_descriptor, table_info.pointer); | 113 | acpi_gbl_RSDP = |
122 | return_ACPI_STATUS (status); | 114 | ACPI_CAST_PTR(struct rsdp_descriptor, table_info.pointer); |
123 | 115 | return_ACPI_STATUS(status); | |
124 | 116 | ||
125 | /* Error exit */ | 117 | /* Error exit */ |
126 | cleanup: | 118 | cleanup: |
127 | 119 | ||
128 | if (acpi_gbl_table_flags & ACPI_PHYSICAL_POINTER) { | 120 | if (acpi_gbl_table_flags & ACPI_PHYSICAL_POINTER) { |
129 | acpi_os_unmap_memory (rsdp, sizeof (struct rsdp_descriptor)); | 121 | acpi_os_unmap_memory(rsdp, sizeof(struct rsdp_descriptor)); |
130 | } | 122 | } |
131 | return_ACPI_STATUS (status); | 123 | return_ACPI_STATUS(status); |
132 | } | 124 | } |
133 | 125 | ||
134 | |||
135 | /******************************************************************************* | 126 | /******************************************************************************* |
136 | * | 127 | * |
137 | * FUNCTION: acpi_tb_get_rsdt_address | 128 | * FUNCTION: acpi_tb_get_rsdt_address |
@@ -145,33 +136,30 @@ cleanup: | |||
145 | * | 136 | * |
146 | ******************************************************************************/ | 137 | ******************************************************************************/ |
147 | 138 | ||
148 | void | 139 | void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address) |
149 | acpi_tb_get_rsdt_address ( | ||
150 | struct acpi_pointer *out_address) | ||
151 | { | 140 | { |
152 | 141 | ||
153 | ACPI_FUNCTION_ENTRY (); | 142 | ACPI_FUNCTION_ENTRY(); |
154 | |||
155 | 143 | ||
156 | out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; | 144 | out_address->pointer_type = |
145 | acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; | ||
157 | 146 | ||
158 | /* Use XSDT if it is present */ | 147 | /* Use XSDT if it is present */ |
159 | 148 | ||
160 | if ((acpi_gbl_RSDP->revision >= 2) && | 149 | if ((acpi_gbl_RSDP->revision >= 2) && |
161 | acpi_gbl_RSDP->xsdt_physical_address) { | 150 | acpi_gbl_RSDP->xsdt_physical_address) { |
162 | out_address->pointer.value = | 151 | out_address->pointer.value = |
163 | acpi_gbl_RSDP->xsdt_physical_address; | 152 | acpi_gbl_RSDP->xsdt_physical_address; |
164 | acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT; | 153 | acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT; |
165 | } | 154 | } else { |
166 | else { | ||
167 | /* No XSDT, use the RSDT */ | 155 | /* No XSDT, use the RSDT */ |
168 | 156 | ||
169 | out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; | 157 | out_address->pointer.value = |
158 | acpi_gbl_RSDP->rsdt_physical_address; | ||
170 | acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT; | 159 | acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT; |
171 | } | 160 | } |
172 | } | 161 | } |
173 | 162 | ||
174 | |||
175 | /******************************************************************************* | 163 | /******************************************************************************* |
176 | * | 164 | * |
177 | * FUNCTION: acpi_tb_validate_rsdt | 165 | * FUNCTION: acpi_tb_validate_rsdt |
@@ -184,49 +172,43 @@ acpi_tb_get_rsdt_address ( | |||
184 | * | 172 | * |
185 | ******************************************************************************/ | 173 | ******************************************************************************/ |
186 | 174 | ||
187 | acpi_status | 175 | acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) |
188 | acpi_tb_validate_rsdt ( | ||
189 | struct acpi_table_header *table_ptr) | ||
190 | { | 176 | { |
191 | int no_match; | 177 | int no_match; |
192 | |||
193 | |||
194 | ACPI_FUNCTION_NAME ("tb_validate_rsdt"); | ||
195 | 178 | ||
179 | ACPI_FUNCTION_NAME("tb_validate_rsdt"); | ||
196 | 180 | ||
197 | /* | 181 | /* |
198 | * Search for appropriate signature, RSDT or XSDT | 182 | * Search for appropriate signature, RSDT or XSDT |
199 | */ | 183 | */ |
200 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 184 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
201 | no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG, | 185 | no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG, |
202 | sizeof (RSDT_SIG) -1); | 186 | sizeof(RSDT_SIG) - 1); |
203 | } | 187 | } else { |
204 | else { | 188 | no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG, |
205 | no_match = ACPI_STRNCMP ((char *) table_ptr, XSDT_SIG, | 189 | sizeof(XSDT_SIG) - 1); |
206 | sizeof (XSDT_SIG) -1); | ||
207 | } | 190 | } |
208 | 191 | ||
209 | if (no_match) { | 192 | if (no_match) { |
210 | /* Invalid RSDT or XSDT signature */ | 193 | /* Invalid RSDT or XSDT signature */ |
211 | 194 | ||
212 | ACPI_REPORT_ERROR (( | 195 | ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); |
213 | "Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); | ||
214 | 196 | ||
215 | ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); | 197 | ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); |
216 | 198 | ||
217 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, | 199 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, |
218 | "RSDT/XSDT signature at %X (%p) is invalid\n", | 200 | "RSDT/XSDT signature at %X (%p) is invalid\n", |
219 | acpi_gbl_RSDP->rsdt_physical_address, | 201 | acpi_gbl_RSDP->rsdt_physical_address, |
220 | (void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); | 202 | (void *)(acpi_native_uint) acpi_gbl_RSDP-> |
203 | rsdt_physical_address)); | ||
221 | 204 | ||
222 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 205 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
223 | ACPI_REPORT_ERROR (("Looking for RSDT\n")) | 206 | ACPI_REPORT_ERROR(("Looking for RSDT\n")) |
224 | } | 207 | } else { |
225 | else { | 208 | ACPI_REPORT_ERROR(("Looking for XSDT\n")) |
226 | ACPI_REPORT_ERROR (("Looking for XSDT\n")) | ||
227 | } | 209 | } |
228 | 210 | ||
229 | ACPI_DUMP_BUFFER ((char *) table_ptr, 48); | 211 | ACPI_DUMP_BUFFER((char *)table_ptr, 48); |
230 | 212 | ||
231 | return (AE_BAD_SIGNATURE); | 213 | return (AE_BAD_SIGNATURE); |
232 | } | 214 | } |
@@ -234,7 +216,6 @@ acpi_tb_validate_rsdt ( | |||
234 | return (AE_OK); | 216 | return (AE_OK); |
235 | } | 217 | } |
236 | 218 | ||
237 | |||
238 | /******************************************************************************* | 219 | /******************************************************************************* |
239 | * | 220 | * |
240 | * FUNCTION: acpi_tb_get_table_rsdt | 221 | * FUNCTION: acpi_tb_get_table_rsdt |
@@ -247,66 +228,61 @@ acpi_tb_validate_rsdt ( | |||
247 | * | 228 | * |
248 | ******************************************************************************/ | 229 | ******************************************************************************/ |
249 | 230 | ||
250 | acpi_status | 231 | acpi_status acpi_tb_get_table_rsdt(void) |
251 | acpi_tb_get_table_rsdt ( | ||
252 | void) | ||
253 | { | 232 | { |
254 | struct acpi_table_desc table_info; | 233 | struct acpi_table_desc table_info; |
255 | acpi_status status; | 234 | acpi_status status; |
256 | struct acpi_pointer address; | 235 | struct acpi_pointer address; |
257 | |||
258 | |||
259 | ACPI_FUNCTION_TRACE ("tb_get_table_rsdt"); | ||
260 | 236 | ||
237 | ACPI_FUNCTION_TRACE("tb_get_table_rsdt"); | ||
261 | 238 | ||
262 | /* Get the RSDT/XSDT via the RSDP */ | 239 | /* Get the RSDT/XSDT via the RSDP */ |
263 | 240 | ||
264 | acpi_tb_get_rsdt_address (&address); | 241 | acpi_tb_get_rsdt_address(&address); |
265 | 242 | ||
266 | table_info.type = ACPI_TABLE_XSDT; | 243 | table_info.type = ACPI_TABLE_XSDT; |
267 | status = acpi_tb_get_table (&address, &table_info); | 244 | status = acpi_tb_get_table(&address, &table_info); |
268 | if (ACPI_FAILURE (status)) { | 245 | if (ACPI_FAILURE(status)) { |
269 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", | 246 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
270 | acpi_format_exception (status))); | 247 | "Could not get the RSDT/XSDT, %s\n", |
248 | acpi_format_exception(status))); | ||
271 | 249 | ||
272 | return_ACPI_STATUS (status); | 250 | return_ACPI_STATUS(status); |
273 | } | 251 | } |
274 | 252 | ||
275 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
276 | "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", | 254 | "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", |
277 | acpi_gbl_RSDP, | 255 | acpi_gbl_RSDP, |
278 | ACPI_FORMAT_UINT64 (address.pointer.value))); | 256 | ACPI_FORMAT_UINT64(address.pointer.value))); |
279 | 257 | ||
280 | /* Check the RSDT or XSDT signature */ | 258 | /* Check the RSDT or XSDT signature */ |
281 | 259 | ||
282 | status = acpi_tb_validate_rsdt (table_info.pointer); | 260 | status = acpi_tb_validate_rsdt(table_info.pointer); |
283 | if (ACPI_FAILURE (status)) { | 261 | if (ACPI_FAILURE(status)) { |
284 | return_ACPI_STATUS (status); | 262 | return_ACPI_STATUS(status); |
285 | } | 263 | } |
286 | 264 | ||
287 | /* Get the number of tables defined in the RSDT or XSDT */ | 265 | /* Get the number of tables defined in the RSDT or XSDT */ |
288 | 266 | ||
289 | acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, | 267 | acpi_gbl_rsdt_table_count = acpi_tb_get_table_count(acpi_gbl_RSDP, |
290 | table_info.pointer); | 268 | table_info.pointer); |
291 | 269 | ||
292 | /* Convert and/or copy to an XSDT structure */ | 270 | /* Convert and/or copy to an XSDT structure */ |
293 | 271 | ||
294 | status = acpi_tb_convert_to_xsdt (&table_info); | 272 | status = acpi_tb_convert_to_xsdt(&table_info); |
295 | if (ACPI_FAILURE (status)) { | 273 | if (ACPI_FAILURE(status)) { |
296 | return_ACPI_STATUS (status); | 274 | return_ACPI_STATUS(status); |
297 | } | 275 | } |
298 | 276 | ||
299 | /* Save the table pointers and allocation info */ | 277 | /* Save the table pointers and allocation info */ |
300 | 278 | ||
301 | status = acpi_tb_init_table_descriptor (ACPI_TABLE_XSDT, &table_info); | 279 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info); |
302 | if (ACPI_FAILURE (status)) { | 280 | if (ACPI_FAILURE(status)) { |
303 | return_ACPI_STATUS (status); | 281 | return_ACPI_STATUS(status); |
304 | } | 282 | } |
305 | 283 | ||
306 | acpi_gbl_XSDT = ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info.pointer); | 284 | acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer); |
307 | 285 | ||
308 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); | 286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); |
309 | return_ACPI_STATUS (status); | 287 | return_ACPI_STATUS(status); |
310 | } | 288 | } |
311 | |||
312 | |||