1. 21 4月, 2014 12 次提交
    • L
      ACPICA: Tables: Clean up split INSTALLED/VALIDATED table state logics. · 7f9fc99c
      Lv Zheng 提交于
      This patch is mainly a naming cleanup to clarify hidden logics, no
      functional changes.
      
      acpi_initialize_tables() is used by Linux to install table addresses for
      early boot steps.  During this stage, table addresses are mapped by
      early_ioremap() mechanism which is different from the runtime IO mappings.
      Thus it is not safe for ACPICA to keep mapped pointers in struct acpi_table_desc
      structure during this stage.
      
      In order to support this in ACPICA, table states are divided into
      1. "INSTALLED" (where struct acpi_table_desc.Pointer is always NULL) and
      2. "VALIDATED" (where struct acpi_table_desc.Pointer is always not NULL).
      During acpi_initialize_tables(), table state are ensured to be "INSTALLED"
      but not "VALIDATED".  This logic is ensured by the original code in very
      ambigious way.  For example, currently acpi_tb_delete_table() is invoked in
      some place to perform an uninstallation while it is invoked in other place
      to perform an invalidation.  They happen to work just because no one enters
      the penalty where the 2 behaviours are not equivalent.
      
      The naming cleanups are made in this patch:
      A. For installation and validation:
         There is code setting struct acpi_table_desc.Pointer first and delete it
         immediately to keep the descriptor's state as "INSTALLED" during the
         installation.  This patch implements this in more direct way.  After
         applying it, struct acpi_table_desc.Pointer will never be set in
         acpi_tb_install_table() and acpi_tb_override_table() as they are the only
         functions invoked during acpi_initialize_tables(). This is achieved by:
      1. Rename acpi_tb_verify_table() to acpi_tb_validate_table() to clarify this
         change.
      2. Rename acpi_tb_table_override() to acpi_tb_override_table() to keep nameing
         consistencies as other APIs (verb. Table).
      3. Stops setting struct acpi_table_desc.Pointer in acpi_tb_install_table() and
         acpi_tb_table_override().
      4. Introduce acpi_tb_acquire_table() to acquire the table pointer that is not
         maintained in the struct acpi_table_desc of the global root table list and
         rewrite acpi_tb_validate_table() using this new function to reduce
         redundancies.
      5. Replace the table pointer using the overridden table pointer in
         acpi_tb_add_table(). As acpi_tb_add_table() is not invoked during early boot
         stage, tables returned from this functions should be "VALIDATED".  As
         acpi_tb_override_table() is modified by this patch to return a "INSTALLED"
         but not "VALIDATED" descriptor, to keep acpi_tb_add_table() unchanged,
         struct acpi_table_desc.Pointer is filled in acpi_tb_add_table().
      B. For invalidation and uninstallation:
         The original code invalidate table by invoking acpi_tb_delete_table() here
         and there, but actually this function should only be used to uninstall
         tables.  This can work just because its invocations are equivalent to
         invalidation in some cases.
         This patch splits acpi_tb_delete_table() into acpi_tb_invalidate_table() and
         acpi_tb_uninstall_table() and cleans up the hidden logic using the new
         APIs.  This is achieved by:
      1. Rename acpi_tb_delete_table() to acpi_tb_uninstall_table() as it is mainly
         called before resetting struct acpi_table_desc.Address.  Thus the table
         descriptor is in "not INSTALLED" state.  This patch enforces this by
         setting struct acpi_table_desc.Address to NULL in this function.
      2. Introduce acpi_tb_invalidate_table() to be the reversal of
         acpi_tb_validate_table() and invoke it in acpi_tb_uninstall_table().
      3. Introduce acpi_tb_release_table() to release the table pointer that is not
         maintained in acpi_gbl_root_table_list and rewrite acpi_tb_invalidate_table()
         using this new function to reduce redundancies.
      
      After cleaning up, the maintainability of the internal APIs are also
      improved:
      1. acpi_tb_acquire_table: Acquire struct acpi_table_header according to
                             ACPI_TABLE_ORIGIN_xxx flags.
      2. acpi_tb_release_table: Release struct acpi_table_header according to
                             ACPI_TABLE_ORIGIN_xxx flags.
      3. acpi_tb_install_table: Make struct acpi_table_desc.Address not NULL according to
                             ACPI_TABLE_ORIGIN_xxx flags.
      4. acpi_tb_uninstall_table: Make struct acpi_table_desc.Address NULL according to
                               ACPI_TABLE_ORIGIN_xxx flags.
      5. acpi_tb_validate_table: Make struct acpi_table_desc.Pointer not NULL according to
                              ACPI_TABLE_ORIGIN_xxx flags.
      6. acpi_tb_invalidate_table: Make struct acpi_table_desc.Pointer NULL according to
                                ACPI_TABLE_ORIGIN_xxx flags.
      7. acpi_tb_override_table: Replace struct acpi_table_desc.Address and
                              struct acpi_table_desc.Flags.  It only happens in
                              "INSTALLED" state.
      
      The patch has been unit tested in acpi_exec by:
      1. Initializing;
      2. Executing exc_tbl ASLTS tests;
      3. Executing "Load" command.
      So that all original acpi_tb_install_table() and acpi_tb_override_table()
      invocations are covered.
      
      Known Issues:
      1. Cleanup acpi_tb_add_table() to Kill Code Redundancies
         Current implementation in acpi_tb_add_table() is not very clean, further
         patch can rewrite acpi_tb_add_table() with ordered acpi_tb_install_table(),
         acpi_tb_override_table() and acpi_tb_validate_table(). It is not done in this
         patch so that it is easy for the reviewers to understand the changes in
         this patch.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7f9fc99c
    • L
      ACPICA: Tables: Fix multiple ACPI_FREE()s around acpi_tb_add_table(). · 55df23f0
      Lv Zheng 提交于
      Currently there are following issues in acpi_tb_add_table():
      Following logic is currently correct:
      1. When a table is allocated in acpi_ex_load_op(), if a reloading happens,
         the allocated memory is freed by acpi_tb_add_table() and AE_OK is
         returned to the caller to avoid the caller to free it again.
      Following logic is currently incorrect:
      1. When a table is allocated in acpi_ex_load_op() or by the
         acpi_load_table() caller, if the table is already loaded, there will be
         twice ACPI_FREE() called for the same pointer when acpi_tb_add_table()
         returns AE_ALREADY_EXISTS.
      
      This patch only fixes the above incorrect logic in acpi_tb_add_table():
      1. Only invoke acpi_tb_delete_table() if AE_OK is going to be returned.
      2. After doing so, we do not invoke ACPI_FREE() when returning AE_OK;
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      [rjw: Subject]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      55df23f0
    • L
      ACPICA: Tables: Fix the issues in handling virtual addressed tables. · dc156adf
      Lv Zheng 提交于
      When table is overridden or reloaded, acpi_tb_delete_table() is called where
      struct acpi_table_desc.Pointer will be NULL.  It thus is impossible for virtual
      addressed tables to obtain the .Pointer again in acpi_tb_verify_table().
      
      This patch stores virtual table addresses  (ACPI_TABLE_ORIGIN_ALLOCATED,
      ACPI_TABLE_ORIGIN_UNKNOWN, ACPI_TABLE_ORIGIN_OVERRIDE) in the
      struct acpi_table_desc.Address field and refills the struct acpi_table_desc.Pointer
      using these addresses in acpi_tb_verify_table(). Note that if a table with
      ACPI_TABLE_ORIGIN_ALLOCATED set is actually freed, the .Address field
      should be invalidated and thus must be replaced with NULL to avoid wrong
      future validations occuring in acpi_tb_verify_table().
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      dc156adf
    • L
      ACPICA: Remove indent divergences to reduce maintenance overhead. · 5582982d
      Lv Zheng 提交于
      The divergences in the ACPICA files makes it difficult to maintain linuxize
      ACPICA table commits.  This patch reduces such divergences before applying
      table manager commits so that human interventions of patch rebasing can be
      reduced.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      [rjw: Subject]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5582982d
    • B
      ACPICA: Add a missing field for debug dump of mutex objects. · 0745fb41
      Bob Moore 提交于
      Adds "OriginalSyncLevel" field to the output.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0745fb41
    • L
      ACPICA: Update use of acpi_os_wait_events_complete interface. · 69c841b6
      Lv Zheng 提交于
      This patch cleans up all of the acpi_os_wait_events_complete() invocations to
      make it to be invoked inside of ACPICA in the way to accommodate Linux's
      work queue implementation.
      
      According to the report, current Linux kernel code is facing a boot time
      race issue in the acpi_remove_notify_handler(). This is because:
      Linux is using work queues to implement a deferred handler call environment
      while ACPICA expects OSPM to implement acpi_os_wait_events_complete() using
      wait queues.  The position to invoke a "waiter" is not suitable for a
      "flusher" as new invocations can be scheduled after this position and
      before the deletion of the handler from its management container.
      
      Since the following commit has deleted acpi_os_wait_events_complete()
      parameters, it thus might not be possible for OSPM to achieve a safe
      removal using wait queues.  This requires ACPICA to be changed accordingly
      to "flush" handlers rather than "wait" them to be drain up:
      
        Commit: 5ff986a2a9db11858247b71fe242fe17617229aa
        Date: Wed, 16 May 2012 13:36:07 -0700
        Subject: Introduce acpi_os_wait_events_complete interface.
      
        This interface will block until asynchronous events like notifies
        and GPEs are complete. Within ACPICA, it is called before a notify or GPE
        handler is removed. ACPICA BZ 868.
      
      This patch fixes this issue by invoking acpi_os_wait_events_complete() in the
      way to "flush" things - it thus should be put to the position after handler
      is removed from its management container but before it is destructed.
      
      The technical concerns are:
      1. MTX_NAMESPACE is used to protect things that acpi_os_wait_events_complete()
         might be waiting for, thus MTX_NAMESPACE must be unlocked before
         invoking acpi_os_wait_events_complete().
      2. MTX_NAMESPACE is also used to implement the serialization of
         acpi_install_notify_handler() and acpi_remove_notify_handler(). This patch
         changes this logic, thus if there are many
         acpi_install/remove_notify_handler() invoked in parallel, the
         acpi_os_wait_events_complete() might face the races which could cause it
         never running to an end.  Normally this will require additional code to
         implement a separate locking facility which is not implemented due to 3.
      3. Given ACPICA users will always invoke acpi_install_notify_handler() once
         during Linux module/device initialization and invoke
         acpi_remove_notify_handler() once during module/device finalization,
         problem stated in 2 will not happen in Linux environment due to the
         mutual exclusive module/device existence, this fix thus is sufficient.
      Same concerns can apply to acpi_install/remove_gpe_handler(). Reported and
      tested: Ronald Vink.  Fixed: Lv Zheng.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=60583Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Reported-and-Tested-by: NRonald Vink <ronald.vink@boskalis.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      69c841b6
    • B
      ACPICA: Disassembler: Add decoding of Notify() values. · 06a63e33
      Bob Moore 提交于
      For Notify operators, displays a comment that describe the meaning
      of the notify value.
      
      This patch updates the debugging information that is enabled for
      CONFIG_ACPI_DEBUG builds.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      06a63e33
    • B
      ACPICA: Disassembler: Add support to decode _HID and _CID values. · b944b29c
      Bob Moore 提交于
      For _HID and _CID, the disassembler will emit a string that describes
      the device if the _HID/_CID value is recognized. acpihelp updated also.
      acpihelp will now search for a specific ID as well as displaying
      the list of "known" (to ACPICA) IDs.
      
      This patch does not affect Linux kernel behavior as the disassembler
      and the acpihelp are not shipped with it.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b944b29c
    • B
      ACPICA: Unload operator: Emit a warning if and when it is ever used. · 43d1a62d
      Bob Moore 提交于
      We would like to see the ASL for any machine that uses this operator,
      so emit at least a warning to hopefully draw some attention.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      43d1a62d
    • B
      ACPICA: Update comments for ACPICA name - no functional change. · 6085bb18
      Bob Moore 提交于
      Change all comments that contain the string "ACPI CA" to "ACPICA"
      so that the name is standard across the entire source base.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6085bb18
    • D
      ACPICA: utstring: Check array index bound before use. · 5d42b0fa
      David Binderman 提交于
      ACPICA BZ 1077. David Binderman.
      
      References: https://bugs.acpica.org/show_bug.cgi?id=1077Signed-off-by: NDavid Binderman <dcb314@hotmail.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: 3.9+ <stable@vger.kernel.org> # 3.9.x: 42f8fb75: ACPICA: Source restructuring
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5d42b0fa
    • B
      ACPICA: Add EXPORT_SYMBOL macros for install/remove SCI handler interfaces. · 1d44efab
      Bob Moore 提交于
      These recently added interfaces did not have these macros, used
      by some hosts.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1d44efab
  2. 26 3月, 2014 5 次提交
  3. 18 3月, 2014 7 次提交
  4. 27 2月, 2014 7 次提交
  5. 13 2月, 2014 1 次提交
  6. 11 2月, 2014 8 次提交