Subversion Repositories Kolibri OS

Rev

Rev 1498 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 6... Line 6...
6
 
6
 
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
Line 115... Line 115...
115
 
115
 
Line 116... Line 116...
116
#define ACPI_CREATE_PREDEFINED_TABLE
116
#define ACPI_CREATE_PREDEFINED_TABLE
117
 
117
 
118
#include "aslcompiler.h"
-
 
119
#include "aslcompiler.y.h"
-
 
120
#include "amlcode.h"
118
#include "aslcompiler.h"
Line 121... Line 119...
121
#include "acparser.h"
119
#include "aslcompiler.y.h"
122
#include "acpredef.h"
120
#include "acpredef.h"
Line 123... Line 121...
123
 
121
 
Line -... Line 122...
-
 
122
 
-
 
123
#define _COMPONENT          ACPI_COMPILER
-
 
124
        ACPI_MODULE_NAME    ("aslpredef")
-
 
125
 
-
 
126
 
124
 
127
/* Local prototypes */
125
#define _COMPONENT          ACPI_COMPILER
128
 
126
        ACPI_MODULE_NAME    ("aslpredef")
129
static void
127
 
130
ApCheckForUnexpectedReturnValue (
Line 217... Line 220...
217
 *              arguments and the return type (returns a value or not)
220
 *              arguments and the return type (returns a value or not)
218
 *              is correct.
221
 *              is correct.
219
 *
222
 *
220
 ******************************************************************************/
223
 ******************************************************************************/
Line 221... Line 224...
221
 
224
 
222
void
225
BOOLEAN
223
ApCheckForPredefinedMethod (
226
ApCheckForPredefinedMethod (
224
    ACPI_PARSE_OBJECT       *Op,
227
    ACPI_PARSE_OBJECT       *Op,
225
    ASL_METHOD_INFO         *MethodInfo)
228
    ASL_METHOD_INFO         *MethodInfo)
226
{
229
{
Line 238... Line 241...
238
    case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
241
    case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
239
    case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
242
    case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
240
    case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
243
    case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
Line 241... Line 244...
241
 
244
 
242
        /* Just return, nothing to do */
245
        /* Just return, nothing to do */
Line 243... Line 246...
243
        break;
246
        return (FALSE);
Line 244... Line 247...
244
 
247
 
Line 305... Line 308...
305
            AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
308
            AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
306
                MsgBuffer);
309
                MsgBuffer);
307
        }
310
        }
308
        break;
311
        break;
309
    }
312
    }
-
 
313
 
-
 
314
    return (TRUE);
-
 
315
}
-
 
316
 
-
 
317
 
-
 
318
/*******************************************************************************
-
 
319
 *
-
 
320
 * FUNCTION:    ApCheckForUnexpectedReturnValue
-
 
321
 *
-
 
322
 * PARAMETERS:  Op              - A parse node of type "RETURN".
-
 
323
 *              MethodInfo      - Saved info about this method
-
 
324
 *
-
 
325
 * RETURN:      None
-
 
326
 *
-
 
327
 * DESCRIPTION: Check for an unexpected return value from a predefined method.
-
 
328
 *              Invoked for predefined methods that are defined to not return
-
 
329
 *              any value. If there is a return value, issue a remark, since
-
 
330
 *              the ASL writer may be confused as to the method definition
-
 
331
 *              and/or functionality.
-
 
332
 *
-
 
333
 * Note: We ignore all return values of "Zero", since this is what a standalone
-
 
334
 *       Return() statement will always generate -- so we ignore it here --
-
 
335
 *       i.e., there is no difference between Return() and Return(Zero).
-
 
336
 *       Also, a null Return() will be disassembled to return(Zero) -- so, we
-
 
337
 *       don't want to generate extraneous remarks/warnings for a disassembled
-
 
338
 *       ASL file.
-
 
339
 *
-
 
340
 ******************************************************************************/
-
 
341
 
-
 
342
static void
-
 
343
ApCheckForUnexpectedReturnValue (
-
 
344
    ACPI_PARSE_OBJECT       *Op,
-
 
345
    ASL_METHOD_INFO         *MethodInfo)
-
 
346
{
-
 
347
    ACPI_PARSE_OBJECT       *ReturnValueOp;
-
 
348
 
-
 
349
 
-
 
350
    /* Ignore Return() and Return(Zero) (they are the same) */
-
 
351
 
-
 
352
    ReturnValueOp = Op->Asl.Child;
-
 
353
    if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO)
-
 
354
    {
-
 
355
        return;
-
 
356
    }
-
 
357
 
-
 
358
    /* We have a valid return value, but the reserved name did not expect it */
-
 
359
 
-
 
360
    AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL,
-
 
361
        Op, MethodInfo->Op->Asl.ExternalName);
310
}
362
}
Line 311... Line 363...
311
 
363
 
312
 
364
 
Line 321... Line 373...
321
 *
373
 *
322
 * DESCRIPTION: If method is a predefined name, attempt to validate the return
374
 * DESCRIPTION: If method is a predefined name, attempt to validate the return
323
 *              value. Only "static" types can be validated - a simple return
375
 *              value. Only "static" types can be validated - a simple return
324
 *              of an integer/string/buffer/package or a named reference to
376
 *              of an integer/string/buffer/package or a named reference to
325
 *              a static object. Values such as a Localx or Argx or a control
377
 *              a static object. Values such as a Localx or Argx or a control
326
 *              method invocation are not checked.
378
 *              method invocation are not checked. Issue a warning if there is
-
 
379
 *              a valid return value, but the reserved method defines no
-
 
380
 *              return value.
327
 *
381
 *
328
 ******************************************************************************/
382
 ******************************************************************************/
Line 329... Line 383...
329
 
383
 
330
void
384
void
Line 341... Line 395...
341
    Index = ApCheckForPredefinedName (MethodInfo->Op,
395
    Index = ApCheckForPredefinedName (MethodInfo->Op,
342
                MethodInfo->Op->Asl.NameSeg);
396
                MethodInfo->Op->Asl.NameSeg);
Line 343... Line 397...
343
 
397
 
344
    switch (Index)
398
    switch (Index)
-
 
399
    {
-
 
400
    case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
-
 
401
 
-
 
402
        /* No return value expected, warn if there is one */
-
 
403
 
-
 
404
        ApCheckForUnexpectedReturnValue (Op, MethodInfo);
-
 
405
        return;
345
    {
406
 
346
    case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
407
    case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
347
    case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
408
    case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
348
    case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
-
 
Line 349... Line 409...
349
    case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
409
    case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
350
 
410
 
Line 351... Line 411...
351
        /* Just return, nothing to do */
411
        /* Just return, nothing to do */
Line 352... Line -...
352
        return;
-
 
353
 
-
 
354
    default: /* A standard predefined ACPI name */
412
        return;
355
 
413
 
-
 
414
    default: /* A standard predefined ACPI name */
-
 
415
 
-
 
416
        if (!PredefinedNames[Index].Info.ExpectedBtypes)
356
        /* Exit if no return value expected */
417
        {
357
 
418
            /* No return value expected, warn if there is one */
Line 358... Line 419...
358
        if (!PredefinedNames[Index].Info.ExpectedBtypes)
419