1 |
1275 |
phoenix |
/******************************************************************************
|
2 |
|
|
*
|
3 |
|
|
* Module Name: tbget - ACPI Table get* routines
|
4 |
|
|
*
|
5 |
|
|
*****************************************************************************/
|
6 |
|
|
|
7 |
|
|
/*
|
8 |
|
|
* Copyright (C) 2000 - 2004, R. Byron Moore
|
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 |
|
|
|
45 |
|
|
#include <acpi/acpi.h>
|
46 |
|
|
#include <acpi/actables.h>
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
#define _COMPONENT ACPI_TABLES
|
50 |
|
|
ACPI_MODULE_NAME ("tbget")
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
/*******************************************************************************
|
54 |
|
|
*
|
55 |
|
|
* FUNCTION: acpi_tb_get_table
|
56 |
|
|
*
|
57 |
|
|
* PARAMETERS: Address - Address of table to retrieve. Can be
|
58 |
|
|
* Logical or Physical
|
59 |
|
|
* table_info - Where table info is returned
|
60 |
|
|
*
|
61 |
|
|
* RETURN: None
|
62 |
|
|
*
|
63 |
|
|
* DESCRIPTION: Get entire table of unknown size.
|
64 |
|
|
*
|
65 |
|
|
******************************************************************************/
|
66 |
|
|
|
67 |
|
|
acpi_status
|
68 |
|
|
acpi_tb_get_table (
|
69 |
|
|
struct acpi_pointer *address,
|
70 |
|
|
struct acpi_table_desc *table_info)
|
71 |
|
|
{
|
72 |
|
|
acpi_status status;
|
73 |
|
|
struct acpi_table_header header;
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
ACPI_FUNCTION_TRACE ("tb_get_table");
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
/*
|
80 |
|
|
* Get the header in order to get signature and table size
|
81 |
|
|
*/
|
82 |
|
|
status = acpi_tb_get_table_header (address, &header);
|
83 |
|
|
if (ACPI_FAILURE (status)) {
|
84 |
|
|
return_ACPI_STATUS (status);
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
/* Get the entire table */
|
88 |
|
|
|
89 |
|
|
status = acpi_tb_get_table_body (address, &header, table_info);
|
90 |
|
|
if (ACPI_FAILURE (status)) {
|
91 |
|
|
ACPI_REPORT_ERROR (("Could not get ACPI table (size %X), %s\n",
|
92 |
|
|
header.length, acpi_format_exception (status)));
|
93 |
|
|
return_ACPI_STATUS (status);
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
return_ACPI_STATUS (AE_OK);
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
/*******************************************************************************
|
101 |
|
|
*
|
102 |
|
|
* FUNCTION: acpi_tb_get_table_header
|
103 |
|
|
*
|
104 |
|
|
* PARAMETERS: Address - Address of table to retrieve. Can be
|
105 |
|
|
* Logical or Physical
|
106 |
|
|
* return_header - Where the table header is returned
|
107 |
|
|
*
|
108 |
|
|
* RETURN: Status
|
109 |
|
|
*
|
110 |
|
|
* DESCRIPTION: Get an ACPI table header. Works in both physical or virtual
|
111 |
|
|
* addressing mode. Works with both physical or logical pointers.
|
112 |
|
|
* Table is either copied or mapped, depending on the pointer
|
113 |
|
|
* type and mode of the processor.
|
114 |
|
|
*
|
115 |
|
|
******************************************************************************/
|
116 |
|
|
|
117 |
|
|
acpi_status
|
118 |
|
|
acpi_tb_get_table_header (
|
119 |
|
|
struct acpi_pointer *address,
|
120 |
|
|
struct acpi_table_header *return_header)
|
121 |
|
|
{
|
122 |
|
|
acpi_status status = AE_OK;
|
123 |
|
|
struct acpi_table_header *header = NULL;
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
ACPI_FUNCTION_TRACE ("tb_get_table_header");
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
/*
|
130 |
|
|
* Flags contains the current processor mode (Virtual or Physical addressing)
|
131 |
|
|
* The pointer_type is either Logical or Physical
|
132 |
|
|
*/
|
133 |
|
|
switch (address->pointer_type) {
|
134 |
|
|
case ACPI_PHYSMODE_PHYSPTR:
|
135 |
|
|
case ACPI_LOGMODE_LOGPTR:
|
136 |
|
|
|
137 |
|
|
/* Pointer matches processor mode, copy the header */
|
138 |
|
|
|
139 |
|
|
ACPI_MEMCPY (return_header, address->pointer.logical, sizeof (struct acpi_table_header));
|
140 |
|
|
break;
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
case ACPI_LOGMODE_PHYSPTR:
|
144 |
|
|
|
145 |
|
|
/* Create a logical address for the physical pointer*/
|
146 |
|
|
|
147 |
|
|
status = acpi_os_map_memory (address->pointer.physical, sizeof (struct acpi_table_header),
|
148 |
|
|
(void *) &header);
|
149 |
|
|
if (ACPI_FAILURE (status)) {
|
150 |
|
|
ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n",
|
151 |
|
|
ACPI_FORMAT_UINT64 (address->pointer.physical),
|
152 |
|
|
sizeof (struct acpi_table_header)));
|
153 |
|
|
return_ACPI_STATUS (status);
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
/* Copy header and delete mapping */
|
157 |
|
|
|
158 |
|
|
ACPI_MEMCPY (return_header, header, sizeof (struct acpi_table_header));
|
159 |
|
|
acpi_os_unmap_memory (header, sizeof (struct acpi_table_header));
|
160 |
|
|
break;
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
default:
|
164 |
|
|
|
165 |
|
|
ACPI_REPORT_ERROR (("Invalid address flags %X\n",
|
166 |
|
|
address->pointer_type));
|
167 |
|
|
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
return_ACPI_STATUS (AE_OK);
|
171 |
|
|
}
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
/*******************************************************************************
|
175 |
|
|
*
|
176 |
|
|
* FUNCTION: acpi_tb_get_table_body
|
177 |
|
|
*
|
178 |
|
|
* PARAMETERS: Address - Address of table to retrieve. Can be
|
179 |
|
|
* Logical or Physical
|
180 |
|
|
* Header - Header of the table to retrieve
|
181 |
|
|
* table_info - Where the table info is returned
|
182 |
|
|
*
|
183 |
|
|
* RETURN: Status
|
184 |
|
|
*
|
185 |
|
|
* DESCRIPTION: Get an entire ACPI table with support to allow the host OS to
|
186 |
|
|
* replace the table with a newer version (table override.)
|
187 |
|
|
* Works in both physical or virtual
|
188 |
|
|
* addressing mode. Works with both physical or logical pointers.
|
189 |
|
|
* Table is either copied or mapped, depending on the pointer
|
190 |
|
|
* type and mode of the processor.
|
191 |
|
|
*
|
192 |
|
|
******************************************************************************/
|
193 |
|
|
|
194 |
|
|
acpi_status
|
195 |
|
|
acpi_tb_get_table_body (
|
196 |
|
|
struct acpi_pointer *address,
|
197 |
|
|
struct acpi_table_header *header,
|
198 |
|
|
struct acpi_table_desc *table_info)
|
199 |
|
|
{
|
200 |
|
|
acpi_status status;
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
ACPI_FUNCTION_TRACE ("tb_get_table_body");
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
if (!table_info || !address) {
|
207 |
|
|
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
/*
|
211 |
|
|
* Attempt table override.
|
212 |
|
|
*/
|
213 |
|
|
status = acpi_tb_table_override (header, table_info);
|
214 |
|
|
if (ACPI_SUCCESS (status)) {
|
215 |
|
|
/* Table was overridden by the host OS */
|
216 |
|
|
|
217 |
|
|
return_ACPI_STATUS (status);
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
/* No override, get the original table */
|
221 |
|
|
|
222 |
|
|
status = acpi_tb_get_this_table (address, header, table_info);
|
223 |
|
|
return_ACPI_STATUS (status);
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
/*******************************************************************************
|
228 |
|
|
*
|
229 |
|
|
* FUNCTION: acpi_tb_table_override
|
230 |
|
|
*
|
231 |
|
|
* PARAMETERS: Header - Pointer to table header
|
232 |
|
|
* table_info - Return info if table is overridden
|
233 |
|
|
*
|
234 |
|
|
* RETURN: None
|
235 |
|
|
*
|
236 |
|
|
* DESCRIPTION: Attempts override of current table with a new one if provided
|
237 |
|
|
* by the host OS.
|
238 |
|
|
*
|
239 |
|
|
******************************************************************************/
|
240 |
|
|
|
241 |
|
|
acpi_status
|
242 |
|
|
acpi_tb_table_override (
|
243 |
|
|
struct acpi_table_header *header,
|
244 |
|
|
struct acpi_table_desc *table_info)
|
245 |
|
|
{
|
246 |
|
|
struct acpi_table_header *new_table;
|
247 |
|
|
acpi_status status;
|
248 |
|
|
struct acpi_pointer address;
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
ACPI_FUNCTION_TRACE ("tb_table_override");
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
/*
|
255 |
|
|
* The OSL will examine the header and decide whether to override this
|
256 |
|
|
* table. If it decides to override, a table will be returned in new_table,
|
257 |
|
|
* which we will then copy.
|
258 |
|
|
*/
|
259 |
|
|
status = acpi_os_table_override (header, &new_table);
|
260 |
|
|
if (ACPI_FAILURE (status)) {
|
261 |
|
|
/* Some severe error from the OSL, but we basically ignore it */
|
262 |
|
|
|
263 |
|
|
ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n",
|
264 |
|
|
acpi_format_exception (status)));
|
265 |
|
|
return_ACPI_STATUS (status);
|
266 |
|
|
}
|
267 |
|
|
|
268 |
|
|
if (!new_table) {
|
269 |
|
|
/* No table override */
|
270 |
|
|
|
271 |
|
|
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
272 |
|
|
}
|
273 |
|
|
|
274 |
|
|
/*
|
275 |
|
|
* We have a new table to override the old one. Get a copy of
|
276 |
|
|
* the new one. We know that the new table has a logical pointer.
|
277 |
|
|
*/
|
278 |
|
|
address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
|
279 |
|
|
address.pointer.logical = new_table;
|
280 |
|
|
|
281 |
|
|
status = acpi_tb_get_this_table (&address, new_table, table_info);
|
282 |
|
|
if (ACPI_FAILURE (status)) {
|
283 |
|
|
ACPI_REPORT_ERROR (("Could not copy override ACPI table, %s\n",
|
284 |
|
|
acpi_format_exception (status)));
|
285 |
|
|
return_ACPI_STATUS (status);
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
/* Copy the table info */
|
289 |
|
|
|
290 |
|
|
ACPI_REPORT_INFO (("Table [%4.4s] replaced by host OS\n",
|
291 |
|
|
table_info->pointer->signature));
|
292 |
|
|
|
293 |
|
|
return_ACPI_STATUS (AE_OK);
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
/*******************************************************************************
|
298 |
|
|
*
|
299 |
|
|
* FUNCTION: acpi_tb_get_this_table
|
300 |
|
|
*
|
301 |
|
|
* PARAMETERS: Address - Address of table to retrieve. Can be
|
302 |
|
|
* Logical or Physical
|
303 |
|
|
* Header - Header of the table to retrieve
|
304 |
|
|
* table_info - Where the table info is returned
|
305 |
|
|
*
|
306 |
|
|
* RETURN: Status
|
307 |
|
|
*
|
308 |
|
|
* DESCRIPTION: Get an entire ACPI table. Works in both physical or virtual
|
309 |
|
|
* addressing mode. Works with both physical or logical pointers.
|
310 |
|
|
* Table is either copied or mapped, depending on the pointer
|
311 |
|
|
* type and mode of the processor.
|
312 |
|
|
*
|
313 |
|
|
******************************************************************************/
|
314 |
|
|
|
315 |
|
|
acpi_status
|
316 |
|
|
acpi_tb_get_this_table (
|
317 |
|
|
struct acpi_pointer *address,
|
318 |
|
|
struct acpi_table_header *header,
|
319 |
|
|
struct acpi_table_desc *table_info)
|
320 |
|
|
{
|
321 |
|
|
struct acpi_table_header *full_table = NULL;
|
322 |
|
|
u8 allocation;
|
323 |
|
|
acpi_status status = AE_OK;
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
ACPI_FUNCTION_TRACE ("tb_get_this_table");
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
/*
|
330 |
|
|
* Flags contains the current processor mode (Virtual or Physical addressing)
|
331 |
|
|
* The pointer_type is either Logical or Physical
|
332 |
|
|
*/
|
333 |
|
|
switch (address->pointer_type) {
|
334 |
|
|
case ACPI_PHYSMODE_PHYSPTR:
|
335 |
|
|
case ACPI_LOGMODE_LOGPTR:
|
336 |
|
|
|
337 |
|
|
/* Pointer matches processor mode, copy the table to a new buffer */
|
338 |
|
|
|
339 |
|
|
full_table = ACPI_MEM_ALLOCATE (header->length);
|
340 |
|
|
if (!full_table) {
|
341 |
|
|
ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n",
|
342 |
|
|
header->signature, header->length));
|
343 |
|
|
return_ACPI_STATUS (AE_NO_MEMORY);
|
344 |
|
|
}
|
345 |
|
|
|
346 |
|
|
/* Copy the entire table (including header) to the local buffer */
|
347 |
|
|
|
348 |
|
|
ACPI_MEMCPY (full_table, address->pointer.logical, header->length);
|
349 |
|
|
|
350 |
|
|
/* Save allocation type */
|
351 |
|
|
|
352 |
|
|
allocation = ACPI_MEM_ALLOCATED;
|
353 |
|
|
break;
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
case ACPI_LOGMODE_PHYSPTR:
|
357 |
|
|
|
358 |
|
|
/*
|
359 |
|
|
* Just map the table's physical memory
|
360 |
|
|
* into our address space.
|
361 |
|
|
*/
|
362 |
|
|
status = acpi_os_map_memory (address->pointer.physical, (acpi_size) header->length,
|
363 |
|
|
(void *) &full_table);
|
364 |
|
|
if (ACPI_FAILURE (status)) {
|
365 |
|
|
ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n",
|
366 |
|
|
header->signature,
|
367 |
|
|
ACPI_FORMAT_UINT64 (address->pointer.physical), header->length));
|
368 |
|
|
return (status);
|
369 |
|
|
}
|
370 |
|
|
|
371 |
|
|
/* Save allocation type */
|
372 |
|
|
|
373 |
|
|
allocation = ACPI_MEM_MAPPED;
|
374 |
|
|
break;
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
default:
|
378 |
|
|
|
379 |
|
|
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid address flags %X\n",
|
380 |
|
|
address->pointer_type));
|
381 |
|
|
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
382 |
|
|
}
|
383 |
|
|
|
384 |
|
|
/*
|
385 |
|
|
* Validate checksum for _most_ tables,
|
386 |
|
|
* even the ones whose signature we don't recognize
|
387 |
|
|
*/
|
388 |
|
|
if (table_info->type != ACPI_TABLE_FACS) {
|
389 |
|
|
status = acpi_tb_verify_table_checksum (full_table);
|
390 |
|
|
|
391 |
|
|
#if (!ACPI_CHECKSUM_ABORT)
|
392 |
|
|
if (ACPI_FAILURE (status)) {
|
393 |
|
|
/* Ignore the error if configuration says so */
|
394 |
|
|
|
395 |
|
|
status = AE_OK;
|
396 |
|
|
}
|
397 |
|
|
#endif
|
398 |
|
|
}
|
399 |
|
|
|
400 |
|
|
/* Return values */
|
401 |
|
|
|
402 |
|
|
table_info->pointer = full_table;
|
403 |
|
|
table_info->length = (acpi_size) header->length;
|
404 |
|
|
table_info->allocation = allocation;
|
405 |
|
|
|
406 |
|
|
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
407 |
|
|
"Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
|
408 |
|
|
full_table->signature,
|
409 |
|
|
ACPI_FORMAT_UINT64 (address->pointer.physical), full_table));
|
410 |
|
|
|
411 |
|
|
return_ACPI_STATUS (status);
|
412 |
|
|
}
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
/*******************************************************************************
|
416 |
|
|
*
|
417 |
|
|
* FUNCTION: acpi_tb_get_table_ptr
|
418 |
|
|
*
|
419 |
|
|
* PARAMETERS: table_type - one of the defined table types
|
420 |
|
|
* Instance - Which table of this type
|
421 |
|
|
* table_ptr_loc - pointer to location to place the pointer for
|
422 |
|
|
* return
|
423 |
|
|
*
|
424 |
|
|
* RETURN: Status
|
425 |
|
|
*
|
426 |
|
|
* DESCRIPTION: This function is called to get the pointer to an ACPI table.
|
427 |
|
|
*
|
428 |
|
|
******************************************************************************/
|
429 |
|
|
|
430 |
|
|
acpi_status
|
431 |
|
|
acpi_tb_get_table_ptr (
|
432 |
|
|
acpi_table_type table_type,
|
433 |
|
|
u32 instance,
|
434 |
|
|
struct acpi_table_header **table_ptr_loc)
|
435 |
|
|
{
|
436 |
|
|
struct acpi_table_desc *table_desc;
|
437 |
|
|
u32 i;
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
ACPI_FUNCTION_TRACE ("tb_get_table_ptr");
|
441 |
|
|
|
442 |
|
|
|
443 |
|
|
if (!acpi_gbl_DSDT) {
|
444 |
|
|
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
445 |
|
|
}
|
446 |
|
|
|
447 |
|
|
if (table_type > ACPI_TABLE_MAX) {
|
448 |
|
|
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
449 |
|
|
}
|
450 |
|
|
|
451 |
|
|
/*
|
452 |
|
|
* For all table types (Single/Multiple), the first
|
453 |
|
|
* instance is always in the list head.
|
454 |
|
|
*/
|
455 |
|
|
if (instance == 1) {
|
456 |
|
|
/* Get the first */
|
457 |
|
|
|
458 |
|
|
*table_ptr_loc = NULL;
|
459 |
|
|
if (acpi_gbl_table_lists[table_type].next) {
|
460 |
|
|
*table_ptr_loc = acpi_gbl_table_lists[table_type].next->pointer;
|
461 |
|
|
}
|
462 |
|
|
return_ACPI_STATUS (AE_OK);
|
463 |
|
|
}
|
464 |
|
|
|
465 |
|
|
/*
|
466 |
|
|
* Check for instance out of range
|
467 |
|
|
*/
|
468 |
|
|
if (instance > acpi_gbl_table_lists[table_type].count) {
|
469 |
|
|
return_ACPI_STATUS (AE_NOT_EXIST);
|
470 |
|
|
}
|
471 |
|
|
|
472 |
|
|
/* Walk the list to get the desired table
|
473 |
|
|
* Since the if (Instance == 1) check above checked for the
|
474 |
|
|
* first table, setting table_desc equal to the .Next member
|
475 |
|
|
* is actually pointing to the second table. Therefore, we
|
476 |
|
|
* need to walk from the 2nd table until we reach the Instance
|
477 |
|
|
* that the user is looking for and return its table pointer.
|
478 |
|
|
*/
|
479 |
|
|
table_desc = acpi_gbl_table_lists[table_type].next;
|
480 |
|
|
for (i = 2; i < instance; i++) {
|
481 |
|
|
table_desc = table_desc->next;
|
482 |
|
|
}
|
483 |
|
|
|
484 |
|
|
/* We are now pointing to the requested table's descriptor */
|
485 |
|
|
|
486 |
|
|
*table_ptr_loc = table_desc->pointer;
|
487 |
|
|
|
488 |
|
|
return_ACPI_STATUS (AE_OK);
|
489 |
|
|
}
|
490 |
|
|
|