OpenCloudOS-Kernel/drivers/acpi/acpica
Lv Zheng 7f9bef9deb ACPICA / Hardware: Fix old register check in acpi_hw_get_access_bit_width()
The address check in acpi_hw_get_access_bit_width() should be byte width
based, not bit width based. This patch fixes this mistake.

For those who want to review acpi_hw_access_bit_width(), here is the
concerns and the design details of the function:

It is supposed that the GAS Address field should be aligned to the byte
width indicated by the GAS AccessSize field. Similarly, for the old non
GAS register, it is supposed that its Address should be aligned to its
Length.

For the "AccessSize = 0 (meaning ANY)" case, we try to return the maximum
instruction width (64 for MMIO or 32 for PIO) or the user expected access
bit width (64 for acpi_read()/acpi_write() or 32 for acpi_hw_read()/
acpi_hw_write()) and it is supposed that the GAS Address field should
always be aligned to the maximum expected access bit width (otherwise it
can't be accessed using ANY access bit width).

The problem is in acpi_tb_init_generic_address(), where the non GAS
register's Length is converted into the GAS BitWidth field, its Address is
converted into the GAS Address field, and the GAS AccessSize field is left
0 but most of the registers actually cannot be accessed using "ANY"
accesses.

As a conclusion, when AccessSize = 0 (ANY), the Address should either be
aligned to the BitWidth (wrong conversion) or aligned to 32 for PIO or 64
for MMIO (real GAS). Since currently, max_bit_width is 32, then:
1. BitWidth for the wrong conversion is 8,16,32; and
2. The Address of the real GAS should always be aligned to 8,16,32.
The address alignment check to exclude false matched real GAS is not
necessary. Thus this patch fixes the issue by removing the address
alignment check.

On the other hand, we in fact could use a simpler check of
"reg->bit_width < max_bit_width" to exclude the "BitWidth=64 PIO" case that
may be issued from acpi_read()/acpi_write() in the future.

Fixes: b314a172ee (ACPICA: Hardware: Add optimized access bit width support)
Reported-and-tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Mike Marshall <hubcap@omnibond.com>
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-06-01 22:44:22 +02:00
..
Makefile ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
acapps.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
accommon.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
acdebug.h ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
acdispat.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
acevents.h ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
acglobal.h ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
achware.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
acinterp.h ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
aclocal.h ACPICA: Renamed some #defined flag constants for clarity 2016-05-05 15:22:26 +02:00
acmacros.h ACPICA: Executer: Introduce a set of macros to handle bit width mask generation 2016-05-05 15:22:27 +02:00
acnamesp.h ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
acobject.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
acopcode.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
acparser.h ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
acpredef.h ACPICA: ACPI 6.0: Update _BIX support for new package element 2016-05-05 15:22:26 +02:00
acresrc.h ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
acstruct.h ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
actables.h ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
acutils.h ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
amlcode.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
amlresrc.h ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dbcmds.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dbconvert.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dbdisply.c ACPICA: Silence a -Wbad-function-cast warning when acpi_uintptr_t is 'uintptr_t' 2016-01-15 22:22:05 +01:00
dbexec.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dbfileio.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dbhistry.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dbinput.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dbmethod.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dbnames.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
dbobject.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dbstats.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dbtest.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dbutils.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
dbxface.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dsargs.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dscontrol.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dsdebug.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dsfield.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dsinit.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dsmethod.c Merge back new ACPICA material for v4.7. 2016-05-06 01:41:06 +02:00
dsmthdat.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dsobject.c ACPICA: Remove unnecessary arguments to ACPI_INFO 2016-02-24 14:14:49 +01:00
dsopcode.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dsutils.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dswexec.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dswload.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dswload2.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
dswscope.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
dswstate.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evevent.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
evglock.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
evgpe.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evgpeblk.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evgpeinit.c ACPICA: Remove unnecessary arguments to ACPI_INFO 2016-02-24 14:14:49 +01:00
evgpeutil.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evhandler.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evmisc.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evregion.c ACPICA: Events: Fix an issue that _REG association can happen before namespace is initialized 2016-04-05 03:53:34 +02:00
evrgnini.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evsci.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
evxface.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
evxfevnt.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
evxfgpe.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
evxfregn.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exconcat.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exconfig.c ACPICA: Tables: Fix wrong MLC condition for dynamic table loading 2016-04-05 03:53:34 +02:00
exconvrt.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
excreate.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exdebug.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exdump.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
exfield.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exfldio.c ACPICA: Executer: Introduce a set of macros to handle bit width mask generation 2016-05-05 15:22:27 +02:00
exmisc.c ACPICA: Intepreter: Add object extensions to Concatenate operand 2016-04-05 03:53:31 +02:00
exmutex.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exnames.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
exoparg1.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exoparg2.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exoparg3.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exoparg6.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exprep.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exregion.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exresnte.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exresolv.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exresop.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exstore.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exstoren.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exstorob.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
exsystem.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
extrace.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
exutils.c ACPICA: Interpreter: Update some function headers, no functional change 2016-04-05 03:53:32 +02:00
hwacpi.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
hwesleep.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
hwgpe.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
hwpci.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
hwregs.c ACPICA / Hardware: Fix old register check in acpi_hw_get_access_bit_width() 2016-06-01 22:44:22 +02:00
hwsleep.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
hwtimer.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
hwvalid.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
hwxface.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
hwxfsleep.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nsaccess.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
nsalloc.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nsarguments.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nsconvert.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
nsdump.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
nsdumpdv.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nseval.c ACPICA: Remove unnecessary arguments to ACPI_INFO 2016-02-24 14:14:49 +01:00
nsinit.c ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated before _REG evaluations 2016-04-05 03:53:34 +02:00
nsload.c ACPICA: Linuxize: reduce divergences for 20160212 release 2016-04-04 17:16:07 +02:00
nsnames.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
nsobject.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
nsparse.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nspredef.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nsprepkg.c ACPICA: ACPI 6.0: Update _BIX support for new package element 2016-05-05 15:22:26 +02:00
nsrepair.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
nsrepair2.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
nssearch.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nsutils.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
nswalk.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
nsxfeval.c ACPICA: Refactor evaluate_object to reduce nesting 2016-05-05 15:22:25 +02:00
nsxfname.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
nsxfobj.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
psargs.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
psloop.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
psobject.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
psopcode.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
psopinfo.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
psparse.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
psscope.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
pstree.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
psutils.c ACPICA: Renamed some #defined flag constants for clarity 2016-05-05 15:22:26 +02:00
pswalk.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
psxface.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
rsaddr.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
rscalc.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
rscreate.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
rsdump.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
rsdumpinfo.c ACPICA: ACPI 6.0, tools/iasl: Add support for new resource descriptors 2016-05-05 15:22:26 +02:00
rsinfo.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
rsio.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
rsirq.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
rslist.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
rsmemory.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
rsmisc.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
rsserial.c ACPICA: ACPI 6.0, tools/iasl: Add support for new resource descriptors 2016-05-05 15:22:26 +02:00
rsutils.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
rsxface.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
tbdata.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
tbfadt.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
tbfind.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
tbinstal.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
tbprint.c ACPICA: Remove unnecessary arguments to ACPI_INFO 2016-02-24 14:14:49 +01:00
tbutils.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
tbxface.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
tbxfload.c ACPICA: Interpreter: Fix wrong conditions for acpi_ev_install_region_handlers() invocation 2016-04-05 03:53:34 +02:00
tbxfroot.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utaddress.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utalloc.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utascii.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
utbuffer.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utcache.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utcopy.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utdebug.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
utdecode.c ACPICA: ACPI 6.1: Add full support for this version of ACPI spec 2016-04-05 03:53:31 +02:00
utdelete.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
uterror.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
uteval.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
utexcep.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utglobal.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
uthex.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utids.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utinit.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utlock.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utmath.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utmisc.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
utmutex.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utnonansi.c ACPICA: Utilities: Update for strtoul64 merger 2016-04-05 03:53:33 +02:00
utobject.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utosi.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utownerid.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utpredef.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utprint.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utresrc.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utstate.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utstring.c ACPICA: Move all ASCII utilities to a common file 2016-05-05 15:22:28 +02:00
uttrack.c ACPICA: All: const keyword changes across the ACPICA source 2016-04-05 03:53:33 +02:00
utuuid.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00
utxface.c ACPICA: Divergence: remove unwanted spaces for typedef 2016-05-05 15:14:35 +02:00
utxferror.c ACPICA: Remove unnecessary arguments to ACPI_INFO 2016-02-24 14:14:49 +01:00
utxfinit.c ACPICA / Interpreter: Fix a regression triggered because of wrong Linux ECDT support 2016-03-10 21:31:14 +01:00
utxfmutex.c ACPICA: Additional 2016 copyright changes 2016-01-15 22:18:09 +01:00