diff options
260 files changed, 7312 insertions, 3389 deletions
diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt index be8d4006bf76..f7b12c071d53 100644 --- a/Documentation/cpu-freq/intel-pstate.txt +++ b/Documentation/cpu-freq/intel-pstate.txt | |||
| @@ -1,61 +1,131 @@ | |||
| 1 | Intel P-state driver | 1 | Intel P-State driver |
| 2 | -------------------- | 2 | -------------------- |
| 3 | 3 | ||
| 4 | This driver provides an interface to control the P state selection for | 4 | This driver provides an interface to control the P-State selection for the |
| 5 | SandyBridge+ Intel processors. The driver can operate two different | 5 | SandyBridge+ Intel processors. |
| 6 | modes based on the processor model, legacy mode and Hardware P state (HWP) | 6 | |
| 7 | mode. | 7 | The following document explains P-States: |
| 8 | 8 | http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf | |
| 9 | In legacy mode, the Intel P-state implements two internal governors, | 9 | As stated in the document, P-State doesn’t exactly mean a frequency. However, for |
| 10 | performance and powersave, that differ from the general cpufreq governors of | 10 | the sake of the relationship with cpufreq, P-State and frequency are used |
| 11 | the same name (the general cpufreq governors implement target(), whereas the | 11 | interchangeably. |
| 12 | internal Intel P-state governors implement setpolicy()). The internal | 12 | |
| 13 | performance governor sets the max_perf_pct and min_perf_pct to 100; that is, | 13 | Understanding the cpufreq core governors and policies are important before |
| 14 | the governor selects the highest available P state to maximize the performance | 14 | discussing more details about the Intel P-State driver. Based on what callbacks |
| 15 | of the core. The internal powersave governor selects the appropriate P state | 15 | a cpufreq driver provides to the cpufreq core, it can support two types of |
| 16 | based on the current load on the CPU. | 16 | drivers: |
| 17 | 17 | - with target_index() callback: In this mode, the drivers using cpufreq core | |
| 18 | In HWP mode P state selection is implemented in the processor | 18 | simply provide the minimum and maximum frequency limits and an additional |
| 19 | itself. The driver provides the interfaces between the cpufreq core and | 19 | interface target_index() to set the current frequency. The cpufreq subsystem |
| 20 | the processor to control P state selection based on user preferences | 20 | has a number of scaling governors ("performance", "powersave", "ondemand", |
| 21 | and reporting frequency to the cpufreq core. In this mode the | 21 | etc.). Depending on which governor is in use, cpufreq core will call for |
| 22 | internal Intel P-state governor code is disabled. | 22 | transitions to a specific frequency using target_index() callback. |
| 23 | 23 | - setpolicy() callback: In this mode, drivers do not provide target_index() | |
| 24 | In addition to the interfaces provided by the cpufreq core for | 24 | callback, so cpufreq core can't request a transition to a specific frequency. |
| 25 | controlling frequency the driver provides sysfs files for | 25 | The driver provides minimum and maximum frequency limits and callbacks to set a |
| 26 | controlling P state selection. These files have been added to | 26 | policy. The policy in cpufreq sysfs is referred to as the "scaling governor". |
| 27 | /sys/devices/system/cpu/intel_pstate/ | 27 | The cpufreq core can request the driver to operate in any of the two policies: |
| 28 | 28 | "performance: and "powersave". The driver decides which frequency to use based | |
| 29 | max_perf_pct: limits the maximum P state that will be requested by | 29 | on the above policy selection considering minimum and maximum frequency limits. |
| 30 | the driver stated as a percentage of the available performance. The | 30 | |
| 31 | available (P states) performance may be reduced by the no_turbo | 31 | The Intel P-State driver falls under the latter category, which implements the |
| 32 | setpolicy() callback. This driver decides what P-State to use based on the | ||
| 33 | requested policy from the cpufreq core. If the processor is capable of | ||
| 34 | selecting its next P-State internally, then the driver will offload this | ||
| 35 | responsibility to the processor (aka HWP: Hardware P-States). If not, the | ||
| 36 | driver implements algorithms to select the next P-State. | ||
| 37 | |||
| 38 | Since these policies are implemented in the driver, they are not same as the | ||
| 39 | cpufreq scaling governors implementation, even if they have the same name in | ||
| 40 | the cpufreq sysfs (scaling_governors). For example the "performance" policy is | ||
| 41 | similar to cpufreq’s "performance" governor, but "powersave" is completely | ||
| 42 | different than the cpufreq "powersave" governor. The strategy here is similar | ||
| 43 | to cpufreq "ondemand", where the requested P-State is related to the system load. | ||
| 44 | |||
| 45 | Sysfs Interface | ||
| 46 | |||
| 47 | In addition to the frequency-controlling interfaces provided by the cpufreq | ||
| 48 | core, the driver provides its own sysfs files to control the P-State selection. | ||
| 49 | These files have been added to /sys/devices/system/cpu/intel_pstate/. | ||
| 50 | Any changes made to these files are applicable to all CPUs (even in a | ||
| 51 | multi-package system). | ||
| 52 | |||
| 53 | max_perf_pct: Limits the maximum P-State that will be requested by | ||
| 54 | the driver. It states it as a percentage of the available performance. The | ||
| 55 | available (P-State) performance may be reduced by the no_turbo | ||
| 32 | setting described below. | 56 | setting described below. |
| 33 | 57 | ||
| 34 | min_perf_pct: limits the minimum P state that will be requested by | 58 | min_perf_pct: Limits the minimum P-State that will be requested by |
| 35 | the driver stated as a percentage of the max (non-turbo) | 59 | the driver. It states it as a percentage of the max (non-turbo) |
| 36 | performance level. | 60 | performance level. |
| 37 | 61 | ||
| 38 | no_turbo: limits the driver to selecting P states below the turbo | 62 | no_turbo: Limits the driver to selecting P-State below the turbo |
| 39 | frequency range. | 63 | frequency range. |
| 40 | 64 | ||
| 41 | turbo_pct: displays the percentage of the total performance that | 65 | turbo_pct: Displays the percentage of the total performance that |
| 42 | is supported by hardware that is in the turbo range. This number | 66 | is supported by hardware that is in the turbo range. This number |
| 43 | is independent of whether turbo has been disabled or not. | 67 | is independent of whether turbo has been disabled or not. |
| 44 | 68 | ||
| 45 | num_pstates: displays the number of pstates that are supported | 69 | num_pstates: Displays the number of P-States that are supported |
| 46 | by hardware. This number is independent of whether turbo has | 70 | by hardware. This number is independent of whether turbo has |
| 47 | been disabled or not. | 71 | been disabled or not. |
| 48 | 72 | ||
| 73 | For example, if a system has these parameters: | ||
| 74 | Max 1 core turbo ratio: 0x21 (Max 1 core ratio is the maximum P-State) | ||
| 75 | Max non turbo ratio: 0x17 | ||
| 76 | Minimum ratio : 0x08 (Here the ratio is called max efficiency ratio) | ||
| 77 | |||
| 78 | Sysfs will show : | ||
| 79 | max_perf_pct:100, which corresponds to 1 core ratio | ||
| 80 | min_perf_pct:24, max_efficiency_ratio / max 1 Core ratio | ||
| 81 | no_turbo:0, turbo is not disabled | ||
| 82 | num_pstates:26 = (max 1 Core ratio - Max Efficiency Ratio + 1) | ||
| 83 | turbo_pct:39 = (max 1 core ratio - max non turbo ratio) / num_pstates | ||
| 84 | |||
| 85 | Refer to "Intel® 64 and IA-32 Architectures Software Developer’s Manual | ||
| 86 | Volume 3: System Programming Guide" to understand ratios. | ||
| 87 | |||
| 88 | cpufreq sysfs for Intel P-State | ||
| 89 | |||
| 90 | Since this driver registers with cpufreq, cpufreq sysfs is also presented. | ||
| 91 | There are some important differences, which need to be considered. | ||
| 92 | |||
| 93 | scaling_cur_freq: This displays the real frequency which was used during | ||
| 94 | the last sample period instead of what is requested. Some other cpufreq driver, | ||
| 95 | like acpi-cpufreq, displays what is requested (Some changes are on the | ||
| 96 | way to fix this for acpi-cpufreq driver). The same is true for frequencies | ||
| 97 | displayed at /proc/cpuinfo. | ||
| 98 | |||
| 99 | scaling_governor: This displays current active policy. Since each CPU has a | ||
| 100 | cpufreq sysfs, it is possible to set a scaling governor to each CPU. But this | ||
| 101 | is not possible with Intel P-States, as there is one common policy for all | ||
| 102 | CPUs. Here, the last requested policy will be applicable to all CPUs. It is | ||
| 103 | suggested that one use the cpupower utility to change policy to all CPUs at the | ||
| 104 | same time. | ||
| 105 | |||
| 106 | scaling_setspeed: This attribute can never be used with Intel P-State. | ||
| 107 | |||
| 108 | scaling_max_freq/scaling_min_freq: This interface can be used similarly to | ||
| 109 | the max_perf_pct/min_perf_pct of Intel P-State sysfs. However since frequencies | ||
| 110 | are converted to nearest possible P-State, this is prone to rounding errors. | ||
| 111 | This method is not preferred to limit performance. | ||
| 112 | |||
| 113 | affected_cpus: Not used | ||
| 114 | related_cpus: Not used | ||
| 115 | |||
| 49 | For contemporary Intel processors, the frequency is controlled by the | 116 | For contemporary Intel processors, the frequency is controlled by the |
| 50 | processor itself and the P-states exposed to software are related to | 117 | processor itself and the P-State exposed to software is related to |
| 51 | performance levels. The idea that frequency can be set to a single | 118 | performance levels. The idea that frequency can be set to a single |
| 52 | frequency is fiction for Intel Core processors. Even if the scaling | 119 | frequency is fictional for Intel Core processors. Even if the scaling |
| 53 | driver selects a single P state the actual frequency the processor | 120 | driver selects a single P-State, the actual frequency the processor |
| 54 | will run at is selected by the processor itself. | 121 | will run at is selected by the processor itself. |
| 55 | 122 | ||
| 56 | For legacy mode debugfs files have also been added to allow tuning of | 123 | Tuning Intel P-State driver |
| 57 | the internal governor algorythm. These files are located at | 124 | |
| 58 | /sys/kernel/debug/pstate_snb/ These files are NOT present in HWP mode. | 125 | When HWP mode is not used, debugfs files have also been added to allow the |
| 126 | tuning of the internal governor algorithm. These files are located at | ||
| 127 | /sys/kernel/debug/pstate_snb/. The algorithm uses a PID (Proportional | ||
| 128 | Integral Derivative) controller. The PID tunable parameters are: | ||
| 59 | 129 | ||
| 60 | deadband | 130 | deadband |
| 61 | d_gain_pct | 131 | d_gain_pct |
| @@ -63,3 +133,90 @@ the internal governor algorythm. These files are located at | |||
| 63 | p_gain_pct | 133 | p_gain_pct |
| 64 | sample_rate_ms | 134 | sample_rate_ms |
| 65 | setpoint | 135 | setpoint |
| 136 | |||
| 137 | To adjust these parameters, some understanding of driver implementation is | ||
| 138 | necessary. There are some tweeks described here, but be very careful. Adjusting | ||
| 139 | them requires expert level understanding of power and performance relationship. | ||
| 140 | These limits are only useful when the "powersave" policy is active. | ||
| 141 | |||
| 142 | -To make the system more responsive to load changes, sample_rate_ms can | ||
| 143 | be adjusted (current default is 10ms). | ||
| 144 | -To make the system use higher performance, even if the load is lower, setpoint | ||
| 145 | can be adjusted to a lower number. This will also lead to faster ramp up time | ||
| 146 | to reach the maximum P-State. | ||
| 147 | If there are no derivative and integral coefficients, The next P-State will be | ||
| 148 | equal to: | ||
| 149 | current P-State - ((setpoint - current cpu load) * p_gain_pct) | ||
| 150 | |||
| 151 | For example, if the current PID parameters are (Which are defaults for the core | ||
| 152 | processors like SandyBridge): | ||
| 153 | deadband = 0 | ||
| 154 | d_gain_pct = 0 | ||
| 155 | i_gain_pct = 0 | ||
| 156 | p_gain_pct = 20 | ||
| 157 | sample_rate_ms = 10 | ||
| 158 | setpoint = 97 | ||
| 159 | |||
| 160 | If the current P-State = 0x08 and current load = 100, this will result in the | ||
| 161 | next P-State = 0x08 - ((97 - 100) * 0.2) = 8.6 (rounded to 9). Here the P-State | ||
| 162 | goes up by only 1. If during next sample interval the current load doesn't | ||
| 163 | change and still 100, then P-State goes up by one again. This process will | ||
| 164 | continue as long as the load is more than the setpoint until the maximum P-State | ||
| 165 | is reached. | ||
| 166 | |||
| 167 | For the same load at setpoint = 60, this will result in the next P-State | ||
| 168 | = 0x08 - ((60 - 100) * 0.2) = 16 | ||
| 169 | So by changing the setpoint from 97 to 60, there is an increase of the | ||
| 170 | next P-State from 9 to 16. So this will make processor execute at higher | ||
| 171 | P-State for the same CPU load. If the load continues to be more than the | ||
| 172 | setpoint during next sample intervals, then P-State will go up again till the | ||
| 173 | maximum P-State is reached. But the ramp up time to reach the maximum P-State | ||
| 174 | will be much faster when the setpoint is 60 compared to 97. | ||
| 175 | |||
| 176 | Debugging Intel P-State driver | ||
| 177 | |||
| 178 | Event tracing | ||
| 179 | To debug P-State transition, the Linux event tracing interface can be used. | ||
| 180 | There are two specific events, which can be enabled (Provided the kernel | ||
| 181 | configs related to event tracing are enabled). | ||
| 182 | |||
| 183 | # cd /sys/kernel/debug/tracing/ | ||
| 184 | # echo 1 > events/power/pstate_sample/enable | ||
| 185 | # echo 1 > events/power/cpu_frequency/enable | ||
| 186 | # cat trace | ||
| 187 | gnome-terminal--4510 [001] ..s. 1177.680733: pstate_sample: core_busy=107 | ||
| 188 | scaled=94 from=26 to=26 mperf=1143818 aperf=1230607 tsc=29838618 | ||
| 189 | freq=2474476 | ||
| 190 | cat-5235 [002] ..s. 1177.681723: cpu_frequency: state=2900000 cpu_id=2 | ||
| 191 | |||
| 192 | |||
| 193 | Using ftrace | ||
| 194 | |||
| 195 | If function level tracing is required, the Linux ftrace interface can be used. | ||
| 196 | For example if we want to check how often a function to set a P-State is | ||
| 197 | called, we can set ftrace filter to intel_pstate_set_pstate. | ||
| 198 | |||
| 199 | # cd /sys/kernel/debug/tracing/ | ||
| 200 | # cat available_filter_functions | grep -i pstate | ||
| 201 | intel_pstate_set_pstate | ||
| 202 | intel_pstate_cpu_init | ||
| 203 | ... | ||
| 204 | |||
| 205 | # echo intel_pstate_set_pstate > set_ftrace_filter | ||
| 206 | # echo function > current_tracer | ||
| 207 | # cat trace | head -15 | ||
| 208 | # tracer: function | ||
| 209 | # | ||
| 210 | # entries-in-buffer/entries-written: 80/80 #P:4 | ||
| 211 | # | ||
| 212 | # _-----=> irqs-off | ||
| 213 | # / _----=> need-resched | ||
| 214 | # | / _---=> hardirq/softirq | ||
| 215 | # || / _--=> preempt-depth | ||
| 216 | # ||| / delay | ||
| 217 | # TASK-PID CPU# |||| TIMESTAMP FUNCTION | ||
| 218 | # | | | |||| | | | ||
| 219 | Xorg-3129 [000] ..s. 2537.644844: intel_pstate_set_pstate <-intel_pstate_timer_func | ||
| 220 | gnome-terminal--4510 [002] ..s. 2537.649844: intel_pstate_set_pstate <-intel_pstate_timer_func | ||
| 221 | gnome-shell-3409 [001] ..s. 2537.650850: intel_pstate_set_pstate <-intel_pstate_timer_func | ||
| 222 | <idle>-0 [000] ..s. 2537.654843: intel_pstate_set_pstate <-intel_pstate_timer_func | ||
diff --git a/Documentation/cpu-freq/pcc-cpufreq.txt b/Documentation/cpu-freq/pcc-cpufreq.txt index 9e3c3b33514c..0a94224ad296 100644 --- a/Documentation/cpu-freq/pcc-cpufreq.txt +++ b/Documentation/cpu-freq/pcc-cpufreq.txt | |||
| @@ -159,8 +159,8 @@ to be strictly associated with a P-state. | |||
| 159 | 159 | ||
| 160 | 2.2 cpuinfo_transition_latency: | 160 | 2.2 cpuinfo_transition_latency: |
| 161 | ------------------------------- | 161 | ------------------------------- |
| 162 | The cpuinfo_transition_latency field is 0. The PCC specification does | 162 | The cpuinfo_transition_latency field is CPUFREQ_ETERNAL. The PCC specification |
| 163 | not include a field to expose this value currently. | 163 | does not include a field to expose this value currently. |
| 164 | 164 | ||
| 165 | 2.3 cpuinfo_cur_freq: | 165 | 2.3 cpuinfo_cur_freq: |
| 166 | --------------------- | 166 | --------------------- |
diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt index 3a07a87fef20..6aca64f289b6 100644 --- a/Documentation/devicetree/bindings/arm/cpus.txt +++ b/Documentation/devicetree/bindings/arm/cpus.txt | |||
| @@ -242,6 +242,23 @@ nodes to be present and contain the properties described below. | |||
| 242 | Definition: Specifies the syscon node controlling the cpu core | 242 | Definition: Specifies the syscon node controlling the cpu core |
| 243 | power domains. | 243 | power domains. |
| 244 | 244 | ||
| 245 | - dynamic-power-coefficient | ||
| 246 | Usage: optional | ||
| 247 | Value type: <prop-encoded-array> | ||
| 248 | Definition: A u32 value that represents the running time dynamic | ||
| 249 | power coefficient in units of mW/MHz/uVolt^2. The | ||
| 250 | coefficient can either be calculated from power | ||
| 251 | measurements or derived by analysis. | ||
| 252 | |||
| 253 | The dynamic power consumption of the CPU is | ||
| 254 | proportional to the square of the Voltage (V) and | ||
| 255 | the clock frequency (f). The coefficient is used to | ||
| 256 | calculate the dynamic power as below - | ||
| 257 | |||
| 258 | Pdyn = dynamic-power-coefficient * V^2 * f | ||
| 259 | |||
| 260 | where voltage is in uV, frequency is in MHz. | ||
| 261 | |||
| 245 | Example 1 (dual-cluster big.LITTLE system 32-bit): | 262 | Example 1 (dual-cluster big.LITTLE system 32-bit): |
| 246 | 263 | ||
| 247 | cpus { | 264 | cpus { |
diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-st.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-st.txt new file mode 100644 index 000000000000..d91a02a3b6b0 --- /dev/null +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-st.txt | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | Binding for ST's CPUFreq driver | ||
| 2 | =============================== | ||
| 3 | |||
| 4 | ST's CPUFreq driver attempts to read 'process' and 'version' attributes | ||
| 5 | from the SoC, then supplies the OPP framework with 'prop' and 'supported | ||
| 6 | hardware' information respectively. The framework is then able to read | ||
| 7 | the DT and operate in the usual way. | ||
| 8 | |||
| 9 | For more information about the expected DT format [See: ../opp/opp.txt]. | ||
| 10 | |||
| 11 | Frequency Scaling only | ||
| 12 | ---------------------- | ||
| 13 | |||
| 14 | No vendor specific driver required for this. | ||
| 15 | |||
| 16 | Located in CPU's node: | ||
| 17 | |||
| 18 | - operating-points : [See: ../power/opp.txt] | ||
| 19 | |||
| 20 | Example [safe] | ||
| 21 | -------------- | ||
| 22 | |||
| 23 | cpus { | ||
| 24 | cpu@0 { | ||
| 25 | /* kHz uV */ | ||
| 26 | operating-points = <1500000 0 | ||
| 27 | 1200000 0 | ||
| 28 | 800000 0 | ||
| 29 | 500000 0>; | ||
| 30 | }; | ||
| 31 | }; | ||
| 32 | |||
| 33 | Dynamic Voltage and Frequency Scaling (DVFS) | ||
| 34 | -------------------------------------------- | ||
| 35 | |||
| 36 | This requires the ST CPUFreq driver to supply 'process' and 'version' info. | ||
| 37 | |||
| 38 | Located in CPU's node: | ||
| 39 | |||
| 40 | - operating-points-v2 : [See ../power/opp.txt] | ||
| 41 | |||
| 42 | Example [unsafe] | ||
| 43 | ---------------- | ||
| 44 | |||
| 45 | cpus { | ||
| 46 | cpu@0 { | ||
| 47 | operating-points-v2 = <&cpu0_opp_table>; | ||
| 48 | }; | ||
| 49 | }; | ||
| 50 | |||
| 51 | cpu0_opp_table: opp_table { | ||
| 52 | compatible = "operating-points-v2"; | ||
| 53 | |||
| 54 | /* ############################################################### */ | ||
| 55 | /* # WARNING: Do not attempt to copy/replicate these nodes, # */ | ||
| 56 | /* # they are only to be supplied by the bootloader !!! # */ | ||
| 57 | /* ############################################################### */ | ||
| 58 | opp0 { | ||
| 59 | /* Major Minor Substrate */ | ||
| 60 | /* 2 all all */ | ||
| 61 | opp-supported-hw = <0x00000004 0xffffffff 0xffffffff>; | ||
| 62 | opp-hz = /bits/ 64 <1500000000>; | ||
| 63 | clock-latency-ns = <10000000>; | ||
| 64 | |||
| 65 | opp-microvolt-pcode0 = <1200000>; | ||
| 66 | opp-microvolt-pcode1 = <1200000>; | ||
| 67 | opp-microvolt-pcode2 = <1200000>; | ||
| 68 | opp-microvolt-pcode3 = <1200000>; | ||
| 69 | opp-microvolt-pcode4 = <1170000>; | ||
| 70 | opp-microvolt-pcode5 = <1140000>; | ||
| 71 | opp-microvolt-pcode6 = <1100000>; | ||
| 72 | opp-microvolt-pcode7 = <1070000>; | ||
| 73 | }; | ||
| 74 | |||
| 75 | opp1 { | ||
| 76 | /* Major Minor Substrate */ | ||
| 77 | /* all all all */ | ||
| 78 | opp-supported-hw = <0xffffffff 0xffffffff 0xffffffff>; | ||
| 79 | opp-hz = /bits/ 64 <1200000000>; | ||
| 80 | clock-latency-ns = <10000000>; | ||
| 81 | |||
| 82 | opp-microvolt-pcode0 = <1110000>; | ||
| 83 | opp-microvolt-pcode1 = <1150000>; | ||
| 84 | opp-microvolt-pcode2 = <1100000>; | ||
| 85 | opp-microvolt-pcode3 = <1080000>; | ||
| 86 | opp-microvolt-pcode4 = <1040000>; | ||
| 87 | opp-microvolt-pcode5 = <1020000>; | ||
| 88 | opp-microvolt-pcode6 = <980000>; | ||
| 89 | opp-microvolt-pcode7 = <930000>; | ||
| 90 | }; | ||
| 91 | }; | ||
diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt index 0cb44dc21f97..601256fe8c0d 100644 --- a/Documentation/devicetree/bindings/opp/opp.txt +++ b/Documentation/devicetree/bindings/opp/opp.txt | |||
| @@ -45,21 +45,10 @@ Devices supporting OPPs must set their "operating-points-v2" property with | |||
| 45 | phandle to a OPP table in their DT node. The OPP core will use this phandle to | 45 | phandle to a OPP table in their DT node. The OPP core will use this phandle to |
| 46 | find the operating points for the device. | 46 | find the operating points for the device. |
| 47 | 47 | ||
| 48 | Devices may want to choose OPP tables at runtime and so can provide a list of | ||
| 49 | phandles here. But only *one* of them should be chosen at runtime. This must be | ||
| 50 | accompanied by a corresponding "operating-points-names" property, to uniquely | ||
| 51 | identify the OPP tables. | ||
| 52 | |||
| 53 | If required, this can be extended for SoC vendor specfic bindings. Such bindings | 48 | If required, this can be extended for SoC vendor specfic bindings. Such bindings |
| 54 | should be documented as Documentation/devicetree/bindings/power/<vendor>-opp.txt | 49 | should be documented as Documentation/devicetree/bindings/power/<vendor>-opp.txt |
| 55 | and should have a compatible description like: "operating-points-v2-<vendor>". | 50 | and should have a compatible description like: "operating-points-v2-<vendor>". |
| 56 | 51 | ||
| 57 | Optional properties: | ||
| 58 | - operating-points-names: Names of OPP tables (required if multiple OPP | ||
| 59 | tables are present), to uniquely identify them. The same list must be present | ||
| 60 | for all the CPUs which are sharing clock/voltage rails and hence the OPP | ||
| 61 | tables. | ||
| 62 | |||
| 63 | * OPP Table Node | 52 | * OPP Table Node |
| 64 | 53 | ||
| 65 | This describes the OPPs belonging to a device. This node can have following | 54 | This describes the OPPs belonging to a device. This node can have following |
| @@ -100,6 +89,14 @@ Optional properties: | |||
| 100 | Entries for multiple regulators must be present in the same order as | 89 | Entries for multiple regulators must be present in the same order as |
| 101 | regulators are specified in device's DT node. | 90 | regulators are specified in device's DT node. |
| 102 | 91 | ||
| 92 | - opp-microvolt-<name>: Named opp-microvolt property. This is exactly similar to | ||
| 93 | the above opp-microvolt property, but allows multiple voltage ranges to be | ||
| 94 | provided for the same OPP. At runtime, the platform can pick a <name> and | ||
| 95 | matching opp-microvolt-<name> property will be enabled for all OPPs. If the | ||
| 96 | platform doesn't pick a specific <name> or the <name> doesn't match with any | ||
| 97 | opp-microvolt-<name> properties, then opp-microvolt property shall be used, if | ||
| 98 | present. | ||
| 99 | |||
| 103 | - opp-microamp: The maximum current drawn by the device in microamperes | 100 | - opp-microamp: The maximum current drawn by the device in microamperes |
| 104 | considering system specific parameters (such as transients, process, aging, | 101 | considering system specific parameters (such as transients, process, aging, |
| 105 | maximum operating temperature range etc.) as necessary. This may be used to | 102 | maximum operating temperature range etc.) as necessary. This may be used to |
| @@ -112,6 +109,9 @@ Optional properties: | |||
| 112 | for few regulators, then this should be marked as zero for them. If it isn't | 109 | for few regulators, then this should be marked as zero for them. If it isn't |
| 113 | required for any regulator, then this property need not be present. | 110 | required for any regulator, then this property need not be present. |
| 114 | 111 | ||
| 112 | - opp-microamp-<name>: Named opp-microamp property. Similar to | ||
| 113 | opp-microvolt-<name> property, but for microamp instead. | ||
| 114 | |||
| 115 | - clock-latency-ns: Specifies the maximum possible transition latency (in | 115 | - clock-latency-ns: Specifies the maximum possible transition latency (in |
| 116 | nanoseconds) for switching to this OPP from any other OPP. | 116 | nanoseconds) for switching to this OPP from any other OPP. |
| 117 | 117 | ||
| @@ -123,6 +123,26 @@ Optional properties: | |||
| 123 | - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in | 123 | - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in |
| 124 | the table should have this. | 124 | the table should have this. |
| 125 | 125 | ||
| 126 | - opp-supported-hw: This enables us to select only a subset of OPPs from the | ||
| 127 | larger OPP table, based on what version of the hardware we are running on. We | ||
| 128 | still can't have multiple nodes with the same opp-hz value in OPP table. | ||
| 129 | |||
| 130 | It's an user defined array containing a hierarchy of hardware version numbers, | ||
| 131 | supported by the OPP. For example: a platform with hierarchy of three levels | ||
| 132 | of versions (A, B and C), this field should be like <X Y Z>, where X | ||
| 133 | corresponds to Version hierarchy A, Y corresponds to version hierarchy B and Z | ||
| 134 | corresponds to version hierarchy C. | ||
| 135 | |||
| 136 | Each level of hierarchy is represented by a 32 bit value, and so there can be | ||
| 137 | only 32 different supported version per hierarchy. i.e. 1 bit per version. A | ||
| 138 | value of 0xFFFFFFFF will enable the OPP for all versions for that hierarchy | ||
| 139 | level. And a value of 0x00000000 will disable the OPP completely, and so we | ||
| 140 | never want that to happen. | ||
| 141 | |||
| 142 | If 32 values aren't sufficient for a version hierarchy, than that version | ||
| 143 | hierarchy can be contained in multiple 32 bit values. i.e. <X Y Z1 Z2> in the | ||
| 144 | above example, Z1 & Z2 refer to the version hierarchy Z. | ||
| 145 | |||
| 126 | - status: Marks the node enabled/disabled. | 146 | - status: Marks the node enabled/disabled. |
| 127 | 147 | ||
| 128 | Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together. | 148 | Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together. |
| @@ -157,20 +177,20 @@ Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together. | |||
| 157 | compatible = "operating-points-v2"; | 177 | compatible = "operating-points-v2"; |
| 158 | opp-shared; | 178 | opp-shared; |
| 159 | 179 | ||
| 160 | opp00 { | 180 | opp@1000000000 { |
| 161 | opp-hz = /bits/ 64 <1000000000>; | 181 | opp-hz = /bits/ 64 <1000000000>; |
| 162 | opp-microvolt = <970000 975000 985000>; | 182 | opp-microvolt = <970000 975000 985000>; |
| 163 | opp-microamp = <70000>; | 183 | opp-microamp = <70000>; |
| 164 | clock-latency-ns = <300000>; | 184 | clock-latency-ns = <300000>; |
| 165 | opp-suspend; | 185 | opp-suspend; |
| 166 | }; | 186 | }; |
| 167 | opp01 { | 187 | opp@1100000000 { |
| 168 | opp-hz = /bits/ 64 <1100000000>; | 188 | opp-hz = /bits/ 64 <1100000000>; |
| 169 | opp-microvolt = <980000 1000000 1010000>; | 189 | opp-microvolt = <980000 1000000 1010000>; |
| 170 | opp-microamp = <80000>; | 190 | opp-microamp = <80000>; |
| 171 | clock-latency-ns = <310000>; | 191 | clock-latency-ns = <310000>; |
| 172 | }; | 192 | }; |
| 173 | opp02 { | 193 | opp@1200000000 { |
| 174 | opp-hz = /bits/ 64 <1200000000>; | 194 | opp-hz = /bits/ 64 <1200000000>; |
| 175 | opp-microvolt = <1025000>; | 195 | opp-microvolt = <1025000>; |
| 176 | clock-latency-ns = <290000>; | 196 | clock-latency-ns = <290000>; |
| @@ -236,20 +256,20 @@ independently. | |||
| 236 | * independently. | 256 | * independently. |
| 237 | */ | 257 | */ |
| 238 | 258 | ||
| 239 | opp00 { | 259 | opp@1000000000 { |
| 240 | opp-hz = /bits/ 64 <1000000000>; | 260 | opp-hz = /bits/ 64 <1000000000>; |
| 241 | opp-microvolt = <970000 975000 985000>; | 261 | opp-microvolt = <970000 975000 985000>; |
| 242 | opp-microamp = <70000>; | 262 | opp-microamp = <70000>; |
| 243 | clock-latency-ns = <300000>; | 263 | clock-latency-ns = <300000>; |
| 244 | opp-suspend; | 264 | opp-suspend; |
| 245 | }; | 265 | }; |
| 246 | opp01 { | 266 | opp@1100000000 { |
| 247 | opp-hz = /bits/ 64 <1100000000>; | 267 | opp-hz = /bits/ 64 <1100000000>; |
| 248 | opp-microvolt = <980000 1000000 1010000>; | 268 | opp-microvolt = <980000 1000000 1010000>; |
| 249 | opp-microamp = <80000>; | 269 | opp-microamp = <80000>; |
| 250 | clock-latency-ns = <310000>; | 270 | clock-latency-ns = <310000>; |
| 251 | }; | 271 | }; |
| 252 | opp02 { | 272 | opp@1200000000 { |
| 253 | opp-hz = /bits/ 64 <1200000000>; | 273 | opp-hz = /bits/ 64 <1200000000>; |
| 254 | opp-microvolt = <1025000>; | 274 | opp-microvolt = <1025000>; |
| 255 | opp-microamp = <90000; | 275 | opp-microamp = <90000; |
| @@ -312,20 +332,20 @@ DVFS state together. | |||
| 312 | compatible = "operating-points-v2"; | 332 | compatible = "operating-points-v2"; |
| 313 | opp-shared; | 333 | opp-shared; |
| 314 | 334 | ||
| 315 | opp00 { | 335 | opp@1000000000 { |
| 316 | opp-hz = /bits/ 64 <1000000000>; | 336 | opp-hz = /bits/ 64 <1000000000>; |
| 317 | opp-microvolt = <970000 975000 985000>; | 337 | opp-microvolt = <970000 975000 985000>; |
| 318 | opp-microamp = <70000>; | 338 | opp-microamp = <70000>; |
| 319 | clock-latency-ns = <300000>; | 339 | clock-latency-ns = <300000>; |
| 320 | opp-suspend; | 340 | opp-suspend; |
| 321 | }; | 341 | }; |
| 322 | opp01 { | 342 | opp@1100000000 { |
| 323 | opp-hz = /bits/ 64 <1100000000>; | 343 | opp-hz = /bits/ 64 <1100000000>; |
| 324 | opp-microvolt = <980000 1000000 1010000>; | 344 | opp-microvolt = <980000 1000000 1010000>; |
| 325 | opp-microamp = <80000>; | 345 | opp-microamp = <80000>; |
| 326 | clock-latency-ns = <310000>; | 346 | clock-latency-ns = <310000>; |
| 327 | }; | 347 | }; |
| 328 | opp02 { | 348 | opp@1200000000 { |
| 329 | opp-hz = /bits/ 64 <1200000000>; | 349 | opp-hz = /bits/ 64 <1200000000>; |
| 330 | opp-microvolt = <1025000>; | 350 | opp-microvolt = <1025000>; |
| 331 | opp-microamp = <90000>; | 351 | opp-microamp = <90000>; |
| @@ -338,20 +358,20 @@ DVFS state together. | |||
| 338 | compatible = "operating-points-v2"; | 358 | compatible = "operating-points-v2"; |
| 339 | opp-shared; | 359 | opp-shared; |
| 340 | 360 | ||
| 341 | opp10 { | 361 | opp@1300000000 { |
| 342 | opp-hz = /bits/ 64 <1300000000>; | 362 | opp-hz = /bits/ 64 <1300000000>; |
| 343 | opp-microvolt = <1045000 1050000 1055000>; | 363 | opp-microvolt = <1045000 1050000 1055000>; |
| 344 | opp-microamp = <95000>; | 364 | opp-microamp = <95000>; |
| 345 | clock-latency-ns = <400000>; | 365 | clock-latency-ns = <400000>; |
| 346 | opp-suspend; | 366 | opp-suspend; |
| 347 | }; | 367 | }; |
| 348 | opp11 { | 368 | opp@1400000000 { |
| 349 | opp-hz = /bits/ 64 <1400000000>; | 369 | opp-hz = /bits/ 64 <1400000000>; |
| 350 | opp-microvolt = <1075000>; | 370 | opp-microvolt = <1075000>; |
| 351 | opp-microamp = <100000>; | 371 | opp-microamp = <100000>; |
| 352 | clock-latency-ns = <400000>; | 372 | clock-latency-ns = <400000>; |
| 353 | }; | 373 | }; |
| 354 | opp12 { | 374 | opp@1500000000 { |
| 355 | opp-hz = /bits/ 64 <1500000000>; | 375 | opp-hz = /bits/ 64 <1500000000>; |
| 356 | opp-microvolt = <1010000 1100000 1110000>; | 376 | opp-microvolt = <1010000 1100000 1110000>; |
| 357 | opp-microamp = <95000>; | 377 | opp-microamp = <95000>; |
| @@ -378,7 +398,7 @@ Example 4: Handling multiple regulators | |||
| 378 | compatible = "operating-points-v2"; | 398 | compatible = "operating-points-v2"; |
| 379 | opp-shared; | 399 | opp-shared; |
| 380 | 400 | ||
| 381 | opp00 { | 401 | opp@1000000000 { |
| 382 | opp-hz = /bits/ 64 <1000000000>; | 402 | opp-hz = /bits/ 64 <1000000000>; |
| 383 | opp-microvolt = <970000>, /* Supply 0 */ | 403 | opp-microvolt = <970000>, /* Supply 0 */ |
| 384 | <960000>, /* Supply 1 */ | 404 | <960000>, /* Supply 1 */ |
| @@ -391,7 +411,7 @@ Example 4: Handling multiple regulators | |||
| 391 | 411 | ||
| 392 | /* OR */ | 412 | /* OR */ |
| 393 | 413 | ||
| 394 | opp00 { | 414 | opp@1000000000 { |
| 395 | opp-hz = /bits/ 64 <1000000000>; | 415 | opp-hz = /bits/ 64 <1000000000>; |
| 396 | opp-microvolt = <970000 975000 985000>, /* Supply 0 */ | 416 | opp-microvolt = <970000 975000 985000>, /* Supply 0 */ |
| 397 | <960000 965000 975000>, /* Supply 1 */ | 417 | <960000 965000 975000>, /* Supply 1 */ |
| @@ -404,7 +424,7 @@ Example 4: Handling multiple regulators | |||
| 404 | 424 | ||
| 405 | /* OR */ | 425 | /* OR */ |
| 406 | 426 | ||
| 407 | opp00 { | 427 | opp@1000000000 { |
| 408 | opp-hz = /bits/ 64 <1000000000>; | 428 | opp-hz = /bits/ 64 <1000000000>; |
| 409 | opp-microvolt = <970000 975000 985000>, /* Supply 0 */ | 429 | opp-microvolt = <970000 975000 985000>, /* Supply 0 */ |
| 410 | <960000 965000 975000>, /* Supply 1 */ | 430 | <960000 965000 975000>, /* Supply 1 */ |
| @@ -417,7 +437,8 @@ Example 4: Handling multiple regulators | |||
| 417 | }; | 437 | }; |
| 418 | }; | 438 | }; |
| 419 | 439 | ||
| 420 | Example 5: Multiple OPP tables | 440 | Example 5: opp-supported-hw |
| 441 | (example: three level hierarchy of versions: cuts, substrate and process) | ||
| 421 | 442 | ||
| 422 | / { | 443 | / { |
| 423 | cpus { | 444 | cpus { |
| @@ -426,40 +447,73 @@ Example 5: Multiple OPP tables | |||
| 426 | ... | 447 | ... |
| 427 | 448 | ||
| 428 | cpu-supply = <&cpu_supply> | 449 | cpu-supply = <&cpu_supply> |
| 429 | operating-points-v2 = <&cpu0_opp_table_slow>, <&cpu0_opp_table_fast>; | 450 | operating-points-v2 = <&cpu0_opp_table_slow>; |
| 430 | operating-points-names = "slow", "fast"; | ||
| 431 | }; | 451 | }; |
| 432 | }; | 452 | }; |
| 433 | 453 | ||
| 434 | cpu0_opp_table_slow: opp_table_slow { | 454 | opp_table { |
| 435 | compatible = "operating-points-v2"; | 455 | compatible = "operating-points-v2"; |
| 436 | status = "okay"; | 456 | status = "okay"; |
| 437 | opp-shared; | 457 | opp-shared; |
| 438 | 458 | ||
| 439 | opp00 { | 459 | opp@600000000 { |
| 460 | /* | ||
| 461 | * Supports all substrate and process versions for 0xF | ||
| 462 | * cuts, i.e. only first four cuts. | ||
| 463 | */ | ||
| 464 | opp-supported-hw = <0xF 0xFFFFFFFF 0xFFFFFFFF> | ||
| 440 | opp-hz = /bits/ 64 <600000000>; | 465 | opp-hz = /bits/ 64 <600000000>; |
| 466 | opp-microvolt = <900000 915000 925000>; | ||
| 441 | ... | 467 | ... |
| 442 | }; | 468 | }; |
| 443 | 469 | ||
| 444 | opp01 { | 470 | opp@800000000 { |
| 471 | /* | ||
| 472 | * Supports: | ||
| 473 | * - cuts: only one, 6th cut (represented by 6th bit). | ||
| 474 | * - substrate: supports 16 different substrate versions | ||
| 475 | * - process: supports 9 different process versions | ||
| 476 | */ | ||
| 477 | opp-supported-hw = <0x20 0xff0000ff 0x0000f4f0> | ||
| 445 | opp-hz = /bits/ 64 <800000000>; | 478 | opp-hz = /bits/ 64 <800000000>; |
| 479 | opp-microvolt = <900000 915000 925000>; | ||
| 446 | ... | 480 | ... |
| 447 | }; | 481 | }; |
| 448 | }; | 482 | }; |
| 483 | }; | ||
| 484 | |||
| 485 | Example 6: opp-microvolt-<name>, opp-microamp-<name>: | ||
| 486 | (example: device with two possible microvolt ranges: slow and fast) | ||
| 449 | 487 | ||
| 450 | cpu0_opp_table_fast: opp_table_fast { | 488 | / { |
| 489 | cpus { | ||
| 490 | cpu@0 { | ||
| 491 | compatible = "arm,cortex-a7"; | ||
| 492 | ... | ||
| 493 | |||
| 494 | operating-points-v2 = <&cpu0_opp_table>; | ||
| 495 | }; | ||
| 496 | }; | ||
| 497 | |||
| 498 | cpu0_opp_table: opp_table0 { | ||
| 451 | compatible = "operating-points-v2"; | 499 | compatible = "operating-points-v2"; |
| 452 | status = "okay"; | ||
| 453 | opp-shared; | 500 | opp-shared; |
| 454 | 501 | ||
| 455 | opp10 { | 502 | opp@1000000000 { |
| 456 | opp-hz = /bits/ 64 <1000000000>; | 503 | opp-hz = /bits/ 64 <1000000000>; |
| 457 | ... | 504 | opp-microvolt-slow = <900000 915000 925000>; |
| 505 | opp-microvolt-fast = <970000 975000 985000>; | ||
| 506 | opp-microamp-slow = <70000>; | ||
| 507 | opp-microamp-fast = <71000>; | ||
| 458 | }; | 508 | }; |
| 459 | 509 | ||
| 460 | opp11 { | 510 | opp@1200000000 { |
| 461 | opp-hz = /bits/ 64 <1100000000>; | 511 | opp-hz = /bits/ 64 <1200000000>; |
| 462 | ... | 512 | opp-microvolt-slow = <900000 915000 925000>, /* Supply vcc0 */ |
| 513 | <910000 925000 935000>; /* Supply vcc1 */ | ||
| 514 | opp-microvolt-fast = <970000 975000 985000>, /* Supply vcc0 */ | ||
| 515 | <960000 965000 975000>; /* Supply vcc1 */ | ||
| 516 | opp-microamp = <70000>; /* Will be used for both slow/fast */ | ||
| 463 | }; | 517 | }; |
| 464 | }; | 518 | }; |
| 465 | }; | 519 | }; |
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt index b0e911e0e8f5..44558882aa60 100644 --- a/Documentation/power/pci.txt +++ b/Documentation/power/pci.txt | |||
| @@ -999,7 +999,7 @@ from its probe routine to make runtime PM work for the device. | |||
| 999 | 999 | ||
| 1000 | It is important to remember that the driver's runtime_suspend() callback | 1000 | It is important to remember that the driver's runtime_suspend() callback |
| 1001 | may be executed right after the usage counter has been decremented, because | 1001 | may be executed right after the usage counter has been decremented, because |
| 1002 | user space may already have cuased the pm_runtime_allow() helper function | 1002 | user space may already have caused the pm_runtime_allow() helper function |
| 1003 | unblocking the runtime PM of the device to run via sysfs, so the driver must | 1003 | unblocking the runtime PM of the device to run via sysfs, so the driver must |
| 1004 | be prepared to cope with that. | 1004 | be prepared to cope with that. |
| 1005 | 1005 | ||
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 0784bc3a2ab5..7328cf85236c 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
| @@ -371,6 +371,12 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
| 371 | - increment the device's usage counter, run pm_runtime_resume(dev) and | 371 | - increment the device's usage counter, run pm_runtime_resume(dev) and |
| 372 | return its result | 372 | return its result |
| 373 | 373 | ||
| 374 | int pm_runtime_get_if_in_use(struct device *dev); | ||
| 375 | - return -EINVAL if 'power.disable_depth' is nonzero; otherwise, if the | ||
| 376 | runtime PM status is RPM_ACTIVE and the runtime PM usage counter is | ||
| 377 | nonzero, increment the counter and return 1; otherwise return 0 without | ||
| 378 | changing the counter | ||
| 379 | |||
| 374 | void pm_runtime_put_noidle(struct device *dev); | 380 | void pm_runtime_put_noidle(struct device *dev); |
| 375 | - decrement the device's usage counter | 381 | - decrement the device's usage counter |
| 376 | 382 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 14ef6ec44ef9..ded96408efe6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -8466,6 +8466,17 @@ F: fs/timerfd.c | |||
| 8466 | F: include/linux/timer* | 8466 | F: include/linux/timer* |
| 8467 | F: kernel/time/*timer* | 8467 | F: kernel/time/*timer* |
| 8468 | 8468 | ||
| 8469 | POWER MANAGEMENT CORE | ||
| 8470 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> | ||
| 8471 | L: linux-pm@vger.kernel.org | ||
| 8472 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm | ||
| 8473 | S: Supported | ||
| 8474 | F: drivers/base/power/ | ||
| 8475 | F: include/linux/pm.h | ||
| 8476 | F: include/linux/pm_* | ||
| 8477 | F: include/linux/powercap.h | ||
| 8478 | F: drivers/powercap/ | ||
| 8479 | |||
| 8469 | POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS | 8480 | POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS |
| 8470 | M: Sebastian Reichel <sre@kernel.org> | 8481 | M: Sebastian Reichel <sre@kernel.org> |
| 8471 | M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 8482 | M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi index 294cfe40388d..40beede46e55 100644 --- a/arch/arm/boot/dts/exynos4412.dtsi +++ b/arch/arm/boot/dts/exynos4412.dtsi | |||
| @@ -64,73 +64,73 @@ | |||
| 64 | compatible = "operating-points-v2"; | 64 | compatible = "operating-points-v2"; |
| 65 | opp-shared; | 65 | opp-shared; |
| 66 | 66 | ||
| 67 | opp00 { | 67 | opp@200000000 { |
| 68 | opp-hz = /bits/ 64 <200000000>; | 68 | opp-hz = /bits/ 64 <200000000>; |
| 69 | opp-microvolt = <900000>; | 69 | opp-microvolt = <900000>; |
| 70 | clock-latency-ns = <200000>; | 70 | clock-latency-ns = <200000>; |
| 71 | }; | 71 | }; |
| 72 | opp01 { | 72 | opp@300000000 { |
| 73 | opp-hz = /bits/ 64 <300000000>; | 73 | opp-hz = /bits/ 64 <300000000>; |
| 74 | opp-microvolt = <900000>; | 74 | opp-microvolt = <900000>; |
| 75 | clock-latency-ns = <200000>; | 75 | clock-latency-ns = <200000>; |
| 76 | }; | 76 | }; |
| 77 | opp02 { | 77 | opp@400000000 { |
| 78 | opp-hz = /bits/ 64 <400000000>; | 78 | opp-hz = /bits/ 64 <400000000>; |
| 79 | opp-microvolt = <925000>; | 79 | opp-microvolt = <925000>; |
| 80 | clock-latency-ns = <200000>; | 80 | clock-latency-ns = <200000>; |
| 81 | }; | 81 | }; |
| 82 | opp03 { | 82 | opp@500000000 { |
| 83 | opp-hz = /bits/ 64 <500000000>; | 83 | opp-hz = /bits/ 64 <500000000>; |
| 84 | opp-microvolt = <950000>; | 84 | opp-microvolt = <950000>; |
| 85 | clock-latency-ns = <200000>; | 85 | clock-latency-ns = <200000>; |
| 86 | }; | 86 | }; |
| 87 | opp04 { | 87 | opp@600000000 { |
| 88 | opp-hz = /bits/ 64 <600000000>; | 88 | opp-hz = /bits/ 64 <600000000>; |
| 89 | opp-microvolt = <975000>; | 89 | opp-microvolt = <975000>; |
| 90 | clock-latency-ns = <200000>; | 90 | clock-latency-ns = <200000>; |
| 91 | }; | 91 | }; |
| 92 | opp05 { | 92 | opp@700000000 { |
| 93 | opp-hz = /bits/ 64 <700000000>; | 93 | opp-hz = /bits/ 64 <700000000>; |
| 94 | opp-microvolt = <987500>; | 94 | opp-microvolt = <987500>; |
| 95 | clock-latency-ns = <200000>; | 95 | clock-latency-ns = <200000>; |
| 96 | }; | 96 | }; |
| 97 | opp06 { | 97 | opp@800000000 { |
| 98 | opp-hz = /bits/ 64 <800000000>; | 98 | opp-hz = /bits/ 64 <800000000>; |
| 99 | opp-microvolt = <1000000>; | 99 | opp-microvolt = <1000000>; |
| 100 | clock-latency-ns = <200000>; | 100 | clock-latency-ns = <200000>; |
| 101 | opp-suspend; | 101 | opp-suspend; |
| 102 | }; | 102 | }; |
| 103 | opp07 { | 103 | opp@900000000 { |
| 104 | opp-hz = /bits/ 64 <900000000>; | 104 | opp-hz = /bits/ 64 <900000000>; |
| 105 | opp-microvolt = <1037500>; | 105 | opp-microvolt = <1037500>; |
| 106 | clock-latency-ns = <200000>; | 106 | clock-latency-ns = <200000>; |
| 107 | }; | 107 | }; |
| 108 | opp08 { | 108 | opp@1000000000 { |
| 109 | opp-hz = /bits/ 64 <1000000000>; | 109 | opp-hz = /bits/ 64 <1000000000>; |
| 110 | opp-microvolt = <1087500>; | 110 | opp-microvolt = <1087500>; |
| 111 | clock-latency-ns = <200000>; | 111 | clock-latency-ns = <200000>; |
| 112 | }; | 112 | }; |
| 113 | opp09 { | 113 | opp@1100000000 { |
| 114 | opp-hz = /bits/ 64 <1100000000>; | 114 | opp-hz = /bits/ 64 <1100000000>; |
| 115 | opp-microvolt = <1137500>; | 115 | opp-microvolt = <1137500>; |
| 116 | clock-latency-ns = <200000>; | 116 | clock-latency-ns = <200000>; |
| 117 | }; | 117 | }; |
| 118 | opp10 { | 118 | opp@1200000000 { |
| 119 | opp-hz = /bits/ 64 <1200000000>; | 119 | opp-hz = /bits/ 64 <1200000000>; |
| 120 | opp-microvolt = <1187500>; | 120 | opp-microvolt = <1187500>; |
| 121 | clock-latency-ns = <200000>; | 121 | clock-latency-ns = <200000>; |
| 122 | }; | 122 | }; |
| 123 | opp11 { | 123 | opp@1300000000 { |
| 124 | opp-hz = /bits/ 64 <1300000000>; | 124 | opp-hz = /bits/ 64 <1300000000>; |
| 125 | opp-microvolt = <1250000>; | 125 | opp-microvolt = <1250000>; |
| 126 | clock-latency-ns = <200000>; | 126 | clock-latency-ns = <200000>; |
| 127 | }; | 127 | }; |
| 128 | opp12 { | 128 | opp@1400000000 { |
| 129 | opp-hz = /bits/ 64 <1400000000>; | 129 | opp-hz = /bits/ 64 <1400000000>; |
| 130 | opp-microvolt = <1287500>; | 130 | opp-microvolt = <1287500>; |
| 131 | clock-latency-ns = <200000>; | 131 | clock-latency-ns = <200000>; |
| 132 | }; | 132 | }; |
| 133 | opp13 { | 133 | opp@1500000000 { |
| 134 | opp-hz = /bits/ 64 <1500000000>; | 134 | opp-hz = /bits/ 64 <1500000000>; |
| 135 | opp-microvolt = <1350000>; | 135 | opp-microvolt = <1350000>; |
| 136 | clock-latency-ns = <200000>; | 136 | clock-latency-ns = <200000>; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 258965d56beb..ccfededfe470 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -534,9 +534,10 @@ config X86_INTEL_QUARK | |||
| 534 | 534 | ||
| 535 | config X86_INTEL_LPSS | 535 | config X86_INTEL_LPSS |
| 536 | bool "Intel Low Power Subsystem Support" | 536 | bool "Intel Low Power Subsystem Support" |
| 537 | depends on ACPI | 537 | depends on X86 && ACPI |
| 538 | select COMMON_CLK | 538 | select COMMON_CLK |
| 539 | select PINCTRL | 539 | select PINCTRL |
| 540 | select IOSF_MBI | ||
| 540 | ---help--- | 541 | ---help--- |
| 541 | Select to build support for Intel Low Power Subsystem such as | 542 | Select to build support for Intel Low Power Subsystem such as |
| 542 | found on Intel Lynxpoint PCH. Selecting this option enables | 543 | found on Intel Lynxpoint PCH. Selecting this option enables |
diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h index b72ad0faa6c5..b41ee164930a 100644 --- a/arch/x86/include/asm/iosf_mbi.h +++ b/arch/x86/include/asm/iosf_mbi.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * iosf_mbi.h: Intel OnChip System Fabric MailBox access support | 2 | * Intel OnChip System Fabric MailBox access support |
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | #ifndef IOSF_MBI_SYMS_H | 5 | #ifndef IOSF_MBI_SYMS_H |
| @@ -16,6 +16,18 @@ | |||
| 16 | #define MBI_MASK_LO 0x000000FF | 16 | #define MBI_MASK_LO 0x000000FF |
| 17 | #define MBI_ENABLE 0xF0 | 17 | #define MBI_ENABLE 0xF0 |
| 18 | 18 | ||
| 19 | /* IOSF SB read/write opcodes */ | ||
| 20 | #define MBI_MMIO_READ 0x00 | ||
| 21 | #define MBI_MMIO_WRITE 0x01 | ||
| 22 | #define MBI_CFG_READ 0x04 | ||
| 23 | #define MBI_CFG_WRITE 0x05 | ||
| 24 | #define MBI_CR_READ 0x06 | ||
| 25 | #define MBI_CR_WRITE 0x07 | ||
| 26 | #define MBI_REG_READ 0x10 | ||
| 27 | #define MBI_REG_WRITE 0x11 | ||
| 28 | #define MBI_ESRAM_READ 0x12 | ||
| 29 | #define MBI_ESRAM_WRITE 0x13 | ||
| 30 | |||
| 19 | /* Baytrail available units */ | 31 | /* Baytrail available units */ |
| 20 | #define BT_MBI_UNIT_AUNIT 0x00 | 32 | #define BT_MBI_UNIT_AUNIT 0x00 |
| 21 | #define BT_MBI_UNIT_SMC 0x01 | 33 | #define BT_MBI_UNIT_SMC 0x01 |
| @@ -28,50 +40,13 @@ | |||
| 28 | #define BT_MBI_UNIT_SATA 0xA3 | 40 | #define BT_MBI_UNIT_SATA 0xA3 |
| 29 | #define BT_MBI_UNIT_PCIE 0xA6 | 41 | #define BT_MBI_UNIT_PCIE 0xA6 |
| 30 | 42 | ||
| 31 | /* Baytrail read/write opcodes */ | ||
| 32 | #define BT_MBI_AUNIT_READ 0x10 | ||
| 33 | #define BT_MBI_AUNIT_WRITE 0x11 | ||
| 34 | #define BT_MBI_SMC_READ 0x10 | ||
| 35 | #define BT_MBI_SMC_WRITE 0x11 | ||
| 36 | #define BT_MBI_CPU_READ 0x10 | ||
| 37 | #define BT_MBI_CPU_WRITE 0x11 | ||
| 38 | #define BT_MBI_BUNIT_READ 0x10 | ||
| 39 | #define BT_MBI_BUNIT_WRITE 0x11 | ||
| 40 | #define BT_MBI_PMC_READ 0x06 | ||
| 41 | #define BT_MBI_PMC_WRITE 0x07 | ||
| 42 | #define BT_MBI_GFX_READ 0x00 | ||
| 43 | #define BT_MBI_GFX_WRITE 0x01 | ||
| 44 | #define BT_MBI_SMIO_READ 0x06 | ||
| 45 | #define BT_MBI_SMIO_WRITE 0x07 | ||
| 46 | #define BT_MBI_USB_READ 0x06 | ||
| 47 | #define BT_MBI_USB_WRITE 0x07 | ||
| 48 | #define BT_MBI_SATA_READ 0x00 | ||
| 49 | #define BT_MBI_SATA_WRITE 0x01 | ||
| 50 | #define BT_MBI_PCIE_READ 0x00 | ||
| 51 | #define BT_MBI_PCIE_WRITE 0x01 | ||
| 52 | |||
| 53 | /* Quark available units */ | 43 | /* Quark available units */ |
| 54 | #define QRK_MBI_UNIT_HBA 0x00 | 44 | #define QRK_MBI_UNIT_HBA 0x00 |
| 55 | #define QRK_MBI_UNIT_HB 0x03 | 45 | #define QRK_MBI_UNIT_HB 0x03 |
| 56 | #define QRK_MBI_UNIT_RMU 0x04 | 46 | #define QRK_MBI_UNIT_RMU 0x04 |
| 57 | #define QRK_MBI_UNIT_MM 0x05 | 47 | #define QRK_MBI_UNIT_MM 0x05 |
| 58 | #define QRK_MBI_UNIT_MMESRAM 0x05 | ||
| 59 | #define QRK_MBI_UNIT_SOC 0x31 | 48 | #define QRK_MBI_UNIT_SOC 0x31 |
| 60 | 49 | ||
| 61 | /* Quark read/write opcodes */ | ||
| 62 | #define QRK_MBI_HBA_READ 0x10 | ||
| 63 | #define QRK_MBI_HBA_WRITE 0x11 | ||
| 64 | #define QRK_MBI_HB_READ 0x10 | ||
| 65 | #define QRK_MBI_HB_WRITE 0x11 | ||
| 66 | #define QRK_MBI_RMU_READ 0x10 | ||
| 67 | #define QRK_MBI_RMU_WRITE 0x11 | ||
| 68 | #define QRK_MBI_MM_READ 0x10 | ||
| 69 | #define QRK_MBI_MM_WRITE 0x11 | ||
| 70 | #define QRK_MBI_MMESRAM_READ 0x12 | ||
| 71 | #define QRK_MBI_MMESRAM_WRITE 0x13 | ||
| 72 | #define QRK_MBI_SOC_READ 0x06 | ||
| 73 | #define QRK_MBI_SOC_WRITE 0x07 | ||
| 74 | |||
| 75 | #if IS_ENABLED(CONFIG_IOSF_MBI) | 50 | #if IS_ENABLED(CONFIG_IOSF_MBI) |
| 76 | 51 | ||
| 77 | bool iosf_mbi_available(void); | 52 | bool iosf_mbi_available(void); |
diff --git a/arch/x86/platform/atom/punit_atom_debug.c b/arch/x86/platform/atom/punit_atom_debug.c index 5ca8ead91579..81c769e80614 100644 --- a/arch/x86/platform/atom/punit_atom_debug.c +++ b/arch/x86/platform/atom/punit_atom_debug.c | |||
| @@ -25,8 +25,6 @@ | |||
| 25 | #include <asm/cpu_device_id.h> | 25 | #include <asm/cpu_device_id.h> |
| 26 | #include <asm/iosf_mbi.h> | 26 | #include <asm/iosf_mbi.h> |
| 27 | 27 | ||
| 28 | /* Side band Interface port */ | ||
| 29 | #define PUNIT_PORT 0x04 | ||
| 30 | /* Power gate status reg */ | 28 | /* Power gate status reg */ |
| 31 | #define PWRGT_STATUS 0x61 | 29 | #define PWRGT_STATUS 0x61 |
| 32 | /* Subsystem config/status Video processor */ | 30 | /* Subsystem config/status Video processor */ |
| @@ -85,9 +83,8 @@ static int punit_dev_state_show(struct seq_file *seq_file, void *unused) | |||
| 85 | 83 | ||
| 86 | seq_puts(seq_file, "\n\nPUNIT NORTH COMPLEX DEVICES :\n"); | 84 | seq_puts(seq_file, "\n\nPUNIT NORTH COMPLEX DEVICES :\n"); |
| 87 | while (punit_devp->name) { | 85 | while (punit_devp->name) { |
| 88 | status = iosf_mbi_read(PUNIT_PORT, BT_MBI_PMC_READ, | 86 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 89 | punit_devp->reg, | 87 | punit_devp->reg, &punit_pwr_status); |
| 90 | &punit_pwr_status); | ||
| 91 | if (status) { | 88 | if (status) { |
| 92 | seq_printf(seq_file, "%9s : Read Failed\n", | 89 | seq_printf(seq_file, "%9s : Read Failed\n", |
| 93 | punit_devp->name); | 90 | punit_devp->name); |
diff --git a/arch/x86/platform/intel-quark/imr.c b/arch/x86/platform/intel-quark/imr.c index 0ee619f9fcb7..c1bdafaac3ca 100644 --- a/arch/x86/platform/intel-quark/imr.c +++ b/arch/x86/platform/intel-quark/imr.c | |||
| @@ -111,23 +111,19 @@ static int imr_read(struct imr_device *idev, u32 imr_id, struct imr_regs *imr) | |||
| 111 | u32 reg = imr_id * IMR_NUM_REGS + idev->reg_base; | 111 | u32 reg = imr_id * IMR_NUM_REGS + idev->reg_base; |
| 112 | int ret; | 112 | int ret; |
| 113 | 113 | ||
| 114 | ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ, | 114 | ret = iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->addr_lo); |
| 115 | reg++, &imr->addr_lo); | ||
| 116 | if (ret) | 115 | if (ret) |
| 117 | return ret; | 116 | return ret; |
| 118 | 117 | ||
| 119 | ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ, | 118 | ret = iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->addr_hi); |
| 120 | reg++, &imr->addr_hi); | ||
| 121 | if (ret) | 119 | if (ret) |
| 122 | return ret; | 120 | return ret; |
| 123 | 121 | ||
| 124 | ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ, | 122 | ret = iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->rmask); |
| 125 | reg++, &imr->rmask); | ||
| 126 | if (ret) | 123 | if (ret) |
| 127 | return ret; | 124 | return ret; |
| 128 | 125 | ||
| 129 | return iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ, | 126 | return iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->wmask); |
| 130 | reg++, &imr->wmask); | ||
| 131 | } | 127 | } |
| 132 | 128 | ||
| 133 | /** | 129 | /** |
| @@ -151,31 +147,27 @@ static int imr_write(struct imr_device *idev, u32 imr_id, | |||
| 151 | 147 | ||
| 152 | local_irq_save(flags); | 148 | local_irq_save(flags); |
| 153 | 149 | ||
| 154 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, reg++, | 150 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->addr_lo); |
| 155 | imr->addr_lo); | ||
| 156 | if (ret) | 151 | if (ret) |
| 157 | goto failed; | 152 | goto failed; |
| 158 | 153 | ||
| 159 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, | 154 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->addr_hi); |
| 160 | reg++, imr->addr_hi); | ||
| 161 | if (ret) | 155 | if (ret) |
| 162 | goto failed; | 156 | goto failed; |
| 163 | 157 | ||
| 164 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, | 158 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->rmask); |
| 165 | reg++, imr->rmask); | ||
| 166 | if (ret) | 159 | if (ret) |
| 167 | goto failed; | 160 | goto failed; |
| 168 | 161 | ||
| 169 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, | 162 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->wmask); |
| 170 | reg++, imr->wmask); | ||
| 171 | if (ret) | 163 | if (ret) |
| 172 | goto failed; | 164 | goto failed; |
| 173 | 165 | ||
| 174 | /* Lock bit must be set separately to addr_lo address bits. */ | 166 | /* Lock bit must be set separately to addr_lo address bits. */ |
| 175 | if (lock) { | 167 | if (lock) { |
| 176 | imr->addr_lo |= IMR_LOCK; | 168 | imr->addr_lo |= IMR_LOCK; |
| 177 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, | 169 | ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, |
| 178 | reg - IMR_NUM_REGS, imr->addr_lo); | 170 | reg - IMR_NUM_REGS, imr->addr_lo); |
| 179 | if (ret) | 171 | if (ret) |
| 180 | goto failed; | 172 | goto failed; |
| 181 | } | 173 | } |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 5eef4cb4f70e..82b96ee8624c 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -58,14 +58,25 @@ config ACPI_CCA_REQUIRED | |||
| 58 | bool | 58 | bool |
| 59 | 59 | ||
| 60 | config ACPI_DEBUGGER | 60 | config ACPI_DEBUGGER |
| 61 | bool "AML debugger interface (EXPERIMENTAL)" | 61 | bool "AML debugger interface" |
| 62 | select ACPI_DEBUG | 62 | select ACPI_DEBUG |
| 63 | help | 63 | help |
| 64 | Enable in-kernel debugging of AML facilities: statistics, internal | 64 | Enable in-kernel debugging of AML facilities: statistics, |
| 65 | object dump, single step control method execution. | 65 | internal object dump, single step control method execution. |
| 66 | This is still under development, currently enabling this only | 66 | This is still under development, currently enabling this only |
| 67 | results in the compilation of the ACPICA debugger files. | 67 | results in the compilation of the ACPICA debugger files. |
| 68 | 68 | ||
| 69 | if ACPI_DEBUGGER | ||
| 70 | |||
| 71 | config ACPI_DEBUGGER_USER | ||
| 72 | tristate "Userspace debugger accessiblity" | ||
| 73 | depends on DEBUG_FS | ||
| 74 | help | ||
| 75 | Export /sys/kernel/debug/acpi/acpidbg for userspace utilities | ||
| 76 | to access the debugger functionalities. | ||
| 77 | |||
| 78 | endif | ||
| 79 | |||
| 69 | config ACPI_SLEEP | 80 | config ACPI_SLEEP |
| 70 | bool | 81 | bool |
| 71 | depends on SUSPEND || HIBERNATION | 82 | depends on SUSPEND || HIBERNATION |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 675eaf337178..cb648a49543a 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
| @@ -8,13 +8,13 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT | |||
| 8 | # | 8 | # |
| 9 | # ACPI Boot-Time Table Parsing | 9 | # ACPI Boot-Time Table Parsing |
| 10 | # | 10 | # |
| 11 | obj-y += tables.o | 11 | obj-$(CONFIG_ACPI) += tables.o |
| 12 | obj-$(CONFIG_X86) += blacklist.o | 12 | obj-$(CONFIG_X86) += blacklist.o |
| 13 | 13 | ||
| 14 | # | 14 | # |
| 15 | # ACPI Core Subsystem (Interpreter) | 15 | # ACPI Core Subsystem (Interpreter) |
| 16 | # | 16 | # |
| 17 | obj-y += acpi.o \ | 17 | obj-$(CONFIG_ACPI) += acpi.o \ |
| 18 | acpica/ | 18 | acpica/ |
| 19 | 19 | ||
| 20 | # All the builtin files are in the "acpi." module_param namespace. | 20 | # All the builtin files are in the "acpi." module_param namespace. |
| @@ -66,10 +66,10 @@ obj-$(CONFIG_ACPI_FAN) += fan.o | |||
| 66 | obj-$(CONFIG_ACPI_VIDEO) += video.o | 66 | obj-$(CONFIG_ACPI_VIDEO) += video.o |
| 67 | obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o | 67 | obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o |
| 68 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | 68 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o |
| 69 | obj-y += container.o | 69 | obj-$(CONFIG_ACPI) += container.o |
| 70 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o | 70 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o |
| 71 | obj-$(CONFIG_ACPI_NFIT) += nfit.o | 71 | obj-$(CONFIG_ACPI_NFIT) += nfit.o |
| 72 | obj-y += acpi_memhotplug.o | 72 | obj-$(CONFIG_ACPI) += acpi_memhotplug.o |
| 73 | obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o | 73 | obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o |
| 74 | obj-$(CONFIG_ACPI_BATTERY) += battery.o | 74 | obj-$(CONFIG_ACPI_BATTERY) += battery.o |
| 75 | obj-$(CONFIG_ACPI_SBS) += sbshc.o | 75 | obj-$(CONFIG_ACPI_SBS) += sbshc.o |
| @@ -79,6 +79,7 @@ obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o | |||
| 79 | obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o | 79 | obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o |
| 80 | obj-$(CONFIG_ACPI_BGRT) += bgrt.o | 80 | obj-$(CONFIG_ACPI_BGRT) += bgrt.o |
| 81 | obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o | 81 | obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o |
| 82 | obj-$(CONFIG_ACPI_DEBUGGER_USER) += acpi_dbg.o | ||
| 82 | 83 | ||
| 83 | # processor has its own "processor." module_param namespace | 84 | # processor has its own "processor." module_param namespace |
| 84 | processor-y := processor_driver.o | 85 | processor-y := processor_driver.o |
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index a450e7af877c..d507cf6deda0 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c | |||
| @@ -51,7 +51,7 @@ struct apd_private_data { | |||
| 51 | const struct apd_device_desc *dev_desc; | 51 | const struct apd_device_desc *dev_desc; |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE | 54 | #if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64) |
| 55 | #define APD_ADDR(desc) ((unsigned long)&desc) | 55 | #define APD_ADDR(desc) ((unsigned long)&desc) |
| 56 | 56 | ||
| 57 | static int acpi_apd_setup(struct apd_private_data *pdata) | 57 | static int acpi_apd_setup(struct apd_private_data *pdata) |
| @@ -71,6 +71,7 @@ static int acpi_apd_setup(struct apd_private_data *pdata) | |||
| 71 | return 0; | 71 | return 0; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE | ||
| 74 | static struct apd_device_desc cz_i2c_desc = { | 75 | static struct apd_device_desc cz_i2c_desc = { |
| 75 | .setup = acpi_apd_setup, | 76 | .setup = acpi_apd_setup, |
| 76 | .fixed_clk_rate = 133000000, | 77 | .fixed_clk_rate = 133000000, |
| @@ -80,6 +81,14 @@ static struct apd_device_desc cz_uart_desc = { | |||
| 80 | .setup = acpi_apd_setup, | 81 | .setup = acpi_apd_setup, |
| 81 | .fixed_clk_rate = 48000000, | 82 | .fixed_clk_rate = 48000000, |
| 82 | }; | 83 | }; |
| 84 | #endif | ||
| 85 | |||
| 86 | #ifdef CONFIG_ARM64 | ||
| 87 | static struct apd_device_desc xgene_i2c_desc = { | ||
| 88 | .setup = acpi_apd_setup, | ||
| 89 | .fixed_clk_rate = 100000000, | ||
| 90 | }; | ||
| 91 | #endif | ||
| 83 | 92 | ||
| 84 | #else | 93 | #else |
| 85 | 94 | ||
| @@ -132,9 +141,14 @@ static int acpi_apd_create_device(struct acpi_device *adev, | |||
| 132 | 141 | ||
| 133 | static const struct acpi_device_id acpi_apd_device_ids[] = { | 142 | static const struct acpi_device_id acpi_apd_device_ids[] = { |
| 134 | /* Generic apd devices */ | 143 | /* Generic apd devices */ |
| 144 | #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE | ||
| 135 | { "AMD0010", APD_ADDR(cz_i2c_desc) }, | 145 | { "AMD0010", APD_ADDR(cz_i2c_desc) }, |
| 136 | { "AMD0020", APD_ADDR(cz_uart_desc) }, | 146 | { "AMD0020", APD_ADDR(cz_uart_desc) }, |
| 137 | { "AMD0030", }, | 147 | { "AMD0030", }, |
| 148 | #endif | ||
| 149 | #ifdef CONFIG_ARM64 | ||
| 150 | { "APMC0D0F", APD_ADDR(xgene_i2c_desc) }, | ||
| 151 | #endif | ||
| 138 | { } | 152 | { } |
| 139 | }; | 153 | }; |
| 140 | 154 | ||
diff --git a/drivers/acpi/acpi_dbg.c b/drivers/acpi/acpi_dbg.c new file mode 100644 index 000000000000..15e4604efba7 --- /dev/null +++ b/drivers/acpi/acpi_dbg.c | |||
| @@ -0,0 +1,804 @@ | |||
| 1 | /* | ||
| 2 | * ACPI AML interfacing support | ||
| 3 | * | ||
| 4 | * Copyright (C) 2015, Intel Corporation | ||
| 5 | * Authors: Lv Zheng <lv.zheng@intel.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* #define DEBUG */ | ||
| 13 | #define pr_fmt(fmt) "ACPI : AML: " fmt | ||
| 14 | |||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/module.h> | ||
| 17 | #include <linux/wait.h> | ||
| 18 | #include <linux/poll.h> | ||
| 19 | #include <linux/sched.h> | ||
| 20 | #include <linux/kthread.h> | ||
| 21 | #include <linux/proc_fs.h> | ||
| 22 | #include <linux/debugfs.h> | ||
| 23 | #include <linux/circ_buf.h> | ||
| 24 | #include <linux/acpi.h> | ||
| 25 | #include "internal.h" | ||
| 26 | |||
| 27 | #define ACPI_AML_BUF_ALIGN (sizeof (acpi_size)) | ||
| 28 | #define ACPI_AML_BUF_SIZE PAGE_SIZE | ||
| 29 | |||
| 30 | #define circ_count(circ) \ | ||
| 31 | (CIRC_CNT((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 32 | #define circ_count_to_end(circ) \ | ||
| 33 | (CIRC_CNT_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 34 | #define circ_space(circ) \ | ||
| 35 | (CIRC_SPACE((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 36 | #define circ_space_to_end(circ) \ | ||
| 37 | (CIRC_SPACE_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 38 | |||
| 39 | #define ACPI_AML_OPENED 0x0001 | ||
| 40 | #define ACPI_AML_CLOSED 0x0002 | ||
| 41 | #define ACPI_AML_IN_USER 0x0004 /* user space is writing cmd */ | ||
| 42 | #define ACPI_AML_IN_KERN 0x0008 /* kernel space is reading cmd */ | ||
| 43 | #define ACPI_AML_OUT_USER 0x0010 /* user space is reading log */ | ||
| 44 | #define ACPI_AML_OUT_KERN 0x0020 /* kernel space is writing log */ | ||
| 45 | #define ACPI_AML_USER (ACPI_AML_IN_USER | ACPI_AML_OUT_USER) | ||
| 46 | #define ACPI_AML_KERN (ACPI_AML_IN_KERN | ACPI_AML_OUT_KERN) | ||
| 47 | #define ACPI_AML_BUSY (ACPI_AML_USER | ACPI_AML_KERN) | ||
| 48 | #define ACPI_AML_OPEN (ACPI_AML_OPENED | ACPI_AML_CLOSED) | ||
| 49 | |||
| 50 | struct acpi_aml_io { | ||
| 51 | wait_queue_head_t wait; | ||
| 52 | unsigned long flags; | ||
| 53 | unsigned long users; | ||
| 54 | struct mutex lock; | ||
| 55 | struct task_struct *thread; | ||
| 56 | char out_buf[ACPI_AML_BUF_SIZE] __aligned(ACPI_AML_BUF_ALIGN); | ||
| 57 | struct circ_buf out_crc; | ||
| 58 | char in_buf[ACPI_AML_BUF_SIZE] __aligned(ACPI_AML_BUF_ALIGN); | ||
| 59 | struct circ_buf in_crc; | ||
| 60 | acpi_osd_exec_callback function; | ||
| 61 | void *context; | ||
| 62 | unsigned long usages; | ||
| 63 | }; | ||
| 64 | |||
| 65 | static struct acpi_aml_io acpi_aml_io; | ||
| 66 | static bool acpi_aml_initialized; | ||
| 67 | static struct file *acpi_aml_active_reader; | ||
| 68 | static struct dentry *acpi_aml_dentry; | ||
| 69 | |||
| 70 | static inline bool __acpi_aml_running(void) | ||
| 71 | { | ||
| 72 | return acpi_aml_io.thread ? true : false; | ||
| 73 | } | ||
| 74 | |||
| 75 | static inline bool __acpi_aml_access_ok(unsigned long flag) | ||
| 76 | { | ||
| 77 | /* | ||
| 78 | * The debugger interface is in opened state (OPENED && !CLOSED), | ||
| 79 | * then it is allowed to access the debugger buffers from either | ||
| 80 | * user space or the kernel space. | ||
| 81 | * In addition, for the kernel space, only the debugger thread | ||
| 82 | * (thread ID matched) is allowed to access. | ||
| 83 | */ | ||
| 84 | if (!(acpi_aml_io.flags & ACPI_AML_OPENED) || | ||
| 85 | (acpi_aml_io.flags & ACPI_AML_CLOSED) || | ||
| 86 | !__acpi_aml_running()) | ||
| 87 | return false; | ||
| 88 | if ((flag & ACPI_AML_KERN) && | ||
| 89 | current != acpi_aml_io.thread) | ||
| 90 | return false; | ||
| 91 | return true; | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline bool __acpi_aml_readable(struct circ_buf *circ, unsigned long flag) | ||
| 95 | { | ||
| 96 | /* | ||
| 97 | * Another read is not in progress and there is data in buffer | ||
| 98 | * available for read. | ||
| 99 | */ | ||
| 100 | if (!(acpi_aml_io.flags & flag) && circ_count(circ)) | ||
| 101 | return true; | ||
| 102 | return false; | ||
| 103 | } | ||
| 104 | |||
| 105 | static inline bool __acpi_aml_writable(struct circ_buf *circ, unsigned long flag) | ||
| 106 | { | ||
| 107 | /* | ||
| 108 | * Another write is not in progress and there is buffer space | ||
| 109 | * available for write. | ||
| 110 | */ | ||
| 111 | if (!(acpi_aml_io.flags & flag) && circ_space(circ)) | ||
| 112 | return true; | ||
| 113 | return false; | ||
| 114 | } | ||
| 115 | |||
| 116 | static inline bool __acpi_aml_busy(void) | ||
| 117 | { | ||
| 118 | if (acpi_aml_io.flags & ACPI_AML_BUSY) | ||
| 119 | return true; | ||
| 120 | return false; | ||
| 121 | } | ||
| 122 | |||
| 123 | static inline bool __acpi_aml_opened(void) | ||
| 124 | { | ||
| 125 | if (acpi_aml_io.flags & ACPI_AML_OPEN) | ||
| 126 | return true; | ||
| 127 | return false; | ||
| 128 | } | ||
| 129 | |||
| 130 | static inline bool __acpi_aml_used(void) | ||
| 131 | { | ||
| 132 | return acpi_aml_io.usages ? true : false; | ||
| 133 | } | ||
| 134 | |||
| 135 | static inline bool acpi_aml_running(void) | ||
| 136 | { | ||
| 137 | bool ret; | ||
| 138 | |||
| 139 | mutex_lock(&acpi_aml_io.lock); | ||
| 140 | ret = __acpi_aml_running(); | ||
| 141 | mutex_unlock(&acpi_aml_io.lock); | ||
| 142 | return ret; | ||
| 143 | } | ||
| 144 | |||
| 145 | static bool acpi_aml_busy(void) | ||
| 146 | { | ||
| 147 | bool ret; | ||
| 148 | |||
| 149 | mutex_lock(&acpi_aml_io.lock); | ||
| 150 | ret = __acpi_aml_busy(); | ||
| 151 | mutex_unlock(&acpi_aml_io.lock); | ||
| 152 | return ret; | ||
| 153 | } | ||
| 154 | |||
| 155 | static bool acpi_aml_used(void) | ||
| 156 | { | ||
| 157 | bool ret; | ||
| 158 | |||
| 159 | /* | ||
| 160 | * The usage count is prepared to avoid race conditions between the | ||
| 161 | * starts and the stops of the debugger thread. | ||
| 162 | */ | ||
| 163 | mutex_lock(&acpi_aml_io.lock); | ||
| 164 | ret = __acpi_aml_used(); | ||
| 165 | mutex_unlock(&acpi_aml_io.lock); | ||
| 166 | return ret; | ||
| 167 | } | ||
| 168 | |||
| 169 | static bool acpi_aml_kern_readable(void) | ||
| 170 | { | ||
| 171 | bool ret; | ||
| 172 | |||
| 173 | mutex_lock(&acpi_aml_io.lock); | ||
| 174 | ret = !__acpi_aml_access_ok(ACPI_AML_IN_KERN) || | ||
| 175 | __acpi_aml_readable(&acpi_aml_io.in_crc, ACPI_AML_IN_KERN); | ||
| 176 | mutex_unlock(&acpi_aml_io.lock); | ||
| 177 | return ret; | ||
| 178 | } | ||
| 179 | |||
| 180 | static bool acpi_aml_kern_writable(void) | ||
| 181 | { | ||
| 182 | bool ret; | ||
| 183 | |||
| 184 | mutex_lock(&acpi_aml_io.lock); | ||
| 185 | ret = !__acpi_aml_access_ok(ACPI_AML_OUT_KERN) || | ||
| 186 | __acpi_aml_writable(&acpi_aml_io.out_crc, ACPI_AML_OUT_KERN); | ||
| 187 | mutex_unlock(&acpi_aml_io.lock); | ||
| 188 | return ret; | ||
| 189 | } | ||
| 190 | |||
| 191 | static bool acpi_aml_user_readable(void) | ||
| 192 | { | ||
| 193 | bool ret; | ||
| 194 | |||
| 195 | mutex_lock(&acpi_aml_io.lock); | ||
| 196 | ret = !__acpi_aml_access_ok(ACPI_AML_OUT_USER) || | ||
| 197 | __acpi_aml_readable(&acpi_aml_io.out_crc, ACPI_AML_OUT_USER); | ||
| 198 | mutex_unlock(&acpi_aml_io.lock); | ||
| 199 | return ret; | ||
| 200 | } | ||
| 201 | |||
| 202 | static bool acpi_aml_user_writable(void) | ||
| 203 | { | ||
| 204 | bool ret; | ||
| 205 | |||
| 206 | mutex_lock(&acpi_aml_io.lock); | ||
| 207 | ret = !__acpi_aml_access_ok(ACPI_AML_IN_USER) || | ||
| 208 | __acpi_aml_writable(&acpi_aml_io.in_crc, ACPI_AML_IN_USER); | ||
| 209 | mutex_unlock(&acpi_aml_io.lock); | ||
| 210 | return ret; | ||
| 211 | } | ||
| 212 | |||
| 213 | static int acpi_aml_lock_write(struct circ_buf *circ, unsigned long flag) | ||
| 214 | { | ||
| 215 | int ret = 0; | ||
| 216 | |||
| 217 | mutex_lock(&acpi_aml_io.lock); | ||
| 218 | if (!__acpi_aml_access_ok(flag)) { | ||
| 219 | ret = -EFAULT; | ||
| 220 | goto out; | ||
| 221 | } | ||
| 222 | if (!__acpi_aml_writable(circ, flag)) { | ||
| 223 | ret = -EAGAIN; | ||
| 224 | goto out; | ||
| 225 | } | ||
| 226 | acpi_aml_io.flags |= flag; | ||
| 227 | out: | ||
| 228 | mutex_unlock(&acpi_aml_io.lock); | ||
| 229 | return ret; | ||
| 230 | } | ||
| 231 | |||
| 232 | static int acpi_aml_lock_read(struct circ_buf *circ, unsigned long flag) | ||
| 233 | { | ||
| 234 | int ret = 0; | ||
| 235 | |||
| 236 | mutex_lock(&acpi_aml_io.lock); | ||
| 237 | if (!__acpi_aml_access_ok(flag)) { | ||
| 238 | ret = -EFAULT; | ||
| 239 | goto out; | ||
| 240 | } | ||
| 241 | if (!__acpi_aml_readable(circ, flag)) { | ||
| 242 | ret = -EAGAIN; | ||
| 243 | goto out; | ||
| 244 | } | ||
| 245 | acpi_aml_io.flags |= flag; | ||
| 246 | out: | ||
| 247 | mutex_unlock(&acpi_aml_io.lock); | ||
| 248 | return ret; | ||
| 249 | } | ||
| 250 | |||
| 251 | static void acpi_aml_unlock_fifo(unsigned long flag, bool wakeup) | ||
| 252 | { | ||
| 253 | mutex_lock(&acpi_aml_io.lock); | ||
| 254 | acpi_aml_io.flags &= ~flag; | ||
| 255 | if (wakeup) | ||
| 256 | wake_up_interruptible(&acpi_aml_io.wait); | ||
| 257 | mutex_unlock(&acpi_aml_io.lock); | ||
| 258 | } | ||
| 259 | |||
| 260 | static int acpi_aml_write_kern(const char *buf, int len) | ||
| 261 | { | ||
| 262 | int ret; | ||
| 263 | struct circ_buf *crc = &acpi_aml_io.out_crc; | ||
| 264 | int n; | ||
| 265 | char *p; | ||
| 266 | |||
| 267 | ret = acpi_aml_lock_write(crc, ACPI_AML_OUT_KERN); | ||
| 268 | if (IS_ERR_VALUE(ret)) | ||
| 269 | return ret; | ||
| 270 | /* sync tail before inserting logs */ | ||
| 271 | smp_mb(); | ||
| 272 | p = &crc->buf[crc->head]; | ||
| 273 | n = min(len, circ_space_to_end(crc)); | ||
| 274 | memcpy(p, buf, n); | ||
| 275 | /* sync head after inserting logs */ | ||
| 276 | smp_wmb(); | ||
| 277 | crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); | ||
| 278 | acpi_aml_unlock_fifo(ACPI_AML_OUT_KERN, true); | ||
| 279 | return n; | ||
| 280 | } | ||
| 281 | |||
| 282 | static int acpi_aml_readb_kern(void) | ||
| 283 | { | ||
| 284 | int ret; | ||
| 285 | struct circ_buf *crc = &acpi_aml_io.in_crc; | ||
| 286 | char *p; | ||
| 287 | |||
| 288 | ret = acpi_aml_lock_read(crc, ACPI_AML_IN_KERN); | ||
| 289 | if (IS_ERR_VALUE(ret)) | ||
| 290 | return ret; | ||
| 291 | /* sync head before removing cmds */ | ||
| 292 | smp_rmb(); | ||
| 293 | p = &crc->buf[crc->tail]; | ||
| 294 | ret = (int)*p; | ||
| 295 | /* sync tail before inserting cmds */ | ||
| 296 | smp_mb(); | ||
| 297 | crc->tail = (crc->tail + 1) & (ACPI_AML_BUF_SIZE - 1); | ||
| 298 | acpi_aml_unlock_fifo(ACPI_AML_IN_KERN, true); | ||
| 299 | return ret; | ||
| 300 | } | ||
| 301 | |||
| 302 | /* | ||
| 303 | * acpi_aml_write_log() - Capture debugger output | ||
| 304 | * @msg: the debugger output | ||
| 305 | * | ||
| 306 | * This function should be used to implement acpi_os_printf() to filter out | ||
| 307 | * the debugger output and store the output into the debugger interface | ||
| 308 | * buffer. Return the size of stored logs or errno. | ||
| 309 | */ | ||
| 310 | static ssize_t acpi_aml_write_log(const char *msg) | ||
| 311 | { | ||
| 312 | int ret = 0; | ||
| 313 | int count = 0, size = 0; | ||
| 314 | |||
| 315 | if (!acpi_aml_initialized) | ||
| 316 | return -ENODEV; | ||
| 317 | if (msg) | ||
| 318 | count = strlen(msg); | ||
| 319 | while (count > 0) { | ||
| 320 | again: | ||
| 321 | ret = acpi_aml_write_kern(msg + size, count); | ||
| 322 | if (ret == -EAGAIN) { | ||
| 323 | ret = wait_event_interruptible(acpi_aml_io.wait, | ||
| 324 | acpi_aml_kern_writable()); | ||
| 325 | /* | ||
| 326 | * We need to retry when the condition | ||
| 327 | * becomes true. | ||
| 328 | */ | ||
| 329 | if (ret == 0) | ||
| 330 | goto again; | ||
| 331 | break; | ||
| 332 | } | ||
| 333 | if (IS_ERR_VALUE(ret)) | ||
| 334 | break; | ||
| 335 | size += ret; | ||
| 336 | count -= ret; | ||
| 337 | } | ||
| 338 | return size > 0 ? size : ret; | ||
| 339 | } | ||
| 340 | |||
| 341 | /* | ||
| 342 | * acpi_aml_read_cmd() - Capture debugger input | ||
| 343 | * @msg: the debugger input | ||
| 344 | * @size: the size of the debugger input | ||
| 345 | * | ||
| 346 | * This function should be used to implement acpi_os_get_line() to capture | ||
| 347 | * the debugger input commands and store the input commands into the | ||
| 348 | * debugger interface buffer. Return the size of stored commands or errno. | ||
| 349 | */ | ||
| 350 | static ssize_t acpi_aml_read_cmd(char *msg, size_t count) | ||
| 351 | { | ||
| 352 | int ret = 0; | ||
| 353 | int size = 0; | ||
| 354 | |||
| 355 | /* | ||
| 356 | * This is ensured by the running fact of the debugger thread | ||
| 357 | * unless a bug is introduced. | ||
| 358 | */ | ||
| 359 | BUG_ON(!acpi_aml_initialized); | ||
| 360 | while (count > 0) { | ||
| 361 | again: | ||
| 362 | /* | ||
| 363 | * Check each input byte to find the end of the command. | ||
| 364 | */ | ||
| 365 | ret = acpi_aml_readb_kern(); | ||
| 366 | if (ret == -EAGAIN) { | ||
| 367 | ret = wait_event_interruptible(acpi_aml_io.wait, | ||
| 368 | acpi_aml_kern_readable()); | ||
| 369 | /* | ||
| 370 | * We need to retry when the condition becomes | ||
| 371 | * true. | ||
| 372 | */ | ||
| 373 | if (ret == 0) | ||
| 374 | goto again; | ||
| 375 | } | ||
| 376 | if (IS_ERR_VALUE(ret)) | ||
| 377 | break; | ||
| 378 | *(msg + size) = (char)ret; | ||
| 379 | size++; | ||
| 380 | count--; | ||
| 381 | if (ret == '\n') { | ||
| 382 | /* | ||
| 383 | * acpi_os_get_line() requires a zero terminated command | ||
| 384 | * string. | ||
| 385 | */ | ||
| 386 | *(msg + size - 1) = '\0'; | ||
| 387 | break; | ||
| 388 | } | ||
| 389 | } | ||
| 390 | return size > 0 ? size : ret; | ||
| 391 | } | ||
| 392 | |||
| 393 | static int acpi_aml_thread(void *unsed) | ||
| 394 | { | ||
| 395 | acpi_osd_exec_callback function = NULL; | ||
| 396 | void *context; | ||
| 397 | |||
| 398 | mutex_lock(&acpi_aml_io.lock); | ||
| 399 | if (acpi_aml_io.function) { | ||
| 400 | acpi_aml_io.usages++; | ||
| 401 | function = acpi_aml_io.function; | ||
| 402 | context = acpi_aml_io.context; | ||
| 403 | } | ||
| 404 | mutex_unlock(&acpi_aml_io.lock); | ||
| 405 | |||
| 406 | if (function) | ||
| 407 | function(context); | ||
| 408 | |||
| 409 | mutex_lock(&acpi_aml_io.lock); | ||
| 410 | acpi_aml_io.usages--; | ||
| 411 | if (!__acpi_aml_used()) { | ||
| 412 | acpi_aml_io.thread = NULL; | ||
| 413 | wake_up(&acpi_aml_io.wait); | ||
| 414 | } | ||
| 415 | mutex_unlock(&acpi_aml_io.lock); | ||
| 416 | |||
| 417 | return 0; | ||
| 418 | } | ||
| 419 | |||
| 420 | /* | ||
| 421 | * acpi_aml_create_thread() - Create AML debugger thread | ||
| 422 | * @function: the debugger thread callback | ||
| 423 | * @context: the context to be passed to the debugger thread | ||
| 424 | * | ||
| 425 | * This function should be used to implement acpi_os_execute() which is | ||
| 426 | * used by the ACPICA debugger to create the debugger thread. | ||
| 427 | */ | ||
| 428 | static int acpi_aml_create_thread(acpi_osd_exec_callback function, void *context) | ||
| 429 | { | ||
| 430 | struct task_struct *t; | ||
| 431 | |||
| 432 | mutex_lock(&acpi_aml_io.lock); | ||
| 433 | acpi_aml_io.function = function; | ||
| 434 | acpi_aml_io.context = context; | ||
| 435 | mutex_unlock(&acpi_aml_io.lock); | ||
| 436 | |||
| 437 | t = kthread_create(acpi_aml_thread, NULL, "aml"); | ||
| 438 | if (IS_ERR(t)) { | ||
| 439 | pr_err("Failed to create AML debugger thread.\n"); | ||
| 440 | return PTR_ERR(t); | ||
| 441 | } | ||
| 442 | |||
| 443 | mutex_lock(&acpi_aml_io.lock); | ||
| 444 | acpi_aml_io.thread = t; | ||
| 445 | acpi_set_debugger_thread_id((acpi_thread_id)(unsigned long)t); | ||
| 446 | wake_up_process(t); | ||
| 447 | mutex_unlock(&acpi_aml_io.lock); | ||
| 448 | return 0; | ||
| 449 | } | ||
| 450 | |||
| 451 | static int acpi_aml_wait_command_ready(bool single_step, | ||
| 452 | char *buffer, size_t length) | ||
| 453 | { | ||
| 454 | acpi_status status; | ||
| 455 | |||
| 456 | if (single_step) | ||
| 457 | acpi_os_printf("\n%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); | ||
| 458 | else | ||
| 459 | acpi_os_printf("\n%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); | ||
| 460 | |||
| 461 | status = acpi_os_get_line(buffer, length, NULL); | ||
| 462 | if (ACPI_FAILURE(status)) | ||
| 463 | return -EINVAL; | ||
| 464 | return 0; | ||
| 465 | } | ||
| 466 | |||
| 467 | static int acpi_aml_notify_command_complete(void) | ||
| 468 | { | ||
| 469 | return 0; | ||
| 470 | } | ||
| 471 | |||
| 472 | static int acpi_aml_open(struct inode *inode, struct file *file) | ||
| 473 | { | ||
| 474 | int ret = 0; | ||
| 475 | acpi_status status; | ||
| 476 | |||
| 477 | mutex_lock(&acpi_aml_io.lock); | ||
| 478 | /* | ||
| 479 | * The debugger interface is being closed, no new user is allowed | ||
| 480 | * during this period. | ||
| 481 | */ | ||
| 482 | if (acpi_aml_io.flags & ACPI_AML_CLOSED) { | ||
| 483 | ret = -EBUSY; | ||
| 484 | goto err_lock; | ||
| 485 | } | ||
| 486 | if ((file->f_flags & O_ACCMODE) != O_WRONLY) { | ||
| 487 | /* | ||
| 488 | * Only one reader is allowed to initiate the debugger | ||
| 489 | * thread. | ||
| 490 | */ | ||
| 491 | if (acpi_aml_active_reader) { | ||
| 492 | ret = -EBUSY; | ||
| 493 | goto err_lock; | ||
| 494 | } else { | ||
| 495 | pr_debug("Opening debugger reader.\n"); | ||
| 496 | acpi_aml_active_reader = file; | ||
| 497 | } | ||
| 498 | } else { | ||
| 499 | /* | ||
| 500 | * No writer is allowed unless the debugger thread is | ||
| 501 | * ready. | ||
| 502 | */ | ||
| 503 | if (!(acpi_aml_io.flags & ACPI_AML_OPENED)) { | ||
| 504 | ret = -ENODEV; | ||
| 505 | goto err_lock; | ||
| 506 | } | ||
| 507 | } | ||
| 508 | if (acpi_aml_active_reader == file) { | ||
| 509 | pr_debug("Opening debugger interface.\n"); | ||
| 510 | mutex_unlock(&acpi_aml_io.lock); | ||
| 511 | |||
| 512 | pr_debug("Initializing debugger thread.\n"); | ||
| 513 | status = acpi_initialize_debugger(); | ||
| 514 | if (ACPI_FAILURE(status)) { | ||
| 515 | pr_err("Failed to initialize debugger.\n"); | ||
| 516 | ret = -EINVAL; | ||
| 517 | goto err_exit; | ||
| 518 | } | ||
| 519 | pr_debug("Debugger thread initialized.\n"); | ||
| 520 | |||
| 521 | mutex_lock(&acpi_aml_io.lock); | ||
| 522 | acpi_aml_io.flags |= ACPI_AML_OPENED; | ||
| 523 | acpi_aml_io.out_crc.head = acpi_aml_io.out_crc.tail = 0; | ||
| 524 | acpi_aml_io.in_crc.head = acpi_aml_io.in_crc.tail = 0; | ||
| 525 | pr_debug("Debugger interface opened.\n"); | ||
| 526 | } | ||
| 527 | acpi_aml_io.users++; | ||
| 528 | err_lock: | ||
| 529 | if (IS_ERR_VALUE(ret)) { | ||
| 530 | if (acpi_aml_active_reader == file) | ||
| 531 | acpi_aml_active_reader = NULL; | ||
| 532 | } | ||
| 533 | mutex_unlock(&acpi_aml_io.lock); | ||
| 534 | err_exit: | ||
| 535 | return ret; | ||
| 536 | } | ||
| 537 | |||
| 538 | static int acpi_aml_release(struct inode *inode, struct file *file) | ||
| 539 | { | ||
| 540 | mutex_lock(&acpi_aml_io.lock); | ||
| 541 | acpi_aml_io.users--; | ||
| 542 | if (file == acpi_aml_active_reader) { | ||
| 543 | pr_debug("Closing debugger reader.\n"); | ||
| 544 | acpi_aml_active_reader = NULL; | ||
| 545 | |||
| 546 | pr_debug("Closing debugger interface.\n"); | ||
| 547 | acpi_aml_io.flags |= ACPI_AML_CLOSED; | ||
| 548 | |||
| 549 | /* | ||
| 550 | * Wake up all user space/kernel space blocked | ||
| 551 | * readers/writers. | ||
| 552 | */ | ||
| 553 | wake_up_interruptible(&acpi_aml_io.wait); | ||
| 554 | mutex_unlock(&acpi_aml_io.lock); | ||
| 555 | /* | ||
| 556 | * Wait all user space/kernel space readers/writers to | ||
| 557 | * stop so that ACPICA command loop of the debugger thread | ||
| 558 | * should fail all its command line reads after this point. | ||
| 559 | */ | ||
| 560 | wait_event(acpi_aml_io.wait, !acpi_aml_busy()); | ||
| 561 | |||
| 562 | /* | ||
| 563 | * Then we try to terminate the debugger thread if it is | ||
| 564 | * not terminated. | ||
| 565 | */ | ||
| 566 | pr_debug("Terminating debugger thread.\n"); | ||
| 567 | acpi_terminate_debugger(); | ||
| 568 | wait_event(acpi_aml_io.wait, !acpi_aml_used()); | ||
| 569 | pr_debug("Debugger thread terminated.\n"); | ||
| 570 | |||
| 571 | mutex_lock(&acpi_aml_io.lock); | ||
| 572 | acpi_aml_io.flags &= ~ACPI_AML_OPENED; | ||
| 573 | } | ||
| 574 | if (acpi_aml_io.users == 0) { | ||
| 575 | pr_debug("Debugger interface closed.\n"); | ||
| 576 | acpi_aml_io.flags &= ~ACPI_AML_CLOSED; | ||
| 577 | } | ||
| 578 | mutex_unlock(&acpi_aml_io.lock); | ||
| 579 | return 0; | ||
| 580 | } | ||
| 581 | |||
| 582 | static int acpi_aml_read_user(char __user *buf, int len) | ||
| 583 | { | ||
| 584 | int ret; | ||
| 585 | struct circ_buf *crc = &acpi_aml_io.out_crc; | ||
| 586 | int n; | ||
| 587 | char *p; | ||
| 588 | |||
| 589 | ret = acpi_aml_lock_read(crc, ACPI_AML_OUT_USER); | ||
| 590 | if (IS_ERR_VALUE(ret)) | ||
| 591 | return ret; | ||
| 592 | /* sync head before removing logs */ | ||
| 593 | smp_rmb(); | ||
| 594 | p = &crc->buf[crc->tail]; | ||
| 595 | n = min(len, circ_count_to_end(crc)); | ||
| 596 | if (copy_to_user(buf, p, n)) { | ||
| 597 | ret = -EFAULT; | ||
| 598 | goto out; | ||
| 599 | } | ||
| 600 | /* sync tail after removing logs */ | ||
| 601 | smp_mb(); | ||
| 602 | crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1); | ||
| 603 | ret = n; | ||
| 604 | out: | ||
| 605 | acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, !IS_ERR_VALUE(ret)); | ||
| 606 | return ret; | ||
| 607 | } | ||
| 608 | |||
| 609 | static ssize_t acpi_aml_read(struct file *file, char __user *buf, | ||
| 610 | size_t count, loff_t *ppos) | ||
| 611 | { | ||
| 612 | int ret = 0; | ||
| 613 | int size = 0; | ||
| 614 | |||
| 615 | if (!count) | ||
| 616 | return 0; | ||
| 617 | if (!access_ok(VERIFY_WRITE, buf, count)) | ||
| 618 | return -EFAULT; | ||
| 619 | |||
| 620 | while (count > 0) { | ||
| 621 | again: | ||
| 622 | ret = acpi_aml_read_user(buf + size, count); | ||
| 623 | if (ret == -EAGAIN) { | ||
| 624 | if (file->f_flags & O_NONBLOCK) | ||
| 625 | break; | ||
| 626 | else { | ||
| 627 | ret = wait_event_interruptible(acpi_aml_io.wait, | ||
| 628 | acpi_aml_user_readable()); | ||
| 629 | /* | ||
| 630 | * We need to retry when the condition | ||
| 631 | * becomes true. | ||
| 632 | */ | ||
| 633 | if (ret == 0) | ||
| 634 | goto again; | ||
| 635 | } | ||
| 636 | } | ||
| 637 | if (IS_ERR_VALUE(ret)) { | ||
| 638 | if (!acpi_aml_running()) | ||
| 639 | ret = 0; | ||
| 640 | break; | ||
| 641 | } | ||
| 642 | if (ret) { | ||
| 643 | size += ret; | ||
| 644 | count -= ret; | ||
| 645 | *ppos += ret; | ||
| 646 | break; | ||
| 647 | } | ||
| 648 | } | ||
| 649 | return size > 0 ? size : ret; | ||
| 650 | } | ||
| 651 | |||
| 652 | static int acpi_aml_write_user(const char __user *buf, int len) | ||
| 653 | { | ||
| 654 | int ret; | ||
| 655 | struct circ_buf *crc = &acpi_aml_io.in_crc; | ||
| 656 | int n; | ||
| 657 | char *p; | ||
| 658 | |||
| 659 | ret = acpi_aml_lock_write(crc, ACPI_AML_IN_USER); | ||
| 660 | if (IS_ERR_VALUE(ret)) | ||
| 661 | return ret; | ||
| 662 | /* sync tail before inserting cmds */ | ||
| 663 | smp_mb(); | ||
| 664 | p = &crc->buf[crc->head]; | ||
| 665 | n = min(len, circ_space_to_end(crc)); | ||
| 666 | if (copy_from_user(p, buf, n)) { | ||
| 667 | ret = -EFAULT; | ||
| 668 | goto out; | ||
| 669 | } | ||
| 670 | /* sync head after inserting cmds */ | ||
| 671 | smp_wmb(); | ||
| 672 | crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); | ||
| 673 | ret = n; | ||
| 674 | out: | ||
| 675 | acpi_aml_unlock_fifo(ACPI_AML_IN_USER, !IS_ERR_VALUE(ret)); | ||
| 676 | return n; | ||
| 677 | } | ||
| 678 | |||
| 679 | static ssize_t acpi_aml_write(struct file *file, const char __user *buf, | ||
| 680 | size_t count, loff_t *ppos) | ||
| 681 | { | ||
| 682 | int ret = 0; | ||
| 683 | int size = 0; | ||
| 684 | |||
| 685 | if (!count) | ||
| 686 | return 0; | ||
| 687 | if (!access_ok(VERIFY_READ, buf, count)) | ||
| 688 | return -EFAULT; | ||
| 689 | |||
| 690 | while (count > 0) { | ||
| 691 | again: | ||
| 692 | ret = acpi_aml_write_user(buf + size, count); | ||
| 693 | if (ret == -EAGAIN) { | ||
| 694 | if (file->f_flags & O_NONBLOCK) | ||
| 695 | break; | ||
| 696 | else { | ||
| 697 | ret = wait_event_interruptible(acpi_aml_io.wait, | ||
| 698 | acpi_aml_user_writable()); | ||
| 699 | /* | ||
| 700 | * We need to retry when the condition | ||
| 701 | * becomes true. | ||
| 702 | */ | ||
| 703 | if (ret == 0) | ||
| 704 | goto again; | ||
| 705 | } | ||
| 706 | } | ||
| 707 | if (IS_ERR_VALUE(ret)) { | ||
| 708 | if (!acpi_aml_running()) | ||
| 709 | ret = 0; | ||
| 710 | break; | ||
| 711 | } | ||
| 712 | if (ret) { | ||
| 713 | size += ret; | ||
| 714 | count -= ret; | ||
| 715 | *ppos += ret; | ||
| 716 | } | ||
| 717 | } | ||
| 718 | return size > 0 ? size : ret; | ||
| 719 | } | ||
| 720 | |||
| 721 | static unsigned int acpi_aml_poll(struct file *file, poll_table *wait) | ||
| 722 | { | ||
| 723 | int masks = 0; | ||
| 724 | |||
| 725 | poll_wait(file, &acpi_aml_io.wait, wait); | ||
| 726 | if (acpi_aml_user_readable()) | ||
| 727 | masks |= POLLIN | POLLRDNORM; | ||
| 728 | if (acpi_aml_user_writable()) | ||
| 729 | masks |= POLLOUT | POLLWRNORM; | ||
| 730 | |||
| 731 | return masks; | ||
| 732 | } | ||
| 733 | |||
| 734 | static const struct file_operations acpi_aml_operations = { | ||
| 735 | .read = acpi_aml_read, | ||
| 736 | .write = acpi_aml_write, | ||
| 737 | .poll = acpi_aml_poll, | ||
| 738 | .open = acpi_aml_open, | ||
| 739 | .release = acpi_aml_release, | ||
| 740 | .llseek = generic_file_llseek, | ||
| 741 | }; | ||
| 742 | |||
| 743 | static const struct acpi_debugger_ops acpi_aml_debugger = { | ||
| 744 | .create_thread = acpi_aml_create_thread, | ||
| 745 | .read_cmd = acpi_aml_read_cmd, | ||
| 746 | .write_log = acpi_aml_write_log, | ||
| 747 | .wait_command_ready = acpi_aml_wait_command_ready, | ||
| 748 | .notify_command_complete = acpi_aml_notify_command_complete, | ||
| 749 | }; | ||
| 750 | |||
| 751 | int __init acpi_aml_init(void) | ||
| 752 | { | ||
| 753 | int ret = 0; | ||
| 754 | |||
| 755 | if (!acpi_debugfs_dir) { | ||
| 756 | ret = -ENOENT; | ||
| 757 | goto err_exit; | ||
| 758 | } | ||
| 759 | |||
| 760 | /* Initialize AML IO interface */ | ||
| 761 | mutex_init(&acpi_aml_io.lock); | ||
| 762 | init_waitqueue_head(&acpi_aml_io.wait); | ||
| 763 | acpi_aml_io.out_crc.buf = acpi_aml_io.out_buf; | ||
| 764 | acpi_aml_io.in_crc.buf = acpi_aml_io.in_buf; | ||
| 765 | acpi_aml_dentry = debugfs_create_file("acpidbg", | ||
| 766 | S_IFREG | S_IRUGO | S_IWUSR, | ||
| 767 | acpi_debugfs_dir, NULL, | ||
| 768 | &acpi_aml_operations); | ||
| 769 | if (acpi_aml_dentry == NULL) { | ||
| 770 | ret = -ENODEV; | ||
| 771 | goto err_exit; | ||
| 772 | } | ||
| 773 | ret = acpi_register_debugger(THIS_MODULE, &acpi_aml_debugger); | ||
| 774 | if (ret) | ||
| 775 | goto err_fs; | ||
| 776 | acpi_aml_initialized = true; | ||
| 777 | |||
| 778 | err_fs: | ||
| 779 | if (ret) { | ||
| 780 | debugfs_remove(acpi_aml_dentry); | ||
| 781 | acpi_aml_dentry = NULL; | ||
| 782 | } | ||
| 783 | err_exit: | ||
| 784 | return ret; | ||
| 785 | } | ||
| 786 | |||
| 787 | void __exit acpi_aml_exit(void) | ||
| 788 | { | ||
| 789 | if (acpi_aml_initialized) { | ||
| 790 | acpi_unregister_debugger(&acpi_aml_debugger); | ||
| 791 | if (acpi_aml_dentry) { | ||
| 792 | debugfs_remove(acpi_aml_dentry); | ||
| 793 | acpi_aml_dentry = NULL; | ||
| 794 | } | ||
| 795 | acpi_aml_initialized = false; | ||
| 796 | } | ||
| 797 | } | ||
| 798 | |||
| 799 | module_init(acpi_aml_init); | ||
| 800 | module_exit(acpi_aml_exit); | ||
| 801 | |||
| 802 | MODULE_AUTHOR("Lv Zheng"); | ||
| 803 | MODULE_DESCRIPTION("ACPI debugger userspace IO driver"); | ||
| 804 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index f9e0d09f7c66..047281a6ae11 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/clk-provider.h> | 15 | #include <linux/clk-provider.h> |
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 18 | #include <linux/mutex.h> | ||
| 18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 19 | #include <linux/platform_data/clk-lpss.h> | 20 | #include <linux/platform_data/clk-lpss.h> |
| 20 | #include <linux/pm_runtime.h> | 21 | #include <linux/pm_runtime.h> |
| @@ -26,6 +27,10 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
| 26 | 27 | ||
| 27 | #ifdef CONFIG_X86_INTEL_LPSS | 28 | #ifdef CONFIG_X86_INTEL_LPSS |
| 28 | 29 | ||
| 30 | #include <asm/cpu_device_id.h> | ||
| 31 | #include <asm/iosf_mbi.h> | ||
| 32 | #include <asm/pmc_atom.h> | ||
| 33 | |||
| 29 | #define LPSS_ADDR(desc) ((unsigned long)&desc) | 34 | #define LPSS_ADDR(desc) ((unsigned long)&desc) |
| 30 | 35 | ||
| 31 | #define LPSS_CLK_SIZE 0x04 | 36 | #define LPSS_CLK_SIZE 0x04 |
| @@ -71,7 +76,7 @@ struct lpss_device_desc { | |||
| 71 | void (*setup)(struct lpss_private_data *pdata); | 76 | void (*setup)(struct lpss_private_data *pdata); |
| 72 | }; | 77 | }; |
| 73 | 78 | ||
| 74 | static struct lpss_device_desc lpss_dma_desc = { | 79 | static const struct lpss_device_desc lpss_dma_desc = { |
| 75 | .flags = LPSS_CLK, | 80 | .flags = LPSS_CLK, |
| 76 | }; | 81 | }; |
| 77 | 82 | ||
| @@ -84,6 +89,23 @@ struct lpss_private_data { | |||
| 84 | u32 prv_reg_ctx[LPSS_PRV_REG_COUNT]; | 89 | u32 prv_reg_ctx[LPSS_PRV_REG_COUNT]; |
| 85 | }; | 90 | }; |
| 86 | 91 | ||
| 92 | /* LPSS run time quirks */ | ||
| 93 | static unsigned int lpss_quirks; | ||
| 94 | |||
| 95 | /* | ||
| 96 | * LPSS_QUIRK_ALWAYS_POWER_ON: override power state for LPSS DMA device. | ||
| 97 | * | ||
| 98 | * The LPSS DMA controller has neither _PS0 nor _PS3 method. Moreover | ||
| 99 | * it can be powered off automatically whenever the last LPSS device goes down. | ||
| 100 | * In case of no power any access to the DMA controller will hang the system. | ||
| 101 | * The behaviour is reproduced on some HP laptops based on Intel BayTrail as | ||
| 102 | * well as on ASuS T100TA transformer. | ||
| 103 | * | ||
| 104 | * This quirk overrides power state of entire LPSS island to keep DMA powered | ||
| 105 | * on whenever we have at least one other device in use. | ||
| 106 | */ | ||
| 107 | #define LPSS_QUIRK_ALWAYS_POWER_ON BIT(0) | ||
| 108 | |||
| 87 | /* UART Component Parameter Register */ | 109 | /* UART Component Parameter Register */ |
| 88 | #define LPSS_UART_CPR 0xF4 | 110 | #define LPSS_UART_CPR 0xF4 |
| 89 | #define LPSS_UART_CPR_AFCE BIT(4) | 111 | #define LPSS_UART_CPR_AFCE BIT(4) |
| @@ -196,13 +218,21 @@ static const struct lpss_device_desc bsw_i2c_dev_desc = { | |||
| 196 | .setup = byt_i2c_setup, | 218 | .setup = byt_i2c_setup, |
| 197 | }; | 219 | }; |
| 198 | 220 | ||
| 199 | static struct lpss_device_desc bsw_spi_dev_desc = { | 221 | static const struct lpss_device_desc bsw_spi_dev_desc = { |
| 200 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX | 222 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX |
| 201 | | LPSS_NO_D3_DELAY, | 223 | | LPSS_NO_D3_DELAY, |
| 202 | .prv_offset = 0x400, | 224 | .prv_offset = 0x400, |
| 203 | .setup = lpss_deassert_reset, | 225 | .setup = lpss_deassert_reset, |
| 204 | }; | 226 | }; |
| 205 | 227 | ||
| 228 | #define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, } | ||
| 229 | |||
| 230 | static const struct x86_cpu_id lpss_cpu_ids[] = { | ||
| 231 | ICPU(0x37), /* Valleyview, Bay Trail */ | ||
| 232 | ICPU(0x4c), /* Braswell, Cherry Trail */ | ||
| 233 | {} | ||
| 234 | }; | ||
| 235 | |||
| 206 | #else | 236 | #else |
| 207 | 237 | ||
| 208 | #define LPSS_ADDR(desc) (0UL) | 238 | #define LPSS_ADDR(desc) (0UL) |
| @@ -574,6 +604,17 @@ static void acpi_lpss_restore_ctx(struct device *dev, | |||
| 574 | { | 604 | { |
| 575 | unsigned int i; | 605 | unsigned int i; |
| 576 | 606 | ||
| 607 | for (i = 0; i < LPSS_PRV_REG_COUNT; i++) { | ||
| 608 | unsigned long offset = i * sizeof(u32); | ||
| 609 | |||
| 610 | __lpss_reg_write(pdata->prv_reg_ctx[i], pdata, offset); | ||
| 611 | dev_dbg(dev, "restoring 0x%08x to LPSS reg at offset 0x%02lx\n", | ||
| 612 | pdata->prv_reg_ctx[i], offset); | ||
| 613 | } | ||
| 614 | } | ||
| 615 | |||
| 616 | static void acpi_lpss_d3_to_d0_delay(struct lpss_private_data *pdata) | ||
| 617 | { | ||
| 577 | /* | 618 | /* |
| 578 | * The following delay is needed or the subsequent write operations may | 619 | * The following delay is needed or the subsequent write operations may |
| 579 | * fail. The LPSS devices are actually PCI devices and the PCI spec | 620 | * fail. The LPSS devices are actually PCI devices and the PCI spec |
| @@ -586,14 +627,34 @@ static void acpi_lpss_restore_ctx(struct device *dev, | |||
| 586 | delay = 0; | 627 | delay = 0; |
| 587 | 628 | ||
| 588 | msleep(delay); | 629 | msleep(delay); |
| 630 | } | ||
| 589 | 631 | ||
| 590 | for (i = 0; i < LPSS_PRV_REG_COUNT; i++) { | 632 | static int acpi_lpss_activate(struct device *dev) |
| 591 | unsigned long offset = i * sizeof(u32); | 633 | { |
| 634 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | ||
| 635 | int ret; | ||
| 592 | 636 | ||
| 593 | __lpss_reg_write(pdata->prv_reg_ctx[i], pdata, offset); | 637 | ret = acpi_dev_runtime_resume(dev); |
| 594 | dev_dbg(dev, "restoring 0x%08x to LPSS reg at offset 0x%02lx\n", | 638 | if (ret) |
| 595 | pdata->prv_reg_ctx[i], offset); | 639 | return ret; |
| 596 | } | 640 | |
| 641 | acpi_lpss_d3_to_d0_delay(pdata); | ||
| 642 | |||
| 643 | /* | ||
| 644 | * This is called only on ->probe() stage where a device is either in | ||
| 645 | * known state defined by BIOS or most likely powered off. Due to this | ||
| 646 | * we have to deassert reset line to be sure that ->probe() will | ||
| 647 | * recognize the device. | ||
| 648 | */ | ||
| 649 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) | ||
| 650 | lpss_deassert_reset(pdata); | ||
| 651 | |||
| 652 | return 0; | ||
| 653 | } | ||
| 654 | |||
| 655 | static void acpi_lpss_dismiss(struct device *dev) | ||
| 656 | { | ||
| 657 | acpi_dev_runtime_suspend(dev); | ||
| 597 | } | 658 | } |
| 598 | 659 | ||
| 599 | #ifdef CONFIG_PM_SLEEP | 660 | #ifdef CONFIG_PM_SLEEP |
| @@ -621,6 +682,8 @@ static int acpi_lpss_resume_early(struct device *dev) | |||
| 621 | if (ret) | 682 | if (ret) |
| 622 | return ret; | 683 | return ret; |
| 623 | 684 | ||
| 685 | acpi_lpss_d3_to_d0_delay(pdata); | ||
| 686 | |||
| 624 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) | 687 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
| 625 | acpi_lpss_restore_ctx(dev, pdata); | 688 | acpi_lpss_restore_ctx(dev, pdata); |
| 626 | 689 | ||
| @@ -628,6 +691,89 @@ static int acpi_lpss_resume_early(struct device *dev) | |||
| 628 | } | 691 | } |
| 629 | #endif /* CONFIG_PM_SLEEP */ | 692 | #endif /* CONFIG_PM_SLEEP */ |
| 630 | 693 | ||
| 694 | /* IOSF SB for LPSS island */ | ||
| 695 | #define LPSS_IOSF_UNIT_LPIOEP 0xA0 | ||
| 696 | #define LPSS_IOSF_UNIT_LPIO1 0xAB | ||
| 697 | #define LPSS_IOSF_UNIT_LPIO2 0xAC | ||
| 698 | |||
| 699 | #define LPSS_IOSF_PMCSR 0x84 | ||
| 700 | #define LPSS_PMCSR_D0 0 | ||
| 701 | #define LPSS_PMCSR_D3hot 3 | ||
| 702 | #define LPSS_PMCSR_Dx_MASK GENMASK(1, 0) | ||
| 703 | |||
| 704 | #define LPSS_IOSF_GPIODEF0 0x154 | ||
| 705 | #define LPSS_GPIODEF0_DMA1_D3 BIT(2) | ||
| 706 | #define LPSS_GPIODEF0_DMA2_D3 BIT(3) | ||
| 707 | #define LPSS_GPIODEF0_DMA_D3_MASK GENMASK(3, 2) | ||
| 708 | |||
| 709 | static DEFINE_MUTEX(lpss_iosf_mutex); | ||
| 710 | |||
| 711 | static void lpss_iosf_enter_d3_state(void) | ||
| 712 | { | ||
| 713 | u32 value1 = 0; | ||
| 714 | u32 mask1 = LPSS_GPIODEF0_DMA_D3_MASK; | ||
| 715 | u32 value2 = LPSS_PMCSR_D3hot; | ||
| 716 | u32 mask2 = LPSS_PMCSR_Dx_MASK; | ||
| 717 | /* | ||
| 718 | * PMC provides an information about actual status of the LPSS devices. | ||
| 719 | * Here we read the values related to LPSS power island, i.e. LPSS | ||
| 720 | * devices, excluding both LPSS DMA controllers, along with SCC domain. | ||
| 721 | */ | ||
| 722 | u32 func_dis, d3_sts_0, pmc_status, pmc_mask = 0xfe000ffe; | ||
| 723 | int ret; | ||
| 724 | |||
| 725 | ret = pmc_atom_read(PMC_FUNC_DIS, &func_dis); | ||
| 726 | if (ret) | ||
| 727 | return; | ||
| 728 | |||
| 729 | mutex_lock(&lpss_iosf_mutex); | ||
| 730 | |||
| 731 | ret = pmc_atom_read(PMC_D3_STS_0, &d3_sts_0); | ||
| 732 | if (ret) | ||
| 733 | goto exit; | ||
| 734 | |||
| 735 | /* | ||
| 736 | * Get the status of entire LPSS power island per device basis. | ||
| 737 | * Shutdown both LPSS DMA controllers if and only if all other devices | ||
| 738 | * are already in D3hot. | ||
| 739 | */ | ||
| 740 | pmc_status = (~(d3_sts_0 | func_dis)) & pmc_mask; | ||
| 741 | if (pmc_status) | ||
| 742 | goto exit; | ||
| 743 | |||
| 744 | iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE, | ||
| 745 | LPSS_IOSF_PMCSR, value2, mask2); | ||
| 746 | |||
| 747 | iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO2, MBI_CFG_WRITE, | ||
| 748 | LPSS_IOSF_PMCSR, value2, mask2); | ||
| 749 | |||
| 750 | iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, | ||
| 751 | LPSS_IOSF_GPIODEF0, value1, mask1); | ||
| 752 | exit: | ||
| 753 | mutex_unlock(&lpss_iosf_mutex); | ||
| 754 | } | ||
| 755 | |||
| 756 | static void lpss_iosf_exit_d3_state(void) | ||
| 757 | { | ||
| 758 | u32 value1 = LPSS_GPIODEF0_DMA1_D3 | LPSS_GPIODEF0_DMA2_D3; | ||
| 759 | u32 mask1 = LPSS_GPIODEF0_DMA_D3_MASK; | ||
| 760 | u32 value2 = LPSS_PMCSR_D0; | ||
| 761 | u32 mask2 = LPSS_PMCSR_Dx_MASK; | ||
| 762 | |||
| 763 | mutex_lock(&lpss_iosf_mutex); | ||
| 764 | |||
| 765 | iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, | ||
| 766 | LPSS_IOSF_GPIODEF0, value1, mask1); | ||
| 767 | |||
| 768 | iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO2, MBI_CFG_WRITE, | ||
| 769 | LPSS_IOSF_PMCSR, value2, mask2); | ||
| 770 | |||
| 771 | iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE, | ||
| 772 | LPSS_IOSF_PMCSR, value2, mask2); | ||
| 773 | |||
| 774 | mutex_unlock(&lpss_iosf_mutex); | ||
| 775 | } | ||
| 776 | |||
| 631 | static int acpi_lpss_runtime_suspend(struct device *dev) | 777 | static int acpi_lpss_runtime_suspend(struct device *dev) |
| 632 | { | 778 | { |
| 633 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | 779 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
| @@ -640,7 +786,17 @@ static int acpi_lpss_runtime_suspend(struct device *dev) | |||
| 640 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) | 786 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
| 641 | acpi_lpss_save_ctx(dev, pdata); | 787 | acpi_lpss_save_ctx(dev, pdata); |
| 642 | 788 | ||
| 643 | return acpi_dev_runtime_suspend(dev); | 789 | ret = acpi_dev_runtime_suspend(dev); |
| 790 | |||
| 791 | /* | ||
| 792 | * This call must be last in the sequence, otherwise PMC will return | ||
| 793 | * wrong status for devices being about to be powered off. See | ||
| 794 | * lpss_iosf_enter_d3_state() for further information. | ||
| 795 | */ | ||
| 796 | if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) | ||
| 797 | lpss_iosf_enter_d3_state(); | ||
| 798 | |||
| 799 | return ret; | ||
| 644 | } | 800 | } |
| 645 | 801 | ||
| 646 | static int acpi_lpss_runtime_resume(struct device *dev) | 802 | static int acpi_lpss_runtime_resume(struct device *dev) |
| @@ -648,10 +804,19 @@ static int acpi_lpss_runtime_resume(struct device *dev) | |||
| 648 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | 804 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
| 649 | int ret; | 805 | int ret; |
| 650 | 806 | ||
| 807 | /* | ||
| 808 | * This call is kept first to be in symmetry with | ||
| 809 | * acpi_lpss_runtime_suspend() one. | ||
| 810 | */ | ||
| 811 | if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) | ||
| 812 | lpss_iosf_exit_d3_state(); | ||
| 813 | |||
| 651 | ret = acpi_dev_runtime_resume(dev); | 814 | ret = acpi_dev_runtime_resume(dev); |
| 652 | if (ret) | 815 | if (ret) |
| 653 | return ret; | 816 | return ret; |
| 654 | 817 | ||
| 818 | acpi_lpss_d3_to_d0_delay(pdata); | ||
| 819 | |||
| 655 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) | 820 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
| 656 | acpi_lpss_restore_ctx(dev, pdata); | 821 | acpi_lpss_restore_ctx(dev, pdata); |
| 657 | 822 | ||
| @@ -660,6 +825,10 @@ static int acpi_lpss_runtime_resume(struct device *dev) | |||
| 660 | #endif /* CONFIG_PM */ | 825 | #endif /* CONFIG_PM */ |
| 661 | 826 | ||
| 662 | static struct dev_pm_domain acpi_lpss_pm_domain = { | 827 | static struct dev_pm_domain acpi_lpss_pm_domain = { |
| 828 | #ifdef CONFIG_PM | ||
| 829 | .activate = acpi_lpss_activate, | ||
| 830 | .dismiss = acpi_lpss_dismiss, | ||
| 831 | #endif | ||
| 663 | .ops = { | 832 | .ops = { |
| 664 | #ifdef CONFIG_PM | 833 | #ifdef CONFIG_PM |
| 665 | #ifdef CONFIG_PM_SLEEP | 834 | #ifdef CONFIG_PM_SLEEP |
| @@ -705,8 +874,14 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, | |||
| 705 | } | 874 | } |
| 706 | 875 | ||
| 707 | switch (action) { | 876 | switch (action) { |
| 708 | case BUS_NOTIFY_ADD_DEVICE: | 877 | case BUS_NOTIFY_BIND_DRIVER: |
| 709 | pdev->dev.pm_domain = &acpi_lpss_pm_domain; | 878 | pdev->dev.pm_domain = &acpi_lpss_pm_domain; |
| 879 | break; | ||
| 880 | case BUS_NOTIFY_DRIVER_NOT_BOUND: | ||
| 881 | case BUS_NOTIFY_UNBOUND_DRIVER: | ||
| 882 | pdev->dev.pm_domain = NULL; | ||
| 883 | break; | ||
| 884 | case BUS_NOTIFY_ADD_DEVICE: | ||
| 710 | if (pdata->dev_desc->flags & LPSS_LTR) | 885 | if (pdata->dev_desc->flags & LPSS_LTR) |
| 711 | return sysfs_create_group(&pdev->dev.kobj, | 886 | return sysfs_create_group(&pdev->dev.kobj, |
| 712 | &lpss_attr_group); | 887 | &lpss_attr_group); |
| @@ -714,7 +889,6 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, | |||
| 714 | case BUS_NOTIFY_DEL_DEVICE: | 889 | case BUS_NOTIFY_DEL_DEVICE: |
| 715 | if (pdata->dev_desc->flags & LPSS_LTR) | 890 | if (pdata->dev_desc->flags & LPSS_LTR) |
| 716 | sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); | 891 | sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); |
| 717 | pdev->dev.pm_domain = NULL; | ||
| 718 | break; | 892 | break; |
| 719 | default: | 893 | default: |
| 720 | break; | 894 | break; |
| @@ -754,10 +928,19 @@ static struct acpi_scan_handler lpss_handler = { | |||
| 754 | 928 | ||
| 755 | void __init acpi_lpss_init(void) | 929 | void __init acpi_lpss_init(void) |
| 756 | { | 930 | { |
| 757 | if (!lpt_clk_init()) { | 931 | const struct x86_cpu_id *id; |
| 758 | bus_register_notifier(&platform_bus_type, &acpi_lpss_nb); | 932 | int ret; |
| 759 | acpi_scan_add_handler(&lpss_handler); | 933 | |
| 760 | } | 934 | ret = lpt_clk_init(); |
| 935 | if (ret) | ||
| 936 | return; | ||
| 937 | |||
| 938 | id = x86_match_cpu(lpss_cpu_ids); | ||
| 939 | if (id) | ||
| 940 | lpss_quirks |= LPSS_QUIRK_ALWAYS_POWER_ON; | ||
| 941 | |||
| 942 | bus_register_notifier(&platform_bus_type, &acpi_lpss_nb); | ||
| 943 | acpi_scan_add_handler(&lpss_handler); | ||
| 761 | } | 944 | } |
| 762 | 945 | ||
| 763 | #else | 946 | #else |
diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c index 48fc3ad13a4b..67d97c0090a2 100644 --- a/drivers/acpi/acpi_pnp.c +++ b/drivers/acpi/acpi_pnp.c | |||
| @@ -367,7 +367,7 @@ static struct acpi_scan_handler acpi_pnp_handler = { | |||
| 367 | */ | 367 | */ |
| 368 | static int is_cmos_rtc_device(struct acpi_device *adev) | 368 | static int is_cmos_rtc_device(struct acpi_device *adev) |
| 369 | { | 369 | { |
| 370 | struct acpi_device_id ids[] = { | 370 | static const struct acpi_device_id ids[] = { |
| 371 | { "PNP0B00" }, | 371 | { "PNP0B00" }, |
| 372 | { "PNP0B01" }, | 372 | { "PNP0B01" }, |
| 373 | { "PNP0B02" }, | 373 | { "PNP0B02" }, |
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 3405f7a41e25..06a006ff89b0 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c | |||
| @@ -77,14 +77,21 @@ module_param(allow_duplicates, bool, 0644); | |||
| 77 | static int disable_backlight_sysfs_if = -1; | 77 | static int disable_backlight_sysfs_if = -1; |
| 78 | module_param(disable_backlight_sysfs_if, int, 0444); | 78 | module_param(disable_backlight_sysfs_if, int, 0444); |
| 79 | 79 | ||
| 80 | #define REPORT_OUTPUT_KEY_EVENTS 0x01 | ||
| 81 | #define REPORT_BRIGHTNESS_KEY_EVENTS 0x02 | ||
| 82 | static int report_key_events = -1; | ||
| 83 | module_param(report_key_events, int, 0644); | ||
| 84 | MODULE_PARM_DESC(report_key_events, | ||
| 85 | "0: none, 1: output changes, 2: brightness changes, 3: all"); | ||
| 86 | |||
| 80 | static bool device_id_scheme = false; | 87 | static bool device_id_scheme = false; |
| 81 | module_param(device_id_scheme, bool, 0444); | 88 | module_param(device_id_scheme, bool, 0444); |
| 82 | 89 | ||
| 83 | static bool only_lcd = false; | 90 | static bool only_lcd = false; |
| 84 | module_param(only_lcd, bool, 0444); | 91 | module_param(only_lcd, bool, 0444); |
| 85 | 92 | ||
| 86 | static int register_count; | 93 | static DECLARE_COMPLETION(register_done); |
| 87 | static DEFINE_MUTEX(register_count_mutex); | 94 | static DEFINE_MUTEX(register_done_mutex); |
| 88 | static struct mutex video_list_lock; | 95 | static struct mutex video_list_lock; |
| 89 | static struct list_head video_bus_head; | 96 | static struct list_head video_bus_head; |
| 90 | static int acpi_video_bus_add(struct acpi_device *device); | 97 | static int acpi_video_bus_add(struct acpi_device *device); |
| @@ -412,6 +419,13 @@ static int video_enable_only_lcd(const struct dmi_system_id *d) | |||
| 412 | return 0; | 419 | return 0; |
| 413 | } | 420 | } |
| 414 | 421 | ||
| 422 | static int video_set_report_key_events(const struct dmi_system_id *id) | ||
| 423 | { | ||
| 424 | if (report_key_events == -1) | ||
| 425 | report_key_events = (uintptr_t)id->driver_data; | ||
| 426 | return 0; | ||
| 427 | } | ||
| 428 | |||
| 415 | static struct dmi_system_id video_dmi_table[] = { | 429 | static struct dmi_system_id video_dmi_table[] = { |
| 416 | /* | 430 | /* |
| 417 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 | 431 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
| @@ -500,6 +514,24 @@ static struct dmi_system_id video_dmi_table[] = { | |||
| 500 | DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile M9410"), | 514 | DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile M9410"), |
| 501 | }, | 515 | }, |
| 502 | }, | 516 | }, |
| 517 | /* | ||
| 518 | * Some machines report wrong key events on the acpi-bus, suppress | ||
| 519 | * key event reporting on these. Note this is only intended to work | ||
| 520 | * around events which are plain wrong. In some cases we get double | ||
| 521 | * events, in this case acpi-video is considered the canonical source | ||
| 522 | * and the events from the other source should be filtered. E.g. | ||
| 523 | * by calling acpi_video_handles_brightness_key_presses() from the | ||
| 524 | * vendor acpi/wmi driver or by using /lib/udev/hwdb.d/60-keyboard.hwdb | ||
| 525 | */ | ||
| 526 | { | ||
| 527 | .callback = video_set_report_key_events, | ||
| 528 | .driver_data = (void *)((uintptr_t)REPORT_OUTPUT_KEY_EVENTS), | ||
| 529 | .ident = "Dell Vostro V131", | ||
| 530 | .matches = { | ||
| 531 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 532 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), | ||
| 533 | }, | ||
| 534 | }, | ||
| 503 | {} | 535 | {} |
| 504 | }; | 536 | }; |
| 505 | 537 | ||
| @@ -1480,7 +1512,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | |||
| 1480 | /* Something vetoed the keypress. */ | 1512 | /* Something vetoed the keypress. */ |
| 1481 | keycode = 0; | 1513 | keycode = 0; |
| 1482 | 1514 | ||
| 1483 | if (keycode) { | 1515 | if (keycode && (report_key_events & REPORT_OUTPUT_KEY_EVENTS)) { |
| 1484 | input_report_key(input, keycode, 1); | 1516 | input_report_key(input, keycode, 1); |
| 1485 | input_sync(input); | 1517 | input_sync(input); |
| 1486 | input_report_key(input, keycode, 0); | 1518 | input_report_key(input, keycode, 0); |
| @@ -1544,7 +1576,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 1544 | 1576 | ||
| 1545 | acpi_notifier_call_chain(device, event, 0); | 1577 | acpi_notifier_call_chain(device, event, 0); |
| 1546 | 1578 | ||
| 1547 | if (keycode) { | 1579 | if (keycode && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS)) { |
| 1548 | input_report_key(input, keycode, 1); | 1580 | input_report_key(input, keycode, 1); |
| 1549 | input_sync(input); | 1581 | input_sync(input); |
| 1550 | input_report_key(input, keycode, 0); | 1582 | input_report_key(input, keycode, 0); |
| @@ -2017,8 +2049,8 @@ int acpi_video_register(void) | |||
| 2017 | { | 2049 | { |
| 2018 | int ret = 0; | 2050 | int ret = 0; |
| 2019 | 2051 | ||
| 2020 | mutex_lock(®ister_count_mutex); | 2052 | mutex_lock(®ister_done_mutex); |
| 2021 | if (register_count) { | 2053 | if (completion_done(®ister_done)) { |
| 2022 | /* | 2054 | /* |
| 2023 | * if the function of acpi_video_register is already called, | 2055 | * if the function of acpi_video_register is already called, |
| 2024 | * don't register the acpi_vide_bus again and return no error. | 2056 | * don't register the acpi_vide_bus again and return no error. |
| @@ -2039,22 +2071,22 @@ int acpi_video_register(void) | |||
| 2039 | * When the acpi_video_bus is loaded successfully, increase | 2071 | * When the acpi_video_bus is loaded successfully, increase |
| 2040 | * the counter reference. | 2072 | * the counter reference. |
| 2041 | */ | 2073 | */ |
| 2042 | register_count = 1; | 2074 | complete(®ister_done); |
| 2043 | 2075 | ||
| 2044 | leave: | 2076 | leave: |
| 2045 | mutex_unlock(®ister_count_mutex); | 2077 | mutex_unlock(®ister_done_mutex); |
| 2046 | return ret; | 2078 | return ret; |
| 2047 | } | 2079 | } |
| 2048 | EXPORT_SYMBOL(acpi_video_register); | 2080 | EXPORT_SYMBOL(acpi_video_register); |
| 2049 | 2081 | ||
| 2050 | void acpi_video_unregister(void) | 2082 | void acpi_video_unregister(void) |
| 2051 | { | 2083 | { |
| 2052 | mutex_lock(®ister_count_mutex); | 2084 | mutex_lock(®ister_done_mutex); |
| 2053 | if (register_count) { | 2085 | if (completion_done(®ister_done)) { |
| 2054 | acpi_bus_unregister_driver(&acpi_video_bus); | 2086 | acpi_bus_unregister_driver(&acpi_video_bus); |
| 2055 | register_count = 0; | 2087 | reinit_completion(®ister_done); |
| 2056 | } | 2088 | } |
| 2057 | mutex_unlock(®ister_count_mutex); | 2089 | mutex_unlock(®ister_done_mutex); |
| 2058 | } | 2090 | } |
| 2059 | EXPORT_SYMBOL(acpi_video_unregister); | 2091 | EXPORT_SYMBOL(acpi_video_unregister); |
| 2060 | 2092 | ||
| @@ -2062,15 +2094,29 @@ void acpi_video_unregister_backlight(void) | |||
| 2062 | { | 2094 | { |
| 2063 | struct acpi_video_bus *video; | 2095 | struct acpi_video_bus *video; |
| 2064 | 2096 | ||
| 2065 | mutex_lock(®ister_count_mutex); | 2097 | mutex_lock(®ister_done_mutex); |
| 2066 | if (register_count) { | 2098 | if (completion_done(®ister_done)) { |
| 2067 | mutex_lock(&video_list_lock); | 2099 | mutex_lock(&video_list_lock); |
| 2068 | list_for_each_entry(video, &video_bus_head, entry) | 2100 | list_for_each_entry(video, &video_bus_head, entry) |
| 2069 | acpi_video_bus_unregister_backlight(video); | 2101 | acpi_video_bus_unregister_backlight(video); |
| 2070 | mutex_unlock(&video_list_lock); | 2102 | mutex_unlock(&video_list_lock); |
| 2071 | } | 2103 | } |
| 2072 | mutex_unlock(®ister_count_mutex); | 2104 | mutex_unlock(®ister_done_mutex); |
| 2105 | } | ||
| 2106 | |||
| 2107 | bool acpi_video_handles_brightness_key_presses(void) | ||
| 2108 | { | ||
| 2109 | bool have_video_busses; | ||
| 2110 | |||
| 2111 | wait_for_completion(®ister_done); | ||
| 2112 | mutex_lock(&video_list_lock); | ||
| 2113 | have_video_busses = !list_empty(&video_bus_head); | ||
| 2114 | mutex_unlock(&video_list_lock); | ||
| 2115 | |||
| 2116 | return have_video_busses && | ||
| 2117 | (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS); | ||
| 2073 | } | 2118 | } |
| 2119 | EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses); | ||
| 2074 | 2120 | ||
| 2075 | /* | 2121 | /* |
| 2076 | * This is kind of nasty. Hardware using Intel chipsets may require | 2122 | * This is kind of nasty. Hardware using Intel chipsets may require |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 885936f79542..f682374c19f4 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
| @@ -50,6 +50,7 @@ acpi-y += \ | |||
| 50 | exdump.o \ | 50 | exdump.o \ |
| 51 | exfield.o \ | 51 | exfield.o \ |
| 52 | exfldio.o \ | 52 | exfldio.o \ |
| 53 | exmisc.o \ | ||
| 53 | exmutex.o \ | 54 | exmutex.o \ |
| 54 | exnames.o \ | 55 | exnames.o \ |
| 55 | exoparg1.o \ | 56 | exoparg1.o \ |
| @@ -57,7 +58,6 @@ acpi-y += \ | |||
| 57 | exoparg3.o \ | 58 | exoparg3.o \ |
| 58 | exoparg6.o \ | 59 | exoparg6.o \ |
| 59 | exprep.o \ | 60 | exprep.o \ |
| 60 | exmisc.o \ | ||
| 61 | exregion.o \ | 61 | exregion.o \ |
| 62 | exresnte.o \ | 62 | exresnte.o \ |
| 63 | exresolv.o \ | 63 | exresolv.o \ |
| @@ -66,6 +66,7 @@ acpi-y += \ | |||
| 66 | exstoren.o \ | 66 | exstoren.o \ |
| 67 | exstorob.o \ | 67 | exstorob.o \ |
| 68 | exsystem.o \ | 68 | exsystem.o \ |
| 69 | extrace.o \ | ||
| 69 | exutils.o | 70 | exutils.o |
| 70 | 71 | ||
| 71 | acpi-y += \ | 72 | acpi-y += \ |
| @@ -196,7 +197,6 @@ acpi-$(ACPI_FUTURE_USAGE) += \ | |||
| 196 | dbfileio.o \ | 197 | dbfileio.o \ |
| 197 | dbtest.o \ | 198 | dbtest.o \ |
| 198 | utcache.o \ | 199 | utcache.o \ |
| 199 | utfileio.o \ | ||
| 200 | utprint.o \ | 200 | utprint.o \ |
| 201 | uttrack.o \ | 201 | uttrack.o \ |
| 202 | utuuid.o | 202 | utuuid.o |
diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h index e4cc48fbf4ee..8b4ff40a294c 100644 --- a/drivers/acpi/acpica/acapps.h +++ b/drivers/acpi/acpica/acapps.h | |||
| @@ -44,6 +44,8 @@ | |||
| 44 | #ifndef _ACAPPS | 44 | #ifndef _ACAPPS |
| 45 | #define _ACAPPS | 45 | #define _ACAPPS |
| 46 | 46 | ||
| 47 | #include <stdio.h> | ||
| 48 | |||
| 47 | /* Common info for tool signons */ | 49 | /* Common info for tool signons */ |
| 48 | 50 | ||
| 49 | #define ACPICA_NAME "Intel ACPI Component Architecture" | 51 | #define ACPICA_NAME "Intel ACPI Component Architecture" |
| @@ -85,11 +87,40 @@ | |||
| 85 | acpi_os_printf (description); | 87 | acpi_os_printf (description); |
| 86 | 88 | ||
| 87 | #define ACPI_OPTION(name, description) \ | 89 | #define ACPI_OPTION(name, description) \ |
| 88 | acpi_os_printf (" %-18s%s\n", name, description); | 90 | acpi_os_printf (" %-20s%s\n", name, description); |
| 91 | |||
| 92 | /* Check for unexpected exceptions */ | ||
| 93 | |||
| 94 | #define ACPI_CHECK_STATUS(name, status, expected) \ | ||
| 95 | if (status != expected) \ | ||
| 96 | { \ | ||
| 97 | acpi_os_printf ("Unexpected %s from %s (%s-%d)\n", \ | ||
| 98 | acpi_format_exception (status), #name, _acpi_module_name, __LINE__); \ | ||
| 99 | } | ||
| 100 | |||
| 101 | /* Check for unexpected non-AE_OK errors */ | ||
| 102 | |||
| 103 | #define ACPI_CHECK_OK(name, status) ACPI_CHECK_STATUS (name, status, AE_OK); | ||
| 89 | 104 | ||
| 90 | #define FILE_SUFFIX_DISASSEMBLY "dsl" | 105 | #define FILE_SUFFIX_DISASSEMBLY "dsl" |
| 91 | #define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */ | 106 | #define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */ |
| 92 | 107 | ||
| 108 | /* acfileio */ | ||
| 109 | |||
| 110 | acpi_status | ||
| 111 | ac_get_all_tables_from_file(char *filename, | ||
| 112 | u8 get_only_aml_tables, | ||
| 113 | struct acpi_new_table_desc **return_list_head); | ||
| 114 | |||
| 115 | u8 ac_is_file_binary(FILE * file); | ||
| 116 | |||
| 117 | acpi_status ac_validate_table_header(FILE * file, long table_offset); | ||
| 118 | |||
| 119 | /* Values for get_only_aml_tables */ | ||
| 120 | |||
| 121 | #define ACPI_GET_ONLY_AML_TABLES TRUE | ||
| 122 | #define ACPI_GET_ALL_TABLES FALSE | ||
| 123 | |||
| 93 | /* | 124 | /* |
| 94 | * getopt | 125 | * getopt |
| 95 | */ | 126 | */ |
| @@ -107,30 +138,6 @@ extern char *acpi_gbl_optarg; | |||
| 107 | */ | 138 | */ |
| 108 | u32 cm_get_file_size(ACPI_FILE file); | 139 | u32 cm_get_file_size(ACPI_FILE file); |
| 109 | 140 | ||
| 110 | #ifndef ACPI_DUMP_APP | ||
| 111 | /* | ||
| 112 | * adisasm | ||
| 113 | */ | ||
| 114 | acpi_status | ||
| 115 | ad_aml_disassemble(u8 out_to_file, | ||
| 116 | char *filename, char *prefix, char **out_filename); | ||
| 117 | |||
| 118 | void ad_print_statistics(void); | ||
| 119 | |||
| 120 | acpi_status ad_find_dsdt(u8 **dsdt_ptr, u32 *dsdt_length); | ||
| 121 | |||
| 122 | void ad_dump_tables(void); | ||
| 123 | |||
| 124 | acpi_status ad_get_local_tables(void); | ||
| 125 | |||
| 126 | acpi_status | ||
| 127 | ad_parse_table(struct acpi_table_header *table, | ||
| 128 | acpi_owner_id * owner_id, u8 load_table, u8 external); | ||
| 129 | |||
| 130 | acpi_status ad_display_tables(char *filename, struct acpi_table_header *table); | ||
| 131 | |||
| 132 | acpi_status ad_display_statistics(void); | ||
| 133 | |||
| 134 | /* | 141 | /* |
| 135 | * adwalk | 142 | * adwalk |
| 136 | */ | 143 | */ |
| @@ -168,6 +175,5 @@ char *ad_generate_filename(char *prefix, char *table_id); | |||
| 168 | void | 175 | void |
| 169 | ad_write_table(struct acpi_table_header *table, | 176 | ad_write_table(struct acpi_table_header *table, |
| 170 | u32 length, char *table_name, char *oem_table_id); | 177 | u32 length, char *table_name, char *oem_table_id); |
| 171 | #endif | ||
| 172 | 178 | ||
| 173 | #endif /* _ACAPPS */ | 179 | #endif /* _ACAPPS */ |
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index c928ba494c40..ecb05f1c1d5c 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
| @@ -80,9 +80,15 @@ struct acpi_db_execute_walk { | |||
| 80 | /* | 80 | /* |
| 81 | * dbxface - external debugger interfaces | 81 | * dbxface - external debugger interfaces |
| 82 | */ | 82 | */ |
| 83 | acpi_status | 83 | ACPI_DBR_DEPENDENT_RETURN_OK(acpi_status |
| 84 | acpi_db_single_step(struct acpi_walk_state *walk_state, | 84 | acpi_db_single_step(struct acpi_walk_state |
| 85 | union acpi_parse_object *op, u32 op_type); | 85 | *walk_state, |
| 86 | union acpi_parse_object *op, | ||
| 87 | u32 op_type)) | ||
| 88 | ACPI_DBR_DEPENDENT_RETURN_VOID(void | ||
| 89 | acpi_db_signal_break_point(struct | ||
| 90 | acpi_walk_state | ||
| 91 | *walk_state)) | ||
| 86 | 92 | ||
| 87 | /* | 93 | /* |
| 88 | * dbcmds - debug commands and output routines | 94 | * dbcmds - debug commands and output routines |
| @@ -182,11 +188,15 @@ void acpi_db_display_method_info(union acpi_parse_object *op); | |||
| 182 | 188 | ||
| 183 | void acpi_db_decode_and_display_object(char *target, char *output_type); | 189 | void acpi_db_decode_and_display_object(char *target, char *output_type); |
| 184 | 190 | ||
| 185 | void | 191 | ACPI_DBR_DEPENDENT_RETURN_VOID(void |
| 186 | acpi_db_display_result_object(union acpi_operand_object *obj_desc, | 192 | acpi_db_display_result_object(union |
| 187 | struct acpi_walk_state *walk_state); | 193 | acpi_operand_object |
| 194 | *obj_desc, | ||
| 195 | struct | ||
| 196 | acpi_walk_state | ||
| 197 | *walk_state)) | ||
| 188 | 198 | ||
| 189 | acpi_status acpi_db_display_all_methods(char *display_count_arg); | 199 | acpi_status acpi_db_display_all_methods(char *display_count_arg); |
| 190 | 200 | ||
| 191 | void acpi_db_display_arguments(void); | 201 | void acpi_db_display_arguments(void); |
| 192 | 202 | ||
| @@ -198,9 +208,13 @@ void acpi_db_display_calling_tree(void); | |||
| 198 | 208 | ||
| 199 | void acpi_db_display_object_type(char *object_arg); | 209 | void acpi_db_display_object_type(char *object_arg); |
| 200 | 210 | ||
| 201 | void | 211 | ACPI_DBR_DEPENDENT_RETURN_VOID(void |
| 202 | acpi_db_display_argument_object(union acpi_operand_object *obj_desc, | 212 | acpi_db_display_argument_object(union |
| 203 | struct acpi_walk_state *walk_state); | 213 | acpi_operand_object |
| 214 | *obj_desc, | ||
| 215 | struct | ||
| 216 | acpi_walk_state | ||
| 217 | *walk_state)) | ||
| 204 | 218 | ||
| 205 | /* | 219 | /* |
| 206 | * dbexec - debugger control method execution | 220 | * dbexec - debugger control method execution |
| @@ -231,10 +245,7 @@ void acpi_db_open_debug_file(char *name); | |||
| 231 | 245 | ||
| 232 | acpi_status acpi_db_load_acpi_table(char *filename); | 246 | acpi_status acpi_db_load_acpi_table(char *filename); |
| 233 | 247 | ||
| 234 | acpi_status | 248 | acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head); |
| 235 | acpi_db_get_table_from_file(char *filename, | ||
| 236 | struct acpi_table_header **table, | ||
| 237 | u8 must_be_aml_table); | ||
| 238 | 249 | ||
| 239 | /* | 250 | /* |
| 240 | * dbhistry - debugger HISTORY command | 251 | * dbhistry - debugger HISTORY command |
| @@ -257,7 +268,7 @@ acpi_db_command_dispatch(char *input_buffer, | |||
| 257 | 268 | ||
| 258 | void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); | 269 | void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); |
| 259 | 270 | ||
| 260 | acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op); | 271 | acpi_status acpi_db_user_commands(void); |
| 261 | 272 | ||
| 262 | char *acpi_db_get_next_token(char *string, | 273 | char *acpi_db_get_next_token(char *string, |
| 263 | char **next, acpi_object_type * return_type); | 274 | char **next, acpi_object_type * return_type); |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 228704b78657..d18f18409071 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
| @@ -161,6 +161,11 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 161 | /* | 161 | /* |
| 162 | * evhandler - Address space handling | 162 | * evhandler - Address space handling |
| 163 | */ | 163 | */ |
| 164 | union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type | ||
| 165 | space_id, | ||
| 166 | union acpi_operand_object | ||
| 167 | *handler_obj); | ||
| 168 | |||
| 164 | u8 | 169 | u8 |
| 165 | acpi_ev_has_default_handler(struct acpi_namespace_node *node, | 170 | acpi_ev_has_default_handler(struct acpi_namespace_node *node, |
| 166 | acpi_adr_space_type space_id); | 171 | acpi_adr_space_type space_id); |
| @@ -193,9 +198,11 @@ void | |||
| 193 | acpi_ev_detach_region(union acpi_operand_object *region_obj, | 198 | acpi_ev_detach_region(union acpi_operand_object *region_obj, |
| 194 | u8 acpi_ns_is_locked); | 199 | u8 acpi_ns_is_locked); |
| 195 | 200 | ||
| 196 | acpi_status | 201 | void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj); |
| 202 | |||
| 203 | void | ||
| 197 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | 204 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, |
| 198 | acpi_adr_space_type space_id); | 205 | acpi_adr_space_type space_id, u32 function); |
| 199 | 206 | ||
| 200 | acpi_status | 207 | acpi_status |
| 201 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); | 208 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index faa97604d878..73462cac41d2 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
| @@ -145,6 +145,7 @@ ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache); | |||
| 145 | 145 | ||
| 146 | ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0); | 146 | ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0); |
| 147 | ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE); | 147 | ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE); |
| 148 | ACPI_INIT_GLOBAL(u8, acpi_gbl_early_initialization, TRUE); | ||
| 148 | 149 | ||
| 149 | /* Global handlers */ | 150 | /* Global handlers */ |
| 150 | 151 | ||
| @@ -164,7 +165,7 @@ ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset); | |||
| 164 | 165 | ||
| 165 | /* Initialization sequencing */ | 166 | /* Initialization sequencing */ |
| 166 | 167 | ||
| 167 | ACPI_GLOBAL(u8, acpi_gbl_reg_methods_executed); | 168 | ACPI_INIT_GLOBAL(u8, acpi_gbl_reg_methods_enabled, FALSE); |
| 168 | 169 | ||
| 169 | /* Misc */ | 170 | /* Misc */ |
| 170 | 171 | ||
| @@ -326,7 +327,6 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list); | |||
| 326 | #ifdef ACPI_DEBUGGER | 327 | #ifdef ACPI_DEBUGGER |
| 327 | 328 | ||
| 328 | ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE); | 329 | ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE); |
| 329 | ACPI_INIT_GLOBAL(u8, acpi_gbl_method_executing, FALSE); | ||
| 330 | ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID); | 330 | ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID); |
| 331 | 331 | ||
| 332 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_ini_methods); | 332 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_ini_methods); |
| @@ -345,7 +345,6 @@ ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]); | |||
| 345 | 345 | ||
| 346 | /* These buffers should all be the same size */ | 346 | /* These buffers should all be the same size */ |
| 347 | 347 | ||
| 348 | ACPI_GLOBAL(char, acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]); | ||
| 349 | ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]); | 348 | ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]); |
| 350 | ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]); | 349 | ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]); |
| 351 | ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]); | 350 | ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]); |
| @@ -360,9 +359,6 @@ ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc); | |||
| 360 | ACPI_GLOBAL(u32, acpi_gbl_num_nodes); | 359 | ACPI_GLOBAL(u32, acpi_gbl_num_nodes); |
| 361 | ACPI_GLOBAL(u32, acpi_gbl_num_objects); | 360 | ACPI_GLOBAL(u32, acpi_gbl_num_objects); |
| 362 | 361 | ||
| 363 | ACPI_GLOBAL(acpi_mutex, acpi_gbl_db_command_ready); | ||
| 364 | ACPI_GLOBAL(acpi_mutex, acpi_gbl_db_command_complete); | ||
| 365 | |||
| 366 | #endif /* ACPI_DEBUGGER */ | 362 | #endif /* ACPI_DEBUGGER */ |
| 367 | 363 | ||
| 368 | /***************************************************************************** | 364 | /***************************************************************************** |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index e1dd784d8515..24928ec444de 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
| @@ -219,6 +219,13 @@ struct acpi_table_list { | |||
| 219 | #define ACPI_ROOT_ORIGIN_ALLOCATED (1) | 219 | #define ACPI_ROOT_ORIGIN_ALLOCATED (1) |
| 220 | #define ACPI_ROOT_ALLOW_RESIZE (2) | 220 | #define ACPI_ROOT_ALLOW_RESIZE (2) |
| 221 | 221 | ||
| 222 | /* List to manage incoming ACPI tables */ | ||
| 223 | |||
| 224 | struct acpi_new_table_desc { | ||
| 225 | struct acpi_table_header *table; | ||
| 226 | struct acpi_new_table_desc *next; | ||
| 227 | }; | ||
| 228 | |||
| 222 | /* Predefined table indexes */ | 229 | /* Predefined table indexes */ |
| 223 | 230 | ||
| 224 | #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF) | 231 | #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF) |
| @@ -388,7 +395,8 @@ union acpi_predefined_info { | |||
| 388 | 395 | ||
| 389 | /* Return object auto-repair info */ | 396 | /* Return object auto-repair info */ |
| 390 | 397 | ||
| 391 | typedef acpi_status(*acpi_object_converter) (union acpi_operand_object | 398 | typedef acpi_status(*acpi_object_converter) (struct acpi_namespace_node * scope, |
| 399 | union acpi_operand_object | ||
| 392 | *original_object, | 400 | *original_object, |
| 393 | union acpi_operand_object | 401 | union acpi_operand_object |
| 394 | **converted_object); | 402 | **converted_object); |
| @@ -420,6 +428,7 @@ struct acpi_simple_repair_info { | |||
| 420 | 428 | ||
| 421 | struct acpi_reg_walk_info { | 429 | struct acpi_reg_walk_info { |
| 422 | acpi_adr_space_type space_id; | 430 | acpi_adr_space_type space_id; |
| 431 | u32 function; | ||
| 423 | u32 reg_run_count; | 432 | u32 reg_run_count; |
| 424 | }; | 433 | }; |
| 425 | 434 | ||
| @@ -861,6 +870,7 @@ struct acpi_parse_state { | |||
| 861 | #define ACPI_PARSEOP_CLOSING_PAREN 0x10 | 870 | #define ACPI_PARSEOP_CLOSING_PAREN 0x10 |
| 862 | #define ACPI_PARSEOP_COMPOUND 0x20 | 871 | #define ACPI_PARSEOP_COMPOUND 0x20 |
| 863 | #define ACPI_PARSEOP_ASSIGNMENT 0x40 | 872 | #define ACPI_PARSEOP_ASSIGNMENT 0x40 |
| 873 | #define ACPI_PARSEOP_ELSEIF 0x80 | ||
| 864 | 874 | ||
| 865 | /***************************************************************************** | 875 | /***************************************************************************** |
| 866 | * | 876 | * |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index e85366ceb15a..bad5bca03acc 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
| @@ -401,17 +401,6 @@ | |||
| 401 | #endif | 401 | #endif |
| 402 | 402 | ||
| 403 | /* | 403 | /* |
| 404 | * Some code only gets executed when the debugger is built in. | ||
| 405 | * Note that this is entirely independent of whether the | ||
| 406 | * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. | ||
| 407 | */ | ||
| 408 | #ifdef ACPI_DEBUGGER | ||
| 409 | #define ACPI_DEBUGGER_EXEC(a) a | ||
| 410 | #else | ||
| 411 | #define ACPI_DEBUGGER_EXEC(a) | ||
| 412 | #endif | ||
| 413 | |||
| 414 | /* | ||
| 415 | * Macros used for ACPICA utilities only | 404 | * Macros used for ACPICA utilities only |
| 416 | */ | 405 | */ |
| 417 | 406 | ||
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 5d261c942a0d..d082e62d7308 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
| @@ -77,6 +77,7 @@ | |||
| 77 | /* Object is not a package element */ | 77 | /* Object is not a package element */ |
| 78 | 78 | ||
| 79 | #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX | 79 | #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX |
| 80 | #define ACPI_ALL_PACKAGE_ELEMENTS (ACPI_UINT32_MAX-1) | ||
| 80 | 81 | ||
| 81 | /* Always emit warning message, not dependent on node flags */ | 82 | /* Always emit warning message, not dependent on node flags */ |
| 82 | 83 | ||
| @@ -183,13 +184,20 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | |||
| 183 | union acpi_operand_object **return_object); | 184 | union acpi_operand_object **return_object); |
| 184 | 185 | ||
| 185 | acpi_status | 186 | acpi_status |
| 186 | acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, | 187 | acpi_ns_convert_to_unicode(struct acpi_namespace_node *scope, |
| 188 | union acpi_operand_object *original_object, | ||
| 187 | union acpi_operand_object **return_object); | 189 | union acpi_operand_object **return_object); |
| 188 | 190 | ||
| 189 | acpi_status | 191 | acpi_status |
| 190 | acpi_ns_convert_to_resource(union acpi_operand_object *original_object, | 192 | acpi_ns_convert_to_resource(struct acpi_namespace_node *scope, |
| 193 | union acpi_operand_object *original_object, | ||
| 191 | union acpi_operand_object **return_object); | 194 | union acpi_operand_object **return_object); |
| 192 | 195 | ||
| 196 | acpi_status | ||
| 197 | acpi_ns_convert_to_reference(struct acpi_namespace_node *scope, | ||
| 198 | union acpi_operand_object *original_object, | ||
| 199 | union acpi_operand_object **return_object); | ||
| 200 | |||
| 193 | /* | 201 | /* |
| 194 | * nsdump - Namespace dump/print utilities | 202 | * nsdump - Namespace dump/print utilities |
| 195 | */ | 203 | */ |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 0bd02c4a5f75..2b154cfbe136 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
| @@ -93,9 +93,10 @@ | |||
| 93 | #define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */ | 93 | #define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */ |
| 94 | #define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */ | 94 | #define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */ |
| 95 | #define AOPOBJ_DATA_VALID 0x04 /* Object is initialized and data is valid */ | 95 | #define AOPOBJ_DATA_VALID 0x04 /* Object is initialized and data is valid */ |
| 96 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ | 96 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized */ |
| 97 | #define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ | 97 | #define AOPOBJ_REG_CONNECTED 0x10 /* _REG was run */ |
| 98 | #define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ | 98 | #define AOPOBJ_SETUP_COMPLETE 0x20 /* Region setup is complete */ |
| 99 | #define AOPOBJ_INVALID 0x40 /* Host OS won't allow a Region address */ | ||
| 99 | 100 | ||
| 100 | /****************************************************************************** | 101 | /****************************************************************************** |
| 101 | * | 102 | * |
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h index f9acf92fa0bc..324512db62bf 100644 --- a/drivers/acpi/acpica/acopcode.h +++ b/drivers/acpi/acpica/acopcode.h | |||
| @@ -92,7 +92,7 @@ | |||
| 92 | #define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) | 92 | #define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) |
| 93 | #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | 93 | #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) |
| 94 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | 94 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) |
| 95 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) | 95 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_NAME_OR_REF,ARGP_TARGET) |
| 96 | #define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | 96 | #define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) |
| 97 | #define ARGP_CONTINUE_OP ARG_NONE | 97 | #define ARGP_CONTINUE_OP ARG_NONE |
| 98 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) | 98 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) |
| @@ -152,13 +152,14 @@ | |||
| 152 | #define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) | 152 | #define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) |
| 153 | #define ARGP_NOOP_OP ARG_NONE | 153 | #define ARGP_NOOP_OP ARG_NONE |
| 154 | #define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | 154 | #define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) |
| 155 | #define ARGP_OBJECT_TYPE_OP ARGP_LIST1 (ARGP_NAME_OR_REF) | ||
| 155 | #define ARGP_ONE_OP ARG_NONE | 156 | #define ARGP_ONE_OP ARG_NONE |
| 156 | #define ARGP_ONES_OP ARG_NONE | 157 | #define ARGP_ONES_OP ARG_NONE |
| 157 | #define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) | 158 | #define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) |
| 158 | #define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) | 159 | #define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) |
| 159 | #define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) | 160 | #define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) |
| 160 | #define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) | 161 | #define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) |
| 161 | #define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) | 162 | #define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_NAME_OR_REF) |
| 162 | #define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) | 163 | #define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) |
| 163 | #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) | 164 | #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) |
| 164 | #define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | 165 | #define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) |
| @@ -185,7 +186,6 @@ | |||
| 185 | #define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | 186 | #define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) |
| 186 | #define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | 187 | #define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) |
| 187 | #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | 188 | #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) |
| 188 | #define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
| 189 | #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) | 189 | #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) |
| 190 | #define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) | 190 | #define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) |
| 191 | #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | 191 | #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) |
| @@ -223,7 +223,7 @@ | |||
| 223 | #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) | 223 | #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) |
| 224 | #define ARGI_BYTE_OP ARGI_INVALID_OPCODE | 224 | #define ARGI_BYTE_OP ARGI_INVALID_OPCODE |
| 225 | #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE | 225 | #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE |
| 226 | #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) | 226 | #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_ANYTYPE, ARGI_ANYTYPE, ARGI_TARGETREF) |
| 227 | #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) | 227 | #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) |
| 228 | #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) | 228 | #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) |
| 229 | #define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE | 229 | #define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE |
| @@ -285,6 +285,7 @@ | |||
| 285 | #define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE | 285 | #define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE |
| 286 | #define ARGI_NOOP_OP ARG_NONE | 286 | #define ARGI_NOOP_OP ARG_NONE |
| 287 | #define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) | 287 | #define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) |
| 288 | #define ARGI_OBJECT_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) | ||
| 288 | #define ARGI_ONE_OP ARG_NONE | 289 | #define ARGI_ONE_OP ARG_NONE |
| 289 | #define ARGI_ONES_OP ARG_NONE | 290 | #define ARGI_ONES_OP ARG_NONE |
| 290 | #define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | 291 | #define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) |
| @@ -318,7 +319,6 @@ | |||
| 318 | #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | 319 | #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) |
| 319 | #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | 320 | #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) |
| 320 | #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) | 321 | #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) |
| 321 | #define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) | ||
| 322 | #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) | 322 | #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) |
| 323 | #define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | 323 | #define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) |
| 324 | #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) | 324 | #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) |
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h index 8fc8c7cea879..96d510a7feba 100644 --- a/drivers/acpi/acpica/acparser.h +++ b/drivers/acpi/acpica/acparser.h | |||
| @@ -92,7 +92,13 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
| 92 | acpi_status | 92 | acpi_status |
| 93 | acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | 93 | acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, |
| 94 | struct acpi_parse_state *parser_state, | 94 | struct acpi_parse_state *parser_state, |
| 95 | union acpi_parse_object *arg, u8 method_call); | 95 | union acpi_parse_object *arg, |
| 96 | u8 possible_method_call); | ||
| 97 | |||
| 98 | /* Values for u8 above */ | ||
| 99 | |||
| 100 | #define ACPI_NOT_METHOD_CALL FALSE | ||
| 101 | #define ACPI_POSSIBLE_METHOD_CALL TRUE | ||
| 96 | 102 | ||
| 97 | acpi_status | 103 | acpi_status |
| 98 | acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | 104 | acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 8b8fef6cc32d..9e84c05c0b91 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
| @@ -184,24 +184,24 @@ acpi_status acpi_ut_init_globals(void); | |||
| 184 | 184 | ||
| 185 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 185 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
| 186 | 186 | ||
| 187 | char *acpi_ut_get_mutex_name(u32 mutex_id); | 187 | const char *acpi_ut_get_mutex_name(u32 mutex_id); |
| 188 | 188 | ||
| 189 | const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type); | 189 | const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type); |
| 190 | #endif | 190 | #endif |
| 191 | 191 | ||
| 192 | char *acpi_ut_get_type_name(acpi_object_type type); | 192 | const char *acpi_ut_get_type_name(acpi_object_type type); |
| 193 | 193 | ||
| 194 | char *acpi_ut_get_node_name(void *object); | 194 | const char *acpi_ut_get_node_name(void *object); |
| 195 | 195 | ||
| 196 | char *acpi_ut_get_descriptor_name(void *object); | 196 | const char *acpi_ut_get_descriptor_name(void *object); |
| 197 | 197 | ||
| 198 | const char *acpi_ut_get_reference_name(union acpi_operand_object *object); | 198 | const char *acpi_ut_get_reference_name(union acpi_operand_object *object); |
| 199 | 199 | ||
| 200 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); | 200 | const char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); |
| 201 | 201 | ||
| 202 | char *acpi_ut_get_region_name(u8 space_id); | 202 | const char *acpi_ut_get_region_name(u8 space_id); |
| 203 | 203 | ||
| 204 | char *acpi_ut_get_event_name(u32 event_id); | 204 | const char *acpi_ut_get_event_name(u32 event_id); |
| 205 | 205 | ||
| 206 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); | 206 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); |
| 207 | 207 | ||
| @@ -353,14 +353,6 @@ acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node, | |||
| 353 | u8 method_count, u8 *out_values); | 353 | u8 method_count, u8 *out_values); |
| 354 | 354 | ||
| 355 | /* | 355 | /* |
| 356 | * utfileio - file operations | ||
| 357 | */ | ||
| 358 | #ifdef ACPI_APPLICATION | ||
| 359 | acpi_status | ||
| 360 | acpi_ut_read_table_from_file(char *filename, struct acpi_table_header **table); | ||
| 361 | #endif | ||
| 362 | |||
| 363 | /* | ||
| 364 | * utids - device ID support | 356 | * utids - device ID support |
| 365 | */ | 357 | */ |
| 366 | acpi_status | 358 | acpi_status |
| @@ -372,10 +364,6 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
| 372 | struct acpi_pnp_device_id ** return_id); | 364 | struct acpi_pnp_device_id ** return_id); |
| 373 | 365 | ||
| 374 | acpi_status | 366 | acpi_status |
| 375 | acpi_ut_execute_SUB(struct acpi_namespace_node *device_node, | ||
| 376 | struct acpi_pnp_device_id **return_id); | ||
| 377 | |||
| 378 | acpi_status | ||
| 379 | acpi_ut_execute_CID(struct acpi_namespace_node *device_node, | 367 | acpi_ut_execute_CID(struct acpi_namespace_node *device_node, |
| 380 | struct acpi_pnp_device_id_list ** return_cid_list); | 368 | struct acpi_pnp_device_id_list ** return_cid_list); |
| 381 | 369 | ||
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h index 883f20cfa698..ab9f3f1fbb0f 100644 --- a/drivers/acpi/acpica/amlcode.h +++ b/drivers/acpi/acpica/amlcode.h | |||
| @@ -120,7 +120,7 @@ | |||
| 120 | #define AML_CREATE_WORD_FIELD_OP (u16) 0x8b | 120 | #define AML_CREATE_WORD_FIELD_OP (u16) 0x8b |
| 121 | #define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c | 121 | #define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c |
| 122 | #define AML_CREATE_BIT_FIELD_OP (u16) 0x8d | 122 | #define AML_CREATE_BIT_FIELD_OP (u16) 0x8d |
| 123 | #define AML_TYPE_OP (u16) 0x8e | 123 | #define AML_OBJECT_TYPE_OP (u16) 0x8e |
| 124 | #define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ | 124 | #define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ |
| 125 | #define AML_LAND_OP (u16) 0x90 | 125 | #define AML_LAND_OP (u16) 0x90 |
| 126 | #define AML_LOR_OP (u16) 0x91 | 126 | #define AML_LOR_OP (u16) 0x91 |
| @@ -238,7 +238,8 @@ | |||
| 238 | #define ARGP_TERMLIST 0x0F | 238 | #define ARGP_TERMLIST 0x0F |
| 239 | #define ARGP_WORDDATA 0x10 | 239 | #define ARGP_WORDDATA 0x10 |
| 240 | #define ARGP_QWORDDATA 0x11 | 240 | #define ARGP_QWORDDATA 0x11 |
| 241 | #define ARGP_SIMPLENAME 0x12 | 241 | #define ARGP_SIMPLENAME 0x12 /* name_string | local_term | arg_term */ |
| 242 | #define ARGP_NAME_OR_REF 0x13 /* For object_type only */ | ||
| 242 | 243 | ||
| 243 | /* | 244 | /* |
| 244 | * Resolved argument types for the AML Interpreter | 245 | * Resolved argument types for the AML Interpreter |
diff --git a/drivers/acpi/acpica/dbcmds.c b/drivers/acpi/acpica/dbcmds.c index 30414b3d7fdd..328c35b323d5 100644 --- a/drivers/acpi/acpica/dbcmds.c +++ b/drivers/acpi/acpica/dbcmds.c | |||
| @@ -798,7 +798,7 @@ acpi_db_device_resources(acpi_handle obj_handle, | |||
| 798 | acpi_status status; | 798 | acpi_status status; |
| 799 | 799 | ||
| 800 | node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); | 800 | node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); |
| 801 | parent_path = acpi_ns_get_external_pathname(node); | 801 | parent_path = acpi_ns_get_normalized_pathname(node, TRUE); |
| 802 | if (!parent_path) { | 802 | if (!parent_path) { |
| 803 | return (AE_NO_MEMORY); | 803 | return (AE_NO_MEMORY); |
| 804 | } | 804 | } |
| @@ -1131,13 +1131,8 @@ void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg) | |||
| 1131 | u32 debug_layer = 0; | 1131 | u32 debug_layer = 0; |
| 1132 | u32 flags = 0; | 1132 | u32 flags = 0; |
| 1133 | 1133 | ||
| 1134 | if (enable_arg) { | 1134 | acpi_ut_strupr(enable_arg); |
| 1135 | acpi_ut_strupr(enable_arg); | 1135 | acpi_ut_strupr(once_arg); |
| 1136 | } | ||
| 1137 | |||
| 1138 | if (once_arg) { | ||
| 1139 | acpi_ut_strupr(once_arg); | ||
| 1140 | } | ||
| 1141 | 1136 | ||
| 1142 | if (method_arg) { | 1137 | if (method_arg) { |
| 1143 | if (acpi_db_trace_method_name) { | 1138 | if (acpi_db_trace_method_name) { |
diff --git a/drivers/acpi/acpica/dbdisply.c b/drivers/acpi/acpica/dbdisply.c index 672977ec7c7d..1965b48d8e83 100644 --- a/drivers/acpi/acpica/dbdisply.c +++ b/drivers/acpi/acpica/dbdisply.c | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | #include "acnamesp.h" | 48 | #include "acnamesp.h" |
| 49 | #include "acparser.h" | 49 | #include "acparser.h" |
| 50 | #include "acinterp.h" | 50 | #include "acinterp.h" |
| 51 | #include "acevents.h" | ||
| 51 | #include "acdebug.h" | 52 | #include "acdebug.h" |
| 52 | 53 | ||
| 53 | #define _COMPONENT ACPI_CA_DEBUGGER | 54 | #define _COMPONENT ACPI_CA_DEBUGGER |
| @@ -588,7 +589,7 @@ void acpi_db_display_calling_tree(void) | |||
| 588 | * | 589 | * |
| 589 | * FUNCTION: acpi_db_display_object_type | 590 | * FUNCTION: acpi_db_display_object_type |
| 590 | * | 591 | * |
| 591 | * PARAMETERS: name - User entered NS node handle or name | 592 | * PARAMETERS: object_arg - User entered NS node handle |
| 592 | * | 593 | * |
| 593 | * RETURN: None | 594 | * RETURN: None |
| 594 | * | 595 | * |
| @@ -596,44 +597,34 @@ void acpi_db_display_calling_tree(void) | |||
| 596 | * | 597 | * |
| 597 | ******************************************************************************/ | 598 | ******************************************************************************/ |
| 598 | 599 | ||
| 599 | void acpi_db_display_object_type(char *name) | 600 | void acpi_db_display_object_type(char *object_arg) |
| 600 | { | 601 | { |
| 601 | struct acpi_namespace_node *node; | 602 | acpi_handle handle; |
| 602 | struct acpi_device_info *info; | 603 | struct acpi_device_info *info; |
| 603 | acpi_status status; | 604 | acpi_status status; |
| 604 | u32 i; | 605 | u32 i; |
| 605 | 606 | ||
| 606 | node = acpi_db_convert_to_node(name); | 607 | handle = ACPI_TO_POINTER(strtoul(object_arg, NULL, 16)); |
| 607 | if (!node) { | ||
| 608 | return; | ||
| 609 | } | ||
| 610 | 608 | ||
| 611 | status = acpi_get_object_info(ACPI_CAST_PTR(acpi_handle, node), &info); | 609 | status = acpi_get_object_info(handle, &info); |
| 612 | if (ACPI_FAILURE(status)) { | 610 | if (ACPI_FAILURE(status)) { |
| 613 | acpi_os_printf("Could not get object info, %s\n", | 611 | acpi_os_printf("Could not get object info, %s\n", |
| 614 | acpi_format_exception(status)); | 612 | acpi_format_exception(status)); |
| 615 | return; | 613 | return; |
| 616 | } | 614 | } |
| 617 | 615 | ||
| 618 | if (info->valid & ACPI_VALID_ADR) { | 616 | acpi_os_printf("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", |
| 619 | acpi_os_printf("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", | 617 | ACPI_FORMAT_UINT64(info->address), |
| 620 | ACPI_FORMAT_UINT64(info->address), | 618 | info->current_status, info->flags); |
| 621 | info->current_status, info->flags); | 619 | |
| 622 | } | 620 | acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", |
| 623 | if (info->valid & ACPI_VALID_SXDS) { | 621 | info->highest_dstates[0], info->highest_dstates[1], |
| 624 | acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", | 622 | info->highest_dstates[2], info->highest_dstates[3]); |
| 625 | info->highest_dstates[0], | 623 | |
| 626 | info->highest_dstates[1], | 624 | acpi_os_printf("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", |
| 627 | info->highest_dstates[2], | 625 | info->lowest_dstates[0], info->lowest_dstates[1], |
| 628 | info->highest_dstates[3]); | 626 | info->lowest_dstates[2], info->lowest_dstates[3], |
| 629 | } | 627 | info->lowest_dstates[4]); |
| 630 | if (info->valid & ACPI_VALID_SXWS) { | ||
| 631 | acpi_os_printf | ||
| 632 | ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", | ||
| 633 | info->lowest_dstates[0], info->lowest_dstates[1], | ||
| 634 | info->lowest_dstates[2], info->lowest_dstates[3], | ||
| 635 | info->lowest_dstates[4]); | ||
| 636 | } | ||
| 637 | 628 | ||
| 638 | if (info->valid & ACPI_VALID_HID) { | 629 | if (info->valid & ACPI_VALID_HID) { |
| 639 | acpi_os_printf("HID: %s\n", info->hardware_id.string); | 630 | acpi_os_printf("HID: %s\n", info->hardware_id.string); |
| @@ -643,10 +634,6 @@ void acpi_db_display_object_type(char *name) | |||
| 643 | acpi_os_printf("UID: %s\n", info->unique_id.string); | 634 | acpi_os_printf("UID: %s\n", info->unique_id.string); |
| 644 | } | 635 | } |
| 645 | 636 | ||
| 646 | if (info->valid & ACPI_VALID_SUB) { | ||
| 647 | acpi_os_printf("SUB: %s\n", info->subsystem_id.string); | ||
| 648 | } | ||
| 649 | |||
| 650 | if (info->valid & ACPI_VALID_CID) { | 637 | if (info->valid & ACPI_VALID_CID) { |
| 651 | for (i = 0; i < info->compatible_id_list.count; i++) { | 638 | for (i = 0; i < info->compatible_id_list.count; i++) { |
| 652 | acpi_os_printf("CID %u: %s\n", i, | 639 | acpi_os_printf("CID %u: %s\n", i, |
| @@ -679,6 +666,12 @@ acpi_db_display_result_object(union acpi_operand_object *obj_desc, | |||
| 679 | struct acpi_walk_state *walk_state) | 666 | struct acpi_walk_state *walk_state) |
| 680 | { | 667 | { |
| 681 | 668 | ||
| 669 | #ifndef ACPI_APPLICATION | ||
| 670 | if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { | ||
| 671 | return; | ||
| 672 | } | ||
| 673 | #endif | ||
| 674 | |||
| 682 | /* Only display if single stepping */ | 675 | /* Only display if single stepping */ |
| 683 | 676 | ||
| 684 | if (!acpi_gbl_cm_single_step) { | 677 | if (!acpi_gbl_cm_single_step) { |
| @@ -708,6 +701,12 @@ acpi_db_display_argument_object(union acpi_operand_object *obj_desc, | |||
| 708 | struct acpi_walk_state *walk_state) | 701 | struct acpi_walk_state *walk_state) |
| 709 | { | 702 | { |
| 710 | 703 | ||
| 704 | #ifndef ACPI_APPLICATION | ||
| 705 | if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { | ||
| 706 | return; | ||
| 707 | } | ||
| 708 | #endif | ||
| 709 | |||
| 711 | if (!acpi_gbl_cm_single_step) { | 710 | if (!acpi_gbl_cm_single_step) { |
| 712 | return; | 711 | return; |
| 713 | } | 712 | } |
| @@ -951,28 +950,25 @@ void acpi_db_display_handlers(void) | |||
| 951 | if (obj_desc) { | 950 | if (obj_desc) { |
| 952 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list); i++) { | 951 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list); i++) { |
| 953 | space_id = acpi_gbl_space_id_list[i]; | 952 | space_id = acpi_gbl_space_id_list[i]; |
| 954 | handler_obj = obj_desc->device.handler; | ||
| 955 | 953 | ||
| 956 | acpi_os_printf(ACPI_PREDEFINED_PREFIX, | 954 | acpi_os_printf(ACPI_PREDEFINED_PREFIX, |
| 957 | acpi_ut_get_region_name((u8)space_id), | 955 | acpi_ut_get_region_name((u8)space_id), |
| 958 | space_id); | 956 | space_id); |
| 959 | 957 | ||
| 960 | while (handler_obj) { | 958 | handler_obj = |
| 961 | if (acpi_gbl_space_id_list[i] == | 959 | acpi_ev_find_region_handler(space_id, |
| 962 | handler_obj->address_space.space_id) { | 960 | obj_desc->common_notify. |
| 963 | acpi_os_printf | 961 | handler); |
| 964 | (ACPI_HANDLER_PRESENT_STRING, | 962 | if (handler_obj) { |
| 965 | (handler_obj->address_space. | 963 | acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, |
| 966 | handler_flags & | 964 | (handler_obj->address_space. |
| 967 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) | 965 | handler_flags & |
| 968 | ? "Default" : "User", | 966 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) |
| 969 | handler_obj->address_space. | 967 | ? "Default" : "User", |
| 970 | handler); | 968 | handler_obj->address_space. |
| 971 | 969 | handler); | |
| 972 | goto found_handler; | ||
| 973 | } | ||
| 974 | 970 | ||
| 975 | handler_obj = handler_obj->address_space.next; | 971 | goto found_handler; |
| 976 | } | 972 | } |
| 977 | 973 | ||
| 978 | /* There is no handler for this space_id */ | 974 | /* There is no handler for this space_id */ |
| @@ -984,7 +980,7 @@ found_handler: ; | |||
| 984 | 980 | ||
| 985 | /* Find all handlers for user-defined space_IDs */ | 981 | /* Find all handlers for user-defined space_IDs */ |
| 986 | 982 | ||
| 987 | handler_obj = obj_desc->device.handler; | 983 | handler_obj = obj_desc->common_notify.handler; |
| 988 | while (handler_obj) { | 984 | while (handler_obj) { |
| 989 | if (handler_obj->address_space.space_id >= | 985 | if (handler_obj->address_space.space_id >= |
| 990 | ACPI_USER_REGION_BEGIN) { | 986 | ACPI_USER_REGION_BEGIN) { |
| @@ -1079,14 +1075,14 @@ acpi_db_display_non_root_handlers(acpi_handle obj_handle, | |||
| 1079 | return (AE_OK); | 1075 | return (AE_OK); |
| 1080 | } | 1076 | } |
| 1081 | 1077 | ||
| 1082 | pathname = acpi_ns_get_external_pathname(node); | 1078 | pathname = acpi_ns_get_normalized_pathname(node, TRUE); |
| 1083 | if (!pathname) { | 1079 | if (!pathname) { |
| 1084 | return (AE_OK); | 1080 | return (AE_OK); |
| 1085 | } | 1081 | } |
| 1086 | 1082 | ||
| 1087 | /* Display all handlers associated with this device */ | 1083 | /* Display all handlers associated with this device */ |
| 1088 | 1084 | ||
| 1089 | handler_obj = obj_desc->device.handler; | 1085 | handler_obj = obj_desc->common_notify.handler; |
| 1090 | while (handler_obj) { | 1086 | while (handler_obj) { |
| 1091 | acpi_os_printf(ACPI_PREDEFINED_PREFIX, | 1087 | acpi_os_printf(ACPI_PREDEFINED_PREFIX, |
| 1092 | acpi_ut_get_region_name((u8)handler_obj-> | 1088 | acpi_ut_get_region_name((u8)handler_obj-> |
diff --git a/drivers/acpi/acpica/dbfileio.c b/drivers/acpi/acpica/dbfileio.c index d0e6b20ce82a..31f54d71c51a 100644 --- a/drivers/acpi/acpica/dbfileio.c +++ b/drivers/acpi/acpica/dbfileio.c | |||
| @@ -46,6 +46,10 @@ | |||
| 46 | #include "accommon.h" | 46 | #include "accommon.h" |
| 47 | #include "acdebug.h" | 47 | #include "acdebug.h" |
| 48 | #include "actables.h" | 48 | #include "actables.h" |
| 49 | #include <stdio.h> | ||
| 50 | #ifdef ACPI_APPLICATION | ||
| 51 | #include "acapps.h" | ||
| 52 | #endif | ||
| 49 | 53 | ||
| 50 | #define _COMPONENT ACPI_CA_DEBUGGER | 54 | #define _COMPONENT ACPI_CA_DEBUGGER |
| 51 | ACPI_MODULE_NAME("dbfileio") | 55 | ACPI_MODULE_NAME("dbfileio") |
| @@ -110,122 +114,31 @@ void acpi_db_open_debug_file(char *name) | |||
| 110 | } | 114 | } |
| 111 | #endif | 115 | #endif |
| 112 | 116 | ||
| 113 | #ifdef ACPI_APPLICATION | ||
| 114 | #include "acapps.h" | ||
| 115 | |||
| 116 | /******************************************************************************* | ||
| 117 | * | ||
| 118 | * FUNCTION: ae_local_load_table | ||
| 119 | * | ||
| 120 | * PARAMETERS: table - pointer to a buffer containing the entire | ||
| 121 | * table to be loaded | ||
| 122 | * | ||
| 123 | * RETURN: Status | ||
| 124 | * | ||
| 125 | * DESCRIPTION: This function is called to load a table from the caller's | ||
| 126 | * buffer. The buffer must contain an entire ACPI Table including | ||
| 127 | * a valid header. The header fields will be verified, and if it | ||
| 128 | * is determined that the table is invalid, the call will fail. | ||
| 129 | * | ||
| 130 | ******************************************************************************/ | ||
| 131 | |||
| 132 | static acpi_status ae_local_load_table(struct acpi_table_header *table) | ||
| 133 | { | ||
| 134 | acpi_status status = AE_OK; | ||
| 135 | |||
| 136 | ACPI_FUNCTION_TRACE(ae_local_load_table); | ||
| 137 | |||
| 138 | #if 0 | ||
| 139 | /* struct acpi_table_desc table_info; */ | ||
| 140 | |||
| 141 | if (!table) { | ||
| 142 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 143 | } | ||
| 144 | |||
| 145 | table_info.pointer = table; | ||
| 146 | status = acpi_tb_recognize_table(&table_info, ACPI_TABLE_ALL); | ||
| 147 | if (ACPI_FAILURE(status)) { | ||
| 148 | return_ACPI_STATUS(status); | ||
| 149 | } | ||
| 150 | |||
| 151 | /* Install the new table into the local data structures */ | ||
| 152 | |||
| 153 | status = acpi_tb_init_table_descriptor(&table_info); | ||
| 154 | if (ACPI_FAILURE(status)) { | ||
| 155 | if (status == AE_ALREADY_EXISTS) { | ||
| 156 | |||
| 157 | /* Table already exists, no error */ | ||
| 158 | |||
| 159 | status = AE_OK; | ||
| 160 | } | ||
| 161 | |||
| 162 | /* Free table allocated by acpi_tb_get_table */ | ||
| 163 | |||
| 164 | acpi_tb_delete_single_table(&table_info); | ||
| 165 | return_ACPI_STATUS(status); | ||
| 166 | } | ||
| 167 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) | ||
| 168 | |||
| 169 | status = | ||
| 170 | acpi_ns_load_table(table_info.installed_desc, acpi_gbl_root_node); | ||
| 171 | if (ACPI_FAILURE(status)) { | ||
| 172 | |||
| 173 | /* Uninstall table and free the buffer */ | ||
| 174 | |||
| 175 | acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_DSDT); | ||
| 176 | return_ACPI_STATUS(status); | ||
| 177 | } | ||
| 178 | #endif | ||
| 179 | #endif | ||
| 180 | |||
| 181 | return_ACPI_STATUS(status); | ||
| 182 | } | ||
| 183 | #endif | ||
| 184 | |||
| 185 | /******************************************************************************* | 117 | /******************************************************************************* |
| 186 | * | 118 | * |
| 187 | * FUNCTION: acpi_db_get_table_from_file | 119 | * FUNCTION: acpi_db_load_tables |
| 188 | * | 120 | * |
| 189 | * PARAMETERS: filename - File where table is located | 121 | * PARAMETERS: list_head - List of ACPI tables to load |
| 190 | * return_table - Where a pointer to the table is returned | ||
| 191 | * | 122 | * |
| 192 | * RETURN: Status | 123 | * RETURN: Status |
| 193 | * | 124 | * |
| 194 | * DESCRIPTION: Load an ACPI table from a file | 125 | * DESCRIPTION: Load ACPI tables from a previously constructed table list. |
| 195 | * | 126 | * |
| 196 | ******************************************************************************/ | 127 | ******************************************************************************/ |
| 197 | 128 | ||
| 198 | acpi_status | 129 | acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head) |
| 199 | acpi_db_get_table_from_file(char *filename, | ||
| 200 | struct acpi_table_header **return_table, | ||
| 201 | u8 must_be_aml_file) | ||
| 202 | { | 130 | { |
| 203 | #ifdef ACPI_APPLICATION | ||
| 204 | acpi_status status; | 131 | acpi_status status; |
| 132 | struct acpi_new_table_desc *table_list_head; | ||
| 205 | struct acpi_table_header *table; | 133 | struct acpi_table_header *table; |
| 206 | u8 is_aml_table = TRUE; | ||
| 207 | |||
| 208 | status = acpi_ut_read_table_from_file(filename, &table); | ||
| 209 | if (ACPI_FAILURE(status)) { | ||
| 210 | return (status); | ||
| 211 | } | ||
| 212 | |||
| 213 | if (must_be_aml_file) { | ||
| 214 | is_aml_table = acpi_ut_is_aml_table(table); | ||
| 215 | if (!is_aml_table) { | ||
| 216 | ACPI_EXCEPTION((AE_INFO, AE_OK, | ||
| 217 | "Input for -e is not an AML table: " | ||
| 218 | "\"%4.4s\" (must be DSDT/SSDT)", | ||
| 219 | table->signature)); | ||
| 220 | return (AE_TYPE); | ||
| 221 | } | ||
| 222 | } | ||
| 223 | 134 | ||
| 224 | if (is_aml_table) { | 135 | /* Load all ACPI tables in the list */ |
| 225 | 136 | ||
| 226 | /* Attempt to recognize and install the table */ | 137 | table_list_head = list_head; |
| 138 | while (table_list_head) { | ||
| 139 | table = table_list_head->table; | ||
| 227 | 140 | ||
| 228 | status = ae_local_load_table(table); | 141 | status = acpi_load_table(table); |
| 229 | if (ACPI_FAILURE(status)) { | 142 | if (ACPI_FAILURE(status)) { |
| 230 | if (status == AE_ALREADY_EXISTS) { | 143 | if (status == AE_ALREADY_EXISTS) { |
| 231 | acpi_os_printf | 144 | acpi_os_printf |
| @@ -239,18 +152,12 @@ acpi_db_get_table_from_file(char *filename, | |||
| 239 | return (status); | 152 | return (status); |
| 240 | } | 153 | } |
| 241 | 154 | ||
| 242 | acpi_tb_print_table_header(0, table); | ||
| 243 | |||
| 244 | fprintf(stderr, | 155 | fprintf(stderr, |
| 245 | "Acpi table [%4.4s] successfully installed and loaded\n", | 156 | "Acpi table [%4.4s] successfully installed and loaded\n", |
| 246 | table->signature); | 157 | table->signature); |
| 247 | } | ||
| 248 | 158 | ||
| 249 | acpi_gbl_acpi_hardware_present = FALSE; | 159 | table_list_head = table_list_head->next; |
| 250 | if (return_table) { | ||
| 251 | *return_table = table; | ||
| 252 | } | 160 | } |
| 253 | 161 | ||
| 254 | #endif /* ACPI_APPLICATION */ | ||
| 255 | return (AE_OK); | 162 | return (AE_OK); |
| 256 | } | 163 | } |
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c index 0480254437f1..6203001baa30 100644 --- a/drivers/acpi/acpica/dbinput.c +++ b/drivers/acpi/acpica/dbinput.c | |||
| @@ -45,6 +45,10 @@ | |||
| 45 | #include "accommon.h" | 45 | #include "accommon.h" |
| 46 | #include "acdebug.h" | 46 | #include "acdebug.h" |
| 47 | 47 | ||
| 48 | #ifdef ACPI_APPLICATION | ||
| 49 | #include "acapps.h" | ||
| 50 | #endif | ||
| 51 | |||
| 48 | #define _COMPONENT ACPI_CA_DEBUGGER | 52 | #define _COMPONENT ACPI_CA_DEBUGGER |
| 49 | ACPI_MODULE_NAME("dbinput") | 53 | ACPI_MODULE_NAME("dbinput") |
| 50 | 54 | ||
| @@ -53,8 +57,6 @@ static u32 acpi_db_get_line(char *input_buffer); | |||
| 53 | 57 | ||
| 54 | static u32 acpi_db_match_command(char *user_command); | 58 | static u32 acpi_db_match_command(char *user_command); |
| 55 | 59 | ||
| 56 | static void acpi_db_single_thread(void); | ||
| 57 | |||
| 58 | static void acpi_db_display_command_info(char *command, u8 display_all); | 60 | static void acpi_db_display_command_info(char *command, u8 display_all); |
| 59 | 61 | ||
| 60 | static void acpi_db_display_help(char *command); | 62 | static void acpi_db_display_help(char *command); |
| @@ -623,9 +625,7 @@ static u32 acpi_db_get_line(char *input_buffer) | |||
| 623 | 625 | ||
| 624 | /* Uppercase the actual command */ | 626 | /* Uppercase the actual command */ |
| 625 | 627 | ||
| 626 | if (acpi_gbl_db_args[0]) { | 628 | acpi_ut_strupr(acpi_gbl_db_args[0]); |
| 627 | acpi_ut_strupr(acpi_gbl_db_args[0]); | ||
| 628 | } | ||
| 629 | 629 | ||
| 630 | count = i; | 630 | count = i; |
| 631 | if (count) { | 631 | if (count) { |
| @@ -1050,11 +1050,17 @@ acpi_db_command_dispatch(char *input_buffer, | |||
| 1050 | acpi_db_close_debug_file(); | 1050 | acpi_db_close_debug_file(); |
| 1051 | break; | 1051 | break; |
| 1052 | 1052 | ||
| 1053 | case CMD_LOAD: | 1053 | case CMD_LOAD:{ |
| 1054 | struct acpi_new_table_desc *list_head = NULL; | ||
| 1054 | 1055 | ||
| 1055 | status = | 1056 | status = |
| 1056 | acpi_db_get_table_from_file(acpi_gbl_db_args[1], NULL, | 1057 | ac_get_all_tables_from_file(acpi_gbl_db_args[1], |
| 1057 | FALSE); | 1058 | ACPI_GET_ALL_TABLES, |
| 1059 | &list_head); | ||
| 1060 | if (ACPI_SUCCESS(status)) { | ||
| 1061 | acpi_db_load_tables(list_head); | ||
| 1062 | } | ||
| 1063 | } | ||
| 1058 | break; | 1064 | break; |
| 1059 | 1065 | ||
| 1060 | case CMD_OPEN: | 1066 | case CMD_OPEN: |
| @@ -1149,55 +1155,16 @@ acpi_db_command_dispatch(char *input_buffer, | |||
| 1149 | 1155 | ||
| 1150 | void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context) | 1156 | void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context) |
| 1151 | { | 1157 | { |
| 1152 | acpi_status status = AE_OK; | ||
| 1153 | acpi_status Mstatus; | ||
| 1154 | |||
| 1155 | while (status != AE_CTRL_TERMINATE && !acpi_gbl_db_terminate_loop) { | ||
| 1156 | acpi_gbl_method_executing = FALSE; | ||
| 1157 | acpi_gbl_step_to_next_call = FALSE; | ||
| 1158 | |||
| 1159 | Mstatus = acpi_os_acquire_mutex(acpi_gbl_db_command_ready, | ||
| 1160 | ACPI_WAIT_FOREVER); | ||
| 1161 | if (ACPI_FAILURE(Mstatus)) { | ||
| 1162 | return; | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | status = | ||
| 1166 | acpi_db_command_dispatch(acpi_gbl_db_line_buf, NULL, NULL); | ||
| 1167 | 1158 | ||
| 1168 | acpi_os_release_mutex(acpi_gbl_db_command_complete); | 1159 | (void)acpi_db_user_commands(); |
| 1169 | } | ||
| 1170 | acpi_gbl_db_threads_terminated = TRUE; | 1160 | acpi_gbl_db_threads_terminated = TRUE; |
| 1171 | } | 1161 | } |
| 1172 | 1162 | ||
| 1173 | /******************************************************************************* | 1163 | /******************************************************************************* |
| 1174 | * | 1164 | * |
| 1175 | * FUNCTION: acpi_db_single_thread | ||
| 1176 | * | ||
| 1177 | * PARAMETERS: None | ||
| 1178 | * | ||
| 1179 | * RETURN: None | ||
| 1180 | * | ||
| 1181 | * DESCRIPTION: Debugger execute thread. Waits for a command line, then | ||
| 1182 | * simply dispatches it. | ||
| 1183 | * | ||
| 1184 | ******************************************************************************/ | ||
| 1185 | |||
| 1186 | static void acpi_db_single_thread(void) | ||
| 1187 | { | ||
| 1188 | |||
| 1189 | acpi_gbl_method_executing = FALSE; | ||
| 1190 | acpi_gbl_step_to_next_call = FALSE; | ||
| 1191 | |||
| 1192 | (void)acpi_db_command_dispatch(acpi_gbl_db_line_buf, NULL, NULL); | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | /******************************************************************************* | ||
| 1196 | * | ||
| 1197 | * FUNCTION: acpi_db_user_commands | 1165 | * FUNCTION: acpi_db_user_commands |
| 1198 | * | 1166 | * |
| 1199 | * PARAMETERS: prompt - User prompt (depends on mode) | 1167 | * PARAMETERS: None |
| 1200 | * op - Current executing parse op | ||
| 1201 | * | 1168 | * |
| 1202 | * RETURN: None | 1169 | * RETURN: None |
| 1203 | * | 1170 | * |
| @@ -1206,7 +1173,7 @@ static void acpi_db_single_thread(void) | |||
| 1206 | * | 1173 | * |
| 1207 | ******************************************************************************/ | 1174 | ******************************************************************************/ |
| 1208 | 1175 | ||
| 1209 | acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op) | 1176 | acpi_status acpi_db_user_commands(void) |
| 1210 | { | 1177 | { |
| 1211 | acpi_status status = AE_OK; | 1178 | acpi_status status = AE_OK; |
| 1212 | 1179 | ||
| @@ -1216,52 +1183,31 @@ acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op) | |||
| 1216 | 1183 | ||
| 1217 | while (!acpi_gbl_db_terminate_loop) { | 1184 | while (!acpi_gbl_db_terminate_loop) { |
| 1218 | 1185 | ||
| 1219 | /* Force output to console until a command is entered */ | 1186 | /* Wait the readiness of the command */ |
| 1220 | |||
| 1221 | acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT); | ||
| 1222 | |||
| 1223 | /* Different prompt if method is executing */ | ||
| 1224 | |||
| 1225 | if (!acpi_gbl_method_executing) { | ||
| 1226 | acpi_os_printf("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); | ||
| 1227 | } else { | ||
| 1228 | acpi_os_printf("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); | ||
| 1229 | } | ||
| 1230 | 1187 | ||
| 1231 | /* Get the user input line */ | 1188 | status = acpi_os_wait_command_ready(); |
| 1232 | |||
| 1233 | status = acpi_os_get_line(acpi_gbl_db_line_buf, | ||
| 1234 | ACPI_DB_LINE_BUFFER_SIZE, NULL); | ||
| 1235 | if (ACPI_FAILURE(status)) { | 1189 | if (ACPI_FAILURE(status)) { |
| 1236 | ACPI_EXCEPTION((AE_INFO, status, | 1190 | break; |
| 1237 | "While parsing command line")); | ||
| 1238 | return (status); | ||
| 1239 | } | 1191 | } |
| 1240 | 1192 | ||
| 1241 | /* Check for single or multithreaded debug */ | 1193 | /* Just call to the command line interpreter */ |
| 1242 | 1194 | ||
| 1243 | if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { | 1195 | acpi_gbl_method_executing = FALSE; |
| 1244 | /* | 1196 | acpi_gbl_step_to_next_call = FALSE; |
| 1245 | * Signal the debug thread that we have a command to execute, | ||
| 1246 | * and wait for the command to complete. | ||
| 1247 | */ | ||
| 1248 | acpi_os_release_mutex(acpi_gbl_db_command_ready); | ||
| 1249 | if (ACPI_FAILURE(status)) { | ||
| 1250 | return (status); | ||
| 1251 | } | ||
| 1252 | 1197 | ||
| 1253 | status = | 1198 | (void)acpi_db_command_dispatch(acpi_gbl_db_line_buf, NULL, |
| 1254 | acpi_os_acquire_mutex(acpi_gbl_db_command_complete, | 1199 | NULL); |
| 1255 | ACPI_WAIT_FOREVER); | 1200 | |
| 1256 | if (ACPI_FAILURE(status)) { | 1201 | /* Notify the completion of the command */ |
| 1257 | return (status); | ||
| 1258 | } | ||
| 1259 | } else { | ||
| 1260 | /* Just call to the command line interpreter */ | ||
| 1261 | 1202 | ||
| 1262 | acpi_db_single_thread(); | 1203 | status = acpi_os_notify_command_complete(); |
| 1204 | if (ACPI_FAILURE(status)) { | ||
| 1205 | break; | ||
| 1263 | } | 1206 | } |
| 1264 | } | 1207 | } |
| 1265 | 1208 | ||
| 1209 | if (ACPI_FAILURE(status) && status != AE_CTRL_TERMINATE) { | ||
| 1210 | ACPI_EXCEPTION((AE_INFO, status, "While parsing command line")); | ||
| 1211 | } | ||
| 1266 | return (status); | 1212 | return (status); |
| 1267 | } | 1213 | } |
diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c index 04ff1ebfda58..4f68dfc6ea55 100644 --- a/drivers/acpi/acpica/dbnames.c +++ b/drivers/acpi/acpica/dbnames.c | |||
| @@ -438,7 +438,7 @@ acpi_db_walk_for_predefined_names(acpi_handle obj_handle, | |||
| 438 | return (AE_OK); | 438 | return (AE_OK); |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | pathname = acpi_ns_get_external_pathname(node); | 441 | pathname = acpi_ns_get_normalized_pathname(node, TRUE); |
| 442 | if (!pathname) { | 442 | if (!pathname) { |
| 443 | return (AE_OK); | 443 | return (AE_OK); |
| 444 | } | 444 | } |
diff --git a/drivers/acpi/acpica/dbstats.c b/drivers/acpi/acpica/dbstats.c index 4ba0a20811eb..de255d975941 100644 --- a/drivers/acpi/acpica/dbstats.c +++ b/drivers/acpi/acpica/dbstats.c | |||
| @@ -382,6 +382,7 @@ acpi_status acpi_db_display_statistics(char *type_arg) | |||
| 382 | acpi_gbl_node_type_count[i], | 382 | acpi_gbl_node_type_count[i], |
| 383 | acpi_gbl_obj_type_count[i]); | 383 | acpi_gbl_obj_type_count[i]); |
| 384 | } | 384 | } |
| 385 | |||
| 385 | acpi_os_printf("%16.16s % 10ld% 10ld\n", "Misc/Unknown", | 386 | acpi_os_printf("%16.16s % 10ld% 10ld\n", "Misc/Unknown", |
| 386 | acpi_gbl_node_type_count_misc, | 387 | acpi_gbl_node_type_count_misc, |
| 387 | acpi_gbl_obj_type_count_misc); | 388 | acpi_gbl_obj_type_count_misc); |
diff --git a/drivers/acpi/acpica/dbtest.c b/drivers/acpi/acpica/dbtest.c index 10ea8bf9b810..68b4e8d9e1d6 100644 --- a/drivers/acpi/acpica/dbtest.c +++ b/drivers/acpi/acpica/dbtest.c | |||
| @@ -953,7 +953,7 @@ acpi_db_evaluate_one_predefined_name(acpi_handle obj_handle, | |||
| 953 | return (AE_OK); | 953 | return (AE_OK); |
| 954 | } | 954 | } |
| 955 | 955 | ||
| 956 | pathname = acpi_ns_get_external_pathname(node); | 956 | pathname = acpi_ns_get_normalized_pathname(node, TRUE); |
| 957 | if (!pathname) { | 957 | if (!pathname) { |
| 958 | return (AE_OK); | 958 | return (AE_OK); |
| 959 | } | 959 | } |
diff --git a/drivers/acpi/acpica/dbutils.c b/drivers/acpi/acpica/dbutils.c index 86790e080139..8c85d85a9cb2 100644 --- a/drivers/acpi/acpica/dbutils.c +++ b/drivers/acpi/acpica/dbutils.c | |||
| @@ -173,6 +173,7 @@ void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level) | |||
| 173 | if (obj_desc->buffer.length > 16) { | 173 | if (obj_desc->buffer.length > 16) { |
| 174 | acpi_os_printf("\n"); | 174 | acpi_os_printf("\n"); |
| 175 | } | 175 | } |
| 176 | |||
| 176 | acpi_ut_debug_dump_buffer(ACPI_CAST_PTR | 177 | acpi_ut_debug_dump_buffer(ACPI_CAST_PTR |
| 177 | (u8, | 178 | (u8, |
| 178 | obj_desc->buffer.pointer), | 179 | obj_desc->buffer.pointer), |
diff --git a/drivers/acpi/acpica/dbxface.c b/drivers/acpi/acpica/dbxface.c index 342298a6e10f..d7ff58e8c233 100644 --- a/drivers/acpi/acpica/dbxface.c +++ b/drivers/acpi/acpica/dbxface.c | |||
| @@ -85,46 +85,21 @@ acpi_db_start_command(struct acpi_walk_state *walk_state, | |||
| 85 | 85 | ||
| 86 | acpi_gbl_method_executing = TRUE; | 86 | acpi_gbl_method_executing = TRUE; |
| 87 | status = AE_CTRL_TRUE; | 87 | status = AE_CTRL_TRUE; |
| 88 | while (status == AE_CTRL_TRUE) { | ||
| 89 | if (acpi_gbl_debugger_configuration == DEBUGGER_MULTI_THREADED) { | ||
| 90 | |||
| 91 | /* Handshake with the front-end that gets user command lines */ | ||
| 92 | |||
| 93 | acpi_os_release_mutex(acpi_gbl_db_command_complete); | ||
| 94 | |||
| 95 | status = | ||
| 96 | acpi_os_acquire_mutex(acpi_gbl_db_command_ready, | ||
| 97 | ACPI_WAIT_FOREVER); | ||
| 98 | if (ACPI_FAILURE(status)) { | ||
| 99 | return (status); | ||
| 100 | } | ||
| 101 | } else { | ||
| 102 | /* Single threaded, we must get a command line ourselves */ | ||
| 103 | |||
| 104 | /* Force output to console until a command is entered */ | ||
| 105 | 88 | ||
| 106 | acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT); | 89 | while (status == AE_CTRL_TRUE) { |
| 107 | 90 | ||
| 108 | /* Different prompt if method is executing */ | 91 | /* Notify the completion of the command */ |
| 109 | 92 | ||
| 110 | if (!acpi_gbl_method_executing) { | 93 | status = acpi_os_notify_command_complete(); |
| 111 | acpi_os_printf("%1c ", | 94 | if (ACPI_FAILURE(status)) { |
| 112 | ACPI_DEBUGGER_COMMAND_PROMPT); | 95 | goto error_exit; |
| 113 | } else { | 96 | } |
| 114 | acpi_os_printf("%1c ", | ||
| 115 | ACPI_DEBUGGER_EXECUTE_PROMPT); | ||
| 116 | } | ||
| 117 | 97 | ||
| 118 | /* Get the user input line */ | 98 | /* Wait the readiness of the command */ |
| 119 | 99 | ||
| 120 | status = acpi_os_get_line(acpi_gbl_db_line_buf, | 100 | status = acpi_os_wait_command_ready(); |
| 121 | ACPI_DB_LINE_BUFFER_SIZE, | 101 | if (ACPI_FAILURE(status)) { |
| 122 | NULL); | 102 | goto error_exit; |
| 123 | if (ACPI_FAILURE(status)) { | ||
| 124 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 125 | "While parsing command line")); | ||
| 126 | return (status); | ||
| 127 | } | ||
| 128 | } | 103 | } |
| 129 | 104 | ||
| 130 | status = | 105 | status = |
| @@ -134,11 +109,46 @@ acpi_db_start_command(struct acpi_walk_state *walk_state, | |||
| 134 | 109 | ||
| 135 | /* acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); */ | 110 | /* acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); */ |
| 136 | 111 | ||
| 112 | error_exit: | ||
| 113 | if (ACPI_FAILURE(status) && status != AE_CTRL_TERMINATE) { | ||
| 114 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 115 | "While parsing/handling command line")); | ||
| 116 | } | ||
| 137 | return (status); | 117 | return (status); |
| 138 | } | 118 | } |
| 139 | 119 | ||
| 140 | /******************************************************************************* | 120 | /******************************************************************************* |
| 141 | * | 121 | * |
| 122 | * FUNCTION: acpi_db_signal_break_point | ||
| 123 | * | ||
| 124 | * PARAMETERS: walk_state - Current walk | ||
| 125 | * | ||
| 126 | * RETURN: Status | ||
| 127 | * | ||
| 128 | * DESCRIPTION: Called for AML_BREAK_POINT_OP | ||
| 129 | * | ||
| 130 | ******************************************************************************/ | ||
| 131 | |||
| 132 | void acpi_db_signal_break_point(struct acpi_walk_state *walk_state) | ||
| 133 | { | ||
| 134 | |||
| 135 | #ifndef ACPI_APPLICATION | ||
| 136 | if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { | ||
| 137 | return; | ||
| 138 | } | ||
| 139 | #endif | ||
| 140 | |||
| 141 | /* | ||
| 142 | * Set the single-step flag. This will cause the debugger (if present) | ||
| 143 | * to break to the console within the AML debugger at the start of the | ||
| 144 | * next AML instruction. | ||
| 145 | */ | ||
| 146 | acpi_gbl_cm_single_step = TRUE; | ||
| 147 | acpi_os_printf("**break** Executed AML BreakPoint opcode\n"); | ||
| 148 | } | ||
| 149 | |||
| 150 | /******************************************************************************* | ||
| 151 | * | ||
| 142 | * FUNCTION: acpi_db_single_step | 152 | * FUNCTION: acpi_db_single_step |
| 143 | * | 153 | * |
| 144 | * PARAMETERS: walk_state - Current walk | 154 | * PARAMETERS: walk_state - Current walk |
| @@ -420,15 +430,7 @@ acpi_status acpi_initialize_debugger(void) | |||
| 420 | 430 | ||
| 421 | /* These were created with one unit, grab it */ | 431 | /* These were created with one unit, grab it */ |
| 422 | 432 | ||
| 423 | status = acpi_os_acquire_mutex(acpi_gbl_db_command_complete, | 433 | status = acpi_os_initialize_command_signals(); |
| 424 | ACPI_WAIT_FOREVER); | ||
| 425 | if (ACPI_FAILURE(status)) { | ||
| 426 | acpi_os_printf("Could not get debugger mutex\n"); | ||
| 427 | return_ACPI_STATUS(status); | ||
| 428 | } | ||
| 429 | |||
| 430 | status = acpi_os_acquire_mutex(acpi_gbl_db_command_ready, | ||
| 431 | ACPI_WAIT_FOREVER); | ||
| 432 | if (ACPI_FAILURE(status)) { | 434 | if (ACPI_FAILURE(status)) { |
| 433 | acpi_os_printf("Could not get debugger mutex\n"); | 435 | acpi_os_printf("Could not get debugger mutex\n"); |
| 434 | return_ACPI_STATUS(status); | 436 | return_ACPI_STATUS(status); |
| @@ -473,13 +475,14 @@ void acpi_terminate_debugger(void) | |||
| 473 | acpi_gbl_db_terminate_loop = TRUE; | 475 | acpi_gbl_db_terminate_loop = TRUE; |
| 474 | 476 | ||
| 475 | if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { | 477 | if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { |
| 476 | acpi_os_release_mutex(acpi_gbl_db_command_ready); | ||
| 477 | 478 | ||
| 478 | /* Wait the AML Debugger threads */ | 479 | /* Wait the AML Debugger threads */ |
| 479 | 480 | ||
| 480 | while (!acpi_gbl_db_threads_terminated) { | 481 | while (!acpi_gbl_db_threads_terminated) { |
| 481 | acpi_os_sleep(100); | 482 | acpi_os_sleep(100); |
| 482 | } | 483 | } |
| 484 | |||
| 485 | acpi_os_terminate_command_signals(); | ||
| 483 | } | 486 | } |
| 484 | 487 | ||
| 485 | if (acpi_gbl_db_buffer) { | 488 | if (acpi_gbl_db_buffer) { |
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c index e2ab59e39162..76cfced31f9f 100644 --- a/drivers/acpi/acpica/dsargs.c +++ b/drivers/acpi/acpica/dsargs.c | |||
| @@ -194,8 +194,8 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
| 194 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | 194 | extra_desc = acpi_ns_get_secondary_object(obj_desc); |
| 195 | node = obj_desc->buffer_field.node; | 195 | node = obj_desc->buffer_field.node; |
| 196 | 196 | ||
| 197 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_BUFFER_FIELD, | 197 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
| 198 | node, NULL)); | 198 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); |
| 199 | 199 | ||
| 200 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", | 200 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", |
| 201 | acpi_ut_get_node_name(node))); | 201 | acpi_ut_get_node_name(node))); |
| @@ -385,7 +385,8 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
| 385 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 385 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
| 386 | (ACPI_TYPE_REGION, node, NULL)); | 386 | (ACPI_TYPE_REGION, node, NULL)); |
| 387 | 387 | ||
| 388 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", | 388 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 389 | "[%4.4s] OpRegion Arg Init at AML %p\n", | ||
| 389 | acpi_ut_get_node_name(node), | 390 | acpi_ut_get_node_name(node), |
| 390 | extra_desc->extra.aml_start)); | 391 | extra_desc->extra.aml_start)); |
| 391 | 392 | ||
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c index 435fc16e2f83..06a6f7f3af52 100644 --- a/drivers/acpi/acpica/dscontrol.c +++ b/drivers/acpi/acpica/dscontrol.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | #include "amlcode.h" | 47 | #include "amlcode.h" |
| 48 | #include "acdispat.h" | 48 | #include "acdispat.h" |
| 49 | #include "acinterp.h" | 49 | #include "acinterp.h" |
| 50 | #include "acdebug.h" | ||
| 50 | 51 | ||
| 51 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
| 52 | ACPI_MODULE_NAME("dscontrol") | 53 | ACPI_MODULE_NAME("dscontrol") |
| @@ -348,14 +349,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 348 | 349 | ||
| 349 | case AML_BREAK_POINT_OP: | 350 | case AML_BREAK_POINT_OP: |
| 350 | 351 | ||
| 351 | /* | 352 | acpi_db_signal_break_point(walk_state); |
| 352 | * Set the single-step flag. This will cause the debugger (if present) | ||
| 353 | * to break to the console within the AML debugger at the start of the | ||
| 354 | * next AML instruction. | ||
| 355 | */ | ||
| 356 | ACPI_DEBUGGER_EXEC(acpi_gbl_cm_single_step = TRUE); | ||
| 357 | ACPI_DEBUGGER_EXEC(acpi_os_printf | ||
| 358 | ("**break** Executed AML BreakPoint opcode\n")); | ||
| 359 | 353 | ||
| 360 | /* Call to the OSL in case OS wants a piece of the action */ | 354 | /* Call to the OSL in case OS wants a piece of the action */ |
| 361 | 355 | ||
diff --git a/drivers/acpi/acpica/dsdebug.c b/drivers/acpi/acpica/dsdebug.c index 309556efc553..1eb82bd7ee16 100644 --- a/drivers/acpi/acpica/dsdebug.c +++ b/drivers/acpi/acpica/dsdebug.c | |||
| @@ -161,6 +161,7 @@ acpi_ds_dump_method_stack(acpi_status status, | |||
| 161 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 162 | "\n**** Exception %s during execution of method ", | 162 | "\n**** Exception %s during execution of method ", |
| 163 | acpi_format_exception(status))); | 163 | acpi_format_exception(status))); |
| 164 | |||
| 164 | acpi_ds_print_node_pathname(walk_state->method_node, NULL); | 165 | acpi_ds_print_node_pathname(walk_state->method_node, NULL); |
| 165 | 166 | ||
| 166 | /* Display stack of executing methods */ | 167 | /* Display stack of executing methods */ |
| @@ -203,8 +204,8 @@ acpi_ds_dump_method_stack(acpi_status status, | |||
| 203 | } else { | 204 | } else { |
| 204 | /* | 205 | /* |
| 205 | * This method has called another method | 206 | * This method has called another method |
| 206 | * NOTE: the method call parse subtree is already deleted at this | 207 | * NOTE: the method call parse subtree is already deleted at |
| 207 | * point, so we cannot disassemble the method invocation. | 208 | * this point, so we cannot disassemble the method invocation. |
| 208 | */ | 209 | */ |
| 209 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, | 210 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, |
| 210 | "Call to method ")); | 211 | "Call to method ")); |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 20de148594fd..6bca0ec42dbd 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
| @@ -106,6 +106,7 @@ acpi_ds_create_external_region(acpi_status lookup_status, | |||
| 106 | * insert the name into the namespace. | 106 | * insert the name into the namespace. |
| 107 | */ | 107 | */ |
| 108 | acpi_dm_add_op_to_external_list(op, path, ACPI_TYPE_REGION, 0, 0); | 108 | acpi_dm_add_op_to_external_list(op, path, ACPI_TYPE_REGION, 0, 0); |
| 109 | |||
| 109 | status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION, | 110 | status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION, |
| 110 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, | 111 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
| 111 | walk_state, node); | 112 | walk_state, node); |
| @@ -202,11 +203,10 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
| 202 | 203 | ||
| 203 | /* Enter the name_string into the namespace */ | 204 | /* Enter the name_string into the namespace */ |
| 204 | 205 | ||
| 205 | status = | 206 | status = acpi_ns_lookup(walk_state->scope_info, |
| 206 | acpi_ns_lookup(walk_state->scope_info, | 207 | arg->common.value.string, ACPI_TYPE_ANY, |
| 207 | arg->common.value.string, ACPI_TYPE_ANY, | 208 | ACPI_IMODE_LOAD_PASS1, flags, |
| 208 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, | 209 | walk_state, &node); |
| 209 | &node); | ||
| 210 | if (ACPI_FAILURE(status)) { | 210 | if (ACPI_FAILURE(status)) { |
| 211 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | 211 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); |
| 212 | return_ACPI_STATUS(status); | 212 | return_ACPI_STATUS(status); |
| @@ -244,8 +244,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | /* | 246 | /* |
| 247 | * Remember location in AML stream of the field unit opcode and operands -- | 247 | * Remember location in AML stream of the field unit opcode and operands |
| 248 | * since the buffer and index operands must be evaluated. | 248 | * -- since the buffer and index operands must be evaluated. |
| 249 | */ | 249 | */ |
| 250 | second_desc = obj_desc->common.next_object; | 250 | second_desc = obj_desc->common.next_object; |
| 251 | second_desc->extra.aml_start = op->named.data; | 251 | second_desc->extra.aml_start = op->named.data; |
| @@ -310,8 +310,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
| 310 | switch (arg->common.aml_opcode) { | 310 | switch (arg->common.aml_opcode) { |
| 311 | case AML_INT_RESERVEDFIELD_OP: | 311 | case AML_INT_RESERVEDFIELD_OP: |
| 312 | 312 | ||
| 313 | position = (u64) info->field_bit_position | 313 | position = (u64)info->field_bit_position + |
| 314 | + (u64) arg->common.value.size; | 314 | (u64)arg->common.value.size; |
| 315 | 315 | ||
| 316 | if (position > ACPI_UINT32_MAX) { | 316 | if (position > ACPI_UINT32_MAX) { |
| 317 | ACPI_ERROR((AE_INFO, | 317 | ACPI_ERROR((AE_INFO, |
| @@ -344,13 +344,13 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
| 344 | 344 | ||
| 345 | /* access_attribute (attrib_quick, attrib_byte, etc.) */ | 345 | /* access_attribute (attrib_quick, attrib_byte, etc.) */ |
| 346 | 346 | ||
| 347 | info->attribute = | 347 | info->attribute = (u8) |
| 348 | (u8)((arg->common.value.integer >> 8) & 0xFF); | 348 | ((arg->common.value.integer >> 8) & 0xFF); |
| 349 | 349 | ||
| 350 | /* access_length (for serial/buffer protocols) */ | 350 | /* access_length (for serial/buffer protocols) */ |
| 351 | 351 | ||
| 352 | info->access_length = | 352 | info->access_length = (u8) |
| 353 | (u8)((arg->common.value.integer >> 16) & 0xFF); | 353 | ((arg->common.value.integer >> 16) & 0xFF); |
| 354 | break; | 354 | break; |
| 355 | 355 | ||
| 356 | case AML_INT_CONNECTION_OP: | 356 | case AML_INT_CONNECTION_OP: |
| @@ -425,8 +425,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
| 425 | 425 | ||
| 426 | /* Keep track of bit position for the next field */ | 426 | /* Keep track of bit position for the next field */ |
| 427 | 427 | ||
| 428 | position = (u64) info->field_bit_position | 428 | position = (u64)info->field_bit_position + |
| 429 | + (u64) arg->common.value.size; | 429 | (u64)arg->common.value.size; |
| 430 | 430 | ||
| 431 | if (position > ACPI_UINT32_MAX) { | 431 | if (position > ACPI_UINT32_MAX) { |
| 432 | ACPI_ERROR((AE_INFO, | 432 | ACPI_ERROR((AE_INFO, |
| @@ -716,11 +716,12 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
| 716 | 716 | ||
| 717 | /* | 717 | /* |
| 718 | * Use Info.data_register_node to store bank_field Op | 718 | * Use Info.data_register_node to store bank_field Op |
| 719 | * It's safe because data_register_node will never be used when create bank field | 719 | * It's safe because data_register_node will never be used when create |
| 720 | * We store aml_start and aml_length in the bank_field Op for late evaluation | 720 | * bank field \we store aml_start and aml_length in the bank_field Op for |
| 721 | * Used in acpi_ex_prep_field_value(Info) | 721 | * late evaluation. Used in acpi_ex_prep_field_value(Info) |
| 722 | * | 722 | * |
| 723 | * TBD: Or, should we add a field in struct acpi_create_field_info, like "void *ParentOp"? | 723 | * TBD: Or, should we add a field in struct acpi_create_field_info, like |
| 724 | * "void *ParentOp"? | ||
| 724 | */ | 725 | */ |
| 725 | info.data_register_node = (struct acpi_namespace_node *)op; | 726 | info.data_register_node = (struct acpi_namespace_node *)op; |
| 726 | 727 | ||
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index 920f1b199bc6..c1d8af8a8aaf 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
| @@ -247,7 +247,7 @@ acpi_ds_initialize_objects(u32 table_index, | |||
| 247 | /* Summary of objects initialized */ | 247 | /* Summary of objects initialized */ |
| 248 | 248 | ||
| 249 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 249 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
| 250 | "Table [%4.4s:%8.8s] (id %.2X) - %4u Objects with %3u Devices, " | 250 | "Table [%4.4s: %-8.8s] (id %.2X) - %4u Objects with %3u Devices, " |
| 251 | "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n", | 251 | "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n", |
| 252 | table->signature, table->oem_table_id, owner_id, | 252 | table->signature, table->oem_table_id, owner_id, |
| 253 | info.object_count, info.device_count, | 253 | info.object_count, info.device_count, |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index bc32f3194afe..6585e8e37c8e 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
| @@ -118,10 +118,9 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | |||
| 118 | return_ACPI_STATUS(AE_NO_MEMORY); | 118 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | status = | 121 | status = acpi_ds_init_aml_walk(walk_state, op, node, |
| 122 | acpi_ds_init_aml_walk(walk_state, op, node, | 122 | obj_desc->method.aml_start, |
| 123 | obj_desc->method.aml_start, | 123 | obj_desc->method.aml_length, NULL, 0); |
| 124 | obj_desc->method.aml_length, NULL, 0); | ||
| 125 | if (ACPI_FAILURE(status)) { | 124 | if (ACPI_FAILURE(status)) { |
| 126 | acpi_ds_delete_walk_state(walk_state); | 125 | acpi_ds_delete_walk_state(walk_state); |
| 127 | acpi_ps_free_op(op); | 126 | acpi_ps_free_op(op); |
| @@ -375,7 +374,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
| 375 | && (walk_state->thread->current_sync_level > | 374 | && (walk_state->thread->current_sync_level > |
| 376 | obj_desc->method.mutex->mutex.sync_level)) { | 375 | obj_desc->method.mutex->mutex.sync_level)) { |
| 377 | ACPI_ERROR((AE_INFO, | 376 | ACPI_ERROR((AE_INFO, |
| 378 | "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", | 377 | "Cannot acquire Mutex for method [%4.4s]" |
| 378 | ", current SyncLevel is too large (%u)", | ||
| 379 | acpi_ut_get_node_name(method_node), | 379 | acpi_ut_get_node_name(method_node), |
| 380 | walk_state->thread->current_sync_level)); | 380 | walk_state->thread->current_sync_level)); |
| 381 | 381 | ||
| @@ -411,8 +411,19 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
| 411 | 411 | ||
| 412 | obj_desc->method.mutex->mutex.thread_id = | 412 | obj_desc->method.mutex->mutex.thread_id = |
| 413 | walk_state->thread->thread_id; | 413 | walk_state->thread->thread_id; |
| 414 | walk_state->thread->current_sync_level = | 414 | |
| 415 | obj_desc->method.sync_level; | 415 | /* |
| 416 | * Update the current sync_level only if this is not an auto- | ||
| 417 | * serialized method. In the auto case, we have to ignore | ||
| 418 | * the sync level for the method mutex (created for the | ||
| 419 | * auto-serialization) because we have no idea of what the | ||
| 420 | * sync level should be. Therefore, just ignore it. | ||
| 421 | */ | ||
| 422 | if (!(obj_desc->method.info_flags & | ||
| 423 | ACPI_METHOD_IGNORE_SYNC_LEVEL)) { | ||
| 424 | walk_state->thread->current_sync_level = | ||
| 425 | obj_desc->method.sync_level; | ||
| 426 | } | ||
| 416 | } else { | 427 | } else { |
| 417 | obj_desc->method.mutex->mutex. | 428 | obj_desc->method.mutex->mutex. |
| 418 | original_sync_level = | 429 | original_sync_level = |
| @@ -501,16 +512,18 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 501 | 512 | ||
| 502 | /* Init for new method, possibly wait on method mutex */ | 513 | /* Init for new method, possibly wait on method mutex */ |
| 503 | 514 | ||
| 504 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 515 | status = |
| 505 | this_walk_state); | 516 | acpi_ds_begin_method_execution(method_node, obj_desc, |
| 517 | this_walk_state); | ||
| 506 | if (ACPI_FAILURE(status)) { | 518 | if (ACPI_FAILURE(status)) { |
| 507 | return_ACPI_STATUS(status); | 519 | return_ACPI_STATUS(status); |
| 508 | } | 520 | } |
| 509 | 521 | ||
| 510 | /* Begin method parse/execution. Create a new walk state */ | 522 | /* Begin method parse/execution. Create a new walk state */ |
| 511 | 523 | ||
| 512 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, | 524 | next_walk_state = |
| 513 | NULL, obj_desc, thread); | 525 | acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, obj_desc, |
| 526 | thread); | ||
| 514 | if (!next_walk_state) { | 527 | if (!next_walk_state) { |
| 515 | status = AE_NO_MEMORY; | 528 | status = AE_NO_MEMORY; |
| 516 | goto cleanup; | 529 | goto cleanup; |
| @@ -797,7 +810,8 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
| 797 | info_flags & ACPI_METHOD_SERIALIZED_PENDING) { | 810 | info_flags & ACPI_METHOD_SERIALIZED_PENDING) { |
| 798 | if (walk_state) { | 811 | if (walk_state) { |
| 799 | ACPI_INFO((AE_INFO, | 812 | ACPI_INFO((AE_INFO, |
| 800 | "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", | 813 | "Marking method %4.4s as Serialized " |
| 814 | "because of AE_ALREADY_EXISTS error", | ||
| 801 | walk_state->method_node->name. | 815 | walk_state->method_node->name. |
| 802 | ascii)); | 816 | ascii)); |
| 803 | } | 817 | } |
| @@ -815,6 +829,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
| 815 | */ | 829 | */ |
| 816 | method_desc->method.info_flags &= | 830 | method_desc->method.info_flags &= |
| 817 | ~ACPI_METHOD_SERIALIZED_PENDING; | 831 | ~ACPI_METHOD_SERIALIZED_PENDING; |
| 832 | |||
| 818 | method_desc->method.info_flags |= | 833 | method_desc->method.info_flags |= |
| 819 | (ACPI_METHOD_SERIALIZED | | 834 | (ACPI_METHOD_SERIALIZED | |
| 820 | ACPI_METHOD_IGNORE_SYNC_LEVEL); | 835 | ACPI_METHOD_IGNORE_SYNC_LEVEL); |
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index 2e4c42b377ec..03c44f2ac7b7 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
| @@ -99,6 +99,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
| 99 | for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { | 99 | for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { |
| 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, | 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, |
| 101 | NAMEOF_ARG_NTE); | 101 | NAMEOF_ARG_NTE); |
| 102 | |||
| 102 | walk_state->arguments[i].name.integer |= (i << 24); | 103 | walk_state->arguments[i].name.integer |= (i << 24); |
| 103 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; | 104 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; |
| 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 105 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
| @@ -201,7 +202,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
| 201 | 202 | ||
| 202 | if (!params) { | 203 | if (!params) { |
| 203 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 204 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 204 | "No param list passed to method\n")); | 205 | "No parameter list passed to method\n")); |
| 205 | return_ACPI_STATUS(AE_OK); | 206 | return_ACPI_STATUS(AE_OK); |
| 206 | } | 207 | } |
| 207 | 208 | ||
| @@ -214,9 +215,9 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
| 214 | * Store the argument in the method/walk descriptor. | 215 | * Store the argument in the method/walk descriptor. |
| 215 | * Do not copy the arg in order to implement call by reference | 216 | * Do not copy the arg in order to implement call by reference |
| 216 | */ | 217 | */ |
| 217 | status = acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index, | 218 | status = |
| 218 | params[index], | 219 | acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index, |
| 219 | walk_state); | 220 | params[index], walk_state); |
| 220 | if (ACPI_FAILURE(status)) { | 221 | if (ACPI_FAILURE(status)) { |
| 221 | return_ACPI_STATUS(status); | 222 | return_ACPI_STATUS(status); |
| 222 | } | 223 | } |
| @@ -610,11 +611,11 @@ acpi_ds_store_object_to_local(u8 type, | |||
| 610 | * do the indirect store | 611 | * do the indirect store |
| 611 | */ | 612 | */ |
| 612 | if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) == | 613 | if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) == |
| 613 | ACPI_DESC_TYPE_OPERAND) | 614 | ACPI_DESC_TYPE_OPERAND) && |
| 614 | && (current_obj_desc->common.type == | 615 | (current_obj_desc->common.type == |
| 615 | ACPI_TYPE_LOCAL_REFERENCE) | 616 | ACPI_TYPE_LOCAL_REFERENCE) && |
| 616 | && (current_obj_desc->reference.class == | 617 | (current_obj_desc->reference.class == |
| 617 | ACPI_REFCLASS_REFOF)) { | 618 | ACPI_REFCLASS_REFOF)) { |
| 618 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 619 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 619 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", | 620 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", |
| 620 | new_obj_desc, | 621 | new_obj_desc, |
| @@ -638,6 +639,7 @@ acpi_ds_store_object_to_local(u8 type, | |||
| 638 | if (new_obj_desc != obj_desc) { | 639 | if (new_obj_desc != obj_desc) { |
| 639 | acpi_ut_remove_reference(new_obj_desc); | 640 | acpi_ut_remove_reference(new_obj_desc); |
| 640 | } | 641 | } |
| 642 | |||
| 641 | return_ACPI_STATUS(status); | 643 | return_ACPI_STATUS(status); |
| 642 | } | 644 | } |
| 643 | } | 645 | } |
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index 2beb7fd674ae..302c91f5377b 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
| @@ -463,10 +463,10 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
| 463 | arg->common.node); | 463 | arg->common.node); |
| 464 | } | 464 | } |
| 465 | } else { | 465 | } else { |
| 466 | status = acpi_ds_build_internal_object(walk_state, arg, | 466 | status = |
| 467 | &obj_desc-> | 467 | acpi_ds_build_internal_object(walk_state, arg, |
| 468 | package. | 468 | &obj_desc->package. |
| 469 | elements[i]); | 469 | elements[i]); |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | if (*obj_desc_ptr) { | 472 | if (*obj_desc_ptr) { |
| @@ -525,7 +525,8 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
| 525 | } | 525 | } |
| 526 | 526 | ||
| 527 | ACPI_INFO((AE_INFO, | 527 | ACPI_INFO((AE_INFO, |
| 528 | "Actual Package length (%u) is larger than NumElements field (%u), truncated", | 528 | "Actual Package length (%u) is larger than " |
| 529 | "NumElements field (%u), truncated", | ||
| 529 | i, element_count)); | 530 | i, element_count)); |
| 530 | } else if (i < element_count) { | 531 | } else if (i < element_count) { |
| 531 | /* | 532 | /* |
| @@ -533,7 +534,8 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
| 533 | * Note: this is not an error, the package is padded out with NULLs. | 534 | * Note: this is not an error, the package is padded out with NULLs. |
| 534 | */ | 535 | */ |
| 535 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 536 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 536 | "Package List length (%u) smaller than NumElements count (%u), padded with null elements\n", | 537 | "Package List length (%u) smaller than NumElements " |
| 538 | "count (%u), padded with null elements\n", | ||
| 537 | i, element_count)); | 539 | i, element_count)); |
| 538 | } | 540 | } |
| 539 | 541 | ||
| @@ -584,8 +586,9 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
| 584 | 586 | ||
| 585 | /* Build an internal object for the argument(s) */ | 587 | /* Build an internal object for the argument(s) */ |
| 586 | 588 | ||
| 587 | status = acpi_ds_build_internal_object(walk_state, op->common.value.arg, | 589 | status = |
| 588 | &obj_desc); | 590 | acpi_ds_build_internal_object(walk_state, op->common.value.arg, |
| 591 | &obj_desc); | ||
| 589 | if (ACPI_FAILURE(status)) { | 592 | if (ACPI_FAILURE(status)) { |
| 590 | return_ACPI_STATUS(status); | 593 | return_ACPI_STATUS(status); |
| 591 | } | 594 | } |
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 81d7b9863e32..1edd66f18907 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
| @@ -243,8 +243,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
| 243 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), | 243 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), |
| 244 | * UPDATE_RULE = 0 (UPDATE_PRESERVE) | 244 | * UPDATE_RULE = 0 (UPDATE_PRESERVE) |
| 245 | */ | 245 | */ |
| 246 | status = acpi_ex_prep_common_field_object(obj_desc, field_flags, 0, | 246 | status = |
| 247 | bit_offset, bit_count); | 247 | acpi_ex_prep_common_field_object(obj_desc, field_flags, 0, |
| 248 | bit_offset, bit_count); | ||
| 248 | if (ACPI_FAILURE(status)) { | 249 | if (ACPI_FAILURE(status)) { |
| 249 | goto cleanup; | 250 | goto cleanup; |
| 250 | } | 251 | } |
| @@ -330,8 +331,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
| 330 | 331 | ||
| 331 | /* Resolve the operands */ | 332 | /* Resolve the operands */ |
| 332 | 333 | ||
| 333 | status = acpi_ex_resolve_operands(op->common.aml_opcode, | 334 | status = |
| 334 | ACPI_WALK_OPERANDS, walk_state); | 335 | acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS, |
| 336 | walk_state); | ||
| 335 | if (ACPI_FAILURE(status)) { | 337 | if (ACPI_FAILURE(status)) { |
| 336 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s), status 0x%X", | 338 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s), status 0x%X", |
| 337 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 339 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
| @@ -414,8 +416,9 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 414 | 416 | ||
| 415 | /* Resolve the length and address operands to numbers */ | 417 | /* Resolve the length and address operands to numbers */ |
| 416 | 418 | ||
| 417 | status = acpi_ex_resolve_operands(op->common.aml_opcode, | 419 | status = |
| 418 | ACPI_WALK_OPERANDS, walk_state); | 420 | acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS, |
| 421 | walk_state); | ||
| 419 | if (ACPI_FAILURE(status)) { | 422 | if (ACPI_FAILURE(status)) { |
| 420 | return_ACPI_STATUS(status); | 423 | return_ACPI_STATUS(status); |
| 421 | } | 424 | } |
| @@ -452,7 +455,6 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 452 | /* Now the address and length are valid for this opregion */ | 455 | /* Now the address and length are valid for this opregion */ |
| 453 | 456 | ||
| 454 | obj_desc->region.flags |= AOPOBJ_DATA_VALID; | 457 | obj_desc->region.flags |= AOPOBJ_DATA_VALID; |
| 455 | |||
| 456 | return_ACPI_STATUS(status); | 458 | return_ACPI_STATUS(status); |
| 457 | } | 459 | } |
| 458 | 460 | ||
| @@ -510,8 +512,9 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, | |||
| 510 | * Resolve the Signature string, oem_id string, | 512 | * Resolve the Signature string, oem_id string, |
| 511 | * and oem_table_id string operands | 513 | * and oem_table_id string operands |
| 512 | */ | 514 | */ |
| 513 | status = acpi_ex_resolve_operands(op->common.aml_opcode, | 515 | status = |
| 514 | ACPI_WALK_OPERANDS, walk_state); | 516 | acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS, |
| 517 | walk_state); | ||
| 515 | if (ACPI_FAILURE(status)) { | 518 | if (ACPI_FAILURE(status)) { |
| 516 | goto cleanup; | 519 | goto cleanup; |
| 517 | } | 520 | } |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index ebc577baeaf9..fa8e2920a3ef 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
| @@ -245,9 +245,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
| 245 | * we will use the return value | 245 | * we will use the return value |
| 246 | */ | 246 | */ |
| 247 | if ((walk_state->control_state->common.state == | 247 | if ((walk_state->control_state->common.state == |
| 248 | ACPI_CONTROL_PREDICATE_EXECUTING) | 248 | ACPI_CONTROL_PREDICATE_EXECUTING) && |
| 249 | && (walk_state->control_state->control. | 249 | (walk_state->control_state->control.predicate_op == |
| 250 | predicate_op == op)) { | 250 | op)) { |
| 251 | goto result_used; | 251 | goto result_used; |
| 252 | } | 252 | } |
| 253 | break; | 253 | break; |
| @@ -481,10 +481,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 481 | 481 | ||
| 482 | /* Get the entire name string from the AML stream */ | 482 | /* Get the entire name string from the AML stream */ |
| 483 | 483 | ||
| 484 | status = | 484 | status = acpi_ex_get_name_string(ACPI_TYPE_ANY, |
| 485 | acpi_ex_get_name_string(ACPI_TYPE_ANY, | 485 | arg->common.value.buffer, |
| 486 | arg->common.value.buffer, | 486 | &name_string, &name_length); |
| 487 | &name_string, &name_length); | ||
| 488 | 487 | ||
| 489 | if (ACPI_FAILURE(status)) { | 488 | if (ACPI_FAILURE(status)) { |
| 490 | return_ACPI_STATUS(status); | 489 | return_ACPI_STATUS(status); |
| @@ -503,9 +502,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 503 | */ | 502 | */ |
| 504 | if ((walk_state->deferred_node) && | 503 | if ((walk_state->deferred_node) && |
| 505 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) | 504 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) |
| 506 | && (arg_index == | 505 | && (arg_index == (u32) |
| 507 | (u32) ((walk_state->opcode == | 506 | ((walk_state->opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) { |
| 508 | AML_CREATE_FIELD_OP) ? 3 : 2))) { | ||
| 509 | obj_desc = | 507 | obj_desc = |
| 510 | ACPI_CAST_PTR(union acpi_operand_object, | 508 | ACPI_CAST_PTR(union acpi_operand_object, |
| 511 | walk_state->deferred_node); | 509 | walk_state->deferred_node); |
| @@ -522,9 +520,10 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 522 | op_info = | 520 | op_info = |
| 523 | acpi_ps_get_opcode_info(parent_op->common. | 521 | acpi_ps_get_opcode_info(parent_op->common. |
| 524 | aml_opcode); | 522 | aml_opcode); |
| 525 | if ((op_info->flags & AML_NSNODE) | 523 | |
| 526 | && (parent_op->common.aml_opcode != | 524 | if ((op_info->flags & AML_NSNODE) && |
| 527 | AML_INT_METHODCALL_OP) | 525 | (parent_op->common.aml_opcode != |
| 526 | AML_INT_METHODCALL_OP) | ||
| 528 | && (parent_op->common.aml_opcode != AML_REGION_OP) | 527 | && (parent_op->common.aml_opcode != AML_REGION_OP) |
| 529 | && (parent_op->common.aml_opcode != | 528 | && (parent_op->common.aml_opcode != |
| 530 | AML_INT_NAMEPATH_OP)) { | 529 | AML_INT_NAMEPATH_OP)) { |
| @@ -605,8 +604,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 605 | if (ACPI_FAILURE(status)) { | 604 | if (ACPI_FAILURE(status)) { |
| 606 | return_ACPI_STATUS(status); | 605 | return_ACPI_STATUS(status); |
| 607 | } | 606 | } |
| 608 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object | 607 | |
| 609 | (obj_desc, walk_state)); | 608 | acpi_db_display_argument_object(obj_desc, walk_state); |
| 610 | } else { | 609 | } else { |
| 611 | /* Check for null name case */ | 610 | /* Check for null name case */ |
| 612 | 611 | ||
| @@ -633,15 +632,16 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 633 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); | 632 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); |
| 634 | } | 633 | } |
| 635 | 634 | ||
| 636 | if ((op_info->flags & AML_HAS_RETVAL) | 635 | if ((op_info->flags & AML_HAS_RETVAL) || |
| 637 | || (arg->common.flags & ACPI_PARSEOP_IN_STACK)) { | 636 | (arg->common.flags & ACPI_PARSEOP_IN_STACK)) { |
| 638 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 637 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 639 | "Argument previously created, already stacked\n")); | 638 | "Argument previously created, already stacked\n")); |
| 640 | 639 | ||
| 641 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object | 640 | acpi_db_display_argument_object(walk_state-> |
| 642 | (walk_state-> | 641 | operands[walk_state-> |
| 643 | operands[walk_state->num_operands - | 642 | num_operands - |
| 644 | 1], walk_state)); | 643 | 1], |
| 644 | walk_state); | ||
| 645 | 645 | ||
| 646 | /* | 646 | /* |
| 647 | * Use value that was already previously returned | 647 | * Use value that was already previously returned |
| @@ -685,8 +685,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 685 | return_ACPI_STATUS(status); | 685 | return_ACPI_STATUS(status); |
| 686 | } | 686 | } |
| 687 | 687 | ||
| 688 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object | 688 | acpi_db_display_argument_object(obj_desc, walk_state); |
| 689 | (obj_desc, walk_state)); | ||
| 690 | } | 689 | } |
| 691 | 690 | ||
| 692 | return_ACPI_STATUS(AE_OK); | 691 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index df54d46225cd..ed2f1d362092 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
| @@ -172,14 +172,14 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
| 172 | 172 | ||
| 173 | cleanup: | 173 | cleanup: |
| 174 | 174 | ||
| 175 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", | 175 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 176 | "Completed a predicate eval=%X Op=%p\n", | ||
| 176 | walk_state->control_state->common.value, | 177 | walk_state->control_state->common.value, |
| 177 | walk_state->op)); | 178 | walk_state->op)); |
| 178 | 179 | ||
| 179 | /* Break to debugger to display result */ | 180 | /* Break to debugger to display result */ |
| 180 | 181 | ||
| 181 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 182 | acpi_db_display_result_object(local_obj_desc, walk_state); |
| 182 | (local_obj_desc, walk_state)); | ||
| 183 | 183 | ||
| 184 | /* | 184 | /* |
| 185 | * Delete the predicate result object (we know that | 185 | * Delete the predicate result object (we know that |
| @@ -264,8 +264,8 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
| 264 | (walk_state->control_state->common.state == | 264 | (walk_state->control_state->common.state == |
| 265 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | 265 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { |
| 266 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 266 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 267 | "Exec predicate Op=%p State=%p\n", op, | 267 | "Exec predicate Op=%p State=%p\n", |
| 268 | walk_state)); | 268 | op, walk_state)); |
| 269 | 269 | ||
| 270 | walk_state->control_state->common.state = | 270 | walk_state->control_state->common.state = |
| 271 | ACPI_CONTROL_PREDICATE_EXECUTING; | 271 | ACPI_CONTROL_PREDICATE_EXECUTING; |
| @@ -386,11 +386,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 386 | 386 | ||
| 387 | /* Call debugger for single step support (DEBUG build only) */ | 387 | /* Call debugger for single step support (DEBUG build only) */ |
| 388 | 388 | ||
| 389 | ACPI_DEBUGGER_EXEC(status = | 389 | status = acpi_db_single_step(walk_state, op, op_class); |
| 390 | acpi_db_single_step(walk_state, op, op_class)); | 390 | if (ACPI_FAILURE(status)) { |
| 391 | ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) { | 391 | return_ACPI_STATUS(status); |
| 392 | return_ACPI_STATUS(status);} | 392 | } |
| 393 | ) ; | ||
| 394 | 393 | ||
| 395 | /* Decode the Opcode Class */ | 394 | /* Decode the Opcode Class */ |
| 396 | 395 | ||
| @@ -502,9 +501,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 502 | "Method Reference in a Package, Op=%p\n", | 501 | "Method Reference in a Package, Op=%p\n", |
| 503 | op)); | 502 | op)); |
| 504 | 503 | ||
| 505 | op->common.node = | 504 | op->common.node = (struct acpi_namespace_node *) |
| 506 | (struct acpi_namespace_node *)op->asl.value. | 505 | op->asl.value.arg->asl.node; |
| 507 | arg->asl.node; | ||
| 508 | acpi_ut_add_reference(op->asl.value.arg->asl. | 506 | acpi_ut_add_reference(op->asl.value.arg->asl. |
| 509 | node->object); | 507 | node->object); |
| 510 | return_ACPI_STATUS(AE_OK); | 508 | return_ACPI_STATUS(AE_OK); |
| @@ -586,8 +584,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 586 | * Put the Node on the object stack (Contains the ACPI Name | 584 | * Put the Node on the object stack (Contains the ACPI Name |
| 587 | * of this object) | 585 | * of this object) |
| 588 | */ | 586 | */ |
| 589 | walk_state->operands[0] = | 587 | walk_state->operands[0] = (void *) |
| 590 | (void *)op->common.parent->common.node; | 588 | op->common.parent->common.node; |
| 591 | walk_state->num_operands = 1; | 589 | walk_state->num_operands = 1; |
| 592 | 590 | ||
| 593 | status = acpi_ds_create_node(walk_state, | 591 | status = acpi_ds_create_node(walk_state, |
| @@ -692,7 +690,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 692 | default: | 690 | default: |
| 693 | 691 | ||
| 694 | ACPI_ERROR((AE_INFO, | 692 | ACPI_ERROR((AE_INFO, |
| 695 | "Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p", | 693 | "Unimplemented opcode, class=0x%X " |
| 694 | "type=0x%X Opcode=0x%X Op=%p", | ||
| 696 | op_class, op_type, op->common.aml_opcode, | 695 | op_class, op_type, op->common.aml_opcode, |
| 697 | op)); | 696 | op)); |
| 698 | 697 | ||
| @@ -728,8 +727,8 @@ cleanup: | |||
| 728 | 727 | ||
| 729 | /* Break to debugger to display result */ | 728 | /* Break to debugger to display result */ |
| 730 | 729 | ||
| 731 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 730 | acpi_db_display_result_object(walk_state->result_obj, |
| 732 | (walk_state->result_obj, walk_state)); | 731 | walk_state); |
| 733 | 732 | ||
| 734 | /* | 733 | /* |
| 735 | * Delete the result op if and only if: | 734 | * Delete the result op if and only if: |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 097188a6b1c1..b3254742aaf6 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
| @@ -476,13 +476,9 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
| 476 | status = | 476 | status = |
| 477 | acpi_ex_create_region(op->named.data, | 477 | acpi_ex_create_region(op->named.data, |
| 478 | op->named.length, | 478 | op->named.length, |
| 479 | (acpi_adr_space_type) ((op-> | 479 | (acpi_adr_space_type) |
| 480 | common. | 480 | ((op->common.value.arg)-> |
| 481 | value. | 481 | common.value.integer), |
| 482 | arg)-> | ||
| 483 | common. | ||
| 484 | value. | ||
| 485 | integer), | ||
| 486 | walk_state); | 482 | walk_state); |
| 487 | if (ACPI_FAILURE(status)) { | 483 | if (ACPI_FAILURE(status)) { |
| 488 | return_ACPI_STATUS(status); | 484 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index e2c08cd79aca..8a32153a111b 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c | |||
| @@ -598,11 +598,10 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
| 598 | * Executing a method: initialize the region and unlock | 598 | * Executing a method: initialize the region and unlock |
| 599 | * the interpreter | 599 | * the interpreter |
| 600 | */ | 600 | */ |
| 601 | status = | 601 | status = acpi_ex_create_region(op->named.data, |
| 602 | acpi_ex_create_region(op->named.data, | 602 | op->named.length, |
| 603 | op->named.length, | 603 | region_space, |
| 604 | region_space, | 604 | walk_state); |
| 605 | walk_state); | ||
| 606 | if (ACPI_FAILURE(status)) { | 605 | if (ACPI_FAILURE(status)) { |
| 607 | return_ACPI_STATUS(status); | 606 | return_ACPI_STATUS(status); |
| 608 | } | 607 | } |
| @@ -664,6 +663,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
| 664 | length, | 663 | length, |
| 665 | walk_state); | 664 | walk_state); |
| 666 | } | 665 | } |
| 666 | |||
| 667 | walk_state->operands[0] = NULL; | 667 | walk_state->operands[0] = NULL; |
| 668 | walk_state->num_operands = 0; | 668 | walk_state->num_operands = 0; |
| 669 | 669 | ||
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c index 43b3ea40c0b6..2d7a04493469 100644 --- a/drivers/acpi/acpica/dswscope.c +++ b/drivers/acpi/acpica/dswscope.c | |||
| @@ -77,6 +77,7 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) | |||
| 77 | "Popped object type (%s)\n", | 77 | "Popped object type (%s)\n", |
| 78 | acpi_ut_get_type_name(scope_info->common. | 78 | acpi_ut_get_type_name(scope_info->common. |
| 79 | value))); | 79 | value))); |
| 80 | |||
| 80 | acpi_ut_delete_generic_state(scope_info); | 81 | acpi_ut_delete_generic_state(scope_info); |
| 81 | } | 82 | } |
| 82 | } | 83 | } |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index ccf793247447..112e821a1cec 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
| @@ -92,8 +92,8 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info) | |||
| 92 | ACPI_SET_BIT(gpe_register_info->enable_for_run, | 92 | ACPI_SET_BIT(gpe_register_info->enable_for_run, |
| 93 | (u8)register_bit); | 93 | (u8)register_bit); |
| 94 | } | 94 | } |
| 95 | gpe_register_info->enable_mask = gpe_register_info->enable_for_run; | ||
| 96 | 95 | ||
| 96 | gpe_register_info->enable_mask = gpe_register_info->enable_for_run; | ||
| 97 | return_ACPI_STATUS(AE_OK); | 97 | return_ACPI_STATUS(AE_OK); |
| 98 | } | 98 | } |
| 99 | 99 | ||
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index e0f24c504513..c00a9f2f82d5 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
| @@ -167,6 +167,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
| 167 | if (gpe_block->next) { | 167 | if (gpe_block->next) { |
| 168 | gpe_block->next->previous = gpe_block->previous; | 168 | gpe_block->next->previous = gpe_block->previous; |
| 169 | } | 169 | } |
| 170 | |||
| 170 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 171 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 171 | } | 172 | } |
| 172 | 173 | ||
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c index 3a958f3612fe..fd5ab9012238 100644 --- a/drivers/acpi/acpica/evgpeutil.c +++ b/drivers/acpi/acpica/evgpeutil.c | |||
| @@ -346,6 +346,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 346 | ACPI_FREE(notify); | 346 | ACPI_FREE(notify); |
| 347 | notify = next; | 347 | notify = next; |
| 348 | } | 348 | } |
| 349 | |||
| 349 | gpe_event_info->dispatch.notify_list = NULL; | 350 | gpe_event_info->dispatch.notify_list = NULL; |
| 350 | gpe_event_info->flags &= | 351 | gpe_event_info->flags &= |
| 351 | ~ACPI_GPE_DISPATCH_MASK; | 352 | ~ACPI_GPE_DISPATCH_MASK; |
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c index 74e8595f5a2b..709419c7cde4 100644 --- a/drivers/acpi/acpica/evhandler.c +++ b/drivers/acpi/acpica/evhandler.c | |||
| @@ -159,7 +159,7 @@ acpi_ev_has_default_handler(struct acpi_namespace_node *node, | |||
| 159 | 159 | ||
| 160 | obj_desc = acpi_ns_get_attached_object(node); | 160 | obj_desc = acpi_ns_get_attached_object(node); |
| 161 | if (obj_desc) { | 161 | if (obj_desc) { |
| 162 | handler_obj = obj_desc->device.handler; | 162 | handler_obj = obj_desc->common_notify.handler; |
| 163 | 163 | ||
| 164 | /* Walk the linked list of handlers for this object */ | 164 | /* Walk the linked list of handlers for this object */ |
| 165 | 165 | ||
| @@ -247,35 +247,31 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
| 247 | 247 | ||
| 248 | /* Check if this Device already has a handler for this address space */ | 248 | /* Check if this Device already has a handler for this address space */ |
| 249 | 249 | ||
| 250 | next_handler_obj = obj_desc->device.handler; | 250 | next_handler_obj = |
| 251 | while (next_handler_obj) { | 251 | acpi_ev_find_region_handler(handler_obj->address_space. |
| 252 | space_id, | ||
| 253 | obj_desc->common_notify. | ||
| 254 | handler); | ||
| 255 | if (next_handler_obj) { | ||
| 252 | 256 | ||
| 253 | /* Found a handler, is it for the same address space? */ | 257 | /* Found a handler, is it for the same address space? */ |
| 254 | 258 | ||
| 255 | if (next_handler_obj->address_space.space_id == | 259 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
| 256 | handler_obj->address_space.space_id) { | 260 | "Found handler for region [%s] in device %p(%p) handler %p\n", |
| 257 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 261 | acpi_ut_get_region_name(handler_obj-> |
| 258 | "Found handler for region [%s] in device %p(%p) " | 262 | address_space. |
| 259 | "handler %p\n", | 263 | space_id), |
| 260 | acpi_ut_get_region_name | 264 | obj_desc, next_handler_obj, |
| 261 | (handler_obj->address_space. | 265 | handler_obj)); |
| 262 | space_id), obj_desc, | 266 | |
| 263 | next_handler_obj, | 267 | /* |
| 264 | handler_obj)); | 268 | * Since the object we found it on was a device, then it means |
| 265 | 269 | * that someone has already installed a handler for the branch | |
| 266 | /* | 270 | * of the namespace from this device on. Just bail out telling |
| 267 | * Since the object we found it on was a device, then it | 271 | * the walk routine to not traverse this branch. This preserves |
| 268 | * means that someone has already installed a handler for | 272 | * the scoping rule for handlers. |
| 269 | * the branch of the namespace from this device on. Just | 273 | */ |
| 270 | * bail out telling the walk routine to not traverse this | 274 | return (AE_CTRL_DEPTH); |
| 271 | * branch. This preserves the scoping rule for handlers. | ||
| 272 | */ | ||
| 273 | return (AE_CTRL_DEPTH); | ||
| 274 | } | ||
| 275 | |||
| 276 | /* Walk the linked list of handlers attached to this device */ | ||
| 277 | |||
| 278 | next_handler_obj = next_handler_obj->address_space.next; | ||
| 279 | } | 275 | } |
| 280 | 276 | ||
| 281 | /* | 277 | /* |
| @@ -309,6 +305,44 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
| 309 | 305 | ||
| 310 | /******************************************************************************* | 306 | /******************************************************************************* |
| 311 | * | 307 | * |
| 308 | * FUNCTION: acpi_ev_find_region_handler | ||
| 309 | * | ||
| 310 | * PARAMETERS: space_id - The address space ID | ||
| 311 | * handler_obj - Head of the handler object list | ||
| 312 | * | ||
| 313 | * RETURN: Matching handler object. NULL if space ID not matched | ||
| 314 | * | ||
| 315 | * DESCRIPTION: Search a handler object list for a match on the address | ||
| 316 | * space ID. | ||
| 317 | * | ||
| 318 | ******************************************************************************/ | ||
| 319 | |||
| 320 | union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type | ||
| 321 | space_id, | ||
| 322 | union acpi_operand_object | ||
| 323 | *handler_obj) | ||
| 324 | { | ||
| 325 | |||
| 326 | /* Walk the handler list for this device */ | ||
| 327 | |||
| 328 | while (handler_obj) { | ||
| 329 | |||
| 330 | /* Same space_id indicates a handler is installed */ | ||
| 331 | |||
| 332 | if (handler_obj->address_space.space_id == space_id) { | ||
| 333 | return (handler_obj); | ||
| 334 | } | ||
| 335 | |||
| 336 | /* Next handler object */ | ||
| 337 | |||
| 338 | handler_obj = handler_obj->address_space.next; | ||
| 339 | } | ||
| 340 | |||
| 341 | return (NULL); | ||
| 342 | } | ||
| 343 | |||
| 344 | /******************************************************************************* | ||
| 345 | * | ||
| 312 | * FUNCTION: acpi_ev_install_space_handler | 346 | * FUNCTION: acpi_ev_install_space_handler |
| 313 | * | 347 | * |
| 314 | * PARAMETERS: node - Namespace node for the device | 348 | * PARAMETERS: node - Namespace node for the device |
| @@ -332,15 +366,15 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
| 332 | { | 366 | { |
| 333 | union acpi_operand_object *obj_desc; | 367 | union acpi_operand_object *obj_desc; |
| 334 | union acpi_operand_object *handler_obj; | 368 | union acpi_operand_object *handler_obj; |
| 335 | acpi_status status; | 369 | acpi_status status = AE_OK; |
| 336 | acpi_object_type type; | 370 | acpi_object_type type; |
| 337 | u8 flags = 0; | 371 | u8 flags = 0; |
| 338 | 372 | ||
| 339 | ACPI_FUNCTION_TRACE(ev_install_space_handler); | 373 | ACPI_FUNCTION_TRACE(ev_install_space_handler); |
| 340 | 374 | ||
| 341 | /* | 375 | /* |
| 342 | * This registration is valid for only the types below and the root. This | 376 | * This registration is valid for only the types below and the root. |
| 343 | * is where the default handlers get placed. | 377 | * The root node is where the default handlers get installed. |
| 344 | */ | 378 | */ |
| 345 | if ((node->type != ACPI_TYPE_DEVICE) && | 379 | if ((node->type != ACPI_TYPE_DEVICE) && |
| 346 | (node->type != ACPI_TYPE_PROCESSOR) && | 380 | (node->type != ACPI_TYPE_PROCESSOR) && |
| @@ -407,38 +441,30 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
| 407 | obj_desc = acpi_ns_get_attached_object(node); | 441 | obj_desc = acpi_ns_get_attached_object(node); |
| 408 | if (obj_desc) { | 442 | if (obj_desc) { |
| 409 | /* | 443 | /* |
| 410 | * The attached device object already exists. Make sure the handler | 444 | * The attached device object already exists. Now make sure |
| 411 | * is not already installed. | 445 | * the handler is not already installed. |
| 412 | */ | 446 | */ |
| 413 | handler_obj = obj_desc->device.handler; | 447 | handler_obj = acpi_ev_find_region_handler(space_id, |
| 414 | 448 | obj_desc-> | |
| 415 | /* Walk the handler list for this device */ | 449 | common_notify. |
| 416 | 450 | handler); | |
| 417 | while (handler_obj) { | ||
| 418 | |||
| 419 | /* Same space_id indicates a handler already installed */ | ||
| 420 | 451 | ||
| 421 | if (handler_obj->address_space.space_id == space_id) { | 452 | if (handler_obj) { |
| 422 | if (handler_obj->address_space.handler == | 453 | if (handler_obj->address_space.handler == handler) { |
| 423 | handler) { | 454 | /* |
| 424 | /* | 455 | * It is (relatively) OK to attempt to install the SAME |
| 425 | * It is (relatively) OK to attempt to install the SAME | 456 | * handler twice. This can easily happen with the |
| 426 | * handler twice. This can easily happen with the | 457 | * PCI_Config space. |
| 427 | * PCI_Config space. | 458 | */ |
| 428 | */ | 459 | status = AE_SAME_HANDLER; |
| 429 | status = AE_SAME_HANDLER; | ||
| 430 | goto unlock_and_exit; | ||
| 431 | } else { | ||
| 432 | /* A handler is already installed */ | ||
| 433 | |||
| 434 | status = AE_ALREADY_EXISTS; | ||
| 435 | } | ||
| 436 | goto unlock_and_exit; | 460 | goto unlock_and_exit; |
| 437 | } | 461 | } else { |
| 462 | /* A handler is already installed */ | ||
| 438 | 463 | ||
| 439 | /* Walk the linked list of handlers */ | 464 | status = AE_ALREADY_EXISTS; |
| 465 | } | ||
| 440 | 466 | ||
| 441 | handler_obj = handler_obj->address_space.next; | 467 | goto unlock_and_exit; |
| 442 | } | 468 | } |
| 443 | } else { | 469 | } else { |
| 444 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 470 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
| @@ -477,7 +503,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
| 477 | } | 503 | } |
| 478 | 504 | ||
| 479 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 505 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
| 480 | "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", | 506 | "Installing address handler for region %s(%X) " |
| 507 | "on Device %4.4s %p(%p)\n", | ||
| 481 | acpi_ut_get_region_name(space_id), space_id, | 508 | acpi_ut_get_region_name(space_id), space_id, |
| 482 | acpi_ut_get_node_name(node), node, obj_desc)); | 509 | acpi_ut_get_node_name(node), node, obj_desc)); |
| 483 | 510 | ||
| @@ -506,28 +533,26 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
| 506 | 533 | ||
| 507 | /* Install at head of Device.address_space list */ | 534 | /* Install at head of Device.address_space list */ |
| 508 | 535 | ||
| 509 | handler_obj->address_space.next = obj_desc->device.handler; | 536 | handler_obj->address_space.next = obj_desc->common_notify.handler; |
| 510 | 537 | ||
| 511 | /* | 538 | /* |
| 512 | * The Device object is the first reference on the handler_obj. | 539 | * The Device object is the first reference on the handler_obj. |
| 513 | * Each region that uses the handler adds a reference. | 540 | * Each region that uses the handler adds a reference. |
| 514 | */ | 541 | */ |
| 515 | obj_desc->device.handler = handler_obj; | 542 | obj_desc->common_notify.handler = handler_obj; |
| 516 | 543 | ||
| 517 | /* | 544 | /* |
| 518 | * Walk the namespace finding all of the regions this | 545 | * Walk the namespace finding all of the regions this handler will |
| 519 | * handler will manage. | 546 | * manage. |
| 520 | * | 547 | * |
| 521 | * Start at the device and search the branch toward | 548 | * Start at the device and search the branch toward the leaf nodes |
| 522 | * the leaf nodes until either the leaf is encountered or | 549 | * until either the leaf is encountered or a device is detected that |
| 523 | * a device is detected that has an address handler of the | 550 | * has an address handler of the same type. |
| 524 | * same type. | ||
| 525 | * | 551 | * |
| 526 | * In either case, back up and search down the remainder | 552 | * In either case, back up and search down the remainder of the branch |
| 527 | * of the branch | ||
| 528 | */ | 553 | */ |
| 529 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, | 554 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, |
| 530 | ACPI_NS_WALK_UNLOCK, | 555 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
| 531 | acpi_ev_install_handler, NULL, | 556 | acpi_ev_install_handler, NULL, |
| 532 | handler_obj, NULL); | 557 | handler_obj, NULL); |
| 533 | 558 | ||
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index f7c9dfe7b990..8866f50d38f7 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
| @@ -68,6 +68,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); | |||
| 68 | 68 | ||
| 69 | u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node) | 69 | u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node) |
| 70 | { | 70 | { |
| 71 | |||
| 71 | switch (node->type) { | 72 | switch (node->type) { |
| 72 | case ACPI_TYPE_DEVICE: | 73 | case ACPI_TYPE_DEVICE: |
| 73 | case ACPI_TYPE_PROCESSOR: | 74 | case ACPI_TYPE_PROCESSOR: |
| @@ -170,8 +171,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
| 170 | acpi_ut_get_notify_name(notify_value, ACPI_TYPE_ANY), | 171 | acpi_ut_get_notify_name(notify_value, ACPI_TYPE_ANY), |
| 171 | node)); | 172 | node)); |
| 172 | 173 | ||
| 173 | status = acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, | 174 | status = acpi_os_execute(OSL_NOTIFY_HANDLER, |
| 174 | info); | 175 | acpi_ev_notify_dispatch, info); |
| 175 | if (ACPI_FAILURE(status)) { | 176 | if (ACPI_FAILURE(status)) { |
| 176 | acpi_ut_delete_generic_state(info); | 177 | acpi_ut_delete_generic_state(info); |
| 177 | } | 178 | } |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 5ee79a16fe33..a43178f20c59 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
| @@ -97,15 +97,12 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
| 97 | if (acpi_ev_has_default_handler(acpi_gbl_root_node, | 97 | if (acpi_ev_has_default_handler(acpi_gbl_root_node, |
| 98 | acpi_gbl_default_address_spaces | 98 | acpi_gbl_default_address_spaces |
| 99 | [i])) { | 99 | [i])) { |
| 100 | status = | 100 | acpi_ev_execute_reg_methods(acpi_gbl_root_node, |
| 101 | acpi_ev_execute_reg_methods(acpi_gbl_root_node, | 101 | acpi_gbl_default_address_spaces |
| 102 | acpi_gbl_default_address_spaces | 102 | [i], ACPI_REG_CONNECT); |
| 103 | [i]); | ||
| 104 | } | 103 | } |
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | acpi_gbl_reg_methods_executed = TRUE; | ||
| 108 | |||
| 109 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 106 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| 110 | return_ACPI_STATUS(status); | 107 | return_ACPI_STATUS(status); |
| 111 | } | 108 | } |
| @@ -127,6 +124,12 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
| 127 | * DESCRIPTION: Dispatch an address space or operation region access to | 124 | * DESCRIPTION: Dispatch an address space or operation region access to |
| 128 | * a previously installed handler. | 125 | * a previously installed handler. |
| 129 | * | 126 | * |
| 127 | * NOTE: During early initialization, we always install the default region | ||
| 128 | * handlers for Memory, I/O and PCI_Config. This ensures that these operation | ||
| 129 | * region address spaces are always available as per the ACPI specification. | ||
| 130 | * This is especially needed in order to support the execution of | ||
| 131 | * module-level AML code during loading of the ACPI tables. | ||
| 132 | * | ||
| 130 | ******************************************************************************/ | 133 | ******************************************************************************/ |
| 131 | 134 | ||
| 132 | acpi_status | 135 | acpi_status |
| @@ -498,6 +501,12 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, | |||
| 498 | 501 | ||
| 499 | ACPI_FUNCTION_TRACE(ev_attach_region); | 502 | ACPI_FUNCTION_TRACE(ev_attach_region); |
| 500 | 503 | ||
| 504 | /* Install the region's handler */ | ||
| 505 | |||
| 506 | if (region_obj->region.handler) { | ||
| 507 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | ||
| 508 | } | ||
| 509 | |||
| 501 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 510 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
| 502 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", | 511 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", |
| 503 | acpi_ut_get_node_name(region_obj->region.node), | 512 | acpi_ut_get_node_name(region_obj->region.node), |
| @@ -509,17 +518,56 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, | |||
| 509 | 518 | ||
| 510 | region_obj->region.next = handler_obj->address_space.region_list; | 519 | region_obj->region.next = handler_obj->address_space.region_list; |
| 511 | handler_obj->address_space.region_list = region_obj; | 520 | handler_obj->address_space.region_list = region_obj; |
| 521 | region_obj->region.handler = handler_obj; | ||
| 522 | acpi_ut_add_reference(handler_obj); | ||
| 512 | 523 | ||
| 513 | /* Install the region's handler */ | 524 | return_ACPI_STATUS(AE_OK); |
| 525 | } | ||
| 514 | 526 | ||
| 515 | if (region_obj->region.handler) { | 527 | /******************************************************************************* |
| 516 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 528 | * |
| 529 | * FUNCTION: acpi_ev_associate_reg_method | ||
| 530 | * | ||
| 531 | * PARAMETERS: region_obj - Region object | ||
| 532 | * | ||
| 533 | * RETURN: Status | ||
| 534 | * | ||
| 535 | * DESCRIPTION: Find and associate _REG method to a region | ||
| 536 | * | ||
| 537 | ******************************************************************************/ | ||
| 538 | |||
| 539 | void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj) | ||
| 540 | { | ||
| 541 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | ||
| 542 | struct acpi_namespace_node *method_node; | ||
| 543 | struct acpi_namespace_node *node; | ||
| 544 | union acpi_operand_object *region_obj2; | ||
| 545 | acpi_status status; | ||
| 546 | |||
| 547 | ACPI_FUNCTION_TRACE(ev_associate_reg_method); | ||
| 548 | |||
| 549 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | ||
| 550 | if (!region_obj2) { | ||
| 551 | return_VOID; | ||
| 517 | } | 552 | } |
| 518 | 553 | ||
| 519 | region_obj->region.handler = handler_obj; | 554 | node = region_obj->region.node->parent; |
| 520 | acpi_ut_add_reference(handler_obj); | ||
| 521 | 555 | ||
| 522 | return_ACPI_STATUS(AE_OK); | 556 | /* Find any "_REG" method associated with this region definition */ |
| 557 | |||
| 558 | status = | ||
| 559 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, | ||
| 560 | &method_node); | ||
| 561 | if (ACPI_SUCCESS(status)) { | ||
| 562 | /* | ||
| 563 | * The _REG method is optional and there can be only one per region | ||
| 564 | * definition. This will be executed when the handler is attached | ||
| 565 | * or removed | ||
| 566 | */ | ||
| 567 | region_obj2->extra.method_REG = method_node; | ||
| 568 | } | ||
| 569 | |||
| 570 | return_VOID; | ||
| 523 | } | 571 | } |
| 524 | 572 | ||
| 525 | /******************************************************************************* | 573 | /******************************************************************************* |
| @@ -550,7 +598,18 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
| 550 | return_ACPI_STATUS(AE_NOT_EXIST); | 598 | return_ACPI_STATUS(AE_NOT_EXIST); |
| 551 | } | 599 | } |
| 552 | 600 | ||
| 553 | if (region_obj2->extra.method_REG == NULL) { | 601 | if (region_obj2->extra.method_REG == NULL || |
| 602 | region_obj->region.handler == NULL || | ||
| 603 | !acpi_gbl_reg_methods_enabled) { | ||
| 604 | return_ACPI_STATUS(AE_OK); | ||
| 605 | } | ||
| 606 | |||
| 607 | /* _REG(DISCONNECT) should be paired with _REG(CONNECT) */ | ||
| 608 | |||
| 609 | if ((function == ACPI_REG_CONNECT && | ||
| 610 | region_obj->common.flags & AOPOBJ_REG_CONNECTED) || | ||
| 611 | (function == ACPI_REG_DISCONNECT && | ||
| 612 | !(region_obj->common.flags & AOPOBJ_REG_CONNECTED))) { | ||
| 554 | return_ACPI_STATUS(AE_OK); | 613 | return_ACPI_STATUS(AE_OK); |
| 555 | } | 614 | } |
| 556 | 615 | ||
| @@ -599,6 +658,16 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
| 599 | status = acpi_ns_evaluate(info); | 658 | status = acpi_ns_evaluate(info); |
| 600 | acpi_ut_remove_reference(args[1]); | 659 | acpi_ut_remove_reference(args[1]); |
| 601 | 660 | ||
| 661 | if (ACPI_FAILURE(status)) { | ||
| 662 | goto cleanup2; | ||
| 663 | } | ||
| 664 | |||
| 665 | if (function == ACPI_REG_CONNECT) { | ||
| 666 | region_obj->common.flags |= AOPOBJ_REG_CONNECTED; | ||
| 667 | } else { | ||
| 668 | region_obj->common.flags &= ~AOPOBJ_REG_CONNECTED; | ||
| 669 | } | ||
| 670 | |||
| 602 | cleanup2: | 671 | cleanup2: |
| 603 | acpi_ut_remove_reference(args[0]); | 672 | acpi_ut_remove_reference(args[0]); |
| 604 | 673 | ||
| @@ -613,24 +682,25 @@ cleanup1: | |||
| 613 | * | 682 | * |
| 614 | * PARAMETERS: node - Namespace node for the device | 683 | * PARAMETERS: node - Namespace node for the device |
| 615 | * space_id - The address space ID | 684 | * space_id - The address space ID |
| 685 | * function - Passed to _REG: On (1) or Off (0) | ||
| 616 | * | 686 | * |
| 617 | * RETURN: Status | 687 | * RETURN: None |
| 618 | * | 688 | * |
| 619 | * DESCRIPTION: Run all _REG methods for the input Space ID; | 689 | * DESCRIPTION: Run all _REG methods for the input Space ID; |
| 620 | * Note: assumes namespace is locked, or system init time. | 690 | * Note: assumes namespace is locked, or system init time. |
| 621 | * | 691 | * |
| 622 | ******************************************************************************/ | 692 | ******************************************************************************/ |
| 623 | 693 | ||
| 624 | acpi_status | 694 | void |
| 625 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | 695 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, |
| 626 | acpi_adr_space_type space_id) | 696 | acpi_adr_space_type space_id, u32 function) |
| 627 | { | 697 | { |
| 628 | acpi_status status; | ||
| 629 | struct acpi_reg_walk_info info; | 698 | struct acpi_reg_walk_info info; |
| 630 | 699 | ||
| 631 | ACPI_FUNCTION_TRACE(ev_execute_reg_methods); | 700 | ACPI_FUNCTION_TRACE(ev_execute_reg_methods); |
| 632 | 701 | ||
| 633 | info.space_id = space_id; | 702 | info.space_id = space_id; |
| 703 | info.function = function; | ||
| 634 | info.reg_run_count = 0; | 704 | info.reg_run_count = 0; |
| 635 | 705 | ||
| 636 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES, | 706 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES, |
| @@ -643,9 +713,9 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
| 643 | * regions and _REG methods. (i.e. handlers must be installed for all | 713 | * regions and _REG methods. (i.e. handlers must be installed for all |
| 644 | * regions of this Space ID before we can run any _REG methods) | 714 | * regions of this Space ID before we can run any _REG methods) |
| 645 | */ | 715 | */ |
| 646 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, | 716 | (void)acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, |
| 647 | ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, | 717 | ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, NULL, |
| 648 | NULL, &info, NULL); | 718 | &info, NULL); |
| 649 | 719 | ||
| 650 | /* Special case for EC: handle "orphan" _REG methods with no region */ | 720 | /* Special case for EC: handle "orphan" _REG methods with no region */ |
| 651 | 721 | ||
| @@ -658,7 +728,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
| 658 | info.reg_run_count, | 728 | info.reg_run_count, |
| 659 | acpi_ut_get_region_name(info.space_id))); | 729 | acpi_ut_get_region_name(info.space_id))); |
| 660 | 730 | ||
| 661 | return_ACPI_STATUS(status); | 731 | return_VOID; |
| 662 | } | 732 | } |
| 663 | 733 | ||
| 664 | /******************************************************************************* | 734 | /******************************************************************************* |
| @@ -717,7 +787,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, | |||
| 717 | } | 787 | } |
| 718 | 788 | ||
| 719 | info->reg_run_count++; | 789 | info->reg_run_count++; |
| 720 | status = acpi_ev_execute_reg_method(obj_desc, ACPI_REG_CONNECT); | 790 | status = acpi_ev_execute_reg_method(obj_desc, info->function); |
| 721 | return (status); | 791 | return (status); |
| 722 | } | 792 | } |
| 723 | 793 | ||
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index da323390bb70..bb2e529249c7 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
| @@ -507,9 +507,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
| 507 | acpi_adr_space_type space_id; | 507 | acpi_adr_space_type space_id; |
| 508 | struct acpi_namespace_node *node; | 508 | struct acpi_namespace_node *node; |
| 509 | acpi_status status; | 509 | acpi_status status; |
| 510 | struct acpi_namespace_node *method_node; | ||
| 511 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | ||
| 512 | union acpi_operand_object *region_obj2; | ||
| 513 | 510 | ||
| 514 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); | 511 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); |
| 515 | 512 | ||
| @@ -521,38 +518,15 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
| 521 | return_ACPI_STATUS(AE_OK); | 518 | return_ACPI_STATUS(AE_OK); |
| 522 | } | 519 | } |
| 523 | 520 | ||
| 524 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 521 | acpi_ev_associate_reg_method(region_obj); |
| 525 | if (!region_obj2) { | 522 | region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; |
| 526 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
| 527 | } | ||
| 528 | 523 | ||
| 529 | node = region_obj->region.node->parent; | 524 | node = region_obj->region.node->parent; |
| 530 | space_id = region_obj->region.space_id; | 525 | space_id = region_obj->region.space_id; |
| 531 | 526 | ||
| 532 | /* Setup defaults */ | ||
| 533 | |||
| 534 | region_obj->region.handler = NULL; | ||
| 535 | region_obj2->extra.method_REG = NULL; | ||
| 536 | region_obj->common.flags &= ~(AOPOBJ_SETUP_COMPLETE); | ||
| 537 | region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; | ||
| 538 | |||
| 539 | /* Find any "_REG" method associated with this region definition */ | ||
| 540 | |||
| 541 | status = | ||
| 542 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, | ||
| 543 | &method_node); | ||
| 544 | if (ACPI_SUCCESS(status)) { | ||
| 545 | /* | ||
| 546 | * The _REG method is optional and there can be only one per region | ||
| 547 | * definition. This will be executed when the handler is attached | ||
| 548 | * or removed | ||
| 549 | */ | ||
| 550 | region_obj2->extra.method_REG = method_node; | ||
| 551 | } | ||
| 552 | |||
| 553 | /* | 527 | /* |
| 554 | * The following loop depends upon the root Node having no parent | 528 | * The following loop depends upon the root Node having no parent |
| 555 | * ie: acpi_gbl_root_node->parent_entry being set to NULL | 529 | * ie: acpi_gbl_root_node->Parent being set to NULL |
| 556 | */ | 530 | */ |
| 557 | while (node) { | 531 | while (node) { |
| 558 | 532 | ||
| @@ -566,18 +540,10 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
| 566 | 540 | ||
| 567 | switch (node->type) { | 541 | switch (node->type) { |
| 568 | case ACPI_TYPE_DEVICE: | 542 | case ACPI_TYPE_DEVICE: |
| 569 | |||
| 570 | handler_obj = obj_desc->device.handler; | ||
| 571 | break; | ||
| 572 | |||
| 573 | case ACPI_TYPE_PROCESSOR: | 543 | case ACPI_TYPE_PROCESSOR: |
| 574 | |||
| 575 | handler_obj = obj_desc->processor.handler; | ||
| 576 | break; | ||
| 577 | |||
| 578 | case ACPI_TYPE_THERMAL: | 544 | case ACPI_TYPE_THERMAL: |
| 579 | 545 | ||
| 580 | handler_obj = obj_desc->thermal_zone.handler; | 546 | handler_obj = obj_desc->common_notify.handler; |
| 581 | break; | 547 | break; |
| 582 | 548 | ||
| 583 | case ACPI_TYPE_METHOD: | 549 | case ACPI_TYPE_METHOD: |
| @@ -602,60 +568,49 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
| 602 | break; | 568 | break; |
| 603 | } | 569 | } |
| 604 | 570 | ||
| 605 | while (handler_obj) { | 571 | handler_obj = |
| 606 | 572 | acpi_ev_find_region_handler(space_id, handler_obj); | |
| 607 | /* Is this handler of the correct type? */ | 573 | if (handler_obj) { |
| 608 | 574 | ||
| 609 | if (handler_obj->address_space.space_id == | 575 | /* Found correct handler */ |
| 610 | space_id) { | ||
| 611 | 576 | ||
| 612 | /* Found correct handler */ | 577 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
| 578 | "Found handler %p for region %p in obj %p\n", | ||
| 579 | handler_obj, region_obj, | ||
| 580 | obj_desc)); | ||
| 613 | 581 | ||
| 614 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 582 | status = |
| 615 | "Found handler %p for region %p in obj %p\n", | 583 | acpi_ev_attach_region(handler_obj, |
| 616 | handler_obj, | ||
| 617 | region_obj, | 584 | region_obj, |
| 618 | obj_desc)); | 585 | acpi_ns_locked); |
| 619 | 586 | ||
| 587 | /* | ||
| 588 | * Tell all users that this region is usable by | ||
| 589 | * running the _REG method | ||
| 590 | */ | ||
| 591 | if (acpi_ns_locked) { | ||
| 620 | status = | 592 | status = |
| 621 | acpi_ev_attach_region(handler_obj, | 593 | acpi_ut_release_mutex |
| 622 | region_obj, | 594 | (ACPI_MTX_NAMESPACE); |
| 623 | acpi_ns_locked); | 595 | if (ACPI_FAILURE(status)) { |
| 624 | 596 | return_ACPI_STATUS(status); | |
| 625 | /* | ||
| 626 | * Tell all users that this region is usable by | ||
| 627 | * running the _REG method | ||
| 628 | */ | ||
| 629 | if (acpi_ns_locked) { | ||
| 630 | status = | ||
| 631 | acpi_ut_release_mutex | ||
| 632 | (ACPI_MTX_NAMESPACE); | ||
| 633 | if (ACPI_FAILURE(status)) { | ||
| 634 | return_ACPI_STATUS | ||
| 635 | (status); | ||
| 636 | } | ||
| 637 | } | 597 | } |
| 598 | } | ||
| 638 | 599 | ||
| 600 | status = | ||
| 601 | acpi_ev_execute_reg_method(region_obj, | ||
| 602 | ACPI_REG_CONNECT); | ||
| 603 | |||
| 604 | if (acpi_ns_locked) { | ||
| 639 | status = | 605 | status = |
| 640 | acpi_ev_execute_reg_method | 606 | acpi_ut_acquire_mutex |
| 641 | (region_obj, ACPI_REG_CONNECT); | 607 | (ACPI_MTX_NAMESPACE); |
| 642 | 608 | if (ACPI_FAILURE(status)) { | |
| 643 | if (acpi_ns_locked) { | 609 | return_ACPI_STATUS(status); |
| 644 | status = | ||
| 645 | acpi_ut_acquire_mutex | ||
| 646 | (ACPI_MTX_NAMESPACE); | ||
| 647 | if (ACPI_FAILURE(status)) { | ||
| 648 | return_ACPI_STATUS | ||
| 649 | (status); | ||
| 650 | } | ||
| 651 | } | 610 | } |
| 652 | |||
| 653 | return_ACPI_STATUS(AE_OK); | ||
| 654 | } | 611 | } |
| 655 | 612 | ||
| 656 | /* Try next handler in the list */ | 613 | return_ACPI_STATUS(AE_OK); |
| 657 | |||
| 658 | handler_obj = handler_obj->address_space.next; | ||
| 659 | } | 614 | } |
| 660 | } | 615 | } |
| 661 | 616 | ||
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 07d22bfbaa00..012b9dedfa79 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
| @@ -879,9 +879,8 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
| 879 | 879 | ||
| 880 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); | 880 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); |
| 881 | 881 | ||
| 882 | status = | 882 | status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, |
| 883 | acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, FALSE, | 883 | FALSE, address, context); |
| 884 | address, context); | ||
| 885 | 884 | ||
| 886 | return_ACPI_STATUS(status); | 885 | return_ACPI_STATUS(status); |
| 887 | } | 886 | } |
| @@ -914,8 +913,8 @@ acpi_install_gpe_raw_handler(acpi_handle gpe_device, | |||
| 914 | 913 | ||
| 915 | ACPI_FUNCTION_TRACE(acpi_install_gpe_raw_handler); | 914 | ACPI_FUNCTION_TRACE(acpi_install_gpe_raw_handler); |
| 916 | 915 | ||
| 917 | status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, TRUE, | 916 | status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, |
| 918 | address, context); | 917 | TRUE, address, context); |
| 919 | 918 | ||
| 920 | return_ACPI_STATUS(status); | 919 | return_ACPI_STATUS(status); |
| 921 | } | 920 | } |
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index f21afbab03f7..35f9e60ce2b7 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
| @@ -112,41 +112,9 @@ acpi_install_address_space_handler(acpi_handle device, | |||
| 112 | goto unlock_and_exit; | 112 | goto unlock_and_exit; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /* | ||
| 116 | * For the default space_IDs, (the IDs for which there are default region handlers | ||
| 117 | * installed) Only execute the _REG methods if the global initialization _REG | ||
| 118 | * methods have already been run (via acpi_initialize_objects). In other words, | ||
| 119 | * we will defer the execution of the _REG methods for these space_IDs until | ||
| 120 | * execution of acpi_initialize_objects. This is done because we need the handlers | ||
| 121 | * for the default spaces (mem/io/pci/table) to be installed before we can run | ||
| 122 | * any control methods (or _REG methods). There is known BIOS code that depends | ||
| 123 | * on this. | ||
| 124 | * | ||
| 125 | * For all other space_IDs, we can safely execute the _REG methods immediately. | ||
| 126 | * This means that for IDs like embedded_controller, this function should be called | ||
| 127 | * only after acpi_enable_subsystem has been called. | ||
| 128 | */ | ||
| 129 | switch (space_id) { | ||
| 130 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
| 131 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
| 132 | case ACPI_ADR_SPACE_PCI_CONFIG: | ||
| 133 | case ACPI_ADR_SPACE_DATA_TABLE: | ||
| 134 | |||
| 135 | if (!acpi_gbl_reg_methods_executed) { | ||
| 136 | |||
| 137 | /* We will defer execution of the _REG methods for this space */ | ||
| 138 | goto unlock_and_exit; | ||
| 139 | } | ||
| 140 | break; | ||
| 141 | |||
| 142 | default: | ||
| 143 | |||
| 144 | break; | ||
| 145 | } | ||
| 146 | |||
| 147 | /* Run all _REG methods for this address space */ | 115 | /* Run all _REG methods for this address space */ |
| 148 | 116 | ||
| 149 | status = acpi_ev_execute_reg_methods(node, space_id); | 117 | acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT); |
| 150 | 118 | ||
| 151 | unlock_and_exit: | 119 | unlock_and_exit: |
| 152 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 120 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| @@ -215,8 +183,8 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
| 215 | 183 | ||
| 216 | /* Find the address handler the user requested */ | 184 | /* Find the address handler the user requested */ |
| 217 | 185 | ||
| 218 | handler_obj = obj_desc->device.handler; | 186 | handler_obj = obj_desc->common_notify.handler; |
| 219 | last_obj_ptr = &obj_desc->device.handler; | 187 | last_obj_ptr = &obj_desc->common_notify.handler; |
| 220 | while (handler_obj) { | 188 | while (handler_obj) { |
| 221 | 189 | ||
| 222 | /* We have a handler, see if user requested this one */ | 190 | /* We have a handler, see if user requested this one */ |
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index b540913c11ac..adcb9c7029c4 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
| @@ -358,8 +358,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | /* | 360 | /* |
| 361 | * If the Region Address and Length have not been previously evaluated, | 361 | * If the Region Address and Length have not been previously |
| 362 | * evaluate them now and save the results. | 362 | * evaluated, evaluate them now and save the results. |
| 363 | */ | 363 | */ |
| 364 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { | 364 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { |
| 365 | status = acpi_ds_get_region_arguments(obj_desc); | 365 | status = acpi_ds_get_region_arguments(obj_desc); |
| @@ -454,8 +454,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
| 454 | } | 454 | } |
| 455 | 455 | ||
| 456 | /* | 456 | /* |
| 457 | * Copy the table from the buffer because the buffer could be modified | 457 | * Copy the table from the buffer because the buffer could be |
| 458 | * or even deleted in the future | 458 | * modified or even deleted in the future |
| 459 | */ | 459 | */ |
| 460 | table = ACPI_ALLOCATE(length); | 460 | table = ACPI_ALLOCATE(length); |
| 461 | if (!table) { | 461 | if (!table) { |
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 1e4c5b6dc0b0..73c2e823488d 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
| @@ -227,8 +227,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, | |||
| 227 | /* Copy the integer to the buffer, LSB first */ | 227 | /* Copy the integer to the buffer, LSB first */ |
| 228 | 228 | ||
| 229 | new_buf = return_desc->buffer.pointer; | 229 | new_buf = return_desc->buffer.pointer; |
| 230 | memcpy(new_buf, | 230 | memcpy(new_buf, &obj_desc->integer.value, |
| 231 | &obj_desc->integer.value, acpi_gbl_integer_byte_width); | 231 | acpi_gbl_integer_byte_width); |
| 232 | break; | 232 | break; |
| 233 | 233 | ||
| 234 | case ACPI_TYPE_STRING: | 234 | case ACPI_TYPE_STRING: |
| @@ -354,9 +354,8 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width) | |||
| 354 | 354 | ||
| 355 | /* Get one hex digit, most significant digits first */ | 355 | /* Get one hex digit, most significant digits first */ |
| 356 | 356 | ||
| 357 | string[k] = | 357 | string[k] = (u8) |
| 358 | (u8) acpi_ut_hex_to_ascii_char(integer, | 358 | acpi_ut_hex_to_ascii_char(integer, ACPI_MUL_4(j)); |
| 359 | ACPI_MUL_4(j)); | ||
| 360 | k++; | 359 | k++; |
| 361 | } | 360 | } |
| 362 | break; | 361 | break; |
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index ccb7219bdcee..46be5a276863 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
| @@ -189,9 +189,9 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) | |||
| 189 | 189 | ||
| 190 | /* Attach object to the Node */ | 190 | /* Attach object to the Node */ |
| 191 | 191 | ||
| 192 | status = | 192 | status = acpi_ns_attach_object((struct acpi_namespace_node *) |
| 193 | acpi_ns_attach_object((struct acpi_namespace_node *)walk_state-> | 193 | walk_state->operands[0], obj_desc, |
| 194 | operands[0], obj_desc, ACPI_TYPE_EVENT); | 194 | ACPI_TYPE_EVENT); |
| 195 | 195 | ||
| 196 | cleanup: | 196 | cleanup: |
| 197 | /* | 197 | /* |
| @@ -326,9 +326,10 @@ acpi_ex_create_region(u8 * aml_start, | |||
| 326 | * Remember location in AML stream of address & length | 326 | * Remember location in AML stream of address & length |
| 327 | * operands since they need to be evaluated at run time. | 327 | * operands since they need to be evaluated at run time. |
| 328 | */ | 328 | */ |
| 329 | region_obj2 = obj_desc->common.next_object; | 329 | region_obj2 = acpi_ns_get_secondary_object(obj_desc); |
| 330 | region_obj2->extra.aml_start = aml_start; | 330 | region_obj2->extra.aml_start = aml_start; |
| 331 | region_obj2->extra.aml_length = aml_length; | 331 | region_obj2->extra.aml_length = aml_length; |
| 332 | region_obj2->extra.method_REG = NULL; | ||
| 332 | if (walk_state->scope_info) { | 333 | if (walk_state->scope_info) { |
| 333 | region_obj2->extra.scope_node = | 334 | region_obj2->extra.scope_node = |
| 334 | walk_state->scope_info->scope.node; | 335 | walk_state->scope_info->scope.node; |
| @@ -342,6 +343,10 @@ acpi_ex_create_region(u8 * aml_start, | |||
| 342 | obj_desc->region.address = 0; | 343 | obj_desc->region.address = 0; |
| 343 | obj_desc->region.length = 0; | 344 | obj_desc->region.length = 0; |
| 344 | obj_desc->region.node = node; | 345 | obj_desc->region.node = node; |
| 346 | obj_desc->region.handler = NULL; | ||
| 347 | obj_desc->common.flags &= | ||
| 348 | ~(AOPOBJ_SETUP_COMPLETE | AOPOBJ_REG_CONNECTED | | ||
| 349 | AOPOBJ_OBJECT_INITIALIZED); | ||
| 345 | 350 | ||
| 346 | /* Install the new region object in the parent Node */ | 351 | /* Install the new region object in the parent Node */ |
| 347 | 352 | ||
| @@ -492,10 +497,9 @@ acpi_ex_create_method(u8 * aml_start, | |||
| 492 | * Disassemble the method flags. Split off the arg_count, Serialized | 497 | * Disassemble the method flags. Split off the arg_count, Serialized |
| 493 | * flag, and sync_level for efficiency. | 498 | * flag, and sync_level for efficiency. |
| 494 | */ | 499 | */ |
| 495 | method_flags = (u8) operand[1]->integer.value; | 500 | method_flags = (u8)operand[1]->integer.value; |
| 496 | 501 | obj_desc->method.param_count = (u8) | |
| 497 | obj_desc->method.param_count = | 502 | (method_flags & AML_METHOD_ARG_COUNT); |
| 498 | (u8) (method_flags & AML_METHOD_ARG_COUNT); | ||
| 499 | 503 | ||
| 500 | /* | 504 | /* |
| 501 | * Get the sync_level. If method is serialized, a mutex will be | 505 | * Get the sync_level. If method is serialized, a mutex will be |
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c index de92458236f5..b22309094c5f 100644 --- a/drivers/acpi/acpica/exdebug.c +++ b/drivers/acpi/acpica/exdebug.c | |||
| @@ -43,21 +43,11 @@ | |||
| 43 | 43 | ||
| 44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
| 45 | #include "accommon.h" | 45 | #include "accommon.h" |
| 46 | #include "acnamesp.h" | ||
| 47 | #include "acinterp.h" | 46 | #include "acinterp.h" |
| 48 | #include "acparser.h" | ||
| 49 | 47 | ||
| 50 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
| 51 | ACPI_MODULE_NAME("exdebug") | 49 | ACPI_MODULE_NAME("exdebug") |
| 52 | 50 | ||
| 53 | static union acpi_operand_object *acpi_gbl_trace_method_object = NULL; | ||
| 54 | |||
| 55 | /* Local prototypes */ | ||
| 56 | |||
| 57 | #ifdef ACPI_DEBUG_OUTPUT | ||
| 58 | static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type); | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #ifndef ACPI_NO_ERROR_MESSAGES | 51 | #ifndef ACPI_NO_ERROR_MESSAGES |
| 62 | /******************************************************************************* | 52 | /******************************************************************************* |
| 63 | * | 53 | * |
| @@ -80,7 +70,6 @@ static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type); | |||
| 80 | * enabled if necessary. | 70 | * enabled if necessary. |
| 81 | * | 71 | * |
| 82 | ******************************************************************************/ | 72 | ******************************************************************************/ |
| 83 | |||
| 84 | void | 73 | void |
| 85 | acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | 74 | acpi_ex_do_debug_object(union acpi_operand_object *source_desc, |
| 86 | u32 level, u32 index) | 75 | u32 level, u32 index) |
| @@ -99,20 +88,40 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 99 | return_VOID; | 88 | return_VOID; |
| 100 | } | 89 | } |
| 101 | 90 | ||
| 102 | /* | 91 | /* Null string or newline -- don't emit the line header */ |
| 103 | * We will emit the current timer value (in microseconds) with each | 92 | |
| 104 | * debug output. Only need the lower 26 bits. This allows for 67 | 93 | if (source_desc && |
| 105 | * million microseconds or 67 seconds before rollover. | 94 | (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) && |
| 106 | */ | 95 | (source_desc->common.type == ACPI_TYPE_STRING)) { |
| 107 | timer = ((u32)acpi_os_get_timer() / 10); /* (100 nanoseconds to microseconds) */ | 96 | if ((source_desc->string.length == 0) || |
| 108 | timer &= 0x03FFFFFF; | 97 | ((source_desc->string.length == 1) && |
| 98 | (*source_desc->string.pointer == '\n'))) { | ||
| 99 | acpi_os_printf("\n"); | ||
| 100 | return_VOID; | ||
| 101 | } | ||
| 102 | } | ||
| 109 | 103 | ||
| 110 | /* | 104 | /* |
| 111 | * Print line header as long as we are not in the middle of an | 105 | * Print line header as long as we are not in the middle of an |
| 112 | * object display | 106 | * object display |
| 113 | */ | 107 | */ |
| 114 | if (!((level > 0) && index == 0)) { | 108 | if (!((level > 0) && index == 0)) { |
| 115 | acpi_os_printf("[ACPI Debug %.8u] %*s", timer, level, " "); | 109 | if (acpi_gbl_display_debug_timer) { |
| 110 | /* | ||
| 111 | * We will emit the current timer value (in microseconds) with each | ||
| 112 | * debug output. Only need the lower 26 bits. This allows for 67 | ||
| 113 | * million microseconds or 67 seconds before rollover. | ||
| 114 | * | ||
| 115 | * Convert 100 nanosecond units to microseconds | ||
| 116 | */ | ||
| 117 | timer = ((u32)acpi_os_get_timer() / 10); | ||
| 118 | timer &= 0x03FFFFFF; | ||
| 119 | |||
| 120 | acpi_os_printf("[ACPI Debug T=0x%8.8X] %*s", timer, | ||
| 121 | level, " "); | ||
| 122 | } else { | ||
| 123 | acpi_os_printf("[ACPI Debug] %*s", level, " "); | ||
| 124 | } | ||
| 116 | } | 125 | } |
| 117 | 126 | ||
| 118 | /* Display the index for package output only */ | 127 | /* Display the index for package output only */ |
| @@ -127,8 +136,15 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 127 | } | 136 | } |
| 128 | 137 | ||
| 129 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { | 138 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { |
| 130 | acpi_os_printf("%s ", | 139 | |
| 131 | acpi_ut_get_object_type_name(source_desc)); | 140 | /* No object type prefix needed for integers and strings */ |
| 141 | |||
| 142 | if ((source_desc->common.type != ACPI_TYPE_INTEGER) && | ||
| 143 | (source_desc->common.type != ACPI_TYPE_STRING)) { | ||
| 144 | acpi_os_printf("%s ", | ||
| 145 | acpi_ut_get_object_type_name | ||
| 146 | (source_desc)); | ||
| 147 | } | ||
| 132 | 148 | ||
| 133 | if (!acpi_ut_valid_internal_object(source_desc)) { | 149 | if (!acpi_ut_valid_internal_object(source_desc)) { |
| 134 | acpi_os_printf("%p, Invalid Internal Object!\n", | 150 | acpi_os_printf("%p, Invalid Internal Object!\n", |
| @@ -137,7 +153,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 137 | } | 153 | } |
| 138 | } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == | 154 | } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == |
| 139 | ACPI_DESC_TYPE_NAMED) { | 155 | ACPI_DESC_TYPE_NAMED) { |
| 140 | acpi_os_printf("%s: %p\n", | 156 | acpi_os_printf("%s (Node %p)\n", |
| 141 | acpi_ut_get_type_name(((struct | 157 | acpi_ut_get_type_name(((struct |
| 142 | acpi_namespace_node *) | 158 | acpi_namespace_node *) |
| 143 | source_desc)->type), | 159 | source_desc)->type), |
| @@ -175,14 +191,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 175 | 191 | ||
| 176 | case ACPI_TYPE_STRING: | 192 | case ACPI_TYPE_STRING: |
| 177 | 193 | ||
| 178 | acpi_os_printf("[0x%.2X] \"%s\"\n", | 194 | acpi_os_printf("\"%s\"\n", source_desc->string.pointer); |
| 179 | source_desc->string.length, | ||
| 180 | source_desc->string.pointer); | ||
| 181 | break; | 195 | break; |
| 182 | 196 | ||
| 183 | case ACPI_TYPE_PACKAGE: | 197 | case ACPI_TYPE_PACKAGE: |
| 184 | 198 | ||
| 185 | acpi_os_printf("[Contains 0x%.2X Elements]\n", | 199 | acpi_os_printf("(Contains 0x%.2X Elements):\n", |
| 186 | source_desc->package.count); | 200 | source_desc->package.count); |
| 187 | 201 | ||
| 188 | /* Output the entire contents of the package */ | 202 | /* Output the entire contents of the package */ |
| @@ -261,11 +275,14 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 261 | if (ACPI_GET_DESCRIPTOR_TYPE | 275 | if (ACPI_GET_DESCRIPTOR_TYPE |
| 262 | (source_desc->reference.object) == | 276 | (source_desc->reference.object) == |
| 263 | ACPI_DESC_TYPE_NAMED) { | 277 | ACPI_DESC_TYPE_NAMED) { |
| 264 | acpi_ex_do_debug_object(((struct | 278 | |
| 265 | acpi_namespace_node *) | 279 | /* Reference object is a namespace node */ |
| 280 | |||
| 281 | acpi_ex_do_debug_object(ACPI_CAST_PTR | ||
| 282 | (union | ||
| 283 | acpi_operand_object, | ||
| 266 | source_desc->reference. | 284 | source_desc->reference. |
| 267 | object)->object, | 285 | object), level + 4, 0); |
| 268 | level + 4, 0); | ||
| 269 | } else { | 286 | } else { |
| 270 | object_desc = source_desc->reference.object; | 287 | object_desc = source_desc->reference.object; |
| 271 | value = source_desc->reference.value; | 288 | value = source_desc->reference.value; |
| @@ -293,9 +310,14 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 293 | case ACPI_TYPE_PACKAGE: | 310 | case ACPI_TYPE_PACKAGE: |
| 294 | 311 | ||
| 295 | acpi_os_printf("Package[%u] = ", value); | 312 | acpi_os_printf("Package[%u] = ", value); |
| 296 | acpi_ex_do_debug_object(*source_desc-> | 313 | if (!(*source_desc->reference.where)) { |
| 297 | reference.where, | 314 | acpi_os_printf |
| 298 | level + 4, 0); | 315 | ("[Uninitialized Package Element]\n"); |
| 316 | } else { | ||
| 317 | acpi_ex_do_debug_object | ||
| 318 | (*source_desc->reference. | ||
| 319 | where, level + 4, 0); | ||
| 320 | } | ||
| 299 | break; | 321 | break; |
| 300 | 322 | ||
| 301 | default: | 323 | default: |
| @@ -311,7 +333,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 311 | 333 | ||
| 312 | default: | 334 | default: |
| 313 | 335 | ||
| 314 | acpi_os_printf("%p\n", source_desc); | 336 | acpi_os_printf("(Descriptor %p)\n", source_desc); |
| 315 | break; | 337 | break; |
| 316 | } | 338 | } |
| 317 | 339 | ||
| @@ -319,316 +341,3 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
| 319 | return_VOID; | 341 | return_VOID; |
| 320 | } | 342 | } |
| 321 | #endif | 343 | #endif |
| 322 | |||
| 323 | /******************************************************************************* | ||
| 324 | * | ||
| 325 | * FUNCTION: acpi_ex_interpreter_trace_enabled | ||
| 326 | * | ||
| 327 | * PARAMETERS: name - Whether method name should be matched, | ||
| 328 | * this should be checked before starting | ||
| 329 | * the tracer | ||
| 330 | * | ||
| 331 | * RETURN: TRUE if interpreter trace is enabled. | ||
| 332 | * | ||
| 333 | * DESCRIPTION: Check whether interpreter trace is enabled | ||
| 334 | * | ||
| 335 | ******************************************************************************/ | ||
| 336 | |||
| 337 | static u8 acpi_ex_interpreter_trace_enabled(char *name) | ||
| 338 | { | ||
| 339 | |||
| 340 | /* Check if tracing is enabled */ | ||
| 341 | |||
| 342 | if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED)) { | ||
| 343 | return (FALSE); | ||
| 344 | } | ||
| 345 | |||
| 346 | /* | ||
| 347 | * Check if tracing is filtered: | ||
| 348 | * | ||
| 349 | * 1. If the tracer is started, acpi_gbl_trace_method_object should have | ||
| 350 | * been filled by the trace starter | ||
| 351 | * 2. If the tracer is not started, acpi_gbl_trace_method_name should be | ||
| 352 | * matched if it is specified | ||
| 353 | * 3. If the tracer is oneshot style, acpi_gbl_trace_method_name should | ||
| 354 | * not be cleared by the trace stopper during the first match | ||
| 355 | */ | ||
| 356 | if (acpi_gbl_trace_method_object) { | ||
| 357 | return (TRUE); | ||
| 358 | } | ||
| 359 | if (name && | ||
| 360 | (acpi_gbl_trace_method_name && | ||
| 361 | strcmp(acpi_gbl_trace_method_name, name))) { | ||
| 362 | return (FALSE); | ||
| 363 | } | ||
| 364 | if ((acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) && | ||
| 365 | !acpi_gbl_trace_method_name) { | ||
| 366 | return (FALSE); | ||
| 367 | } | ||
| 368 | |||
| 369 | return (TRUE); | ||
| 370 | } | ||
| 371 | |||
| 372 | /******************************************************************************* | ||
| 373 | * | ||
| 374 | * FUNCTION: acpi_ex_get_trace_event_name | ||
| 375 | * | ||
| 376 | * PARAMETERS: type - Trace event type | ||
| 377 | * | ||
| 378 | * RETURN: Trace event name. | ||
| 379 | * | ||
| 380 | * DESCRIPTION: Used to obtain the full trace event name. | ||
| 381 | * | ||
| 382 | ******************************************************************************/ | ||
| 383 | |||
| 384 | #ifdef ACPI_DEBUG_OUTPUT | ||
| 385 | |||
| 386 | static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type) | ||
| 387 | { | ||
| 388 | switch (type) { | ||
| 389 | case ACPI_TRACE_AML_METHOD: | ||
| 390 | |||
| 391 | return "Method"; | ||
| 392 | |||
| 393 | case ACPI_TRACE_AML_OPCODE: | ||
| 394 | |||
| 395 | return "Opcode"; | ||
| 396 | |||
| 397 | case ACPI_TRACE_AML_REGION: | ||
| 398 | |||
| 399 | return "Region"; | ||
| 400 | |||
| 401 | default: | ||
| 402 | |||
| 403 | return ""; | ||
| 404 | } | ||
| 405 | } | ||
| 406 | |||
| 407 | #endif | ||
| 408 | |||
| 409 | /******************************************************************************* | ||
| 410 | * | ||
| 411 | * FUNCTION: acpi_ex_trace_point | ||
| 412 | * | ||
| 413 | * PARAMETERS: type - Trace event type | ||
| 414 | * begin - TRUE if before execution | ||
| 415 | * aml - Executed AML address | ||
| 416 | * pathname - Object path | ||
| 417 | * | ||
| 418 | * RETURN: None | ||
| 419 | * | ||
| 420 | * DESCRIPTION: Internal interpreter execution trace. | ||
| 421 | * | ||
| 422 | ******************************************************************************/ | ||
| 423 | |||
| 424 | void | ||
| 425 | acpi_ex_trace_point(acpi_trace_event_type type, | ||
| 426 | u8 begin, u8 *aml, char *pathname) | ||
| 427 | { | ||
| 428 | |||
| 429 | ACPI_FUNCTION_NAME(ex_trace_point); | ||
| 430 | |||
| 431 | if (pathname) { | ||
| 432 | ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, | ||
| 433 | "%s %s [0x%p:%s] execution.\n", | ||
| 434 | acpi_ex_get_trace_event_name(type), | ||
| 435 | begin ? "Begin" : "End", aml, pathname)); | ||
| 436 | } else { | ||
| 437 | ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, | ||
| 438 | "%s %s [0x%p] execution.\n", | ||
| 439 | acpi_ex_get_trace_event_name(type), | ||
| 440 | begin ? "Begin" : "End", aml)); | ||
| 441 | } | ||
| 442 | } | ||
| 443 | |||
| 444 | /******************************************************************************* | ||
| 445 | * | ||
| 446 | * FUNCTION: acpi_ex_start_trace_method | ||
| 447 | * | ||
| 448 | * PARAMETERS: method_node - Node of the method | ||
| 449 | * obj_desc - The method object | ||
| 450 | * walk_state - current state, NULL if not yet executing | ||
| 451 | * a method. | ||
| 452 | * | ||
| 453 | * RETURN: None | ||
| 454 | * | ||
| 455 | * DESCRIPTION: Start control method execution trace | ||
| 456 | * | ||
| 457 | ******************************************************************************/ | ||
| 458 | |||
| 459 | void | ||
| 460 | acpi_ex_start_trace_method(struct acpi_namespace_node *method_node, | ||
| 461 | union acpi_operand_object *obj_desc, | ||
| 462 | struct acpi_walk_state *walk_state) | ||
| 463 | { | ||
| 464 | acpi_status status; | ||
| 465 | char *pathname = NULL; | ||
| 466 | u8 enabled = FALSE; | ||
| 467 | |||
| 468 | ACPI_FUNCTION_NAME(ex_start_trace_method); | ||
| 469 | |||
| 470 | if (method_node) { | ||
| 471 | pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); | ||
| 472 | } | ||
| 473 | |||
| 474 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 475 | if (ACPI_FAILURE(status)) { | ||
| 476 | goto exit; | ||
| 477 | } | ||
| 478 | |||
| 479 | enabled = acpi_ex_interpreter_trace_enabled(pathname); | ||
| 480 | if (enabled && !acpi_gbl_trace_method_object) { | ||
| 481 | acpi_gbl_trace_method_object = obj_desc; | ||
| 482 | acpi_gbl_original_dbg_level = acpi_dbg_level; | ||
| 483 | acpi_gbl_original_dbg_layer = acpi_dbg_layer; | ||
| 484 | acpi_dbg_level = ACPI_TRACE_LEVEL_ALL; | ||
| 485 | acpi_dbg_layer = ACPI_TRACE_LAYER_ALL; | ||
| 486 | |||
| 487 | if (acpi_gbl_trace_dbg_level) { | ||
| 488 | acpi_dbg_level = acpi_gbl_trace_dbg_level; | ||
| 489 | } | ||
| 490 | if (acpi_gbl_trace_dbg_layer) { | ||
| 491 | acpi_dbg_layer = acpi_gbl_trace_dbg_layer; | ||
| 492 | } | ||
| 493 | } | ||
| 494 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 495 | |||
| 496 | exit: | ||
| 497 | if (enabled) { | ||
| 498 | ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, TRUE, | ||
| 499 | obj_desc ? obj_desc->method.aml_start : NULL, | ||
| 500 | pathname); | ||
| 501 | } | ||
| 502 | if (pathname) { | ||
| 503 | ACPI_FREE(pathname); | ||
| 504 | } | ||
| 505 | } | ||
| 506 | |||
| 507 | /******************************************************************************* | ||
| 508 | * | ||
| 509 | * FUNCTION: acpi_ex_stop_trace_method | ||
| 510 | * | ||
| 511 | * PARAMETERS: method_node - Node of the method | ||
| 512 | * obj_desc - The method object | ||
| 513 | * walk_state - current state, NULL if not yet executing | ||
| 514 | * a method. | ||
| 515 | * | ||
| 516 | * RETURN: None | ||
| 517 | * | ||
| 518 | * DESCRIPTION: Stop control method execution trace | ||
| 519 | * | ||
| 520 | ******************************************************************************/ | ||
| 521 | |||
| 522 | void | ||
| 523 | acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node, | ||
| 524 | union acpi_operand_object *obj_desc, | ||
| 525 | struct acpi_walk_state *walk_state) | ||
| 526 | { | ||
| 527 | acpi_status status; | ||
| 528 | char *pathname = NULL; | ||
| 529 | u8 enabled; | ||
| 530 | |||
| 531 | ACPI_FUNCTION_NAME(ex_stop_trace_method); | ||
| 532 | |||
| 533 | if (method_node) { | ||
| 534 | pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); | ||
| 535 | } | ||
| 536 | |||
| 537 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 538 | if (ACPI_FAILURE(status)) { | ||
| 539 | goto exit_path; | ||
| 540 | } | ||
| 541 | |||
| 542 | enabled = acpi_ex_interpreter_trace_enabled(NULL); | ||
| 543 | |||
| 544 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 545 | |||
| 546 | if (enabled) { | ||
| 547 | ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, FALSE, | ||
| 548 | obj_desc ? obj_desc->method.aml_start : NULL, | ||
| 549 | pathname); | ||
| 550 | } | ||
| 551 | |||
| 552 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 553 | if (ACPI_FAILURE(status)) { | ||
| 554 | goto exit_path; | ||
| 555 | } | ||
| 556 | |||
| 557 | /* Check whether the tracer should be stopped */ | ||
| 558 | |||
| 559 | if (acpi_gbl_trace_method_object == obj_desc) { | ||
| 560 | |||
| 561 | /* Disable further tracing if type is one-shot */ | ||
| 562 | |||
| 563 | if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) { | ||
| 564 | acpi_gbl_trace_method_name = NULL; | ||
| 565 | } | ||
| 566 | |||
| 567 | acpi_dbg_level = acpi_gbl_original_dbg_level; | ||
| 568 | acpi_dbg_layer = acpi_gbl_original_dbg_layer; | ||
| 569 | acpi_gbl_trace_method_object = NULL; | ||
| 570 | } | ||
| 571 | |||
| 572 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 573 | |||
| 574 | exit_path: | ||
| 575 | if (pathname) { | ||
| 576 | ACPI_FREE(pathname); | ||
| 577 | } | ||
| 578 | } | ||
| 579 | |||
| 580 | /******************************************************************************* | ||
| 581 | * | ||
| 582 | * FUNCTION: acpi_ex_start_trace_opcode | ||
| 583 | * | ||
| 584 | * PARAMETERS: op - The parser opcode object | ||
| 585 | * walk_state - current state, NULL if not yet executing | ||
| 586 | * a method. | ||
| 587 | * | ||
| 588 | * RETURN: None | ||
| 589 | * | ||
| 590 | * DESCRIPTION: Start opcode execution trace | ||
| 591 | * | ||
| 592 | ******************************************************************************/ | ||
| 593 | |||
| 594 | void | ||
| 595 | acpi_ex_start_trace_opcode(union acpi_parse_object *op, | ||
| 596 | struct acpi_walk_state *walk_state) | ||
| 597 | { | ||
| 598 | |||
| 599 | ACPI_FUNCTION_NAME(ex_start_trace_opcode); | ||
| 600 | |||
| 601 | if (acpi_ex_interpreter_trace_enabled(NULL) && | ||
| 602 | (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { | ||
| 603 | ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, TRUE, | ||
| 604 | op->common.aml, op->common.aml_op_name); | ||
| 605 | } | ||
| 606 | } | ||
| 607 | |||
| 608 | /******************************************************************************* | ||
| 609 | * | ||
| 610 | * FUNCTION: acpi_ex_stop_trace_opcode | ||
| 611 | * | ||
| 612 | * PARAMETERS: op - The parser opcode object | ||
| 613 | * walk_state - current state, NULL if not yet executing | ||
| 614 | * a method. | ||
| 615 | * | ||
| 616 | * RETURN: None | ||
| 617 | * | ||
| 618 | * DESCRIPTION: Stop opcode execution trace | ||
| 619 | * | ||
| 620 | ******************************************************************************/ | ||
| 621 | |||
| 622 | void | ||
| 623 | acpi_ex_stop_trace_opcode(union acpi_parse_object *op, | ||
| 624 | struct acpi_walk_state *walk_state) | ||
| 625 | { | ||
| 626 | |||
| 627 | ACPI_FUNCTION_NAME(ex_stop_trace_opcode); | ||
| 628 | |||
| 629 | if (acpi_ex_interpreter_trace_enabled(NULL) && | ||
| 630 | (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { | ||
| 631 | ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, FALSE, | ||
| 632 | op->common.aml, op->common.aml_op_name); | ||
| 633 | } | ||
| 634 | } | ||
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index d836f888bb16..ff976c43b992 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
| @@ -508,7 +508,8 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
| 508 | if (next) { | 508 | if (next) { |
| 509 | acpi_os_printf("(%s %2.2X)", | 509 | acpi_os_printf("(%s %2.2X)", |
| 510 | acpi_ut_get_object_type_name | 510 | acpi_ut_get_object_type_name |
| 511 | (next), next->common.type); | 511 | (next), |
| 512 | next->address_space.space_id); | ||
| 512 | 513 | ||
| 513 | while (next->address_space.next) { | 514 | while (next->address_space.next) { |
| 514 | if ((next->common.type == | 515 | if ((next->common.type == |
| @@ -520,7 +521,8 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
| 520 | acpi_os_printf("->%p(%s %2.2X)", next, | 521 | acpi_os_printf("->%p(%s %2.2X)", next, |
| 521 | acpi_ut_get_object_type_name | 522 | acpi_ut_get_object_type_name |
| 522 | (next), | 523 | (next), |
| 523 | next->common.type); | 524 | next->address_space. |
| 525 | space_id); | ||
| 524 | 526 | ||
| 525 | if ((next == start) || (next == data)) { | 527 | if ((next == start) || (next == data)) { |
| 526 | acpi_os_printf | 528 | acpi_os_printf |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 61fd9c7b88bc..ad7080ba65e2 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
| @@ -167,10 +167,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
| 167 | || obj_desc->field.region_obj->region.space_id == | 167 | || obj_desc->field.region_obj->region.space_id == |
| 168 | ACPI_ADR_SPACE_IPMI)) { | 168 | ACPI_ADR_SPACE_IPMI)) { |
| 169 | /* | 169 | /* |
| 170 | * This is an SMBus, GSBus or IPMI read. We must create a buffer to hold | 170 | * This is an SMBus, GSBus or IPMI read. We must create a buffer to |
| 171 | * the data and then directly access the region handler. | 171 | * hold the data and then directly access the region handler. |
| 172 | * | 172 | * |
| 173 | * Note: SMBus and GSBus protocol value is passed in upper 16-bits of Function | 173 | * Note: SMBus and GSBus protocol value is passed in upper 16-bits |
| 174 | * of Function | ||
| 174 | */ | 175 | */ |
| 175 | if (obj_desc->field.region_obj->region.space_id == | 176 | if (obj_desc->field.region_obj->region.space_id == |
| 176 | ACPI_ADR_SPACE_SMBUS) { | 177 | ACPI_ADR_SPACE_SMBUS) { |
| @@ -180,17 +181,17 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
| 180 | } else if (obj_desc->field.region_obj->region.space_id == | 181 | } else if (obj_desc->field.region_obj->region.space_id == |
| 181 | ACPI_ADR_SPACE_GSBUS) { | 182 | ACPI_ADR_SPACE_GSBUS) { |
| 182 | accessor_type = obj_desc->field.attribute; | 183 | accessor_type = obj_desc->field.attribute; |
| 183 | length = acpi_ex_get_serial_access_length(accessor_type, | 184 | length = |
| 184 | obj_desc-> | 185 | acpi_ex_get_serial_access_length(accessor_type, |
| 185 | field. | 186 | obj_desc->field. |
| 186 | access_length); | 187 | access_length); |
| 187 | 188 | ||
| 188 | /* | 189 | /* |
| 189 | * Add additional 2 bytes for the generic_serial_bus data buffer: | 190 | * Add additional 2 bytes for the generic_serial_bus data buffer: |
| 190 | * | 191 | * |
| 191 | * Status; (Byte 0 of the data buffer) | 192 | * Status; (Byte 0 of the data buffer) |
| 192 | * Length; (Byte 1 of the data buffer) | 193 | * Length; (Byte 1 of the data buffer) |
| 193 | * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) | 194 | * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) |
| 194 | */ | 195 | */ |
| 195 | length += 2; | 196 | length += 2; |
| 196 | function = ACPI_READ | (accessor_type << 16); | 197 | function = ACPI_READ | (accessor_type << 16); |
| @@ -216,6 +217,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
| 216 | buffer_desc-> | 217 | buffer_desc-> |
| 217 | buffer.pointer), | 218 | buffer.pointer), |
| 218 | function); | 219 | function); |
| 220 | |||
| 219 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | 221 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
| 220 | goto exit; | 222 | goto exit; |
| 221 | } | 223 | } |
| @@ -232,6 +234,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
| 232 | */ | 234 | */ |
| 233 | length = | 235 | length = |
| 234 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); | 236 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); |
| 237 | |||
| 235 | if (length > acpi_gbl_integer_byte_width) { | 238 | if (length > acpi_gbl_integer_byte_width) { |
| 236 | 239 | ||
| 237 | /* Field is too large for an Integer, create a Buffer instead */ | 240 | /* Field is too large for an Integer, create a Buffer instead */ |
| @@ -273,8 +276,10 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
| 273 | 276 | ||
| 274 | /* Perform the write */ | 277 | /* Perform the write */ |
| 275 | 278 | ||
| 276 | status = acpi_ex_access_region(obj_desc, 0, | 279 | status = |
| 277 | (u64 *)buffer, ACPI_READ); | 280 | acpi_ex_access_region(obj_desc, 0, (u64 *)buffer, |
| 281 | ACPI_READ); | ||
| 282 | |||
| 278 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | 283 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
| 279 | if (ACPI_FAILURE(status)) { | 284 | if (ACPI_FAILURE(status)) { |
| 280 | acpi_ut_remove_reference(buffer_desc); | 285 | acpi_ut_remove_reference(buffer_desc); |
| @@ -366,19 +371,22 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
| 366 | || obj_desc->field.region_obj->region.space_id == | 371 | || obj_desc->field.region_obj->region.space_id == |
| 367 | ACPI_ADR_SPACE_IPMI)) { | 372 | ACPI_ADR_SPACE_IPMI)) { |
| 368 | /* | 373 | /* |
| 369 | * This is an SMBus, GSBus or IPMI write. We will bypass the entire field | 374 | * This is an SMBus, GSBus or IPMI write. We will bypass the entire |
| 370 | * mechanism and handoff the buffer directly to the handler. For | 375 | * field mechanism and handoff the buffer directly to the handler. |
| 371 | * these address spaces, the buffer is bi-directional; on a write, | 376 | * For these address spaces, the buffer is bi-directional; on a |
| 372 | * return data is returned in the same buffer. | 377 | * write, return data is returned in the same buffer. |
| 373 | * | 378 | * |
| 374 | * Source must be a buffer of sufficient size: | 379 | * Source must be a buffer of sufficient size: |
| 375 | * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE. | 380 | * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or |
| 381 | * ACPI_IPMI_BUFFER_SIZE. | ||
| 376 | * | 382 | * |
| 377 | * Note: SMBus and GSBus protocol type is passed in upper 16-bits of Function | 383 | * Note: SMBus and GSBus protocol type is passed in upper 16-bits |
| 384 | * of Function | ||
| 378 | */ | 385 | */ |
| 379 | if (source_desc->common.type != ACPI_TYPE_BUFFER) { | 386 | if (source_desc->common.type != ACPI_TYPE_BUFFER) { |
| 380 | ACPI_ERROR((AE_INFO, | 387 | ACPI_ERROR((AE_INFO, |
| 381 | "SMBus/IPMI/GenericSerialBus write requires Buffer, found type %s", | 388 | "SMBus/IPMI/GenericSerialBus write requires " |
| 389 | "Buffer, found type %s", | ||
| 382 | acpi_ut_get_object_type_name(source_desc))); | 390 | acpi_ut_get_object_type_name(source_desc))); |
| 383 | 391 | ||
| 384 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 392 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
| @@ -392,17 +400,17 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
| 392 | } else if (obj_desc->field.region_obj->region.space_id == | 400 | } else if (obj_desc->field.region_obj->region.space_id == |
| 393 | ACPI_ADR_SPACE_GSBUS) { | 401 | ACPI_ADR_SPACE_GSBUS) { |
| 394 | accessor_type = obj_desc->field.attribute; | 402 | accessor_type = obj_desc->field.attribute; |
| 395 | length = acpi_ex_get_serial_access_length(accessor_type, | 403 | length = |
| 396 | obj_desc-> | 404 | acpi_ex_get_serial_access_length(accessor_type, |
| 397 | field. | 405 | obj_desc->field. |
| 398 | access_length); | 406 | access_length); |
| 399 | 407 | ||
| 400 | /* | 408 | /* |
| 401 | * Add additional 2 bytes for the generic_serial_bus data buffer: | 409 | * Add additional 2 bytes for the generic_serial_bus data buffer: |
| 402 | * | 410 | * |
| 403 | * Status; (Byte 0 of the data buffer) | 411 | * Status; (Byte 0 of the data buffer) |
| 404 | * Length; (Byte 1 of the data buffer) | 412 | * Length; (Byte 1 of the data buffer) |
| 405 | * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) | 413 | * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) |
| 406 | */ | 414 | */ |
| 407 | length += 2; | 415 | length += 2; |
| 408 | function = ACPI_WRITE | (accessor_type << 16); | 416 | function = ACPI_WRITE | (accessor_type << 16); |
| @@ -414,7 +422,8 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
| 414 | 422 | ||
| 415 | if (source_desc->buffer.length < length) { | 423 | if (source_desc->buffer.length < length) { |
| 416 | ACPI_ERROR((AE_INFO, | 424 | ACPI_ERROR((AE_INFO, |
| 417 | "SMBus/IPMI/GenericSerialBus write requires Buffer of length %u, found length %u", | 425 | "SMBus/IPMI/GenericSerialBus write requires " |
| 426 | "Buffer of length %u, found length %u", | ||
| 418 | length, source_desc->buffer.length)); | 427 | length, source_desc->buffer.length)); |
| 419 | 428 | ||
| 420 | return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); | 429 | return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); |
| @@ -438,8 +447,8 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
| 438 | * Perform the write (returns status and perhaps data in the | 447 | * Perform the write (returns status and perhaps data in the |
| 439 | * same buffer) | 448 | * same buffer) |
| 440 | */ | 449 | */ |
| 441 | status = acpi_ex_access_region(obj_desc, 0, | 450 | status = |
| 442 | (u64 *) buffer, function); | 451 | acpi_ex_access_region(obj_desc, 0, (u64 *)buffer, function); |
| 443 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | 452 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
| 444 | 453 | ||
| 445 | *result_desc = buffer_desc; | 454 | *result_desc = buffer_desc; |
| @@ -460,7 +469,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
| 460 | } | 469 | } |
| 461 | 470 | ||
| 462 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 471 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 463 | "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", | 472 | "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", |
| 464 | acpi_ut_get_type_name(source_desc->common. | 473 | acpi_ut_get_type_name(source_desc->common. |
| 465 | type), | 474 | type), |
| 466 | source_desc->common.type, | 475 | source_desc->common.type, |
| @@ -476,8 +485,9 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
| 476 | 485 | ||
| 477 | /* Perform the write */ | 486 | /* Perform the write */ |
| 478 | 487 | ||
| 479 | status = acpi_ex_access_region(obj_desc, 0, | 488 | status = |
| 480 | (u64 *)buffer, ACPI_WRITE); | 489 | acpi_ex_access_region(obj_desc, 0, (u64 *)buffer, |
| 490 | ACPI_WRITE); | ||
| 481 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | 491 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
| 482 | return_ACPI_STATUS(status); | 492 | return_ACPI_STATUS(status); |
| 483 | } | 493 | } |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 70b7bbbb860b..0337191dbf3d 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
| @@ -180,7 +180,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
| 180 | * byte, and a field with Dword access specified. | 180 | * byte, and a field with Dword access specified. |
| 181 | */ | 181 | */ |
| 182 | ACPI_ERROR((AE_INFO, | 182 | ACPI_ERROR((AE_INFO, |
| 183 | "Field [%4.4s] access width (%u bytes) too large for region [%4.4s] (length %u)", | 183 | "Field [%4.4s] access width (%u bytes) " |
| 184 | "too large for region [%4.4s] (length %u)", | ||
| 184 | acpi_ut_get_node_name(obj_desc-> | 185 | acpi_ut_get_node_name(obj_desc-> |
| 185 | common_field.node), | 186 | common_field.node), |
| 186 | obj_desc->common_field.access_byte_width, | 187 | obj_desc->common_field.access_byte_width, |
| @@ -194,7 +195,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
| 194 | * exceeds region length, indicate an error | 195 | * exceeds region length, indicate an error |
| 195 | */ | 196 | */ |
| 196 | ACPI_ERROR((AE_INFO, | 197 | ACPI_ERROR((AE_INFO, |
| 197 | "Field [%4.4s] Base+Offset+Width %u+%u+%u is beyond end of region [%4.4s] (length %u)", | 198 | "Field [%4.4s] Base+Offset+Width %u+%u+%u " |
| 199 | "is beyond end of region [%4.4s] (length %u)", | ||
| 198 | acpi_ut_get_node_name(obj_desc->common_field.node), | 200 | acpi_ut_get_node_name(obj_desc->common_field.node), |
| 199 | obj_desc->common_field.base_byte_offset, | 201 | obj_desc->common_field.base_byte_offset, |
| 200 | field_datum_byte_offset, | 202 | field_datum_byte_offset, |
| @@ -638,15 +640,15 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
| 638 | 640 | ||
| 639 | ACPI_ERROR((AE_INFO, | 641 | ACPI_ERROR((AE_INFO, |
| 640 | "Unknown UpdateRule value: 0x%X", | 642 | "Unknown UpdateRule value: 0x%X", |
| 641 | (obj_desc->common_field. | 643 | (obj_desc->common_field.field_flags & |
| 642 | field_flags & | ||
| 643 | AML_FIELD_UPDATE_RULE_MASK))); | 644 | AML_FIELD_UPDATE_RULE_MASK))); |
| 644 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 645 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
| 645 | } | 646 | } |
| 646 | } | 647 | } |
| 647 | 648 | ||
| 648 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 649 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 649 | "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", | 650 | "Mask %8.8X%8.8X, DatumOffset %X, Width %X, " |
| 651 | "Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", | ||
| 650 | ACPI_FORMAT_UINT64(mask), | 652 | ACPI_FORMAT_UINT64(mask), |
| 651 | field_datum_byte_offset, | 653 | field_datum_byte_offset, |
| 652 | obj_desc->common_field.access_byte_width, | 654 | obj_desc->common_field.access_byte_width, |
| @@ -655,8 +657,9 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
| 655 | 657 | ||
| 656 | /* Write the merged value */ | 658 | /* Write the merged value */ |
| 657 | 659 | ||
| 658 | status = acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset, | 660 | status = |
| 659 | &merged_value, ACPI_WRITE); | 661 | acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset, |
| 662 | &merged_value, ACPI_WRITE); | ||
| 660 | 663 | ||
| 661 | return_ACPI_STATUS(status); | 664 | return_ACPI_STATUS(status); |
| 662 | } | 665 | } |
| @@ -764,8 +767,9 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
| 764 | /* Get next input datum from the field */ | 767 | /* Get next input datum from the field */ |
| 765 | 768 | ||
| 766 | field_offset += obj_desc->common_field.access_byte_width; | 769 | field_offset += obj_desc->common_field.access_byte_width; |
| 767 | status = acpi_ex_field_datum_io(obj_desc, field_offset, | 770 | status = |
| 768 | &raw_datum, ACPI_READ); | 771 | acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum, |
| 772 | ACPI_READ); | ||
| 769 | if (ACPI_FAILURE(status)) { | 773 | if (ACPI_FAILURE(status)) { |
| 770 | return_ACPI_STATUS(status); | 774 | return_ACPI_STATUS(status); |
| 771 | } | 775 | } |
| @@ -858,6 +862,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
| 858 | new_buffer = NULL; | 862 | new_buffer = NULL; |
| 859 | required_length = | 863 | required_length = |
| 860 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); | 864 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); |
| 865 | |||
| 861 | /* | 866 | /* |
| 862 | * We must have a buffer that is at least as long as the field | 867 | * We must have a buffer that is at least as long as the field |
| 863 | * we are writing to. This is because individual fields are | 868 | * we are writing to. This is because individual fields are |
| @@ -932,9 +937,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
| 932 | /* Write merged datum to the target field */ | 937 | /* Write merged datum to the target field */ |
| 933 | 938 | ||
| 934 | merged_datum &= mask; | 939 | merged_datum &= mask; |
| 935 | status = acpi_ex_write_with_update_rule(obj_desc, mask, | 940 | status = |
| 936 | merged_datum, | 941 | acpi_ex_write_with_update_rule(obj_desc, mask, merged_datum, |
| 937 | field_offset); | 942 | field_offset); |
| 938 | if (ACPI_FAILURE(status)) { | 943 | if (ACPI_FAILURE(status)) { |
| 939 | goto exit; | 944 | goto exit; |
| 940 | } | 945 | } |
| @@ -990,9 +995,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
| 990 | /* Write the last datum to the field */ | 995 | /* Write the last datum to the field */ |
| 991 | 996 | ||
| 992 | merged_datum &= mask; | 997 | merged_datum &= mask; |
| 993 | status = acpi_ex_write_with_update_rule(obj_desc, | 998 | status = |
| 994 | mask, merged_datum, | 999 | acpi_ex_write_with_update_rule(obj_desc, mask, merged_datum, |
| 995 | field_offset); | 1000 | field_offset); |
| 996 | 1001 | ||
| 997 | exit: | 1002 | exit: |
| 998 | /* Free temporary buffer if we used one */ | 1003 | /* Free temporary buffer if we used one */ |
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index d02afece0f10..f598b3948c17 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c | |||
| @@ -98,9 +98,9 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
| 98 | 98 | ||
| 99 | default: | 99 | default: |
| 100 | 100 | ||
| 101 | ACPI_ERROR((AE_INFO, "Unknown Reference Class 0x%2.2X", | 101 | ACPI_ERROR((AE_INFO, "Invalid Reference Class 0x%2.2X", |
| 102 | obj_desc->reference.class)); | 102 | obj_desc->reference.class)); |
| 103 | return_ACPI_STATUS(AE_AML_INTERNAL); | 103 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
| 104 | } | 104 | } |
| 105 | break; | 105 | break; |
| 106 | 106 | ||
| @@ -247,6 +247,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
| 247 | union acpi_operand_object *local_operand1 = operand1; | 247 | union acpi_operand_object *local_operand1 = operand1; |
| 248 | union acpi_operand_object *return_desc; | 248 | union acpi_operand_object *return_desc; |
| 249 | char *new_buf; | 249 | char *new_buf; |
| 250 | const char *type_string; | ||
| 250 | acpi_status status; | 251 | acpi_status status; |
| 251 | 252 | ||
| 252 | ACPI_FUNCTION_TRACE(ex_do_concatenate); | 253 | ACPI_FUNCTION_TRACE(ex_do_concatenate); |
| @@ -266,9 +267,41 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
| 266 | break; | 267 | break; |
| 267 | 268 | ||
| 268 | case ACPI_TYPE_STRING: | 269 | case ACPI_TYPE_STRING: |
| 270 | /* | ||
| 271 | * Per the ACPI spec, Concatenate only supports int/str/buf. | ||
| 272 | * However, we support all objects here as an extension. | ||
| 273 | * This improves the usefulness of the Printf() macro. | ||
| 274 | * 12/2015. | ||
| 275 | */ | ||
| 276 | switch (operand1->common.type) { | ||
| 277 | case ACPI_TYPE_INTEGER: | ||
| 278 | case ACPI_TYPE_STRING: | ||
| 279 | case ACPI_TYPE_BUFFER: | ||
| 280 | |||
| 281 | status = | ||
| 282 | acpi_ex_convert_to_string(operand1, &local_operand1, | ||
| 283 | ACPI_IMPLICIT_CONVERT_HEX); | ||
| 284 | break; | ||
| 285 | |||
| 286 | default: | ||
| 287 | /* | ||
| 288 | * Just emit a string containing the object type. | ||
| 289 | */ | ||
| 290 | type_string = | ||
| 291 | acpi_ut_get_type_name(operand1->common.type); | ||
| 292 | |||
| 293 | local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */ | ||
| 294 | if (!local_operand1) { | ||
| 295 | status = AE_NO_MEMORY; | ||
| 296 | goto cleanup; | ||
| 297 | } | ||
| 269 | 298 | ||
| 270 | status = acpi_ex_convert_to_string(operand1, &local_operand1, | 299 | strcpy(local_operand1->string.pointer, "["); |
| 271 | ACPI_IMPLICIT_CONVERT_HEX); | 300 | strcat(local_operand1->string.pointer, type_string); |
| 301 | strcat(local_operand1->string.pointer, " Object]"); | ||
| 302 | status = AE_OK; | ||
| 303 | break; | ||
| 304 | } | ||
| 272 | break; | 305 | break; |
| 273 | 306 | ||
| 274 | case ACPI_TYPE_BUFFER: | 307 | case ACPI_TYPE_BUFFER: |
| @@ -347,8 +380,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
| 347 | /* Concatenate the strings */ | 380 | /* Concatenate the strings */ |
| 348 | 381 | ||
| 349 | strcpy(new_buf, operand0->string.pointer); | 382 | strcpy(new_buf, operand0->string.pointer); |
| 350 | strcpy(new_buf + operand0->string.length, | 383 | strcat(new_buf, local_operand1->string.pointer); |
| 351 | local_operand1->string.pointer); | ||
| 352 | break; | 384 | break; |
| 353 | 385 | ||
| 354 | case ACPI_TYPE_BUFFER: | 386 | case ACPI_TYPE_BUFFER: |
| @@ -591,8 +623,9 @@ acpi_ex_do_logical_op(u16 opcode, | |||
| 591 | 623 | ||
| 592 | case ACPI_TYPE_STRING: | 624 | case ACPI_TYPE_STRING: |
| 593 | 625 | ||
| 594 | status = acpi_ex_convert_to_string(operand1, &local_operand1, | 626 | status = |
| 595 | ACPI_IMPLICIT_CONVERT_HEX); | 627 | acpi_ex_convert_to_string(operand1, &local_operand1, |
| 628 | ACPI_IMPLICIT_CONVERT_HEX); | ||
| 596 | break; | 629 | break; |
| 597 | 630 | ||
| 598 | case ACPI_TYPE_BUFFER: | 631 | case ACPI_TYPE_BUFFER: |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index 472030f2b5bb..843c60ae91f6 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
| @@ -185,8 +185,9 @@ acpi_ex_acquire_mutex_object(u16 timeout, | |||
| 185 | if (obj_desc == acpi_gbl_global_lock_mutex) { | 185 | if (obj_desc == acpi_gbl_global_lock_mutex) { |
| 186 | status = acpi_ev_acquire_global_lock(timeout); | 186 | status = acpi_ev_acquire_global_lock(timeout); |
| 187 | } else { | 187 | } else { |
| 188 | status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, | 188 | status = |
| 189 | timeout); | 189 | acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, |
| 190 | timeout); | ||
| 190 | } | 191 | } |
| 191 | 192 | ||
| 192 | if (ACPI_FAILURE(status)) { | 193 | if (ACPI_FAILURE(status)) { |
| @@ -243,20 +244,30 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
| 243 | } | 244 | } |
| 244 | 245 | ||
| 245 | /* | 246 | /* |
| 246 | * Current sync level must be less than or equal to the sync level of the | 247 | * Current sync level must be less than or equal to the sync level |
| 247 | * mutex. This mechanism provides some deadlock prevention | 248 | * of the mutex. This mechanism provides some deadlock prevention. |
| 248 | */ | 249 | */ |
| 249 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 250 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
| 250 | ACPI_ERROR((AE_INFO, | 251 | ACPI_ERROR((AE_INFO, |
| 251 | "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)", | 252 | "Cannot acquire Mutex [%4.4s], " |
| 253 | "current SyncLevel is too large (%u)", | ||
| 252 | acpi_ut_get_node_name(obj_desc->mutex.node), | 254 | acpi_ut_get_node_name(obj_desc->mutex.node), |
| 253 | walk_state->thread->current_sync_level)); | 255 | walk_state->thread->current_sync_level)); |
| 254 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 256 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
| 255 | } | 257 | } |
| 256 | 258 | ||
| 257 | status = acpi_ex_acquire_mutex_object((u16) time_desc->integer.value, | 259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 260 | "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, " | ||
| 261 | "Depth %u TID %p\n", | ||
| 262 | obj_desc->mutex.sync_level, | ||
| 263 | walk_state->thread->current_sync_level, | ||
| 264 | obj_desc->mutex.acquisition_depth, | ||
| 265 | walk_state->thread)); | ||
| 266 | |||
| 267 | status = acpi_ex_acquire_mutex_object((u16)time_desc->integer.value, | ||
| 258 | obj_desc, | 268 | obj_desc, |
| 259 | walk_state->thread->thread_id); | 269 | walk_state->thread->thread_id); |
| 270 | |||
| 260 | if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { | 271 | if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { |
| 261 | 272 | ||
| 262 | /* Save Thread object, original/current sync levels */ | 273 | /* Save Thread object, original/current sync levels */ |
| @@ -272,6 +283,12 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
| 272 | acpi_ex_link_mutex(obj_desc, walk_state->thread); | 283 | acpi_ex_link_mutex(obj_desc, walk_state->thread); |
| 273 | } | 284 | } |
| 274 | 285 | ||
| 286 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 287 | "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n", | ||
| 288 | obj_desc->mutex.sync_level, | ||
| 289 | walk_state->thread->current_sync_level, | ||
| 290 | obj_desc->mutex.acquisition_depth)); | ||
| 291 | |||
| 275 | return_ACPI_STATUS(status); | 292 | return_ACPI_STATUS(status); |
| 276 | } | 293 | } |
| 277 | 294 | ||
| @@ -356,9 +373,9 @@ acpi_status | |||
| 356 | acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | 373 | acpi_ex_release_mutex(union acpi_operand_object *obj_desc, |
| 357 | struct acpi_walk_state *walk_state) | 374 | struct acpi_walk_state *walk_state) |
| 358 | { | 375 | { |
| 359 | acpi_status status = AE_OK; | ||
| 360 | u8 previous_sync_level; | 376 | u8 previous_sync_level; |
| 361 | struct acpi_thread_state *owner_thread; | 377 | struct acpi_thread_state *owner_thread; |
| 378 | acpi_status status = AE_OK; | ||
| 362 | 379 | ||
| 363 | ACPI_FUNCTION_TRACE(ex_release_mutex); | 380 | ACPI_FUNCTION_TRACE(ex_release_mutex); |
| 364 | 381 | ||
| @@ -409,7 +426,8 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
| 409 | */ | 426 | */ |
| 410 | if (obj_desc->mutex.sync_level != owner_thread->current_sync_level) { | 427 | if (obj_desc->mutex.sync_level != owner_thread->current_sync_level) { |
| 411 | ACPI_ERROR((AE_INFO, | 428 | ACPI_ERROR((AE_INFO, |
| 412 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u", | 429 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: " |
| 430 | "mutex %u current %u", | ||
| 413 | acpi_ut_get_node_name(obj_desc->mutex.node), | 431 | acpi_ut_get_node_name(obj_desc->mutex.node), |
| 414 | obj_desc->mutex.sync_level, | 432 | obj_desc->mutex.sync_level, |
| 415 | walk_state->thread->current_sync_level)); | 433 | walk_state->thread->current_sync_level)); |
| @@ -424,6 +442,15 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
| 424 | previous_sync_level = | 442 | previous_sync_level = |
| 425 | owner_thread->acquired_mutex_list->mutex.original_sync_level; | 443 | owner_thread->acquired_mutex_list->mutex.original_sync_level; |
| 426 | 444 | ||
| 445 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 446 | "Releasing: Object SyncLevel %u, Thread SyncLevel %u, " | ||
| 447 | "Prev SyncLevel %u, Depth %u TID %p\n", | ||
| 448 | obj_desc->mutex.sync_level, | ||
| 449 | walk_state->thread->current_sync_level, | ||
| 450 | previous_sync_level, | ||
| 451 | obj_desc->mutex.acquisition_depth, | ||
| 452 | walk_state->thread)); | ||
| 453 | |||
| 427 | status = acpi_ex_release_mutex_object(obj_desc); | 454 | status = acpi_ex_release_mutex_object(obj_desc); |
| 428 | if (ACPI_FAILURE(status)) { | 455 | if (ACPI_FAILURE(status)) { |
| 429 | return_ACPI_STATUS(status); | 456 | return_ACPI_STATUS(status); |
| @@ -436,6 +463,14 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
| 436 | owner_thread->current_sync_level = previous_sync_level; | 463 | owner_thread->current_sync_level = previous_sync_level; |
| 437 | } | 464 | } |
| 438 | 465 | ||
| 466 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 467 | "Released: Object SyncLevel %u, Thread SyncLevel, %u, " | ||
| 468 | "Prev SyncLevel %u, Depth %u\n", | ||
| 469 | obj_desc->mutex.sync_level, | ||
| 470 | walk_state->thread->current_sync_level, | ||
| 471 | previous_sync_level, | ||
| 472 | obj_desc->mutex.acquisition_depth)); | ||
| 473 | |||
| 439 | return_ACPI_STATUS(status); | 474 | return_ACPI_STATUS(status); |
| 440 | } | 475 | } |
| 441 | 476 | ||
| @@ -462,21 +497,17 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
| 462 | union acpi_operand_object *next = thread->acquired_mutex_list; | 497 | union acpi_operand_object *next = thread->acquired_mutex_list; |
| 463 | union acpi_operand_object *obj_desc; | 498 | union acpi_operand_object *obj_desc; |
| 464 | 499 | ||
| 465 | ACPI_FUNCTION_NAME(ex_release_all_mutexes); | 500 | ACPI_FUNCTION_TRACE(ex_release_all_mutexes); |
| 466 | 501 | ||
| 467 | /* Traverse the list of owned mutexes, releasing each one */ | 502 | /* Traverse the list of owned mutexes, releasing each one */ |
| 468 | 503 | ||
| 469 | while (next) { | 504 | while (next) { |
| 470 | obj_desc = next; | 505 | obj_desc = next; |
| 471 | next = obj_desc->mutex.next; | ||
| 472 | |||
| 473 | obj_desc->mutex.prev = NULL; | ||
| 474 | obj_desc->mutex.next = NULL; | ||
| 475 | obj_desc->mutex.acquisition_depth = 0; | ||
| 476 | |||
| 477 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 506 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 478 | "Force-releasing held mutex: %p\n", | 507 | "Mutex [%4.4s] force-release, SyncLevel %u Depth %u\n", |
| 479 | obj_desc)); | 508 | obj_desc->mutex.node->name.ascii, |
| 509 | obj_desc->mutex.sync_level, | ||
| 510 | obj_desc->mutex.acquisition_depth)); | ||
| 480 | 511 | ||
| 481 | /* Release the mutex, special case for Global Lock */ | 512 | /* Release the mutex, special case for Global Lock */ |
| 482 | 513 | ||
| @@ -489,14 +520,21 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
| 489 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); | 520 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); |
| 490 | } | 521 | } |
| 491 | 522 | ||
| 492 | /* Mark mutex unowned */ | ||
| 493 | |||
| 494 | obj_desc->mutex.owner_thread = NULL; | ||
| 495 | obj_desc->mutex.thread_id = 0; | ||
| 496 | |||
| 497 | /* Update Thread sync_level (Last mutex is the important one) */ | 523 | /* Update Thread sync_level (Last mutex is the important one) */ |
| 498 | 524 | ||
| 499 | thread->current_sync_level = | 525 | thread->current_sync_level = |
| 500 | obj_desc->mutex.original_sync_level; | 526 | obj_desc->mutex.original_sync_level; |
| 527 | |||
| 528 | /* Mark mutex unowned */ | ||
| 529 | |||
| 530 | next = obj_desc->mutex.next; | ||
| 531 | |||
| 532 | obj_desc->mutex.prev = NULL; | ||
| 533 | obj_desc->mutex.next = NULL; | ||
| 534 | obj_desc->mutex.acquisition_depth = 0; | ||
| 535 | obj_desc->mutex.owner_thread = NULL; | ||
| 536 | obj_desc->mutex.thread_id = 0; | ||
| 501 | } | 537 | } |
| 538 | |||
| 539 | return_VOID; | ||
| 502 | } | 540 | } |
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c index 20e87813c7d7..b2e911a35866 100644 --- a/drivers/acpi/acpica/exnames.c +++ b/drivers/acpi/acpica/exnames.c | |||
| @@ -164,8 +164,8 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
| 164 | ACPI_FUNCTION_TRACE(ex_name_segment); | 164 | ACPI_FUNCTION_TRACE(ex_name_segment); |
| 165 | 165 | ||
| 166 | /* | 166 | /* |
| 167 | * If first character is a digit, then we know that we aren't looking at a | 167 | * If first character is a digit, then we know that we aren't looking |
| 168 | * valid name segment | 168 | * at a valid name segment |
| 169 | */ | 169 | */ |
| 170 | char_buf[0] = *aml_address; | 170 | char_buf[0] = *aml_address; |
| 171 | 171 | ||
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index 77930683ab7d..efe7ac319f65 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c | |||
| @@ -484,22 +484,26 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 484 | 484 | ||
| 485 | case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ | 485 | case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ |
| 486 | 486 | ||
| 487 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 487 | status = |
| 488 | ACPI_EXPLICIT_CONVERT_DECIMAL); | 488 | acpi_ex_convert_to_string(operand[0], &return_desc, |
| 489 | ACPI_EXPLICIT_CONVERT_DECIMAL); | ||
| 489 | if (return_desc == operand[0]) { | 490 | if (return_desc == operand[0]) { |
| 490 | 491 | ||
| 491 | /* No conversion performed, add ref to handle return value */ | 492 | /* No conversion performed, add ref to handle return value */ |
| 493 | |||
| 492 | acpi_ut_add_reference(return_desc); | 494 | acpi_ut_add_reference(return_desc); |
| 493 | } | 495 | } |
| 494 | break; | 496 | break; |
| 495 | 497 | ||
| 496 | case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ | 498 | case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ |
| 497 | 499 | ||
| 498 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 500 | status = |
| 499 | ACPI_EXPLICIT_CONVERT_HEX); | 501 | acpi_ex_convert_to_string(operand[0], &return_desc, |
| 502 | ACPI_EXPLICIT_CONVERT_HEX); | ||
| 500 | if (return_desc == operand[0]) { | 503 | if (return_desc == operand[0]) { |
| 501 | 504 | ||
| 502 | /* No conversion performed, add ref to handle return value */ | 505 | /* No conversion performed, add ref to handle return value */ |
| 506 | |||
| 503 | acpi_ut_add_reference(return_desc); | 507 | acpi_ut_add_reference(return_desc); |
| 504 | } | 508 | } |
| 505 | break; | 509 | break; |
| @@ -510,17 +514,20 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 510 | if (return_desc == operand[0]) { | 514 | if (return_desc == operand[0]) { |
| 511 | 515 | ||
| 512 | /* No conversion performed, add ref to handle return value */ | 516 | /* No conversion performed, add ref to handle return value */ |
| 517 | |||
| 513 | acpi_ut_add_reference(return_desc); | 518 | acpi_ut_add_reference(return_desc); |
| 514 | } | 519 | } |
| 515 | break; | 520 | break; |
| 516 | 521 | ||
| 517 | case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ | 522 | case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ |
| 518 | 523 | ||
| 519 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, | 524 | status = |
| 520 | ACPI_ANY_BASE); | 525 | acpi_ex_convert_to_integer(operand[0], &return_desc, |
| 526 | ACPI_ANY_BASE); | ||
| 521 | if (return_desc == operand[0]) { | 527 | if (return_desc == operand[0]) { |
| 522 | 528 | ||
| 523 | /* No conversion performed, add ref to handle return value */ | 529 | /* No conversion performed, add ref to handle return value */ |
| 530 | |||
| 524 | acpi_ut_add_reference(return_desc); | 531 | acpi_ut_add_reference(return_desc); |
| 525 | } | 532 | } |
| 526 | break; | 533 | break; |
| @@ -679,7 +686,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 679 | status = acpi_ex_store(return_desc, operand[0], walk_state); | 686 | status = acpi_ex_store(return_desc, operand[0], walk_state); |
| 680 | break; | 687 | break; |
| 681 | 688 | ||
| 682 | case AML_TYPE_OP: /* object_type (source_object) */ | 689 | case AML_OBJECT_TYPE_OP: /* object_type (source_object) */ |
| 683 | /* | 690 | /* |
| 684 | * Note: The operand is not resolved at this point because we want to | 691 | * Note: The operand is not resolved at this point because we want to |
| 685 | * get the associated object, not its value. For example, we don't | 692 | * get the associated object, not its value. For example, we don't |
| @@ -713,9 +720,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 713 | 720 | ||
| 714 | /* Get the base object */ | 721 | /* Get the base object */ |
| 715 | 722 | ||
| 716 | status = acpi_ex_resolve_multiple(walk_state, | 723 | status = |
| 717 | operand[0], &type, | 724 | acpi_ex_resolve_multiple(walk_state, operand[0], &type, |
| 718 | &temp_desc); | 725 | &temp_desc); |
| 719 | if (ACPI_FAILURE(status)) { | 726 | if (ACPI_FAILURE(status)) { |
| 720 | goto cleanup; | 727 | goto cleanup; |
| 721 | } | 728 | } |
| @@ -759,8 +766,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 759 | default: | 766 | default: |
| 760 | 767 | ||
| 761 | ACPI_ERROR((AE_INFO, | 768 | ACPI_ERROR((AE_INFO, |
| 762 | "Operand must be Buffer/Integer/String/Package - found type %s", | 769 | "Operand must be Buffer/Integer/String/Package" |
| 770 | " - found type %s", | ||
| 763 | acpi_ut_get_type_name(type))); | 771 | acpi_ut_get_type_name(type))); |
| 772 | |||
| 764 | status = AE_AML_OPERAND_TYPE; | 773 | status = AE_AML_OPERAND_TYPE; |
| 765 | goto cleanup; | 774 | goto cleanup; |
| 766 | } | 775 | } |
| @@ -981,6 +990,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 981 | "Unknown Index TargetType 0x%X in reference object %p", | 990 | "Unknown Index TargetType 0x%X in reference object %p", |
| 982 | operand[0]->reference. | 991 | operand[0]->reference. |
| 983 | target_type, operand[0])); | 992 | target_type, operand[0])); |
| 993 | |||
| 984 | status = AE_AML_OPERAND_TYPE; | 994 | status = AE_AML_OPERAND_TYPE; |
| 985 | goto cleanup; | 995 | goto cleanup; |
| 986 | } | 996 | } |
| @@ -1050,6 +1060,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 1050 | 1060 | ||
| 1051 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", | 1061 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", |
| 1052 | walk_state->opcode)); | 1062 | walk_state->opcode)); |
| 1063 | |||
| 1053 | status = AE_AML_BAD_OPCODE; | 1064 | status = AE_AML_BAD_OPCODE; |
| 1054 | goto cleanup; | 1065 | goto cleanup; |
| 1055 | } | 1066 | } |
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index b8944ebb1081..6dad2ca1c8c9 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c | |||
| @@ -199,6 +199,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
| 199 | 199 | ||
| 200 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", | 200 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", |
| 201 | walk_state->opcode)); | 201 | walk_state->opcode)); |
| 202 | |||
| 202 | status = AE_AML_BAD_OPCODE; | 203 | status = AE_AML_BAD_OPCODE; |
| 203 | goto cleanup; | 204 | goto cleanup; |
| 204 | } | 205 | } |
| @@ -299,8 +300,9 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 299 | 300 | ||
| 300 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ | 301 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ |
| 301 | 302 | ||
| 302 | status = acpi_ex_do_concatenate(operand[0], operand[1], | 303 | status = |
| 303 | &return_desc, walk_state); | 304 | acpi_ex_do_concatenate(operand[0], operand[1], &return_desc, |
| 305 | walk_state); | ||
| 304 | break; | 306 | break; |
| 305 | 307 | ||
| 306 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ | 308 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ |
| @@ -345,8 +347,9 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 345 | 347 | ||
| 346 | /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ | 348 | /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ |
| 347 | 349 | ||
| 348 | status = acpi_ex_concat_template(operand[0], operand[1], | 350 | status = |
| 349 | &return_desc, walk_state); | 351 | acpi_ex_concat_template(operand[0], operand[1], |
| 352 | &return_desc, walk_state); | ||
| 350 | break; | 353 | break; |
| 351 | 354 | ||
| 352 | case AML_INDEX_OP: /* Index (Source Index Result) */ | 355 | case AML_INDEX_OP: /* Index (Source Index Result) */ |
| @@ -553,6 +556,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 553 | 556 | ||
| 554 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", | 557 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", |
| 555 | walk_state->opcode)); | 558 | walk_state->opcode)); |
| 559 | |||
| 556 | status = AE_AML_BAD_OPCODE; | 560 | status = AE_AML_BAD_OPCODE; |
| 557 | goto cleanup; | 561 | goto cleanup; |
| 558 | } | 562 | } |
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index fa100b3b92ee..27fb0172fca2 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c | |||
| @@ -95,10 +95,11 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
| 95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
| 96 | 96 | ||
| 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 98 | "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 98 | "FatalOp: Type %X Code %X Arg %X " |
| 99 | (u32) operand[0]->integer.value, | 99 | "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
| 100 | (u32) operand[1]->integer.value, | 100 | (u32)operand[0]->integer.value, |
| 101 | (u32) operand[2]->integer.value)); | 101 | (u32)operand[1]->integer.value, |
| 102 | (u32)operand[2]->integer.value)); | ||
| 102 | 103 | ||
| 103 | fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); | 104 | fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); |
| 104 | if (fatal) { | 105 | if (fatal) { |
| @@ -131,6 +132,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
| 131 | 132 | ||
| 132 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", | 133 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", |
| 133 | walk_state->opcode)); | 134 | walk_state->opcode)); |
| 135 | |||
| 134 | status = AE_AML_BAD_OPCODE; | 136 | status = AE_AML_BAD_OPCODE; |
| 135 | goto cleanup; | 137 | goto cleanup; |
| 136 | } | 138 | } |
| @@ -193,7 +195,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 193 | /* Truncate request if larger than the actual String/Buffer */ | 195 | /* Truncate request if larger than the actual String/Buffer */ |
| 194 | 196 | ||
| 195 | else if ((index + length) > operand[0]->string.length) { | 197 | else if ((index + length) > operand[0]->string.length) { |
| 196 | length = (acpi_size) operand[0]->string.length - | 198 | length = |
| 199 | (acpi_size) operand[0]->string.length - | ||
| 197 | (acpi_size) index; | 200 | (acpi_size) index; |
| 198 | } | 201 | } |
| 199 | 202 | ||
| @@ -237,8 +240,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 237 | 240 | ||
| 238 | /* We have a buffer, copy the portion requested */ | 241 | /* We have a buffer, copy the portion requested */ |
| 239 | 242 | ||
| 240 | memcpy(buffer, operand[0]->string.pointer + index, | 243 | memcpy(buffer, |
| 241 | length); | 244 | operand[0]->string.pointer + index, length); |
| 242 | } | 245 | } |
| 243 | 246 | ||
| 244 | /* Set the length of the new String/Buffer */ | 247 | /* Set the length of the new String/Buffer */ |
| @@ -255,6 +258,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 255 | 258 | ||
| 256 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", | 259 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", |
| 257 | walk_state->opcode)); | 260 | walk_state->opcode)); |
| 261 | |||
| 258 | status = AE_AML_BAD_OPCODE; | 262 | status = AE_AML_BAD_OPCODE; |
| 259 | goto cleanup; | 263 | goto cleanup; |
| 260 | } | 264 | } |
| @@ -270,12 +274,11 @@ cleanup: | |||
| 270 | if (ACPI_FAILURE(status) || walk_state->result_obj) { | 274 | if (ACPI_FAILURE(status) || walk_state->result_obj) { |
| 271 | acpi_ut_remove_reference(return_desc); | 275 | acpi_ut_remove_reference(return_desc); |
| 272 | walk_state->result_obj = NULL; | 276 | walk_state->result_obj = NULL; |
| 273 | } | 277 | } else { |
| 278 | /* Set the return object and exit */ | ||
| 274 | 279 | ||
| 275 | /* Set the return object and exit */ | ||
| 276 | |||
| 277 | else { | ||
| 278 | walk_state->result_obj = return_desc; | 280 | walk_state->result_obj = return_desc; |
| 279 | } | 281 | } |
| 282 | |||
| 280 | return_ACPI_STATUS(status); | 283 | return_ACPI_STATUS(status); |
| 281 | } | 284 | } |
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index c930edda3f65..7efc9f47ffb9 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c | |||
| @@ -310,6 +310,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
| 310 | 310 | ||
| 311 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", | 311 | ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", |
| 312 | walk_state->opcode)); | 312 | walk_state->opcode)); |
| 313 | |||
| 313 | status = AE_AML_BAD_OPCODE; | 314 | status = AE_AML_BAD_OPCODE; |
| 314 | goto cleanup; | 315 | goto cleanup; |
| 315 | } | 316 | } |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 4c2836dc825b..1f111cc94c00 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | * | 2 | * |
| 3 | * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities | 3 | * Module Name: exprep - ACPI AML field prep utilities |
| 4 | * | 4 | * |
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| @@ -103,8 +103,10 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
| 103 | /* Round Field start offset and length to "minimal" byte boundaries */ | 103 | /* Round Field start offset and length to "minimal" byte boundaries */ |
| 104 | 104 | ||
| 105 | field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8)); | 105 | field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8)); |
| 106 | field_byte_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length + | 106 | |
| 107 | field_bit_offset, 8)); | 107 | field_byte_end_offset = |
| 108 | ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length + field_bit_offset, 8)); | ||
| 109 | |||
| 108 | field_byte_length = field_byte_end_offset - field_byte_offset; | 110 | field_byte_length = field_byte_end_offset - field_byte_offset; |
| 109 | 111 | ||
| 110 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 112 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| @@ -159,7 +161,8 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
| 159 | 161 | ||
| 160 | if (accesses <= 1) { | 162 | if (accesses <= 1) { |
| 161 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 163 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 162 | "Entire field can be accessed with one operation of size %u\n", | 164 | "Entire field can be accessed " |
| 165 | "with one operation of size %u\n", | ||
| 163 | access_byte_width)); | 166 | access_byte_width)); |
| 164 | return_VALUE(access_byte_width); | 167 | return_VALUE(access_byte_width); |
| 165 | } | 168 | } |
| @@ -202,6 +205,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
| 202 | */ | 205 | */ |
| 203 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 204 | "Cannot access field in one operation, using width 8\n")); | 207 | "Cannot access field in one operation, using width 8\n")); |
| 208 | |||
| 205 | return_VALUE(8); | 209 | return_VALUE(8); |
| 206 | } | 210 | } |
| 207 | #endif /* ACPI_UNDER_DEVELOPMENT */ | 211 | #endif /* ACPI_UNDER_DEVELOPMENT */ |
| @@ -281,6 +285,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
| 281 | /* Invalid field access type */ | 285 | /* Invalid field access type */ |
| 282 | 286 | ||
| 283 | ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); | 287 | ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); |
| 288 | |||
| 284 | return_UINT32(0); | 289 | return_UINT32(0); |
| 285 | } | 290 | } |
| 286 | 291 | ||
| @@ -354,8 +359,8 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
| 354 | * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is | 359 | * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is |
| 355 | * the same (equivalent) as the byte_alignment. | 360 | * the same (equivalent) as the byte_alignment. |
| 356 | */ | 361 | */ |
| 357 | access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags, | 362 | access_bit_width = |
| 358 | &byte_alignment); | 363 | acpi_ex_decode_field_access(obj_desc, field_flags, &byte_alignment); |
| 359 | if (!access_bit_width) { | 364 | if (!access_bit_width) { |
| 360 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 365 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
| 361 | } | 366 | } |
| @@ -595,7 +600,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
| 595 | access_byte_width); | 600 | access_byte_width); |
| 596 | 601 | ||
| 597 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 602 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 598 | "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", | 603 | "IndexField: BitOff %X, Off %X, Value %X, " |
| 604 | "Gran %X, Index %p, Data %p\n", | ||
| 599 | obj_desc->index_field.start_field_bit_offset, | 605 | obj_desc->index_field.start_field_bit_offset, |
| 600 | obj_desc->index_field.base_byte_offset, | 606 | obj_desc->index_field.base_byte_offset, |
| 601 | obj_desc->index_field.value, | 607 | obj_desc->index_field.value, |
| @@ -615,8 +621,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
| 615 | * Store the constructed descriptor (obj_desc) into the parent Node, | 621 | * Store the constructed descriptor (obj_desc) into the parent Node, |
| 616 | * preserving the current type of that named_obj. | 622 | * preserving the current type of that named_obj. |
| 617 | */ | 623 | */ |
| 618 | status = acpi_ns_attach_object(info->field_node, obj_desc, | 624 | status = |
| 619 | acpi_ns_get_type(info->field_node)); | 625 | acpi_ns_attach_object(info->field_node, obj_desc, |
| 626 | acpi_ns_get_type(info->field_node)); | ||
| 620 | 627 | ||
| 621 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 628 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 622 | "Set NamedObj %p [%4.4s], ObjDesc %p\n", | 629 | "Set NamedObj %p [%4.4s], ObjDesc %p\n", |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index b4a5e44c00dd..1851a307544a 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
| @@ -392,7 +392,8 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
| 392 | pci_register = (u16) (u32) address; | 392 | pci_register = (u16) (u32) address; |
| 393 | 393 | ||
| 394 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 394 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 395 | "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", | 395 | "Pci-Config %u (%u) Seg(%04x) Bus(%04x) " |
| 396 | "Dev(%04x) Func(%04x) Reg(%04x)\n", | ||
| 396 | function, bit_width, pci_id->segment, pci_id->bus, | 397 | function, bit_width, pci_id->segment, pci_id->bus, |
| 397 | pci_id->device, pci_id->function, pci_register)); | 398 | pci_id->device, pci_id->function, pci_register)); |
| 398 | 399 | ||
| @@ -400,14 +401,16 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
| 400 | case ACPI_READ: | 401 | case ACPI_READ: |
| 401 | 402 | ||
| 402 | *value = 0; | 403 | *value = 0; |
| 403 | status = acpi_os_read_pci_configuration(pci_id, pci_register, | 404 | status = |
| 404 | value, bit_width); | 405 | acpi_os_read_pci_configuration(pci_id, pci_register, value, |
| 406 | bit_width); | ||
| 405 | break; | 407 | break; |
| 406 | 408 | ||
| 407 | case ACPI_WRITE: | 409 | case ACPI_WRITE: |
| 408 | 410 | ||
| 409 | status = acpi_os_write_pci_configuration(pci_id, pci_register, | 411 | status = |
| 410 | *value, bit_width); | 412 | acpi_os_write_pci_configuration(pci_id, pci_register, |
| 413 | *value, bit_width); | ||
| 411 | break; | 414 | break; |
| 412 | 415 | ||
| 413 | default: | 416 | default: |
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c index 1b372ef69308..6793dcc8a946 100644 --- a/drivers/acpi/acpica/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c | |||
| @@ -112,7 +112,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
| 112 | 112 | ||
| 113 | /* | 113 | /* |
| 114 | * Several object types require no further processing: | 114 | * Several object types require no further processing: |
| 115 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node | 115 | * 1) Device/Thermal objects don't have a "real" subobject, return Node |
| 116 | * 2) Method locals and arguments have a pseudo-Node | 116 | * 2) Method locals and arguments have a pseudo-Node |
| 117 | * 3) 10/2007: Added method type to assist with Package construction. | 117 | * 3) 10/2007: Added method type to assist with Package construction. |
| 118 | */ | 118 | */ |
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index a1afe1a1e7c2..7f9260b129fc 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c | |||
| @@ -217,7 +217,8 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
| 217 | * the package, can't dereference it | 217 | * the package, can't dereference it |
| 218 | */ | 218 | */ |
| 219 | ACPI_ERROR((AE_INFO, | 219 | ACPI_ERROR((AE_INFO, |
| 220 | "Attempt to dereference an Index to NULL package element Idx=%p", | 220 | "Attempt to dereference an Index to " |
| 221 | "NULL package element Idx=%p", | ||
| 221 | stack_desc)); | 222 | stack_desc)); |
| 222 | status = AE_AML_UNINITIALIZED_ELEMENT; | 223 | status = AE_AML_UNINITIALIZED_ELEMENT; |
| 223 | } | 224 | } |
| @@ -361,10 +362,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
| 361 | 362 | ||
| 362 | if (type == ACPI_TYPE_LOCAL_ALIAS) { | 363 | if (type == ACPI_TYPE_LOCAL_ALIAS) { |
| 363 | type = ((struct acpi_namespace_node *)obj_desc)->type; | 364 | type = ((struct acpi_namespace_node *)obj_desc)->type; |
| 364 | obj_desc = | 365 | obj_desc = acpi_ns_get_attached_object((struct |
| 365 | acpi_ns_get_attached_object((struct | 366 | acpi_namespace_node |
| 366 | acpi_namespace_node *) | 367 | *)obj_desc); |
| 367 | obj_desc); | ||
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | if (!obj_desc) { | 370 | if (!obj_desc) { |
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c index 424442d50b5e..861453e58555 100644 --- a/drivers/acpi/acpica/exresop.c +++ b/drivers/acpi/acpica/exresop.c | |||
| @@ -90,8 +90,8 @@ acpi_ex_check_object_type(acpi_object_type type_needed, | |||
| 90 | * specification, a store to a constant is a noop.) | 90 | * specification, a store to a constant is a noop.) |
| 91 | */ | 91 | */ |
| 92 | if ((this_type == ACPI_TYPE_INTEGER) && | 92 | if ((this_type == ACPI_TYPE_INTEGER) && |
| 93 | (((union acpi_operand_object *)object)->common. | 93 | (((union acpi_operand_object *)object)->common.flags & |
| 94 | flags & AOPOBJ_AML_CONSTANT)) { | 94 | AOPOBJ_AML_CONSTANT)) { |
| 95 | return (AE_OK); | 95 | return (AE_OK); |
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| @@ -196,10 +196,10 @@ acpi_ex_resolve_operands(u16 opcode, | |||
| 196 | * thus, the attached object is always the aliased namespace node | 196 | * thus, the attached object is always the aliased namespace node |
| 197 | */ | 197 | */ |
| 198 | if (object_type == ACPI_TYPE_LOCAL_ALIAS) { | 198 | if (object_type == ACPI_TYPE_LOCAL_ALIAS) { |
| 199 | obj_desc = | 199 | obj_desc = acpi_ns_get_attached_object((struct |
| 200 | acpi_ns_get_attached_object((struct | 200 | acpi_namespace_node |
| 201 | acpi_namespace_node | 201 | *) |
| 202 | *)obj_desc); | 202 | obj_desc); |
| 203 | *stack_ptr = obj_desc; | 203 | *stack_ptr = obj_desc; |
| 204 | object_type = | 204 | object_type = |
| 205 | ((struct acpi_namespace_node *)obj_desc)-> | 205 | ((struct acpi_namespace_node *)obj_desc)-> |
| @@ -285,8 +285,8 @@ acpi_ex_resolve_operands(u16 opcode, | |||
| 285 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ | 285 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ |
| 286 | 286 | ||
| 287 | if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == | 287 | if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
| 288 | ACPI_DESC_TYPE_OPERAND) | 288 | ACPI_DESC_TYPE_OPERAND) && |
| 289 | && (obj_desc->common.type == ACPI_TYPE_STRING)) { | 289 | (obj_desc->common.type == ACPI_TYPE_STRING)) { |
| 290 | /* | 290 | /* |
| 291 | * String found - the string references a named object and | 291 | * String found - the string references a named object and |
| 292 | * must be resolved to a node | 292 | * must be resolved to a node |
| @@ -465,8 +465,9 @@ acpi_ex_resolve_operands(u16 opcode, | |||
| 465 | * But we can implicitly convert from a BUFFER or INTEGER | 465 | * But we can implicitly convert from a BUFFER or INTEGER |
| 466 | * aka - "Implicit Source Operand Conversion" | 466 | * aka - "Implicit Source Operand Conversion" |
| 467 | */ | 467 | */ |
| 468 | status = acpi_ex_convert_to_string(obj_desc, stack_ptr, | 468 | status = |
| 469 | ACPI_IMPLICIT_CONVERT_HEX); | 469 | acpi_ex_convert_to_string(obj_desc, stack_ptr, |
| 470 | ACPI_IMPLICIT_CONVERT_HEX); | ||
| 470 | if (ACPI_FAILURE(status)) { | 471 | if (ACPI_FAILURE(status)) { |
| 471 | if (status == AE_TYPE) { | 472 | if (status == AE_TYPE) { |
| 472 | ACPI_ERROR((AE_INFO, | 473 | ACPI_ERROR((AE_INFO, |
| @@ -597,8 +598,10 @@ acpi_ex_resolve_operands(u16 opcode, | |||
| 597 | 598 | ||
| 598 | case ARGI_REGION_OR_BUFFER: /* Used by Load() only */ | 599 | case ARGI_REGION_OR_BUFFER: /* Used by Load() only */ |
| 599 | 600 | ||
| 600 | /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ | 601 | /* |
| 601 | 602 | * Need an operand of type REGION or a BUFFER | |
| 603 | * (which could be a resolved region field) | ||
| 604 | */ | ||
| 602 | switch (obj_desc->common.type) { | 605 | switch (obj_desc->common.type) { |
| 603 | case ACPI_TYPE_BUFFER: | 606 | case ACPI_TYPE_BUFFER: |
| 604 | case ACPI_TYPE_REGION: | 607 | case ACPI_TYPE_REGION: |
| @@ -640,9 +643,9 @@ acpi_ex_resolve_operands(u16 opcode, | |||
| 640 | 643 | ||
| 641 | if (acpi_gbl_enable_interpreter_slack) { | 644 | if (acpi_gbl_enable_interpreter_slack) { |
| 642 | /* | 645 | /* |
| 643 | * Enable original behavior of Store(), allowing any and all | 646 | * Enable original behavior of Store(), allowing any |
| 644 | * objects as the source operand. The ACPI spec does not | 647 | * and all objects as the source operand. The ACPI |
| 645 | * allow this, however. | 648 | * spec does not allow this, however. |
| 646 | */ | 649 | */ |
| 647 | break; | 650 | break; |
| 648 | } | 651 | } |
| @@ -655,7 +658,8 @@ acpi_ex_resolve_operands(u16 opcode, | |||
| 655 | } | 658 | } |
| 656 | 659 | ||
| 657 | ACPI_ERROR((AE_INFO, | 660 | ACPI_ERROR((AE_INFO, |
| 658 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p", | 661 | "Needed Integer/Buffer/String/Package/Ref/Ddb]" |
| 662 | ", found [%s] %p", | ||
| 659 | acpi_ut_get_object_type_name | 663 | acpi_ut_get_object_type_name |
| 660 | (obj_desc), obj_desc)); | 664 | (obj_desc), obj_desc)); |
| 661 | 665 | ||
| @@ -678,9 +682,10 @@ acpi_ex_resolve_operands(u16 opcode, | |||
| 678 | * Make sure that the original object was resolved to the | 682 | * Make sure that the original object was resolved to the |
| 679 | * required object type (Simple cases only). | 683 | * required object type (Simple cases only). |
| 680 | */ | 684 | */ |
| 681 | status = acpi_ex_check_object_type(type_needed, | 685 | status = |
| 682 | (*stack_ptr)->common.type, | 686 | acpi_ex_check_object_type(type_needed, |
| 683 | *stack_ptr); | 687 | (*stack_ptr)->common.type, |
| 688 | *stack_ptr); | ||
| 684 | if (ACPI_FAILURE(status)) { | 689 | if (ACPI_FAILURE(status)) { |
| 685 | return_ACPI_STATUS(status); | 690 | return_ACPI_STATUS(status); |
| 686 | } | 691 | } |
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index c076e9100d66..d3afbcbe7886 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
| @@ -467,7 +467,8 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
| 467 | case ACPI_TYPE_THERMAL: | 467 | case ACPI_TYPE_THERMAL: |
| 468 | 468 | ||
| 469 | ACPI_ERROR((AE_INFO, | 469 | ACPI_ERROR((AE_INFO, |
| 470 | "Target must be [Buffer/Integer/String/Reference], found [%s] (%4.4s)", | 470 | "Target must be [Buffer/Integer/String/Reference]" |
| 471 | ", found [%s] (%4.4s)", | ||
| 471 | acpi_ut_get_type_name(node->type), | 472 | acpi_ut_get_type_name(node->type), |
| 472 | node->name.ascii)); | 473 | node->name.ascii)); |
| 473 | 474 | ||
| @@ -504,8 +505,9 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
| 504 | * an implicit conversion, as per the ACPI specification. | 505 | * an implicit conversion, as per the ACPI specification. |
| 505 | * A direct store is performed instead. | 506 | * A direct store is performed instead. |
| 506 | */ | 507 | */ |
| 507 | status = acpi_ex_store_direct_to_node(source_desc, node, | 508 | status = |
| 508 | walk_state); | 509 | acpi_ex_store_direct_to_node(source_desc, node, |
| 510 | walk_state); | ||
| 509 | break; | 511 | break; |
| 510 | } | 512 | } |
| 511 | 513 | ||
| @@ -528,8 +530,9 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
| 528 | * store has been performed such that the node/object type | 530 | * store has been performed such that the node/object type |
| 529 | * has been changed. | 531 | * has been changed. |
| 530 | */ | 532 | */ |
| 531 | status = acpi_ns_attach_object(node, new_desc, | 533 | status = |
| 532 | new_desc->common.type); | 534 | acpi_ns_attach_object(node, new_desc, |
| 535 | new_desc->common.type); | ||
| 533 | 536 | ||
| 534 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 537 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 535 | "Store type [%s] into [%s] via Convert/Attach\n", | 538 | "Store type [%s] into [%s] via Convert/Attach\n", |
| @@ -563,8 +566,8 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
| 563 | * operator. (Note, for this default case, all normal | 566 | * operator. (Note, for this default case, all normal |
| 564 | * Store/Target operations exited above with an error). | 567 | * Store/Target operations exited above with an error). |
| 565 | */ | 568 | */ |
| 566 | status = acpi_ex_store_direct_to_node(source_desc, node, | 569 | status = |
| 567 | walk_state); | 570 | acpi_ex_store_direct_to_node(source_desc, node, walk_state); |
| 568 | break; | 571 | break; |
| 569 | } | 572 | } |
| 570 | 573 | ||
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c index e1d4f4d51b97..ad3bc92af2e6 100644 --- a/drivers/acpi/acpica/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | * | 2 | * |
| 3 | * Module Name: exstorob - AML Interpreter object store support, store to object | 3 | * Module Name: exstorob - AML object store support, store to object |
| 4 | * | 4 | * |
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| @@ -203,8 +203,9 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
| 203 | ACPI_FREE(target_desc->string.pointer); | 203 | ACPI_FREE(target_desc->string.pointer); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size) | 206 | target_desc->string.pointer = |
| 207 | length + 1); | 207 | ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); |
| 208 | |||
| 208 | if (!target_desc->string.pointer) { | 209 | if (!target_desc->string.pointer) { |
| 209 | return_ACPI_STATUS(AE_NO_MEMORY); | 210 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 210 | } | 211 | } |
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 05450656fe3d..7c91c1f799a5 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
| @@ -78,7 +78,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
| 78 | /* We must wait, so unlock the interpreter */ | 78 | /* We must wait, so unlock the interpreter */ |
| 79 | 79 | ||
| 80 | acpi_ex_exit_interpreter(); | 80 | acpi_ex_exit_interpreter(); |
| 81 | |||
| 82 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); | 81 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
| 83 | 82 | ||
| 84 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 83 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| @@ -124,7 +123,6 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
| 124 | /* We must wait, so unlock the interpreter */ | 123 | /* We must wait, so unlock the interpreter */ |
| 125 | 124 | ||
| 126 | acpi_ex_exit_interpreter(); | 125 | acpi_ex_exit_interpreter(); |
| 127 | |||
| 128 | status = acpi_os_acquire_mutex(mutex, timeout); | 126 | status = acpi_os_acquire_mutex(mutex, timeout); |
| 129 | 127 | ||
| 130 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 128 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| @@ -169,8 +167,8 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) | |||
| 169 | * (ACPI specifies 100 usec as max, but this gives some slack in | 167 | * (ACPI specifies 100 usec as max, but this gives some slack in |
| 170 | * order to support existing BIOSs) | 168 | * order to support existing BIOSs) |
| 171 | */ | 169 | */ |
| 172 | ACPI_ERROR((AE_INFO, "Time parameter is too large (%u)", | 170 | ACPI_ERROR((AE_INFO, |
| 173 | how_long)); | 171 | "Time parameter is too large (%u)", how_long)); |
| 174 | status = AE_AML_OPERAND_VALUE; | 172 | status = AE_AML_OPERAND_VALUE; |
| 175 | } else { | 173 | } else { |
| 176 | acpi_os_stall(how_long); | 174 | acpi_os_stall(how_long); |
diff --git a/drivers/acpi/acpica/extrace.c b/drivers/acpi/acpica/extrace.c new file mode 100644 index 000000000000..e4a185eece8a --- /dev/null +++ b/drivers/acpi/acpica/extrace.c | |||
| @@ -0,0 +1,377 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Module Name: extrace - Support for interpreter execution tracing | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2015, Intel Corp. | ||
| 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 | #include <acpi/acpi.h> | ||
| 45 | #include "accommon.h" | ||
| 46 | #include "acnamesp.h" | ||
| 47 | #include "acinterp.h" | ||
| 48 | |||
| 49 | #define _COMPONENT ACPI_EXECUTER | ||
| 50 | ACPI_MODULE_NAME("extrace") | ||
| 51 | |||
| 52 | static union acpi_operand_object *acpi_gbl_trace_method_object = NULL; | ||
| 53 | |||
| 54 | /* Local prototypes */ | ||
| 55 | |||
| 56 | #ifdef ACPI_DEBUG_OUTPUT | ||
| 57 | static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type); | ||
| 58 | #endif | ||
| 59 | |||
| 60 | /******************************************************************************* | ||
| 61 | * | ||
| 62 | * FUNCTION: acpi_ex_interpreter_trace_enabled | ||
| 63 | * | ||
| 64 | * PARAMETERS: name - Whether method name should be matched, | ||
| 65 | * this should be checked before starting | ||
| 66 | * the tracer | ||
| 67 | * | ||
| 68 | * RETURN: TRUE if interpreter trace is enabled. | ||
| 69 | * | ||
| 70 | * DESCRIPTION: Check whether interpreter trace is enabled | ||
| 71 | * | ||
| 72 | ******************************************************************************/ | ||
| 73 | |||
| 74 | static u8 acpi_ex_interpreter_trace_enabled(char *name) | ||
| 75 | { | ||
| 76 | |||
| 77 | /* Check if tracing is enabled */ | ||
| 78 | |||
| 79 | if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED)) { | ||
| 80 | return (FALSE); | ||
| 81 | } | ||
| 82 | |||
| 83 | /* | ||
| 84 | * Check if tracing is filtered: | ||
| 85 | * | ||
| 86 | * 1. If the tracer is started, acpi_gbl_trace_method_object should have | ||
| 87 | * been filled by the trace starter | ||
| 88 | * 2. If the tracer is not started, acpi_gbl_trace_method_name should be | ||
| 89 | * matched if it is specified | ||
| 90 | * 3. If the tracer is oneshot style, acpi_gbl_trace_method_name should | ||
| 91 | * not be cleared by the trace stopper during the first match | ||
| 92 | */ | ||
| 93 | if (acpi_gbl_trace_method_object) { | ||
| 94 | return (TRUE); | ||
| 95 | } | ||
| 96 | |||
| 97 | if (name && | ||
| 98 | (acpi_gbl_trace_method_name && | ||
| 99 | strcmp(acpi_gbl_trace_method_name, name))) { | ||
| 100 | return (FALSE); | ||
| 101 | } | ||
| 102 | |||
| 103 | if ((acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) && | ||
| 104 | !acpi_gbl_trace_method_name) { | ||
| 105 | return (FALSE); | ||
| 106 | } | ||
| 107 | |||
| 108 | return (TRUE); | ||
| 109 | } | ||
| 110 | |||
| 111 | /******************************************************************************* | ||
| 112 | * | ||
| 113 | * FUNCTION: acpi_ex_get_trace_event_name | ||
| 114 | * | ||
| 115 | * PARAMETERS: type - Trace event type | ||
| 116 | * | ||
| 117 | * RETURN: Trace event name. | ||
| 118 | * | ||
| 119 | * DESCRIPTION: Used to obtain the full trace event name. | ||
| 120 | * | ||
| 121 | ******************************************************************************/ | ||
| 122 | |||
| 123 | #ifdef ACPI_DEBUG_OUTPUT | ||
| 124 | |||
| 125 | static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type) | ||
| 126 | { | ||
| 127 | |||
| 128 | switch (type) { | ||
| 129 | case ACPI_TRACE_AML_METHOD: | ||
| 130 | |||
| 131 | return "Method"; | ||
| 132 | |||
| 133 | case ACPI_TRACE_AML_OPCODE: | ||
| 134 | |||
| 135 | return "Opcode"; | ||
| 136 | |||
| 137 | case ACPI_TRACE_AML_REGION: | ||
| 138 | |||
| 139 | return "Region"; | ||
| 140 | |||
| 141 | default: | ||
| 142 | |||
| 143 | return ""; | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 147 | #endif | ||
| 148 | |||
| 149 | /******************************************************************************* | ||
| 150 | * | ||
| 151 | * FUNCTION: acpi_ex_trace_point | ||
| 152 | * | ||
| 153 | * PARAMETERS: type - Trace event type | ||
| 154 | * begin - TRUE if before execution | ||
| 155 | * aml - Executed AML address | ||
| 156 | * pathname - Object path | ||
| 157 | * | ||
| 158 | * RETURN: None | ||
| 159 | * | ||
| 160 | * DESCRIPTION: Internal interpreter execution trace. | ||
| 161 | * | ||
| 162 | ******************************************************************************/ | ||
| 163 | |||
| 164 | void | ||
| 165 | acpi_ex_trace_point(acpi_trace_event_type type, | ||
| 166 | u8 begin, u8 *aml, char *pathname) | ||
| 167 | { | ||
| 168 | |||
| 169 | ACPI_FUNCTION_NAME(ex_trace_point); | ||
| 170 | |||
| 171 | if (pathname) { | ||
| 172 | ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, | ||
| 173 | "%s %s [0x%p:%s] execution.\n", | ||
| 174 | acpi_ex_get_trace_event_name(type), | ||
| 175 | begin ? "Begin" : "End", aml, pathname)); | ||
| 176 | } else { | ||
| 177 | ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, | ||
| 178 | "%s %s [0x%p] execution.\n", | ||
| 179 | acpi_ex_get_trace_event_name(type), | ||
| 180 | begin ? "Begin" : "End", aml)); | ||
| 181 | } | ||
| 182 | } | ||
| 183 | |||
| 184 | /******************************************************************************* | ||
| 185 | * | ||
| 186 | * FUNCTION: acpi_ex_start_trace_method | ||
| 187 | * | ||
| 188 | * PARAMETERS: method_node - Node of the method | ||
| 189 | * obj_desc - The method object | ||
| 190 | * walk_state - current state, NULL if not yet executing | ||
| 191 | * a method. | ||
| 192 | * | ||
| 193 | * RETURN: None | ||
| 194 | * | ||
| 195 | * DESCRIPTION: Start control method execution trace | ||
| 196 | * | ||
| 197 | ******************************************************************************/ | ||
| 198 | |||
| 199 | void | ||
| 200 | acpi_ex_start_trace_method(struct acpi_namespace_node *method_node, | ||
| 201 | union acpi_operand_object *obj_desc, | ||
| 202 | struct acpi_walk_state *walk_state) | ||
| 203 | { | ||
| 204 | acpi_status status; | ||
| 205 | char *pathname = NULL; | ||
| 206 | u8 enabled = FALSE; | ||
| 207 | |||
| 208 | ACPI_FUNCTION_NAME(ex_start_trace_method); | ||
| 209 | |||
| 210 | if (method_node) { | ||
| 211 | pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); | ||
| 212 | } | ||
| 213 | |||
| 214 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 215 | if (ACPI_FAILURE(status)) { | ||
| 216 | goto exit; | ||
| 217 | } | ||
| 218 | |||
| 219 | enabled = acpi_ex_interpreter_trace_enabled(pathname); | ||
| 220 | if (enabled && !acpi_gbl_trace_method_object) { | ||
| 221 | acpi_gbl_trace_method_object = obj_desc; | ||
| 222 | acpi_gbl_original_dbg_level = acpi_dbg_level; | ||
| 223 | acpi_gbl_original_dbg_layer = acpi_dbg_layer; | ||
| 224 | acpi_dbg_level = ACPI_TRACE_LEVEL_ALL; | ||
| 225 | acpi_dbg_layer = ACPI_TRACE_LAYER_ALL; | ||
| 226 | |||
| 227 | if (acpi_gbl_trace_dbg_level) { | ||
| 228 | acpi_dbg_level = acpi_gbl_trace_dbg_level; | ||
| 229 | } | ||
| 230 | |||
| 231 | if (acpi_gbl_trace_dbg_layer) { | ||
| 232 | acpi_dbg_layer = acpi_gbl_trace_dbg_layer; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 236 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 237 | |||
| 238 | exit: | ||
| 239 | if (enabled) { | ||
| 240 | ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, TRUE, | ||
| 241 | obj_desc ? obj_desc->method.aml_start : NULL, | ||
| 242 | pathname); | ||
| 243 | } | ||
| 244 | |||
| 245 | if (pathname) { | ||
| 246 | ACPI_FREE(pathname); | ||
| 247 | } | ||
| 248 | } | ||
| 249 | |||
| 250 | /******************************************************************************* | ||
| 251 | * | ||
| 252 | * FUNCTION: acpi_ex_stop_trace_method | ||
| 253 | * | ||
| 254 | * PARAMETERS: method_node - Node of the method | ||
| 255 | * obj_desc - The method object | ||
| 256 | * walk_state - current state, NULL if not yet executing | ||
| 257 | * a method. | ||
| 258 | * | ||
| 259 | * RETURN: None | ||
| 260 | * | ||
| 261 | * DESCRIPTION: Stop control method execution trace | ||
| 262 | * | ||
| 263 | ******************************************************************************/ | ||
| 264 | |||
| 265 | void | ||
| 266 | acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node, | ||
| 267 | union acpi_operand_object *obj_desc, | ||
| 268 | struct acpi_walk_state *walk_state) | ||
| 269 | { | ||
| 270 | acpi_status status; | ||
| 271 | char *pathname = NULL; | ||
| 272 | u8 enabled; | ||
| 273 | |||
| 274 | ACPI_FUNCTION_NAME(ex_stop_trace_method); | ||
| 275 | |||
| 276 | if (method_node) { | ||
| 277 | pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); | ||
| 278 | } | ||
| 279 | |||
| 280 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 281 | if (ACPI_FAILURE(status)) { | ||
| 282 | goto exit_path; | ||
| 283 | } | ||
| 284 | |||
| 285 | enabled = acpi_ex_interpreter_trace_enabled(NULL); | ||
| 286 | |||
| 287 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 288 | |||
| 289 | if (enabled) { | ||
| 290 | ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, FALSE, | ||
| 291 | obj_desc ? obj_desc->method.aml_start : NULL, | ||
| 292 | pathname); | ||
| 293 | } | ||
| 294 | |||
| 295 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 296 | if (ACPI_FAILURE(status)) { | ||
| 297 | goto exit_path; | ||
| 298 | } | ||
| 299 | |||
| 300 | /* Check whether the tracer should be stopped */ | ||
| 301 | |||
| 302 | if (acpi_gbl_trace_method_object == obj_desc) { | ||
| 303 | |||
| 304 | /* Disable further tracing if type is one-shot */ | ||
| 305 | |||
| 306 | if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) { | ||
| 307 | acpi_gbl_trace_method_name = NULL; | ||
| 308 | } | ||
| 309 | |||
| 310 | acpi_dbg_level = acpi_gbl_original_dbg_level; | ||
| 311 | acpi_dbg_layer = acpi_gbl_original_dbg_layer; | ||
| 312 | acpi_gbl_trace_method_object = NULL; | ||
| 313 | } | ||
| 314 | |||
| 315 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 316 | |||
| 317 | exit_path: | ||
| 318 | if (pathname) { | ||
| 319 | ACPI_FREE(pathname); | ||
| 320 | } | ||
| 321 | } | ||
| 322 | |||
| 323 | /******************************************************************************* | ||
| 324 | * | ||
| 325 | * FUNCTION: acpi_ex_start_trace_opcode | ||
| 326 | * | ||
| 327 | * PARAMETERS: op - The parser opcode object | ||
| 328 | * walk_state - current state, NULL if not yet executing | ||
| 329 | * a method. | ||
| 330 | * | ||
| 331 | * RETURN: None | ||
| 332 | * | ||
| 333 | * DESCRIPTION: Start opcode execution trace | ||
| 334 | * | ||
| 335 | ******************************************************************************/ | ||
| 336 | |||
| 337 | void | ||
| 338 | acpi_ex_start_trace_opcode(union acpi_parse_object *op, | ||
| 339 | struct acpi_walk_state *walk_state) | ||
| 340 | { | ||
| 341 | |||
| 342 | ACPI_FUNCTION_NAME(ex_start_trace_opcode); | ||
| 343 | |||
| 344 | if (acpi_ex_interpreter_trace_enabled(NULL) && | ||
| 345 | (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { | ||
| 346 | ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, TRUE, | ||
| 347 | op->common.aml, op->common.aml_op_name); | ||
| 348 | } | ||
| 349 | } | ||
| 350 | |||
| 351 | /******************************************************************************* | ||
| 352 | * | ||
| 353 | * FUNCTION: acpi_ex_stop_trace_opcode | ||
| 354 | * | ||
| 355 | * PARAMETERS: op - The parser opcode object | ||
| 356 | * walk_state - current state, NULL if not yet executing | ||
| 357 | * a method. | ||
| 358 | * | ||
| 359 | * RETURN: None | ||
| 360 | * | ||
| 361 | * DESCRIPTION: Stop opcode execution trace | ||
| 362 | * | ||
| 363 | ******************************************************************************/ | ||
| 364 | |||
| 365 | void | ||
| 366 | acpi_ex_stop_trace_opcode(union acpi_parse_object *op, | ||
| 367 | struct acpi_walk_state *walk_state) | ||
| 368 | { | ||
| 369 | |||
| 370 | ACPI_FUNCTION_NAME(ex_stop_trace_opcode); | ||
| 371 | |||
| 372 | if (acpi_ex_interpreter_trace_enabled(NULL) && | ||
| 373 | (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { | ||
| 374 | ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, FALSE, | ||
| 375 | op->common.aml, op->common.aml_op_name); | ||
| 376 | } | ||
| 377 | } | ||
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 30c3f464fda5..8ae7634bd7d2 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
| @@ -167,8 +167,8 @@ u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
| 167 | if ((acpi_gbl_integer_byte_width == 4) && | 167 | if ((acpi_gbl_integer_byte_width == 4) && |
| 168 | (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) { | 168 | (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) { |
| 169 | /* | 169 | /* |
| 170 | * We are executing in a 32-bit ACPI table. | 170 | * We are executing in a 32-bit ACPI table. Truncate |
| 171 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field | 171 | * the value to 32 bits by zeroing out the upper 32-bit field |
| 172 | */ | 172 | */ |
| 173 | obj_desc->integer.value &= (u64)ACPI_UINT32_MAX; | 173 | obj_desc->integer.value &= (u64)ACPI_UINT32_MAX; |
| 174 | return (TRUE); | 174 | return (TRUE); |
| @@ -323,7 +323,8 @@ void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id) | |||
| 323 | 323 | ||
| 324 | if (compressed_id > ACPI_UINT32_MAX) { | 324 | if (compressed_id > ACPI_UINT32_MAX) { |
| 325 | ACPI_WARNING((AE_INFO, | 325 | ACPI_WARNING((AE_INFO, |
| 326 | "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", | 326 | "Expected EISAID is larger than 32 bits: " |
| 327 | "0x%8.8X%8.8X, truncating", | ||
| 327 | ACPI_FORMAT_UINT64(compressed_id))); | 328 | ACPI_FORMAT_UINT64(compressed_id))); |
| 328 | } | 329 | } |
| 329 | 330 | ||
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c index e5599f610808..d0319a228ef7 100644 --- a/drivers/acpi/acpica/hwesleep.c +++ b/drivers/acpi/acpica/hwesleep.c | |||
| @@ -117,8 +117,8 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) | |||
| 117 | 117 | ||
| 118 | /* Clear wake status (WAK_STS) */ | 118 | /* Clear wake status (WAK_STS) */ |
| 119 | 119 | ||
| 120 | status = | 120 | status = acpi_write((u64)ACPI_X_WAKE_STATUS, |
| 121 | acpi_write((u64)ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); | 121 | &acpi_gbl_FADT.sleep_status); |
| 122 | if (ACPI_FAILURE(status)) { | 122 | if (ACPI_FAILURE(status)) { |
| 123 | return_ACPI_STATUS(status); | 123 | return_ACPI_STATUS(status); |
| 124 | } | 124 | } |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 73cfa5947ff3..8272f966382a 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
| @@ -187,9 +187,8 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
| 187 | */ | 187 | */ |
| 188 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); | 188 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
| 189 | 189 | ||
| 190 | status = acpi_hw_write(register_bit, | 190 | status = |
| 191 | &gpe_register_info->status_address); | 191 | acpi_hw_write(register_bit, &gpe_register_info->status_address); |
| 192 | |||
| 193 | return (status); | 192 | return (status); |
| 194 | } | 193 | } |
| 195 | 194 | ||
| @@ -297,6 +296,7 @@ acpi_hw_gpe_enable_write(u8 enable_mask, | |||
| 297 | acpi_status status; | 296 | acpi_status status; |
| 298 | 297 | ||
| 299 | gpe_register_info->enable_mask = enable_mask; | 298 | gpe_register_info->enable_mask = enable_mask; |
| 299 | |||
| 300 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); | 300 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); |
| 301 | return (status); | 301 | return (status); |
| 302 | } | 302 | } |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 7d21cae6d602..ac5b7f768d4b 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
| @@ -80,8 +80,8 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) | |||
| 80 | 80 | ||
| 81 | /* Clear wake status */ | 81 | /* Clear wake status */ |
| 82 | 82 | ||
| 83 | status = | 83 | status = acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, |
| 84 | acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); | 84 | ACPI_CLEAR_STATUS); |
| 85 | if (ACPI_FAILURE(status)) { | 85 | if (ACPI_FAILURE(status)) { |
| 86 | return_ACPI_STATUS(status); | 86 | return_ACPI_STATUS(status); |
| 87 | } | 87 | } |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index 5f97468df8ff..b2e50d8007fe 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
| @@ -504,11 +504,20 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | |||
| 504 | * Evaluate the \_Sx namespace object containing the register values | 504 | * Evaluate the \_Sx namespace object containing the register values |
| 505 | * for this state | 505 | * for this state |
| 506 | */ | 506 | */ |
| 507 | info->relative_pathname = | 507 | info->relative_pathname = ACPI_CAST_PTR(char, |
| 508 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | 508 | acpi_gbl_sleep_state_names |
| 509 | [sleep_state]); | ||
| 510 | |||
| 509 | status = acpi_ns_evaluate(info); | 511 | status = acpi_ns_evaluate(info); |
| 510 | if (ACPI_FAILURE(status)) { | 512 | if (ACPI_FAILURE(status)) { |
| 511 | goto cleanup; | 513 | if (status == AE_NOT_FOUND) { |
| 514 | |||
| 515 | /* The _Sx states are optional, ignore NOT_FOUND */ | ||
| 516 | |||
| 517 | goto final_cleanup; | ||
| 518 | } | ||
| 519 | |||
| 520 | goto warning_cleanup; | ||
| 512 | } | 521 | } |
| 513 | 522 | ||
| 514 | /* Must have a return object */ | 523 | /* Must have a return object */ |
| @@ -517,7 +526,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | |||
| 517 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | 526 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", |
| 518 | info->relative_pathname)); | 527 | info->relative_pathname)); |
| 519 | status = AE_AML_NO_RETURN_VALUE; | 528 | status = AE_AML_NO_RETURN_VALUE; |
| 520 | goto cleanup; | 529 | goto warning_cleanup; |
| 521 | } | 530 | } |
| 522 | 531 | ||
| 523 | /* Return object must be of type Package */ | 532 | /* Return object must be of type Package */ |
| @@ -526,7 +535,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | |||
| 526 | ACPI_ERROR((AE_INFO, | 535 | ACPI_ERROR((AE_INFO, |
| 527 | "Sleep State return object is not a Package")); | 536 | "Sleep State return object is not a Package")); |
| 528 | status = AE_AML_OPERAND_TYPE; | 537 | status = AE_AML_OPERAND_TYPE; |
| 529 | goto cleanup1; | 538 | goto return_value_cleanup; |
| 530 | } | 539 | } |
| 531 | 540 | ||
| 532 | /* | 541 | /* |
| @@ -570,16 +579,17 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | |||
| 570 | break; | 579 | break; |
| 571 | } | 580 | } |
| 572 | 581 | ||
| 573 | cleanup1: | 582 | return_value_cleanup: |
| 574 | acpi_ut_remove_reference(info->return_object); | 583 | acpi_ut_remove_reference(info->return_object); |
| 575 | 584 | ||
| 576 | cleanup: | 585 | warning_cleanup: |
| 577 | if (ACPI_FAILURE(status)) { | 586 | if (ACPI_FAILURE(status)) { |
| 578 | ACPI_EXCEPTION((AE_INFO, status, | 587 | ACPI_EXCEPTION((AE_INFO, status, |
| 579 | "While evaluating Sleep State [%s]", | 588 | "While evaluating Sleep State [%s]", |
| 580 | info->relative_pathname)); | 589 | info->relative_pathname)); |
| 581 | } | 590 | } |
| 582 | 591 | ||
| 592 | final_cleanup: | ||
| 583 | ACPI_FREE(info); | 593 | ACPI_FREE(info); |
| 584 | return_ACPI_STATUS(status); | 594 | return_ACPI_STATUS(status); |
| 585 | } | 595 | } |
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index d62a61612b3f..1ce4efa1a2bd 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c | |||
| @@ -52,9 +52,9 @@ ACPI_MODULE_NAME("hwxfsleep") | |||
| 52 | /* Local prototypes */ | 52 | /* Local prototypes */ |
| 53 | #if (!ACPI_REDUCED_HARDWARE) | 53 | #if (!ACPI_REDUCED_HARDWARE) |
| 54 | static acpi_status | 54 | static acpi_status |
| 55 | acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, | 55 | acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs, |
| 56 | acpi_physical_address physical_address, | 56 | acpi_physical_address physical_address, |
| 57 | acpi_physical_address physical_address64); | 57 | acpi_physical_address physical_address64); |
| 58 | #endif | 58 | #endif |
| 59 | 59 | ||
| 60 | static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id); | 60 | static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id); |
| @@ -79,22 +79,20 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { | |||
| 79 | 79 | ||
| 80 | /* | 80 | /* |
| 81 | * These functions are removed for the ACPI_REDUCED_HARDWARE case: | 81 | * These functions are removed for the ACPI_REDUCED_HARDWARE case: |
| 82 | * acpi_set_firmware_waking_vectors | ||
| 83 | * acpi_set_firmware_waking_vector | 82 | * acpi_set_firmware_waking_vector |
| 84 | * acpi_set_firmware_waking_vector64 | ||
| 85 | * acpi_enter_sleep_state_s4bios | 83 | * acpi_enter_sleep_state_s4bios |
| 86 | */ | 84 | */ |
| 87 | 85 | ||
| 88 | #if (!ACPI_REDUCED_HARDWARE) | 86 | #if (!ACPI_REDUCED_HARDWARE) |
| 89 | /******************************************************************************* | 87 | /******************************************************************************* |
| 90 | * | 88 | * |
| 91 | * FUNCTION: acpi_hw_set_firmware_waking_vectors | 89 | * FUNCTION: acpi_hw_set_firmware_waking_vector |
| 92 | * | 90 | * |
| 93 | * PARAMETERS: facs - Pointer to FACS table | 91 | * PARAMETERS: facs - Pointer to FACS table |
| 94 | * physical_address - 32-bit physical address of ACPI real mode | 92 | * physical_address - 32-bit physical address of ACPI real mode |
| 95 | * entry point. | 93 | * entry point |
| 96 | * physical_address64 - 64-bit physical address of ACPI protected | 94 | * physical_address64 - 64-bit physical address of ACPI protected |
| 97 | * mode entry point. | 95 | * mode entry point |
| 98 | * | 96 | * |
| 99 | * RETURN: Status | 97 | * RETURN: Status |
| 100 | * | 98 | * |
| @@ -103,11 +101,11 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { | |||
| 103 | ******************************************************************************/ | 101 | ******************************************************************************/ |
| 104 | 102 | ||
| 105 | static acpi_status | 103 | static acpi_status |
| 106 | acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, | 104 | acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs, |
| 107 | acpi_physical_address physical_address, | 105 | acpi_physical_address physical_address, |
| 108 | acpi_physical_address physical_address64) | 106 | acpi_physical_address physical_address64) |
| 109 | { | 107 | { |
| 110 | ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vectors); | 108 | ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vector); |
| 111 | 109 | ||
| 112 | 110 | ||
| 113 | /* | 111 | /* |
| @@ -140,12 +138,12 @@ acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, | |||
| 140 | 138 | ||
| 141 | /******************************************************************************* | 139 | /******************************************************************************* |
| 142 | * | 140 | * |
| 143 | * FUNCTION: acpi_set_firmware_waking_vectors | 141 | * FUNCTION: acpi_set_firmware_waking_vector |
| 144 | * | 142 | * |
| 145 | * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode | 143 | * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode |
| 146 | * entry point. | 144 | * entry point |
| 147 | * physical_address64 - 64-bit physical address of ACPI protected | 145 | * physical_address64 - 64-bit physical address of ACPI protected |
| 148 | * mode entry point. | 146 | * mode entry point |
| 149 | * | 147 | * |
| 150 | * RETURN: Status | 148 | * RETURN: Status |
| 151 | * | 149 | * |
| @@ -154,79 +152,23 @@ acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, | |||
| 154 | ******************************************************************************/ | 152 | ******************************************************************************/ |
| 155 | 153 | ||
| 156 | acpi_status | 154 | acpi_status |
| 157 | acpi_set_firmware_waking_vectors(acpi_physical_address physical_address, | 155 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address, |
| 158 | acpi_physical_address physical_address64) | 156 | acpi_physical_address physical_address64) |
| 159 | { | 157 | { |
| 160 | 158 | ||
| 161 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vectors); | 159 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); |
| 162 | 160 | ||
| 163 | if (acpi_gbl_FACS) { | 161 | if (acpi_gbl_FACS) { |
| 164 | (void)acpi_hw_set_firmware_waking_vectors(acpi_gbl_FACS, | 162 | (void)acpi_hw_set_firmware_waking_vector(acpi_gbl_FACS, |
| 165 | physical_address, | 163 | physical_address, |
| 166 | physical_address64); | 164 | physical_address64); |
| 167 | } | 165 | } |
| 168 | 166 | ||
| 169 | return_ACPI_STATUS(AE_OK); | 167 | return_ACPI_STATUS(AE_OK); |
| 170 | } | 168 | } |
| 171 | 169 | ||
| 172 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vectors) | ||
| 173 | |||
| 174 | /******************************************************************************* | ||
| 175 | * | ||
| 176 | * FUNCTION: acpi_set_firmware_waking_vector | ||
| 177 | * | ||
| 178 | * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode | ||
| 179 | * entry point. | ||
| 180 | * | ||
| 181 | * RETURN: Status | ||
| 182 | * | ||
| 183 | * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS | ||
| 184 | * | ||
| 185 | ******************************************************************************/ | ||
| 186 | acpi_status acpi_set_firmware_waking_vector(u32 physical_address) | ||
| 187 | { | ||
| 188 | acpi_status status; | ||
| 189 | |||
| 190 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); | ||
| 191 | |||
| 192 | status = acpi_set_firmware_waking_vectors((acpi_physical_address) | ||
| 193 | physical_address, 0); | ||
| 194 | |||
| 195 | return_ACPI_STATUS(status); | ||
| 196 | } | ||
| 197 | |||
| 198 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) | 170 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) |
| 199 | 171 | ||
| 200 | #if ACPI_MACHINE_WIDTH == 64 | ||
| 201 | /******************************************************************************* | ||
| 202 | * | ||
| 203 | * FUNCTION: acpi_set_firmware_waking_vector64 | ||
| 204 | * | ||
| 205 | * PARAMETERS: physical_address - 64-bit physical address of ACPI protected | ||
| 206 | * mode entry point. | ||
| 207 | * | ||
| 208 | * RETURN: Status | ||
| 209 | * | ||
| 210 | * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if | ||
| 211 | * it exists in the table. This function is intended for use with | ||
| 212 | * 64-bit host operating systems. | ||
| 213 | * | ||
| 214 | ******************************************************************************/ | ||
| 215 | acpi_status acpi_set_firmware_waking_vector64(u64 physical_address) | ||
| 216 | { | ||
| 217 | acpi_status status; | ||
| 218 | |||
| 219 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); | ||
| 220 | |||
| 221 | status = acpi_set_firmware_waking_vectors(0, | ||
| 222 | (acpi_physical_address) | ||
| 223 | physical_address); | ||
| 224 | |||
| 225 | return_ACPI_STATUS(status); | ||
| 226 | } | ||
| 227 | |||
| 228 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) | ||
| 229 | #endif | ||
| 230 | /******************************************************************************* | 172 | /******************************************************************************* |
| 231 | * | 173 | * |
| 232 | * FUNCTION: acpi_enter_sleep_state_s4bios | 174 | * FUNCTION: acpi_enter_sleep_state_s4bios |
| @@ -286,6 +228,7 @@ acpi_status acpi_enter_sleep_state_s4bios(void) | |||
| 286 | if (ACPI_FAILURE(status)) { | 228 | if (ACPI_FAILURE(status)) { |
| 287 | return_ACPI_STATUS(status); | 229 | return_ACPI_STATUS(status); |
| 288 | } | 230 | } |
| 231 | |||
| 289 | } while (!in_value); | 232 | } while (!in_value); |
| 290 | 233 | ||
| 291 | return_ACPI_STATUS(AE_OK); | 234 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c index da55a1c60da1..f21568ba325b 100644 --- a/drivers/acpi/acpica/nsconvert.c +++ b/drivers/acpi/acpica/nsconvert.c | |||
| @@ -96,9 +96,9 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object, | |||
| 96 | /* Extract each buffer byte to create the integer */ | 96 | /* Extract each buffer byte to create the integer */ |
| 97 | 97 | ||
| 98 | for (i = 0; i < original_object->buffer.length; i++) { | 98 | for (i = 0; i < original_object->buffer.length; i++) { |
| 99 | value |= | 99 | value |= ((u64) |
| 100 | ((u64)original_object->buffer. | 100 | original_object->buffer.pointer[i] << (i * |
| 101 | pointer[i] << (i * 8)); | 101 | 8)); |
| 102 | } | 102 | } |
| 103 | break; | 103 | break; |
| 104 | 104 | ||
| @@ -153,10 +153,9 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object, | |||
| 153 | return (AE_NO_MEMORY); | 153 | return (AE_NO_MEMORY); |
| 154 | } | 154 | } |
| 155 | } else { | 155 | } else { |
| 156 | status = | 156 | status = acpi_ex_convert_to_string(original_object, |
| 157 | acpi_ex_convert_to_string(original_object, | 157 | &new_object, |
| 158 | &new_object, | 158 | ACPI_IMPLICIT_CONVERT_HEX); |
| 159 | ACPI_IMPLICIT_CONVERT_HEX); | ||
| 160 | if (ACPI_FAILURE(status)) { | 159 | if (ACPI_FAILURE(status)) { |
| 161 | return (status); | 160 | return (status); |
| 162 | } | 161 | } |
| @@ -244,9 +243,8 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | |||
| 244 | 243 | ||
| 245 | /* String-to-Buffer conversion. Simple data copy */ | 244 | /* String-to-Buffer conversion. Simple data copy */ |
| 246 | 245 | ||
| 247 | new_object = | 246 | new_object = acpi_ut_create_buffer_object |
| 248 | acpi_ut_create_buffer_object(original_object->string. | 247 | (original_object->string.length); |
| 249 | length); | ||
| 250 | if (!new_object) { | 248 | if (!new_object) { |
| 251 | return (AE_NO_MEMORY); | 249 | return (AE_NO_MEMORY); |
| 252 | } | 250 | } |
| @@ -308,7 +306,8 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | |||
| 308 | * | 306 | * |
| 309 | * FUNCTION: acpi_ns_convert_to_unicode | 307 | * FUNCTION: acpi_ns_convert_to_unicode |
| 310 | * | 308 | * |
| 311 | * PARAMETERS: original_object - ASCII String Object to be converted | 309 | * PARAMETERS: scope - Namespace node for the method/object |
| 310 | * original_object - ASCII String Object to be converted | ||
| 312 | * return_object - Where the new converted object is returned | 311 | * return_object - Where the new converted object is returned |
| 313 | * | 312 | * |
| 314 | * RETURN: Status. AE_OK if conversion was successful. | 313 | * RETURN: Status. AE_OK if conversion was successful. |
| @@ -318,7 +317,8 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | |||
| 318 | ******************************************************************************/ | 317 | ******************************************************************************/ |
| 319 | 318 | ||
| 320 | acpi_status | 319 | acpi_status |
| 321 | acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, | 320 | acpi_ns_convert_to_unicode(struct acpi_namespace_node * scope, |
| 321 | union acpi_operand_object *original_object, | ||
| 322 | union acpi_operand_object **return_object) | 322 | union acpi_operand_object **return_object) |
| 323 | { | 323 | { |
| 324 | union acpi_operand_object *new_object; | 324 | union acpi_operand_object *new_object; |
| @@ -372,7 +372,8 @@ acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, | |||
| 372 | * | 372 | * |
| 373 | * FUNCTION: acpi_ns_convert_to_resource | 373 | * FUNCTION: acpi_ns_convert_to_resource |
| 374 | * | 374 | * |
| 375 | * PARAMETERS: original_object - Object to be converted | 375 | * PARAMETERS: scope - Namespace node for the method/object |
| 376 | * original_object - Object to be converted | ||
| 376 | * return_object - Where the new converted object is returned | 377 | * return_object - Where the new converted object is returned |
| 377 | * | 378 | * |
| 378 | * RETURN: Status. AE_OK if conversion was successful | 379 | * RETURN: Status. AE_OK if conversion was successful |
| @@ -383,7 +384,8 @@ acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, | |||
| 383 | ******************************************************************************/ | 384 | ******************************************************************************/ |
| 384 | 385 | ||
| 385 | acpi_status | 386 | acpi_status |
| 386 | acpi_ns_convert_to_resource(union acpi_operand_object *original_object, | 387 | acpi_ns_convert_to_resource(struct acpi_namespace_node * scope, |
| 388 | union acpi_operand_object *original_object, | ||
| 387 | union acpi_operand_object **return_object) | 389 | union acpi_operand_object **return_object) |
| 388 | { | 390 | { |
| 389 | union acpi_operand_object *new_object; | 391 | union acpi_operand_object *new_object; |
| @@ -444,3 +446,78 @@ acpi_ns_convert_to_resource(union acpi_operand_object *original_object, | |||
| 444 | *return_object = new_object; | 446 | *return_object = new_object; |
| 445 | return (AE_OK); | 447 | return (AE_OK); |
| 446 | } | 448 | } |
| 449 | |||
| 450 | /******************************************************************************* | ||
| 451 | * | ||
| 452 | * FUNCTION: acpi_ns_convert_to_reference | ||
| 453 | * | ||
| 454 | * PARAMETERS: scope - Namespace node for the method/object | ||
| 455 | * original_object - Object to be converted | ||
| 456 | * return_object - Where the new converted object is returned | ||
| 457 | * | ||
| 458 | * RETURN: Status. AE_OK if conversion was successful | ||
| 459 | * | ||
| 460 | * DESCRIPTION: Attempt to convert a Integer object to a object_reference. | ||
| 461 | * Buffer. | ||
| 462 | * | ||
| 463 | ******************************************************************************/ | ||
| 464 | |||
| 465 | acpi_status | ||
| 466 | acpi_ns_convert_to_reference(struct acpi_namespace_node * scope, | ||
| 467 | union acpi_operand_object *original_object, | ||
| 468 | union acpi_operand_object **return_object) | ||
| 469 | { | ||
| 470 | union acpi_operand_object *new_object = NULL; | ||
| 471 | acpi_status status; | ||
| 472 | struct acpi_namespace_node *node; | ||
| 473 | union acpi_generic_state scope_info; | ||
| 474 | char *name; | ||
| 475 | |||
| 476 | ACPI_FUNCTION_NAME(ns_convert_to_reference); | ||
| 477 | |||
| 478 | /* Convert path into internal presentation */ | ||
| 479 | |||
| 480 | status = | ||
| 481 | acpi_ns_internalize_name(original_object->string.pointer, &name); | ||
| 482 | if (ACPI_FAILURE(status)) { | ||
| 483 | return_ACPI_STATUS(status); | ||
| 484 | } | ||
| 485 | |||
| 486 | /* Find the namespace node */ | ||
| 487 | |||
| 488 | scope_info.scope.node = | ||
| 489 | ACPI_CAST_PTR(struct acpi_namespace_node, scope); | ||
| 490 | status = | ||
| 491 | acpi_ns_lookup(&scope_info, name, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | ||
| 492 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | ||
| 493 | NULL, &node); | ||
| 494 | if (ACPI_FAILURE(status)) { | ||
| 495 | |||
| 496 | /* Check if we are resolving a named reference within a package */ | ||
| 497 | |||
| 498 | ACPI_ERROR_NAMESPACE(original_object->string.pointer, status); | ||
| 499 | goto error_exit; | ||
| 500 | } | ||
| 501 | |||
| 502 | /* Create and init a new internal ACPI object */ | ||
| 503 | |||
| 504 | new_object = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); | ||
| 505 | if (!new_object) { | ||
| 506 | status = AE_NO_MEMORY; | ||
| 507 | goto error_exit; | ||
| 508 | } | ||
| 509 | new_object->reference.node = node; | ||
| 510 | new_object->reference.object = node->object; | ||
| 511 | new_object->reference.class = ACPI_REFCLASS_NAME; | ||
| 512 | |||
| 513 | /* | ||
| 514 | * Increase reference of the object if needed (the object is likely a | ||
| 515 | * null for device nodes). | ||
| 516 | */ | ||
| 517 | acpi_ut_add_reference(node->object); | ||
| 518 | |||
| 519 | error_exit: | ||
| 520 | ACPI_FREE(name); | ||
| 521 | *return_object = new_object; | ||
| 522 | return (AE_OK); | ||
| 523 | } | ||
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 37aa5c45ca4b..bc5ff358b2a7 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
| @@ -539,11 +539,13 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
| 539 | acpi_os_printf | 539 | acpi_os_printf |
| 540 | ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", | 540 | ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", |
| 541 | obj_type); | 541 | obj_type); |
| 542 | |||
| 542 | bytes_to_dump = 32; | 543 | bytes_to_dump = 32; |
| 543 | } else { | 544 | } else { |
| 544 | acpi_os_printf | 545 | acpi_os_printf |
| 545 | ("(Pointer to ACPI Object type %.2X [%s])\n", | 546 | ("(Pointer to ACPI Object type %.2X [%s])\n", |
| 546 | obj_type, acpi_ut_get_type_name(obj_type)); | 547 | obj_type, acpi_ut_get_type_name(obj_type)); |
| 548 | |||
| 547 | bytes_to_dump = | 549 | bytes_to_dump = |
| 548 | sizeof(union acpi_operand_object); | 550 | sizeof(union acpi_operand_object); |
| 549 | } | 551 | } |
| @@ -573,6 +575,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
| 573 | */ | 575 | */ |
| 574 | bytes_to_dump = obj_desc->string.length; | 576 | bytes_to_dump = obj_desc->string.length; |
| 575 | obj_desc = (void *)obj_desc->string.pointer; | 577 | obj_desc = (void *)obj_desc->string.pointer; |
| 578 | |||
| 576 | acpi_os_printf("(Buffer/String pointer %p length %X)\n", | 579 | acpi_os_printf("(Buffer/String pointer %p length %X)\n", |
| 577 | obj_desc, bytes_to_dump); | 580 | obj_desc, bytes_to_dump); |
| 578 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); | 581 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
| @@ -717,7 +720,7 @@ acpi_ns_dump_one_object_path(acpi_handle obj_handle, | |||
| 717 | return (AE_OK); | 720 | return (AE_OK); |
| 718 | } | 721 | } |
| 719 | 722 | ||
| 720 | pathname = acpi_ns_get_external_pathname(node); | 723 | pathname = acpi_ns_get_normalized_pathname(node, TRUE); |
| 721 | 724 | ||
| 722 | path_indent = 1; | 725 | path_indent = 1; |
| 723 | if (level <= max_level) { | 726 | if (level <= max_level) { |
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index 7eba578d36f3..15e0b2ec5d65 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c | |||
| @@ -135,7 +135,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |||
| 135 | 135 | ||
| 136 | /* Get the full pathname to the object, for use in warning messages */ | 136 | /* Get the full pathname to the object, for use in warning messages */ |
| 137 | 137 | ||
| 138 | info->full_pathname = acpi_ns_get_external_pathname(info->node); | 138 | info->full_pathname = acpi_ns_get_normalized_pathname(info->node, TRUE); |
| 139 | if (!info->full_pathname) { | 139 | if (!info->full_pathname) { |
| 140 | return_ACPI_STATUS(AE_NO_MEMORY); | 140 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 141 | } | 141 | } |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index b744a53618eb..ac59929c3ee9 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
| @@ -582,7 +582,8 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
| 582 | 582 | ||
| 583 | /* Ignore error and move on to next device */ | 583 | /* Ignore error and move on to next device */ |
| 584 | 584 | ||
| 585 | char *scope_name = acpi_ns_get_external_pathname(info->node); | 585 | char *scope_name = |
| 586 | acpi_ns_get_normalized_pathname(device_node, TRUE); | ||
| 586 | 587 | ||
| 587 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", | 588 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", |
| 588 | scope_name)); | 589 | scope_name)); |
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index 14ab83668207..14c953e6fe9e 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
| @@ -149,6 +149,23 @@ unlock: | |||
| 149 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 149 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 150 | "**** Completed Table Object Initialization\n")); | 150 | "**** Completed Table Object Initialization\n")); |
| 151 | 151 | ||
| 152 | /* | ||
| 153 | * Execute any module-level code that was detected during the table load | ||
| 154 | * phase. Although illegal since ACPI 2.0, there are many machines that | ||
| 155 | * contain this type of code. Each block of detected executable AML code | ||
| 156 | * outside of any control method is wrapped with a temporary control | ||
| 157 | * method object and placed on a global list. The methods on this list | ||
| 158 | * are executed below. | ||
| 159 | * | ||
| 160 | * This case executes the module-level code for each table immediately | ||
| 161 | * after the table has been loaded. This provides compatibility with | ||
| 162 | * other ACPI implementations. Optionally, the execution can be deferred | ||
| 163 | * until later, see acpi_initialize_objects. | ||
| 164 | */ | ||
| 165 | if (!acpi_gbl_group_module_level_code) { | ||
| 166 | acpi_ns_exec_module_code_list(); | ||
| 167 | } | ||
| 168 | |||
| 152 | return_ACPI_STATUS(status); | 169 | return_ACPI_STATUS(status); |
| 153 | } | 170 | } |
| 154 | 171 | ||
| @@ -321,7 +338,6 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle) | |||
| 321 | /* This function does the real work */ | 338 | /* This function does the real work */ |
| 322 | 339 | ||
| 323 | status = acpi_ns_delete_subtree(handle); | 340 | status = acpi_ns_delete_subtree(handle); |
| 324 | |||
| 325 | return_ACPI_STATUS(status); | 341 | return_ACPI_STATUS(status); |
| 326 | } | 342 | } |
| 327 | #endif | 343 | #endif |
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 8934b4eddb73..521031f9b6c6 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
| @@ -70,7 +70,6 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
| 70 | ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); | 70 | ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); |
| 71 | 71 | ||
| 72 | name_buffer = acpi_ns_get_normalized_pathname(node, FALSE); | 72 | name_buffer = acpi_ns_get_normalized_pathname(node, FALSE); |
| 73 | |||
| 74 | return_PTR(name_buffer); | 73 | return_PTR(name_buffer); |
| 75 | } | 74 | } |
| 76 | 75 | ||
| @@ -93,7 +92,6 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) | |||
| 93 | ACPI_FUNCTION_ENTRY(); | 92 | ACPI_FUNCTION_ENTRY(); |
| 94 | 93 | ||
| 95 | size = acpi_ns_build_normalized_path(node, NULL, 0, FALSE); | 94 | size = acpi_ns_build_normalized_path(node, NULL, 0, FALSE); |
| 96 | |||
| 97 | return (size); | 95 | return (size); |
| 98 | } | 96 | } |
| 99 | 97 | ||
| @@ -217,6 +215,7 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, | |||
| 217 | ACPI_PATH_PUT8(full_path, path_size, | 215 | ACPI_PATH_PUT8(full_path, path_size, |
| 218 | AML_DUAL_NAME_PREFIX, length); | 216 | AML_DUAL_NAME_PREFIX, length); |
| 219 | } | 217 | } |
| 218 | |||
| 220 | ACPI_MOVE_32_TO_32(name, &next_node->name); | 219 | ACPI_MOVE_32_TO_32(name, &next_node->name); |
| 221 | do_no_trailing = no_trailing; | 220 | do_no_trailing = no_trailing; |
| 222 | for (i = 0; i < 4; i++) { | 221 | for (i = 0; i < 4; i++) { |
| @@ -228,8 +227,10 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, | |||
| 228 | ACPI_PATH_PUT8(full_path, path_size, c, length); | 227 | ACPI_PATH_PUT8(full_path, path_size, c, length); |
| 229 | } | 228 | } |
| 230 | } | 229 | } |
| 230 | |||
| 231 | next_node = next_node->parent; | 231 | next_node = next_node->parent; |
| 232 | } | 232 | } |
| 233 | |||
| 233 | ACPI_PATH_PUT8(full_path, path_size, AML_ROOT_PREFIX, length); | 234 | ACPI_PATH_PUT8(full_path, path_size, AML_ROOT_PREFIX, length); |
| 234 | 235 | ||
| 235 | /* Reverse the path string */ | 236 | /* Reverse the path string */ |
| @@ -237,6 +238,7 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, | |||
| 237 | if (length <= path_size) { | 238 | if (length <= path_size) { |
| 238 | left = full_path; | 239 | left = full_path; |
| 239 | right = full_path + length - 1; | 240 | right = full_path + length - 1; |
| 241 | |||
| 240 | while (left < right) { | 242 | while (left < right) { |
| 241 | c = *left; | 243 | c = *left; |
| 242 | *left++ = *right; | 244 | *left++ = *right; |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 3736d43b18b9..43b45a8c2fe4 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
| @@ -141,8 +141,8 @@ acpi_ns_one_complete_parse(u32 pass_number, | |||
| 141 | 141 | ||
| 142 | /* Parse the AML */ | 142 | /* Parse the AML */ |
| 143 | 143 | ||
| 144 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", | 144 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
| 145 | pass_number)); | 145 | "*PARSE* pass %u parse\n", pass_number)); |
| 146 | status = acpi_ps_parse_aml(walk_state); | 146 | status = acpi_ps_parse_aml(walk_state); |
| 147 | 147 | ||
| 148 | cleanup: | 148 | cleanup: |
| @@ -181,6 +181,7 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) | |||
| 181 | * performs another complete parse of the AML. | 181 | * performs another complete parse of the AML. |
| 182 | */ | 182 | */ |
| 183 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); | 183 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); |
| 184 | |||
| 184 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, | 185 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, |
| 185 | table_index, start_node); | 186 | table_index, start_node); |
| 186 | if (ACPI_FAILURE(status)) { | 187 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index 9bb251932b45..c05a83be5c11 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c | |||
| @@ -233,8 +233,9 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 233 | 233 | ||
| 234 | /* First element is the (Integer) revision */ | 234 | /* First element is the (Integer) revision */ |
| 235 | 235 | ||
| 236 | status = acpi_ns_check_object_type(info, elements, | 236 | status = |
| 237 | ACPI_RTYPE_INTEGER, 0); | 237 | acpi_ns_check_object_type(info, elements, |
| 238 | ACPI_RTYPE_INTEGER, 0); | ||
| 238 | if (ACPI_FAILURE(status)) { | 239 | if (ACPI_FAILURE(status)) { |
| 239 | return (status); | 240 | return (status); |
| 240 | } | 241 | } |
| @@ -252,8 +253,9 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 252 | 253 | ||
| 253 | /* First element is the (Integer) count of subpackages to follow */ | 254 | /* First element is the (Integer) count of subpackages to follow */ |
| 254 | 255 | ||
| 255 | status = acpi_ns_check_object_type(info, elements, | 256 | status = |
| 256 | ACPI_RTYPE_INTEGER, 0); | 257 | acpi_ns_check_object_type(info, elements, |
| 258 | ACPI_RTYPE_INTEGER, 0); | ||
| 257 | if (ACPI_FAILURE(status)) { | 259 | if (ACPI_FAILURE(status)) { |
| 258 | return (status); | 260 | return (status); |
| 259 | } | 261 | } |
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index 77d8103d0094..6418863f93d5 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
| @@ -116,6 +116,11 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = { | |||
| 116 | ACPI_NOT_PACKAGE_ELEMENT, | 116 | ACPI_NOT_PACKAGE_ELEMENT, |
| 117 | acpi_ns_convert_to_resource}, | 117 | acpi_ns_convert_to_resource}, |
| 118 | 118 | ||
| 119 | /* Object reference conversions */ | ||
| 120 | |||
| 121 | {"_DEP", ACPI_RTYPE_STRING, ACPI_ALL_PACKAGE_ELEMENTS, | ||
| 122 | acpi_ns_convert_to_reference}, | ||
| 123 | |||
| 119 | /* Unicode conversions */ | 124 | /* Unicode conversions */ |
| 120 | 125 | ||
| 121 | {"_MLS", ACPI_RTYPE_STRING, 1, | 126 | {"_MLS", ACPI_RTYPE_STRING, 1, |
| @@ -172,8 +177,8 @@ acpi_ns_simple_repair(struct acpi_evaluate_info *info, | |||
| 172 | "Missing expected return value")); | 177 | "Missing expected return value")); |
| 173 | } | 178 | } |
| 174 | 179 | ||
| 175 | status = | 180 | status = predefined->object_converter(info->node, return_object, |
| 176 | predefined->object_converter(return_object, &new_object); | 181 | &new_object); |
| 177 | if (ACPI_FAILURE(status)) { | 182 | if (ACPI_FAILURE(status)) { |
| 178 | 183 | ||
| 179 | /* A fatal error occurred during a conversion */ | 184 | /* A fatal error occurred during a conversion */ |
| @@ -360,12 +365,15 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct | |||
| 360 | /* Check if we can actually repair this name/type combination */ | 365 | /* Check if we can actually repair this name/type combination */ |
| 361 | 366 | ||
| 362 | if ((return_btype & this_name->unexpected_btypes) && | 367 | if ((return_btype & this_name->unexpected_btypes) && |
| 363 | (package_index == this_name->package_index)) { | 368 | (this_name->package_index == |
| 369 | ACPI_ALL_PACKAGE_ELEMENTS | ||
| 370 | || package_index == this_name->package_index)) { | ||
| 364 | return (this_name); | 371 | return (this_name); |
| 365 | } | 372 | } |
| 366 | 373 | ||
| 367 | return (NULL); | 374 | return (NULL); |
| 368 | } | 375 | } |
| 376 | |||
| 369 | this_name++; | 377 | this_name++; |
| 370 | } | 378 | } |
| 371 | 379 | ||
| @@ -521,6 +529,7 @@ acpi_ns_remove_null_elements(struct acpi_evaluate_info *info, | |||
| 521 | *dest = *source; | 529 | *dest = *source; |
| 522 | dest++; | 530 | dest++; |
| 523 | } | 531 | } |
| 532 | |||
| 524 | source++; | 533 | source++; |
| 525 | } | 534 | } |
| 526 | 535 | ||
| @@ -572,8 +581,8 @@ acpi_ns_wrap_with_package(struct acpi_evaluate_info *info, | |||
| 572 | ACPI_FUNCTION_NAME(ns_wrap_with_package); | 581 | ACPI_FUNCTION_NAME(ns_wrap_with_package); |
| 573 | 582 | ||
| 574 | /* | 583 | /* |
| 575 | * Create the new outer package and populate it. The new package will | 584 | * Create the new outer package and populate it. The new |
| 576 | * have a single element, the lone sub-object. | 585 | * package will have a single element, the lone sub-object. |
| 577 | */ | 586 | */ |
| 578 | pkg_obj_desc = acpi_ut_create_package_object(1); | 587 | pkg_obj_desc = acpi_ut_create_package_object(1); |
| 579 | if (!pkg_obj_desc) { | 588 | if (!pkg_obj_desc) { |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 0515a70f42a4..f6dd2a83ea63 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
| @@ -225,6 +225,7 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct | |||
| 225 | if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) { | 225 | if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) { |
| 226 | return (this_name); | 226 | return (this_name); |
| 227 | } | 227 | } |
| 228 | |||
| 228 | this_name++; | 229 | this_name++; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| @@ -301,7 +302,8 @@ acpi_ns_repair_FDE(struct acpi_evaluate_info *info, | |||
| 301 | /* We can only repair if we have exactly 5 BYTEs */ | 302 | /* We can only repair if we have exactly 5 BYTEs */ |
| 302 | 303 | ||
| 303 | if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) { | 304 | if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) { |
| 304 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, | 305 | ACPI_WARN_PREDEFINED((AE_INFO, |
| 306 | info->full_pathname, | ||
| 305 | info->node_flags, | 307 | info->node_flags, |
| 306 | "Incorrect return buffer length %u, expected %u", | 308 | "Incorrect return buffer length %u, expected %u", |
| 307 | return_object->buffer.length, | 309 | return_object->buffer.length, |
| @@ -321,8 +323,8 @@ acpi_ns_repair_FDE(struct acpi_evaluate_info *info, | |||
| 321 | /* Expand each byte to a DWORD */ | 323 | /* Expand each byte to a DWORD */ |
| 322 | 324 | ||
| 323 | byte_buffer = return_object->buffer.pointer; | 325 | byte_buffer = return_object->buffer.pointer; |
| 324 | dword_buffer = | 326 | dword_buffer = ACPI_CAST_PTR(u32, |
| 325 | ACPI_CAST_PTR(u32, buffer_object->buffer.pointer); | 327 | buffer_object->buffer.pointer); |
| 326 | 328 | ||
| 327 | for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) { | 329 | for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) { |
| 328 | *dword_buffer = (u32) *byte_buffer; | 330 | *dword_buffer = (u32) *byte_buffer; |
| @@ -461,7 +463,8 @@ acpi_ns_repair_CST(struct acpi_evaluate_info *info, | |||
| 461 | removing = FALSE; | 463 | removing = FALSE; |
| 462 | 464 | ||
| 463 | if ((*outer_elements)->package.count == 0) { | 465 | if ((*outer_elements)->package.count == 0) { |
| 464 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, | 466 | ACPI_WARN_PREDEFINED((AE_INFO, |
| 467 | info->full_pathname, | ||
| 465 | info->node_flags, | 468 | info->node_flags, |
| 466 | "SubPackage[%u] - removing entry due to zero count", | 469 | "SubPackage[%u] - removing entry due to zero count", |
| 467 | i)); | 470 | i)); |
| @@ -471,7 +474,8 @@ acpi_ns_repair_CST(struct acpi_evaluate_info *info, | |||
| 471 | 474 | ||
| 472 | obj_desc = (*outer_elements)->package.elements[1]; /* Index1 = Type */ | 475 | obj_desc = (*outer_elements)->package.elements[1]; /* Index1 = Type */ |
| 473 | if ((u32)obj_desc->integer.value == 0) { | 476 | if ((u32)obj_desc->integer.value == 0) { |
| 474 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, | 477 | ACPI_WARN_PREDEFINED((AE_INFO, |
| 478 | info->full_pathname, | ||
| 475 | info->node_flags, | 479 | info->node_flags, |
| 476 | "SubPackage[%u] - removing entry due to invalid Type(0)", | 480 | "SubPackage[%u] - removing entry due to invalid Type(0)", |
| 477 | i)); | 481 | i)); |
| @@ -538,8 +542,8 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, | |||
| 538 | } | 542 | } |
| 539 | 543 | ||
| 540 | if (return_object->string.length == 0) { | 544 | if (return_object->string.length == 0) { |
| 541 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, | 545 | ACPI_WARN_PREDEFINED((AE_INFO, |
| 542 | info->node_flags, | 546 | info->full_pathname, info->node_flags, |
| 543 | "Invalid zero-length _HID or _CID string")); | 547 | "Invalid zero-length _HID or _CID string")); |
| 544 | 548 | ||
| 545 | /* Return AE_OK anyway, let driver handle it */ | 549 | /* Return AE_OK anyway, let driver handle it */ |
| @@ -710,8 +714,9 @@ acpi_ns_repair_PSS(struct acpi_evaluate_info *info, | |||
| 710 | elements = (*outer_elements)->package.elements; | 714 | elements = (*outer_elements)->package.elements; |
| 711 | obj_desc = elements[1]; /* Index1 = power_dissipation */ | 715 | obj_desc = elements[1]; /* Index1 = power_dissipation */ |
| 712 | 716 | ||
| 713 | if ((u32) obj_desc->integer.value > previous_value) { | 717 | if ((u32)obj_desc->integer.value > previous_value) { |
| 714 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, | 718 | ACPI_WARN_PREDEFINED((AE_INFO, |
| 719 | info->full_pathname, | ||
| 715 | info->node_flags, | 720 | info->node_flags, |
| 716 | "SubPackage[%u,%u] - suspicious power dissipation values", | 721 | "SubPackage[%u,%u] - suspicious power dissipation values", |
| 717 | i - 1, i)); | 722 | i - 1, i)); |
| @@ -969,6 +974,7 @@ acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index) | |||
| 969 | *dest = *source; | 974 | *dest = *source; |
| 970 | dest++; | 975 | dest++; |
| 971 | } | 976 | } |
| 977 | |||
| 972 | source++; | 978 | source++; |
| 973 | } | 979 | } |
| 974 | 980 | ||
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index d73904013830..9cc3564de37e 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
| @@ -105,7 +105,7 @@ acpi_ns_search_one_scope(u32 target_name, | |||
| 105 | if (ACPI_LV_NAMES & acpi_dbg_level) { | 105 | if (ACPI_LV_NAMES & acpi_dbg_level) { |
| 106 | char *scope_name; | 106 | char *scope_name; |
| 107 | 107 | ||
| 108 | scope_name = acpi_ns_get_external_pathname(parent_node); | 108 | scope_name = acpi_ns_get_normalized_pathname(parent_node, TRUE); |
| 109 | if (scope_name) { | 109 | if (scope_name) { |
| 110 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 110 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
| 111 | "Searching %s (%p) For [%4.4s] (%s)\n", | 111 | "Searching %s (%p) For [%4.4s] (%s)\n", |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index de325ae04ce1..32f1d956eb7f 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
| @@ -173,9 +173,10 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) | |||
| 173 | info->fully_qualified = FALSE; | 173 | info->fully_qualified = FALSE; |
| 174 | 174 | ||
| 175 | /* | 175 | /* |
| 176 | * For the internal name, the required length is 4 bytes per segment, plus | 176 | * For the internal name, the required length is 4 bytes per segment, |
| 177 | * 1 each for root_prefix, multi_name_prefix_op, segment count, trailing null | 177 | * plus 1 each for root_prefix, multi_name_prefix_op, segment count, |
| 178 | * (which is not really needed, but no there's harm in putting it there) | 178 | * trailing null (which is not really needed, but no there's harm in |
| 179 | * putting it there) | ||
| 179 | * | 180 | * |
| 180 | * strlen() + 1 covers the first name_seg, which has no path separator | 181 | * strlen() + 1 covers the first name_seg, which has no path separator |
| 181 | */ | 182 | */ |
| @@ -699,6 +700,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | |||
| 699 | if (!prefix_node) { | 700 | if (!prefix_node) { |
| 700 | *return_node = acpi_gbl_root_node; | 701 | *return_node = acpi_gbl_root_node; |
| 701 | } | 702 | } |
| 703 | |||
| 702 | return_ACPI_STATUS(AE_OK); | 704 | return_ACPI_STATUS(AE_OK); |
| 703 | } | 705 | } |
| 704 | 706 | ||
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index 6ee1e52b903d..429f0d27bef0 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
| @@ -750,8 +750,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
| 750 | 750 | ||
| 751 | /* We have a valid device, invoke the user function */ | 751 | /* We have a valid device, invoke the user function */ |
| 752 | 752 | ||
| 753 | status = info->user_function(obj_handle, nesting_level, info->context, | 753 | status = info->user_function(obj_handle, nesting_level, |
| 754 | return_value); | 754 | info->context, return_value); |
| 755 | return (status); | 755 | return (status); |
| 756 | } | 756 | } |
| 757 | 757 | ||
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index 4b4d2f43d406..669e0f1b0967 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
| @@ -159,7 +159,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
| 159 | { | 159 | { |
| 160 | acpi_status status; | 160 | acpi_status status; |
| 161 | struct acpi_namespace_node *node; | 161 | struct acpi_namespace_node *node; |
| 162 | char *node_name; | 162 | const char *node_name; |
| 163 | 163 | ||
| 164 | /* Parameter validation */ | 164 | /* Parameter validation */ |
| 165 | 165 | ||
| @@ -238,7 +238,6 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, | |||
| 238 | struct acpi_pnp_device_id *source, | 238 | struct acpi_pnp_device_id *source, |
| 239 | char *string_area) | 239 | char *string_area) |
| 240 | { | 240 | { |
| 241 | |||
| 242 | /* Create the destination PNP_DEVICE_ID */ | 241 | /* Create the destination PNP_DEVICE_ID */ |
| 243 | 242 | ||
| 244 | dest->string = string_area; | 243 | dest->string = string_area; |
| @@ -263,11 +262,18 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, | |||
| 263 | * namespace node and possibly by running several standard | 262 | * namespace node and possibly by running several standard |
| 264 | * control methods (Such as in the case of a device.) | 263 | * control methods (Such as in the case of a device.) |
| 265 | * | 264 | * |
| 266 | * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, | 265 | * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, |
| 267 | * _CLS, _STA, _ADR, _sx_w, and _sx_d methods. | 266 | * _CLS, _ADR, _sx_w, and _sx_d methods. |
| 268 | * | 267 | * |
| 269 | * Note: Allocates the return buffer, must be freed by the caller. | 268 | * Note: Allocates the return buffer, must be freed by the caller. |
| 270 | * | 269 | * |
| 270 | * Note: This interface is intended to be used during the initial device | ||
| 271 | * discovery namespace traversal. Therefore, no complex methods can be | ||
| 272 | * executed, especially those that access operation regions. Therefore, do | ||
| 273 | * not add any additional methods that could cause problems in this area. | ||
| 274 | * this was the fate of the _SUB method which was found to cause such | ||
| 275 | * problems and was removed (11/2015). | ||
| 276 | * | ||
| 271 | ******************************************************************************/ | 277 | ******************************************************************************/ |
| 272 | 278 | ||
| 273 | acpi_status | 279 | acpi_status |
| @@ -279,7 +285,6 @@ acpi_get_object_info(acpi_handle handle, | |||
| 279 | struct acpi_pnp_device_id_list *cid_list = NULL; | 285 | struct acpi_pnp_device_id_list *cid_list = NULL; |
| 280 | struct acpi_pnp_device_id *hid = NULL; | 286 | struct acpi_pnp_device_id *hid = NULL; |
| 281 | struct acpi_pnp_device_id *uid = NULL; | 287 | struct acpi_pnp_device_id *uid = NULL; |
| 282 | struct acpi_pnp_device_id *sub = NULL; | ||
| 283 | struct acpi_pnp_device_id *cls = NULL; | 288 | struct acpi_pnp_device_id *cls = NULL; |
| 284 | char *next_id_string; | 289 | char *next_id_string; |
| 285 | acpi_object_type type; | 290 | acpi_object_type type; |
| @@ -325,7 +330,7 @@ acpi_get_object_info(acpi_handle handle, | |||
| 325 | if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { | 330 | if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { |
| 326 | /* | 331 | /* |
| 327 | * Get extra info for ACPI Device/Processor objects only: | 332 | * Get extra info for ACPI Device/Processor objects only: |
| 328 | * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. | 333 | * Run the Device _HID, _UID, _CLS, and _CID methods. |
| 329 | * | 334 | * |
| 330 | * Note: none of these methods are required, so they may or may | 335 | * Note: none of these methods are required, so they may or may |
| 331 | * not be present for this device. The Info->Valid bitfield is used | 336 | * not be present for this device. The Info->Valid bitfield is used |
| @@ -348,14 +353,6 @@ acpi_get_object_info(acpi_handle handle, | |||
| 348 | valid |= ACPI_VALID_UID; | 353 | valid |= ACPI_VALID_UID; |
| 349 | } | 354 | } |
| 350 | 355 | ||
| 351 | /* Execute the Device._SUB method */ | ||
| 352 | |||
| 353 | status = acpi_ut_execute_SUB(node, &sub); | ||
| 354 | if (ACPI_SUCCESS(status)) { | ||
| 355 | info_size += sub->length; | ||
| 356 | valid |= ACPI_VALID_SUB; | ||
| 357 | } | ||
| 358 | |||
| 359 | /* Execute the Device._CID method */ | 356 | /* Execute the Device._CID method */ |
| 360 | 357 | ||
| 361 | status = acpi_ut_execute_CID(node, &cid_list); | 358 | status = acpi_ut_execute_CID(node, &cid_list); |
| @@ -456,9 +453,8 @@ acpi_get_object_info(acpi_handle handle, | |||
| 456 | } | 453 | } |
| 457 | 454 | ||
| 458 | /* | 455 | /* |
| 459 | * Copy the HID, UID, SUB, and CIDs to the return buffer. | 456 | * Copy the HID, UID, and CIDs to the return buffer. The variable-length |
| 460 | * The variable-length strings are copied to the reserved area | 457 | * strings are copied to the reserved area at the end of the buffer. |
| 461 | * at the end of the buffer. | ||
| 462 | * | 458 | * |
| 463 | * For HID and CID, check if the ID is a PCI Root Bridge. | 459 | * For HID and CID, check if the ID is a PCI Root Bridge. |
| 464 | */ | 460 | */ |
| @@ -476,11 +472,6 @@ acpi_get_object_info(acpi_handle handle, | |||
| 476 | uid, next_id_string); | 472 | uid, next_id_string); |
| 477 | } | 473 | } |
| 478 | 474 | ||
| 479 | if (sub) { | ||
| 480 | next_id_string = acpi_ns_copy_device_id(&info->subsystem_id, | ||
| 481 | sub, next_id_string); | ||
| 482 | } | ||
| 483 | |||
| 484 | if (cid_list) { | 475 | if (cid_list) { |
| 485 | info->compatible_id_list.count = cid_list->count; | 476 | info->compatible_id_list.count = cid_list->count; |
| 486 | info->compatible_id_list.list_size = cid_list->list_size; | 477 | info->compatible_id_list.list_size = cid_list->list_size; |
| @@ -522,9 +513,6 @@ cleanup: | |||
| 522 | if (uid) { | 513 | if (uid) { |
| 523 | ACPI_FREE(uid); | 514 | ACPI_FREE(uid); |
| 524 | } | 515 | } |
| 525 | if (sub) { | ||
| 526 | ACPI_FREE(sub); | ||
| 527 | } | ||
| 528 | if (cid_list) { | 516 | if (cid_list) { |
| 529 | ACPI_FREE(cid_list); | 517 | ACPI_FREE(cid_list); |
| 530 | } | 518 | } |
| @@ -591,6 +579,7 @@ acpi_status acpi_install_method(u8 *buffer) | |||
| 591 | parser_state.aml += acpi_ps_get_opcode_size(opcode); | 579 | parser_state.aml += acpi_ps_get_opcode_size(opcode); |
| 592 | parser_state.pkg_end = acpi_ps_get_next_package_end(&parser_state); | 580 | parser_state.pkg_end = acpi_ps_get_next_package_end(&parser_state); |
| 593 | path = acpi_ps_get_next_namestring(&parser_state); | 581 | path = acpi_ps_get_next_namestring(&parser_state); |
| 582 | |||
| 594 | method_flags = *parser_state.aml++; | 583 | method_flags = *parser_state.aml++; |
| 595 | aml_start = parser_state.aml; | 584 | aml_start = parser_state.aml; |
| 596 | aml_length = ACPI_PTR_DIFF(parser_state.pkg_end, aml_start); | 585 | aml_length = ACPI_PTR_DIFF(parser_state.pkg_end, aml_start); |
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 793383501f81..6e1389babb47 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
| @@ -74,10 +74,8 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) | |||
| 74 | return (AE_BAD_PARAMETER); | 74 | return (AE_BAD_PARAMETER); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | /* | 77 | /* Special case for the predefined Root Node (return type ANY) */ |
| 78 | * Special case for the predefined Root Node | 78 | |
| 79 | * (return type ANY) | ||
| 80 | */ | ||
| 81 | if (handle == ACPI_ROOT_OBJECT) { | 79 | if (handle == ACPI_ROOT_OBJECT) { |
| 82 | *ret_type = ACPI_TYPE_ANY; | 80 | *ret_type = ACPI_TYPE_ANY; |
| 83 | return (AE_OK); | 81 | return (AE_OK); |
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index 29d8b7b01dca..f3bcfa20b0ae 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
| @@ -269,7 +269,8 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
| 269 | */ | 269 | */ |
| 270 | if (ACPI_SUCCESS(status) && | 270 | if (ACPI_SUCCESS(status) && |
| 271 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { | 271 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { |
| 272 | if (walk_state->opcode == AML_UNLOAD_OP) { | 272 | if (GET_CURRENT_ARG_TYPE(walk_state->arg_types) == |
| 273 | ARGP_SUPERNAME) { | ||
| 273 | /* | 274 | /* |
| 274 | * acpi_ps_get_next_namestring has increased the AML pointer, | 275 | * acpi_ps_get_next_namestring has increased the AML pointer, |
| 275 | * so we need to restore the saved AML pointer for method call. | 276 | * so we need to restore the saved AML pointer for method call. |
| @@ -696,7 +697,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state | |||
| 696 | * | 697 | * |
| 697 | * PARAMETERS: walk_state - Current state | 698 | * PARAMETERS: walk_state - Current state |
| 698 | * parser_state - Current parser state object | 699 | * parser_state - Current parser state object |
| 699 | * arg_type - The argument type (AML_*_ARG) | 700 | * arg_type - The parser argument type (ARGP_*) |
| 700 | * return_arg - Where the next arg is returned | 701 | * return_arg - Where the next arg is returned |
| 701 | * | 702 | * |
| 702 | * RETURN: Status, and an op object containing the next argument. | 703 | * RETURN: Status, and an op object containing the next argument. |
| @@ -733,6 +734,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
| 733 | if (!arg) { | 734 | if (!arg) { |
| 734 | return_ACPI_STATUS(AE_NO_MEMORY); | 735 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 735 | } | 736 | } |
| 737 | |||
| 736 | acpi_ps_get_next_simple_arg(parser_state, arg_type, arg); | 738 | acpi_ps_get_next_simple_arg(parser_state, arg_type, arg); |
| 737 | break; | 739 | break; |
| 738 | 740 | ||
| @@ -798,6 +800,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
| 798 | case ARGP_TARGET: | 800 | case ARGP_TARGET: |
| 799 | case ARGP_SUPERNAME: | 801 | case ARGP_SUPERNAME: |
| 800 | case ARGP_SIMPLENAME: | 802 | case ARGP_SIMPLENAME: |
| 803 | case ARGP_NAME_OR_REF: | ||
| 801 | 804 | ||
| 802 | subop = acpi_ps_peek_opcode(parser_state); | 805 | subop = acpi_ps_peek_opcode(parser_state); |
| 803 | if (subop == 0 || | 806 | if (subop == 0 || |
| @@ -814,17 +817,17 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
| 814 | return_ACPI_STATUS(AE_NO_MEMORY); | 817 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 815 | } | 818 | } |
| 816 | 819 | ||
| 817 | /* To support super_name arg of Unload */ | 820 | /* super_name allows argument to be a method call */ |
| 818 | 821 | ||
| 819 | if (walk_state->opcode == AML_UNLOAD_OP) { | 822 | if (arg_type == ARGP_SUPERNAME) { |
| 820 | status = | 823 | status = |
| 821 | acpi_ps_get_next_namepath(walk_state, | 824 | acpi_ps_get_next_namepath(walk_state, |
| 822 | parser_state, arg, | 825 | parser_state, arg, |
| 823 | 1); | 826 | ACPI_POSSIBLE_METHOD_CALL); |
| 824 | 827 | ||
| 825 | /* | 828 | /* |
| 826 | * If the super_name arg of Unload is a method call, | 829 | * If the super_name argument is a method call, we have |
| 827 | * we have restored the AML pointer, just free this Arg | 830 | * already restored the AML pointer, just free this Arg |
| 828 | */ | 831 | */ |
| 829 | if (arg->common.aml_opcode == | 832 | if (arg->common.aml_opcode == |
| 830 | AML_INT_METHODCALL_OP) { | 833 | AML_INT_METHODCALL_OP) { |
| @@ -835,7 +838,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
| 835 | status = | 838 | status = |
| 836 | acpi_ps_get_next_namepath(walk_state, | 839 | acpi_ps_get_next_namepath(walk_state, |
| 837 | parser_state, arg, | 840 | parser_state, arg, |
| 838 | 0); | 841 | ACPI_NOT_METHOD_CALL); |
| 839 | } | 842 | } |
| 840 | } else { | 843 | } else { |
| 841 | /* Single complex argument, nothing returned */ | 844 | /* Single complex argument, nothing returned */ |
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index 03ac8c9a67ab..a57f473bac83 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
| @@ -109,10 +109,10 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, | |||
| 109 | 109 | ||
| 110 | case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ | 110 | case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ |
| 111 | 111 | ||
| 112 | status = | 112 | status = acpi_ps_get_next_namepath(walk_state, |
| 113 | acpi_ps_get_next_namepath(walk_state, | 113 | &(walk_state->parser_state), |
| 114 | &(walk_state->parser_state), op, | 114 | op, |
| 115 | 1); | 115 | ACPI_POSSIBLE_METHOD_CALL); |
| 116 | if (ACPI_FAILURE(status)) { | 116 | if (ACPI_FAILURE(status)) { |
| 117 | return_ACPI_STATUS(status); | 117 | return_ACPI_STATUS(status); |
| 118 | } | 118 | } |
| @@ -124,8 +124,8 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, | |||
| 124 | /* | 124 | /* |
| 125 | * Op is not a constant or string, append each argument to the Op | 125 | * Op is not a constant or string, append each argument to the Op |
| 126 | */ | 126 | */ |
| 127 | while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) | 127 | while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) && |
| 128 | && !walk_state->arg_count) { | 128 | !walk_state->arg_count) { |
| 129 | walk_state->aml = walk_state->parser_state.aml; | 129 | walk_state->aml = walk_state->parser_state.aml; |
| 130 | 130 | ||
| 131 | status = | 131 | status = |
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c index ed90fddf2487..40909ddeebb3 100644 --- a/drivers/acpi/acpica/psopcode.c +++ b/drivers/acpi/acpica/psopcode.c | |||
| @@ -185,458 +185,458 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { | |||
| 185 | /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ | 185 | /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ |
| 186 | 186 | ||
| 187 | /* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, | 187 | /* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, |
| 188 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), | 188 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), |
| 189 | /* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, | 189 | /* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, |
| 190 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), | 190 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), |
| 191 | /* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, | 191 | /* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, |
| 192 | ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, | 192 | ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, |
| 193 | AML_TYPE_NAMED_SIMPLE, | 193 | AML_TYPE_NAMED_SIMPLE, |
| 194 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 194 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 195 | AML_NSNODE | AML_NAMED), | 195 | AML_NSNODE | AML_NAMED), |
| 196 | /* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, | 196 | /* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, |
| 197 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, | 197 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, |
| 198 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 198 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 199 | AML_NSNODE | AML_NAMED), | 199 | AML_NSNODE | AML_NAMED), |
| 200 | /* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, | 200 | /* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, |
| 201 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 201 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
| 202 | AML_TYPE_LITERAL, AML_CONSTANT), | 202 | AML_TYPE_LITERAL, AML_CONSTANT), |
| 203 | /* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, | 203 | /* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, |
| 204 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 204 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
| 205 | AML_TYPE_LITERAL, AML_CONSTANT), | 205 | AML_TYPE_LITERAL, AML_CONSTANT), |
| 206 | /* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, | 206 | /* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, |
| 207 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 207 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
| 208 | AML_TYPE_LITERAL, AML_CONSTANT), | 208 | AML_TYPE_LITERAL, AML_CONSTANT), |
| 209 | /* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP, | 209 | /* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP, |
| 210 | ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, | 210 | ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, |
| 211 | AML_TYPE_LITERAL, AML_CONSTANT), | 211 | AML_TYPE_LITERAL, AML_CONSTANT), |
| 212 | /* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, | 212 | /* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, |
| 213 | ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, | 213 | ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, |
| 214 | AML_TYPE_NAMED_NO_OBJ, | 214 | AML_TYPE_NAMED_NO_OBJ, |
| 215 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 215 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 216 | AML_NSNODE | AML_NAMED), | 216 | AML_NSNODE | AML_NAMED), |
| 217 | /* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, | 217 | /* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, |
| 218 | ACPI_TYPE_BUFFER, AML_CLASS_CREATE, | 218 | ACPI_TYPE_BUFFER, AML_CLASS_CREATE, |
| 219 | AML_TYPE_CREATE_OBJECT, | 219 | AML_TYPE_CREATE_OBJECT, |
| 220 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), | 220 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), |
| 221 | /* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, | 221 | /* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, |
| 222 | ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, | 222 | ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, |
| 223 | AML_TYPE_CREATE_OBJECT, | 223 | AML_TYPE_CREATE_OBJECT, |
| 224 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), | 224 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), |
| 225 | /* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, | 225 | /* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, |
| 226 | ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, | 226 | ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, |
| 227 | AML_TYPE_NAMED_COMPLEX, | 227 | AML_TYPE_NAMED_COMPLEX, |
| 228 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 228 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 229 | AML_NSNODE | AML_NAMED | AML_DEFER), | 229 | AML_NSNODE | AML_NAMED | AML_DEFER), |
| 230 | /* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0, | 230 | /* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0, |
| 231 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 231 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 232 | AML_TYPE_LOCAL_VARIABLE, 0), | 232 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 233 | /* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1, | 233 | /* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1, |
| 234 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 234 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 235 | AML_TYPE_LOCAL_VARIABLE, 0), | 235 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 236 | /* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2, | 236 | /* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2, |
| 237 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 237 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 238 | AML_TYPE_LOCAL_VARIABLE, 0), | 238 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 239 | /* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3, | 239 | /* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3, |
| 240 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 240 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 241 | AML_TYPE_LOCAL_VARIABLE, 0), | 241 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 242 | /* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4, | 242 | /* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4, |
| 243 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 243 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 244 | AML_TYPE_LOCAL_VARIABLE, 0), | 244 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 245 | /* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5, | 245 | /* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5, |
| 246 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 246 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 247 | AML_TYPE_LOCAL_VARIABLE, 0), | 247 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 248 | /* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6, | 248 | /* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6, |
| 249 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 249 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 250 | AML_TYPE_LOCAL_VARIABLE, 0), | 250 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 251 | /* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7, | 251 | /* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7, |
| 252 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 252 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 253 | AML_TYPE_LOCAL_VARIABLE, 0), | 253 | AML_TYPE_LOCAL_VARIABLE, 0), |
| 254 | /* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0, | 254 | /* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0, |
| 255 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 255 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 256 | AML_TYPE_METHOD_ARGUMENT, 0), | 256 | AML_TYPE_METHOD_ARGUMENT, 0), |
| 257 | /* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1, | 257 | /* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1, |
| 258 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 258 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 259 | AML_TYPE_METHOD_ARGUMENT, 0), | 259 | AML_TYPE_METHOD_ARGUMENT, 0), |
| 260 | /* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2, | 260 | /* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2, |
| 261 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 261 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 262 | AML_TYPE_METHOD_ARGUMENT, 0), | 262 | AML_TYPE_METHOD_ARGUMENT, 0), |
| 263 | /* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3, | 263 | /* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3, |
| 264 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 264 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 265 | AML_TYPE_METHOD_ARGUMENT, 0), | 265 | AML_TYPE_METHOD_ARGUMENT, 0), |
| 266 | /* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4, | 266 | /* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4, |
| 267 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 267 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 268 | AML_TYPE_METHOD_ARGUMENT, 0), | 268 | AML_TYPE_METHOD_ARGUMENT, 0), |
| 269 | /* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5, | 269 | /* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5, |
| 270 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 270 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 271 | AML_TYPE_METHOD_ARGUMENT, 0), | 271 | AML_TYPE_METHOD_ARGUMENT, 0), |
| 272 | /* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6, | 272 | /* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6, |
| 273 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 273 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 274 | AML_TYPE_METHOD_ARGUMENT, 0), | 274 | AML_TYPE_METHOD_ARGUMENT, 0), |
| 275 | /* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, | 275 | /* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, |
| 276 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 276 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
| 277 | AML_FLAGS_EXEC_1A_1T_1R), | 277 | AML_FLAGS_EXEC_1A_1T_1R), |
| 278 | /* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, | 278 | /* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, |
| 279 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, | 279 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, |
| 280 | AML_FLAGS_EXEC_1A_0T_1R), | 280 | AML_FLAGS_EXEC_1A_0T_1R), |
| 281 | /* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, | 281 | /* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, |
| 282 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 282 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 283 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 283 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 284 | /* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, | 284 | /* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, |
| 285 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 285 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 286 | AML_TYPE_EXEC_2A_1T_1R, | 286 | AML_TYPE_EXEC_2A_1T_1R, |
| 287 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 287 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
| 288 | /* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, | 288 | /* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, |
| 289 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 289 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 290 | AML_TYPE_EXEC_2A_1T_1R, | 290 | AML_TYPE_EXEC_2A_1T_1R, |
| 291 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 291 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 292 | /* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, | 292 | /* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, |
| 293 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 293 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 294 | AML_TYPE_EXEC_1A_0T_1R, | 294 | AML_TYPE_EXEC_1A_0T_1R, |
| 295 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), | 295 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), |
| 296 | /* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, | 296 | /* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, |
| 297 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 297 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 298 | AML_TYPE_EXEC_1A_0T_1R, | 298 | AML_TYPE_EXEC_1A_0T_1R, |
| 299 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), | 299 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), |
| 300 | /* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, | 300 | /* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, |
| 301 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 301 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 302 | AML_TYPE_EXEC_2A_1T_1R, | 302 | AML_TYPE_EXEC_2A_1T_1R, |
| 303 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 303 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 304 | /* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, | 304 | /* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, |
| 305 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 305 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 306 | AML_TYPE_EXEC_2A_2T_1R, | 306 | AML_TYPE_EXEC_2A_2T_1R, |
| 307 | AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), | 307 | AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), |
| 308 | /* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, | 308 | /* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, |
| 309 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 309 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 310 | AML_TYPE_EXEC_2A_1T_1R, | 310 | AML_TYPE_EXEC_2A_1T_1R, |
| 311 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 311 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 312 | /* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, | 312 | /* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, |
| 313 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 313 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 314 | AML_TYPE_EXEC_2A_1T_1R, | 314 | AML_TYPE_EXEC_2A_1T_1R, |
| 315 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 315 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 316 | /* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, | 316 | /* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, |
| 317 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 317 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 318 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 318 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 319 | /* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, | 319 | /* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, |
| 320 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 320 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 321 | AML_TYPE_EXEC_2A_1T_1R, | 321 | AML_TYPE_EXEC_2A_1T_1R, |
| 322 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 322 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 323 | /* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, | 323 | /* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, |
| 324 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 324 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 325 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 325 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 326 | /* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, | 326 | /* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, |
| 327 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 327 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 328 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 328 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 329 | /* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, | 329 | /* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, |
| 330 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 330 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 331 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 331 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
| 332 | /* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, | 332 | /* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, |
| 333 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 333 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
| 334 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 334 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 335 | /* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, | 335 | /* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, |
| 336 | ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, | 336 | ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, |
| 337 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 337 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
| 338 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 338 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 339 | /* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP, | 339 | /* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP, |
| 340 | ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, | 340 | ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, |
| 341 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 341 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
| 342 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 342 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 343 | /* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, | 343 | /* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, |
| 344 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 344 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 345 | AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), | 345 | AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), |
| 346 | /* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, | 346 | /* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, |
| 347 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 347 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 348 | AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), | 348 | AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), |
| 349 | /* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, | 349 | /* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, |
| 350 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 350 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 351 | AML_TYPE_EXEC_1A_0T_1R, | 351 | AML_TYPE_EXEC_1A_0T_1R, |
| 352 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), | 352 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), |
| 353 | /* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, | 353 | /* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, |
| 354 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 354 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 355 | AML_FLAGS_EXEC_2A_1T_1R), | 355 | AML_FLAGS_EXEC_2A_1T_1R), |
| 356 | /* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, | 356 | /* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, |
| 357 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, | 357 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, |
| 358 | AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), | 358 | AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), |
| 359 | /* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP, | 359 | /* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP, |
| 360 | ARGI_CREATE_DWORD_FIELD_OP, | 360 | ARGI_CREATE_DWORD_FIELD_OP, |
| 361 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 361 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
| 362 | AML_TYPE_CREATE_FIELD, | 362 | AML_TYPE_CREATE_FIELD, |
| 363 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 363 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
| 364 | AML_DEFER | AML_CREATE), | 364 | AML_DEFER | AML_CREATE), |
| 365 | /* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, | 365 | /* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, |
| 366 | ARGI_CREATE_WORD_FIELD_OP, | 366 | ARGI_CREATE_WORD_FIELD_OP, |
| 367 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 367 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
| 368 | AML_TYPE_CREATE_FIELD, | 368 | AML_TYPE_CREATE_FIELD, |
| 369 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 369 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
| 370 | AML_DEFER | AML_CREATE), | 370 | AML_DEFER | AML_CREATE), |
| 371 | /* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, | 371 | /* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, |
| 372 | ARGI_CREATE_BYTE_FIELD_OP, | 372 | ARGI_CREATE_BYTE_FIELD_OP, |
| 373 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 373 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
| 374 | AML_TYPE_CREATE_FIELD, | 374 | AML_TYPE_CREATE_FIELD, |
| 375 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 375 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
| 376 | AML_DEFER | AML_CREATE), | 376 | AML_DEFER | AML_CREATE), |
| 377 | /* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, | 377 | /* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, |
| 378 | ARGI_CREATE_BIT_FIELD_OP, | 378 | ARGI_CREATE_BIT_FIELD_OP, |
| 379 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 379 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
| 380 | AML_TYPE_CREATE_FIELD, | 380 | AML_TYPE_CREATE_FIELD, |
| 381 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 381 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
| 382 | AML_DEFER | AML_CREATE), | 382 | AML_DEFER | AML_CREATE), |
| 383 | /* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, | 383 | /* 37 */ ACPI_OP("ObjectType", ARGP_OBJECT_TYPE_OP, ARGI_OBJECT_TYPE_OP, |
| 384 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 384 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 385 | AML_TYPE_EXEC_1A_0T_1R, | 385 | AML_TYPE_EXEC_1A_0T_1R, |
| 386 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), | 386 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), |
| 387 | /* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, | 387 | /* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, |
| 388 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 388 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
| 389 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | | 389 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | |
| 390 | AML_CONSTANT), | 390 | AML_CONSTANT), |
| 391 | /* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, | 391 | /* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, |
| 392 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 392 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
| 393 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | | 393 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | |
| 394 | AML_CONSTANT), | 394 | AML_CONSTANT), |
| 395 | /* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, | 395 | /* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, |
| 396 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, | 396 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, |
| 397 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), | 397 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), |
| 398 | /* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, | 398 | /* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, |
| 399 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 399 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 400 | AML_TYPE_EXEC_2A_0T_1R, | 400 | AML_TYPE_EXEC_2A_0T_1R, |
| 401 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), | 401 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), |
| 402 | /* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, | 402 | /* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, |
| 403 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 403 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 404 | AML_TYPE_EXEC_2A_0T_1R, | 404 | AML_TYPE_EXEC_2A_0T_1R, |
| 405 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), | 405 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), |
| 406 | /* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, | 406 | /* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, |
| 407 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 407 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
| 408 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), | 408 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), |
| 409 | /* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, | 409 | /* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, |
| 410 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), | 410 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), |
| 411 | /* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, | 411 | /* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, |
| 412 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), | 412 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), |
| 413 | /* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, | 413 | /* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, |
| 414 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), | 414 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), |
| 415 | /* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, | 415 | /* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, |
| 416 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 416 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
| 417 | /* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, | 417 | /* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, |
| 418 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, | 418 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, |
| 419 | AML_TYPE_CONTROL, AML_HAS_ARGS), | 419 | AML_TYPE_CONTROL, AML_HAS_ARGS), |
| 420 | /* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, | 420 | /* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, |
| 421 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 421 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
| 422 | /* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, | 422 | /* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, |
| 423 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 423 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
| 424 | /* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, | 424 | /* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, |
| 425 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), | 425 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), |
| 426 | 426 | ||
| 427 | /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ | 427 | /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ |
| 428 | 428 | ||
| 429 | /* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, | 429 | /* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, |
| 430 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, | 430 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, |
| 431 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 431 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 432 | AML_NSNODE | AML_NAMED), | 432 | AML_NSNODE | AML_NAMED), |
| 433 | /* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, | 433 | /* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, |
| 434 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, | 434 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, |
| 435 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), | 435 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), |
| 436 | /* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, | 436 | /* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, |
| 437 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 437 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 438 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), | 438 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), |
| 439 | /* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP, | 439 | /* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP, |
| 440 | ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, | 440 | ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, |
| 441 | AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, | 441 | AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, |
| 442 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 442 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
| 443 | AML_DEFER | AML_FIELD | AML_CREATE), | 443 | AML_DEFER | AML_FIELD | AML_CREATE), |
| 444 | /* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, | 444 | /* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, |
| 445 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, | 445 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, |
| 446 | AML_FLAGS_EXEC_1A_1T_0R), | 446 | AML_FLAGS_EXEC_1A_1T_0R), |
| 447 | /* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, | 447 | /* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, |
| 448 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, | 448 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, |
| 449 | AML_FLAGS_EXEC_1A_0T_0R), | 449 | AML_FLAGS_EXEC_1A_0T_0R), |
| 450 | /* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, | 450 | /* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, |
| 451 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, | 451 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, |
| 452 | AML_FLAGS_EXEC_1A_0T_0R), | 452 | AML_FLAGS_EXEC_1A_0T_0R), |
| 453 | /* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, | 453 | /* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, |
| 454 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 454 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 455 | AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), | 455 | AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), |
| 456 | /* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, | 456 | /* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, |
| 457 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 457 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 458 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), | 458 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), |
| 459 | /* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, | 459 | /* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, |
| 460 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 460 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
| 461 | AML_FLAGS_EXEC_2A_0T_1R), | 461 | AML_FLAGS_EXEC_2A_0T_1R), |
| 462 | /* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, | 462 | /* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, |
| 463 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, | 463 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, |
| 464 | AML_FLAGS_EXEC_1A_0T_0R), | 464 | AML_FLAGS_EXEC_1A_0T_0R), |
| 465 | /* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, | 465 | /* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, |
| 466 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 466 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 467 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), | 467 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), |
| 468 | /* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, | 468 | /* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, |
| 469 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 469 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 470 | AML_TYPE_EXEC_1A_1T_1R, | 470 | AML_TYPE_EXEC_1A_1T_1R, |
| 471 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 471 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 472 | /* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, | 472 | /* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, |
| 473 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 473 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
| 474 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 474 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 475 | /* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, | 475 | /* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, |
| 476 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 476 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 477 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), | 477 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), |
| 478 | /* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, | 478 | /* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, |
| 479 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 479 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
| 480 | AML_TYPE_CONSTANT, 0), | 480 | AML_TYPE_CONSTANT, 0), |
| 481 | /* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, | 481 | /* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, |
| 482 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 482 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 483 | AML_TYPE_CONSTANT, 0), | 483 | AML_TYPE_CONSTANT, 0), |
| 484 | /* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, | 484 | /* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, |
| 485 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, | 485 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, |
| 486 | AML_FLAGS_EXEC_3A_0T_0R), | 486 | AML_FLAGS_EXEC_3A_0T_0R), |
| 487 | /* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, | 487 | /* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, |
| 488 | ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, | 488 | ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, |
| 489 | AML_TYPE_NAMED_COMPLEX, | 489 | AML_TYPE_NAMED_COMPLEX, |
| 490 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 490 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 491 | AML_NSNODE | AML_NAMED | AML_DEFER), | 491 | AML_NSNODE | AML_NAMED | AML_DEFER), |
| 492 | /* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, | 492 | /* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, |
| 493 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, | 493 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, |
| 494 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 494 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 495 | AML_FIELD), | 495 | AML_FIELD), |
| 496 | /* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, | 496 | /* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, |
| 497 | ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, | 497 | ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, |
| 498 | AML_TYPE_NAMED_NO_OBJ, | 498 | AML_TYPE_NAMED_NO_OBJ, |
| 499 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 499 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 500 | AML_NSNODE | AML_NAMED), | 500 | AML_NSNODE | AML_NAMED), |
| 501 | /* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, | 501 | /* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, |
| 502 | ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, | 502 | ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, |
| 503 | AML_TYPE_NAMED_SIMPLE, | 503 | AML_TYPE_NAMED_SIMPLE, |
| 504 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 504 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 505 | AML_NSNODE | AML_NAMED), | 505 | AML_NSNODE | AML_NAMED), |
| 506 | /* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, | 506 | /* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, |
| 507 | ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, | 507 | ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, |
| 508 | AML_TYPE_NAMED_SIMPLE, | 508 | AML_TYPE_NAMED_SIMPLE, |
| 509 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 509 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 510 | AML_NSNODE | AML_NAMED), | 510 | AML_NSNODE | AML_NAMED), |
| 511 | /* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP, | 511 | /* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP, |
| 512 | ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, | 512 | ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, |
| 513 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, | 513 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, |
| 514 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 514 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 515 | AML_NSNODE | AML_NAMED), | 515 | AML_NSNODE | AML_NAMED), |
| 516 | /* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, | 516 | /* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, |
| 517 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, | 517 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, |
| 518 | AML_TYPE_NAMED_FIELD, | 518 | AML_TYPE_NAMED_FIELD, |
| 519 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 519 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 520 | AML_FIELD), | 520 | AML_FIELD), |
| 521 | /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, | 521 | /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, |
| 522 | ACPI_TYPE_LOCAL_BANK_FIELD, | 522 | ACPI_TYPE_LOCAL_BANK_FIELD, |
| 523 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, | 523 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, |
| 524 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 524 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 525 | AML_FIELD | AML_DEFER), | 525 | AML_FIELD | AML_DEFER), |
| 526 | 526 | ||
| 527 | /* Internal opcodes that map to invalid AML opcodes */ | 527 | /* Internal opcodes that map to invalid AML opcodes */ |
| 528 | 528 | ||
| 529 | /* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, | 529 | /* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, |
| 530 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, | 530 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, |
| 531 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), | 531 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), |
| 532 | /* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, | 532 | /* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, |
| 533 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, | 533 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, |
| 534 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), | 534 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), |
| 535 | /* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP, | 535 | /* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP, |
| 536 | ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, | 536 | ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, |
| 537 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, | 537 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, |
| 538 | AML_HAS_ARGS | AML_CONSTANT), | 538 | AML_HAS_ARGS | AML_CONSTANT), |
| 539 | /* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, | 539 | /* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, |
| 540 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 540 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
| 541 | AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE), | 541 | AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE), |
| 542 | /* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, | 542 | /* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, |
| 543 | ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, | 543 | ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, |
| 544 | AML_TYPE_METHOD_CALL, | 544 | AML_TYPE_METHOD_CALL, |
| 545 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), | 545 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), |
| 546 | /* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, | 546 | /* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, |
| 547 | ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, | 547 | ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, |
| 548 | AML_TYPE_LITERAL, 0), | 548 | AML_TYPE_LITERAL, 0), |
| 549 | /* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP, | 549 | /* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP, |
| 550 | ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, | 550 | ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, |
| 551 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), | 551 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), |
| 552 | /* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, | 552 | /* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, |
| 553 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, | 553 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, |
| 554 | AML_TYPE_BOGUS, | 554 | AML_TYPE_BOGUS, |
| 555 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), | 555 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), |
| 556 | /* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP, | 556 | /* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP, |
| 557 | ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, | 557 | ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, |
| 558 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), | 558 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), |
| 559 | /* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP, | 559 | /* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP, |
| 560 | ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, | 560 | ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, |
| 561 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), | 561 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), |
| 562 | /* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, | 562 | /* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, |
| 563 | AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, | 563 | AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, |
| 564 | AML_HAS_ARGS | AML_HAS_RETVAL), | 564 | AML_HAS_ARGS | AML_HAS_RETVAL), |
| 565 | /* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, | 565 | /* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, |
| 566 | AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), | 566 | AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), |
| 567 | /* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, | 567 | /* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, |
| 568 | AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), | 568 | AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), |
| 569 | /* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, | 569 | /* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, |
| 570 | AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), | 570 | AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), |
| 571 | 571 | ||
| 572 | /* ACPI 2.0 opcodes */ | 572 | /* ACPI 2.0 opcodes */ |
| 573 | 573 | ||
| 574 | /* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, | 574 | /* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, |
| 575 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 575 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
| 576 | AML_TYPE_LITERAL, AML_CONSTANT), | 576 | AML_TYPE_LITERAL, AML_CONSTANT), |
| 577 | /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP, | 577 | /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP, |
| 578 | ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, | 578 | ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, |
| 579 | AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, | 579 | AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, |
| 580 | AML_HAS_ARGS | AML_DEFER), | 580 | AML_HAS_ARGS | AML_DEFER), |
| 581 | /* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, | 581 | /* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, |
| 582 | ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, | 582 | ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, |
| 583 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 583 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 584 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 584 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
| 585 | /* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, | 585 | /* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, |
| 586 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 586 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
| 587 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 587 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
| 588 | /* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP, | 588 | /* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP, |
| 589 | ARGI_CREATE_QWORD_FIELD_OP, | 589 | ARGI_CREATE_QWORD_FIELD_OP, |
| 590 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 590 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
| 591 | AML_TYPE_CREATE_FIELD, | 591 | AML_TYPE_CREATE_FIELD, |
| 592 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 592 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
| 593 | AML_DEFER | AML_CREATE), | 593 | AML_DEFER | AML_CREATE), |
| 594 | /* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, | 594 | /* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, |
| 595 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 595 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 596 | AML_TYPE_EXEC_1A_1T_1R, | 596 | AML_TYPE_EXEC_1A_1T_1R, |
| 597 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 597 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 598 | /* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP, | 598 | /* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP, |
| 599 | ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, | 599 | ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, |
| 600 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 600 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
| 601 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 601 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 602 | /* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, | 602 | /* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, |
| 603 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 603 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 604 | AML_TYPE_EXEC_1A_1T_1R, | 604 | AML_TYPE_EXEC_1A_1T_1R, |
| 605 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 605 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 606 | /* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, | 606 | /* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, |
| 607 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 607 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 608 | AML_TYPE_EXEC_1A_1T_1R, | 608 | AML_TYPE_EXEC_1A_1T_1R, |
| 609 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 609 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
| 610 | /* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, | 610 | /* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, |
| 611 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 611 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 612 | AML_TYPE_EXEC_2A_1T_1R, | 612 | AML_TYPE_EXEC_2A_1T_1R, |
| 613 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 613 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
| 614 | /* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, | 614 | /* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, |
| 615 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 615 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 616 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), | 616 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), |
| 617 | /* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, | 617 | /* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, |
| 618 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, | 618 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, |
| 619 | AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), | 619 | AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), |
| 620 | /* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, | 620 | /* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, |
| 621 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 621 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
| 622 | /* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, | 622 | /* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, |
| 623 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 623 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
| 624 | AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), | 624 | AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), |
| 625 | /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, | 625 | /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, |
| 626 | ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, | 626 | ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, |
| 627 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, | 627 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, |
| 628 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 628 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 629 | AML_NSNODE | AML_NAMED | AML_DEFER), | 629 | AML_NSNODE | AML_NAMED | AML_DEFER), |
| 630 | /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, | 630 | /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, |
| 631 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, | 631 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, |
| 632 | AML_TYPE_NAMED_NO_OBJ, | 632 | AML_TYPE_NAMED_NO_OBJ, |
| 633 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 633 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
| 634 | AML_NSNODE), | 634 | AML_NSNODE), |
| 635 | 635 | ||
| 636 | /* ACPI 3.0 opcodes */ | 636 | /* ACPI 3.0 opcodes */ |
| 637 | 637 | ||
| 638 | /* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, | 638 | /* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, |
| 639 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, | 639 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, |
| 640 | AML_FLAGS_EXEC_0A_0T_1R), | 640 | AML_FLAGS_EXEC_0A_0T_1R), |
| 641 | 641 | ||
| 642 | /* ACPI 5.0 opcodes */ | 642 | /* ACPI 5.0 opcodes */ |
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 98001d7f6f80..b729d9b291d0 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c | |||
| @@ -526,8 +526,8 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | /* | 528 | /* |
| 529 | * If the transfer to the new method method call worked, a new walk | 529 | * If the transfer to the new method method call worked |
| 530 | * state was created -- get it | 530 | *, a new walk state was created -- get it |
| 531 | */ | 531 | */ |
| 532 | walk_state = acpi_ds_get_current_walk_state(thread); | 532 | walk_state = acpi_ds_get_current_walk_state(thread); |
| 533 | continue; | 533 | continue; |
| @@ -544,8 +544,8 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
| 544 | /* Check for possible multi-thread reentrancy problem */ | 544 | /* Check for possible multi-thread reentrancy problem */ |
| 545 | 545 | ||
| 546 | if ((status == AE_ALREADY_EXISTS) && | 546 | if ((status == AE_ALREADY_EXISTS) && |
| 547 | (!(walk_state->method_desc->method. | 547 | (!(walk_state->method_desc->method.info_flags & |
| 548 | info_flags & ACPI_METHOD_SERIALIZED))) { | 548 | ACPI_METHOD_SERIALIZED))) { |
| 549 | /* | 549 | /* |
| 550 | * Method is not serialized and tried to create an object | 550 | * Method is not serialized and tried to create an object |
| 551 | * twice. The probable cause is that the method cannot | 551 | * twice. The probable cause is that the method cannot |
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c index 71d2877cd2ce..6cb02a2a1468 100644 --- a/drivers/acpi/acpica/psutils.c +++ b/drivers/acpi/acpica/psutils.c | |||
| @@ -175,8 +175,8 @@ void acpi_ps_free_op(union acpi_parse_object *op) | |||
| 175 | ACPI_FUNCTION_NAME(ps_free_op); | 175 | ACPI_FUNCTION_NAME(ps_free_op); |
| 176 | 176 | ||
| 177 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 177 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
| 178 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", | 178 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
| 179 | op)); | 179 | "Free retval op: %p\n", op)); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { | 182 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { |
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index ba5f69171288..f620d4395b66 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c | |||
| @@ -99,6 +99,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) | |||
| 99 | if (op == subtree_root) { | 99 | if (op == subtree_root) { |
| 100 | return_VOID; | 100 | return_VOID; |
| 101 | } | 101 | } |
| 102 | |||
| 102 | if (next) { | 103 | if (next) { |
| 103 | op = next; | 104 | op = next; |
| 104 | } else { | 105 | } else { |
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c index 66d406e8fe36..bdb7e73cdf4a 100644 --- a/drivers/acpi/acpica/rsaddr.c +++ b/drivers/acpi/acpica/rsaddr.c | |||
| @@ -312,8 +312,8 @@ acpi_rs_get_address_common(struct acpi_resource *resource, | |||
| 312 | 312 | ||
| 313 | /* Validate the Resource Type */ | 313 | /* Validate the Resource Type */ |
| 314 | 314 | ||
| 315 | if ((aml->address.resource_type > 2) | 315 | if ((aml->address.resource_type > 2) && |
| 316 | && (aml->address.resource_type < 0xC0)) { | 316 | (aml->address.resource_type < 0xC0)) { |
| 317 | return (FALSE); | 317 | return (FALSE); |
| 318 | } | 318 | } |
| 319 | 319 | ||
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index cb739a694931..88fce58cc545 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
| @@ -143,16 +143,17 @@ acpi_rs_stream_option_length(u32 resource_length, | |||
| 143 | ACPI_FUNCTION_ENTRY(); | 143 | ACPI_FUNCTION_ENTRY(); |
| 144 | 144 | ||
| 145 | /* | 145 | /* |
| 146 | * The resource_source_index and resource_source are optional elements of some | 146 | * The resource_source_index and resource_source are optional elements of |
| 147 | * Large-type resource descriptors. | 147 | * some Large-type resource descriptors. |
| 148 | */ | 148 | */ |
| 149 | 149 | ||
| 150 | /* | 150 | /* |
| 151 | * If the length of the actual resource descriptor is greater than the ACPI | 151 | * If the length of the actual resource descriptor is greater than the |
| 152 | * spec-defined minimum length, it means that a resource_source_index exists | 152 | * ACPI spec-defined minimum length, it means that a resource_source_index |
| 153 | * and is followed by a (required) null terminated string. The string length | 153 | * exists and is followed by a (required) null terminated string. The |
| 154 | * (including the null terminator) is the resource length minus the minimum | 154 | * string length (including the null terminator) is the resource length |
| 155 | * length, minus one byte for the resource_source_index itself. | 155 | * minus the minimum length, minus one byte for the resource_source_index |
| 156 | * itself. | ||
| 156 | */ | 157 | */ |
| 157 | if (resource_length > minimum_aml_resource_length) { | 158 | if (resource_length > minimum_aml_resource_length) { |
| 158 | 159 | ||
| @@ -277,11 +278,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, | |||
| 277 | * 16-Bit Address Resource: | 278 | * 16-Bit Address Resource: |
| 278 | * Add the size of the optional resource_source info | 279 | * Add the size of the optional resource_source info |
| 279 | */ | 280 | */ |
| 280 | total_size = (acpi_rs_length) | 281 | total_size = (acpi_rs_length) (total_size + |
| 281 | (total_size + | 282 | acpi_rs_struct_option_length |
| 282 | acpi_rs_struct_option_length(&resource->data. | 283 | (&resource->data. |
| 283 | address16. | 284 | address16. |
| 284 | resource_source)); | 285 | resource_source)); |
| 285 | break; | 286 | break; |
| 286 | 287 | ||
| 287 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 288 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
| @@ -289,11 +290,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, | |||
| 289 | * 32-Bit Address Resource: | 290 | * 32-Bit Address Resource: |
| 290 | * Add the size of the optional resource_source info | 291 | * Add the size of the optional resource_source info |
| 291 | */ | 292 | */ |
| 292 | total_size = (acpi_rs_length) | 293 | total_size = (acpi_rs_length) (total_size + |
| 293 | (total_size + | 294 | acpi_rs_struct_option_length |
| 294 | acpi_rs_struct_option_length(&resource->data. | 295 | (&resource->data. |
| 295 | address32. | 296 | address32. |
| 296 | resource_source)); | 297 | resource_source)); |
| 297 | break; | 298 | break; |
| 298 | 299 | ||
| 299 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 300 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
| @@ -301,11 +302,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, | |||
| 301 | * 64-Bit Address Resource: | 302 | * 64-Bit Address Resource: |
| 302 | * Add the size of the optional resource_source info | 303 | * Add the size of the optional resource_source info |
| 303 | */ | 304 | */ |
| 304 | total_size = (acpi_rs_length) | 305 | total_size = (acpi_rs_length) (total_size + |
| 305 | (total_size + | 306 | acpi_rs_struct_option_length |
| 306 | acpi_rs_struct_option_length(&resource->data. | 307 | (&resource->data. |
| 307 | address64. | 308 | address64. |
| 308 | resource_source)); | 309 | resource_source)); |
| 309 | break; | 310 | break; |
| 310 | 311 | ||
| 311 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 312 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
| @@ -314,26 +315,28 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, | |||
| 314 | * Add the size of each additional optional interrupt beyond the | 315 | * Add the size of each additional optional interrupt beyond the |
| 315 | * required 1 (4 bytes for each u32 interrupt number) | 316 | * required 1 (4 bytes for each u32 interrupt number) |
| 316 | */ | 317 | */ |
| 317 | total_size = (acpi_rs_length) | 318 | total_size = (acpi_rs_length) (total_size + |
| 318 | (total_size + | 319 | ((resource->data. |
| 319 | ((resource->data.extended_irq.interrupt_count - | 320 | extended_irq. |
| 320 | 1) * 4) + | 321 | interrupt_count - |
| 321 | /* Add the size of the optional resource_source info */ | 322 | 1) * 4) + |
| 322 | acpi_rs_struct_option_length(&resource->data. | 323 | /* Add the size of the optional resource_source info */ |
| 323 | extended_irq. | 324 | acpi_rs_struct_option_length |
| 324 | resource_source)); | 325 | (&resource->data. |
| 326 | extended_irq. | ||
| 327 | resource_source)); | ||
| 325 | break; | 328 | break; |
| 326 | 329 | ||
| 327 | case ACPI_RESOURCE_TYPE_GPIO: | 330 | case ACPI_RESOURCE_TYPE_GPIO: |
| 328 | 331 | ||
| 329 | total_size = | 332 | total_size = (acpi_rs_length) (total_size + |
| 330 | (acpi_rs_length) (total_size + | 333 | (resource->data.gpio. |
| 331 | (resource->data.gpio. | 334 | pin_table_length * 2) + |
| 332 | pin_table_length * 2) + | 335 | resource->data.gpio. |
| 333 | resource->data.gpio. | 336 | resource_source. |
| 334 | resource_source.string_length + | 337 | string_length + |
| 335 | resource->data.gpio. | 338 | resource->data.gpio. |
| 336 | vendor_length); | 339 | vendor_length); |
| 337 | 340 | ||
| 338 | break; | 341 | break; |
| 339 | 342 | ||
| @@ -566,8 +569,8 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
| 566 | acpi_gbl_resource_struct_sizes[resource_index] + | 569 | acpi_gbl_resource_struct_sizes[resource_index] + |
| 567 | extra_struct_bytes; | 570 | extra_struct_bytes; |
| 568 | } | 571 | } |
| 569 | buffer_size = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); | ||
| 570 | 572 | ||
| 573 | buffer_size = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); | ||
| 571 | *size_needed += buffer_size; | 574 | *size_needed += buffer_size; |
| 572 | 575 | ||
| 573 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, | 576 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index a5344428f3ae..603e544e3f64 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
| @@ -81,8 +81,9 @@ acpi_buffer_to_resource(u8 *aml_buffer, | |||
| 81 | 81 | ||
| 82 | /* Get the required length for the converted resource */ | 82 | /* Get the required length for the converted resource */ |
| 83 | 83 | ||
| 84 | status = acpi_rs_get_list_length(aml_buffer, aml_buffer_length, | 84 | status = |
| 85 | &list_size_needed); | 85 | acpi_rs_get_list_length(aml_buffer, aml_buffer_length, |
| 86 | &list_size_needed); | ||
| 86 | if (status == AE_AML_NO_RESOURCE_END_TAG) { | 87 | if (status == AE_AML_NO_RESOURCE_END_TAG) { |
| 87 | status = AE_OK; | 88 | status = AE_OK; |
| 88 | } | 89 | } |
| @@ -232,8 +233,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 232 | 233 | ||
| 233 | /* Get the required buffer length */ | 234 | /* Get the required buffer length */ |
| 234 | 235 | ||
| 235 | status = acpi_rs_get_pci_routing_table_length(package_object, | 236 | status = |
| 236 | &buffer_size_needed); | 237 | acpi_rs_get_pci_routing_table_length(package_object, |
| 238 | &buffer_size_needed); | ||
| 237 | if (ACPI_FAILURE(status)) { | 239 | if (ACPI_FAILURE(status)) { |
| 238 | return_ACPI_STATUS(status); | 240 | return_ACPI_STATUS(status); |
| 239 | } | 241 | } |
| @@ -270,9 +272,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 270 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); | 272 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
| 271 | 273 | ||
| 272 | /* | 274 | /* |
| 273 | * Fill in the Length field with the information we have at this point. | 275 | * Fill in the Length field with the information we have at this |
| 274 | * The minus four is to subtract the size of the u8 Source[4] member | 276 | * point. The minus four is to subtract the size of the u8 |
| 275 | * because it is added below. | 277 | * Source[4] member because it is added below. |
| 276 | */ | 278 | */ |
| 277 | user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); | 279 | user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); |
| 278 | 280 | ||
| @@ -345,11 +347,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 345 | (u8 *) output_buffer->pointer); | 347 | (u8 *) output_buffer->pointer); |
| 346 | path_buffer.pointer = user_prt->source; | 348 | path_buffer.pointer = user_prt->source; |
| 347 | 349 | ||
| 348 | status = | 350 | status = acpi_ns_handle_to_pathname((acpi_handle) node, &path_buffer, FALSE); |
| 349 | acpi_ns_handle_to_pathname((acpi_handle) | ||
| 350 | node, | ||
| 351 | &path_buffer, | ||
| 352 | FALSE); | ||
| 353 | 351 | ||
| 354 | /* +1 to include null terminator */ | 352 | /* +1 to include null terminator */ |
| 355 | 353 | ||
| @@ -371,8 +369,8 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 371 | 369 | ||
| 372 | case ACPI_TYPE_INTEGER: | 370 | case ACPI_TYPE_INTEGER: |
| 373 | /* | 371 | /* |
| 374 | * If this is a number, then the Source Name is NULL, since the | 372 | * If this is a number, then the Source Name is NULL, since |
| 375 | * entire buffer was zeroed out, we can leave this alone. | 373 | * the entire buffer was zeroed out, we can leave this alone. |
| 376 | * | 374 | * |
| 377 | * Add to the Length field the length of the u32 NULL | 375 | * Add to the Length field the length of the u32 NULL |
| 378 | */ | 376 | */ |
| @@ -451,9 +449,9 @@ acpi_rs_create_aml_resources(struct acpi_buffer *resource_list, | |||
| 451 | 449 | ||
| 452 | /* Get the buffer size needed for the AML byte stream */ | 450 | /* Get the buffer size needed for the AML byte stream */ |
| 453 | 451 | ||
| 454 | status = acpi_rs_get_aml_length(resource_list->pointer, | 452 | status = |
| 455 | resource_list->length, | 453 | acpi_rs_get_aml_length(resource_list->pointer, |
| 456 | &aml_size_needed); | 454 | resource_list->length, &aml_size_needed); |
| 457 | 455 | ||
| 458 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", | 456 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", |
| 459 | (u32)aml_size_needed, acpi_format_exception(status))); | 457 | (u32)aml_size_needed, acpi_format_exception(status))); |
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c index 2a09288e7c57..05cc560699e1 100644 --- a/drivers/acpi/acpica/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c | |||
| @@ -483,6 +483,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) | |||
| 483 | 483 | ||
| 484 | static void acpi_rs_out_string(char *title, char *value) | 484 | static void acpi_rs_out_string(char *title, char *value) |
| 485 | { | 485 | { |
| 486 | |||
| 486 | acpi_os_printf("%27s : %s", title, value); | 487 | acpi_os_printf("%27s : %s", title, value); |
| 487 | if (!*value) { | 488 | if (!*value) { |
| 488 | acpi_os_printf("[NULL NAMESTRING]"); | 489 | acpi_os_printf("[NULL NAMESTRING]"); |
| @@ -497,21 +498,25 @@ static void acpi_rs_out_integer8(char *title, u8 value) | |||
| 497 | 498 | ||
| 498 | static void acpi_rs_out_integer16(char *title, u16 value) | 499 | static void acpi_rs_out_integer16(char *title, u16 value) |
| 499 | { | 500 | { |
| 501 | |||
| 500 | acpi_os_printf("%27s : %4.4X\n", title, value); | 502 | acpi_os_printf("%27s : %4.4X\n", title, value); |
| 501 | } | 503 | } |
| 502 | 504 | ||
| 503 | static void acpi_rs_out_integer32(char *title, u32 value) | 505 | static void acpi_rs_out_integer32(char *title, u32 value) |
| 504 | { | 506 | { |
| 507 | |||
| 505 | acpi_os_printf("%27s : %8.8X\n", title, value); | 508 | acpi_os_printf("%27s : %8.8X\n", title, value); |
| 506 | } | 509 | } |
| 507 | 510 | ||
| 508 | static void acpi_rs_out_integer64(char *title, u64 value) | 511 | static void acpi_rs_out_integer64(char *title, u64 value) |
| 509 | { | 512 | { |
| 513 | |||
| 510 | acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); | 514 | acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); |
| 511 | } | 515 | } |
| 512 | 516 | ||
| 513 | static void acpi_rs_out_title(char *title) | 517 | static void acpi_rs_out_title(char *title) |
| 514 | { | 518 | { |
| 519 | |||
| 515 | acpi_os_printf("%27s : ", title); | 520 | acpi_os_printf("%27s : ", title); |
| 516 | } | 521 | } |
| 517 | 522 | ||
| @@ -544,6 +549,7 @@ static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) | |||
| 544 | for (i = 0; i < length; i++) { | 549 | for (i = 0; i < length; i++) { |
| 545 | acpi_os_printf("%X ", data[i]); | 550 | acpi_os_printf("%X ", data[i]); |
| 546 | } | 551 | } |
| 552 | |||
| 547 | acpi_os_printf("\n"); | 553 | acpi_os_printf("\n"); |
| 548 | } | 554 | } |
| 549 | 555 | ||
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c index 50d5be2ee062..286ccb461a20 100644 --- a/drivers/acpi/acpica/rslist.c +++ b/drivers/acpi/acpica/rslist.c | |||
| @@ -89,6 +89,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml, | |||
| 89 | /* Get the appropriate conversion info table */ | 89 | /* Get the appropriate conversion info table */ |
| 90 | 90 | ||
| 91 | aml_resource = ACPI_CAST_PTR(union aml_resource, aml); | 91 | aml_resource = ACPI_CAST_PTR(union aml_resource, aml); |
| 92 | |||
| 92 | if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) { | 93 | if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) { |
| 93 | if (aml_resource->common_serial_bus.type > | 94 | if (aml_resource->common_serial_bus.type > |
| 94 | AML_RESOURCE_MAX_SERIALBUSTYPE) { | 95 | AML_RESOURCE_MAX_SERIALBUSTYPE) { |
| @@ -225,10 +226,10 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
| 225 | 226 | ||
| 226 | /* Perform final sanity check on the new AML resource descriptor */ | 227 | /* Perform final sanity check on the new AML resource descriptor */ |
| 227 | 228 | ||
| 228 | status = acpi_ut_validate_resource(NULL, | 229 | status = |
| 229 | ACPI_CAST_PTR(union | 230 | acpi_ut_validate_resource(NULL, |
| 230 | aml_resource, | 231 | ACPI_CAST_PTR(union aml_resource, |
| 231 | aml), NULL); | 232 | aml), NULL); |
| 232 | if (ACPI_FAILURE(status)) { | 233 | if (ACPI_FAILURE(status)) { |
| 233 | return_ACPI_STATUS(status); | 234 | return_ACPI_STATUS(status); |
| 234 | } | 235 | } |
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index ac37852e0821..b112c7b1abbf 100644 --- a/drivers/acpi/acpica/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c | |||
| @@ -189,8 +189,8 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
| 189 | item_count = ACPI_GET8(source); | 189 | item_count = ACPI_GET8(source); |
| 190 | ACPI_SET8(destination, item_count); | 190 | ACPI_SET8(destination, item_count); |
| 191 | 191 | ||
| 192 | resource->length = resource->length + | 192 | resource->length = |
| 193 | (info->value * item_count); | 193 | resource->length + (info->value * item_count); |
| 194 | break; | 194 | break; |
| 195 | 195 | ||
| 196 | case ACPI_RSC_COUNT_GPIO_RES: | 196 | case ACPI_RSC_COUNT_GPIO_RES: |
| @@ -445,8 +445,8 @@ exit: | |||
| 445 | 445 | ||
| 446 | /* Round the resource struct length up to the next boundary (32 or 64) */ | 446 | /* Round the resource struct length up to the next boundary (32 or 64) */ |
| 447 | 447 | ||
| 448 | resource->length = | 448 | resource->length = (u32) |
| 449 | (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); | 449 | ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); |
| 450 | } | 450 | } |
| 451 | return_ACPI_STATUS(AE_OK); | 451 | return_ACPI_STATUS(AE_OK); |
| 452 | } | 452 | } |
| @@ -550,9 +550,8 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
| 550 | item_count = ACPI_GET8(source); | 550 | item_count = ACPI_GET8(source); |
| 551 | ACPI_SET8(destination, item_count); | 551 | ACPI_SET8(destination, item_count); |
| 552 | 552 | ||
| 553 | aml_length = | 553 | aml_length = (u16) |
| 554 | (u16) (aml_length + | 554 | (aml_length + (info->value * (item_count - 1))); |
| 555 | (info->value * (item_count - 1))); | ||
| 556 | break; | 555 | break; |
| 557 | 556 | ||
| 558 | case ACPI_RSC_COUNT16: | 557 | case ACPI_RSC_COUNT16: |
| @@ -723,11 +722,10 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
| 723 | /* | 722 | /* |
| 724 | * 16-bit encoded bitmask (IRQ macro) | 723 | * 16-bit encoded bitmask (IRQ macro) |
| 725 | */ | 724 | */ |
| 726 | temp16 = acpi_rs_encode_bitmask(source, | 725 | temp16 = |
| 727 | *ACPI_ADD_PTR(u8, | 726 | acpi_rs_encode_bitmask(source, |
| 728 | resource, | 727 | *ACPI_ADD_PTR(u8, resource, |
| 729 | info-> | 728 | info->value)); |
| 730 | value)); | ||
| 731 | ACPI_MOVE_16_TO_16(destination, &temp16); | 729 | ACPI_MOVE_16_TO_16(destination, &temp16); |
| 732 | break; | 730 | break; |
| 733 | 731 | ||
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index 9486992edbb8..33e558c9434f 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
| @@ -221,14 +221,13 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, | |||
| 221 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, | 221 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, |
| 222 | &resource_length); | 222 | &resource_length); |
| 223 | } else { | 223 | } else { |
| 224 | /* Small descriptor -- bits 2:0 of byte 0 contain the length */ | 224 | /* |
| 225 | 225 | * Small descriptor -- bits 2:0 of byte 0 contain the length | |
| 226 | * Clear any existing length, preserving descriptor type bits | ||
| 227 | */ | ||
| 226 | aml->small_header.descriptor_type = (u8) | 228 | aml->small_header.descriptor_type = (u8) |
| 227 | 229 | ((aml->small_header.descriptor_type & | |
| 228 | /* Clear any existing length, preserving descriptor type bits */ | 230 | ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) |
| 229 | ((aml->small_header. | ||
| 230 | descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) | ||
| 231 | |||
| 232 | | resource_length); | 231 | | resource_length); |
| 233 | } | 232 | } |
| 234 | } | 233 | } |
| @@ -333,8 +332,8 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
| 333 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); | 332 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); |
| 334 | 333 | ||
| 335 | /* | 334 | /* |
| 336 | * resource_source is present if the length of the descriptor is longer than | 335 | * resource_source is present if the length of the descriptor is longer |
| 337 | * the minimum length. | 336 | * than the minimum length. |
| 338 | * | 337 | * |
| 339 | * Note: Some resource descriptors will have an additional null, so | 338 | * Note: Some resource descriptors will have an additional null, so |
| 340 | * we add 1 to the minimum length. | 339 | * we add 1 to the minimum length. |
| @@ -366,6 +365,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
| 366 | total_length = | 365 | total_length = |
| 367 | (u32)strlen(ACPI_CAST_PTR(char, &aml_resource_source[1])) + | 366 | (u32)strlen(ACPI_CAST_PTR(char, &aml_resource_source[1])) + |
| 368 | 1; | 367 | 1; |
| 368 | |||
| 369 | total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); | 369 | total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); |
| 370 | 370 | ||
| 371 | memset(resource_source->string_ptr, 0, total_length); | 371 | memset(resource_source->string_ptr, 0, total_length); |
| @@ -438,8 +438,8 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
| 438 | * Add the length of the string (+ 1 for null terminator) to the | 438 | * Add the length of the string (+ 1 for null terminator) to the |
| 439 | * final descriptor length | 439 | * final descriptor length |
| 440 | */ | 440 | */ |
| 441 | descriptor_length += | 441 | descriptor_length += ((acpi_rsdesc_size) |
| 442 | ((acpi_rsdesc_size) resource_source->string_length + 1); | 442 | resource_source->string_length + 1); |
| 443 | } | 443 | } |
| 444 | 444 | ||
| 445 | /* Return the new total length of the AML descriptor */ | 445 | /* Return the new total length of the AML descriptor */ |
| @@ -478,8 +478,9 @@ acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, | |||
| 478 | 478 | ||
| 479 | /* Execute the method, no parameters */ | 479 | /* Execute the method, no parameters */ |
| 480 | 480 | ||
| 481 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT, | 481 | status = |
| 482 | ACPI_BTYPE_PACKAGE, &obj_desc); | 482 | acpi_ut_evaluate_object(node, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE, |
| 483 | &obj_desc); | ||
| 483 | if (ACPI_FAILURE(status)) { | 484 | if (ACPI_FAILURE(status)) { |
| 484 | return_ACPI_STATUS(status); | 485 | return_ACPI_STATUS(status); |
| 485 | } | 486 | } |
| @@ -527,8 +528,9 @@ acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, | |||
| 527 | 528 | ||
| 528 | /* Execute the method, no parameters */ | 529 | /* Execute the method, no parameters */ |
| 529 | 530 | ||
| 530 | status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS, | 531 | status = |
| 531 | ACPI_BTYPE_BUFFER, &obj_desc); | 532 | acpi_ut_evaluate_object(node, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER, |
| 533 | &obj_desc); | ||
| 532 | if (ACPI_FAILURE(status)) { | 534 | if (ACPI_FAILURE(status)) { |
| 533 | return_ACPI_STATUS(status); | 535 | return_ACPI_STATUS(status); |
| 534 | } | 536 | } |
| @@ -577,8 +579,9 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, | |||
| 577 | 579 | ||
| 578 | /* Execute the method, no parameters */ | 580 | /* Execute the method, no parameters */ |
| 579 | 581 | ||
| 580 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS, | 582 | status = |
| 581 | ACPI_BTYPE_BUFFER, &obj_desc); | 583 | acpi_ut_evaluate_object(node, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER, |
| 584 | &obj_desc); | ||
| 582 | if (ACPI_FAILURE(status)) { | 585 | if (ACPI_FAILURE(status)) { |
| 583 | return_ACPI_STATUS(status); | 586 | return_ACPI_STATUS(status); |
| 584 | } | 587 | } |
| @@ -627,8 +630,9 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node, | |||
| 627 | 630 | ||
| 628 | /* Execute the method, no parameters */ | 631 | /* Execute the method, no parameters */ |
| 629 | 632 | ||
| 630 | status = acpi_ut_evaluate_object(node, METHOD_NAME__AEI, | 633 | status = |
| 631 | ACPI_BTYPE_BUFFER, &obj_desc); | 634 | acpi_ut_evaluate_object(node, METHOD_NAME__AEI, ACPI_BTYPE_BUFFER, |
| 635 | &obj_desc); | ||
| 632 | if (ACPI_FAILURE(status)) { | 636 | if (ACPI_FAILURE(status)) { |
| 633 | return_ACPI_STATUS(status); | 637 | return_ACPI_STATUS(status); |
| 634 | } | 638 | } |
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 1e8cd5723326..308bfd6bff5f 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
| @@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsxface") | |||
| 53 | 53 | ||
| 54 | /* Local macros for 16,32-bit to 64-bit conversion */ | 54 | /* Local macros for 16,32-bit to 64-bit conversion */ |
| 55 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) | 55 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) |
| 56 | #define ACPI_COPY_ADDRESS(out, in) \ | 56 | #define ACPI_COPY_ADDRESS(out, in) \ |
| 57 | ACPI_COPY_FIELD(out, in, resource_type); \ | 57 | ACPI_COPY_FIELD(out, in, resource_type); \ |
| 58 | ACPI_COPY_FIELD(out, in, producer_consumer); \ | 58 | ACPI_COPY_FIELD(out, in, producer_consumer); \ |
| 59 | ACPI_COPY_FIELD(out, in, decode); \ | 59 | ACPI_COPY_FIELD(out, in, decode); \ |
diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c index 5c9d5abf1588..4a8152777767 100644 --- a/drivers/acpi/acpica/tbdata.c +++ b/drivers/acpi/acpica/tbdata.c | |||
| @@ -407,6 +407,7 @@ acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature) | |||
| 407 | table_desc->signature.ascii : "????", | 407 | table_desc->signature.ascii : "????", |
| 408 | ACPI_FORMAT_UINT64(table_desc-> | 408 | ACPI_FORMAT_UINT64(table_desc-> |
| 409 | address))); | 409 | address))); |
| 410 | |||
| 410 | goto invalidate_and_exit; | 411 | goto invalidate_and_exit; |
| 411 | } | 412 | } |
| 412 | } | 413 | } |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 6319b42420c6..bd87801acedf 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
| @@ -337,8 +337,8 @@ acpi_tb_install_standard_table(acpi_physical_address address, | |||
| 337 | * need to be unregistered when they are unloaded, and slots in the | 337 | * need to be unregistered when they are unloaded, and slots in the |
| 338 | * root table list should be reused when empty. | 338 | * root table list should be reused when empty. |
| 339 | */ | 339 | */ |
| 340 | if (acpi_gbl_root_table_list.tables[i]. | 340 | if (acpi_gbl_root_table_list.tables[i].flags & |
| 341 | flags & ACPI_TABLE_IS_LOADED) { | 341 | ACPI_TABLE_IS_LOADED) { |
| 342 | 342 | ||
| 343 | /* Table is still loaded, this is an error */ | 343 | /* Table is still loaded, this is an error */ |
| 344 | 344 | ||
diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c index 709d5112fc16..d0d12596cfc9 100644 --- a/drivers/acpi/acpica/tbprint.c +++ b/drivers/acpi/acpica/tbprint.c | |||
| @@ -76,6 +76,7 @@ static void acpi_tb_fix_string(char *string, acpi_size length) | |||
| 76 | if (!isprint((int)*string)) { | 76 | if (!isprint((int)*string)) { |
| 77 | *string = '?'; | 77 | *string = '?'; |
| 78 | } | 78 | } |
| 79 | |||
| 79 | string++; | 80 | string++; |
| 80 | length--; | 81 | length--; |
| 81 | } | 82 | } |
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index d8ddef38c947..7c1b5f8a5cbf 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
| @@ -121,6 +121,7 @@ void acpi_tb_check_dsdt_header(void) | |||
| 121 | ACPI_BIOS_ERROR((AE_INFO, | 121 | ACPI_BIOS_ERROR((AE_INFO, |
| 122 | "The DSDT has been corrupted or replaced - " | 122 | "The DSDT has been corrupted or replaced - " |
| 123 | "old, new headers below")); | 123 | "old, new headers below")); |
| 124 | |||
| 124 | acpi_tb_print_table_header(0, &acpi_gbl_original_dsdt_header); | 125 | acpi_tb_print_table_header(0, &acpi_gbl_original_dsdt_header); |
| 125 | acpi_tb_print_table_header(0, acpi_gbl_DSDT); | 126 | acpi_tb_print_table_header(0, acpi_gbl_DSDT); |
| 126 | 127 | ||
| @@ -379,7 +380,6 @@ next_table: | |||
| 379 | } | 380 | } |
| 380 | 381 | ||
| 381 | acpi_os_unmap_memory(table, length); | 382 | acpi_os_unmap_memory(table, length); |
| 382 | |||
| 383 | return_ACPI_STATUS(AE_OK); | 383 | return_ACPI_STATUS(AE_OK); |
| 384 | } | 384 | } |
| 385 | 385 | ||
| @@ -389,7 +389,7 @@ next_table: | |||
| 389 | * | 389 | * |
| 390 | * PARAMETERS: signature - Sig string to be validated | 390 | * PARAMETERS: signature - Sig string to be validated |
| 391 | * | 391 | * |
| 392 | * RETURN: TRUE if signature is correct length and has valid characters | 392 | * RETURN: TRUE if signature is has 4 valid ACPI characters |
| 393 | * | 393 | * |
| 394 | * DESCRIPTION: Validate an ACPI table signature. | 394 | * DESCRIPTION: Validate an ACPI table signature. |
| 395 | * | 395 | * |
| @@ -399,12 +399,6 @@ u8 acpi_is_valid_signature(char *signature) | |||
| 399 | { | 399 | { |
| 400 | u32 i; | 400 | u32 i; |
| 401 | 401 | ||
| 402 | /* Validate the signature length */ | ||
| 403 | |||
| 404 | if (strlen(signature) != ACPI_NAME_SIZE) { | ||
| 405 | return (FALSE); | ||
| 406 | } | ||
| 407 | |||
| 408 | /* Validate each character in the signature */ | 402 | /* Validate each character in the signature */ |
| 409 | 403 | ||
| 410 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 404 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index 55ee14ca9418..ca2f1366b498 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c | |||
| @@ -191,6 +191,7 @@ acpi_status acpi_tb_load_namespace(void) | |||
| 191 | "(%4.4s:%8.8s) while loading table", | 191 | "(%4.4s:%8.8s) while loading table", |
| 192 | table->signature.ascii, | 192 | table->signature.ascii, |
| 193 | table->pointer->oem_table_id)); | 193 | table->pointer->oem_table_id)); |
| 194 | |||
| 194 | tables_failed++; | 195 | tables_failed++; |
| 195 | 196 | ||
| 196 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 197 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
| @@ -206,7 +207,7 @@ acpi_status acpi_tb_load_namespace(void) | |||
| 206 | 207 | ||
| 207 | if (!tables_failed) { | 208 | if (!tables_failed) { |
| 208 | ACPI_INFO((AE_INFO, | 209 | ACPI_INFO((AE_INFO, |
| 209 | "%u ACPI AML tables successfully acquired and loaded", | 210 | "%u ACPI AML tables successfully acquired and loaded\n", |
| 210 | tables_loaded)); | 211 | tables_loaded)); |
| 211 | } else { | 212 | } else { |
| 212 | ACPI_ERROR((AE_INFO, | 213 | ACPI_ERROR((AE_INFO, |
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c index 911ea8e7fe87..38a29e235b74 100644 --- a/drivers/acpi/acpica/utaddress.c +++ b/drivers/acpi/acpica/utaddress.c | |||
| @@ -239,8 +239,9 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, | |||
| 239 | overlap_count++; | 239 | overlap_count++; |
| 240 | if (warn) { /* Optional warning message */ | 240 | if (warn) { /* Optional warning message */ |
| 241 | pathname = | 241 | pathname = |
| 242 | acpi_ns_get_external_pathname(range_info-> | 242 | acpi_ns_get_normalized_pathname(range_info-> |
| 243 | region_node); | 243 | region_node, |
| 244 | TRUE); | ||
| 244 | 245 | ||
| 245 | ACPI_WARNING((AE_INFO, | 246 | ACPI_WARNING((AE_INFO, |
| 246 | "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", | 247 | "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", |
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index 257221d452c8..ade8acf3f3a5 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
| @@ -257,9 +257,9 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type, | |||
| 257 | ACPI_FUNCTION_ENTRY(); | 257 | ACPI_FUNCTION_ENTRY(); |
| 258 | 258 | ||
| 259 | this_index = state->pkg.index; | 259 | this_index = state->pkg.index; |
| 260 | target_object = (union acpi_object *) | 260 | target_object = (union acpi_object *)&((union acpi_object *) |
| 261 | &((union acpi_object *)(state->pkg.dest_object))->package. | 261 | (state->pkg.dest_object))-> |
| 262 | elements[this_index]; | 262 | package.elements[this_index]; |
| 263 | 263 | ||
| 264 | switch (object_type) { | 264 | switch (object_type) { |
| 265 | case ACPI_COPY_TYPE_SIMPLE: | 265 | case ACPI_COPY_TYPE_SIMPLE: |
| @@ -348,15 +348,15 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, | |||
| 348 | * Free space begins right after the first package | 348 | * Free space begins right after the first package |
| 349 | */ | 349 | */ |
| 350 | info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); | 350 | info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); |
| 351 | info.free_space = | 351 | info.free_space = buffer + |
| 352 | buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); | 352 | ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); |
| 353 | info.object_space = 0; | 353 | info.object_space = 0; |
| 354 | info.num_packages = 1; | 354 | info.num_packages = 1; |
| 355 | 355 | ||
| 356 | external_object->type = internal_object->common.type; | 356 | external_object->type = internal_object->common.type; |
| 357 | external_object->package.count = internal_object->package.count; | 357 | external_object->package.count = internal_object->package.count; |
| 358 | external_object->package.elements = ACPI_CAST_PTR(union acpi_object, | 358 | external_object->package.elements = |
| 359 | info.free_space); | 359 | ACPI_CAST_PTR(union acpi_object, info.free_space); |
| 360 | 360 | ||
| 361 | /* | 361 | /* |
| 362 | * Leave room for an array of ACPI_OBJECTS in the buffer | 362 | * Leave room for an array of ACPI_OBJECTS in the buffer |
| @@ -593,8 +593,8 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, | |||
| 593 | package_elements = package_object->package.elements; | 593 | package_elements = package_object->package.elements; |
| 594 | 594 | ||
| 595 | /* | 595 | /* |
| 596 | * Recursive implementation. Probably ok, since nested external packages | 596 | * Recursive implementation. Probably ok, since nested external |
| 597 | * as parameters should be very rare. | 597 | * packages as parameters should be very rare. |
| 598 | */ | 598 | */ |
| 599 | for (i = 0; i < external_object->package.count; i++) { | 599 | for (i = 0; i < external_object->package.count; i++) { |
| 600 | status = | 600 | status = |
| @@ -649,9 +649,8 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, | |||
| 649 | /* | 649 | /* |
| 650 | * Build a simple object (no nested objects) | 650 | * Build a simple object (no nested objects) |
| 651 | */ | 651 | */ |
| 652 | status = | 652 | status = acpi_ut_copy_esimple_to_isimple(external_object, |
| 653 | acpi_ut_copy_esimple_to_isimple(external_object, | 653 | internal_object); |
| 654 | internal_object); | ||
| 655 | } | 654 | } |
| 656 | 655 | ||
| 657 | return_ACPI_STATUS(status); | 656 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c index ecaaaffc0788..3533135dbd4d 100644 --- a/drivers/acpi/acpica/utdecode.c +++ b/drivers/acpi/acpica/utdecode.c | |||
| @@ -114,7 +114,7 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | |||
| 114 | "PCC" /* 0x0A */ | 114 | "PCC" /* 0x0A */ |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | char *acpi_ut_get_region_name(u8 space_id) | 117 | const char *acpi_ut_get_region_name(u8 space_id) |
| 118 | { | 118 | { |
| 119 | 119 | ||
| 120 | if (space_id >= ACPI_USER_REGION_BEGIN) { | 120 | if (space_id >= ACPI_USER_REGION_BEGIN) { |
| @@ -127,7 +127,7 @@ char *acpi_ut_get_region_name(u8 space_id) | |||
| 127 | return ("InvalidSpaceId"); | 127 | return ("InvalidSpaceId"); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); | 130 | return (acpi_gbl_region_types[space_id]); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | /******************************************************************************* | 133 | /******************************************************************************* |
| @@ -152,14 +152,14 @@ static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { | |||
| 152 | "RealTimeClock", | 152 | "RealTimeClock", |
| 153 | }; | 153 | }; |
| 154 | 154 | ||
| 155 | char *acpi_ut_get_event_name(u32 event_id) | 155 | const char *acpi_ut_get_event_name(u32 event_id) |
| 156 | { | 156 | { |
| 157 | 157 | ||
| 158 | if (event_id > ACPI_EVENT_MAX) { | 158 | if (event_id > ACPI_EVENT_MAX) { |
| 159 | return ("InvalidEventID"); | 159 | return ("InvalidEventID"); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); | 162 | return (acpi_gbl_event_types[event_id]); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | /******************************************************************************* | 165 | /******************************************************************************* |
| @@ -180,7 +180,8 @@ char *acpi_ut_get_event_name(u32 event_id) | |||
| 180 | * | 180 | * |
| 181 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; | 181 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; |
| 182 | * when stored in a table it really means that we have thus far seen no | 182 | * when stored in a table it really means that we have thus far seen no |
| 183 | * evidence to indicate what type is actually going to be stored for this entry. | 183 | * evidence to indicate what type is actually going to be stored for this |
| 184 | & entry. | ||
| 184 | */ | 185 | */ |
| 185 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; | 186 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; |
| 186 | 187 | ||
| @@ -220,17 +221,17 @@ static const char *acpi_gbl_ns_type_names[] = { | |||
| 220 | /* 30 */ "Invalid" | 221 | /* 30 */ "Invalid" |
| 221 | }; | 222 | }; |
| 222 | 223 | ||
| 223 | char *acpi_ut_get_type_name(acpi_object_type type) | 224 | const char *acpi_ut_get_type_name(acpi_object_type type) |
| 224 | { | 225 | { |
| 225 | 226 | ||
| 226 | if (type > ACPI_TYPE_INVALID) { | 227 | if (type > ACPI_TYPE_INVALID) { |
| 227 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); | 228 | return (acpi_gbl_bad_type); |
| 228 | } | 229 | } |
| 229 | 230 | ||
| 230 | return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); | 231 | return (acpi_gbl_ns_type_names[type]); |
| 231 | } | 232 | } |
| 232 | 233 | ||
| 233 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) | 234 | const char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) |
| 234 | { | 235 | { |
| 235 | ACPI_FUNCTION_TRACE(ut_get_object_type_name); | 236 | ACPI_FUNCTION_TRACE(ut_get_object_type_name); |
| 236 | 237 | ||
| @@ -267,7 +268,7 @@ char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) | |||
| 267 | * | 268 | * |
| 268 | ******************************************************************************/ | 269 | ******************************************************************************/ |
| 269 | 270 | ||
| 270 | char *acpi_ut_get_node_name(void *object) | 271 | const char *acpi_ut_get_node_name(void *object) |
| 271 | { | 272 | { |
| 272 | struct acpi_namespace_node *node = (struct acpi_namespace_node *)object; | 273 | struct acpi_namespace_node *node = (struct acpi_namespace_node *)object; |
| 273 | 274 | ||
| @@ -333,7 +334,7 @@ static const char *acpi_gbl_desc_type_names[] = { | |||
| 333 | /* 15 */ "Node" | 334 | /* 15 */ "Node" |
| 334 | }; | 335 | }; |
| 335 | 336 | ||
| 336 | char *acpi_ut_get_descriptor_name(void *object) | 337 | const char *acpi_ut_get_descriptor_name(void *object) |
| 337 | { | 338 | { |
| 338 | 339 | ||
| 339 | if (!object) { | 340 | if (!object) { |
| @@ -344,10 +345,7 @@ char *acpi_ut_get_descriptor_name(void *object) | |||
| 344 | return ("Not a Descriptor"); | 345 | return ("Not a Descriptor"); |
| 345 | } | 346 | } |
| 346 | 347 | ||
| 347 | return (ACPI_CAST_PTR(char, | 348 | return (acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); |
| 348 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE | ||
| 349 | (object)])); | ||
| 350 | |||
| 351 | } | 349 | } |
| 352 | 350 | ||
| 353 | /******************************************************************************* | 351 | /******************************************************************************* |
| @@ -415,7 +413,7 @@ const char *acpi_ut_get_reference_name(union acpi_operand_object *object) | |||
| 415 | 413 | ||
| 416 | /* Names for internal mutex objects, used for debug output */ | 414 | /* Names for internal mutex objects, used for debug output */ |
| 417 | 415 | ||
| 418 | static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { | 416 | static const char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { |
| 419 | "ACPI_MTX_Interpreter", | 417 | "ACPI_MTX_Interpreter", |
| 420 | "ACPI_MTX_Namespace", | 418 | "ACPI_MTX_Namespace", |
| 421 | "ACPI_MTX_Tables", | 419 | "ACPI_MTX_Tables", |
| @@ -424,7 +422,7 @@ static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { | |||
| 424 | "ACPI_MTX_Memory", | 422 | "ACPI_MTX_Memory", |
| 425 | }; | 423 | }; |
| 426 | 424 | ||
| 427 | char *acpi_ut_get_mutex_name(u32 mutex_id) | 425 | const char *acpi_ut_get_mutex_name(u32 mutex_id) |
| 428 | { | 426 | { |
| 429 | 427 | ||
| 430 | if (mutex_id > ACPI_MAX_MUTEX) { | 428 | if (mutex_id > ACPI_MAX_MUTEX) { |
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index 1638312e3d8f..1afd7427a90c 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
| @@ -209,6 +209,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
| 209 | acpi_ut_delete_object_desc(object->method.mutex); | 209 | acpi_ut_delete_object_desc(object->method.mutex); |
| 210 | object->method.mutex = NULL; | 210 | object->method.mutex = NULL; |
| 211 | } | 211 | } |
| 212 | |||
| 212 | if (object->method.node) { | 213 | if (object->method.node) { |
| 213 | object->method.node = NULL; | 214 | object->method.node = NULL; |
| 214 | } | 215 | } |
| @@ -515,8 +516,8 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
| 515 | } | 516 | } |
| 516 | 517 | ||
| 517 | /* | 518 | /* |
| 518 | * All sub-objects must have their reference count incremented also. | 519 | * All sub-objects must have their reference count incremented |
| 519 | * Different object types have different subobjects. | 520 | * also. Different object types have different subobjects. |
| 520 | */ | 521 | */ |
| 521 | switch (object->common.type) { | 522 | switch (object->common.type) { |
| 522 | case ACPI_TYPE_DEVICE: | 523 | case ACPI_TYPE_DEVICE: |
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c index 9ef80f2828e3..f93bb90ea72a 100644 --- a/drivers/acpi/acpica/uterror.c +++ b/drivers/acpi/acpica/uterror.c | |||
| @@ -217,8 +217,9 @@ acpi_ut_namespace_error(const char *module_name, | |||
| 217 | } else { | 217 | } else { |
| 218 | /* Convert path to external format */ | 218 | /* Convert path to external format */ |
| 219 | 219 | ||
| 220 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | 220 | status = |
| 221 | internal_name, NULL, &name); | 221 | acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_name, |
| 222 | NULL, &name); | ||
| 222 | 223 | ||
| 223 | /* Print target name */ | 224 | /* Print target name */ |
| 224 | 225 | ||
| @@ -271,9 +272,8 @@ acpi_ut_method_error(const char *module_name, | |||
| 271 | acpi_os_printf(ACPI_MSG_ERROR); | 272 | acpi_os_printf(ACPI_MSG_ERROR); |
| 272 | 273 | ||
| 273 | if (path) { | 274 | if (path) { |
| 274 | status = | 275 | status = acpi_ns_get_node(prefix_node, path, |
| 275 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | 276 | ACPI_NS_NO_UPSEARCH, &node); |
| 276 | &node); | ||
| 277 | if (ACPI_FAILURE(status)) { | 277 | if (ACPI_FAILURE(status)) { |
| 278 | acpi_os_printf("[Could not get node by pathname]"); | 278 | acpi_os_printf("[Could not get node by pathname]"); |
| 279 | } | 279 | } |
diff --git a/drivers/acpi/acpica/utfileio.c b/drivers/acpi/acpica/utfileio.c deleted file mode 100644 index d435b7b7eb94..000000000000 --- a/drivers/acpi/acpica/utfileio.c +++ /dev/null | |||
| @@ -1,334 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * | ||
| 3 | * Module Name: utfileio - simple file I/O routines | ||
| 4 | * | ||
| 5 | ******************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2015, Intel Corp. | ||
| 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 | #include <acpi/acpi.h> | ||
| 45 | #include "accommon.h" | ||
| 46 | #include "actables.h" | ||
| 47 | #include "acapps.h" | ||
| 48 | #include "errno.h" | ||
| 49 | |||
| 50 | #ifdef ACPI_ASL_COMPILER | ||
| 51 | #include "aslcompiler.h" | ||
| 52 | #endif | ||
| 53 | |||
| 54 | #define _COMPONENT ACPI_CA_DEBUGGER | ||
| 55 | ACPI_MODULE_NAME("utfileio") | ||
| 56 | |||
| 57 | #ifdef ACPI_APPLICATION | ||
| 58 | /* Local prototypes */ | ||
| 59 | static acpi_status | ||
| 60 | acpi_ut_check_text_mode_corruption(u8 *table, | ||
| 61 | u32 table_length, u32 file_length); | ||
| 62 | |||
| 63 | static acpi_status | ||
| 64 | acpi_ut_read_table(FILE * fp, | ||
| 65 | struct acpi_table_header **table, u32 *table_length); | ||
| 66 | |||
| 67 | /******************************************************************************* | ||
| 68 | * | ||
| 69 | * FUNCTION: acpi_ut_check_text_mode_corruption | ||
| 70 | * | ||
| 71 | * PARAMETERS: table - Table buffer | ||
| 72 | * table_length - Length of table from the table header | ||
| 73 | * file_length - Length of the file that contains the table | ||
| 74 | * | ||
| 75 | * RETURN: Status | ||
| 76 | * | ||
| 77 | * DESCRIPTION: Check table for text mode file corruption where all linefeed | ||
| 78 | * characters (LF) have been replaced by carriage return linefeed | ||
| 79 | * pairs (CR/LF). | ||
| 80 | * | ||
| 81 | ******************************************************************************/ | ||
| 82 | |||
| 83 | static acpi_status | ||
| 84 | acpi_ut_check_text_mode_corruption(u8 *table, u32 table_length, u32 file_length) | ||
| 85 | { | ||
| 86 | u32 i; | ||
| 87 | u32 pairs = 0; | ||
| 88 | |||
| 89 | if (table_length != file_length) { | ||
| 90 | ACPI_WARNING((AE_INFO, | ||
| 91 | "File length (0x%X) is not the same as the table length (0x%X)", | ||
| 92 | file_length, table_length)); | ||
| 93 | } | ||
| 94 | |||
| 95 | /* Scan entire table to determine if each LF has been prefixed with a CR */ | ||
| 96 | |||
| 97 | for (i = 1; i < file_length; i++) { | ||
| 98 | if (table[i] == 0x0A) { | ||
| 99 | if (table[i - 1] != 0x0D) { | ||
| 100 | |||
| 101 | /* The LF does not have a preceding CR, table not corrupted */ | ||
| 102 | |||
| 103 | return (AE_OK); | ||
| 104 | } else { | ||
| 105 | /* Found a CR/LF pair */ | ||
| 106 | |||
| 107 | pairs++; | ||
| 108 | } | ||
| 109 | i++; | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | if (!pairs) { | ||
| 114 | return (AE_OK); | ||
| 115 | } | ||
| 116 | |||
| 117 | /* | ||
| 118 | * Entire table scanned, each CR is part of a CR/LF pair -- | ||
| 119 | * meaning that the table was treated as a text file somewhere. | ||
| 120 | * | ||
| 121 | * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the | ||
| 122 | * original table are left untouched by the text conversion process -- | ||
| 123 | * meaning that we cannot simply replace CR/LF pairs with LFs. | ||
| 124 | */ | ||
| 125 | acpi_os_printf("Table has been corrupted by text mode conversion\n"); | ||
| 126 | acpi_os_printf("All LFs (%u) were changed to CR/LF pairs\n", pairs); | ||
| 127 | acpi_os_printf("Table cannot be repaired!\n"); | ||
| 128 | return (AE_BAD_VALUE); | ||
| 129 | } | ||
| 130 | |||
| 131 | /******************************************************************************* | ||
| 132 | * | ||
| 133 | * FUNCTION: acpi_ut_read_table | ||
| 134 | * | ||
| 135 | * PARAMETERS: fp - File that contains table | ||
| 136 | * table - Return value, buffer with table | ||
| 137 | * table_length - Return value, length of table | ||
| 138 | * | ||
| 139 | * RETURN: Status | ||
| 140 | * | ||
| 141 | * DESCRIPTION: Load the DSDT from the file pointer | ||
| 142 | * | ||
| 143 | ******************************************************************************/ | ||
| 144 | |||
| 145 | static acpi_status | ||
| 146 | acpi_ut_read_table(FILE * fp, | ||
| 147 | struct acpi_table_header **table, u32 *table_length) | ||
| 148 | { | ||
| 149 | struct acpi_table_header table_header; | ||
| 150 | u32 actual; | ||
| 151 | acpi_status status; | ||
| 152 | u32 file_size; | ||
| 153 | u8 standard_header = TRUE; | ||
| 154 | s32 count; | ||
| 155 | |||
| 156 | /* Get the file size */ | ||
| 157 | |||
| 158 | file_size = cm_get_file_size(fp); | ||
| 159 | if (file_size == ACPI_UINT32_MAX) { | ||
| 160 | return (AE_ERROR); | ||
| 161 | } | ||
| 162 | |||
| 163 | if (file_size < 4) { | ||
| 164 | return (AE_BAD_HEADER); | ||
| 165 | } | ||
| 166 | |||
| 167 | /* Read the signature */ | ||
| 168 | |||
| 169 | fseek(fp, 0, SEEK_SET); | ||
| 170 | |||
| 171 | count = fread(&table_header, 1, sizeof(struct acpi_table_header), fp); | ||
| 172 | if (count != sizeof(struct acpi_table_header)) { | ||
| 173 | acpi_os_printf("Could not read the table header\n"); | ||
| 174 | return (AE_BAD_HEADER); | ||
| 175 | } | ||
| 176 | |||
| 177 | /* The RSDP table does not have standard ACPI header */ | ||
| 178 | |||
| 179 | if (ACPI_VALIDATE_RSDP_SIG(table_header.signature)) { | ||
| 180 | *table_length = file_size; | ||
| 181 | standard_header = FALSE; | ||
| 182 | } else { | ||
| 183 | |||
| 184 | #if 0 | ||
| 185 | /* Validate the table header/length */ | ||
| 186 | |||
| 187 | status = acpi_tb_validate_table_header(&table_header); | ||
| 188 | if (ACPI_FAILURE(status)) { | ||
| 189 | acpi_os_printf("Table header is invalid!\n"); | ||
| 190 | return (status); | ||
| 191 | } | ||
| 192 | #endif | ||
| 193 | |||
| 194 | /* File size must be at least as long as the Header-specified length */ | ||
| 195 | |||
| 196 | if (table_header.length > file_size) { | ||
| 197 | acpi_os_printf | ||
| 198 | ("TableHeader length [0x%X] greater than the input file size [0x%X]\n", | ||
| 199 | table_header.length, file_size); | ||
| 200 | |||
| 201 | #ifdef ACPI_ASL_COMPILER | ||
| 202 | acpi_os_printf("File is corrupt or is ASCII text -- " | ||
| 203 | "it must be a binary file\n"); | ||
| 204 | #endif | ||
| 205 | return (AE_BAD_HEADER); | ||
| 206 | } | ||
| 207 | #ifdef ACPI_OBSOLETE_CODE | ||
| 208 | /* We only support a limited number of table types */ | ||
| 209 | |||
| 210 | if (!ACPI_COMPARE_NAME | ||
| 211 | ((char *)table_header.signature, ACPI_SIG_DSDT) | ||
| 212 | && !ACPI_COMPARE_NAME((char *)table_header.signature, | ||
| 213 | ACPI_SIG_PSDT) | ||
| 214 | && !ACPI_COMPARE_NAME((char *)table_header.signature, | ||
| 215 | ACPI_SIG_SSDT)) { | ||
| 216 | acpi_os_printf | ||
| 217 | ("Table signature [%4.4s] is invalid or not supported\n", | ||
| 218 | (char *)table_header.signature); | ||
| 219 | ACPI_DUMP_BUFFER(&table_header, | ||
| 220 | sizeof(struct acpi_table_header)); | ||
| 221 | return (AE_ERROR); | ||
| 222 | } | ||
| 223 | #endif | ||
| 224 | |||
| 225 | *table_length = table_header.length; | ||
| 226 | } | ||
| 227 | |||
| 228 | /* Allocate a buffer for the table */ | ||
| 229 | |||
| 230 | *table = acpi_os_allocate((size_t) file_size); | ||
| 231 | if (!*table) { | ||
| 232 | acpi_os_printf | ||
| 233 | ("Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", | ||
| 234 | table_header.signature, *table_length); | ||
| 235 | return (AE_NO_MEMORY); | ||
| 236 | } | ||
| 237 | |||
| 238 | /* Get the rest of the table */ | ||
| 239 | |||
| 240 | fseek(fp, 0, SEEK_SET); | ||
| 241 | actual = fread(*table, 1, (size_t) file_size, fp); | ||
| 242 | if (actual == file_size) { | ||
| 243 | if (standard_header) { | ||
| 244 | |||
| 245 | /* Now validate the checksum */ | ||
| 246 | |||
| 247 | status = acpi_tb_verify_checksum((void *)*table, | ||
| 248 | ACPI_CAST_PTR(struct | ||
| 249 | acpi_table_header, | ||
| 250 | *table)-> | ||
| 251 | length); | ||
| 252 | |||
| 253 | if (status == AE_BAD_CHECKSUM) { | ||
| 254 | status = | ||
| 255 | acpi_ut_check_text_mode_corruption((u8 *) | ||
| 256 | *table, | ||
| 257 | file_size, | ||
| 258 | (*table)-> | ||
| 259 | length); | ||
| 260 | return (status); | ||
| 261 | } | ||
| 262 | } | ||
| 263 | return (AE_OK); | ||
| 264 | } | ||
| 265 | |||
| 266 | if (actual > 0) { | ||
| 267 | acpi_os_printf("Warning - reading table, asked for %X got %X\n", | ||
| 268 | file_size, actual); | ||
| 269 | return (AE_OK); | ||
| 270 | } | ||
| 271 | |||
| 272 | acpi_os_printf("Error - could not read the table file\n"); | ||
| 273 | acpi_os_free(*table); | ||
| 274 | *table = NULL; | ||
| 275 | *table_length = 0; | ||
| 276 | return (AE_ERROR); | ||
| 277 | } | ||
| 278 | |||
| 279 | /******************************************************************************* | ||
| 280 | * | ||
| 281 | * FUNCTION: acpi_ut_read_table_from_file | ||
| 282 | * | ||
| 283 | * PARAMETERS: filename - File where table is located | ||
| 284 | * table - Where a pointer to the table is returned | ||
| 285 | * | ||
| 286 | * RETURN: Status | ||
| 287 | * | ||
| 288 | * DESCRIPTION: Get an ACPI table from a file | ||
| 289 | * | ||
| 290 | ******************************************************************************/ | ||
| 291 | |||
| 292 | acpi_status | ||
| 293 | acpi_ut_read_table_from_file(char *filename, struct acpi_table_header ** table) | ||
| 294 | { | ||
| 295 | FILE *file; | ||
| 296 | u32 file_size; | ||
| 297 | u32 table_length; | ||
| 298 | acpi_status status = AE_ERROR; | ||
| 299 | |||
| 300 | /* Open the file, get current size */ | ||
| 301 | |||
| 302 | file = fopen(filename, "rb"); | ||
| 303 | if (!file) { | ||
| 304 | perror("Could not open input file"); | ||
| 305 | |||
| 306 | if (errno == ENOENT) { | ||
| 307 | return (AE_NOT_EXIST); | ||
| 308 | } | ||
| 309 | |||
| 310 | return (status); | ||
| 311 | } | ||
| 312 | |||
| 313 | file_size = cm_get_file_size(file); | ||
| 314 | if (file_size == ACPI_UINT32_MAX) { | ||
| 315 | goto exit; | ||
| 316 | } | ||
| 317 | |||
| 318 | /* Get the entire file */ | ||
| 319 | |||
| 320 | fprintf(stderr, | ||
| 321 | "Reading ACPI table from file %12s - Length %.8u (0x%06X)\n", | ||
| 322 | filename, file_size, file_size); | ||
| 323 | |||
| 324 | status = acpi_ut_read_table(file, table, &table_length); | ||
| 325 | if (ACPI_FAILURE(status)) { | ||
| 326 | acpi_os_printf("Could not get table from the file\n"); | ||
| 327 | } | ||
| 328 | |||
| 329 | exit: | ||
| 330 | fclose(file); | ||
| 331 | return (status); | ||
| 332 | } | ||
| 333 | |||
| 334 | #endif | ||
diff --git a/drivers/acpi/acpica/uthex.c b/drivers/acpi/acpica/uthex.c index fda8b3def81c..8ad086ed1a06 100644 --- a/drivers/acpi/acpica/uthex.c +++ b/drivers/acpi/acpica/uthex.c | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | ACPI_MODULE_NAME("uthex") | 48 | ACPI_MODULE_NAME("uthex") |
| 49 | 49 | ||
| 50 | /* Hex to ASCII conversion table */ | 50 | /* Hex to ASCII conversion table */ |
| 51 | static char acpi_gbl_hex_to_ascii[] = { | 51 | static const char acpi_gbl_hex_to_ascii[] = { |
| 52 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', | 52 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', |
| 53 | 'E', 'F' | 53 | 'E', 'F' |
| 54 | }; | 54 | }; |
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index 7956df1e263c..05ee76eec314 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c | |||
| @@ -127,73 +127,6 @@ cleanup: | |||
| 127 | 127 | ||
| 128 | /******************************************************************************* | 128 | /******************************************************************************* |
| 129 | * | 129 | * |
| 130 | * FUNCTION: acpi_ut_execute_SUB | ||
| 131 | * | ||
| 132 | * PARAMETERS: device_node - Node for the device | ||
| 133 | * return_id - Where the _SUB is returned | ||
| 134 | * | ||
| 135 | * RETURN: Status | ||
| 136 | * | ||
| 137 | * DESCRIPTION: Executes the _SUB control method that returns the subsystem | ||
| 138 | * ID of the device. The _SUB value is always a string containing | ||
| 139 | * either a valid PNP or ACPI ID. | ||
| 140 | * | ||
| 141 | * NOTE: Internal function, no parameter validation | ||
| 142 | * | ||
| 143 | ******************************************************************************/ | ||
| 144 | |||
| 145 | acpi_status | ||
| 146 | acpi_ut_execute_SUB(struct acpi_namespace_node *device_node, | ||
| 147 | struct acpi_pnp_device_id **return_id) | ||
| 148 | { | ||
| 149 | union acpi_operand_object *obj_desc; | ||
| 150 | struct acpi_pnp_device_id *sub; | ||
| 151 | u32 length; | ||
| 152 | acpi_status status; | ||
| 153 | |||
| 154 | ACPI_FUNCTION_TRACE(ut_execute_SUB); | ||
| 155 | |||
| 156 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__SUB, | ||
| 157 | ACPI_BTYPE_STRING, &obj_desc); | ||
| 158 | if (ACPI_FAILURE(status)) { | ||
| 159 | return_ACPI_STATUS(status); | ||
| 160 | } | ||
| 161 | |||
| 162 | /* Get the size of the String to be returned, includes null terminator */ | ||
| 163 | |||
| 164 | length = obj_desc->string.length + 1; | ||
| 165 | |||
| 166 | /* Allocate a buffer for the SUB */ | ||
| 167 | |||
| 168 | sub = | ||
| 169 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) + | ||
| 170 | (acpi_size) length); | ||
| 171 | if (!sub) { | ||
| 172 | status = AE_NO_MEMORY; | ||
| 173 | goto cleanup; | ||
| 174 | } | ||
| 175 | |||
| 176 | /* Area for the string starts after PNP_DEVICE_ID struct */ | ||
| 177 | |||
| 178 | sub->string = | ||
| 179 | ACPI_ADD_PTR(char, sub, sizeof(struct acpi_pnp_device_id)); | ||
| 180 | |||
| 181 | /* Simply copy existing string */ | ||
| 182 | |||
| 183 | strcpy(sub->string, obj_desc->string.pointer); | ||
| 184 | sub->length = length; | ||
| 185 | *return_id = sub; | ||
| 186 | |||
| 187 | cleanup: | ||
| 188 | |||
| 189 | /* On exit, we must delete the return object */ | ||
| 190 | |||
| 191 | acpi_ut_remove_reference(obj_desc); | ||
| 192 | return_ACPI_STATUS(status); | ||
| 193 | } | ||
| 194 | |||
| 195 | /******************************************************************************* | ||
| 196 | * | ||
| 197 | * FUNCTION: acpi_ut_execute_UID | 130 | * FUNCTION: acpi_ut_execute_UID |
| 198 | * | 131 | * |
| 199 | * PARAMETERS: device_node - Node for the device | 132 | * PARAMETERS: device_node - Node for the device |
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index ccd0745f011e..fd82a122785e 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
| @@ -206,7 +206,6 @@ acpi_status acpi_ut_init_globals(void) | |||
| 206 | acpi_gbl_next_owner_id_offset = 0; | 206 | acpi_gbl_next_owner_id_offset = 0; |
| 207 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; | 207 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; |
| 208 | acpi_gbl_osi_mutex = NULL; | 208 | acpi_gbl_osi_mutex = NULL; |
| 209 | acpi_gbl_reg_methods_executed = FALSE; | ||
| 210 | acpi_gbl_max_loop_iterations = 0xFFFF; | 209 | acpi_gbl_max_loop_iterations = 0xFFFF; |
| 211 | 210 | ||
| 212 | /* Hardware oriented */ | 211 | /* Hardware oriented */ |
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index f9ff100f0159..58b5d4236429 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
| @@ -111,6 +111,7 @@ acpi_ut_short_divide(u64 dividend, | |||
| 111 | */ | 111 | */ |
| 112 | ACPI_DIV_64_BY_32(0, dividend_ovl.part.hi, divisor, | 112 | ACPI_DIV_64_BY_32(0, dividend_ovl.part.hi, divisor, |
| 113 | quotient.part.hi, remainder32); | 113 | quotient.part.hi, remainder32); |
| 114 | |||
| 114 | ACPI_DIV_64_BY_32(remainder32, dividend_ovl.part.lo, divisor, | 115 | ACPI_DIV_64_BY_32(remainder32, dividend_ovl.part.lo, divisor, |
| 115 | quotient.part.lo, remainder32); | 116 | quotient.part.lo, remainder32); |
| 116 | 117 | ||
| @@ -179,6 +180,7 @@ acpi_ut_divide(u64 in_dividend, | |||
| 179 | */ | 180 | */ |
| 180 | ACPI_DIV_64_BY_32(0, dividend.part.hi, divisor.part.lo, | 181 | ACPI_DIV_64_BY_32(0, dividend.part.hi, divisor.part.lo, |
| 181 | quotient.part.hi, partial1); | 182 | quotient.part.hi, partial1); |
| 183 | |||
| 182 | ACPI_DIV_64_BY_32(partial1, dividend.part.lo, divisor.part.lo, | 184 | ACPI_DIV_64_BY_32(partial1, dividend.part.lo, divisor.part.lo, |
| 183 | quotient.part.lo, remainder.part.lo); | 185 | quotient.part.lo, remainder.part.lo); |
| 184 | } | 186 | } |
| @@ -206,12 +208,12 @@ acpi_ut_divide(u64 in_dividend, | |||
| 206 | 208 | ||
| 207 | ACPI_DIV_64_BY_32(normalized_dividend.part.hi, | 209 | ACPI_DIV_64_BY_32(normalized_dividend.part.hi, |
| 208 | normalized_dividend.part.lo, | 210 | normalized_dividend.part.lo, |
| 209 | normalized_divisor.part.lo, | 211 | normalized_divisor.part.lo, quotient.part.lo, |
| 210 | quotient.part.lo, partial1); | 212 | partial1); |
| 211 | 213 | ||
| 212 | /* | 214 | /* |
| 213 | * The quotient is always 32 bits, and simply requires adjustment. | 215 | * The quotient is always 32 bits, and simply requires |
| 214 | * The 64-bit remainder must be generated. | 216 | * adjustment. The 64-bit remainder must be generated. |
| 215 | */ | 217 | */ |
| 216 | partial1 = quotient.part.lo * divisor.part.hi; | 218 | partial1 = quotient.part.lo * divisor.part.hi; |
| 217 | partial2.full = (u64) quotient.part.lo * divisor.part.lo; | 219 | partial2.full = (u64) quotient.part.lo * divisor.part.lo; |
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index bd4443bdcbad..eab1cfeb52cc 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
| @@ -264,8 +264,8 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object, | |||
| 264 | */ | 264 | */ |
| 265 | if ((!this_source_obj) || | 265 | if ((!this_source_obj) || |
| 266 | (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) != | 266 | (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) != |
| 267 | ACPI_DESC_TYPE_OPERAND) | 267 | ACPI_DESC_TYPE_OPERAND) || |
| 268 | || (this_source_obj->common.type != ACPI_TYPE_PACKAGE)) { | 268 | (this_source_obj->common.type != ACPI_TYPE_PACKAGE)) { |
| 269 | status = | 269 | status = |
| 270 | walk_callback(ACPI_COPY_TYPE_SIMPLE, | 270 | walk_callback(ACPI_COPY_TYPE_SIMPLE, |
| 271 | this_source_obj, state, context); | 271 | this_source_obj, state, context); |
| @@ -318,9 +318,10 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object, | |||
| 318 | * The callback above returned a new target package object. | 318 | * The callback above returned a new target package object. |
| 319 | */ | 319 | */ |
| 320 | acpi_ut_push_generic_state(&state_list, state); | 320 | acpi_ut_push_generic_state(&state_list, state); |
| 321 | state = acpi_ut_create_pkg_state(this_source_obj, | 321 | state = |
| 322 | state->pkg. | 322 | acpi_ut_create_pkg_state(this_source_obj, |
| 323 | this_target_obj, 0); | 323 | state->pkg.this_target_obj, |
| 324 | 0); | ||
| 324 | if (!state) { | 325 | if (!state) { |
| 325 | 326 | ||
| 326 | /* Free any stacked Update State objects */ | 327 | /* Free any stacked Update State objects */ |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index ce406e39b669..038ff849ad20 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
| @@ -111,17 +111,6 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
| 111 | if (ACPI_FAILURE(status)) { | 111 | if (ACPI_FAILURE(status)) { |
| 112 | return_ACPI_STATUS(status); | 112 | return_ACPI_STATUS(status); |
| 113 | } | 113 | } |
| 114 | #ifdef ACPI_DEBUGGER | ||
| 115 | |||
| 116 | /* Debugger Support */ | ||
| 117 | |||
| 118 | status = acpi_os_create_mutex(&acpi_gbl_db_command_ready); | ||
| 119 | if (ACPI_FAILURE(status)) { | ||
| 120 | return_ACPI_STATUS(status); | ||
| 121 | } | ||
| 122 | |||
| 123 | status = acpi_os_create_mutex(&acpi_gbl_db_command_complete); | ||
| 124 | #endif | ||
| 125 | 114 | ||
| 126 | return_ACPI_STATUS(status); | 115 | return_ACPI_STATUS(status); |
| 127 | } | 116 | } |
| @@ -162,12 +151,6 @@ void acpi_ut_mutex_terminate(void) | |||
| 162 | /* Delete the reader/writer lock */ | 151 | /* Delete the reader/writer lock */ |
| 163 | 152 | ||
| 164 | acpi_ut_delete_rw_lock(&acpi_gbl_namespace_rw_lock); | 153 | acpi_ut_delete_rw_lock(&acpi_gbl_namespace_rw_lock); |
| 165 | |||
| 166 | #ifdef ACPI_DEBUGGER | ||
| 167 | acpi_os_delete_mutex(acpi_gbl_db_command_ready); | ||
| 168 | acpi_os_delete_mutex(acpi_gbl_db_command_complete); | ||
| 169 | #endif | ||
| 170 | |||
| 171 | return_VOID; | 154 | return_VOID; |
| 172 | } | 155 | } |
| 173 | 156 | ||
| @@ -290,8 +273,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
| 290 | (u32)this_thread_id, | 273 | (u32)this_thread_id, |
| 291 | acpi_ut_get_mutex_name(mutex_id))); | 274 | acpi_ut_get_mutex_name(mutex_id))); |
| 292 | 275 | ||
| 293 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 276 | status = |
| 294 | ACPI_WAIT_FOREVER); | 277 | acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
| 278 | ACPI_WAIT_FOREVER); | ||
| 295 | if (ACPI_SUCCESS(status)) { | 279 | if (ACPI_SUCCESS(status)) { |
| 296 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 280 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
| 297 | "Thread %u acquired Mutex [%s]\n", | 281 | "Thread %u acquired Mutex [%s]\n", |
diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c index 1d5f6b17b766..9c3cadc27fb8 100644 --- a/drivers/acpi/acpica/utnonansi.c +++ b/drivers/acpi/acpica/utnonansi.c | |||
| @@ -282,8 +282,8 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer) | |||
| 282 | 282 | ||
| 283 | /* Divide the digit into the correct position */ | 283 | /* Divide the digit into the correct position */ |
| 284 | 284 | ||
| 285 | (void)acpi_ut_short_divide((dividend - (u64)this_digit), | 285 | (void)acpi_ut_short_divide((dividend - (u64)this_digit), base, |
| 286 | base, "ient, NULL); | 286 | "ient, NULL); |
| 287 | 287 | ||
| 288 | if (return_value > quotient) { | 288 | if (return_value > quotient) { |
| 289 | if (to_integer_op) { | 289 | if (to_integer_op) { |
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 7d83efe1ea29..787eccf6a1d5 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c | |||
| @@ -112,9 +112,9 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char | |||
| 112 | 112 | ||
| 113 | /* These types require a secondary object */ | 113 | /* These types require a secondary object */ |
| 114 | 114 | ||
| 115 | second_object = acpi_ut_allocate_object_desc_dbg(module_name, | 115 | second_object = |
| 116 | line_number, | 116 | acpi_ut_allocate_object_desc_dbg(module_name, line_number, |
| 117 | component_id); | 117 | component_id); |
| 118 | if (!second_object) { | 118 | if (!second_object) { |
| 119 | acpi_ut_delete_object_desc(object); | 119 | acpi_ut_delete_object_desc(object); |
| 120 | return_PTR(NULL); | 120 | return_PTR(NULL); |
| @@ -253,7 +253,8 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) | |||
| 253 | buffer = ACPI_ALLOCATE_ZEROED(buffer_size); | 253 | buffer = ACPI_ALLOCATE_ZEROED(buffer_size); |
| 254 | if (!buffer) { | 254 | if (!buffer) { |
| 255 | ACPI_ERROR((AE_INFO, "Could not allocate size %u", | 255 | ACPI_ERROR((AE_INFO, "Could not allocate size %u", |
| 256 | (u32) buffer_size)); | 256 | (u32)buffer_size)); |
| 257 | |||
| 257 | acpi_ut_remove_reference(buffer_desc); | 258 | acpi_ut_remove_reference(buffer_desc); |
| 258 | return_PTR(NULL); | 259 | return_PTR(NULL); |
| 259 | } | 260 | } |
| @@ -305,7 +306,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
| 305 | string = ACPI_ALLOCATE_ZEROED(string_size + 1); | 306 | string = ACPI_ALLOCATE_ZEROED(string_size + 1); |
| 306 | if (!string) { | 307 | if (!string) { |
| 307 | ACPI_ERROR((AE_INFO, "Could not allocate size %u", | 308 | ACPI_ERROR((AE_INFO, "Could not allocate size %u", |
| 308 | (u32) string_size)); | 309 | (u32)string_size)); |
| 310 | |||
| 309 | acpi_ut_remove_reference(string_desc); | 311 | acpi_ut_remove_reference(string_desc); |
| 310 | return_PTR(NULL); | 312 | return_PTR(NULL); |
| 311 | } | 313 | } |
| @@ -649,8 +651,9 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, | |||
| 649 | info.object_space = 0; | 651 | info.object_space = 0; |
| 650 | info.num_packages = 1; | 652 | info.num_packages = 1; |
| 651 | 653 | ||
| 652 | status = acpi_ut_walk_package_tree(internal_object, NULL, | 654 | status = |
| 653 | acpi_ut_get_element_length, &info); | 655 | acpi_ut_walk_package_tree(internal_object, NULL, |
| 656 | acpi_ut_get_element_length, &info); | ||
| 654 | if (ACPI_FAILURE(status)) { | 657 | if (ACPI_FAILURE(status)) { |
| 655 | return_ACPI_STATUS(status); | 658 | return_ACPI_STATUS(status); |
| 656 | } | 659 | } |
| @@ -660,7 +663,8 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, | |||
| 660 | * just add the length of the package objects themselves. | 663 | * just add the length of the package objects themselves. |
| 661 | * Round up to the next machine word. | 664 | * Round up to the next machine word. |
| 662 | */ | 665 | */ |
| 663 | info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) * | 666 | info.length += |
| 667 | ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) * | ||
| 664 | (acpi_size) info.num_packages; | 668 | (acpi_size) info.num_packages; |
| 665 | 669 | ||
| 666 | /* Return the total package length */ | 670 | /* Return the total package length */ |
| @@ -692,8 +696,8 @@ acpi_ut_get_object_size(union acpi_operand_object *internal_object, | |||
| 692 | ACPI_FUNCTION_ENTRY(); | 696 | ACPI_FUNCTION_ENTRY(); |
| 693 | 697 | ||
| 694 | if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) == | 698 | if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) == |
| 695 | ACPI_DESC_TYPE_OPERAND) | 699 | ACPI_DESC_TYPE_OPERAND) && |
| 696 | && (internal_object->common.type == ACPI_TYPE_PACKAGE)) { | 700 | (internal_object->common.type == ACPI_TYPE_PACKAGE)) { |
| 697 | status = | 701 | status = |
| 698 | acpi_ut_get_package_object_size(internal_object, | 702 | acpi_ut_get_package_object_size(internal_object, |
| 699 | obj_length); | 703 | obj_length); |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 8f3d203aed79..0809d73193e1 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c | |||
| @@ -269,9 +269,10 @@ acpi_status acpi_ut_remove_interface(acpi_string interface_name) | |||
| 269 | previous_interface = next_interface = acpi_gbl_supported_interfaces; | 269 | previous_interface = next_interface = acpi_gbl_supported_interfaces; |
| 270 | while (next_interface) { | 270 | while (next_interface) { |
| 271 | if (!strcmp(interface_name, next_interface->name)) { | 271 | if (!strcmp(interface_name, next_interface->name)) { |
| 272 | 272 | /* | |
| 273 | /* Found: name is in either the static list or was added at runtime */ | 273 | * Found: name is in either the static list |
| 274 | 274 | * or was added at runtime | |
| 275 | */ | ||
| 275 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { | 276 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { |
| 276 | 277 | ||
| 277 | /* Interface was added dynamically, remove and free it */ | 278 | /* Interface was added dynamically, remove and free it */ |
| @@ -288,8 +289,8 @@ acpi_status acpi_ut_remove_interface(acpi_string interface_name) | |||
| 288 | ACPI_FREE(next_interface); | 289 | ACPI_FREE(next_interface); |
| 289 | } else { | 290 | } else { |
| 290 | /* | 291 | /* |
| 291 | * Interface is in static list. If marked invalid, then it | 292 | * Interface is in static list. If marked invalid, then |
| 292 | * does not actually exist. Else, mark it invalid. | 293 | * it does not actually exist. Else, mark it invalid. |
| 293 | */ | 294 | */ |
| 294 | if (next_interface->flags & ACPI_OSI_INVALID) { | 295 | if (next_interface->flags & ACPI_OSI_INVALID) { |
| 295 | return (AE_NOT_EXIST); | 296 | return (AE_NOT_EXIST); |
diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c index 2959217067cb..ebb811c43c89 100644 --- a/drivers/acpi/acpica/utownerid.c +++ b/drivers/acpi/acpica/utownerid.c | |||
| @@ -73,8 +73,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
| 73 | /* Guard against multiple allocations of ID to the same location */ | 73 | /* Guard against multiple allocations of ID to the same location */ |
| 74 | 74 | ||
| 75 | if (*owner_id) { | 75 | if (*owner_id) { |
| 76 | ACPI_ERROR((AE_INFO, "Owner ID [0x%2.2X] already exists", | 76 | ACPI_ERROR((AE_INFO, |
| 77 | *owner_id)); | 77 | "Owner ID [0x%2.2X] already exists", *owner_id)); |
| 78 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 78 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| @@ -87,8 +87,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
| 87 | 87 | ||
| 88 | /* | 88 | /* |
| 89 | * Find a free owner ID, cycle through all possible IDs on repeated | 89 | * Find a free owner ID, cycle through all possible IDs on repeated |
| 90 | * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have | 90 | * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index |
| 91 | * to be scanned twice. | 91 | * may have to be scanned twice. |
| 92 | */ | 92 | */ |
| 93 | for (i = 0, j = acpi_gbl_last_owner_id_index; | 93 | for (i = 0, j = acpi_gbl_last_owner_id_index; |
| 94 | i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { | 94 | i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { |
| @@ -141,8 +141,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
| 141 | * they are released when a table is unloaded or a method completes | 141 | * they are released when a table is unloaded or a method completes |
| 142 | * execution. | 142 | * execution. |
| 143 | * | 143 | * |
| 144 | * If this error happens, there may be very deep nesting of invoked control | 144 | * If this error happens, there may be very deep nesting of invoked |
| 145 | * methods, or there may be a bug where the IDs are not released. | 145 | * control methods, or there may be a bug where the IDs are not released. |
| 146 | */ | 146 | */ |
| 147 | status = AE_OWNER_ID_LIMIT; | 147 | status = AE_OWNER_ID_LIMIT; |
| 148 | ACPI_ERROR((AE_INFO, | 148 | ACPI_ERROR((AE_INFO, |
diff --git a/drivers/acpi/acpica/utpredef.c b/drivers/acpi/acpica/utpredef.c index 97898ed71b4b..9f8e415bf0af 100644 --- a/drivers/acpi/acpica/utpredef.c +++ b/drivers/acpi/acpica/utpredef.c | |||
| @@ -225,8 +225,10 @@ const union acpi_predefined_info *acpi_ut_match_resource_name(char *name) | |||
| 225 | { | 225 | { |
| 226 | const union acpi_predefined_info *this_name; | 226 | const union acpi_predefined_info *this_name; |
| 227 | 227 | ||
| 228 | /* Quick check for a predefined name, first character must be underscore */ | 228 | /* |
| 229 | 229 | * Quick check for a predefined name, first character must | |
| 230 | * be underscore | ||
| 231 | */ | ||
| 230 | if (name[0] != '_') { | 232 | if (name[0] != '_') { |
| 231 | return (NULL); | 233 | return (NULL); |
| 232 | } | 234 | } |
diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c index b26297c5de49..01f04da779c5 100644 --- a/drivers/acpi/acpica/utprint.c +++ b/drivers/acpi/acpica/utprint.c | |||
| @@ -314,8 +314,9 @@ static char *acpi_ut_format_number(char *string, | |||
| 314 | if (need_prefix) { | 314 | if (need_prefix) { |
| 315 | string = acpi_ut_bound_string_output(string, end, '0'); | 315 | string = acpi_ut_bound_string_output(string, end, '0'); |
| 316 | if (base == 16) { | 316 | if (base == 16) { |
| 317 | string = acpi_ut_bound_string_output(string, end, | 317 | string = |
| 318 | upper ? 'X' : 'x'); | 318 | acpi_ut_bound_string_output(string, end, |
| 319 | upper ? 'X' : 'x'); | ||
| 319 | } | 320 | } |
| 320 | } | 321 | } |
| 321 | if (!(type & ACPI_FORMAT_LEFT)) { | 322 | if (!(type & ACPI_FORMAT_LEFT)) { |
| @@ -400,6 +401,7 @@ acpi_ut_vsnprintf(char *string, | |||
| 400 | } else { | 401 | } else { |
| 401 | break; | 402 | break; |
| 402 | } | 403 | } |
| 404 | |||
| 403 | } while (1); | 405 | } while (1); |
| 404 | 406 | ||
| 405 | /* Process width */ | 407 | /* Process width */ |
| @@ -429,6 +431,7 @@ acpi_ut_vsnprintf(char *string, | |||
| 429 | ++format; | 431 | ++format; |
| 430 | precision = va_arg(args, int); | 432 | precision = va_arg(args, int); |
| 431 | } | 433 | } |
| 434 | |||
| 432 | if (precision < 0) { | 435 | if (precision < 0) { |
| 433 | precision = 0; | 436 | precision = 0; |
| 434 | } | 437 | } |
| @@ -488,10 +491,12 @@ acpi_ut_vsnprintf(char *string, | |||
| 488 | ' '); | 491 | ' '); |
| 489 | } | 492 | } |
| 490 | } | 493 | } |
| 494 | |||
| 491 | for (i = 0; i < length; ++i) { | 495 | for (i = 0; i < length; ++i) { |
| 492 | pos = acpi_ut_bound_string_output(pos, end, *s); | 496 | pos = acpi_ut_bound_string_output(pos, end, *s); |
| 493 | ++s; | 497 | ++s; |
| 494 | } | 498 | } |
| 499 | |||
| 495 | while (length < width--) { | 500 | while (length < width--) { |
| 496 | pos = | 501 | pos = |
| 497 | acpi_ut_bound_string_output(pos, end, ' '); | 502 | acpi_ut_bound_string_output(pos, end, ' '); |
| @@ -529,9 +534,9 @@ acpi_ut_vsnprintf(char *string, | |||
| 529 | } | 534 | } |
| 530 | 535 | ||
| 531 | p = va_arg(args, void *); | 536 | p = va_arg(args, void *); |
| 532 | pos = acpi_ut_format_number(pos, end, | 537 | pos = |
| 533 | ACPI_TO_INTEGER(p), 16, | 538 | acpi_ut_format_number(pos, end, ACPI_TO_INTEGER(p), |
| 534 | width, precision, type); | 539 | 16, width, precision, type); |
| 535 | continue; | 540 | continue; |
| 536 | 541 | ||
| 537 | default: | 542 | default: |
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index b3505dbc715e..d50b41c4daa7 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c | |||
| @@ -441,8 +441,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, | |||
| 441 | acpi_ut_validate_resource(walk_state, aml, &resource_index); | 441 | acpi_ut_validate_resource(walk_state, aml, &resource_index); |
| 442 | if (ACPI_FAILURE(status)) { | 442 | if (ACPI_FAILURE(status)) { |
| 443 | /* | 443 | /* |
| 444 | * Exit on failure. Cannot continue because the descriptor length | 444 | * Exit on failure. Cannot continue because the descriptor |
| 445 | * may be bogus also. | 445 | * length may be bogus also. |
| 446 | */ | 446 | */ |
| 447 | return_ACPI_STATUS(status); | 447 | return_ACPI_STATUS(status); |
| 448 | } | 448 | } |
| @@ -568,8 +568,8 @@ acpi_ut_validate_resource(struct acpi_walk_state *walk_state, | |||
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | /* | 570 | /* |
| 571 | * Check validity of the resource type, via acpi_gbl_resource_types. Zero | 571 | * Check validity of the resource type, via acpi_gbl_resource_types. |
| 572 | * indicates an invalid resource. | 572 | * Zero indicates an invalid resource. |
| 573 | */ | 573 | */ |
| 574 | if (!acpi_gbl_resource_types[resource_index]) { | 574 | if (!acpi_gbl_resource_types[resource_index]) { |
| 575 | goto invalid_resource; | 575 | goto invalid_resource; |
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c index f201171c5dda..0050e00997ed 100644 --- a/drivers/acpi/acpica/utstate.c +++ b/drivers/acpi/acpica/utstate.c | |||
| @@ -246,6 +246,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
| 246 | state->pkg.dest_object = external_object; | 246 | state->pkg.dest_object = external_object; |
| 247 | state->pkg.index = index; | 247 | state->pkg.index = index; |
| 248 | state->pkg.num_packages = 1; | 248 | state->pkg.num_packages = 1; |
| 249 | |||
| 249 | return (state); | 250 | return (state); |
| 250 | } | 251 | } |
| 251 | 252 | ||
| @@ -279,6 +280,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
| 279 | 280 | ||
| 280 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; | 281 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; |
| 281 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; | 282 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
| 283 | |||
| 282 | return (state); | 284 | return (state); |
| 283 | } | 285 | } |
| 284 | 286 | ||
| @@ -304,5 +306,6 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state) | |||
| 304 | if (state) { | 306 | if (state) { |
| 305 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | 307 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); |
| 306 | } | 308 | } |
| 309 | |||
| 307 | return; | 310 | return; |
| 308 | } | 311 | } |
diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c index 4ddd105d9741..958b2f7b552d 100644 --- a/drivers/acpi/acpica/utstring.c +++ b/drivers/acpi/acpica/utstring.c | |||
| @@ -135,6 +135,7 @@ void acpi_ut_print_string(char *string, u16 max_length) | |||
| 135 | break; | 135 | break; |
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| 138 | |||
| 138 | acpi_os_printf("\""); | 139 | acpi_os_printf("\""); |
| 139 | 140 | ||
| 140 | if (i == max_length && string[i]) { | 141 | if (i == max_length && string[i]) { |
| @@ -239,6 +240,14 @@ void acpi_ut_repair_name(char *name) | |||
| 239 | 240 | ||
| 240 | ACPI_FUNCTION_NAME(ut_repair_name); | 241 | ACPI_FUNCTION_NAME(ut_repair_name); |
| 241 | 242 | ||
| 243 | /* | ||
| 244 | * Special case for the root node. This can happen if we get an | ||
| 245 | * error during the execution of module-level code. | ||
| 246 | */ | ||
| 247 | if (ACPI_COMPARE_NAME(name, "\\___")) { | ||
| 248 | return; | ||
| 249 | } | ||
| 250 | |||
| 242 | ACPI_MOVE_NAME(&original_name, name); | 251 | ACPI_MOVE_NAME(&original_name, name); |
| 243 | 252 | ||
| 244 | /* Check each character in the name */ | 253 | /* Check each character in the name */ |
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c index 9a7dc8196a5d..ea698e98442e 100644 --- a/drivers/acpi/acpica/uttrack.c +++ b/drivers/acpi/acpica/uttrack.c | |||
| @@ -150,9 +150,9 @@ void *acpi_ut_allocate_and_track(acpi_size size, | |||
| 150 | return (NULL); | 150 | return (NULL); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | status = acpi_ut_track_allocation(allocation, size, | 153 | status = |
| 154 | ACPI_MEM_MALLOC, component, module, | 154 | acpi_ut_track_allocation(allocation, size, ACPI_MEM_MALLOC, |
| 155 | line); | 155 | component, module, line); |
| 156 | if (ACPI_FAILURE(status)) { | 156 | if (ACPI_FAILURE(status)) { |
| 157 | acpi_os_free(allocation); | 157 | acpi_os_free(allocation); |
| 158 | return (NULL); | 158 | return (NULL); |
| @@ -161,6 +161,7 @@ void *acpi_ut_allocate_and_track(acpi_size size, | |||
| 161 | acpi_gbl_global_list->total_allocated++; | 161 | acpi_gbl_global_list->total_allocated++; |
| 162 | acpi_gbl_global_list->total_size += (u32)size; | 162 | acpi_gbl_global_list->total_size += (u32)size; |
| 163 | acpi_gbl_global_list->current_total_size += (u32)size; | 163 | acpi_gbl_global_list->current_total_size += (u32)size; |
| 164 | |||
| 164 | if (acpi_gbl_global_list->current_total_size > | 165 | if (acpi_gbl_global_list->current_total_size > |
| 165 | acpi_gbl_global_list->max_occupied) { | 166 | acpi_gbl_global_list->max_occupied) { |
| 166 | acpi_gbl_global_list->max_occupied = | 167 | acpi_gbl_global_list->max_occupied = |
| @@ -223,6 +224,7 @@ void *acpi_ut_allocate_zeroed_and_track(acpi_size size, | |||
| 223 | acpi_gbl_global_list->total_allocated++; | 224 | acpi_gbl_global_list->total_allocated++; |
| 224 | acpi_gbl_global_list->total_size += (u32)size; | 225 | acpi_gbl_global_list->total_size += (u32)size; |
| 225 | acpi_gbl_global_list->current_total_size += (u32)size; | 226 | acpi_gbl_global_list->current_total_size += (u32)size; |
| 227 | |||
| 226 | if (acpi_gbl_global_list->current_total_size > | 228 | if (acpi_gbl_global_list->current_total_size > |
| 227 | acpi_gbl_global_list->max_occupied) { | 229 | acpi_gbl_global_list->max_occupied) { |
| 228 | acpi_gbl_global_list->max_occupied = | 230 | acpi_gbl_global_list->max_occupied = |
| @@ -269,8 +271,8 @@ acpi_ut_free_and_track(void *allocation, | |||
| 269 | acpi_gbl_global_list->total_freed++; | 271 | acpi_gbl_global_list->total_freed++; |
| 270 | acpi_gbl_global_list->current_total_size -= debug_block->size; | 272 | acpi_gbl_global_list->current_total_size -= debug_block->size; |
| 271 | 273 | ||
| 272 | status = acpi_ut_remove_allocation(debug_block, | 274 | status = |
| 273 | component, module, line); | 275 | acpi_ut_remove_allocation(debug_block, component, module, line); |
| 274 | if (ACPI_FAILURE(status)) { | 276 | if (ACPI_FAILURE(status)) { |
| 275 | ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); | 277 | ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); |
| 276 | } | 278 | } |
| @@ -525,35 +527,35 @@ void acpi_ut_dump_allocation_info(void) | |||
| 525 | 527 | ||
| 526 | /* | 528 | /* |
| 527 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 529 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
| 528 | ("%30s: %4d (%3d Kb)\n", "Current allocations", | 530 | ("%30s: %4d (%3d Kb)\n", "Current allocations", |
| 529 | mem_list->current_count, | 531 | mem_list->current_count, |
| 530 | ROUND_UP_TO_1K (mem_list->current_size))); | 532 | ROUND_UP_TO_1K (mem_list->current_size))); |
| 531 | 533 | ||
| 532 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 534 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
| 533 | ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", | 535 | ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", |
| 534 | mem_list->max_concurrent_count, | 536 | mem_list->max_concurrent_count, |
| 535 | ROUND_UP_TO_1K (mem_list->max_concurrent_size))); | 537 | ROUND_UP_TO_1K (mem_list->max_concurrent_size))); |
| 536 | 538 | ||
| 537 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 539 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
| 538 | ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", | 540 | ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", |
| 539 | running_object_count, | 541 | running_object_count, |
| 540 | ROUND_UP_TO_1K (running_object_size))); | 542 | ROUND_UP_TO_1K (running_object_size))); |
| 541 | 543 | ||
| 542 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 544 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
| 543 | ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", | 545 | ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", |
| 544 | running_alloc_count, | 546 | running_alloc_count, |
| 545 | ROUND_UP_TO_1K (running_alloc_size))); | 547 | ROUND_UP_TO_1K (running_alloc_size))); |
| 546 | 548 | ||
| 547 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 549 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
| 548 | ("%30s: %4d (%3d Kb)\n", "Current Nodes", | 550 | ("%30s: %4d (%3d Kb)\n", "Current Nodes", |
| 549 | acpi_gbl_current_node_count, | 551 | acpi_gbl_current_node_count, |
| 550 | ROUND_UP_TO_1K (acpi_gbl_current_node_size))); | 552 | ROUND_UP_TO_1K (acpi_gbl_current_node_size))); |
| 551 | 553 | ||
| 552 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 554 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
| 553 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", | 555 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", |
| 554 | acpi_gbl_max_concurrent_node_count, | 556 | acpi_gbl_max_concurrent_node_count, |
| 555 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * | 557 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * |
| 556 | sizeof (struct acpi_namespace_node))))); | 558 | sizeof (struct acpi_namespace_node))))); |
| 557 | */ | 559 | */ |
| 558 | return_VOID; | 560 | return_VOID; |
| 559 | } | 561 | } |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index f9c8f9ce1f0f..9f3f0a1591f6 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
| @@ -154,7 +154,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) | |||
| 154 | * Populate the return buffer | 154 | * Populate the return buffer |
| 155 | */ | 155 | */ |
| 156 | info_ptr = (struct acpi_system_info *)out_buffer->pointer; | 156 | info_ptr = (struct acpi_system_info *)out_buffer->pointer; |
| 157 | |||
| 158 | info_ptr->acpi_ca_version = ACPI_CA_VERSION; | 157 | info_ptr->acpi_ca_version = ACPI_CA_VERSION; |
| 159 | 158 | ||
| 160 | /* System flags (ACPI capabilities) */ | 159 | /* System flags (ACPI capabilities) */ |
| @@ -216,7 +215,6 @@ acpi_status acpi_get_statistics(struct acpi_statistics *stats) | |||
| 216 | /* Other counters */ | 215 | /* Other counters */ |
| 217 | 216 | ||
| 218 | stats->method_count = acpi_method_count; | 217 | stats->method_count = acpi_method_count; |
| 219 | |||
| 220 | return_ACPI_STATUS(AE_OK); | 218 | return_ACPI_STATUS(AE_OK); |
| 221 | } | 219 | } |
| 222 | 220 | ||
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index 98d578753101..f6cbaf451dbf 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c | |||
| @@ -117,6 +117,7 @@ acpi_exception(const char *module_name, | |||
| 117 | acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", | 117 | acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", |
| 118 | acpi_format_exception(status)); | 118 | acpi_format_exception(status)); |
| 119 | } | 119 | } |
| 120 | |||
| 120 | va_start(arg_list, format); | 121 | va_start(arg_list, format); |
| 121 | acpi_os_vprintf(format, arg_list); | 122 | acpi_os_vprintf(format, arg_list); |
| 122 | ACPI_MSG_SUFFIX; | 123 | ACPI_MSG_SUFFIX; |
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index a7137ec28447..e38facd3e32f 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c | |||
| @@ -147,6 +147,28 @@ acpi_status __init acpi_enable_subsystem(u32 flags) | |||
| 147 | 147 | ||
| 148 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | 148 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); |
| 149 | 149 | ||
| 150 | /* | ||
| 151 | * The early initialization phase is complete. The namespace is loaded, | ||
| 152 | * and we can now support address spaces other than Memory, I/O, and | ||
| 153 | * PCI_Config. | ||
| 154 | */ | ||
| 155 | acpi_gbl_early_initialization = FALSE; | ||
| 156 | |||
| 157 | /* | ||
| 158 | * Install the default operation region handlers. These are the | ||
| 159 | * handlers that are defined by the ACPI specification to be | ||
| 160 | * "always accessible" -- namely, system_memory, system_IO, and | ||
| 161 | * PCI_Config. This also means that no _REG methods need to be | ||
| 162 | * run for these address spaces. We need to have these handlers | ||
| 163 | * installed before any AML code can be executed, especially any | ||
| 164 | * module-level code (11/2015). | ||
| 165 | */ | ||
| 166 | status = acpi_ev_install_region_handlers(); | ||
| 167 | if (ACPI_FAILURE(status)) { | ||
| 168 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 169 | "During Region initialization")); | ||
| 170 | return_ACPI_STATUS(status); | ||
| 171 | } | ||
| 150 | #if (!ACPI_REDUCED_HARDWARE) | 172 | #if (!ACPI_REDUCED_HARDWARE) |
| 151 | 173 | ||
| 152 | /* Enable ACPI mode */ | 174 | /* Enable ACPI mode */ |
| @@ -175,23 +197,7 @@ acpi_status __init acpi_enable_subsystem(u32 flags) | |||
| 175 | return_ACPI_STATUS(status); | 197 | return_ACPI_STATUS(status); |
| 176 | } | 198 | } |
| 177 | } | 199 | } |
| 178 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
| 179 | |||
| 180 | /* | ||
| 181 | * Install the default op_region handlers. These are installed unless | ||
| 182 | * other handlers have already been installed via the | ||
| 183 | * install_address_space_handler interface. | ||
| 184 | */ | ||
| 185 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
| 186 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 187 | "[Init] Installing default address space handlers\n")); | ||
| 188 | 200 | ||
| 189 | status = acpi_ev_install_region_handlers(); | ||
| 190 | if (ACPI_FAILURE(status)) { | ||
| 191 | return_ACPI_STATUS(status); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | #if (!ACPI_REDUCED_HARDWARE) | ||
| 195 | /* | 201 | /* |
| 196 | * Initialize ACPI Event handling (Fixed and General Purpose) | 202 | * Initialize ACPI Event handling (Fixed and General Purpose) |
| 197 | * | 203 | * |
| @@ -261,6 +267,7 @@ acpi_status __init acpi_initialize_objects(u32 flags) | |||
| 261 | * initialized, even if they contain executable AML (see the call to | 267 | * initialized, even if they contain executable AML (see the call to |
| 262 | * acpi_ns_initialize_objects below). | 268 | * acpi_ns_initialize_objects below). |
| 263 | */ | 269 | */ |
| 270 | acpi_gbl_reg_methods_enabled = TRUE; | ||
| 264 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 271 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
| 265 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 272 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 266 | "[Init] Executing _REG OpRegion methods\n")); | 273 | "[Init] Executing _REG OpRegion methods\n")); |
| @@ -285,8 +292,14 @@ acpi_status __init acpi_initialize_objects(u32 flags) | |||
| 285 | * outside of any control method is wrapped with a temporary control | 292 | * outside of any control method is wrapped with a temporary control |
| 286 | * method object and placed on a global list. The methods on this list | 293 | * method object and placed on a global list. The methods on this list |
| 287 | * are executed below. | 294 | * are executed below. |
| 295 | * | ||
| 296 | * This case executes the module-level code for all tables only after | ||
| 297 | * all of the tables have been loaded. It is a legacy option and is | ||
| 298 | * not compatible with other ACPI implementations. See acpi_ns_load_table. | ||
| 288 | */ | 299 | */ |
| 289 | acpi_ns_exec_module_code_list(); | 300 | if (acpi_gbl_group_module_level_code) { |
| 301 | acpi_ns_exec_module_code_list(); | ||
| 302 | } | ||
| 290 | 303 | ||
| 291 | /* | 304 | /* |
| 292 | * Initialize the objects that remain uninitialized. This runs the | 305 | * Initialize the objects that remain uninitialized. This runs the |
diff --git a/drivers/acpi/acpica/utxfmutex.c b/drivers/acpi/acpica/utxfmutex.c index f2606af3364c..95d6123a7010 100644 --- a/drivers/acpi/acpica/utxfmutex.c +++ b/drivers/acpi/acpica/utxfmutex.c | |||
| @@ -89,9 +89,9 @@ acpi_ut_get_mutex_object(acpi_handle handle, | |||
| 89 | 89 | ||
| 90 | mutex_node = handle; | 90 | mutex_node = handle; |
| 91 | if (pathname != NULL) { | 91 | if (pathname != NULL) { |
| 92 | status = acpi_get_handle(handle, pathname, | 92 | status = |
| 93 | ACPI_CAST_PTR(acpi_handle, | 93 | acpi_get_handle(handle, pathname, |
| 94 | &mutex_node)); | 94 | ACPI_CAST_PTR(acpi_handle, &mutex_node)); |
| 95 | if (ACPI_FAILURE(status)) { | 95 | if (ACPI_FAILURE(status)) { |
| 96 | return (status); | 96 | return (status); |
| 97 | } | 97 | } |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a212cefae524..891c42d1cd65 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -180,14 +180,15 @@ static void acpi_print_osc_error(acpi_handle handle, | |||
| 180 | int i; | 180 | int i; |
| 181 | 181 | ||
| 182 | if (ACPI_FAILURE(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer))) | 182 | if (ACPI_FAILURE(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer))) |
| 183 | printk(KERN_DEBUG "%s\n", error); | 183 | printk(KERN_DEBUG "%s: %s\n", context->uuid_str, error); |
| 184 | else { | 184 | else { |
| 185 | printk(KERN_DEBUG "%s:%s\n", (char *)buffer.pointer, error); | 185 | printk(KERN_DEBUG "%s (%s): %s\n", |
| 186 | (char *)buffer.pointer, context->uuid_str, error); | ||
| 186 | kfree(buffer.pointer); | 187 | kfree(buffer.pointer); |
| 187 | } | 188 | } |
| 188 | printk(KERN_DEBUG"_OSC request data:"); | 189 | printk(KERN_DEBUG "_OSC request data:"); |
| 189 | for (i = 0; i < context->cap.length; i += sizeof(u32)) | 190 | for (i = 0; i < context->cap.length; i += sizeof(u32)) |
| 190 | printk("%x ", *((u32 *)(context->cap.pointer + i))); | 191 | printk(" %x", *((u32 *)(context->cap.pointer + i))); |
| 191 | printk("\n"); | 192 | printk("\n"); |
| 192 | } | 193 | } |
| 193 | 194 | ||
| @@ -1094,6 +1095,7 @@ static int __init acpi_init(void) | |||
| 1094 | acpi_debugfs_init(); | 1095 | acpi_debugfs_init(); |
| 1095 | acpi_sleep_proc_init(); | 1096 | acpi_sleep_proc_init(); |
| 1096 | acpi_wakeup_device_init(); | 1097 | acpi_wakeup_device_init(); |
| 1098 | acpi_debugger_init(); | ||
| 1097 | return 0; | 1099 | return 0; |
| 1098 | } | 1100 | } |
| 1099 | 1101 | ||
diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c index fa4585a6914e..ee9e0f27b2bf 100644 --- a/drivers/acpi/gsi.c +++ b/drivers/acpi/gsi.c | |||
| @@ -17,25 +17,6 @@ enum acpi_irq_model_id acpi_irq_model; | |||
| 17 | 17 | ||
| 18 | static struct fwnode_handle *acpi_gsi_domain_id; | 18 | static struct fwnode_handle *acpi_gsi_domain_id; |
| 19 | 19 | ||
| 20 | static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity) | ||
| 21 | { | ||
| 22 | switch (polarity) { | ||
| 23 | case ACPI_ACTIVE_LOW: | ||
| 24 | return trigger == ACPI_EDGE_SENSITIVE ? | ||
| 25 | IRQ_TYPE_EDGE_FALLING : | ||
| 26 | IRQ_TYPE_LEVEL_LOW; | ||
| 27 | case ACPI_ACTIVE_HIGH: | ||
| 28 | return trigger == ACPI_EDGE_SENSITIVE ? | ||
| 29 | IRQ_TYPE_EDGE_RISING : | ||
| 30 | IRQ_TYPE_LEVEL_HIGH; | ||
| 31 | case ACPI_ACTIVE_BOTH: | ||
| 32 | if (trigger == ACPI_EDGE_SENSITIVE) | ||
| 33 | return IRQ_TYPE_EDGE_BOTH; | ||
| 34 | default: | ||
| 35 | return IRQ_TYPE_NONE; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | 20 | /** |
| 40 | * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI | 21 | * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI |
| 41 | * @gsi: GSI IRQ number to map | 22 | * @gsi: GSI IRQ number to map |
| @@ -82,7 +63,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, | |||
| 82 | 63 | ||
| 83 | fwspec.fwnode = acpi_gsi_domain_id; | 64 | fwspec.fwnode = acpi_gsi_domain_id; |
| 84 | fwspec.param[0] = gsi; | 65 | fwspec.param[0] = gsi; |
| 85 | fwspec.param[1] = acpi_gsi_get_irq_type(trigger, polarity); | 66 | fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity); |
| 86 | fwspec.param_count = 2; | 67 | fwspec.param_count = 2; |
| 87 | 68 | ||
| 88 | return irq_create_fwspec_mapping(&fwspec); | 69 | return irq_create_fwspec_mapping(&fwspec); |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 11d87bf67e73..1e6833a5cd44 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
| @@ -86,6 +86,14 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent); | |||
| 86 | #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ | 86 | #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ |
| 87 | ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) | 87 | ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) |
| 88 | 88 | ||
| 89 | extern struct list_head acpi_bus_id_list; | ||
| 90 | |||
| 91 | struct acpi_device_bus_id { | ||
| 92 | char bus_id[15]; | ||
| 93 | unsigned int instance_no; | ||
| 94 | struct list_head node; | ||
| 95 | }; | ||
| 96 | |||
| 89 | int acpi_device_add(struct acpi_device *device, | 97 | int acpi_device_add(struct acpi_device *device, |
| 90 | void (*release)(struct device *)); | 98 | void (*release)(struct device *)); |
| 91 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | 99 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 32d684af0ec7..67da6fb72274 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -220,6 +220,7 @@ void acpi_os_printf(const char *fmt, ...) | |||
| 220 | acpi_os_vprintf(fmt, args); | 220 | acpi_os_vprintf(fmt, args); |
| 221 | va_end(args); | 221 | va_end(args); |
| 222 | } | 222 | } |
| 223 | EXPORT_SYMBOL(acpi_os_printf); | ||
| 223 | 224 | ||
| 224 | void acpi_os_vprintf(const char *fmt, va_list args) | 225 | void acpi_os_vprintf(const char *fmt, va_list args) |
| 225 | { | 226 | { |
| @@ -234,7 +235,8 @@ void acpi_os_vprintf(const char *fmt, va_list args) | |||
| 234 | printk(KERN_CONT "%s", buffer); | 235 | printk(KERN_CONT "%s", buffer); |
| 235 | } | 236 | } |
| 236 | #else | 237 | #else |
| 237 | printk(KERN_CONT "%s", buffer); | 238 | if (acpi_debugger_write_log(buffer) < 0) |
| 239 | printk(KERN_CONT "%s", buffer); | ||
| 238 | #endif | 240 | #endif |
| 239 | } | 241 | } |
| 240 | 242 | ||
| @@ -364,6 +366,19 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) | |||
| 364 | iounmap(vaddr); | 366 | iounmap(vaddr); |
| 365 | } | 367 | } |
| 366 | 368 | ||
| 369 | /** | ||
| 370 | * acpi_os_map_iomem - Get a virtual address for a given physical address range. | ||
| 371 | * @phys: Start of the physical address range to map. | ||
| 372 | * @size: Size of the physical address range to map. | ||
| 373 | * | ||
| 374 | * Look up the given physical address range in the list of existing ACPI memory | ||
| 375 | * mappings. If found, get a reference to it and return a pointer to it (its | ||
| 376 | * virtual address). If not found, map it, add it to that list and return a | ||
| 377 | * pointer to it. | ||
| 378 | * | ||
| 379 | * During early init (when acpi_gbl_permanent_mmap has not been set yet) this | ||
| 380 | * routine simply calls __acpi_map_table() to get the job done. | ||
| 381 | */ | ||
| 367 | void __iomem *__init_refok | 382 | void __iomem *__init_refok |
| 368 | acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) | 383 | acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) |
| 369 | { | 384 | { |
| @@ -439,6 +454,20 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) | |||
| 439 | } | 454 | } |
| 440 | } | 455 | } |
| 441 | 456 | ||
| 457 | /** | ||
| 458 | * acpi_os_unmap_iomem - Drop a memory mapping reference. | ||
| 459 | * @virt: Start of the address range to drop a reference to. | ||
| 460 | * @size: Size of the address range to drop a reference to. | ||
| 461 | * | ||
| 462 | * Look up the given virtual address range in the list of existing ACPI memory | ||
| 463 | * mappings, drop a reference to it and unmap it if there are no more active | ||
| 464 | * references to it. | ||
| 465 | * | ||
| 466 | * During early init (when acpi_gbl_permanent_mmap has not been set yet) this | ||
| 467 | * routine simply calls __acpi_unmap_table() to get the job done. Since | ||
| 468 | * __acpi_unmap_table() is an __init function, the __ref annotation is needed | ||
| 469 | * here. | ||
| 470 | */ | ||
| 442 | void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) | 471 | void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) |
| 443 | { | 472 | { |
| 444 | struct acpi_ioremap *map; | 473 | struct acpi_ioremap *map; |
| @@ -1101,6 +1130,200 @@ static void acpi_os_execute_deferred(struct work_struct *work) | |||
| 1101 | kfree(dpc); | 1130 | kfree(dpc); |
| 1102 | } | 1131 | } |
| 1103 | 1132 | ||
| 1133 | #ifdef CONFIG_ACPI_DEBUGGER | ||
| 1134 | static struct acpi_debugger acpi_debugger; | ||
| 1135 | static bool acpi_debugger_initialized; | ||
| 1136 | |||
| 1137 | int acpi_register_debugger(struct module *owner, | ||
| 1138 | const struct acpi_debugger_ops *ops) | ||
| 1139 | { | ||
| 1140 | int ret = 0; | ||
| 1141 | |||
| 1142 | mutex_lock(&acpi_debugger.lock); | ||
| 1143 | if (acpi_debugger.ops) { | ||
| 1144 | ret = -EBUSY; | ||
| 1145 | goto err_lock; | ||
| 1146 | } | ||
| 1147 | |||
| 1148 | acpi_debugger.owner = owner; | ||
| 1149 | acpi_debugger.ops = ops; | ||
| 1150 | |||
| 1151 | err_lock: | ||
| 1152 | mutex_unlock(&acpi_debugger.lock); | ||
| 1153 | return ret; | ||
| 1154 | } | ||
| 1155 | EXPORT_SYMBOL(acpi_register_debugger); | ||
| 1156 | |||
| 1157 | void acpi_unregister_debugger(const struct acpi_debugger_ops *ops) | ||
| 1158 | { | ||
| 1159 | mutex_lock(&acpi_debugger.lock); | ||
| 1160 | if (ops == acpi_debugger.ops) { | ||
| 1161 | acpi_debugger.ops = NULL; | ||
| 1162 | acpi_debugger.owner = NULL; | ||
| 1163 | } | ||
| 1164 | mutex_unlock(&acpi_debugger.lock); | ||
| 1165 | } | ||
| 1166 | EXPORT_SYMBOL(acpi_unregister_debugger); | ||
| 1167 | |||
| 1168 | int acpi_debugger_create_thread(acpi_osd_exec_callback function, void *context) | ||
| 1169 | { | ||
| 1170 | int ret; | ||
| 1171 | int (*func)(acpi_osd_exec_callback, void *); | ||
| 1172 | struct module *owner; | ||
| 1173 | |||
| 1174 | if (!acpi_debugger_initialized) | ||
| 1175 | return -ENODEV; | ||
| 1176 | mutex_lock(&acpi_debugger.lock); | ||
| 1177 | if (!acpi_debugger.ops) { | ||
| 1178 | ret = -ENODEV; | ||
| 1179 | goto err_lock; | ||
| 1180 | } | ||
| 1181 | if (!try_module_get(acpi_debugger.owner)) { | ||
| 1182 | ret = -ENODEV; | ||
| 1183 | goto err_lock; | ||
| 1184 | } | ||
| 1185 | func = acpi_debugger.ops->create_thread; | ||
| 1186 | owner = acpi_debugger.owner; | ||
| 1187 | mutex_unlock(&acpi_debugger.lock); | ||
| 1188 | |||
| 1189 | ret = func(function, context); | ||
| 1190 | |||
| 1191 | mutex_lock(&acpi_debugger.lock); | ||
| 1192 | module_put(owner); | ||
| 1193 | err_lock: | ||
| 1194 | mutex_unlock(&acpi_debugger.lock); | ||
| 1195 | return ret; | ||
| 1196 | } | ||
| 1197 | |||
| 1198 | ssize_t acpi_debugger_write_log(const char *msg) | ||
| 1199 | { | ||
| 1200 | ssize_t ret; | ||
| 1201 | ssize_t (*func)(const char *); | ||
| 1202 | struct module *owner; | ||
| 1203 | |||
| 1204 | if (!acpi_debugger_initialized) | ||
| 1205 | return -ENODEV; | ||
| 1206 | mutex_lock(&acpi_debugger.lock); | ||
| 1207 | if (!acpi_debugger.ops) { | ||
| 1208 | ret = -ENODEV; | ||
| 1209 | goto err_lock; | ||
| 1210 | } | ||
| 1211 | if (!try_module_get(acpi_debugger.owner)) { | ||
| 1212 | ret = -ENODEV; | ||
| 1213 | goto err_lock; | ||
| 1214 | } | ||
| 1215 | func = acpi_debugger.ops->write_log; | ||
| 1216 | owner = acpi_debugger.owner; | ||
| 1217 | mutex_unlock(&acpi_debugger.lock); | ||
| 1218 | |||
| 1219 | ret = func(msg); | ||
| 1220 | |||
| 1221 | mutex_lock(&acpi_debugger.lock); | ||
| 1222 | module_put(owner); | ||
| 1223 | err_lock: | ||
| 1224 | mutex_unlock(&acpi_debugger.lock); | ||
| 1225 | return ret; | ||
| 1226 | } | ||
| 1227 | |||
| 1228 | ssize_t acpi_debugger_read_cmd(char *buffer, size_t buffer_length) | ||
| 1229 | { | ||
| 1230 | ssize_t ret; | ||
| 1231 | ssize_t (*func)(char *, size_t); | ||
| 1232 | struct module *owner; | ||
| 1233 | |||
| 1234 | if (!acpi_debugger_initialized) | ||
| 1235 | return -ENODEV; | ||
| 1236 | mutex_lock(&acpi_debugger.lock); | ||
| 1237 | if (!acpi_debugger.ops) { | ||
| 1238 | ret = -ENODEV; | ||
| 1239 | goto err_lock; | ||
| 1240 | } | ||
| 1241 | if (!try_module_get(acpi_debugger.owner)) { | ||
| 1242 | ret = -ENODEV; | ||
| 1243 | goto err_lock; | ||
| 1244 | } | ||
| 1245 | func = acpi_debugger.ops->read_cmd; | ||
| 1246 | owner = acpi_debugger.owner; | ||
| 1247 | mutex_unlock(&acpi_debugger.lock); | ||
| 1248 | |||
| 1249 | ret = func(buffer, buffer_length); | ||
| 1250 | |||
| 1251 | mutex_lock(&acpi_debugger.lock); | ||
| 1252 | module_put(owner); | ||
| 1253 | err_lock: | ||
| 1254 | mutex_unlock(&acpi_debugger.lock); | ||
| 1255 | return ret; | ||
| 1256 | } | ||
| 1257 | |||
| 1258 | int acpi_debugger_wait_command_ready(void) | ||
| 1259 | { | ||
| 1260 | int ret; | ||
| 1261 | int (*func)(bool, char *, size_t); | ||
| 1262 | struct module *owner; | ||
| 1263 | |||
| 1264 | if (!acpi_debugger_initialized) | ||
| 1265 | return -ENODEV; | ||
| 1266 | mutex_lock(&acpi_debugger.lock); | ||
| 1267 | if (!acpi_debugger.ops) { | ||
| 1268 | ret = -ENODEV; | ||
| 1269 | goto err_lock; | ||
| 1270 | } | ||
| 1271 | if (!try_module_get(acpi_debugger.owner)) { | ||
| 1272 | ret = -ENODEV; | ||
| 1273 | goto err_lock; | ||
| 1274 | } | ||
| 1275 | func = acpi_debugger.ops->wait_command_ready; | ||
| 1276 | owner = acpi_debugger.owner; | ||
| 1277 | mutex_unlock(&acpi_debugger.lock); | ||
| 1278 | |||
| 1279 | ret = func(acpi_gbl_method_executing, | ||
| 1280 | acpi_gbl_db_line_buf, ACPI_DB_LINE_BUFFER_SIZE); | ||
| 1281 | |||
| 1282 | mutex_lock(&acpi_debugger.lock); | ||
| 1283 | module_put(owner); | ||
| 1284 | err_lock: | ||
| 1285 | mutex_unlock(&acpi_debugger.lock); | ||
| 1286 | return ret; | ||
| 1287 | } | ||
| 1288 | |||
| 1289 | int acpi_debugger_notify_command_complete(void) | ||
| 1290 | { | ||
| 1291 | int ret; | ||
| 1292 | int (*func)(void); | ||
| 1293 | struct module *owner; | ||
| 1294 | |||
| 1295 | if (!acpi_debugger_initialized) | ||
| 1296 | return -ENODEV; | ||
| 1297 | mutex_lock(&acpi_debugger.lock); | ||
| 1298 | if (!acpi_debugger.ops) { | ||
| 1299 | ret = -ENODEV; | ||
| 1300 | goto err_lock; | ||
| 1301 | } | ||
| 1302 | if (!try_module_get(acpi_debugger.owner)) { | ||
| 1303 | ret = -ENODEV; | ||
| 1304 | goto err_lock; | ||
| 1305 | } | ||
| 1306 | func = acpi_debugger.ops->notify_command_complete; | ||
| 1307 | owner = acpi_debugger.owner; | ||
| 1308 | mutex_unlock(&acpi_debugger.lock); | ||
| 1309 | |||
| 1310 | ret = func(); | ||
| 1311 | |||
| 1312 | mutex_lock(&acpi_debugger.lock); | ||
| 1313 | module_put(owner); | ||
| 1314 | err_lock: | ||
| 1315 | mutex_unlock(&acpi_debugger.lock); | ||
| 1316 | return ret; | ||
| 1317 | } | ||
| 1318 | |||
| 1319 | int __init acpi_debugger_init(void) | ||
| 1320 | { | ||
| 1321 | mutex_init(&acpi_debugger.lock); | ||
| 1322 | acpi_debugger_initialized = true; | ||
| 1323 | return 0; | ||
| 1324 | } | ||
| 1325 | #endif | ||
| 1326 | |||
| 1104 | /******************************************************************************* | 1327 | /******************************************************************************* |
| 1105 | * | 1328 | * |
| 1106 | * FUNCTION: acpi_os_execute | 1329 | * FUNCTION: acpi_os_execute |
| @@ -1127,6 +1350,15 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
| 1127 | "Scheduling function [%p(%p)] for deferred execution.\n", | 1350 | "Scheduling function [%p(%p)] for deferred execution.\n", |
| 1128 | function, context)); | 1351 | function, context)); |
| 1129 | 1352 | ||
| 1353 | if (type == OSL_DEBUGGER_MAIN_THREAD) { | ||
| 1354 | ret = acpi_debugger_create_thread(function, context); | ||
| 1355 | if (ret) { | ||
| 1356 | pr_err("Call to kthread_create() failed.\n"); | ||
| 1357 | status = AE_ERROR; | ||
| 1358 | } | ||
| 1359 | goto out_thread; | ||
| 1360 | } | ||
| 1361 | |||
| 1130 | /* | 1362 | /* |
| 1131 | * Allocate/initialize DPC structure. Note that this memory will be | 1363 | * Allocate/initialize DPC structure. Note that this memory will be |
| 1132 | * freed by the callee. The kernel handles the work_struct list in a | 1364 | * freed by the callee. The kernel handles the work_struct list in a |
| @@ -1151,11 +1383,17 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
| 1151 | if (type == OSL_NOTIFY_HANDLER) { | 1383 | if (type == OSL_NOTIFY_HANDLER) { |
| 1152 | queue = kacpi_notify_wq; | 1384 | queue = kacpi_notify_wq; |
| 1153 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 1385 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
| 1154 | } else { | 1386 | } else if (type == OSL_GPE_HANDLER) { |
| 1155 | queue = kacpid_wq; | 1387 | queue = kacpid_wq; |
| 1156 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 1388 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
| 1389 | } else { | ||
| 1390 | pr_err("Unsupported os_execute type %d.\n", type); | ||
| 1391 | status = AE_ERROR; | ||
| 1157 | } | 1392 | } |
| 1158 | 1393 | ||
| 1394 | if (ACPI_FAILURE(status)) | ||
| 1395 | goto err_workqueue; | ||
| 1396 | |||
| 1159 | /* | 1397 | /* |
| 1160 | * On some machines, a software-initiated SMI causes corruption unless | 1398 | * On some machines, a software-initiated SMI causes corruption unless |
| 1161 | * the SMI runs on CPU 0. An SMI can be initiated by any AML, but | 1399 | * the SMI runs on CPU 0. An SMI can be initiated by any AML, but |
| @@ -1164,13 +1402,15 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
| 1164 | * queueing on CPU 0. | 1402 | * queueing on CPU 0. |
| 1165 | */ | 1403 | */ |
| 1166 | ret = queue_work_on(0, queue, &dpc->work); | 1404 | ret = queue_work_on(0, queue, &dpc->work); |
| 1167 | |||
| 1168 | if (!ret) { | 1405 | if (!ret) { |
| 1169 | printk(KERN_ERR PREFIX | 1406 | printk(KERN_ERR PREFIX |
| 1170 | "Call to queue_work() failed.\n"); | 1407 | "Call to queue_work() failed.\n"); |
| 1171 | status = AE_ERROR; | 1408 | status = AE_ERROR; |
| 1172 | kfree(dpc); | ||
| 1173 | } | 1409 | } |
| 1410 | err_workqueue: | ||
| 1411 | if (ACPI_FAILURE(status)) | ||
| 1412 | kfree(dpc); | ||
| 1413 | out_thread: | ||
| 1174 | return status; | 1414 | return status; |
| 1175 | } | 1415 | } |
| 1176 | EXPORT_SYMBOL(acpi_os_execute); | 1416 | EXPORT_SYMBOL(acpi_os_execute); |
| @@ -1358,10 +1598,39 @@ acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read) | |||
| 1358 | chars = strlen(buffer) - 1; | 1598 | chars = strlen(buffer) - 1; |
| 1359 | buffer[chars] = '\0'; | 1599 | buffer[chars] = '\0'; |
| 1360 | } | 1600 | } |
| 1601 | #else | ||
| 1602 | int ret; | ||
| 1603 | |||
| 1604 | ret = acpi_debugger_read_cmd(buffer, buffer_length); | ||
| 1605 | if (ret < 0) | ||
| 1606 | return AE_ERROR; | ||
| 1607 | if (bytes_read) | ||
| 1608 | *bytes_read = ret; | ||
| 1361 | #endif | 1609 | #endif |
| 1362 | 1610 | ||
| 1363 | return AE_OK; | 1611 | return AE_OK; |
| 1364 | } | 1612 | } |
| 1613 | EXPORT_SYMBOL(acpi_os_get_line); | ||
| 1614 | |||
| 1615 | acpi_status acpi_os_wait_command_ready(void) | ||
| 1616 | { | ||
| 1617 | int ret; | ||
| 1618 | |||
| 1619 | ret = acpi_debugger_wait_command_ready(); | ||
| 1620 | if (ret < 0) | ||
| 1621 | return AE_ERROR; | ||
| 1622 | return AE_OK; | ||
| 1623 | } | ||
| 1624 | |||
| 1625 | acpi_status acpi_os_notify_command_complete(void) | ||
| 1626 | { | ||
| 1627 | int ret; | ||
| 1628 | |||
| 1629 | ret = acpi_debugger_notify_command_complete(); | ||
| 1630 | if (ret < 0) | ||
| 1631 | return AE_ERROR; | ||
| 1632 | return AE_OK; | ||
| 1633 | } | ||
| 1365 | 1634 | ||
| 1366 | acpi_status acpi_os_signal(u32 function, void *info) | 1635 | acpi_status acpi_os_signal(u32 function, void *info) |
| 1367 | { | 1636 | { |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index c9336751e5e3..d30184c7f3bc 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
| @@ -131,9 +131,6 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, | |||
| 131 | quirk = &prt_quirks[i]; | 131 | quirk = &prt_quirks[i]; |
| 132 | 132 | ||
| 133 | /* All current quirks involve link devices, not GSIs */ | 133 | /* All current quirks involve link devices, not GSIs */ |
| 134 | if (!prt->source) | ||
| 135 | continue; | ||
| 136 | |||
| 137 | if (dmi_check_system(quirk->system) && | 134 | if (dmi_check_system(quirk->system) && |
| 138 | entry->id.segment == quirk->segment && | 135 | entry->id.segment == quirk->segment && |
| 139 | entry->id.bus == quirk->bus && | 136 | entry->id.bus == quirk->bus && |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 7c8408b946ca..fa2863567eed 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
| 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
| 6 | * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de> | 6 | * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de> |
| 7 | * Copyright (c) 2015, The Linux Foundation. All rights reserved. | ||
| 7 | * | 8 | * |
| 8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 9 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 9 | * | 10 | * |
| @@ -67,12 +68,12 @@ static struct acpi_scan_handler pci_link_handler = { | |||
| 67 | * later even the link is disable. Instead, we just repick the active irq | 68 | * later even the link is disable. Instead, we just repick the active irq |
| 68 | */ | 69 | */ |
| 69 | struct acpi_pci_link_irq { | 70 | struct acpi_pci_link_irq { |
| 70 | u8 active; /* Current IRQ */ | 71 | u32 active; /* Current IRQ */ |
| 71 | u8 triggering; /* All IRQs */ | 72 | u8 triggering; /* All IRQs */ |
| 72 | u8 polarity; /* All IRQs */ | 73 | u8 polarity; /* All IRQs */ |
| 73 | u8 resource_type; | 74 | u8 resource_type; |
| 74 | u8 possible_count; | 75 | u8 possible_count; |
| 75 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 76 | u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
| 76 | u8 initialized:1; | 77 | u8 initialized:1; |
| 77 | u8 reserved:7; | 78 | u8 reserved:7; |
| 78 | }; | 79 | }; |
| @@ -437,7 +438,6 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 437 | * enabled system. | 438 | * enabled system. |
| 438 | */ | 439 | */ |
| 439 | 440 | ||
| 440 | #define ACPI_MAX_IRQS 256 | ||
| 441 | #define ACPI_MAX_ISA_IRQ 16 | 441 | #define ACPI_MAX_ISA_IRQ 16 |
| 442 | 442 | ||
| 443 | #define PIRQ_PENALTY_PCI_AVAILABLE (0) | 443 | #define PIRQ_PENALTY_PCI_AVAILABLE (0) |
| @@ -447,7 +447,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 447 | #define PIRQ_PENALTY_ISA_USED (16*16*16*16*16) | 447 | #define PIRQ_PENALTY_ISA_USED (16*16*16*16*16) |
| 448 | #define PIRQ_PENALTY_ISA_ALWAYS (16*16*16*16*16*16) | 448 | #define PIRQ_PENALTY_ISA_ALWAYS (16*16*16*16*16*16) |
| 449 | 449 | ||
| 450 | static int acpi_irq_penalty[ACPI_MAX_IRQS] = { | 450 | static int acpi_irq_isa_penalty[ACPI_MAX_ISA_IRQ] = { |
| 451 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ | 451 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ |
| 452 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ | 452 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ |
| 453 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ | 453 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ |
| @@ -464,9 +464,68 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { | |||
| 464 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ | 464 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ |
| 465 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ | 465 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ |
| 466 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ | 466 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ |
| 467 | /* >IRQ15 */ | ||
| 468 | }; | 467 | }; |
| 469 | 468 | ||
| 469 | struct irq_penalty_info { | ||
| 470 | int irq; | ||
| 471 | int penalty; | ||
| 472 | struct list_head node; | ||
| 473 | }; | ||
| 474 | |||
| 475 | static LIST_HEAD(acpi_irq_penalty_list); | ||
| 476 | |||
| 477 | static int acpi_irq_get_penalty(int irq) | ||
| 478 | { | ||
| 479 | struct irq_penalty_info *irq_info; | ||
| 480 | |||
| 481 | if (irq < ACPI_MAX_ISA_IRQ) | ||
| 482 | return acpi_irq_isa_penalty[irq]; | ||
| 483 | |||
| 484 | list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { | ||
| 485 | if (irq_info->irq == irq) | ||
| 486 | return irq_info->penalty; | ||
| 487 | } | ||
| 488 | |||
| 489 | return 0; | ||
| 490 | } | ||
| 491 | |||
| 492 | static int acpi_irq_set_penalty(int irq, int new_penalty) | ||
| 493 | { | ||
| 494 | struct irq_penalty_info *irq_info; | ||
| 495 | |||
| 496 | /* see if this is a ISA IRQ */ | ||
| 497 | if (irq < ACPI_MAX_ISA_IRQ) { | ||
| 498 | acpi_irq_isa_penalty[irq] = new_penalty; | ||
| 499 | return 0; | ||
| 500 | } | ||
| 501 | |||
| 502 | /* next, try to locate from the dynamic list */ | ||
| 503 | list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { | ||
| 504 | if (irq_info->irq == irq) { | ||
| 505 | irq_info->penalty = new_penalty; | ||
| 506 | return 0; | ||
| 507 | } | ||
| 508 | } | ||
| 509 | |||
| 510 | /* nope, let's allocate a slot for this IRQ */ | ||
| 511 | irq_info = kzalloc(sizeof(*irq_info), GFP_KERNEL); | ||
| 512 | if (!irq_info) | ||
| 513 | return -ENOMEM; | ||
| 514 | |||
| 515 | irq_info->irq = irq; | ||
| 516 | irq_info->penalty = new_penalty; | ||
| 517 | list_add_tail(&irq_info->node, &acpi_irq_penalty_list); | ||
| 518 | |||
| 519 | return 0; | ||
| 520 | } | ||
| 521 | |||
| 522 | static void acpi_irq_add_penalty(int irq, int penalty) | ||
| 523 | { | ||
| 524 | int curpen = acpi_irq_get_penalty(irq); | ||
| 525 | |||
| 526 | acpi_irq_set_penalty(irq, curpen + penalty); | ||
| 527 | } | ||
| 528 | |||
| 470 | int __init acpi_irq_penalty_init(void) | 529 | int __init acpi_irq_penalty_init(void) |
| 471 | { | 530 | { |
| 472 | struct acpi_pci_link *link; | 531 | struct acpi_pci_link *link; |
| @@ -487,15 +546,16 @@ int __init acpi_irq_penalty_init(void) | |||
| 487 | link->irq.possible_count; | 546 | link->irq.possible_count; |
| 488 | 547 | ||
| 489 | for (i = 0; i < link->irq.possible_count; i++) { | 548 | for (i = 0; i < link->irq.possible_count; i++) { |
| 490 | if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) | 549 | if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) { |
| 491 | acpi_irq_penalty[link->irq. | 550 | int irqpos = link->irq.possible[i]; |
| 492 | possible[i]] += | 551 | |
| 493 | penalty; | 552 | acpi_irq_add_penalty(irqpos, penalty); |
| 553 | } | ||
| 494 | } | 554 | } |
| 495 | 555 | ||
| 496 | } else if (link->irq.active) { | 556 | } else if (link->irq.active) { |
| 497 | acpi_irq_penalty[link->irq.active] += | 557 | acpi_irq_add_penalty(link->irq.active, |
| 498 | PIRQ_PENALTY_PCI_POSSIBLE; | 558 | PIRQ_PENALTY_PCI_POSSIBLE); |
| 499 | } | 559 | } |
| 500 | } | 560 | } |
| 501 | 561 | ||
| @@ -547,12 +607,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
| 547 | * the use of IRQs 9, 10, 11, and >15. | 607 | * the use of IRQs 9, 10, 11, and >15. |
| 548 | */ | 608 | */ |
| 549 | for (i = (link->irq.possible_count - 1); i >= 0; i--) { | 609 | for (i = (link->irq.possible_count - 1); i >= 0; i--) { |
| 550 | if (acpi_irq_penalty[irq] > | 610 | if (acpi_irq_get_penalty(irq) > |
| 551 | acpi_irq_penalty[link->irq.possible[i]]) | 611 | acpi_irq_get_penalty(link->irq.possible[i])) |
| 552 | irq = link->irq.possible[i]; | 612 | irq = link->irq.possible[i]; |
| 553 | } | 613 | } |
| 554 | } | 614 | } |
| 555 | if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) { | 615 | if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { |
| 556 | printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " | 616 | printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " |
| 557 | "Try pci=noacpi or acpi=off\n", | 617 | "Try pci=noacpi or acpi=off\n", |
| 558 | acpi_device_name(link->device), | 618 | acpi_device_name(link->device), |
| @@ -568,7 +628,8 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
| 568 | acpi_device_bid(link->device)); | 628 | acpi_device_bid(link->device)); |
| 569 | return -ENODEV; | 629 | return -ENODEV; |
| 570 | } else { | 630 | } else { |
| 571 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; | 631 | acpi_irq_add_penalty(link->irq.active, PIRQ_PENALTY_PCI_USING); |
| 632 | |||
| 572 | printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", | 633 | printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", |
| 573 | acpi_device_name(link->device), | 634 | acpi_device_name(link->device), |
| 574 | acpi_device_bid(link->device), link->irq.active); | 635 | acpi_device_bid(link->device), link->irq.active); |
| @@ -778,7 +839,7 @@ static void acpi_pci_link_remove(struct acpi_device *device) | |||
| 778 | } | 839 | } |
| 779 | 840 | ||
| 780 | /* | 841 | /* |
| 781 | * modify acpi_irq_penalty[] from cmdline | 842 | * modify penalty from cmdline |
| 782 | */ | 843 | */ |
| 783 | static int __init acpi_irq_penalty_update(char *str, int used) | 844 | static int __init acpi_irq_penalty_update(char *str, int used) |
| 784 | { | 845 | { |
| @@ -796,13 +857,10 @@ static int __init acpi_irq_penalty_update(char *str, int used) | |||
| 796 | if (irq < 0) | 857 | if (irq < 0) |
| 797 | continue; | 858 | continue; |
| 798 | 859 | ||
| 799 | if (irq >= ARRAY_SIZE(acpi_irq_penalty)) | ||
| 800 | continue; | ||
| 801 | |||
| 802 | if (used) | 860 | if (used) |
| 803 | acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; | 861 | acpi_irq_add_penalty(irq, PIRQ_PENALTY_ISA_USED); |
| 804 | else | 862 | else |
| 805 | acpi_irq_penalty[irq] = PIRQ_PENALTY_PCI_AVAILABLE; | 863 | acpi_irq_set_penalty(irq, PIRQ_PENALTY_PCI_AVAILABLE); |
| 806 | 864 | ||
| 807 | if (retval != 2) /* no next number */ | 865 | if (retval != 2) /* no next number */ |
| 808 | break; | 866 | break; |
| @@ -819,18 +877,15 @@ static int __init acpi_irq_penalty_update(char *str, int used) | |||
| 819 | */ | 877 | */ |
| 820 | void acpi_penalize_isa_irq(int irq, int active) | 878 | void acpi_penalize_isa_irq(int irq, int active) |
| 821 | { | 879 | { |
| 822 | if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { | 880 | if (irq >= 0) |
| 823 | if (active) | 881 | acpi_irq_add_penalty(irq, active ? |
| 824 | acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; | 882 | PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING); |
| 825 | else | ||
| 826 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | ||
| 827 | } | ||
| 828 | } | 883 | } |
| 829 | 884 | ||
| 830 | bool acpi_isa_irq_available(int irq) | 885 | bool acpi_isa_irq_available(int irq) |
| 831 | { | 886 | { |
| 832 | return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) || | 887 | return irq >= 0 && |
| 833 | acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS); | 888 | (acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS); |
| 834 | } | 889 | } |
| 835 | 890 | ||
| 836 | /* | 891 | /* |
| @@ -840,13 +895,18 @@ bool acpi_isa_irq_available(int irq) | |||
| 840 | */ | 895 | */ |
| 841 | void acpi_penalize_sci_irq(int irq, int trigger, int polarity) | 896 | void acpi_penalize_sci_irq(int irq, int trigger, int polarity) |
| 842 | { | 897 | { |
| 843 | if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { | 898 | int penalty; |
| 844 | if (trigger != ACPI_MADT_TRIGGER_LEVEL || | 899 | |
| 845 | polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) | 900 | if (irq < 0) |
| 846 | acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_ALWAYS; | 901 | return; |
| 847 | else | 902 | |
| 848 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | 903 | if (trigger != ACPI_MADT_TRIGGER_LEVEL || |
| 849 | } | 904 | polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) |
| 905 | penalty = PIRQ_PENALTY_ISA_ALWAYS; | ||
| 906 | else | ||
| 907 | penalty = PIRQ_PENALTY_PCI_USING; | ||
| 908 | |||
| 909 | acpi_irq_add_penalty(irq, penalty); | ||
| 850 | } | 910 | } |
| 851 | 911 | ||
| 852 | /* | 912 | /* |
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 88f4306744c0..2aee41655ce9 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
| @@ -346,7 +346,7 @@ void acpi_free_properties(struct acpi_device *adev) | |||
| 346 | * | 346 | * |
| 347 | * Return: %0 if property with @name has been found (success), | 347 | * Return: %0 if property with @name has been found (success), |
| 348 | * %-EINVAL if the arguments are invalid, | 348 | * %-EINVAL if the arguments are invalid, |
| 349 | * %-ENODATA if the property doesn't exist, | 349 | * %-EINVAL if the property doesn't exist, |
| 350 | * %-EPROTO if the property value type doesn't match @type. | 350 | * %-EPROTO if the property value type doesn't match @type. |
| 351 | */ | 351 | */ |
| 352 | static int acpi_data_get_property(struct acpi_device_data *data, | 352 | static int acpi_data_get_property(struct acpi_device_data *data, |
| @@ -360,7 +360,7 @@ static int acpi_data_get_property(struct acpi_device_data *data, | |||
| 360 | return -EINVAL; | 360 | return -EINVAL; |
| 361 | 361 | ||
| 362 | if (!data->pointer || !data->properties) | 362 | if (!data->pointer || !data->properties) |
| 363 | return -ENODATA; | 363 | return -EINVAL; |
| 364 | 364 | ||
| 365 | properties = data->properties; | 365 | properties = data->properties; |
| 366 | for (i = 0; i < properties->package.count; i++) { | 366 | for (i = 0; i < properties->package.count; i++) { |
| @@ -375,13 +375,13 @@ static int acpi_data_get_property(struct acpi_device_data *data, | |||
| 375 | if (!strcmp(name, propname->string.pointer)) { | 375 | if (!strcmp(name, propname->string.pointer)) { |
| 376 | if (type != ACPI_TYPE_ANY && propvalue->type != type) | 376 | if (type != ACPI_TYPE_ANY && propvalue->type != type) |
| 377 | return -EPROTO; | 377 | return -EPROTO; |
| 378 | else if (obj) | 378 | if (obj) |
| 379 | *obj = propvalue; | 379 | *obj = propvalue; |
| 380 | 380 | ||
| 381 | return 0; | 381 | return 0; |
| 382 | } | 382 | } |
| 383 | } | 383 | } |
| 384 | return -ENODATA; | 384 | return -EINVAL; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | /** | 387 | /** |
| @@ -439,7 +439,7 @@ int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, | |||
| 439 | * | 439 | * |
| 440 | * Return: %0 if array property (package) with @name has been found (success), | 440 | * Return: %0 if array property (package) with @name has been found (success), |
| 441 | * %-EINVAL if the arguments are invalid, | 441 | * %-EINVAL if the arguments are invalid, |
| 442 | * %-ENODATA if the property doesn't exist, | 442 | * %-EINVAL if the property doesn't exist, |
| 443 | * %-EPROTO if the property is not a package or the type of its elements | 443 | * %-EPROTO if the property is not a package or the type of its elements |
| 444 | * doesn't match @type. | 444 | * doesn't match @type. |
| 445 | */ | 445 | */ |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index cdc5c2599beb..d02fd53042a5 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/export.h> | 23 | #include <linux/export.h> |
| 24 | #include <linux/ioport.h> | 24 | #include <linux/ioport.h> |
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/irq.h> | ||
| 26 | 27 | ||
| 27 | #ifdef CONFIG_X86 | 28 | #ifdef CONFIG_X86 |
| 28 | #define valid_IRQ(i) (((i) != 0) && ((i) != 2)) | 29 | #define valid_IRQ(i) (((i) != 0) && ((i) != 2)) |
| @@ -336,6 +337,31 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable) | |||
| 336 | } | 337 | } |
| 337 | EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); | 338 | EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); |
| 338 | 339 | ||
| 340 | /** | ||
| 341 | * acpi_dev_get_irq_type - Determine irq type. | ||
| 342 | * @triggering: Triggering type as provided by ACPI. | ||
| 343 | * @polarity: Interrupt polarity as provided by ACPI. | ||
| 344 | */ | ||
| 345 | unsigned int acpi_dev_get_irq_type(int triggering, int polarity) | ||
| 346 | { | ||
| 347 | switch (polarity) { | ||
| 348 | case ACPI_ACTIVE_LOW: | ||
| 349 | return triggering == ACPI_EDGE_SENSITIVE ? | ||
| 350 | IRQ_TYPE_EDGE_FALLING : | ||
| 351 | IRQ_TYPE_LEVEL_LOW; | ||
| 352 | case ACPI_ACTIVE_HIGH: | ||
| 353 | return triggering == ACPI_EDGE_SENSITIVE ? | ||
| 354 | IRQ_TYPE_EDGE_RISING : | ||
| 355 | IRQ_TYPE_LEVEL_HIGH; | ||
| 356 | case ACPI_ACTIVE_BOTH: | ||
| 357 | if (triggering == ACPI_EDGE_SENSITIVE) | ||
| 358 | return IRQ_TYPE_EDGE_BOTH; | ||
| 359 | default: | ||
| 360 | return IRQ_TYPE_NONE; | ||
| 361 | } | ||
| 362 | } | ||
| 363 | EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type); | ||
| 364 | |||
| 339 | static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) | 365 | static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) |
| 340 | { | 366 | { |
| 341 | res->start = gsi; | 367 | res->start = gsi; |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index cb3dedb1beae..ad0b13ad4bbb 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
| @@ -417,11 +417,11 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) | |||
| 417 | if ((value & 0xf000) != sel) { | 417 | if ((value & 0xf000) != sel) { |
| 418 | value &= 0x0fff; | 418 | value &= 0x0fff; |
| 419 | value |= sel; | 419 | value |= sel; |
| 420 | ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, | 420 | ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, |
| 421 | ACPI_SBS_MANAGER, | 421 | ACPI_SBS_MANAGER, |
| 422 | 0x01, (u8 *)&value, 2); | 422 | 0x01, (u8 *)&value, 2); |
| 423 | if (ret) | 423 | if (ret) |
| 424 | goto end; | 424 | goto end; |
| 425 | } | 425 | } |
| 426 | } | 426 | } |
| 427 | ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY, | 427 | ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY, |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 78d5f02a073b..407a3760e8de 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -39,7 +39,7 @@ static const char *dummy_hid = "device"; | |||
| 39 | 39 | ||
| 40 | static LIST_HEAD(acpi_dep_list); | 40 | static LIST_HEAD(acpi_dep_list); |
| 41 | static DEFINE_MUTEX(acpi_dep_list_lock); | 41 | static DEFINE_MUTEX(acpi_dep_list_lock); |
| 42 | static LIST_HEAD(acpi_bus_id_list); | 42 | LIST_HEAD(acpi_bus_id_list); |
| 43 | static DEFINE_MUTEX(acpi_scan_lock); | 43 | static DEFINE_MUTEX(acpi_scan_lock); |
| 44 | static LIST_HEAD(acpi_scan_handlers_list); | 44 | static LIST_HEAD(acpi_scan_handlers_list); |
| 45 | DEFINE_MUTEX(acpi_device_lock); | 45 | DEFINE_MUTEX(acpi_device_lock); |
| @@ -52,12 +52,6 @@ struct acpi_dep_data { | |||
| 52 | acpi_handle slave; | 52 | acpi_handle slave; |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | struct acpi_device_bus_id{ | ||
| 56 | char bus_id[15]; | ||
| 57 | unsigned int instance_no; | ||
| 58 | struct list_head node; | ||
| 59 | }; | ||
| 60 | |||
| 61 | void acpi_scan_lock_acquire(void) | 55 | void acpi_scan_lock_acquire(void) |
| 62 | { | 56 | { |
| 63 | mutex_lock(&acpi_scan_lock); | 57 | mutex_lock(&acpi_scan_lock); |
| @@ -471,10 +465,24 @@ static void acpi_device_release(struct device *dev) | |||
| 471 | 465 | ||
| 472 | static void acpi_device_del(struct acpi_device *device) | 466 | static void acpi_device_del(struct acpi_device *device) |
| 473 | { | 467 | { |
| 468 | struct acpi_device_bus_id *acpi_device_bus_id; | ||
| 469 | |||
| 474 | mutex_lock(&acpi_device_lock); | 470 | mutex_lock(&acpi_device_lock); |
| 475 | if (device->parent) | 471 | if (device->parent) |
| 476 | list_del(&device->node); | 472 | list_del(&device->node); |
| 477 | 473 | ||
| 474 | list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) | ||
| 475 | if (!strcmp(acpi_device_bus_id->bus_id, | ||
| 476 | acpi_device_hid(device))) { | ||
| 477 | if (acpi_device_bus_id->instance_no > 0) | ||
| 478 | acpi_device_bus_id->instance_no--; | ||
| 479 | else { | ||
| 480 | list_del(&acpi_device_bus_id->node); | ||
| 481 | kfree(acpi_device_bus_id); | ||
| 482 | } | ||
| 483 | break; | ||
| 484 | } | ||
| 485 | |||
| 478 | list_del(&device->wakeup_list); | 486 | list_del(&device->wakeup_list); |
| 479 | mutex_unlock(&acpi_device_lock); | 487 | mutex_unlock(&acpi_device_lock); |
| 480 | 488 | ||
| @@ -1461,7 +1469,7 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, | |||
| 1461 | *type = ACPI_BUS_TYPE_DEVICE; | 1469 | *type = ACPI_BUS_TYPE_DEVICE; |
| 1462 | status = acpi_bus_get_status_handle(handle, sta); | 1470 | status = acpi_bus_get_status_handle(handle, sta); |
| 1463 | if (ACPI_FAILURE(status)) | 1471 | if (ACPI_FAILURE(status)) |
| 1464 | return -ENODEV; | 1472 | *sta = 0; |
| 1465 | break; | 1473 | break; |
| 1466 | case ACPI_TYPE_PROCESSOR: | 1474 | case ACPI_TYPE_PROCESSOR: |
| 1467 | *type = ACPI_BUS_TYPE_PROCESSOR; | 1475 | *type = ACPI_BUS_TYPE_PROCESSOR; |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 0d94621dc856..9cb975200cac 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
| @@ -61,7 +61,7 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
| 61 | if (acpi_state == ACPI_STATE_S3) { | 61 | if (acpi_state == ACPI_STATE_S3) { |
| 62 | if (!acpi_wakeup_address) | 62 | if (!acpi_wakeup_address) |
| 63 | return -EFAULT; | 63 | return -EFAULT; |
| 64 | acpi_set_firmware_waking_vector(acpi_wakeup_address); | 64 | acpi_set_waking_vector(acpi_wakeup_address); |
| 65 | 65 | ||
| 66 | } | 66 | } |
| 67 | ACPI_FLUSH_CPU_CACHE(); | 67 | ACPI_FLUSH_CPU_CACHE(); |
| @@ -410,7 +410,7 @@ static void acpi_pm_finish(void) | |||
| 410 | acpi_leave_sleep_state(acpi_state); | 410 | acpi_leave_sleep_state(acpi_state); |
| 411 | 411 | ||
| 412 | /* reset firmware waking vector */ | 412 | /* reset firmware waking vector */ |
| 413 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | 413 | acpi_set_waking_vector(0); |
| 414 | 414 | ||
| 415 | acpi_target_sleep_state = ACPI_STATE_S0; | 415 | acpi_target_sleep_state = ACPI_STATE_S0; |
| 416 | 416 | ||
diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h index c797ffa568d5..a9cc34e663f9 100644 --- a/drivers/acpi/sleep.h +++ b/drivers/acpi/sleep.h | |||
| @@ -6,3 +6,9 @@ extern struct list_head acpi_wakeup_device_list; | |||
| 6 | extern struct mutex acpi_device_lock; | 6 | extern struct mutex acpi_device_lock; |
| 7 | 7 | ||
| 8 | extern void acpi_resume_power_resources(void); | 8 | extern void acpi_resume_power_resources(void); |
| 9 | |||
| 10 | static inline acpi_status acpi_set_waking_vector(u32 wakeup_address) | ||
| 11 | { | ||
| 12 | return acpi_set_firmware_waking_vector( | ||
| 13 | (acpi_physical_address)wakeup_address, 0); | ||
| 14 | } | ||
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 475c9079bf85..f2f9873bb5c3 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/dynamic_debug.h> | 29 | #include <linux/dynamic_debug.h> |
| 30 | 30 | ||
| 31 | #include "internal.h" | 31 | #include "internal.h" |
| 32 | #include "sleep.h" | ||
| 32 | 33 | ||
| 33 | #define _COMPONENT ACPI_BUS_COMPONENT | 34 | #define _COMPONENT ACPI_BUS_COMPONENT |
| 34 | ACPI_MODULE_NAME("utils"); | 35 | ACPI_MODULE_NAME("utils"); |
| @@ -709,6 +710,36 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs) | |||
| 709 | } | 710 | } |
| 710 | EXPORT_SYMBOL(acpi_check_dsm); | 711 | EXPORT_SYMBOL(acpi_check_dsm); |
| 711 | 712 | ||
| 713 | /** | ||
| 714 | * acpi_dev_present - Detect presence of a given ACPI device in the system. | ||
| 715 | * @hid: Hardware ID of the device. | ||
| 716 | * | ||
| 717 | * Return %true if the device was present at the moment of invocation. | ||
| 718 | * Note that if the device is pluggable, it may since have disappeared. | ||
| 719 | * | ||
| 720 | * For this function to work, acpi_bus_scan() must have been executed | ||
| 721 | * which happens in the subsys_initcall() subsection. Hence, do not | ||
| 722 | * call from a subsys_initcall() or earlier (use acpi_get_devices() | ||
| 723 | * instead). Calling from module_init() is fine (which is synonymous | ||
| 724 | * with device_initcall()). | ||
| 725 | */ | ||
| 726 | bool acpi_dev_present(const char *hid) | ||
| 727 | { | ||
| 728 | struct acpi_device_bus_id *acpi_device_bus_id; | ||
| 729 | bool found = false; | ||
| 730 | |||
| 731 | mutex_lock(&acpi_device_lock); | ||
| 732 | list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) | ||
| 733 | if (!strcmp(acpi_device_bus_id->bus_id, hid)) { | ||
| 734 | found = true; | ||
| 735 | break; | ||
| 736 | } | ||
| 737 | mutex_unlock(&acpi_device_lock); | ||
| 738 | |||
| 739 | return found; | ||
| 740 | } | ||
| 741 | EXPORT_SYMBOL(acpi_dev_present); | ||
| 742 | |||
| 712 | /* | 743 | /* |
| 713 | * acpi_backlight= handling, this is done here rather then in video_detect.c | 744 | * acpi_backlight= handling, this is done here rather then in video_detect.c |
| 714 | * because __setup cannot be used in modules. | 745 | * because __setup cannot be used in modules. |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index daaf1c4e1e0f..90e2d54be526 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
| @@ -250,6 +250,15 @@ static const struct dmi_system_id video_detect_dmi_table[] = { | |||
| 250 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"), | 250 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"), |
| 251 | }, | 251 | }, |
| 252 | }, | 252 | }, |
| 253 | { | ||
| 254 | /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */ | ||
| 255 | .callback = video_detect_force_video, | ||
| 256 | .ident = "SAMSUNG 530U4E/540U4E", | ||
| 257 | .matches = { | ||
| 258 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 259 | DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"), | ||
| 260 | }, | ||
| 261 | }, | ||
| 253 | 262 | ||
| 254 | /* Non win8 machines which need native backlight nevertheless */ | 263 | /* Non win8 machines which need native backlight nevertheless */ |
| 255 | { | 264 | { |
| @@ -279,6 +288,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { | |||
| 279 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"), | 288 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"), |
| 280 | }, | 289 | }, |
| 281 | }, | 290 | }, |
| 291 | { | ||
| 292 | .callback = video_detect_force_native, | ||
| 293 | .ident = "Dell Vostro V131", | ||
| 294 | .matches = { | ||
| 295 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 296 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), | ||
| 297 | }, | ||
| 298 | }, | ||
| 282 | { }, | 299 | { }, |
| 283 | }; | 300 | }; |
| 284 | 301 | ||
diff --git a/drivers/base/base.h b/drivers/base/base.h index 1782f3aa386e..e05db388bd1c 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
| @@ -131,6 +131,8 @@ extern void device_remove_groups(struct device *dev, | |||
| 131 | extern char *make_class_name(const char *name, struct kobject *kobj); | 131 | extern char *make_class_name(const char *name, struct kobject *kobj); |
| 132 | 132 | ||
| 133 | extern int devres_release_all(struct device *dev); | 133 | extern int devres_release_all(struct device *dev); |
| 134 | extern void device_block_probing(void); | ||
| 135 | extern void device_unblock_probing(void); | ||
| 134 | 136 | ||
| 135 | /* /sys/devices directory */ | 137 | /* /sys/devices directory */ |
| 136 | extern struct kset *devices_kset; | 138 | extern struct kset *devices_kset; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index b7d56c5ea3c6..0a8bdade53f2 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -2261,7 +2261,10 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) | |||
| 2261 | if (fwnode_is_primary(fn)) | 2261 | if (fwnode_is_primary(fn)) |
| 2262 | fn = fn->secondary; | 2262 | fn = fn->secondary; |
| 2263 | 2263 | ||
| 2264 | fwnode->secondary = fn; | 2264 | if (fn) { |
| 2265 | WARN_ON(fwnode->secondary); | ||
| 2266 | fwnode->secondary = fn; | ||
| 2267 | } | ||
| 2265 | dev->fwnode = fwnode; | 2268 | dev->fwnode = fwnode; |
| 2266 | } else { | 2269 | } else { |
| 2267 | dev->fwnode = fwnode_is_primary(dev->fwnode) ? | 2270 | dev->fwnode = fwnode_is_primary(dev->fwnode) ? |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index a641cf3ccad6..7399be790b5d 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
| @@ -55,6 +55,13 @@ static struct workqueue_struct *deferred_wq; | |||
| 55 | static atomic_t deferred_trigger_count = ATOMIC_INIT(0); | 55 | static atomic_t deferred_trigger_count = ATOMIC_INIT(0); |
| 56 | 56 | ||
| 57 | /* | 57 | /* |
| 58 | * In some cases, like suspend to RAM or hibernation, It might be reasonable | ||
| 59 | * to prohibit probing of devices as it could be unsafe. | ||
| 60 | * Once defer_all_probes is true all drivers probes will be forcibly deferred. | ||
| 61 | */ | ||
| 62 | static bool defer_all_probes; | ||
| 63 | |||
| 64 | /* | ||
| 58 | * deferred_probe_work_func() - Retry probing devices in the active list. | 65 | * deferred_probe_work_func() - Retry probing devices in the active list. |
| 59 | */ | 66 | */ |
| 60 | static void deferred_probe_work_func(struct work_struct *work) | 67 | static void deferred_probe_work_func(struct work_struct *work) |
| @@ -172,6 +179,30 @@ static void driver_deferred_probe_trigger(void) | |||
| 172 | } | 179 | } |
| 173 | 180 | ||
| 174 | /** | 181 | /** |
| 182 | * device_block_probing() - Block/defere device's probes | ||
| 183 | * | ||
| 184 | * It will disable probing of devices and defer their probes instead. | ||
| 185 | */ | ||
| 186 | void device_block_probing(void) | ||
| 187 | { | ||
| 188 | defer_all_probes = true; | ||
| 189 | /* sync with probes to avoid races. */ | ||
| 190 | wait_for_device_probe(); | ||
| 191 | } | ||
| 192 | |||
| 193 | /** | ||
| 194 | * device_unblock_probing() - Unblock/enable device's probes | ||
| 195 | * | ||
| 196 | * It will restore normal behavior and trigger re-probing of deferred | ||
| 197 | * devices. | ||
| 198 | */ | ||
| 199 | void device_unblock_probing(void) | ||
| 200 | { | ||
| 201 | defer_all_probes = false; | ||
| 202 | driver_deferred_probe_trigger(); | ||
| 203 | } | ||
| 204 | |||
| 205 | /** | ||
| 175 | * deferred_probe_initcall() - Enable probing of deferred devices | 206 | * deferred_probe_initcall() - Enable probing of deferred devices |
| 176 | * | 207 | * |
| 177 | * We don't want to get in the way when the bulk of drivers are getting probed. | 208 | * We don't want to get in the way when the bulk of drivers are getting probed. |
| @@ -268,6 +299,9 @@ int device_bind_driver(struct device *dev) | |||
| 268 | ret = driver_sysfs_add(dev); | 299 | ret = driver_sysfs_add(dev); |
| 269 | if (!ret) | 300 | if (!ret) |
| 270 | driver_bound(dev); | 301 | driver_bound(dev); |
| 302 | else if (dev->bus) | ||
| 303 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, | ||
| 304 | BUS_NOTIFY_DRIVER_NOT_BOUND, dev); | ||
| 271 | return ret; | 305 | return ret; |
| 272 | } | 306 | } |
| 273 | EXPORT_SYMBOL_GPL(device_bind_driver); | 307 | EXPORT_SYMBOL_GPL(device_bind_driver); |
| @@ -277,9 +311,20 @@ static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue); | |||
| 277 | 311 | ||
| 278 | static int really_probe(struct device *dev, struct device_driver *drv) | 312 | static int really_probe(struct device *dev, struct device_driver *drv) |
| 279 | { | 313 | { |
| 280 | int ret = 0; | 314 | int ret = -EPROBE_DEFER; |
| 281 | int local_trigger_count = atomic_read(&deferred_trigger_count); | 315 | int local_trigger_count = atomic_read(&deferred_trigger_count); |
| 282 | 316 | ||
| 317 | if (defer_all_probes) { | ||
| 318 | /* | ||
| 319 | * Value of defer_all_probes can be set only by | ||
| 320 | * device_defer_all_probes_enable() which, in turn, will call | ||
| 321 | * wait_for_device_probe() right after that to avoid any races. | ||
| 322 | */ | ||
| 323 | dev_dbg(dev, "Driver %s force probe deferral\n", drv->name); | ||
| 324 | driver_deferred_probe_add(dev); | ||
| 325 | return ret; | ||
| 326 | } | ||
| 327 | |||
| 283 | atomic_inc(&probe_count); | 328 | atomic_inc(&probe_count); |
| 284 | pr_debug("bus: '%s': %s: probing driver %s with device %s\n", | 329 | pr_debug("bus: '%s': %s: probing driver %s with device %s\n", |
| 285 | drv->bus->name, __func__, drv->name, dev_name(dev)); | 330 | drv->bus->name, __func__, drv->name, dev_name(dev)); |
| @@ -290,7 +335,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) | |||
| 290 | /* If using pinctrl, bind pins now before probing */ | 335 | /* If using pinctrl, bind pins now before probing */ |
| 291 | ret = pinctrl_bind_pins(dev); | 336 | ret = pinctrl_bind_pins(dev); |
| 292 | if (ret) | 337 | if (ret) |
| 293 | goto probe_failed; | 338 | goto pinctrl_bind_failed; |
| 294 | 339 | ||
| 295 | if (driver_sysfs_add(dev)) { | 340 | if (driver_sysfs_add(dev)) { |
| 296 | printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", | 341 | printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", |
| @@ -334,12 +379,17 @@ static int really_probe(struct device *dev, struct device_driver *drv) | |||
| 334 | goto done; | 379 | goto done; |
| 335 | 380 | ||
| 336 | probe_failed: | 381 | probe_failed: |
| 382 | if (dev->bus) | ||
| 383 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, | ||
| 384 | BUS_NOTIFY_DRIVER_NOT_BOUND, dev); | ||
| 385 | pinctrl_bind_failed: | ||
| 337 | devres_release_all(dev); | 386 | devres_release_all(dev); |
| 338 | driver_sysfs_remove(dev); | 387 | driver_sysfs_remove(dev); |
| 339 | dev->driver = NULL; | 388 | dev->driver = NULL; |
| 340 | dev_set_drvdata(dev, NULL); | 389 | dev_set_drvdata(dev, NULL); |
| 341 | if (dev->pm_domain && dev->pm_domain->dismiss) | 390 | if (dev->pm_domain && dev->pm_domain->dismiss) |
| 342 | dev->pm_domain->dismiss(dev); | 391 | dev->pm_domain->dismiss(dev); |
| 392 | pm_runtime_reinit(dev); | ||
| 343 | 393 | ||
| 344 | switch (ret) { | 394 | switch (ret) { |
| 345 | case -EPROBE_DEFER: | 395 | case -EPROBE_DEFER: |
| @@ -393,6 +443,10 @@ int driver_probe_done(void) | |||
| 393 | */ | 443 | */ |
| 394 | void wait_for_device_probe(void) | 444 | void wait_for_device_probe(void) |
| 395 | { | 445 | { |
| 446 | /* wait for the deferred probe workqueue to finish */ | ||
| 447 | if (driver_deferred_probe_enable) | ||
| 448 | flush_workqueue(deferred_wq); | ||
| 449 | |||
| 396 | /* wait for the known devices to complete their probing */ | 450 | /* wait for the known devices to complete their probing */ |
| 397 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); | 451 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); |
| 398 | async_synchronize_full(); | 452 | async_synchronize_full(); |
| @@ -695,13 +749,13 @@ static void __device_release_driver(struct device *dev) | |||
| 695 | dev_set_drvdata(dev, NULL); | 749 | dev_set_drvdata(dev, NULL); |
| 696 | if (dev->pm_domain && dev->pm_domain->dismiss) | 750 | if (dev->pm_domain && dev->pm_domain->dismiss) |
| 697 | dev->pm_domain->dismiss(dev); | 751 | dev->pm_domain->dismiss(dev); |
| 752 | pm_runtime_reinit(dev); | ||
| 698 | 753 | ||
| 699 | klist_remove(&dev->p->knode_driver); | 754 | klist_remove(&dev->p->knode_driver); |
| 700 | if (dev->bus) | 755 | if (dev->bus) |
| 701 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, | 756 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, |
| 702 | BUS_NOTIFY_UNBOUND_DRIVER, | 757 | BUS_NOTIFY_UNBOUND_DRIVER, |
| 703 | dev); | 758 | dev); |
| 704 | |||
| 705 | } | 759 | } |
| 706 | } | 760 | } |
| 707 | 761 | ||
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 73e399466c6e..8dcbb266643b 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/acpi.h> | 26 | #include <linux/acpi.h> |
| 27 | #include <linux/clk/clk-conf.h> | 27 | #include <linux/clk/clk-conf.h> |
| 28 | #include <linux/limits.h> | 28 | #include <linux/limits.h> |
| 29 | #include <linux/property.h> | ||
| 29 | 30 | ||
| 30 | #include "base.h" | 31 | #include "base.h" |
| 31 | #include "power/power.h" | 32 | #include "power/power.h" |
| @@ -319,6 +320,22 @@ int platform_device_add_data(struct platform_device *pdev, const void *data, | |||
| 319 | EXPORT_SYMBOL_GPL(platform_device_add_data); | 320 | EXPORT_SYMBOL_GPL(platform_device_add_data); |
| 320 | 321 | ||
| 321 | /** | 322 | /** |
| 323 | * platform_device_add_properties - add built-in properties to a platform device | ||
| 324 | * @pdev: platform device to add properties to | ||
| 325 | * @pset: properties to add | ||
| 326 | * | ||
| 327 | * The function will take deep copy of the properties in @pset and attach | ||
| 328 | * the copy to the platform device. The memory associated with properties | ||
| 329 | * will be freed when the platform device is released. | ||
| 330 | */ | ||
| 331 | int platform_device_add_properties(struct platform_device *pdev, | ||
| 332 | const struct property_set *pset) | ||
| 333 | { | ||
| 334 | return device_add_property_set(&pdev->dev, pset); | ||
| 335 | } | ||
| 336 | EXPORT_SYMBOL_GPL(platform_device_add_properties); | ||
| 337 | |||
| 338 | /** | ||
| 322 | * platform_device_add - add a platform device to device hierarchy | 339 | * platform_device_add - add a platform device to device hierarchy |
| 323 | * @pdev: platform device we're adding | 340 | * @pdev: platform device we're adding |
| 324 | * | 341 | * |
| @@ -429,6 +446,8 @@ void platform_device_del(struct platform_device *pdev) | |||
| 429 | if (r->parent) | 446 | if (r->parent) |
| 430 | release_resource(r); | 447 | release_resource(r); |
| 431 | } | 448 | } |
| 449 | |||
| 450 | device_remove_property_set(&pdev->dev); | ||
| 432 | } | 451 | } |
| 433 | } | 452 | } |
| 434 | EXPORT_SYMBOL_GPL(platform_device_del); | 453 | EXPORT_SYMBOL_GPL(platform_device_del); |
| @@ -507,6 +526,12 @@ struct platform_device *platform_device_register_full( | |||
| 507 | if (ret) | 526 | if (ret) |
| 508 | goto err; | 527 | goto err; |
| 509 | 528 | ||
| 529 | if (pdevinfo->pset) { | ||
| 530 | ret = platform_device_add_properties(pdev, pdevinfo->pset); | ||
| 531 | if (ret) | ||
| 532 | goto err; | ||
| 533 | } | ||
| 534 | |||
| 510 | ret = platform_device_add(pdev); | 535 | ret = platform_device_add(pdev); |
| 511 | if (ret) { | 536 | if (ret) { |
| 512 | err: | 537 | err: |
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 60ee5591ee8f..c39b8617280f 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c | |||
| @@ -473,6 +473,7 @@ static int pm_clk_notify(struct notifier_block *nb, | |||
| 473 | enable_clock(dev, NULL); | 473 | enable_clock(dev, NULL); |
| 474 | } | 474 | } |
| 475 | break; | 475 | break; |
| 476 | case BUS_NOTIFY_DRIVER_NOT_BOUND: | ||
| 476 | case BUS_NOTIFY_UNBOUND_DRIVER: | 477 | case BUS_NOTIFY_UNBOUND_DRIVER: |
| 477 | if (clknb->con_ids[0]) { | 478 | if (clknb->con_ids[0]) { |
| 478 | for (con_id = clknb->con_ids; *con_id; con_id++) | 479 | for (con_id = clknb->con_ids; *con_id; con_id++) |
diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c index f32b802b98f4..f48e33385b3e 100644 --- a/drivers/base/power/common.c +++ b/drivers/base/power/common.c | |||
| @@ -112,7 +112,7 @@ EXPORT_SYMBOL_GPL(dev_pm_domain_attach); | |||
| 112 | 112 | ||
| 113 | /** | 113 | /** |
| 114 | * dev_pm_domain_detach - Detach a device from its PM domain. | 114 | * dev_pm_domain_detach - Detach a device from its PM domain. |
| 115 | * @dev: Device to attach. | 115 | * @dev: Device to detach. |
| 116 | * @power_off: Used to indicate whether we should power off the device. | 116 | * @power_off: Used to indicate whether we should power off the device. |
| 117 | * | 117 | * |
| 118 | * This functions will reverse the actions from dev_pm_domain_attach() and thus | 118 | * This functions will reverse the actions from dev_pm_domain_attach() and thus |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 65f50eccd49b..b80379012840 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
| @@ -1263,6 +1263,7 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, | |||
| 1263 | 1263 | ||
| 1264 | return ret; | 1264 | return ret; |
| 1265 | } | 1265 | } |
| 1266 | EXPORT_SYMBOL_GPL(__pm_genpd_add_device); | ||
| 1266 | 1267 | ||
| 1267 | /** | 1268 | /** |
| 1268 | * pm_genpd_remove_device - Remove a device from an I/O PM domain. | 1269 | * pm_genpd_remove_device - Remove a device from an I/O PM domain. |
| @@ -1313,6 +1314,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, | |||
| 1313 | 1314 | ||
| 1314 | return ret; | 1315 | return ret; |
| 1315 | } | 1316 | } |
| 1317 | EXPORT_SYMBOL_GPL(pm_genpd_remove_device); | ||
| 1316 | 1318 | ||
| 1317 | /** | 1319 | /** |
| 1318 | * pm_genpd_add_subdomain - Add a subdomain to an I/O PM domain. | 1320 | * pm_genpd_add_subdomain - Add a subdomain to an I/O PM domain. |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 1710c26ba097..9d626ac08d9c 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -963,6 +963,9 @@ void dpm_complete(pm_message_t state) | |||
| 963 | } | 963 | } |
| 964 | list_splice(&list, &dpm_list); | 964 | list_splice(&list, &dpm_list); |
| 965 | mutex_unlock(&dpm_list_mtx); | 965 | mutex_unlock(&dpm_list_mtx); |
| 966 | |||
| 967 | /* Allow device probing and trigger re-probing of deferred devices */ | ||
| 968 | device_unblock_probing(); | ||
| 966 | trace_suspend_resume(TPS("dpm_complete"), state.event, false); | 969 | trace_suspend_resume(TPS("dpm_complete"), state.event, false); |
| 967 | } | 970 | } |
| 968 | 971 | ||
| @@ -1624,6 +1627,20 @@ int dpm_prepare(pm_message_t state) | |||
| 1624 | trace_suspend_resume(TPS("dpm_prepare"), state.event, true); | 1627 | trace_suspend_resume(TPS("dpm_prepare"), state.event, true); |
| 1625 | might_sleep(); | 1628 | might_sleep(); |
| 1626 | 1629 | ||
| 1630 | /* | ||
| 1631 | * Give a chance for the known devices to complete their probes, before | ||
| 1632 | * disable probing of devices. This sync point is important at least | ||
| 1633 | * at boot time + hibernation restore. | ||
| 1634 | */ | ||
| 1635 | wait_for_device_probe(); | ||
| 1636 | /* | ||
| 1637 | * It is unsafe if probing of devices will happen during suspend or | ||
| 1638 | * hibernation and system behavior will be unpredictable in this case. | ||
| 1639 | * So, let's prohibit device's probing here and defer their probes | ||
| 1640 | * instead. The normal behavior will be restored in dpm_complete(). | ||
| 1641 | */ | ||
| 1642 | device_block_probing(); | ||
| 1643 | |||
| 1627 | mutex_lock(&dpm_list_mtx); | 1644 | mutex_lock(&dpm_list_mtx); |
| 1628 | while (!list_empty(&dpm_list)) { | 1645 | while (!list_empty(&dpm_list)) { |
| 1629 | struct device *dev = to_device(dpm_list.next); | 1646 | struct device *dev = to_device(dpm_list.next); |
diff --git a/drivers/base/power/opp/Makefile b/drivers/base/power/opp/Makefile index 33c1e18c41a4..19837ef04d8e 100644 --- a/drivers/base/power/opp/Makefile +++ b/drivers/base/power/opp/Makefile | |||
| @@ -1,2 +1,3 @@ | |||
| 1 | ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG | 1 | ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG |
| 2 | obj-y += core.o cpu.o | 2 | obj-y += core.o cpu.o |
| 3 | obj-$(CONFIG_DEBUG_FS) += debugfs.o | ||
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index b8e76f75073b..cf351d3dab1c 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c | |||
| @@ -463,6 +463,7 @@ static void _kfree_list_dev_rcu(struct rcu_head *head) | |||
| 463 | static void _remove_list_dev(struct device_list_opp *list_dev, | 463 | static void _remove_list_dev(struct device_list_opp *list_dev, |
| 464 | struct device_opp *dev_opp) | 464 | struct device_opp *dev_opp) |
| 465 | { | 465 | { |
| 466 | opp_debug_unregister(list_dev, dev_opp); | ||
| 466 | list_del(&list_dev->node); | 467 | list_del(&list_dev->node); |
| 467 | call_srcu(&dev_opp->srcu_head.srcu, &list_dev->rcu_head, | 468 | call_srcu(&dev_opp->srcu_head.srcu, &list_dev->rcu_head, |
| 468 | _kfree_list_dev_rcu); | 469 | _kfree_list_dev_rcu); |
| @@ -472,6 +473,7 @@ struct device_list_opp *_add_list_dev(const struct device *dev, | |||
| 472 | struct device_opp *dev_opp) | 473 | struct device_opp *dev_opp) |
| 473 | { | 474 | { |
| 474 | struct device_list_opp *list_dev; | 475 | struct device_list_opp *list_dev; |
| 476 | int ret; | ||
| 475 | 477 | ||
| 476 | list_dev = kzalloc(sizeof(*list_dev), GFP_KERNEL); | 478 | list_dev = kzalloc(sizeof(*list_dev), GFP_KERNEL); |
| 477 | if (!list_dev) | 479 | if (!list_dev) |
| @@ -481,6 +483,12 @@ struct device_list_opp *_add_list_dev(const struct device *dev, | |||
| 481 | list_dev->dev = dev; | 483 | list_dev->dev = dev; |
| 482 | list_add_rcu(&list_dev->node, &dev_opp->dev_list); | 484 | list_add_rcu(&list_dev->node, &dev_opp->dev_list); |
| 483 | 485 | ||
| 486 | /* Create debugfs entries for the dev_opp */ | ||
| 487 | ret = opp_debug_register(list_dev, dev_opp); | ||
| 488 | if (ret) | ||
| 489 | dev_err(dev, "%s: Failed to register opp debugfs (%d)\n", | ||
| 490 | __func__, ret); | ||
| 491 | |||
| 484 | return list_dev; | 492 | return list_dev; |
| 485 | } | 493 | } |
| 486 | 494 | ||
| @@ -551,6 +559,12 @@ static void _remove_device_opp(struct device_opp *dev_opp) | |||
| 551 | if (!list_empty(&dev_opp->opp_list)) | 559 | if (!list_empty(&dev_opp->opp_list)) |
| 552 | return; | 560 | return; |
| 553 | 561 | ||
| 562 | if (dev_opp->supported_hw) | ||
| 563 | return; | ||
| 564 | |||
| 565 | if (dev_opp->prop_name) | ||
| 566 | return; | ||
| 567 | |||
| 554 | list_dev = list_first_entry(&dev_opp->dev_list, struct device_list_opp, | 568 | list_dev = list_first_entry(&dev_opp->dev_list, struct device_list_opp, |
| 555 | node); | 569 | node); |
| 556 | 570 | ||
| @@ -596,6 +610,7 @@ static void _opp_remove(struct device_opp *dev_opp, | |||
| 596 | */ | 610 | */ |
| 597 | if (notify) | 611 | if (notify) |
| 598 | srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_REMOVE, opp); | 612 | srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_REMOVE, opp); |
| 613 | opp_debug_remove_one(opp); | ||
| 599 | list_del_rcu(&opp->node); | 614 | list_del_rcu(&opp->node); |
| 600 | call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, _kfree_opp_rcu); | 615 | call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, _kfree_opp_rcu); |
| 601 | 616 | ||
| @@ -673,6 +688,7 @@ static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, | |||
| 673 | { | 688 | { |
| 674 | struct dev_pm_opp *opp; | 689 | struct dev_pm_opp *opp; |
| 675 | struct list_head *head = &dev_opp->opp_list; | 690 | struct list_head *head = &dev_opp->opp_list; |
| 691 | int ret; | ||
| 676 | 692 | ||
| 677 | /* | 693 | /* |
| 678 | * Insert new OPP in order of increasing frequency and discard if | 694 | * Insert new OPP in order of increasing frequency and discard if |
| @@ -703,6 +719,11 @@ static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, | |||
| 703 | new_opp->dev_opp = dev_opp; | 719 | new_opp->dev_opp = dev_opp; |
| 704 | list_add_rcu(&new_opp->node, head); | 720 | list_add_rcu(&new_opp->node, head); |
| 705 | 721 | ||
| 722 | ret = opp_debug_create_one(new_opp, dev_opp); | ||
| 723 | if (ret) | ||
| 724 | dev_err(dev, "%s: Failed to register opp to debugfs (%d)\n", | ||
| 725 | __func__, ret); | ||
| 726 | |||
| 706 | return 0; | 727 | return 0; |
| 707 | } | 728 | } |
| 708 | 729 | ||
| @@ -776,35 +797,49 @@ unlock: | |||
| 776 | } | 797 | } |
| 777 | 798 | ||
| 778 | /* TODO: Support multiple regulators */ | 799 | /* TODO: Support multiple regulators */ |
| 779 | static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev) | 800 | static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, |
| 801 | struct device_opp *dev_opp) | ||
| 780 | { | 802 | { |
| 781 | u32 microvolt[3] = {0}; | 803 | u32 microvolt[3] = {0}; |
| 782 | u32 val; | 804 | u32 val; |
| 783 | int count, ret; | 805 | int count, ret; |
| 806 | struct property *prop = NULL; | ||
| 807 | char name[NAME_MAX]; | ||
| 808 | |||
| 809 | /* Search for "opp-microvolt-<name>" */ | ||
| 810 | if (dev_opp->prop_name) { | ||
| 811 | snprintf(name, sizeof(name), "opp-microvolt-%s", | ||
| 812 | dev_opp->prop_name); | ||
| 813 | prop = of_find_property(opp->np, name, NULL); | ||
| 814 | } | ||
| 784 | 815 | ||
| 785 | /* Missing property isn't a problem, but an invalid entry is */ | 816 | if (!prop) { |
| 786 | if (!of_find_property(opp->np, "opp-microvolt", NULL)) | 817 | /* Search for "opp-microvolt" */ |
| 787 | return 0; | 818 | sprintf(name, "opp-microvolt"); |
| 819 | prop = of_find_property(opp->np, name, NULL); | ||
| 788 | 820 | ||
| 789 | count = of_property_count_u32_elems(opp->np, "opp-microvolt"); | 821 | /* Missing property isn't a problem, but an invalid entry is */ |
| 822 | if (!prop) | ||
| 823 | return 0; | ||
| 824 | } | ||
| 825 | |||
| 826 | count = of_property_count_u32_elems(opp->np, name); | ||
| 790 | if (count < 0) { | 827 | if (count < 0) { |
| 791 | dev_err(dev, "%s: Invalid opp-microvolt property (%d)\n", | 828 | dev_err(dev, "%s: Invalid %s property (%d)\n", |
| 792 | __func__, count); | 829 | __func__, name, count); |
| 793 | return count; | 830 | return count; |
| 794 | } | 831 | } |
| 795 | 832 | ||
| 796 | /* There can be one or three elements here */ | 833 | /* There can be one or three elements here */ |
| 797 | if (count != 1 && count != 3) { | 834 | if (count != 1 && count != 3) { |
| 798 | dev_err(dev, "%s: Invalid number of elements in opp-microvolt property (%d)\n", | 835 | dev_err(dev, "%s: Invalid number of elements in %s property (%d)\n", |
| 799 | __func__, count); | 836 | __func__, name, count); |
| 800 | return -EINVAL; | 837 | return -EINVAL; |
| 801 | } | 838 | } |
| 802 | 839 | ||
| 803 | ret = of_property_read_u32_array(opp->np, "opp-microvolt", microvolt, | 840 | ret = of_property_read_u32_array(opp->np, name, microvolt, count); |
| 804 | count); | ||
| 805 | if (ret) { | 841 | if (ret) { |
| 806 | dev_err(dev, "%s: error parsing opp-microvolt: %d\n", __func__, | 842 | dev_err(dev, "%s: error parsing %s: %d\n", __func__, name, ret); |
| 807 | ret); | ||
| 808 | return -EINVAL; | 843 | return -EINVAL; |
| 809 | } | 844 | } |
| 810 | 845 | ||
| @@ -812,13 +847,272 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev) | |||
| 812 | opp->u_volt_min = microvolt[1]; | 847 | opp->u_volt_min = microvolt[1]; |
| 813 | opp->u_volt_max = microvolt[2]; | 848 | opp->u_volt_max = microvolt[2]; |
| 814 | 849 | ||
| 815 | if (!of_property_read_u32(opp->np, "opp-microamp", &val)) | 850 | /* Search for "opp-microamp-<name>" */ |
| 851 | prop = NULL; | ||
| 852 | if (dev_opp->prop_name) { | ||
| 853 | snprintf(name, sizeof(name), "opp-microamp-%s", | ||
| 854 | dev_opp->prop_name); | ||
| 855 | prop = of_find_property(opp->np, name, NULL); | ||
| 856 | } | ||
| 857 | |||
| 858 | if (!prop) { | ||
| 859 | /* Search for "opp-microamp" */ | ||
| 860 | sprintf(name, "opp-microamp"); | ||
| 861 | prop = of_find_property(opp->np, name, NULL); | ||
| 862 | } | ||
| 863 | |||
| 864 | if (prop && !of_property_read_u32(opp->np, name, &val)) | ||
| 816 | opp->u_amp = val; | 865 | opp->u_amp = val; |
| 817 | 866 | ||
| 818 | return 0; | 867 | return 0; |
| 819 | } | 868 | } |
| 820 | 869 | ||
| 821 | /** | 870 | /** |
| 871 | * dev_pm_opp_set_supported_hw() - Set supported platforms | ||
| 872 | * @dev: Device for which supported-hw has to be set. | ||
| 873 | * @versions: Array of hierarchy of versions to match. | ||
| 874 | * @count: Number of elements in the array. | ||
| 875 | * | ||
| 876 | * This is required only for the V2 bindings, and it enables a platform to | ||
| 877 | * specify the hierarchy of versions it supports. OPP layer will then enable | ||
| 878 | * OPPs, which are available for those versions, based on its 'opp-supported-hw' | ||
| 879 | * property. | ||
| 880 | * | ||
| 881 | * Locking: The internal device_opp and opp structures are RCU protected. | ||
| 882 | * Hence this function internally uses RCU updater strategy with mutex locks | ||
| 883 | * to keep the integrity of the internal data structures. Callers should ensure | ||
| 884 | * that this function is *NOT* called under RCU protection or in contexts where | ||
| 885 | * mutex cannot be locked. | ||
| 886 | */ | ||
| 887 | int dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, | ||
| 888 | unsigned int count) | ||
| 889 | { | ||
| 890 | struct device_opp *dev_opp; | ||
| 891 | int ret = 0; | ||
| 892 | |||
| 893 | /* Hold our list modification lock here */ | ||
| 894 | mutex_lock(&dev_opp_list_lock); | ||
| 895 | |||
| 896 | dev_opp = _add_device_opp(dev); | ||
| 897 | if (!dev_opp) { | ||
| 898 | ret = -ENOMEM; | ||
| 899 | goto unlock; | ||
| 900 | } | ||
| 901 | |||
| 902 | /* Make sure there are no concurrent readers while updating dev_opp */ | ||
| 903 | WARN_ON(!list_empty(&dev_opp->opp_list)); | ||
| 904 | |||
| 905 | /* Do we already have a version hierarchy associated with dev_opp? */ | ||
| 906 | if (dev_opp->supported_hw) { | ||
| 907 | dev_err(dev, "%s: Already have supported hardware list\n", | ||
| 908 | __func__); | ||
| 909 | ret = -EBUSY; | ||
| 910 | goto err; | ||
| 911 | } | ||
| 912 | |||
| 913 | dev_opp->supported_hw = kmemdup(versions, count * sizeof(*versions), | ||
| 914 | GFP_KERNEL); | ||
| 915 | if (!dev_opp->supported_hw) { | ||
| 916 | ret = -ENOMEM; | ||
| 917 | goto err; | ||
| 918 | } | ||
| 919 | |||
| 920 | dev_opp->supported_hw_count = count; | ||
| 921 | mutex_unlock(&dev_opp_list_lock); | ||
| 922 | return 0; | ||
| 923 | |||
| 924 | err: | ||
| 925 | _remove_device_opp(dev_opp); | ||
| 926 | unlock: | ||
| 927 | mutex_unlock(&dev_opp_list_lock); | ||
| 928 | |||
| 929 | return ret; | ||
| 930 | } | ||
| 931 | EXPORT_SYMBOL_GPL(dev_pm_opp_set_supported_hw); | ||
| 932 | |||
| 933 | /** | ||
| 934 | * dev_pm_opp_put_supported_hw() - Releases resources blocked for supported hw | ||
| 935 | * @dev: Device for which supported-hw has to be set. | ||
| 936 | * | ||
| 937 | * This is required only for the V2 bindings, and is called for a matching | ||
| 938 | * dev_pm_opp_set_supported_hw(). Until this is called, the device_opp structure | ||
| 939 | * will not be freed. | ||
| 940 | * | ||
| 941 | * Locking: The internal device_opp and opp structures are RCU protected. | ||
| 942 | * Hence this function internally uses RCU updater strategy with mutex locks | ||
| 943 | * to keep the integrity of the internal data structures. Callers should ensure | ||
| 944 | * that this function is *NOT* called under RCU protection or in contexts where | ||
| 945 | * mutex cannot be locked. | ||
| 946 | */ | ||
| 947 | void dev_pm_opp_put_supported_hw(struct device *dev) | ||
| 948 | { | ||
| 949 | struct device_opp *dev_opp; | ||
| 950 | |||
| 951 | /* Hold our list modification lock here */ | ||
| 952 | mutex_lock(&dev_opp_list_lock); | ||
| 953 | |||
| 954 | /* Check for existing list for 'dev' first */ | ||
| 955 | dev_opp = _find_device_opp(dev); | ||
| 956 | if (IS_ERR(dev_opp)) { | ||
| 957 | dev_err(dev, "Failed to find dev_opp: %ld\n", PTR_ERR(dev_opp)); | ||
| 958 | goto unlock; | ||
| 959 | } | ||
| 960 | |||
| 961 | /* Make sure there are no concurrent readers while updating dev_opp */ | ||
| 962 | WARN_ON(!list_empty(&dev_opp->opp_list)); | ||
| 963 | |||
| 964 | if (!dev_opp->supported_hw) { | ||
| 965 | dev_err(dev, "%s: Doesn't have supported hardware list\n", | ||
| 966 | __func__); | ||
| 967 | goto unlock; | ||
| 968 | } | ||
| 969 | |||
| 970 | kfree(dev_opp->supported_hw); | ||
| 971 | dev_opp->supported_hw = NULL; | ||
| 972 | dev_opp->supported_hw_count = 0; | ||
| 973 | |||
| 974 | /* Try freeing device_opp if this was the last blocking resource */ | ||
| 975 | _remove_device_opp(dev_opp); | ||
| 976 | |||
| 977 | unlock: | ||
| 978 | mutex_unlock(&dev_opp_list_lock); | ||
| 979 | } | ||
| 980 | EXPORT_SYMBOL_GPL(dev_pm_opp_put_supported_hw); | ||
| 981 | |||
| 982 | /** | ||
| 983 | * dev_pm_opp_set_prop_name() - Set prop-extn name | ||
| 984 | * @dev: Device for which the regulator has to be set. | ||
| 985 | * @name: name to postfix to properties. | ||
| 986 | * | ||
| 987 | * This is required only for the V2 bindings, and it enables a platform to | ||
| 988 | * specify the extn to be used for certain property names. The properties to | ||
| 989 | * which the extension will apply are opp-microvolt and opp-microamp. OPP core | ||
| 990 | * should postfix the property name with -<name> while looking for them. | ||
| 991 | * | ||
| 992 | * Locking: The internal device_opp and opp structures are RCU protected. | ||
| 993 | * Hence this function internally uses RCU updater strategy with mutex locks | ||
| 994 | * to keep the integrity of the internal data structures. Callers should ensure | ||
| 995 | * that this function is *NOT* called under RCU protection or in contexts where | ||
| 996 | * mutex cannot be locked. | ||
| 997 | */ | ||
| 998 | int dev_pm_opp_set_prop_name(struct device *dev, const char *name) | ||
| 999 | { | ||
| 1000 | struct device_opp *dev_opp; | ||
| 1001 | int ret = 0; | ||
| 1002 | |||
| 1003 | /* Hold our list modification lock here */ | ||
| 1004 | mutex_lock(&dev_opp_list_lock); | ||
| 1005 | |||
| 1006 | dev_opp = _add_device_opp(dev); | ||
| 1007 | if (!dev_opp) { | ||
| 1008 | ret = -ENOMEM; | ||
| 1009 | goto unlock; | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | /* Make sure there are no concurrent readers while updating dev_opp */ | ||
| 1013 | WARN_ON(!list_empty(&dev_opp->opp_list)); | ||
| 1014 | |||
| 1015 | /* Do we already have a prop-name associated with dev_opp? */ | ||
| 1016 | if (dev_opp->prop_name) { | ||
| 1017 | dev_err(dev, "%s: Already have prop-name %s\n", __func__, | ||
| 1018 | dev_opp->prop_name); | ||
| 1019 | ret = -EBUSY; | ||
| 1020 | goto err; | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | dev_opp->prop_name = kstrdup(name, GFP_KERNEL); | ||
| 1024 | if (!dev_opp->prop_name) { | ||
| 1025 | ret = -ENOMEM; | ||
| 1026 | goto err; | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | mutex_unlock(&dev_opp_list_lock); | ||
| 1030 | return 0; | ||
| 1031 | |||
| 1032 | err: | ||
| 1033 | _remove_device_opp(dev_opp); | ||
| 1034 | unlock: | ||
| 1035 | mutex_unlock(&dev_opp_list_lock); | ||
| 1036 | |||
| 1037 | return ret; | ||
| 1038 | } | ||
| 1039 | EXPORT_SYMBOL_GPL(dev_pm_opp_set_prop_name); | ||
| 1040 | |||
| 1041 | /** | ||
| 1042 | * dev_pm_opp_put_prop_name() - Releases resources blocked for prop-name | ||
| 1043 | * @dev: Device for which the regulator has to be set. | ||
| 1044 | * | ||
| 1045 | * This is required only for the V2 bindings, and is called for a matching | ||
| 1046 | * dev_pm_opp_set_prop_name(). Until this is called, the device_opp structure | ||
| 1047 | * will not be freed. | ||
| 1048 | * | ||
| 1049 | * Locking: The internal device_opp and opp structures are RCU protected. | ||
| 1050 | * Hence this function internally uses RCU updater strategy with mutex locks | ||
| 1051 | * to keep the integrity of the internal data structures. Callers should ensure | ||
| 1052 | * that this function is *NOT* called under RCU protection or in contexts where | ||
| 1053 | * mutex cannot be locked. | ||
| 1054 | */ | ||
| 1055 | void dev_pm_opp_put_prop_name(struct device *dev) | ||
| 1056 | { | ||
| 1057 | struct device_opp *dev_opp; | ||
| 1058 | |||
| 1059 | /* Hold our list modification lock here */ | ||
| 1060 | mutex_lock(&dev_opp_list_lock); | ||
| 1061 | |||
| 1062 | /* Check for existing list for 'dev' first */ | ||
| 1063 | dev_opp = _find_device_opp(dev); | ||
| 1064 | if (IS_ERR(dev_opp)) { | ||
| 1065 | dev_err(dev, "Failed to find dev_opp: %ld\n", PTR_ERR(dev_opp)); | ||
| 1066 | goto unlock; | ||
| 1067 | } | ||
| 1068 | |||
| 1069 | /* Make sure there are no concurrent readers while updating dev_opp */ | ||
| 1070 | WARN_ON(!list_empty(&dev_opp->opp_list)); | ||
| 1071 | |||
| 1072 | if (!dev_opp->prop_name) { | ||
| 1073 | dev_err(dev, "%s: Doesn't have a prop-name\n", __func__); | ||
| 1074 | goto unlock; | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | kfree(dev_opp->prop_name); | ||
| 1078 | dev_opp->prop_name = NULL; | ||
| 1079 | |||
| 1080 | /* Try freeing device_opp if this was the last blocking resource */ | ||
| 1081 | _remove_device_opp(dev_opp); | ||
| 1082 | |||
| 1083 | unlock: | ||
| 1084 | mutex_unlock(&dev_opp_list_lock); | ||
| 1085 | } | ||
| 1086 | EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); | ||
| 1087 | |||
| 1088 | static bool _opp_is_supported(struct device *dev, struct device_opp *dev_opp, | ||
| 1089 | struct device_node *np) | ||
| 1090 | { | ||
| 1091 | unsigned int count = dev_opp->supported_hw_count; | ||
| 1092 | u32 version; | ||
| 1093 | int ret; | ||
| 1094 | |||
| 1095 | if (!dev_opp->supported_hw) | ||
| 1096 | return true; | ||
| 1097 | |||
| 1098 | while (count--) { | ||
| 1099 | ret = of_property_read_u32_index(np, "opp-supported-hw", count, | ||
| 1100 | &version); | ||
| 1101 | if (ret) { | ||
| 1102 | dev_warn(dev, "%s: failed to read opp-supported-hw property at index %d: %d\n", | ||
| 1103 | __func__, count, ret); | ||
| 1104 | return false; | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | /* Both of these are bitwise masks of the versions */ | ||
| 1108 | if (!(version & dev_opp->supported_hw[count])) | ||
| 1109 | return false; | ||
| 1110 | } | ||
| 1111 | |||
| 1112 | return true; | ||
| 1113 | } | ||
| 1114 | |||
| 1115 | /** | ||
| 822 | * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings) | 1116 | * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings) |
| 823 | * @dev: device for which we do this operation | 1117 | * @dev: device for which we do this operation |
| 824 | * @np: device node | 1118 | * @np: device node |
| @@ -864,6 +1158,12 @@ static int _opp_add_static_v2(struct device *dev, struct device_node *np) | |||
| 864 | goto free_opp; | 1158 | goto free_opp; |
| 865 | } | 1159 | } |
| 866 | 1160 | ||
| 1161 | /* Check if the OPP supports hardware's hierarchy of versions or not */ | ||
| 1162 | if (!_opp_is_supported(dev, dev_opp, np)) { | ||
| 1163 | dev_dbg(dev, "OPP not supported by hardware: %llu\n", rate); | ||
| 1164 | goto free_opp; | ||
| 1165 | } | ||
| 1166 | |||
| 867 | /* | 1167 | /* |
| 868 | * Rate is defined as an unsigned long in clk API, and so casting | 1168 | * Rate is defined as an unsigned long in clk API, and so casting |
| 869 | * explicitly to its type. Must be fixed once rate is 64 bit | 1169 | * explicitly to its type. Must be fixed once rate is 64 bit |
| @@ -879,7 +1179,7 @@ static int _opp_add_static_v2(struct device *dev, struct device_node *np) | |||
| 879 | if (!of_property_read_u32(np, "clock-latency-ns", &val)) | 1179 | if (!of_property_read_u32(np, "clock-latency-ns", &val)) |
| 880 | new_opp->clock_latency_ns = val; | 1180 | new_opp->clock_latency_ns = val; |
| 881 | 1181 | ||
| 882 | ret = opp_parse_supplies(new_opp, dev); | 1182 | ret = opp_parse_supplies(new_opp, dev, dev_opp); |
| 883 | if (ret) | 1183 | if (ret) |
| 884 | goto free_opp; | 1184 | goto free_opp; |
| 885 | 1185 | ||
| @@ -889,12 +1189,14 @@ static int _opp_add_static_v2(struct device *dev, struct device_node *np) | |||
| 889 | 1189 | ||
| 890 | /* OPP to select on device suspend */ | 1190 | /* OPP to select on device suspend */ |
| 891 | if (of_property_read_bool(np, "opp-suspend")) { | 1191 | if (of_property_read_bool(np, "opp-suspend")) { |
| 892 | if (dev_opp->suspend_opp) | 1192 | if (dev_opp->suspend_opp) { |
| 893 | dev_warn(dev, "%s: Multiple suspend OPPs found (%lu %lu)\n", | 1193 | dev_warn(dev, "%s: Multiple suspend OPPs found (%lu %lu)\n", |
| 894 | __func__, dev_opp->suspend_opp->rate, | 1194 | __func__, dev_opp->suspend_opp->rate, |
| 895 | new_opp->rate); | 1195 | new_opp->rate); |
| 896 | else | 1196 | } else { |
| 1197 | new_opp->suspend = true; | ||
| 897 | dev_opp->suspend_opp = new_opp; | 1198 | dev_opp->suspend_opp = new_opp; |
| 1199 | } | ||
| 898 | } | 1200 | } |
| 899 | 1201 | ||
| 900 | if (new_opp->clock_latency_ns > dev_opp->clock_latency_ns_max) | 1202 | if (new_opp->clock_latency_ns > dev_opp->clock_latency_ns_max) |
diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c index 7b445e88a0d5..9f0c15570f64 100644 --- a/drivers/base/power/opp/cpu.c +++ b/drivers/base/power/opp/cpu.c | |||
| @@ -214,7 +214,6 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_add_table); | |||
| 214 | /* | 214 | /* |
| 215 | * Works only for OPP v2 bindings. | 215 | * Works only for OPP v2 bindings. |
| 216 | * | 216 | * |
| 217 | * cpumask should be already set to mask of cpu_dev->id. | ||
| 218 | * Returns -ENOENT if operating-points-v2 bindings aren't supported. | 217 | * Returns -ENOENT if operating-points-v2 bindings aren't supported. |
| 219 | */ | 218 | */ |
| 220 | int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) | 219 | int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) |
| @@ -230,6 +229,8 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask | |||
| 230 | return -ENOENT; | 229 | return -ENOENT; |
| 231 | } | 230 | } |
| 232 | 231 | ||
| 232 | cpumask_set_cpu(cpu_dev->id, cpumask); | ||
| 233 | |||
| 233 | /* OPPs are shared ? */ | 234 | /* OPPs are shared ? */ |
| 234 | if (!of_property_read_bool(np, "opp-shared")) | 235 | if (!of_property_read_bool(np, "opp-shared")) |
| 235 | goto put_cpu_node; | 236 | goto put_cpu_node; |
diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c new file mode 100644 index 000000000000..ddfe4773e922 --- /dev/null +++ b/drivers/base/power/opp/debugfs.c | |||
| @@ -0,0 +1,219 @@ | |||
| 1 | /* | ||
| 2 | * Generic OPP debugfs interface | ||
| 3 | * | ||
| 4 | * Copyright (C) 2015-2016 Viresh Kumar <viresh.kumar@linaro.org> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 12 | |||
| 13 | #include <linux/debugfs.h> | ||
| 14 | #include <linux/device.h> | ||
| 15 | #include <linux/err.h> | ||
| 16 | #include <linux/init.h> | ||
| 17 | #include <linux/limits.h> | ||
| 18 | |||
| 19 | #include "opp.h" | ||
| 20 | |||
| 21 | static struct dentry *rootdir; | ||
| 22 | |||
| 23 | static void opp_set_dev_name(const struct device *dev, char *name) | ||
| 24 | { | ||
| 25 | if (dev->parent) | ||
| 26 | snprintf(name, NAME_MAX, "%s-%s", dev_name(dev->parent), | ||
| 27 | dev_name(dev)); | ||
| 28 | else | ||
| 29 | snprintf(name, NAME_MAX, "%s", dev_name(dev)); | ||
| 30 | } | ||
| 31 | |||
| 32 | void opp_debug_remove_one(struct dev_pm_opp *opp) | ||
| 33 | { | ||
| 34 | debugfs_remove_recursive(opp->dentry); | ||
| 35 | } | ||
| 36 | |||
| 37 | int opp_debug_create_one(struct dev_pm_opp *opp, struct device_opp *dev_opp) | ||
| 38 | { | ||
| 39 | struct dentry *pdentry = dev_opp->dentry; | ||
| 40 | struct dentry *d; | ||
| 41 | char name[25]; /* 20 chars for 64 bit value + 5 (opp:\0) */ | ||
| 42 | |||
| 43 | /* Rate is unique to each OPP, use it to give opp-name */ | ||
| 44 | snprintf(name, sizeof(name), "opp:%lu", opp->rate); | ||
| 45 | |||
| 46 | /* Create per-opp directory */ | ||
| 47 | d = debugfs_create_dir(name, pdentry); | ||
| 48 | if (!d) | ||
| 49 | return -ENOMEM; | ||
| 50 | |||
| 51 | if (!debugfs_create_bool("available", S_IRUGO, d, &opp->available)) | ||
| 52 | return -ENOMEM; | ||
| 53 | |||
| 54 | if (!debugfs_create_bool("dynamic", S_IRUGO, d, &opp->dynamic)) | ||
| 55 | return -ENOMEM; | ||
| 56 | |||
| 57 | if (!debugfs_create_bool("turbo", S_IRUGO, d, &opp->turbo)) | ||
| 58 | return -ENOMEM; | ||
| 59 | |||
| 60 | if (!debugfs_create_bool("suspend", S_IRUGO, d, &opp->suspend)) | ||
| 61 | return -ENOMEM; | ||
| 62 | |||
| 63 | if (!debugfs_create_ulong("rate_hz", S_IRUGO, d, &opp->rate)) | ||
| 64 | return -ENOMEM; | ||
| 65 | |||
| 66 | if (!debugfs_create_ulong("u_volt_target", S_IRUGO, d, &opp->u_volt)) | ||
| 67 | return -ENOMEM; | ||
| 68 | |||
| 69 | if (!debugfs_create_ulong("u_volt_min", S_IRUGO, d, &opp->u_volt_min)) | ||
| 70 | return -ENOMEM; | ||
| 71 | |||
| 72 | if (!debugfs_create_ulong("u_volt_max", S_IRUGO, d, &opp->u_volt_max)) | ||
| 73 | return -ENOMEM; | ||
| 74 | |||
| 75 | if (!debugfs_create_ulong("u_amp", S_IRUGO, d, &opp->u_amp)) | ||
| 76 | return -ENOMEM; | ||
| 77 | |||
| 78 | if (!debugfs_create_ulong("clock_latency_ns", S_IRUGO, d, | ||
| 79 | &opp->clock_latency_ns)) | ||
| 80 | return -ENOMEM; | ||
| 81 | |||
| 82 | opp->dentry = d; | ||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | |||
| 86 | static int device_opp_debug_create_dir(struct device_list_opp *list_dev, | ||
| 87 | struct device_opp *dev_opp) | ||
| 88 | { | ||
| 89 | const struct device *dev = list_dev->dev; | ||
| 90 | struct dentry *d; | ||
| 91 | |||
| 92 | opp_set_dev_name(dev, dev_opp->dentry_name); | ||
| 93 | |||
| 94 | /* Create device specific directory */ | ||
| 95 | d = debugfs_create_dir(dev_opp->dentry_name, rootdir); | ||
| 96 | if (!d) { | ||
| 97 | dev_err(dev, "%s: Failed to create debugfs dir\n", __func__); | ||
| 98 | return -ENOMEM; | ||
| 99 | } | ||
| 100 | |||
| 101 | list_dev->dentry = d; | ||
| 102 | dev_opp->dentry = d; | ||
| 103 | |||
| 104 | return 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | static int device_opp_debug_create_link(struct device_list_opp *list_dev, | ||
| 108 | struct device_opp *dev_opp) | ||
| 109 | { | ||
| 110 | const struct device *dev = list_dev->dev; | ||
| 111 | char name[NAME_MAX]; | ||
| 112 | struct dentry *d; | ||
| 113 | |||
| 114 | opp_set_dev_name(list_dev->dev, name); | ||
| 115 | |||
| 116 | /* Create device specific directory link */ | ||
| 117 | d = debugfs_create_symlink(name, rootdir, dev_opp->dentry_name); | ||
| 118 | if (!d) { | ||
| 119 | dev_err(dev, "%s: Failed to create link\n", __func__); | ||
| 120 | return -ENOMEM; | ||
| 121 | } | ||
| 122 | |||
| 123 | list_dev->dentry = d; | ||
| 124 | |||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 128 | /** | ||
| 129 | * opp_debug_register - add a device opp node to the debugfs 'opp' directory | ||
| 130 | * @list_dev: list-dev pointer for device | ||
| 131 | * @dev_opp: the device-opp being added | ||
| 132 | * | ||
| 133 | * Dynamically adds device specific directory in debugfs 'opp' directory. If the | ||
| 134 | * device-opp is shared with other devices, then links will be created for all | ||
| 135 | * devices except the first. | ||
| 136 | * | ||
| 137 | * Return: 0 on success, otherwise negative error. | ||
| 138 | */ | ||
| 139 | int opp_debug_register(struct device_list_opp *list_dev, | ||
| 140 | struct device_opp *dev_opp) | ||
| 141 | { | ||
| 142 | if (!rootdir) { | ||
| 143 | pr_debug("%s: Uninitialized rootdir\n", __func__); | ||
| 144 | return -EINVAL; | ||
| 145 | } | ||
| 146 | |||
| 147 | if (dev_opp->dentry) | ||
| 148 | return device_opp_debug_create_link(list_dev, dev_opp); | ||
| 149 | |||
| 150 | return device_opp_debug_create_dir(list_dev, dev_opp); | ||
| 151 | } | ||
| 152 | |||
| 153 | static void opp_migrate_dentry(struct device_list_opp *list_dev, | ||
| 154 | struct device_opp *dev_opp) | ||
| 155 | { | ||
| 156 | struct device_list_opp *new_dev; | ||
| 157 | const struct device *dev; | ||
| 158 | struct dentry *dentry; | ||
| 159 | |||
| 160 | /* Look for next list-dev */ | ||
| 161 | list_for_each_entry(new_dev, &dev_opp->dev_list, node) | ||
| 162 | if (new_dev != list_dev) | ||
| 163 | break; | ||
| 164 | |||
| 165 | /* new_dev is guaranteed to be valid here */ | ||
| 166 | dev = new_dev->dev; | ||
| 167 | debugfs_remove_recursive(new_dev->dentry); | ||
| 168 | |||
| 169 | opp_set_dev_name(dev, dev_opp->dentry_name); | ||
| 170 | |||
| 171 | dentry = debugfs_rename(rootdir, list_dev->dentry, rootdir, | ||
| 172 | dev_opp->dentry_name); | ||
| 173 | if (!dentry) { | ||
| 174 | dev_err(dev, "%s: Failed to rename link from: %s to %s\n", | ||
| 175 | __func__, dev_name(list_dev->dev), dev_name(dev)); | ||
| 176 | return; | ||
| 177 | } | ||
| 178 | |||
| 179 | new_dev->dentry = dentry; | ||
| 180 | dev_opp->dentry = dentry; | ||
| 181 | } | ||
| 182 | |||
| 183 | /** | ||
| 184 | * opp_debug_unregister - remove a device opp node from debugfs opp directory | ||
| 185 | * @list_dev: list-dev pointer for device | ||
| 186 | * @dev_opp: the device-opp being removed | ||
| 187 | * | ||
| 188 | * Dynamically removes device specific directory from debugfs 'opp' directory. | ||
| 189 | */ | ||
| 190 | void opp_debug_unregister(struct device_list_opp *list_dev, | ||
| 191 | struct device_opp *dev_opp) | ||
| 192 | { | ||
| 193 | if (list_dev->dentry == dev_opp->dentry) { | ||
| 194 | /* Move the real dentry object under another device */ | ||
| 195 | if (!list_is_singular(&dev_opp->dev_list)) { | ||
| 196 | opp_migrate_dentry(list_dev, dev_opp); | ||
| 197 | goto out; | ||
| 198 | } | ||
| 199 | dev_opp->dentry = NULL; | ||
| 200 | } | ||
| 201 | |||
| 202 | debugfs_remove_recursive(list_dev->dentry); | ||
| 203 | |||
| 204 | out: | ||
| 205 | list_dev->dentry = NULL; | ||
| 206 | } | ||
| 207 | |||
| 208 | static int __init opp_debug_init(void) | ||
| 209 | { | ||
| 210 | /* Create /sys/kernel/debug/opp directory */ | ||
| 211 | rootdir = debugfs_create_dir("opp", NULL); | ||
| 212 | if (!rootdir) { | ||
| 213 | pr_err("%s: Failed to create root directory\n", __func__); | ||
| 214 | return -ENOMEM; | ||
| 215 | } | ||
| 216 | |||
| 217 | return 0; | ||
| 218 | } | ||
| 219 | core_initcall(opp_debug_init); | ||
diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h index 7366b2aa8997..690638ef36ee 100644 --- a/drivers/base/power/opp/opp.h +++ b/drivers/base/power/opp/opp.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
| 20 | #include <linux/limits.h> | ||
| 20 | #include <linux/pm_opp.h> | 21 | #include <linux/pm_opp.h> |
| 21 | #include <linux/rculist.h> | 22 | #include <linux/rculist.h> |
| 22 | #include <linux/rcupdate.h> | 23 | #include <linux/rcupdate.h> |
| @@ -50,9 +51,10 @@ extern struct mutex dev_opp_list_lock; | |||
| 50 | * are protected by the dev_opp_list_lock for integrity. | 51 | * are protected by the dev_opp_list_lock for integrity. |
| 51 | * IMPORTANT: the opp nodes should be maintained in increasing | 52 | * IMPORTANT: the opp nodes should be maintained in increasing |
| 52 | * order. | 53 | * order. |
| 53 | * @dynamic: not-created from static DT entries. | ||
| 54 | * @available: true/false - marks if this OPP as available or not | 54 | * @available: true/false - marks if this OPP as available or not |
| 55 | * @dynamic: not-created from static DT entries. | ||
| 55 | * @turbo: true if turbo (boost) OPP | 56 | * @turbo: true if turbo (boost) OPP |
| 57 | * @suspend: true if suspend OPP | ||
| 56 | * @rate: Frequency in hertz | 58 | * @rate: Frequency in hertz |
| 57 | * @u_volt: Target voltage in microvolts corresponding to this OPP | 59 | * @u_volt: Target voltage in microvolts corresponding to this OPP |
| 58 | * @u_volt_min: Minimum voltage in microvolts corresponding to this OPP | 60 | * @u_volt_min: Minimum voltage in microvolts corresponding to this OPP |
| @@ -63,6 +65,7 @@ extern struct mutex dev_opp_list_lock; | |||
| 63 | * @dev_opp: points back to the device_opp struct this opp belongs to | 65 | * @dev_opp: points back to the device_opp struct this opp belongs to |
| 64 | * @rcu_head: RCU callback head used for deferred freeing | 66 | * @rcu_head: RCU callback head used for deferred freeing |
| 65 | * @np: OPP's device node. | 67 | * @np: OPP's device node. |
| 68 | * @dentry: debugfs dentry pointer (per opp) | ||
| 66 | * | 69 | * |
| 67 | * This structure stores the OPP information for a given device. | 70 | * This structure stores the OPP information for a given device. |
| 68 | */ | 71 | */ |
| @@ -72,6 +75,7 @@ struct dev_pm_opp { | |||
| 72 | bool available; | 75 | bool available; |
| 73 | bool dynamic; | 76 | bool dynamic; |
| 74 | bool turbo; | 77 | bool turbo; |
| 78 | bool suspend; | ||
| 75 | unsigned long rate; | 79 | unsigned long rate; |
| 76 | 80 | ||
| 77 | unsigned long u_volt; | 81 | unsigned long u_volt; |
| @@ -84,6 +88,10 @@ struct dev_pm_opp { | |||
| 84 | struct rcu_head rcu_head; | 88 | struct rcu_head rcu_head; |
| 85 | 89 | ||
| 86 | struct device_node *np; | 90 | struct device_node *np; |
| 91 | |||
| 92 | #ifdef CONFIG_DEBUG_FS | ||
| 93 | struct dentry *dentry; | ||
| 94 | #endif | ||
| 87 | }; | 95 | }; |
| 88 | 96 | ||
| 89 | /** | 97 | /** |
| @@ -91,6 +99,7 @@ struct dev_pm_opp { | |||
| 91 | * @node: list node | 99 | * @node: list node |
| 92 | * @dev: device to which the struct object belongs | 100 | * @dev: device to which the struct object belongs |
| 93 | * @rcu_head: RCU callback head used for deferred freeing | 101 | * @rcu_head: RCU callback head used for deferred freeing |
| 102 | * @dentry: debugfs dentry pointer (per device) | ||
| 94 | * | 103 | * |
| 95 | * This is an internal data structure maintaining the list of devices that are | 104 | * This is an internal data structure maintaining the list of devices that are |
| 96 | * managed by 'struct device_opp'. | 105 | * managed by 'struct device_opp'. |
| @@ -99,6 +108,10 @@ struct device_list_opp { | |||
| 99 | struct list_head node; | 108 | struct list_head node; |
| 100 | const struct device *dev; | 109 | const struct device *dev; |
| 101 | struct rcu_head rcu_head; | 110 | struct rcu_head rcu_head; |
| 111 | |||
| 112 | #ifdef CONFIG_DEBUG_FS | ||
| 113 | struct dentry *dentry; | ||
| 114 | #endif | ||
| 102 | }; | 115 | }; |
| 103 | 116 | ||
| 104 | /** | 117 | /** |
| @@ -113,7 +126,14 @@ struct device_list_opp { | |||
| 113 | * @dev_list: list of devices that share these OPPs | 126 | * @dev_list: list of devices that share these OPPs |
| 114 | * @opp_list: list of opps | 127 | * @opp_list: list of opps |
| 115 | * @np: struct device_node pointer for opp's DT node. | 128 | * @np: struct device_node pointer for opp's DT node. |
| 129 | * @clock_latency_ns_max: Max clock latency in nanoseconds. | ||
| 116 | * @shared_opp: OPP is shared between multiple devices. | 130 | * @shared_opp: OPP is shared between multiple devices. |
| 131 | * @suspend_opp: Pointer to OPP to be used during device suspend. | ||
| 132 | * @supported_hw: Array of version number to support. | ||
| 133 | * @supported_hw_count: Number of elements in supported_hw array. | ||
| 134 | * @prop_name: A name to postfix to many DT properties, while parsing them. | ||
| 135 | * @dentry: debugfs dentry pointer of the real device directory (not links). | ||
| 136 | * @dentry_name: Name of the real dentry. | ||
| 117 | * | 137 | * |
| 118 | * This is an internal data structure maintaining the link to opps attached to | 138 | * This is an internal data structure maintaining the link to opps attached to |
| 119 | * a device. This structure is not meant to be shared to users as it is | 139 | * a device. This structure is not meant to be shared to users as it is |
| @@ -135,6 +155,15 @@ struct device_opp { | |||
| 135 | unsigned long clock_latency_ns_max; | 155 | unsigned long clock_latency_ns_max; |
| 136 | bool shared_opp; | 156 | bool shared_opp; |
| 137 | struct dev_pm_opp *suspend_opp; | 157 | struct dev_pm_opp *suspend_opp; |
| 158 | |||
| 159 | unsigned int *supported_hw; | ||
| 160 | unsigned int supported_hw_count; | ||
| 161 | const char *prop_name; | ||
| 162 | |||
| 163 | #ifdef CONFIG_DEBUG_FS | ||
| 164 | struct dentry *dentry; | ||
| 165 | char dentry_name[NAME_MAX]; | ||
| 166 | #endif | ||
| 138 | }; | 167 | }; |
| 139 | 168 | ||
| 140 | /* Routines internal to opp core */ | 169 | /* Routines internal to opp core */ |
| @@ -143,4 +172,26 @@ struct device_list_opp *_add_list_dev(const struct device *dev, | |||
| 143 | struct device_opp *dev_opp); | 172 | struct device_opp *dev_opp); |
| 144 | struct device_node *_of_get_opp_desc_node(struct device *dev); | 173 | struct device_node *_of_get_opp_desc_node(struct device *dev); |
| 145 | 174 | ||
| 175 | #ifdef CONFIG_DEBUG_FS | ||
| 176 | void opp_debug_remove_one(struct dev_pm_opp *opp); | ||
| 177 | int opp_debug_create_one(struct dev_pm_opp *opp, struct device_opp *dev_opp); | ||
| 178 | int opp_debug_register(struct device_list_opp *list_dev, | ||
| 179 | struct device_opp *dev_opp); | ||
| 180 | void opp_debug_unregister(struct device_list_opp *list_dev, | ||
| 181 | struct device_opp *dev_opp); | ||
| 182 | #else | ||
| 183 | static inline void opp_debug_remove_one(struct dev_pm_opp *opp) {} | ||
| 184 | |||
| 185 | static inline int opp_debug_create_one(struct dev_pm_opp *opp, | ||
| 186 | struct device_opp *dev_opp) | ||
| 187 | { return 0; } | ||
| 188 | static inline int opp_debug_register(struct device_list_opp *list_dev, | ||
| 189 | struct device_opp *dev_opp) | ||
| 190 | { return 0; } | ||
| 191 | |||
| 192 | static inline void opp_debug_unregister(struct device_list_opp *list_dev, | ||
| 193 | struct device_opp *dev_opp) | ||
| 194 | { } | ||
| 195 | #endif /* DEBUG_FS */ | ||
| 196 | |||
| 146 | #endif /* __DRIVER_OPP_H__ */ | 197 | #endif /* __DRIVER_OPP_H__ */ |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index 998fa6b23084..8b06193d4a5e 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
| @@ -18,6 +18,7 @@ static inline void pm_runtime_early_init(struct device *dev) | |||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | extern void pm_runtime_init(struct device *dev); | 20 | extern void pm_runtime_init(struct device *dev); |
| 21 | extern void pm_runtime_reinit(struct device *dev); | ||
| 21 | extern void pm_runtime_remove(struct device *dev); | 22 | extern void pm_runtime_remove(struct device *dev); |
| 22 | 23 | ||
| 23 | struct wake_irq { | 24 | struct wake_irq { |
| @@ -84,6 +85,7 @@ static inline void pm_runtime_early_init(struct device *dev) | |||
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | static inline void pm_runtime_init(struct device *dev) {} | 87 | static inline void pm_runtime_init(struct device *dev) {} |
| 88 | static inline void pm_runtime_reinit(struct device *dev) {} | ||
| 87 | static inline void pm_runtime_remove(struct device *dev) {} | 89 | static inline void pm_runtime_remove(struct device *dev) {} |
| 88 | 90 | ||
| 89 | static inline int dpm_sysfs_add(struct device *dev) { return 0; } | 91 | static inline int dpm_sysfs_add(struct device *dev) { return 0; } |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index e1a10a03df8e..4c7055009bd6 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
| @@ -966,6 +966,30 @@ int __pm_runtime_resume(struct device *dev, int rpmflags) | |||
| 966 | EXPORT_SYMBOL_GPL(__pm_runtime_resume); | 966 | EXPORT_SYMBOL_GPL(__pm_runtime_resume); |
| 967 | 967 | ||
| 968 | /** | 968 | /** |
| 969 | * pm_runtime_get_if_in_use - Conditionally bump up the device's usage counter. | ||
| 970 | * @dev: Device to handle. | ||
| 971 | * | ||
| 972 | * Return -EINVAL if runtime PM is disabled for the device. | ||
| 973 | * | ||
| 974 | * If that's not the case and if the device's runtime PM status is RPM_ACTIVE | ||
| 975 | * and the runtime PM usage counter is nonzero, increment the counter and | ||
| 976 | * return 1. Otherwise return 0 without changing the counter. | ||
| 977 | */ | ||
| 978 | int pm_runtime_get_if_in_use(struct device *dev) | ||
| 979 | { | ||
| 980 | unsigned long flags; | ||
| 981 | int retval; | ||
| 982 | |||
| 983 | spin_lock_irqsave(&dev->power.lock, flags); | ||
| 984 | retval = dev->power.disable_depth > 0 ? -EINVAL : | ||
| 985 | dev->power.runtime_status == RPM_ACTIVE | ||
| 986 | && atomic_inc_not_zero(&dev->power.usage_count); | ||
| 987 | spin_unlock_irqrestore(&dev->power.lock, flags); | ||
| 988 | return retval; | ||
| 989 | } | ||
| 990 | EXPORT_SYMBOL_GPL(pm_runtime_get_if_in_use); | ||
| 991 | |||
| 992 | /** | ||
| 969 | * __pm_runtime_set_status - Set runtime PM status of a device. | 993 | * __pm_runtime_set_status - Set runtime PM status of a device. |
| 970 | * @dev: Device to handle. | 994 | * @dev: Device to handle. |
| 971 | * @status: New runtime PM status of the device. | 995 | * @status: New runtime PM status of the device. |
| @@ -1390,18 +1414,32 @@ void pm_runtime_init(struct device *dev) | |||
| 1390 | } | 1414 | } |
| 1391 | 1415 | ||
| 1392 | /** | 1416 | /** |
| 1417 | * pm_runtime_reinit - Re-initialize runtime PM fields in given device object. | ||
| 1418 | * @dev: Device object to re-initialize. | ||
| 1419 | */ | ||
| 1420 | void pm_runtime_reinit(struct device *dev) | ||
| 1421 | { | ||
| 1422 | if (!pm_runtime_enabled(dev)) { | ||
| 1423 | if (dev->power.runtime_status == RPM_ACTIVE) | ||
| 1424 | pm_runtime_set_suspended(dev); | ||
| 1425 | if (dev->power.irq_safe) { | ||
| 1426 | spin_lock_irq(&dev->power.lock); | ||
| 1427 | dev->power.irq_safe = 0; | ||
| 1428 | spin_unlock_irq(&dev->power.lock); | ||
| 1429 | if (dev->parent) | ||
| 1430 | pm_runtime_put(dev->parent); | ||
| 1431 | } | ||
| 1432 | } | ||
| 1433 | } | ||
| 1434 | |||
| 1435 | /** | ||
| 1393 | * pm_runtime_remove - Prepare for removing a device from device hierarchy. | 1436 | * pm_runtime_remove - Prepare for removing a device from device hierarchy. |
| 1394 | * @dev: Device object being removed from device hierarchy. | 1437 | * @dev: Device object being removed from device hierarchy. |
| 1395 | */ | 1438 | */ |
| 1396 | void pm_runtime_remove(struct device *dev) | 1439 | void pm_runtime_remove(struct device *dev) |
| 1397 | { | 1440 | { |
| 1398 | __pm_runtime_disable(dev, false); | 1441 | __pm_runtime_disable(dev, false); |
| 1399 | 1442 | pm_runtime_reinit(dev); | |
| 1400 | /* Change the status back to 'suspended' to match the initial status. */ | ||
| 1401 | if (dev->power.runtime_status == RPM_ACTIVE) | ||
| 1402 | pm_runtime_set_suspended(dev); | ||
| 1403 | if (dev->power.irq_safe && dev->parent) | ||
| 1404 | pm_runtime_put(dev->parent); | ||
| 1405 | } | 1443 | } |
| 1406 | 1444 | ||
| 1407 | /** | 1445 | /** |
diff --git a/drivers/base/property.c b/drivers/base/property.c index 1325ff225cc4..c359351d50f1 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c | |||
| @@ -19,32 +19,14 @@ | |||
| 19 | #include <linux/etherdevice.h> | 19 | #include <linux/etherdevice.h> |
| 20 | #include <linux/phy.h> | 20 | #include <linux/phy.h> |
| 21 | 21 | ||
| 22 | /** | 22 | static inline bool is_pset_node(struct fwnode_handle *fwnode) |
| 23 | * device_add_property_set - Add a collection of properties to a device object. | ||
| 24 | * @dev: Device to add properties to. | ||
| 25 | * @pset: Collection of properties to add. | ||
| 26 | * | ||
| 27 | * Associate a collection of device properties represented by @pset with @dev | ||
| 28 | * as its secondary firmware node. | ||
| 29 | */ | ||
| 30 | void device_add_property_set(struct device *dev, struct property_set *pset) | ||
| 31 | { | ||
| 32 | if (!pset) | ||
| 33 | return; | ||
| 34 | |||
| 35 | pset->fwnode.type = FWNODE_PDATA; | ||
| 36 | set_secondary_fwnode(dev, &pset->fwnode); | ||
| 37 | } | ||
| 38 | EXPORT_SYMBOL_GPL(device_add_property_set); | ||
| 39 | |||
| 40 | static inline bool is_pset(struct fwnode_handle *fwnode) | ||
| 41 | { | 23 | { |
| 42 | return fwnode && fwnode->type == FWNODE_PDATA; | 24 | return fwnode && fwnode->type == FWNODE_PDATA; |
| 43 | } | 25 | } |
| 44 | 26 | ||
| 45 | static inline struct property_set *to_pset(struct fwnode_handle *fwnode) | 27 | static inline struct property_set *to_pset_node(struct fwnode_handle *fwnode) |
| 46 | { | 28 | { |
| 47 | return is_pset(fwnode) ? | 29 | return is_pset_node(fwnode) ? |
| 48 | container_of(fwnode, struct property_set, fwnode) : NULL; | 30 | container_of(fwnode, struct property_set, fwnode) : NULL; |
| 49 | } | 31 | } |
| 50 | 32 | ||
| @@ -63,45 +45,135 @@ static struct property_entry *pset_prop_get(struct property_set *pset, | |||
| 63 | return NULL; | 45 | return NULL; |
| 64 | } | 46 | } |
| 65 | 47 | ||
| 66 | static int pset_prop_read_array(struct property_set *pset, const char *name, | 48 | static void *pset_prop_find(struct property_set *pset, const char *propname, |
| 67 | enum dev_prop_type type, void *val, size_t nval) | 49 | size_t length) |
| 68 | { | 50 | { |
| 69 | struct property_entry *prop; | 51 | struct property_entry *prop; |
| 70 | unsigned int item_size; | 52 | void *pointer; |
| 71 | 53 | ||
| 72 | prop = pset_prop_get(pset, name); | 54 | prop = pset_prop_get(pset, propname); |
| 73 | if (!prop) | 55 | if (!prop) |
| 74 | return -ENODATA; | 56 | return ERR_PTR(-EINVAL); |
| 57 | if (prop->is_array) | ||
| 58 | pointer = prop->pointer.raw_data; | ||
| 59 | else | ||
| 60 | pointer = &prop->value.raw_data; | ||
| 61 | if (!pointer) | ||
| 62 | return ERR_PTR(-ENODATA); | ||
| 63 | if (length > prop->length) | ||
| 64 | return ERR_PTR(-EOVERFLOW); | ||
| 65 | return pointer; | ||
| 66 | } | ||
| 67 | |||
| 68 | static int pset_prop_read_u8_array(struct property_set *pset, | ||
| 69 | const char *propname, | ||
| 70 | u8 *values, size_t nval) | ||
| 71 | { | ||
| 72 | void *pointer; | ||
| 73 | size_t length = nval * sizeof(*values); | ||
| 74 | |||
| 75 | pointer = pset_prop_find(pset, propname, length); | ||
| 76 | if (IS_ERR(pointer)) | ||
| 77 | return PTR_ERR(pointer); | ||
| 78 | |||
| 79 | memcpy(values, pointer, length); | ||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | static int pset_prop_read_u16_array(struct property_set *pset, | ||
| 84 | const char *propname, | ||
| 85 | u16 *values, size_t nval) | ||
| 86 | { | ||
| 87 | void *pointer; | ||
| 88 | size_t length = nval * sizeof(*values); | ||
| 89 | |||
| 90 | pointer = pset_prop_find(pset, propname, length); | ||
| 91 | if (IS_ERR(pointer)) | ||
| 92 | return PTR_ERR(pointer); | ||
| 93 | |||
| 94 | memcpy(values, pointer, length); | ||
| 95 | return 0; | ||
| 96 | } | ||
| 97 | |||
| 98 | static int pset_prop_read_u32_array(struct property_set *pset, | ||
| 99 | const char *propname, | ||
| 100 | u32 *values, size_t nval) | ||
| 101 | { | ||
| 102 | void *pointer; | ||
| 103 | size_t length = nval * sizeof(*values); | ||
| 104 | |||
| 105 | pointer = pset_prop_find(pset, propname, length); | ||
| 106 | if (IS_ERR(pointer)) | ||
| 107 | return PTR_ERR(pointer); | ||
| 108 | |||
| 109 | memcpy(values, pointer, length); | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | static int pset_prop_read_u64_array(struct property_set *pset, | ||
| 114 | const char *propname, | ||
| 115 | u64 *values, size_t nval) | ||
| 116 | { | ||
| 117 | void *pointer; | ||
| 118 | size_t length = nval * sizeof(*values); | ||
| 119 | |||
| 120 | pointer = pset_prop_find(pset, propname, length); | ||
| 121 | if (IS_ERR(pointer)) | ||
| 122 | return PTR_ERR(pointer); | ||
| 123 | |||
| 124 | memcpy(values, pointer, length); | ||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 128 | static int pset_prop_count_elems_of_size(struct property_set *pset, | ||
| 129 | const char *propname, size_t length) | ||
| 130 | { | ||
| 131 | struct property_entry *prop; | ||
| 132 | |||
| 133 | prop = pset_prop_get(pset, propname); | ||
| 134 | if (!prop) | ||
| 135 | return -EINVAL; | ||
| 136 | |||
| 137 | return prop->length / length; | ||
| 138 | } | ||
| 139 | |||
| 140 | static int pset_prop_read_string_array(struct property_set *pset, | ||
| 141 | const char *propname, | ||
| 142 | const char **strings, size_t nval) | ||
| 143 | { | ||
| 144 | void *pointer; | ||
| 145 | size_t length = nval * sizeof(*strings); | ||
| 146 | |||
| 147 | pointer = pset_prop_find(pset, propname, length); | ||
| 148 | if (IS_ERR(pointer)) | ||
| 149 | return PTR_ERR(pointer); | ||
| 150 | |||
| 151 | memcpy(strings, pointer, length); | ||
| 152 | return 0; | ||
| 153 | } | ||
| 154 | |||
| 155 | static int pset_prop_read_string(struct property_set *pset, | ||
| 156 | const char *propname, const char **strings) | ||
| 157 | { | ||
| 158 | struct property_entry *prop; | ||
| 159 | const char **pointer; | ||
| 75 | 160 | ||
| 76 | if (prop->type != type) | 161 | prop = pset_prop_get(pset, propname); |
| 77 | return -EPROTO; | 162 | if (!prop) |
| 78 | |||
| 79 | if (!val) | ||
| 80 | return prop->nval; | ||
| 81 | |||
| 82 | if (prop->nval < nval) | ||
| 83 | return -EOVERFLOW; | ||
| 84 | |||
| 85 | switch (type) { | ||
| 86 | case DEV_PROP_U8: | ||
| 87 | item_size = sizeof(u8); | ||
| 88 | break; | ||
| 89 | case DEV_PROP_U16: | ||
| 90 | item_size = sizeof(u16); | ||
| 91 | break; | ||
| 92 | case DEV_PROP_U32: | ||
| 93 | item_size = sizeof(u32); | ||
| 94 | break; | ||
| 95 | case DEV_PROP_U64: | ||
| 96 | item_size = sizeof(u64); | ||
| 97 | break; | ||
| 98 | case DEV_PROP_STRING: | ||
| 99 | item_size = sizeof(const char *); | ||
| 100 | break; | ||
| 101 | default: | ||
| 102 | return -EINVAL; | 163 | return -EINVAL; |
| 164 | if (!prop->is_string) | ||
| 165 | return -EILSEQ; | ||
| 166 | if (prop->is_array) { | ||
| 167 | pointer = prop->pointer.str; | ||
| 168 | if (!pointer) | ||
| 169 | return -ENODATA; | ||
| 170 | } else { | ||
| 171 | pointer = &prop->value.str; | ||
| 172 | if (*pointer && strnlen(*pointer, prop->length) >= prop->length) | ||
| 173 | return -EILSEQ; | ||
| 103 | } | 174 | } |
| 104 | memcpy(val, prop->value.raw_data, nval * item_size); | 175 | |
| 176 | *strings = *pointer; | ||
| 105 | return 0; | 177 | return 0; |
| 106 | } | 178 | } |
| 107 | 179 | ||
| @@ -124,6 +196,18 @@ bool device_property_present(struct device *dev, const char *propname) | |||
| 124 | } | 196 | } |
| 125 | EXPORT_SYMBOL_GPL(device_property_present); | 197 | EXPORT_SYMBOL_GPL(device_property_present); |
| 126 | 198 | ||
| 199 | static bool __fwnode_property_present(struct fwnode_handle *fwnode, | ||
| 200 | const char *propname) | ||
| 201 | { | ||
| 202 | if (is_of_node(fwnode)) | ||
| 203 | return of_property_read_bool(to_of_node(fwnode), propname); | ||
| 204 | else if (is_acpi_node(fwnode)) | ||
| 205 | return !acpi_node_prop_get(fwnode, propname, NULL); | ||
| 206 | else if (is_pset_node(fwnode)) | ||
| 207 | return !!pset_prop_get(to_pset_node(fwnode), propname); | ||
| 208 | return false; | ||
| 209 | } | ||
| 210 | |||
| 127 | /** | 211 | /** |
| 128 | * fwnode_property_present - check if a property of a firmware node is present | 212 | * fwnode_property_present - check if a property of a firmware node is present |
| 129 | * @fwnode: Firmware node whose property to check | 213 | * @fwnode: Firmware node whose property to check |
| @@ -131,12 +215,12 @@ EXPORT_SYMBOL_GPL(device_property_present); | |||
| 131 | */ | 215 | */ |
| 132 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname) | 216 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname) |
| 133 | { | 217 | { |
| 134 | if (is_of_node(fwnode)) | 218 | bool ret; |
| 135 | return of_property_read_bool(to_of_node(fwnode), propname); | ||
| 136 | else if (is_acpi_node(fwnode)) | ||
| 137 | return !acpi_node_prop_get(fwnode, propname, NULL); | ||
| 138 | 219 | ||
| 139 | return !!pset_prop_get(to_pset(fwnode), propname); | 220 | ret = __fwnode_property_present(fwnode, propname); |
| 221 | if (ret == false && fwnode && fwnode->secondary) | ||
| 222 | ret = __fwnode_property_present(fwnode->secondary, propname); | ||
| 223 | return ret; | ||
| 140 | } | 224 | } |
| 141 | EXPORT_SYMBOL_GPL(fwnode_property_present); | 225 | EXPORT_SYMBOL_GPL(fwnode_property_present); |
| 142 | 226 | ||
| @@ -309,25 +393,40 @@ int device_property_match_string(struct device *dev, const char *propname, | |||
| 309 | } | 393 | } |
| 310 | EXPORT_SYMBOL_GPL(device_property_match_string); | 394 | EXPORT_SYMBOL_GPL(device_property_match_string); |
| 311 | 395 | ||
| 312 | #define OF_DEV_PROP_READ_ARRAY(node, propname, type, val, nval) \ | 396 | #define OF_DEV_PROP_READ_ARRAY(node, propname, type, val, nval) \ |
| 313 | (val) ? of_property_read_##type##_array((node), (propname), (val), (nval)) \ | 397 | (val) ? of_property_read_##type##_array((node), (propname), (val), (nval)) \ |
| 314 | : of_property_count_elems_of_size((node), (propname), sizeof(type)) | 398 | : of_property_count_elems_of_size((node), (propname), sizeof(type)) |
| 315 | 399 | ||
| 316 | #define FWNODE_PROP_READ_ARRAY(_fwnode_, _propname_, _type_, _proptype_, _val_, _nval_) \ | 400 | #define PSET_PROP_READ_ARRAY(node, propname, type, val, nval) \ |
| 317 | ({ \ | 401 | (val) ? pset_prop_read_##type##_array((node), (propname), (val), (nval)) \ |
| 318 | int _ret_; \ | 402 | : pset_prop_count_elems_of_size((node), (propname), sizeof(type)) |
| 319 | if (is_of_node(_fwnode_)) \ | 403 | |
| 320 | _ret_ = OF_DEV_PROP_READ_ARRAY(to_of_node(_fwnode_), _propname_, \ | 404 | #define FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_, _val_, _nval_) \ |
| 321 | _type_, _val_, _nval_); \ | 405 | ({ \ |
| 322 | else if (is_acpi_node(_fwnode_)) \ | 406 | int _ret_; \ |
| 323 | _ret_ = acpi_node_prop_read(_fwnode_, _propname_, _proptype_, \ | 407 | if (is_of_node(_fwnode_)) \ |
| 324 | _val_, _nval_); \ | 408 | _ret_ = OF_DEV_PROP_READ_ARRAY(to_of_node(_fwnode_), _propname_, \ |
| 325 | else if (is_pset(_fwnode_)) \ | 409 | _type_, _val_, _nval_); \ |
| 326 | _ret_ = pset_prop_read_array(to_pset(_fwnode_), _propname_, \ | 410 | else if (is_acpi_node(_fwnode_)) \ |
| 327 | _proptype_, _val_, _nval_); \ | 411 | _ret_ = acpi_node_prop_read(_fwnode_, _propname_, _proptype_, \ |
| 328 | else \ | 412 | _val_, _nval_); \ |
| 329 | _ret_ = -ENXIO; \ | 413 | else if (is_pset_node(_fwnode_)) \ |
| 330 | _ret_; \ | 414 | _ret_ = PSET_PROP_READ_ARRAY(to_pset_node(_fwnode_), _propname_, \ |
| 415 | _type_, _val_, _nval_); \ | ||
| 416 | else \ | ||
| 417 | _ret_ = -ENXIO; \ | ||
| 418 | _ret_; \ | ||
| 419 | }) | ||
| 420 | |||
| 421 | #define FWNODE_PROP_READ_ARRAY(_fwnode_, _propname_, _type_, _proptype_, _val_, _nval_) \ | ||
| 422 | ({ \ | ||
| 423 | int _ret_; \ | ||
| 424 | _ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_, \ | ||
| 425 | _val_, _nval_); \ | ||
| 426 | if (_ret_ == -EINVAL && _fwnode_ && _fwnode_->secondary) \ | ||
| 427 | _ret_ = FWNODE_PROP_READ(_fwnode_->secondary, _propname_, _type_, \ | ||
| 428 | _proptype_, _val_, _nval_); \ | ||
| 429 | _ret_; \ | ||
| 331 | }) | 430 | }) |
| 332 | 431 | ||
| 333 | /** | 432 | /** |
| @@ -434,6 +533,41 @@ int fwnode_property_read_u64_array(struct fwnode_handle *fwnode, | |||
| 434 | } | 533 | } |
| 435 | EXPORT_SYMBOL_GPL(fwnode_property_read_u64_array); | 534 | EXPORT_SYMBOL_GPL(fwnode_property_read_u64_array); |
| 436 | 535 | ||
| 536 | static int __fwnode_property_read_string_array(struct fwnode_handle *fwnode, | ||
| 537 | const char *propname, | ||
| 538 | const char **val, size_t nval) | ||
| 539 | { | ||
| 540 | if (is_of_node(fwnode)) | ||
| 541 | return val ? | ||
| 542 | of_property_read_string_array(to_of_node(fwnode), | ||
| 543 | propname, val, nval) : | ||
| 544 | of_property_count_strings(to_of_node(fwnode), propname); | ||
| 545 | else if (is_acpi_node(fwnode)) | ||
| 546 | return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING, | ||
| 547 | val, nval); | ||
| 548 | else if (is_pset_node(fwnode)) | ||
| 549 | return val ? | ||
| 550 | pset_prop_read_string_array(to_pset_node(fwnode), | ||
| 551 | propname, val, nval) : | ||
| 552 | pset_prop_count_elems_of_size(to_pset_node(fwnode), | ||
| 553 | propname, | ||
| 554 | sizeof(const char *)); | ||
| 555 | return -ENXIO; | ||
| 556 | } | ||
| 557 | |||
| 558 | static int __fwnode_property_read_string(struct fwnode_handle *fwnode, | ||
| 559 | const char *propname, const char **val) | ||
| 560 | { | ||
| 561 | if (is_of_node(fwnode)) | ||
| 562 | return of_property_read_string(to_of_node(fwnode), propname, val); | ||
| 563 | else if (is_acpi_node(fwnode)) | ||
| 564 | return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING, | ||
| 565 | val, 1); | ||
| 566 | else if (is_pset_node(fwnode)) | ||
| 567 | return pset_prop_read_string(to_pset_node(fwnode), propname, val); | ||
| 568 | return -ENXIO; | ||
| 569 | } | ||
| 570 | |||
| 437 | /** | 571 | /** |
| 438 | * fwnode_property_read_string_array - return string array property of a node | 572 | * fwnode_property_read_string_array - return string array property of a node |
| 439 | * @fwnode: Firmware node to get the property of | 573 | * @fwnode: Firmware node to get the property of |
| @@ -456,18 +590,13 @@ int fwnode_property_read_string_array(struct fwnode_handle *fwnode, | |||
| 456 | const char *propname, const char **val, | 590 | const char *propname, const char **val, |
| 457 | size_t nval) | 591 | size_t nval) |
| 458 | { | 592 | { |
| 459 | if (is_of_node(fwnode)) | 593 | int ret; |
| 460 | return val ? | 594 | |
| 461 | of_property_read_string_array(to_of_node(fwnode), | 595 | ret = __fwnode_property_read_string_array(fwnode, propname, val, nval); |
| 462 | propname, val, nval) : | 596 | if (ret == -EINVAL && fwnode && fwnode->secondary) |
| 463 | of_property_count_strings(to_of_node(fwnode), propname); | 597 | ret = __fwnode_property_read_string_array(fwnode->secondary, |
| 464 | else if (is_acpi_node(fwnode)) | 598 | propname, val, nval); |
| 465 | return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING, | 599 | return ret; |
| 466 | val, nval); | ||
| 467 | else if (is_pset(fwnode)) | ||
| 468 | return pset_prop_read_array(to_pset(fwnode), propname, | ||
| 469 | DEV_PROP_STRING, val, nval); | ||
| 470 | return -ENXIO; | ||
| 471 | } | 600 | } |
| 472 | EXPORT_SYMBOL_GPL(fwnode_property_read_string_array); | 601 | EXPORT_SYMBOL_GPL(fwnode_property_read_string_array); |
| 473 | 602 | ||
| @@ -489,14 +618,13 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_string_array); | |||
| 489 | int fwnode_property_read_string(struct fwnode_handle *fwnode, | 618 | int fwnode_property_read_string(struct fwnode_handle *fwnode, |
| 490 | const char *propname, const char **val) | 619 | const char *propname, const char **val) |
| 491 | { | 620 | { |
| 492 | if (is_of_node(fwnode)) | 621 | int ret; |
| 493 | return of_property_read_string(to_of_node(fwnode), propname, val); | ||
| 494 | else if (is_acpi_node(fwnode)) | ||
| 495 | return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING, | ||
| 496 | val, 1); | ||
| 497 | 622 | ||
| 498 | return pset_prop_read_array(to_pset(fwnode), propname, | 623 | ret = __fwnode_property_read_string(fwnode, propname, val); |
| 499 | DEV_PROP_STRING, val, 1); | 624 | if (ret == -EINVAL && fwnode && fwnode->secondary) |
| 625 | ret = __fwnode_property_read_string(fwnode->secondary, | ||
| 626 | propname, val); | ||
| 627 | return ret; | ||
| 500 | } | 628 | } |
| 501 | EXPORT_SYMBOL_GPL(fwnode_property_read_string); | 629 | EXPORT_SYMBOL_GPL(fwnode_property_read_string); |
| 502 | 630 | ||
| @@ -525,6 +653,9 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode, | |||
| 525 | if (nval < 0) | 653 | if (nval < 0) |
| 526 | return nval; | 654 | return nval; |
| 527 | 655 | ||
| 656 | if (nval == 0) | ||
| 657 | return -ENODATA; | ||
| 658 | |||
| 528 | values = kcalloc(nval, sizeof(*values), GFP_KERNEL); | 659 | values = kcalloc(nval, sizeof(*values), GFP_KERNEL); |
| 529 | if (!values) | 660 | if (!values) |
| 530 | return -ENOMEM; | 661 | return -ENOMEM; |
| @@ -547,6 +678,182 @@ out: | |||
| 547 | EXPORT_SYMBOL_GPL(fwnode_property_match_string); | 678 | EXPORT_SYMBOL_GPL(fwnode_property_match_string); |
| 548 | 679 | ||
| 549 | /** | 680 | /** |
| 681 | * pset_free_set - releases memory allocated for copied property set | ||
| 682 | * @pset: Property set to release | ||
| 683 | * | ||
| 684 | * Function takes previously copied property set and releases all the | ||
| 685 | * memory allocated to it. | ||
| 686 | */ | ||
| 687 | static void pset_free_set(struct property_set *pset) | ||
| 688 | { | ||
| 689 | const struct property_entry *prop; | ||
| 690 | size_t i, nval; | ||
| 691 | |||
| 692 | if (!pset) | ||
| 693 | return; | ||
| 694 | |||
| 695 | for (prop = pset->properties; prop->name; prop++) { | ||
| 696 | if (prop->is_array) { | ||
| 697 | if (prop->is_string && prop->pointer.str) { | ||
| 698 | nval = prop->length / sizeof(const char *); | ||
| 699 | for (i = 0; i < nval; i++) | ||
| 700 | kfree(prop->pointer.str[i]); | ||
| 701 | } | ||
| 702 | kfree(prop->pointer.raw_data); | ||
| 703 | } else if (prop->is_string) { | ||
| 704 | kfree(prop->value.str); | ||
| 705 | } | ||
| 706 | kfree(prop->name); | ||
| 707 | } | ||
| 708 | |||
| 709 | kfree(pset->properties); | ||
| 710 | kfree(pset); | ||
| 711 | } | ||
| 712 | |||
| 713 | static int pset_copy_entry(struct property_entry *dst, | ||
| 714 | const struct property_entry *src) | ||
| 715 | { | ||
| 716 | const char **d, **s; | ||
| 717 | size_t i, nval; | ||
| 718 | |||
| 719 | dst->name = kstrdup(src->name, GFP_KERNEL); | ||
| 720 | if (!dst->name) | ||
| 721 | return -ENOMEM; | ||
| 722 | |||
| 723 | if (src->is_array) { | ||
| 724 | if (!src->length) | ||
| 725 | return -ENODATA; | ||
| 726 | |||
| 727 | if (src->is_string) { | ||
| 728 | nval = src->length / sizeof(const char *); | ||
| 729 | dst->pointer.str = kcalloc(nval, sizeof(const char *), | ||
| 730 | GFP_KERNEL); | ||
| 731 | if (!dst->pointer.str) | ||
| 732 | return -ENOMEM; | ||
| 733 | |||
| 734 | d = dst->pointer.str; | ||
| 735 | s = src->pointer.str; | ||
| 736 | for (i = 0; i < nval; i++) { | ||
| 737 | d[i] = kstrdup(s[i], GFP_KERNEL); | ||
| 738 | if (!d[i] && s[i]) | ||
| 739 | return -ENOMEM; | ||
| 740 | } | ||
| 741 | } else { | ||
| 742 | dst->pointer.raw_data = kmemdup(src->pointer.raw_data, | ||
| 743 | src->length, GFP_KERNEL); | ||
| 744 | if (!dst->pointer.raw_data) | ||
| 745 | return -ENOMEM; | ||
| 746 | } | ||
| 747 | } else if (src->is_string) { | ||
| 748 | dst->value.str = kstrdup(src->value.str, GFP_KERNEL); | ||
| 749 | if (!dst->value.str && src->value.str) | ||
| 750 | return -ENOMEM; | ||
| 751 | } else { | ||
| 752 | dst->value.raw_data = src->value.raw_data; | ||
| 753 | } | ||
| 754 | |||
| 755 | dst->length = src->length; | ||
| 756 | dst->is_array = src->is_array; | ||
| 757 | dst->is_string = src->is_string; | ||
| 758 | |||
| 759 | return 0; | ||
| 760 | } | ||
| 761 | |||
| 762 | /** | ||
| 763 | * pset_copy_set - copies property set | ||
| 764 | * @pset: Property set to copy | ||
| 765 | * | ||
| 766 | * This function takes a deep copy of the given property set and returns | ||
| 767 | * pointer to the copy. Call device_free_property_set() to free resources | ||
| 768 | * allocated in this function. | ||
| 769 | * | ||
| 770 | * Return: Pointer to the new property set or error pointer. | ||
| 771 | */ | ||
| 772 | static struct property_set *pset_copy_set(const struct property_set *pset) | ||
| 773 | { | ||
| 774 | const struct property_entry *entry; | ||
| 775 | struct property_set *p; | ||
| 776 | size_t i, n = 0; | ||
| 777 | |||
| 778 | p = kzalloc(sizeof(*p), GFP_KERNEL); | ||
| 779 | if (!p) | ||
| 780 | return ERR_PTR(-ENOMEM); | ||
| 781 | |||
| 782 | while (pset->properties[n].name) | ||
| 783 | n++; | ||
| 784 | |||
| 785 | p->properties = kcalloc(n + 1, sizeof(*entry), GFP_KERNEL); | ||
| 786 | if (!p->properties) { | ||
| 787 | kfree(p); | ||
| 788 | return ERR_PTR(-ENOMEM); | ||
| 789 | } | ||
| 790 | |||
| 791 | for (i = 0; i < n; i++) { | ||
| 792 | int ret = pset_copy_entry(&p->properties[i], | ||
| 793 | &pset->properties[i]); | ||
| 794 | if (ret) { | ||
| 795 | pset_free_set(p); | ||
| 796 | return ERR_PTR(ret); | ||
| 797 | } | ||
| 798 | } | ||
| 799 | |||
| 800 | return p; | ||
| 801 | } | ||
| 802 | |||
| 803 | /** | ||
| 804 | * device_remove_property_set - Remove properties from a device object. | ||
| 805 | * @dev: Device whose properties to remove. | ||
| 806 | * | ||
| 807 | * The function removes properties previously associated to the device | ||
| 808 | * secondary firmware node with device_add_property_set(). Memory allocated | ||
| 809 | * to the properties will also be released. | ||
| 810 | */ | ||
| 811 | void device_remove_property_set(struct device *dev) | ||
| 812 | { | ||
| 813 | struct fwnode_handle *fwnode; | ||
| 814 | |||
| 815 | fwnode = dev_fwnode(dev); | ||
| 816 | if (!fwnode) | ||
| 817 | return; | ||
| 818 | /* | ||
| 819 | * Pick either primary or secondary node depending which one holds | ||
| 820 | * the pset. If there is no real firmware node (ACPI/DT) primary | ||
| 821 | * will hold the pset. | ||
| 822 | */ | ||
| 823 | if (!is_pset_node(fwnode)) | ||
| 824 | fwnode = fwnode->secondary; | ||
| 825 | if (!IS_ERR(fwnode) && is_pset_node(fwnode)) | ||
| 826 | pset_free_set(to_pset_node(fwnode)); | ||
| 827 | set_secondary_fwnode(dev, NULL); | ||
| 828 | } | ||
| 829 | EXPORT_SYMBOL_GPL(device_remove_property_set); | ||
| 830 | |||
| 831 | /** | ||
| 832 | * device_add_property_set - Add a collection of properties to a device object. | ||
| 833 | * @dev: Device to add properties to. | ||
| 834 | * @pset: Collection of properties to add. | ||
| 835 | * | ||
| 836 | * Associate a collection of device properties represented by @pset with @dev | ||
| 837 | * as its secondary firmware node. The function takes a copy of @pset. | ||
| 838 | */ | ||
| 839 | int device_add_property_set(struct device *dev, const struct property_set *pset) | ||
| 840 | { | ||
| 841 | struct property_set *p; | ||
| 842 | |||
| 843 | if (!pset) | ||
| 844 | return -EINVAL; | ||
| 845 | |||
| 846 | p = pset_copy_set(pset); | ||
| 847 | if (IS_ERR(p)) | ||
| 848 | return PTR_ERR(p); | ||
| 849 | |||
| 850 | p->fwnode.type = FWNODE_PDATA; | ||
| 851 | set_secondary_fwnode(dev, &p->fwnode); | ||
| 852 | return 0; | ||
| 853 | } | ||
| 854 | EXPORT_SYMBOL_GPL(device_add_property_set); | ||
| 855 | |||
| 856 | /** | ||
| 550 | * device_get_next_child_node - Return the next child node handle for a device | 857 | * device_get_next_child_node - Return the next child node handle for a device |
| 551 | * @dev: Device to find the next child node for. | 858 | * @dev: Device to find the next child node for. |
| 552 | * @child: Handle to one of the device's child nodes or a null handle. | 859 | * @child: Handle to one of the device's child nodes or a null handle. |
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index b1f8a73e5a94..0031069b64c9 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | config ARM_BIG_LITTLE_CPUFREQ | 6 | config ARM_BIG_LITTLE_CPUFREQ |
| 7 | tristate "Generic ARM big LITTLE CPUfreq driver" | 7 | tristate "Generic ARM big LITTLE CPUfreq driver" |
| 8 | depends on (ARM_CPU_TOPOLOGY || ARM64) && HAVE_CLK | 8 | depends on (ARM_CPU_TOPOLOGY || ARM64) && HAVE_CLK |
| 9 | # if CPU_THERMAL is on and THERMAL=m, ARM_BIT_LITTLE_CPUFREQ cannot be =y | ||
| 10 | depends on !CPU_THERMAL || THERMAL | ||
| 9 | select PM_OPP | 11 | select PM_OPP |
| 10 | help | 12 | help |
| 11 | This enables the Generic CPUfreq driver for ARM big.LITTLE platforms. | 13 | This enables the Generic CPUfreq driver for ARM big.LITTLE platforms. |
| @@ -217,6 +219,16 @@ config ARM_SPEAR_CPUFREQ | |||
| 217 | help | 219 | help |
| 218 | This adds the CPUFreq driver support for SPEAr SOCs. | 220 | This adds the CPUFreq driver support for SPEAr SOCs. |
| 219 | 221 | ||
| 222 | config ARM_STI_CPUFREQ | ||
| 223 | tristate "STi CPUFreq support" | ||
| 224 | depends on SOC_STIH407 | ||
| 225 | help | ||
| 226 | This driver uses the generic OPP framework to match the running | ||
| 227 | platform with a predefined set of suitable values. If not provided | ||
| 228 | we will fall-back so safe-values contained in Device Tree. Enable | ||
| 229 | this config option if you wish to add CPUFreq support for STi based | ||
| 230 | SoCs. | ||
| 231 | |||
| 220 | config ARM_TEGRA20_CPUFREQ | 232 | config ARM_TEGRA20_CPUFREQ |
| 221 | bool "Tegra20 CPUFreq support" | 233 | bool "Tegra20 CPUFreq support" |
| 222 | depends on ARCH_TEGRA | 234 | depends on ARCH_TEGRA |
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index c0af1a1281c8..9e63fb1b09f8 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
| @@ -73,6 +73,7 @@ obj-$(CONFIG_ARM_SA1100_CPUFREQ) += sa1100-cpufreq.o | |||
| 73 | obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o | 73 | obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o |
| 74 | obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o | 74 | obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o |
| 75 | obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o | 75 | obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o |
| 76 | obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o | ||
| 76 | obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o | 77 | obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o |
| 77 | obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o | 78 | obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o |
| 78 | obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o | 79 | obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o |
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index cec1ee2d2f74..51eef87bbc37 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
| @@ -135,7 +135,7 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask) | |||
| 135 | wrmsr_on_cpus(cpumask, msr_addr, msrs); | 135 | wrmsr_on_cpus(cpumask, msr_addr, msrs); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | static int _store_boost(int val) | 138 | static int set_boost(int val) |
| 139 | { | 139 | { |
| 140 | get_online_cpus(); | 140 | get_online_cpus(); |
| 141 | boost_set_msrs(val, cpu_online_mask); | 141 | boost_set_msrs(val, cpu_online_mask); |
| @@ -158,29 +158,24 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) | |||
| 158 | cpufreq_freq_attr_ro(freqdomain_cpus); | 158 | cpufreq_freq_attr_ro(freqdomain_cpus); |
| 159 | 159 | ||
| 160 | #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB | 160 | #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB |
| 161 | static ssize_t store_boost(const char *buf, size_t count) | 161 | static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, |
| 162 | size_t count) | ||
| 162 | { | 163 | { |
| 163 | int ret; | 164 | int ret; |
| 164 | unsigned long val = 0; | 165 | unsigned int val = 0; |
| 165 | 166 | ||
| 166 | if (!acpi_cpufreq_driver.boost_supported) | 167 | if (!acpi_cpufreq_driver.set_boost) |
| 167 | return -EINVAL; | 168 | return -EINVAL; |
| 168 | 169 | ||
| 169 | ret = kstrtoul(buf, 10, &val); | 170 | ret = kstrtouint(buf, 10, &val); |
| 170 | if (ret || (val > 1)) | 171 | if (ret || val > 1) |
| 171 | return -EINVAL; | 172 | return -EINVAL; |
| 172 | 173 | ||
| 173 | _store_boost((int) val); | 174 | set_boost(val); |
| 174 | 175 | ||
| 175 | return count; | 176 | return count; |
| 176 | } | 177 | } |
| 177 | 178 | ||
| 178 | static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, | ||
| 179 | size_t count) | ||
| 180 | { | ||
| 181 | return store_boost(buf, count); | ||
| 182 | } | ||
| 183 | |||
| 184 | static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) | 179 | static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) |
| 185 | { | 180 | { |
| 186 | return sprintf(buf, "%u\n", acpi_cpufreq_driver.boost_enabled); | 181 | return sprintf(buf, "%u\n", acpi_cpufreq_driver.boost_enabled); |
| @@ -905,7 +900,6 @@ static struct cpufreq_driver acpi_cpufreq_driver = { | |||
| 905 | .resume = acpi_cpufreq_resume, | 900 | .resume = acpi_cpufreq_resume, |
| 906 | .name = "acpi-cpufreq", | 901 | .name = "acpi-cpufreq", |
| 907 | .attr = acpi_cpufreq_attr, | 902 | .attr = acpi_cpufreq_attr, |
| 908 | .set_boost = _store_boost, | ||
| 909 | }; | 903 | }; |
| 910 | 904 | ||
| 911 | static void __init acpi_cpufreq_boost_init(void) | 905 | static void __init acpi_cpufreq_boost_init(void) |
| @@ -916,7 +910,7 @@ static void __init acpi_cpufreq_boost_init(void) | |||
| 916 | if (!msrs) | 910 | if (!msrs) |
| 917 | return; | 911 | return; |
| 918 | 912 | ||
| 919 | acpi_cpufreq_driver.boost_supported = true; | 913 | acpi_cpufreq_driver.set_boost = set_boost; |
| 920 | acpi_cpufreq_driver.boost_enabled = boost_state(0); | 914 | acpi_cpufreq_driver.boost_enabled = boost_state(0); |
| 921 | 915 | ||
| 922 | cpu_notifier_register_begin(); | 916 | cpu_notifier_register_begin(); |
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index c5d256caa664..c251247ae661 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/cpu.h> | 23 | #include <linux/cpu.h> |
| 24 | #include <linux/cpufreq.h> | 24 | #include <linux/cpufreq.h> |
| 25 | #include <linux/cpumask.h> | 25 | #include <linux/cpumask.h> |
| 26 | #include <linux/cpu_cooling.h> | ||
| 26 | #include <linux/export.h> | 27 | #include <linux/export.h> |
| 27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 28 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
| @@ -55,6 +56,7 @@ static bool bL_switching_enabled; | |||
| 55 | #define ACTUAL_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq << 1 : freq) | 56 | #define ACTUAL_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq << 1 : freq) |
| 56 | #define VIRT_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq >> 1 : freq) | 57 | #define VIRT_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq >> 1 : freq) |
| 57 | 58 | ||
| 59 | static struct thermal_cooling_device *cdev[MAX_CLUSTERS]; | ||
| 58 | static struct cpufreq_arm_bL_ops *arm_bL_ops; | 60 | static struct cpufreq_arm_bL_ops *arm_bL_ops; |
| 59 | static struct clk *clk[MAX_CLUSTERS]; | 61 | static struct clk *clk[MAX_CLUSTERS]; |
| 60 | static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1]; | 62 | static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1]; |
| @@ -493,6 +495,12 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy) | |||
| 493 | static int bL_cpufreq_exit(struct cpufreq_policy *policy) | 495 | static int bL_cpufreq_exit(struct cpufreq_policy *policy) |
| 494 | { | 496 | { |
| 495 | struct device *cpu_dev; | 497 | struct device *cpu_dev; |
| 498 | int cur_cluster = cpu_to_cluster(policy->cpu); | ||
| 499 | |||
| 500 | if (cur_cluster < MAX_CLUSTERS) { | ||
| 501 | cpufreq_cooling_unregister(cdev[cur_cluster]); | ||
| 502 | cdev[cur_cluster] = NULL; | ||
| 503 | } | ||
| 496 | 504 | ||
| 497 | cpu_dev = get_cpu_device(policy->cpu); | 505 | cpu_dev = get_cpu_device(policy->cpu); |
| 498 | if (!cpu_dev) { | 506 | if (!cpu_dev) { |
| @@ -507,6 +515,38 @@ static int bL_cpufreq_exit(struct cpufreq_policy *policy) | |||
| 507 | return 0; | 515 | return 0; |
| 508 | } | 516 | } |
| 509 | 517 | ||
| 518 | static void bL_cpufreq_ready(struct cpufreq_policy *policy) | ||
| 519 | { | ||
| 520 | struct device *cpu_dev = get_cpu_device(policy->cpu); | ||
| 521 | int cur_cluster = cpu_to_cluster(policy->cpu); | ||
| 522 | struct device_node *np; | ||
| 523 | |||
| 524 | /* Do not register a cpu_cooling device if we are in IKS mode */ | ||
| 525 | if (cur_cluster >= MAX_CLUSTERS) | ||
| 526 | return; | ||
| 527 | |||
| 528 | np = of_node_get(cpu_dev->of_node); | ||
| 529 | if (WARN_ON(!np)) | ||
| 530 | return; | ||
| 531 | |||
| 532 | if (of_find_property(np, "#cooling-cells", NULL)) { | ||
| 533 | u32 power_coefficient = 0; | ||
| 534 | |||
| 535 | of_property_read_u32(np, "dynamic-power-coefficient", | ||
| 536 | &power_coefficient); | ||
| 537 | |||
| 538 | cdev[cur_cluster] = of_cpufreq_power_cooling_register(np, | ||
| 539 | policy->related_cpus, power_coefficient, NULL); | ||
| 540 | if (IS_ERR(cdev[cur_cluster])) { | ||
| 541 | dev_err(cpu_dev, | ||
| 542 | "running cpufreq without cooling device: %ld\n", | ||
| 543 | PTR_ERR(cdev[cur_cluster])); | ||
| 544 | cdev[cur_cluster] = NULL; | ||
| 545 | } | ||
| 546 | } | ||
| 547 | of_node_put(np); | ||
| 548 | } | ||
| 549 | |||
| 510 | static struct cpufreq_driver bL_cpufreq_driver = { | 550 | static struct cpufreq_driver bL_cpufreq_driver = { |
| 511 | .name = "arm-big-little", | 551 | .name = "arm-big-little", |
| 512 | .flags = CPUFREQ_STICKY | | 552 | .flags = CPUFREQ_STICKY | |
| @@ -517,6 +557,7 @@ static struct cpufreq_driver bL_cpufreq_driver = { | |||
| 517 | .get = bL_cpufreq_get_rate, | 557 | .get = bL_cpufreq_get_rate, |
| 518 | .init = bL_cpufreq_init, | 558 | .init = bL_cpufreq_init, |
| 519 | .exit = bL_cpufreq_exit, | 559 | .exit = bL_cpufreq_exit, |
| 560 | .ready = bL_cpufreq_ready, | ||
| 520 | .attr = cpufreq_generic_attr, | 561 | .attr = cpufreq_generic_attr, |
| 521 | }; | 562 | }; |
| 522 | 563 | ||
diff --git a/drivers/cpufreq/blackfin-cpufreq.c b/drivers/cpufreq/blackfin-cpufreq.c index a9f8e5bd0716..12e97d8a9db0 100644 --- a/drivers/cpufreq/blackfin-cpufreq.c +++ b/drivers/cpufreq/blackfin-cpufreq.c | |||
| @@ -112,7 +112,7 @@ static unsigned int bfin_getfreq_khz(unsigned int cpu) | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | #ifdef CONFIG_BF60x | 114 | #ifdef CONFIG_BF60x |
| 115 | unsigned long cpu_set_cclk(int cpu, unsigned long new) | 115 | static int cpu_set_cclk(int cpu, unsigned long new) |
| 116 | { | 116 | { |
| 117 | struct clk *clk; | 117 | struct clk *clk; |
| 118 | int ret; | 118 | int ret; |
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 90d64081ddb3..9bc37c437874 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c | |||
| @@ -50,7 +50,8 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index) | |||
| 50 | struct private_data *priv = policy->driver_data; | 50 | struct private_data *priv = policy->driver_data; |
| 51 | struct device *cpu_dev = priv->cpu_dev; | 51 | struct device *cpu_dev = priv->cpu_dev; |
| 52 | struct regulator *cpu_reg = priv->cpu_reg; | 52 | struct regulator *cpu_reg = priv->cpu_reg; |
| 53 | unsigned long volt = 0, volt_old = 0, tol = 0; | 53 | unsigned long volt = 0, tol = 0; |
| 54 | int volt_old = 0; | ||
| 54 | unsigned int old_freq, new_freq; | 55 | unsigned int old_freq, new_freq; |
| 55 | long freq_Hz, freq_exact; | 56 | long freq_Hz, freq_exact; |
| 56 | int ret; | 57 | int ret; |
| @@ -83,7 +84,7 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index) | |||
| 83 | opp_freq / 1000, volt); | 84 | opp_freq / 1000, volt); |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n", | 87 | dev_dbg(cpu_dev, "%u MHz, %d mV --> %u MHz, %ld mV\n", |
| 87 | old_freq / 1000, (volt_old > 0) ? volt_old / 1000 : -1, | 88 | old_freq / 1000, (volt_old > 0) ? volt_old / 1000 : -1, |
| 88 | new_freq / 1000, volt ? volt / 1000 : -1); | 89 | new_freq / 1000, volt ? volt / 1000 : -1); |
| 89 | 90 | ||
| @@ -407,8 +408,13 @@ static void cpufreq_ready(struct cpufreq_policy *policy) | |||
| 407 | * thermal DT code takes care of matching them. | 408 | * thermal DT code takes care of matching them. |
| 408 | */ | 409 | */ |
| 409 | if (of_find_property(np, "#cooling-cells", NULL)) { | 410 | if (of_find_property(np, "#cooling-cells", NULL)) { |
| 410 | priv->cdev = of_cpufreq_cooling_register(np, | 411 | u32 power_coefficient = 0; |
| 411 | policy->related_cpus); | 412 | |
| 413 | of_property_read_u32(np, "dynamic-power-coefficient", | ||
| 414 | &power_coefficient); | ||
| 415 | |||
| 416 | priv->cdev = of_cpufreq_power_cooling_register(np, | ||
| 417 | policy->related_cpus, power_coefficient, NULL); | ||
| 412 | if (IS_ERR(priv->cdev)) { | 418 | if (IS_ERR(priv->cdev)) { |
| 413 | dev_err(priv->cpu_dev, | 419 | dev_err(priv->cpu_dev, |
| 414 | "running cpufreq without cooling device: %ld\n", | 420 | "running cpufreq without cooling device: %ld\n", |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 8412ce5f93a7..c35e7da1ed7a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -2330,29 +2330,15 @@ int cpufreq_boost_trigger_state(int state) | |||
| 2330 | return ret; | 2330 | return ret; |
| 2331 | } | 2331 | } |
| 2332 | 2332 | ||
| 2333 | int cpufreq_boost_supported(void) | 2333 | static bool cpufreq_boost_supported(void) |
| 2334 | { | 2334 | { |
| 2335 | if (likely(cpufreq_driver)) | 2335 | return likely(cpufreq_driver) && cpufreq_driver->set_boost; |
| 2336 | return cpufreq_driver->boost_supported; | ||
| 2337 | |||
| 2338 | return 0; | ||
| 2339 | } | 2336 | } |
| 2340 | EXPORT_SYMBOL_GPL(cpufreq_boost_supported); | ||
| 2341 | 2337 | ||
| 2342 | static int create_boost_sysfs_file(void) | 2338 | static int create_boost_sysfs_file(void) |
| 2343 | { | 2339 | { |
| 2344 | int ret; | 2340 | int ret; |
| 2345 | 2341 | ||
| 2346 | if (!cpufreq_boost_supported()) | ||
| 2347 | return 0; | ||
| 2348 | |||
| 2349 | /* | ||
| 2350 | * Check if driver provides function to enable boost - | ||
| 2351 | * if not, use cpufreq_boost_set_sw as default | ||
| 2352 | */ | ||
| 2353 | if (!cpufreq_driver->set_boost) | ||
| 2354 | cpufreq_driver->set_boost = cpufreq_boost_set_sw; | ||
| 2355 | |||
| 2356 | ret = sysfs_create_file(cpufreq_global_kobject, &boost.attr); | 2342 | ret = sysfs_create_file(cpufreq_global_kobject, &boost.attr); |
| 2357 | if (ret) | 2343 | if (ret) |
| 2358 | pr_err("%s: cannot register global BOOST sysfs file\n", | 2344 | pr_err("%s: cannot register global BOOST sysfs file\n", |
| @@ -2375,7 +2361,7 @@ int cpufreq_enable_boost_support(void) | |||
| 2375 | if (cpufreq_boost_supported()) | 2361 | if (cpufreq_boost_supported()) |
| 2376 | return 0; | 2362 | return 0; |
| 2377 | 2363 | ||
| 2378 | cpufreq_driver->boost_supported = true; | 2364 | cpufreq_driver->set_boost = cpufreq_boost_set_sw; |
| 2379 | 2365 | ||
| 2380 | /* This will get removed on driver unregister */ | 2366 | /* This will get removed on driver unregister */ |
| 2381 | return create_boost_sysfs_file(); | 2367 | return create_boost_sysfs_file(); |
| @@ -2435,9 +2421,11 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
| 2435 | if (driver_data->setpolicy) | 2421 | if (driver_data->setpolicy) |
| 2436 | driver_data->flags |= CPUFREQ_CONST_LOOPS; | 2422 | driver_data->flags |= CPUFREQ_CONST_LOOPS; |
| 2437 | 2423 | ||
| 2438 | ret = create_boost_sysfs_file(); | 2424 | if (cpufreq_boost_supported()) { |
| 2439 | if (ret) | 2425 | ret = create_boost_sysfs_file(); |
| 2440 | goto err_null_driver; | 2426 | if (ret) |
| 2427 | goto err_null_driver; | ||
| 2428 | } | ||
| 2441 | 2429 | ||
| 2442 | ret = subsys_interface_register(&cpufreq_interface); | 2430 | ret = subsys_interface_register(&cpufreq_interface); |
| 2443 | if (ret) | 2431 | if (ret) |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 1fa1deb6e91f..606ad74abe6e 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
| @@ -115,13 +115,13 @@ static void cs_check_cpu(int cpu, unsigned int load) | |||
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | static unsigned int cs_dbs_timer(struct cpu_dbs_info *cdbs, | 118 | static unsigned int cs_dbs_timer(struct cpufreq_policy *policy, bool modify_all) |
| 119 | struct dbs_data *dbs_data, bool modify_all) | ||
| 120 | { | 119 | { |
| 120 | struct dbs_data *dbs_data = policy->governor_data; | ||
| 121 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 121 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; |
| 122 | 122 | ||
| 123 | if (modify_all) | 123 | if (modify_all) |
| 124 | dbs_check_cpu(dbs_data, cdbs->shared->policy->cpu); | 124 | dbs_check_cpu(dbs_data, policy->cpu); |
| 125 | 125 | ||
| 126 | return delay_for_sampling_rate(cs_tuners->sampling_rate); | 126 | return delay_for_sampling_rate(cs_tuners->sampling_rate); |
| 127 | } | 127 | } |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index b260576ddb12..bab3a514ec12 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
| @@ -84,6 +84,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) | |||
| 84 | (cur_wall_time - j_cdbs->prev_cpu_wall); | 84 | (cur_wall_time - j_cdbs->prev_cpu_wall); |
| 85 | j_cdbs->prev_cpu_wall = cur_wall_time; | 85 | j_cdbs->prev_cpu_wall = cur_wall_time; |
| 86 | 86 | ||
| 87 | if (cur_idle_time < j_cdbs->prev_cpu_idle) | ||
| 88 | cur_idle_time = j_cdbs->prev_cpu_idle; | ||
| 89 | |||
| 87 | idle_time = (unsigned int) | 90 | idle_time = (unsigned int) |
| 88 | (cur_idle_time - j_cdbs->prev_cpu_idle); | 91 | (cur_idle_time - j_cdbs->prev_cpu_idle); |
| 89 | j_cdbs->prev_cpu_idle = cur_idle_time; | 92 | j_cdbs->prev_cpu_idle = cur_idle_time; |
| @@ -158,47 +161,55 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) | |||
| 158 | } | 161 | } |
| 159 | EXPORT_SYMBOL_GPL(dbs_check_cpu); | 162 | EXPORT_SYMBOL_GPL(dbs_check_cpu); |
| 160 | 163 | ||
| 161 | static inline void __gov_queue_work(int cpu, struct dbs_data *dbs_data, | 164 | void gov_add_timers(struct cpufreq_policy *policy, unsigned int delay) |
| 162 | unsigned int delay) | ||
| 163 | { | 165 | { |
| 164 | struct cpu_dbs_info *cdbs = dbs_data->cdata->get_cpu_cdbs(cpu); | 166 | struct dbs_data *dbs_data = policy->governor_data; |
| 165 | 167 | struct cpu_dbs_info *cdbs; | |
| 166 | mod_delayed_work_on(cpu, system_wq, &cdbs->dwork, delay); | 168 | int cpu; |
| 167 | } | ||
| 168 | |||
| 169 | void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy, | ||
| 170 | unsigned int delay, bool all_cpus) | ||
| 171 | { | ||
| 172 | int i; | ||
| 173 | 169 | ||
| 174 | if (!all_cpus) { | 170 | for_each_cpu(cpu, policy->cpus) { |
| 175 | /* | 171 | cdbs = dbs_data->cdata->get_cpu_cdbs(cpu); |
| 176 | * Use raw_smp_processor_id() to avoid preemptible warnings. | 172 | cdbs->timer.expires = jiffies + delay; |
| 177 | * We know that this is only called with all_cpus == false from | 173 | add_timer_on(&cdbs->timer, cpu); |
| 178 | * works that have been queued with *_work_on() functions and | ||
| 179 | * those works are canceled during CPU_DOWN_PREPARE so they | ||
| 180 | * can't possibly run on any other CPU. | ||
| 181 | */ | ||
| 182 | __gov_queue_work(raw_smp_processor_id(), dbs_data, delay); | ||
| 183 | } else { | ||
| 184 | for_each_cpu(i, policy->cpus) | ||
| 185 | __gov_queue_work(i, dbs_data, delay); | ||
| 186 | } | 174 | } |
| 187 | } | 175 | } |
| 188 | EXPORT_SYMBOL_GPL(gov_queue_work); | 176 | EXPORT_SYMBOL_GPL(gov_add_timers); |
| 189 | 177 | ||
| 190 | static inline void gov_cancel_work(struct dbs_data *dbs_data, | 178 | static inline void gov_cancel_timers(struct cpufreq_policy *policy) |
| 191 | struct cpufreq_policy *policy) | ||
| 192 | { | 179 | { |
| 180 | struct dbs_data *dbs_data = policy->governor_data; | ||
| 193 | struct cpu_dbs_info *cdbs; | 181 | struct cpu_dbs_info *cdbs; |
| 194 | int i; | 182 | int i; |
| 195 | 183 | ||
| 196 | for_each_cpu(i, policy->cpus) { | 184 | for_each_cpu(i, policy->cpus) { |
| 197 | cdbs = dbs_data->cdata->get_cpu_cdbs(i); | 185 | cdbs = dbs_data->cdata->get_cpu_cdbs(i); |
| 198 | cancel_delayed_work_sync(&cdbs->dwork); | 186 | del_timer_sync(&cdbs->timer); |
| 199 | } | 187 | } |
| 200 | } | 188 | } |
| 201 | 189 | ||
| 190 | void gov_cancel_work(struct cpu_common_dbs_info *shared) | ||
| 191 | { | ||
| 192 | /* Tell dbs_timer_handler() to skip queuing up work items. */ | ||
| 193 | atomic_inc(&shared->skip_work); | ||
| 194 | /* | ||
| 195 | * If dbs_timer_handler() is already running, it may not notice the | ||
| 196 | * incremented skip_work, so wait for it to complete to prevent its work | ||
| 197 | * item from being queued up after the cancel_work_sync() below. | ||
| 198 | */ | ||
| 199 | gov_cancel_timers(shared->policy); | ||
| 200 | /* | ||
| 201 | * In case dbs_timer_handler() managed to run and spawn a work item | ||
| 202 | * before the timers have been canceled, wait for that work item to | ||
| 203 | * complete and then cancel all of the timers set up by it. If | ||
| 204 | * dbs_timer_handler() runs again at that point, it will see the | ||
| 205 | * positive value of skip_work and won't spawn any more work items. | ||
| 206 | */ | ||
| 207 | cancel_work_sync(&shared->work); | ||
| 208 | gov_cancel_timers(shared->policy); | ||
| 209 | atomic_set(&shared->skip_work, 0); | ||
| 210 | } | ||
| 211 | EXPORT_SYMBOL_GPL(gov_cancel_work); | ||
| 212 | |||
| 202 | /* Will return if we need to evaluate cpu load again or not */ | 213 | /* Will return if we need to evaluate cpu load again or not */ |
| 203 | static bool need_load_eval(struct cpu_common_dbs_info *shared, | 214 | static bool need_load_eval(struct cpu_common_dbs_info *shared, |
| 204 | unsigned int sampling_rate) | 215 | unsigned int sampling_rate) |
| @@ -217,29 +228,21 @@ static bool need_load_eval(struct cpu_common_dbs_info *shared, | |||
| 217 | return true; | 228 | return true; |
| 218 | } | 229 | } |
| 219 | 230 | ||
| 220 | static void dbs_timer(struct work_struct *work) | 231 | static void dbs_work_handler(struct work_struct *work) |
| 221 | { | 232 | { |
| 222 | struct cpu_dbs_info *cdbs = container_of(work, struct cpu_dbs_info, | 233 | struct cpu_common_dbs_info *shared = container_of(work, struct |
| 223 | dwork.work); | 234 | cpu_common_dbs_info, work); |
| 224 | struct cpu_common_dbs_info *shared = cdbs->shared; | ||
| 225 | struct cpufreq_policy *policy; | 235 | struct cpufreq_policy *policy; |
| 226 | struct dbs_data *dbs_data; | 236 | struct dbs_data *dbs_data; |
| 227 | unsigned int sampling_rate, delay; | 237 | unsigned int sampling_rate, delay; |
| 228 | bool modify_all = true; | 238 | bool eval_load; |
| 229 | |||
| 230 | mutex_lock(&shared->timer_mutex); | ||
| 231 | 239 | ||
| 232 | policy = shared->policy; | 240 | policy = shared->policy; |
| 233 | |||
| 234 | /* | ||
| 235 | * Governor might already be disabled and there is no point continuing | ||
| 236 | * with the work-handler. | ||
| 237 | */ | ||
| 238 | if (!policy) | ||
| 239 | goto unlock; | ||
| 240 | |||
| 241 | dbs_data = policy->governor_data; | 241 | dbs_data = policy->governor_data; |
| 242 | 242 | ||
| 243 | /* Kill all timers */ | ||
| 244 | gov_cancel_timers(policy); | ||
| 245 | |||
| 243 | if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { | 246 | if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { |
| 244 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 247 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; |
| 245 | 248 | ||
| @@ -250,14 +253,37 @@ static void dbs_timer(struct work_struct *work) | |||
| 250 | sampling_rate = od_tuners->sampling_rate; | 253 | sampling_rate = od_tuners->sampling_rate; |
| 251 | } | 254 | } |
| 252 | 255 | ||
| 253 | if (!need_load_eval(cdbs->shared, sampling_rate)) | 256 | eval_load = need_load_eval(shared, sampling_rate); |
| 254 | modify_all = false; | ||
| 255 | |||
| 256 | delay = dbs_data->cdata->gov_dbs_timer(cdbs, dbs_data, modify_all); | ||
| 257 | gov_queue_work(dbs_data, policy, delay, modify_all); | ||
| 258 | 257 | ||
| 259 | unlock: | 258 | /* |
| 259 | * Make sure cpufreq_governor_limits() isn't evaluating load in | ||
| 260 | * parallel. | ||
| 261 | */ | ||
| 262 | mutex_lock(&shared->timer_mutex); | ||
| 263 | delay = dbs_data->cdata->gov_dbs_timer(policy, eval_load); | ||
| 260 | mutex_unlock(&shared->timer_mutex); | 264 | mutex_unlock(&shared->timer_mutex); |
| 265 | |||
| 266 | atomic_dec(&shared->skip_work); | ||
| 267 | |||
| 268 | gov_add_timers(policy, delay); | ||
| 269 | } | ||
| 270 | |||
| 271 | static void dbs_timer_handler(unsigned long data) | ||
| 272 | { | ||
| 273 | struct cpu_dbs_info *cdbs = (struct cpu_dbs_info *)data; | ||
| 274 | struct cpu_common_dbs_info *shared = cdbs->shared; | ||
| 275 | |||
| 276 | /* | ||
| 277 | * Timer handler may not be allowed to queue the work at the moment, | ||
| 278 | * because: | ||
| 279 | * - Another timer handler has done that | ||
| 280 | * - We are stopping the governor | ||
| 281 | * - Or we are updating the sampling rate of the ondemand governor | ||
| 282 | */ | ||
| 283 | if (atomic_inc_return(&shared->skip_work) > 1) | ||
| 284 | atomic_dec(&shared->skip_work); | ||
| 285 | else | ||
| 286 | queue_work(system_wq, &shared->work); | ||
| 261 | } | 287 | } |
| 262 | 288 | ||
| 263 | static void set_sampling_rate(struct dbs_data *dbs_data, | 289 | static void set_sampling_rate(struct dbs_data *dbs_data, |
| @@ -287,6 +313,9 @@ static int alloc_common_dbs_info(struct cpufreq_policy *policy, | |||
| 287 | for_each_cpu(j, policy->related_cpus) | 313 | for_each_cpu(j, policy->related_cpus) |
| 288 | cdata->get_cpu_cdbs(j)->shared = shared; | 314 | cdata->get_cpu_cdbs(j)->shared = shared; |
| 289 | 315 | ||
| 316 | mutex_init(&shared->timer_mutex); | ||
| 317 | atomic_set(&shared->skip_work, 0); | ||
| 318 | INIT_WORK(&shared->work, dbs_work_handler); | ||
| 290 | return 0; | 319 | return 0; |
| 291 | } | 320 | } |
| 292 | 321 | ||
| @@ -297,6 +326,8 @@ static void free_common_dbs_info(struct cpufreq_policy *policy, | |||
| 297 | struct cpu_common_dbs_info *shared = cdbs->shared; | 326 | struct cpu_common_dbs_info *shared = cdbs->shared; |
| 298 | int j; | 327 | int j; |
| 299 | 328 | ||
| 329 | mutex_destroy(&shared->timer_mutex); | ||
| 330 | |||
| 300 | for_each_cpu(j, policy->cpus) | 331 | for_each_cpu(j, policy->cpus) |
| 301 | cdata->get_cpu_cdbs(j)->shared = NULL; | 332 | cdata->get_cpu_cdbs(j)->shared = NULL; |
| 302 | 333 | ||
| @@ -433,7 +464,6 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy, | |||
| 433 | 464 | ||
| 434 | shared->policy = policy; | 465 | shared->policy = policy; |
| 435 | shared->time_stamp = ktime_get(); | 466 | shared->time_stamp = ktime_get(); |
| 436 | mutex_init(&shared->timer_mutex); | ||
| 437 | 467 | ||
| 438 | for_each_cpu(j, policy->cpus) { | 468 | for_each_cpu(j, policy->cpus) { |
| 439 | struct cpu_dbs_info *j_cdbs = cdata->get_cpu_cdbs(j); | 469 | struct cpu_dbs_info *j_cdbs = cdata->get_cpu_cdbs(j); |
| @@ -450,7 +480,9 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy, | |||
| 450 | if (ignore_nice) | 480 | if (ignore_nice) |
| 451 | j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 481 | j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
| 452 | 482 | ||
| 453 | INIT_DEFERRABLE_WORK(&j_cdbs->dwork, dbs_timer); | 483 | __setup_timer(&j_cdbs->timer, dbs_timer_handler, |
| 484 | (unsigned long)j_cdbs, | ||
| 485 | TIMER_DEFERRABLE | TIMER_IRQSAFE); | ||
| 454 | } | 486 | } |
| 455 | 487 | ||
| 456 | if (cdata->governor == GOV_CONSERVATIVE) { | 488 | if (cdata->governor == GOV_CONSERVATIVE) { |
| @@ -468,8 +500,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy, | |||
| 468 | od_ops->powersave_bias_init_cpu(cpu); | 500 | od_ops->powersave_bias_init_cpu(cpu); |
| 469 | } | 501 | } |
| 470 | 502 | ||
| 471 | gov_queue_work(dbs_data, policy, delay_for_sampling_rate(sampling_rate), | 503 | gov_add_timers(policy, delay_for_sampling_rate(sampling_rate)); |
| 472 | true); | ||
| 473 | return 0; | 504 | return 0; |
| 474 | } | 505 | } |
| 475 | 506 | ||
| @@ -483,18 +514,9 @@ static int cpufreq_governor_stop(struct cpufreq_policy *policy, | |||
| 483 | if (!shared || !shared->policy) | 514 | if (!shared || !shared->policy) |
| 484 | return -EBUSY; | 515 | return -EBUSY; |
| 485 | 516 | ||
| 486 | /* | 517 | gov_cancel_work(shared); |
| 487 | * Work-handler must see this updated, as it should not proceed any | ||
| 488 | * further after governor is disabled. And so timer_mutex is taken while | ||
| 489 | * updating this value. | ||
| 490 | */ | ||
| 491 | mutex_lock(&shared->timer_mutex); | ||
| 492 | shared->policy = NULL; | 518 | shared->policy = NULL; |
| 493 | mutex_unlock(&shared->timer_mutex); | ||
| 494 | |||
| 495 | gov_cancel_work(dbs_data, policy); | ||
| 496 | 519 | ||
| 497 | mutex_destroy(&shared->timer_mutex); | ||
| 498 | return 0; | 520 | return 0; |
| 499 | } | 521 | } |
| 500 | 522 | ||
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 5621bb03e874..91e767a058a7 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #ifndef _CPUFREQ_GOVERNOR_H | 17 | #ifndef _CPUFREQ_GOVERNOR_H |
| 18 | #define _CPUFREQ_GOVERNOR_H | 18 | #define _CPUFREQ_GOVERNOR_H |
| 19 | 19 | ||
| 20 | #include <linux/atomic.h> | ||
| 20 | #include <linux/cpufreq.h> | 21 | #include <linux/cpufreq.h> |
| 21 | #include <linux/kernel_stat.h> | 22 | #include <linux/kernel_stat.h> |
| 22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| @@ -132,12 +133,14 @@ static void *get_cpu_dbs_info_s(int cpu) \ | |||
| 132 | struct cpu_common_dbs_info { | 133 | struct cpu_common_dbs_info { |
| 133 | struct cpufreq_policy *policy; | 134 | struct cpufreq_policy *policy; |
| 134 | /* | 135 | /* |
| 135 | * percpu mutex that serializes governor limit change with dbs_timer | 136 | * Per policy mutex that serializes load evaluation from limit-change |
| 136 | * invocation. We do not want dbs_timer to run when user is changing | 137 | * and work-handler. |
| 137 | * the governor or limits. | ||
| 138 | */ | 138 | */ |
| 139 | struct mutex timer_mutex; | 139 | struct mutex timer_mutex; |
| 140 | |||
| 140 | ktime_t time_stamp; | 141 | ktime_t time_stamp; |
| 142 | atomic_t skip_work; | ||
| 143 | struct work_struct work; | ||
| 141 | }; | 144 | }; |
| 142 | 145 | ||
| 143 | /* Per cpu structures */ | 146 | /* Per cpu structures */ |
| @@ -152,7 +155,7 @@ struct cpu_dbs_info { | |||
| 152 | * wake-up from idle. | 155 | * wake-up from idle. |
| 153 | */ | 156 | */ |
| 154 | unsigned int prev_load; | 157 | unsigned int prev_load; |
| 155 | struct delayed_work dwork; | 158 | struct timer_list timer; |
| 156 | struct cpu_common_dbs_info *shared; | 159 | struct cpu_common_dbs_info *shared; |
| 157 | }; | 160 | }; |
| 158 | 161 | ||
| @@ -209,8 +212,7 @@ struct common_dbs_data { | |||
| 209 | 212 | ||
| 210 | struct cpu_dbs_info *(*get_cpu_cdbs)(int cpu); | 213 | struct cpu_dbs_info *(*get_cpu_cdbs)(int cpu); |
| 211 | void *(*get_cpu_dbs_info_s)(int cpu); | 214 | void *(*get_cpu_dbs_info_s)(int cpu); |
| 212 | unsigned int (*gov_dbs_timer)(struct cpu_dbs_info *cdbs, | 215 | unsigned int (*gov_dbs_timer)(struct cpufreq_policy *policy, |
| 213 | struct dbs_data *dbs_data, | ||
| 214 | bool modify_all); | 216 | bool modify_all); |
| 215 | void (*gov_check_cpu)(int cpu, unsigned int load); | 217 | void (*gov_check_cpu)(int cpu, unsigned int load); |
| 216 | int (*init)(struct dbs_data *dbs_data, bool notify); | 218 | int (*init)(struct dbs_data *dbs_data, bool notify); |
| @@ -269,11 +271,11 @@ static ssize_t show_sampling_rate_min_gov_pol \ | |||
| 269 | 271 | ||
| 270 | extern struct mutex cpufreq_governor_lock; | 272 | extern struct mutex cpufreq_governor_lock; |
| 271 | 273 | ||
| 274 | void gov_add_timers(struct cpufreq_policy *policy, unsigned int delay); | ||
| 275 | void gov_cancel_work(struct cpu_common_dbs_info *shared); | ||
| 272 | void dbs_check_cpu(struct dbs_data *dbs_data, int cpu); | 276 | void dbs_check_cpu(struct dbs_data *dbs_data, int cpu); |
| 273 | int cpufreq_governor_dbs(struct cpufreq_policy *policy, | 277 | int cpufreq_governor_dbs(struct cpufreq_policy *policy, |
| 274 | struct common_dbs_data *cdata, unsigned int event); | 278 | struct common_dbs_data *cdata, unsigned int event); |
| 275 | void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy, | ||
| 276 | unsigned int delay, bool all_cpus); | ||
| 277 | void od_register_powersave_bias_handler(unsigned int (*f) | 279 | void od_register_powersave_bias_handler(unsigned int (*f) |
| 278 | (struct cpufreq_policy *, unsigned int, unsigned int), | 280 | (struct cpufreq_policy *, unsigned int, unsigned int), |
| 279 | unsigned int powersave_bias); | 281 | unsigned int powersave_bias); |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 03ac6ce54042..eae51070c034 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
| @@ -191,10 +191,9 @@ static void od_check_cpu(int cpu, unsigned int load) | |||
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static unsigned int od_dbs_timer(struct cpu_dbs_info *cdbs, | 194 | static unsigned int od_dbs_timer(struct cpufreq_policy *policy, bool modify_all) |
| 195 | struct dbs_data *dbs_data, bool modify_all) | ||
| 196 | { | 195 | { |
| 197 | struct cpufreq_policy *policy = cdbs->shared->policy; | 196 | struct dbs_data *dbs_data = policy->governor_data; |
| 198 | unsigned int cpu = policy->cpu; | 197 | unsigned int cpu = policy->cpu; |
| 199 | struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, | 198 | struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, |
| 200 | cpu); | 199 | cpu); |
| @@ -247,40 +246,66 @@ static void update_sampling_rate(struct dbs_data *dbs_data, | |||
| 247 | unsigned int new_rate) | 246 | unsigned int new_rate) |
| 248 | { | 247 | { |
| 249 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 248 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
| 249 | struct cpumask cpumask; | ||
| 250 | int cpu; | 250 | int cpu; |
| 251 | 251 | ||
| 252 | od_tuners->sampling_rate = new_rate = max(new_rate, | 252 | od_tuners->sampling_rate = new_rate = max(new_rate, |
| 253 | dbs_data->min_sampling_rate); | 253 | dbs_data->min_sampling_rate); |
| 254 | 254 | ||
| 255 | for_each_online_cpu(cpu) { | 255 | /* |
| 256 | * Lock governor so that governor start/stop can't execute in parallel. | ||
| 257 | */ | ||
| 258 | mutex_lock(&od_dbs_cdata.mutex); | ||
| 259 | |||
| 260 | cpumask_copy(&cpumask, cpu_online_mask); | ||
| 261 | |||
| 262 | for_each_cpu(cpu, &cpumask) { | ||
| 256 | struct cpufreq_policy *policy; | 263 | struct cpufreq_policy *policy; |
| 257 | struct od_cpu_dbs_info_s *dbs_info; | 264 | struct od_cpu_dbs_info_s *dbs_info; |
| 265 | struct cpu_dbs_info *cdbs; | ||
| 266 | struct cpu_common_dbs_info *shared; | ||
| 258 | unsigned long next_sampling, appointed_at; | 267 | unsigned long next_sampling, appointed_at; |
| 259 | 268 | ||
| 260 | policy = cpufreq_cpu_get(cpu); | ||
| 261 | if (!policy) | ||
| 262 | continue; | ||
| 263 | if (policy->governor != &cpufreq_gov_ondemand) { | ||
| 264 | cpufreq_cpu_put(policy); | ||
| 265 | continue; | ||
| 266 | } | ||
| 267 | dbs_info = &per_cpu(od_cpu_dbs_info, cpu); | 269 | dbs_info = &per_cpu(od_cpu_dbs_info, cpu); |
| 268 | cpufreq_cpu_put(policy); | 270 | cdbs = &dbs_info->cdbs; |
| 271 | shared = cdbs->shared; | ||
| 269 | 272 | ||
| 270 | if (!delayed_work_pending(&dbs_info->cdbs.dwork)) | 273 | /* |
| 274 | * A valid shared and shared->policy means governor hasn't | ||
| 275 | * stopped or exited yet. | ||
| 276 | */ | ||
| 277 | if (!shared || !shared->policy) | ||
| 278 | continue; | ||
| 279 | |||
| 280 | policy = shared->policy; | ||
| 281 | |||
| 282 | /* clear all CPUs of this policy */ | ||
| 283 | cpumask_andnot(&cpumask, &cpumask, policy->cpus); | ||
| 284 | |||
| 285 | /* | ||
| 286 | * Update sampling rate for CPUs whose policy is governed by | ||
| 287 | * dbs_data. In case of governor_per_policy, only a single | ||
| 288 | * policy will be governed by dbs_data, otherwise there can be | ||
| 289 | * multiple policies that are governed by the same dbs_data. | ||
| 290 | */ | ||
| 291 | if (dbs_data != policy->governor_data) | ||
| 271 | continue; | 292 | continue; |
| 272 | 293 | ||
| 294 | /* | ||
| 295 | * Checking this for any CPU should be fine, timers for all of | ||
| 296 | * them are scheduled together. | ||
| 297 | */ | ||
| 273 | next_sampling = jiffies + usecs_to_jiffies(new_rate); | 298 | next_sampling = jiffies + usecs_to_jiffies(new_rate); |
| 274 | appointed_at = dbs_info->cdbs.dwork.timer.expires; | 299 | appointed_at = dbs_info->cdbs.timer.expires; |
| 275 | 300 | ||
| 276 | if (time_before(next_sampling, appointed_at)) { | 301 | if (time_before(next_sampling, appointed_at)) { |
| 277 | cancel_delayed_work_sync(&dbs_info->cdbs.dwork); | 302 | gov_cancel_work(shared); |
| 278 | 303 | gov_add_timers(policy, usecs_to_jiffies(new_rate)); | |
| 279 | gov_queue_work(dbs_data, policy, | ||
| 280 | usecs_to_jiffies(new_rate), true); | ||
| 281 | 304 | ||
| 282 | } | 305 | } |
| 283 | } | 306 | } |
| 307 | |||
| 308 | mutex_unlock(&od_dbs_cdata.mutex); | ||
| 284 | } | 309 | } |
| 285 | 310 | ||
| 286 | static ssize_t store_sampling_rate(struct dbs_data *dbs_data, const char *buf, | 311 | static ssize_t store_sampling_rate(struct dbs_data *dbs_data, const char *buf, |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 98fb8821382d..cd83d477e32d 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -66,6 +66,7 @@ static inline int ceiling_fp(int32_t x) | |||
| 66 | 66 | ||
| 67 | struct sample { | 67 | struct sample { |
| 68 | int32_t core_pct_busy; | 68 | int32_t core_pct_busy; |
| 69 | int32_t busy_scaled; | ||
| 69 | u64 aperf; | 70 | u64 aperf; |
| 70 | u64 mperf; | 71 | u64 mperf; |
| 71 | u64 tsc; | 72 | u64 tsc; |
| @@ -112,6 +113,7 @@ struct cpudata { | |||
| 112 | u64 prev_aperf; | 113 | u64 prev_aperf; |
| 113 | u64 prev_mperf; | 114 | u64 prev_mperf; |
| 114 | u64 prev_tsc; | 115 | u64 prev_tsc; |
| 116 | u64 prev_cummulative_iowait; | ||
| 115 | struct sample sample; | 117 | struct sample sample; |
| 116 | }; | 118 | }; |
| 117 | 119 | ||
| @@ -133,6 +135,7 @@ struct pstate_funcs { | |||
| 133 | int (*get_scaling)(void); | 135 | int (*get_scaling)(void); |
| 134 | void (*set)(struct cpudata*, int pstate); | 136 | void (*set)(struct cpudata*, int pstate); |
| 135 | void (*get_vid)(struct cpudata *); | 137 | void (*get_vid)(struct cpudata *); |
| 138 | int32_t (*get_target_pstate)(struct cpudata *); | ||
| 136 | }; | 139 | }; |
| 137 | 140 | ||
| 138 | struct cpu_defaults { | 141 | struct cpu_defaults { |
| @@ -140,6 +143,9 @@ struct cpu_defaults { | |||
| 140 | struct pstate_funcs funcs; | 143 | struct pstate_funcs funcs; |
| 141 | }; | 144 | }; |
| 142 | 145 | ||
| 146 | static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu); | ||
| 147 | static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu); | ||
| 148 | |||
| 143 | static struct pstate_adjust_policy pid_params; | 149 | static struct pstate_adjust_policy pid_params; |
| 144 | static struct pstate_funcs pstate_funcs; | 150 | static struct pstate_funcs pstate_funcs; |
| 145 | static int hwp_active; | 151 | static int hwp_active; |
| @@ -738,6 +744,7 @@ static struct cpu_defaults core_params = { | |||
| 738 | .get_turbo = core_get_turbo_pstate, | 744 | .get_turbo = core_get_turbo_pstate, |
| 739 | .get_scaling = core_get_scaling, | 745 | .get_scaling = core_get_scaling, |
| 740 | .set = core_set_pstate, | 746 | .set = core_set_pstate, |
| 747 | .get_target_pstate = get_target_pstate_use_performance, | ||
| 741 | }, | 748 | }, |
| 742 | }; | 749 | }; |
| 743 | 750 | ||
| @@ -758,6 +765,7 @@ static struct cpu_defaults silvermont_params = { | |||
| 758 | .set = atom_set_pstate, | 765 | .set = atom_set_pstate, |
| 759 | .get_scaling = silvermont_get_scaling, | 766 | .get_scaling = silvermont_get_scaling, |
| 760 | .get_vid = atom_get_vid, | 767 | .get_vid = atom_get_vid, |
| 768 | .get_target_pstate = get_target_pstate_use_cpu_load, | ||
| 761 | }, | 769 | }, |
| 762 | }; | 770 | }; |
| 763 | 771 | ||
| @@ -778,6 +786,7 @@ static struct cpu_defaults airmont_params = { | |||
| 778 | .set = atom_set_pstate, | 786 | .set = atom_set_pstate, |
| 779 | .get_scaling = airmont_get_scaling, | 787 | .get_scaling = airmont_get_scaling, |
| 780 | .get_vid = atom_get_vid, | 788 | .get_vid = atom_get_vid, |
| 789 | .get_target_pstate = get_target_pstate_use_cpu_load, | ||
| 781 | }, | 790 | }, |
| 782 | }; | 791 | }; |
| 783 | 792 | ||
| @@ -797,6 +806,7 @@ static struct cpu_defaults knl_params = { | |||
| 797 | .get_turbo = knl_get_turbo_pstate, | 806 | .get_turbo = knl_get_turbo_pstate, |
| 798 | .get_scaling = core_get_scaling, | 807 | .get_scaling = core_get_scaling, |
| 799 | .set = core_set_pstate, | 808 | .set = core_set_pstate, |
| 809 | .get_target_pstate = get_target_pstate_use_performance, | ||
| 800 | }, | 810 | }, |
| 801 | }; | 811 | }; |
| 802 | 812 | ||
| @@ -882,12 +892,11 @@ static inline void intel_pstate_sample(struct cpudata *cpu) | |||
| 882 | local_irq_save(flags); | 892 | local_irq_save(flags); |
| 883 | rdmsrl(MSR_IA32_APERF, aperf); | 893 | rdmsrl(MSR_IA32_APERF, aperf); |
| 884 | rdmsrl(MSR_IA32_MPERF, mperf); | 894 | rdmsrl(MSR_IA32_MPERF, mperf); |
| 885 | if (cpu->prev_mperf == mperf) { | 895 | tsc = rdtsc(); |
| 896 | if ((cpu->prev_mperf == mperf) || (cpu->prev_tsc == tsc)) { | ||
| 886 | local_irq_restore(flags); | 897 | local_irq_restore(flags); |
| 887 | return; | 898 | return; |
| 888 | } | 899 | } |
| 889 | |||
| 890 | tsc = rdtsc(); | ||
| 891 | local_irq_restore(flags); | 900 | local_irq_restore(flags); |
| 892 | 901 | ||
| 893 | cpu->last_sample_time = cpu->sample.time; | 902 | cpu->last_sample_time = cpu->sample.time; |
| @@ -922,7 +931,43 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu) | |||
| 922 | mod_timer_pinned(&cpu->timer, jiffies + delay); | 931 | mod_timer_pinned(&cpu->timer, jiffies + delay); |
| 923 | } | 932 | } |
| 924 | 933 | ||
| 925 | static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | 934 | static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) |
| 935 | { | ||
| 936 | struct sample *sample = &cpu->sample; | ||
| 937 | u64 cummulative_iowait, delta_iowait_us; | ||
| 938 | u64 delta_iowait_mperf; | ||
| 939 | u64 mperf, now; | ||
| 940 | int32_t cpu_load; | ||
| 941 | |||
| 942 | cummulative_iowait = get_cpu_iowait_time_us(cpu->cpu, &now); | ||
| 943 | |||
| 944 | /* | ||
| 945 | * Convert iowait time into number of IO cycles spent at max_freq. | ||
| 946 | * IO is considered as busy only for the cpu_load algorithm. For | ||
| 947 | * performance this is not needed since we always try to reach the | ||
| 948 | * maximum P-State, so we are already boosting the IOs. | ||
| 949 | */ | ||
| 950 | delta_iowait_us = cummulative_iowait - cpu->prev_cummulative_iowait; | ||
| 951 | delta_iowait_mperf = div64_u64(delta_iowait_us * cpu->pstate.scaling * | ||
| 952 | cpu->pstate.max_pstate, MSEC_PER_SEC); | ||
| 953 | |||
| 954 | mperf = cpu->sample.mperf + delta_iowait_mperf; | ||
| 955 | cpu->prev_cummulative_iowait = cummulative_iowait; | ||
| 956 | |||
| 957 | |||
| 958 | /* | ||
| 959 | * The load can be estimated as the ratio of the mperf counter | ||
| 960 | * running at a constant frequency during active periods | ||
| 961 | * (C0) and the time stamp counter running at the same frequency | ||
| 962 | * also during C-states. | ||
| 963 | */ | ||
| 964 | cpu_load = div64_u64(int_tofp(100) * mperf, sample->tsc); | ||
| 965 | cpu->sample.busy_scaled = cpu_load; | ||
| 966 | |||
| 967 | return cpu->pstate.current_pstate - pid_calc(&cpu->pid, cpu_load); | ||
| 968 | } | ||
| 969 | |||
| 970 | static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu) | ||
| 926 | { | 971 | { |
| 927 | int32_t core_busy, max_pstate, current_pstate, sample_ratio; | 972 | int32_t core_busy, max_pstate, current_pstate, sample_ratio; |
| 928 | s64 duration_us; | 973 | s64 duration_us; |
| @@ -960,30 +1005,24 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | |||
| 960 | core_busy = mul_fp(core_busy, sample_ratio); | 1005 | core_busy = mul_fp(core_busy, sample_ratio); |
| 961 | } | 1006 | } |
| 962 | 1007 | ||
| 963 | return core_busy; | 1008 | cpu->sample.busy_scaled = core_busy; |
| 1009 | return cpu->pstate.current_pstate - pid_calc(&cpu->pid, core_busy); | ||
| 964 | } | 1010 | } |
| 965 | 1011 | ||
| 966 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) | 1012 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) |
| 967 | { | 1013 | { |
| 968 | int32_t busy_scaled; | 1014 | int from, target_pstate; |
| 969 | struct _pid *pid; | ||
| 970 | signed int ctl; | ||
| 971 | int from; | ||
| 972 | struct sample *sample; | 1015 | struct sample *sample; |
| 973 | 1016 | ||
| 974 | from = cpu->pstate.current_pstate; | 1017 | from = cpu->pstate.current_pstate; |
| 975 | 1018 | ||
| 976 | pid = &cpu->pid; | 1019 | target_pstate = pstate_funcs.get_target_pstate(cpu); |
| 977 | busy_scaled = intel_pstate_get_scaled_busy(cpu); | ||
| 978 | 1020 | ||
| 979 | ctl = pid_calc(pid, busy_scaled); | 1021 | intel_pstate_set_pstate(cpu, target_pstate, true); |
| 980 | |||
| 981 | /* Negative values of ctl increase the pstate and vice versa */ | ||
| 982 | intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl, true); | ||
| 983 | 1022 | ||
| 984 | sample = &cpu->sample; | 1023 | sample = &cpu->sample; |
| 985 | trace_pstate_sample(fp_toint(sample->core_pct_busy), | 1024 | trace_pstate_sample(fp_toint(sample->core_pct_busy), |
| 986 | fp_toint(busy_scaled), | 1025 | fp_toint(sample->busy_scaled), |
| 987 | from, | 1026 | from, |
| 988 | cpu->pstate.current_pstate, | 1027 | cpu->pstate.current_pstate, |
| 989 | sample->mperf, | 1028 | sample->mperf, |
| @@ -1237,6 +1276,8 @@ static void copy_cpu_funcs(struct pstate_funcs *funcs) | |||
| 1237 | pstate_funcs.get_scaling = funcs->get_scaling; | 1276 | pstate_funcs.get_scaling = funcs->get_scaling; |
| 1238 | pstate_funcs.set = funcs->set; | 1277 | pstate_funcs.set = funcs->set; |
| 1239 | pstate_funcs.get_vid = funcs->get_vid; | 1278 | pstate_funcs.get_vid = funcs->get_vid; |
| 1279 | pstate_funcs.get_target_pstate = funcs->get_target_pstate; | ||
| 1280 | |||
| 1240 | } | 1281 | } |
| 1241 | 1282 | ||
| 1242 | #if IS_ENABLED(CONFIG_ACPI) | 1283 | #if IS_ENABLED(CONFIG_ACPI) |
diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c index 83001dc5b646..1efba340456d 100644 --- a/drivers/cpufreq/mt8173-cpufreq.c +++ b/drivers/cpufreq/mt8173-cpufreq.c | |||
| @@ -41,16 +41,35 @@ | |||
| 41 | * the original PLL becomes stable at target frequency. | 41 | * the original PLL becomes stable at target frequency. |
| 42 | */ | 42 | */ |
| 43 | struct mtk_cpu_dvfs_info { | 43 | struct mtk_cpu_dvfs_info { |
| 44 | struct cpumask cpus; | ||
| 44 | struct device *cpu_dev; | 45 | struct device *cpu_dev; |
| 45 | struct regulator *proc_reg; | 46 | struct regulator *proc_reg; |
| 46 | struct regulator *sram_reg; | 47 | struct regulator *sram_reg; |
| 47 | struct clk *cpu_clk; | 48 | struct clk *cpu_clk; |
| 48 | struct clk *inter_clk; | 49 | struct clk *inter_clk; |
| 49 | struct thermal_cooling_device *cdev; | 50 | struct thermal_cooling_device *cdev; |
| 51 | struct list_head list_head; | ||
| 50 | int intermediate_voltage; | 52 | int intermediate_voltage; |
| 51 | bool need_voltage_tracking; | 53 | bool need_voltage_tracking; |
| 52 | }; | 54 | }; |
| 53 | 55 | ||
| 56 | static LIST_HEAD(dvfs_info_list); | ||
| 57 | |||
| 58 | static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu) | ||
| 59 | { | ||
| 60 | struct mtk_cpu_dvfs_info *info; | ||
| 61 | struct list_head *list; | ||
| 62 | |||
| 63 | list_for_each(list, &dvfs_info_list) { | ||
| 64 | info = list_entry(list, struct mtk_cpu_dvfs_info, list_head); | ||
| 65 | |||
| 66 | if (cpumask_test_cpu(cpu, &info->cpus)) | ||
| 67 | return info; | ||
| 68 | } | ||
| 69 | |||
| 70 | return NULL; | ||
| 71 | } | ||
| 72 | |||
| 54 | static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info, | 73 | static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info, |
| 55 | int new_vproc) | 74 | int new_vproc) |
| 56 | { | 75 | { |
| @@ -59,7 +78,10 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info, | |||
| 59 | int old_vproc, old_vsram, new_vsram, vsram, vproc, ret; | 78 | int old_vproc, old_vsram, new_vsram, vsram, vproc, ret; |
| 60 | 79 | ||
| 61 | old_vproc = regulator_get_voltage(proc_reg); | 80 | old_vproc = regulator_get_voltage(proc_reg); |
| 62 | old_vsram = regulator_get_voltage(sram_reg); | 81 | if (old_vproc < 0) { |
| 82 | pr_err("%s: invalid Vproc value: %d\n", __func__, old_vproc); | ||
| 83 | return old_vproc; | ||
| 84 | } | ||
| 63 | /* Vsram should not exceed the maximum allowed voltage of SoC. */ | 85 | /* Vsram should not exceed the maximum allowed voltage of SoC. */ |
| 64 | new_vsram = min(new_vproc + MIN_VOLT_SHIFT, MAX_VOLT_LIMIT); | 86 | new_vsram = min(new_vproc + MIN_VOLT_SHIFT, MAX_VOLT_LIMIT); |
| 65 | 87 | ||
| @@ -72,7 +94,17 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info, | |||
| 72 | */ | 94 | */ |
| 73 | do { | 95 | do { |
| 74 | old_vsram = regulator_get_voltage(sram_reg); | 96 | old_vsram = regulator_get_voltage(sram_reg); |
| 97 | if (old_vsram < 0) { | ||
| 98 | pr_err("%s: invalid Vsram value: %d\n", | ||
| 99 | __func__, old_vsram); | ||
| 100 | return old_vsram; | ||
| 101 | } | ||
| 75 | old_vproc = regulator_get_voltage(proc_reg); | 102 | old_vproc = regulator_get_voltage(proc_reg); |
| 103 | if (old_vproc < 0) { | ||
| 104 | pr_err("%s: invalid Vproc value: %d\n", | ||
| 105 | __func__, old_vproc); | ||
| 106 | return old_vproc; | ||
| 107 | } | ||
| 76 | 108 | ||
| 77 | vsram = min(new_vsram, old_vproc + MAX_VOLT_SHIFT); | 109 | vsram = min(new_vsram, old_vproc + MAX_VOLT_SHIFT); |
| 78 | 110 | ||
| @@ -117,7 +149,17 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info, | |||
| 117 | */ | 149 | */ |
| 118 | do { | 150 | do { |
| 119 | old_vproc = regulator_get_voltage(proc_reg); | 151 | old_vproc = regulator_get_voltage(proc_reg); |
| 152 | if (old_vproc < 0) { | ||
| 153 | pr_err("%s: invalid Vproc value: %d\n", | ||
| 154 | __func__, old_vproc); | ||
| 155 | return old_vproc; | ||
| 156 | } | ||
| 120 | old_vsram = regulator_get_voltage(sram_reg); | 157 | old_vsram = regulator_get_voltage(sram_reg); |
| 158 | if (old_vsram < 0) { | ||
| 159 | pr_err("%s: invalid Vsram value: %d\n", | ||
| 160 | __func__, old_vsram); | ||
| 161 | return old_vsram; | ||
| 162 | } | ||
| 121 | 163 | ||
| 122 | vproc = max(new_vproc, old_vsram - MAX_VOLT_SHIFT); | 164 | vproc = max(new_vproc, old_vsram - MAX_VOLT_SHIFT); |
| 123 | ret = regulator_set_voltage(proc_reg, vproc, | 165 | ret = regulator_set_voltage(proc_reg, vproc, |
| @@ -185,6 +227,10 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy, | |||
| 185 | 227 | ||
| 186 | old_freq_hz = clk_get_rate(cpu_clk); | 228 | old_freq_hz = clk_get_rate(cpu_clk); |
| 187 | old_vproc = regulator_get_voltage(info->proc_reg); | 229 | old_vproc = regulator_get_voltage(info->proc_reg); |
| 230 | if (old_vproc < 0) { | ||
| 231 | pr_err("%s: invalid Vproc value: %d\n", __func__, old_vproc); | ||
| 232 | return old_vproc; | ||
| 233 | } | ||
| 188 | 234 | ||
| 189 | freq_hz = freq_table[index].frequency * 1000; | 235 | freq_hz = freq_table[index].frequency * 1000; |
| 190 | 236 | ||
| @@ -344,7 +390,15 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) | |||
| 344 | /* Both presence and absence of sram regulator are valid cases. */ | 390 | /* Both presence and absence of sram regulator are valid cases. */ |
| 345 | sram_reg = regulator_get_exclusive(cpu_dev, "sram"); | 391 | sram_reg = regulator_get_exclusive(cpu_dev, "sram"); |
| 346 | 392 | ||
| 347 | ret = dev_pm_opp_of_add_table(cpu_dev); | 393 | /* Get OPP-sharing information from "operating-points-v2" bindings */ |
| 394 | ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, &info->cpus); | ||
| 395 | if (ret) { | ||
| 396 | pr_err("failed to get OPP-sharing information for cpu%d\n", | ||
| 397 | cpu); | ||
| 398 | goto out_free_resources; | ||
| 399 | } | ||
| 400 | |||
| 401 | ret = dev_pm_opp_of_cpumask_add_table(&info->cpus); | ||
| 348 | if (ret) { | 402 | if (ret) { |
| 349 | pr_warn("no OPP table for cpu%d\n", cpu); | 403 | pr_warn("no OPP table for cpu%d\n", cpu); |
| 350 | goto out_free_resources; | 404 | goto out_free_resources; |
| @@ -378,7 +432,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) | |||
| 378 | return 0; | 432 | return 0; |
| 379 | 433 | ||
| 380 | out_free_opp_table: | 434 | out_free_opp_table: |
| 381 | dev_pm_opp_of_remove_table(cpu_dev); | 435 | dev_pm_opp_of_cpumask_remove_table(&info->cpus); |
| 382 | 436 | ||
| 383 | out_free_resources: | 437 | out_free_resources: |
| 384 | if (!IS_ERR(proc_reg)) | 438 | if (!IS_ERR(proc_reg)) |
| @@ -404,7 +458,7 @@ static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info) | |||
| 404 | if (!IS_ERR(info->inter_clk)) | 458 | if (!IS_ERR(info->inter_clk)) |
| 405 | clk_put(info->inter_clk); | 459 | clk_put(info->inter_clk); |
| 406 | 460 | ||
| 407 | dev_pm_opp_of_remove_table(info->cpu_dev); | 461 | dev_pm_opp_of_cpumask_remove_table(&info->cpus); |
| 408 | } | 462 | } |
| 409 | 463 | ||
| 410 | static int mtk_cpufreq_init(struct cpufreq_policy *policy) | 464 | static int mtk_cpufreq_init(struct cpufreq_policy *policy) |
| @@ -413,22 +467,18 @@ static int mtk_cpufreq_init(struct cpufreq_policy *policy) | |||
| 413 | struct cpufreq_frequency_table *freq_table; | 467 | struct cpufreq_frequency_table *freq_table; |
| 414 | int ret; | 468 | int ret; |
| 415 | 469 | ||
| 416 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 470 | info = mtk_cpu_dvfs_info_lookup(policy->cpu); |
| 417 | if (!info) | 471 | if (!info) { |
| 418 | return -ENOMEM; | 472 | pr_err("dvfs info for cpu%d is not initialized.\n", |
| 419 | 473 | policy->cpu); | |
| 420 | ret = mtk_cpu_dvfs_info_init(info, policy->cpu); | 474 | return -EINVAL; |
| 421 | if (ret) { | ||
| 422 | pr_err("%s failed to initialize dvfs info for cpu%d\n", | ||
| 423 | __func__, policy->cpu); | ||
| 424 | goto out_free_dvfs_info; | ||
| 425 | } | 475 | } |
| 426 | 476 | ||
| 427 | ret = dev_pm_opp_init_cpufreq_table(info->cpu_dev, &freq_table); | 477 | ret = dev_pm_opp_init_cpufreq_table(info->cpu_dev, &freq_table); |
| 428 | if (ret) { | 478 | if (ret) { |
| 429 | pr_err("failed to init cpufreq table for cpu%d: %d\n", | 479 | pr_err("failed to init cpufreq table for cpu%d: %d\n", |
| 430 | policy->cpu, ret); | 480 | policy->cpu, ret); |
| 431 | goto out_release_dvfs_info; | 481 | return ret; |
| 432 | } | 482 | } |
| 433 | 483 | ||
| 434 | ret = cpufreq_table_validate_and_show(policy, freq_table); | 484 | ret = cpufreq_table_validate_and_show(policy, freq_table); |
| @@ -437,8 +487,7 @@ static int mtk_cpufreq_init(struct cpufreq_policy *policy) | |||
| 437 | goto out_free_cpufreq_table; | 487 | goto out_free_cpufreq_table; |
| 438 | } | 488 | } |
| 439 | 489 | ||
| 440 | /* CPUs in the same cluster share a clock and power domain. */ | 490 | cpumask_copy(policy->cpus, &info->cpus); |
| 441 | cpumask_copy(policy->cpus, &cpu_topology[policy->cpu].core_sibling); | ||
| 442 | policy->driver_data = info; | 491 | policy->driver_data = info; |
| 443 | policy->clk = info->cpu_clk; | 492 | policy->clk = info->cpu_clk; |
| 444 | 493 | ||
| @@ -446,13 +495,6 @@ static int mtk_cpufreq_init(struct cpufreq_policy *policy) | |||
| 446 | 495 | ||
| 447 | out_free_cpufreq_table: | 496 | out_free_cpufreq_table: |
| 448 | dev_pm_opp_free_cpufreq_table(info->cpu_dev, &freq_table); | 497 | dev_pm_opp_free_cpufreq_table(info->cpu_dev, &freq_table); |
| 449 | |||
| 450 | out_release_dvfs_info: | ||
| 451 | mtk_cpu_dvfs_info_release(info); | ||
| 452 | |||
| 453 | out_free_dvfs_info: | ||
| 454 | kfree(info); | ||
| 455 | |||
| 456 | return ret; | 498 | return ret; |
| 457 | } | 499 | } |
| 458 | 500 | ||
| @@ -462,14 +504,13 @@ static int mtk_cpufreq_exit(struct cpufreq_policy *policy) | |||
| 462 | 504 | ||
| 463 | cpufreq_cooling_unregister(info->cdev); | 505 | cpufreq_cooling_unregister(info->cdev); |
| 464 | dev_pm_opp_free_cpufreq_table(info->cpu_dev, &policy->freq_table); | 506 | dev_pm_opp_free_cpufreq_table(info->cpu_dev, &policy->freq_table); |
| 465 | mtk_cpu_dvfs_info_release(info); | ||
| 466 | kfree(info); | ||
| 467 | 507 | ||
| 468 | return 0; | 508 | return 0; |
| 469 | } | 509 | } |
| 470 | 510 | ||
| 471 | static struct cpufreq_driver mt8173_cpufreq_driver = { | 511 | static struct cpufreq_driver mt8173_cpufreq_driver = { |
| 472 | .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, | 512 | .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | |
| 513 | CPUFREQ_HAVE_GOVERNOR_PER_POLICY, | ||
| 473 | .verify = cpufreq_generic_frequency_table_verify, | 514 | .verify = cpufreq_generic_frequency_table_verify, |
| 474 | .target_index = mtk_cpufreq_set_target, | 515 | .target_index = mtk_cpufreq_set_target, |
| 475 | .get = cpufreq_generic_get, | 516 | .get = cpufreq_generic_get, |
| @@ -482,11 +523,47 @@ static struct cpufreq_driver mt8173_cpufreq_driver = { | |||
| 482 | 523 | ||
| 483 | static int mt8173_cpufreq_probe(struct platform_device *pdev) | 524 | static int mt8173_cpufreq_probe(struct platform_device *pdev) |
| 484 | { | 525 | { |
| 485 | int ret; | 526 | struct mtk_cpu_dvfs_info *info; |
| 527 | struct list_head *list, *tmp; | ||
| 528 | int cpu, ret; | ||
| 529 | |||
| 530 | for_each_possible_cpu(cpu) { | ||
| 531 | info = mtk_cpu_dvfs_info_lookup(cpu); | ||
| 532 | if (info) | ||
| 533 | continue; | ||
| 534 | |||
| 535 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); | ||
| 536 | if (!info) { | ||
| 537 | ret = -ENOMEM; | ||
| 538 | goto release_dvfs_info_list; | ||
| 539 | } | ||
| 540 | |||
| 541 | ret = mtk_cpu_dvfs_info_init(info, cpu); | ||
| 542 | if (ret) { | ||
| 543 | dev_err(&pdev->dev, | ||
| 544 | "failed to initialize dvfs info for cpu%d\n", | ||
| 545 | cpu); | ||
| 546 | goto release_dvfs_info_list; | ||
| 547 | } | ||
| 548 | |||
| 549 | list_add(&info->list_head, &dvfs_info_list); | ||
| 550 | } | ||
| 486 | 551 | ||
| 487 | ret = cpufreq_register_driver(&mt8173_cpufreq_driver); | 552 | ret = cpufreq_register_driver(&mt8173_cpufreq_driver); |
| 488 | if (ret) | 553 | if (ret) { |
| 489 | pr_err("failed to register mtk cpufreq driver\n"); | 554 | dev_err(&pdev->dev, "failed to register mtk cpufreq driver\n"); |
| 555 | goto release_dvfs_info_list; | ||
| 556 | } | ||
| 557 | |||
| 558 | return 0; | ||
| 559 | |||
| 560 | release_dvfs_info_list: | ||
| 561 | list_for_each_safe(list, tmp, &dvfs_info_list) { | ||
| 562 | info = list_entry(list, struct mtk_cpu_dvfs_info, list_head); | ||
| 563 | |||
| 564 | mtk_cpu_dvfs_info_release(info); | ||
| 565 | list_del(list); | ||
| 566 | } | ||
| 490 | 567 | ||
| 491 | return ret; | 568 | return ret; |
| 492 | } | 569 | } |
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index 2a0d58959acf..808a320e9d5d 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c | |||
| @@ -555,6 +555,8 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 555 | policy->min = policy->cpuinfo.min_freq = | 555 | policy->min = policy->cpuinfo.min_freq = |
| 556 | ioread32(&pcch_hdr->minimum_frequency) * 1000; | 556 | ioread32(&pcch_hdr->minimum_frequency) * 1000; |
| 557 | 557 | ||
| 558 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | ||
| 559 | |||
| 558 | pr_debug("init: policy->max is %d, policy->min is %d\n", | 560 | pr_debug("init: policy->max is %d, policy->min is %d\n", |
| 559 | policy->max, policy->min); | 561 | policy->max, policy->min); |
| 560 | out: | 562 | out: |
diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index 358f0752c31e..b23e525a7af3 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
| 14 | #include <linux/cpufreq.h> | 14 | #include <linux/cpufreq.h> |
| 15 | #include <linux/cpu_cooling.h> | ||
| 15 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| @@ -33,6 +34,7 @@ | |||
| 33 | struct cpu_data { | 34 | struct cpu_data { |
| 34 | struct clk **pclk; | 35 | struct clk **pclk; |
| 35 | struct cpufreq_frequency_table *table; | 36 | struct cpufreq_frequency_table *table; |
| 37 | struct thermal_cooling_device *cdev; | ||
| 36 | }; | 38 | }; |
| 37 | 39 | ||
| 38 | /** | 40 | /** |
| @@ -321,6 +323,27 @@ static int qoriq_cpufreq_target(struct cpufreq_policy *policy, | |||
| 321 | return clk_set_parent(policy->clk, parent); | 323 | return clk_set_parent(policy->clk, parent); |
| 322 | } | 324 | } |
| 323 | 325 | ||
| 326 | |||
| 327 | static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) | ||
| 328 | { | ||
| 329 | struct cpu_data *cpud = policy->driver_data; | ||
| 330 | struct device_node *np = of_get_cpu_node(policy->cpu, NULL); | ||
| 331 | |||
| 332 | if (of_find_property(np, "#cooling-cells", NULL)) { | ||
| 333 | cpud->cdev = of_cpufreq_cooling_register(np, | ||
| 334 | policy->related_cpus); | ||
| 335 | |||
| 336 | if (IS_ERR(cpud->cdev)) { | ||
| 337 | pr_err("Failed to register cooling device cpu%d: %ld\n", | ||
| 338 | policy->cpu, PTR_ERR(cpud->cdev)); | ||
| 339 | |||
| 340 | cpud->cdev = NULL; | ||
| 341 | } | ||
| 342 | } | ||
| 343 | |||
| 344 | of_node_put(np); | ||
| 345 | } | ||
| 346 | |||
| 324 | static struct cpufreq_driver qoriq_cpufreq_driver = { | 347 | static struct cpufreq_driver qoriq_cpufreq_driver = { |
| 325 | .name = "qoriq_cpufreq", | 348 | .name = "qoriq_cpufreq", |
| 326 | .flags = CPUFREQ_CONST_LOOPS, | 349 | .flags = CPUFREQ_CONST_LOOPS, |
| @@ -329,6 +352,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver = { | |||
| 329 | .verify = cpufreq_generic_frequency_table_verify, | 352 | .verify = cpufreq_generic_frequency_table_verify, |
| 330 | .target_index = qoriq_cpufreq_target, | 353 | .target_index = qoriq_cpufreq_target, |
| 331 | .get = cpufreq_generic_get, | 354 | .get = cpufreq_generic_get, |
| 355 | .ready = qoriq_cpufreq_ready, | ||
| 332 | .attr = cpufreq_generic_attr, | 356 | .attr = cpufreq_generic_attr, |
| 333 | }; | 357 | }; |
| 334 | 358 | ||
diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c new file mode 100644 index 000000000000..a9c659f58974 --- /dev/null +++ b/drivers/cpufreq/sti-cpufreq.c | |||
| @@ -0,0 +1,294 @@ | |||
| 1 | /* | ||
| 2 | * Match running platform with pre-defined OPP values for CPUFreq | ||
| 3 | * | ||
| 4 | * Author: Ajit Pal Singh <ajitpal.singh@st.com> | ||
| 5 | * Lee Jones <lee.jones@linaro.org> | ||
| 6 | * | ||
| 7 | * Copyright (C) 2015 STMicroelectronics (R&D) Limited | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the version 2 of the GNU General Public License as | ||
| 11 | * published by the Free Software Foundation | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/cpu.h> | ||
| 15 | #include <linux/io.h> | ||
| 16 | #include <linux/mfd/syscon.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/of.h> | ||
| 19 | #include <linux/of_platform.h> | ||
| 20 | #include <linux/pm_opp.h> | ||
| 21 | #include <linux/regmap.h> | ||
| 22 | |||
| 23 | #define VERSION_ELEMENTS 3 | ||
| 24 | #define MAX_PCODE_NAME_LEN 7 | ||
| 25 | |||
| 26 | #define VERSION_SHIFT 28 | ||
| 27 | #define HW_INFO_INDEX 1 | ||
| 28 | #define MAJOR_ID_INDEX 1 | ||
| 29 | #define MINOR_ID_INDEX 2 | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Only match on "suitable for ALL versions" entries | ||
| 33 | * | ||
| 34 | * This will be used with the BIT() macro. It sets the | ||
| 35 | * top bit of a 32bit value and is equal to 0x80000000. | ||
| 36 | */ | ||
| 37 | #define DEFAULT_VERSION 31 | ||
| 38 | |||
| 39 | enum { | ||
| 40 | PCODE = 0, | ||
| 41 | SUBSTRATE, | ||
| 42 | DVFS_MAX_REGFIELDS, | ||
| 43 | }; | ||
| 44 | |||
| 45 | /** | ||
| 46 | * ST CPUFreq Driver Data | ||
| 47 | * | ||
| 48 | * @cpu_node CPU's OF node | ||
| 49 | * @syscfg_eng Engineering Syscon register map | ||
| 50 | * @regmap Syscon register map | ||
| 51 | */ | ||
| 52 | static struct sti_cpufreq_ddata { | ||
| 53 | struct device *cpu; | ||
| 54 | struct regmap *syscfg_eng; | ||
| 55 | struct regmap *syscfg; | ||
| 56 | } ddata; | ||
| 57 | |||
| 58 | static int sti_cpufreq_fetch_major(void) { | ||
| 59 | struct device_node *np = ddata.cpu->of_node; | ||
| 60 | struct device *dev = ddata.cpu; | ||
| 61 | unsigned int major_offset; | ||
| 62 | unsigned int socid; | ||
| 63 | int ret; | ||
| 64 | |||
| 65 | ret = of_property_read_u32_index(np, "st,syscfg", | ||
| 66 | MAJOR_ID_INDEX, &major_offset); | ||
| 67 | if (ret) { | ||
| 68 | dev_err(dev, "No major number offset provided in %s [%d]\n", | ||
| 69 | np->full_name, ret); | ||
| 70 | return ret; | ||
| 71 | } | ||
| 72 | |||
| 73 | ret = regmap_read(ddata.syscfg, major_offset, &socid); | ||
| 74 | if (ret) { | ||
| 75 | dev_err(dev, "Failed to read major number from syscon [%d]\n", | ||
| 76 | ret); | ||
| 77 | return ret; | ||
| 78 | } | ||
| 79 | |||
| 80 | return ((socid >> VERSION_SHIFT) & 0xf) + 1; | ||
| 81 | } | ||
| 82 | |||
| 83 | static int sti_cpufreq_fetch_minor(void) | ||
| 84 | { | ||
| 85 | struct device *dev = ddata.cpu; | ||
| 86 | struct device_node *np = dev->of_node; | ||
| 87 | unsigned int minor_offset; | ||
| 88 | unsigned int minid; | ||
| 89 | int ret; | ||
| 90 | |||
| 91 | ret = of_property_read_u32_index(np, "st,syscfg-eng", | ||
| 92 | MINOR_ID_INDEX, &minor_offset); | ||
| 93 | if (ret) { | ||
| 94 | dev_err(dev, | ||
| 95 | "No minor number offset provided %s [%d]\n", | ||
| 96 | np->full_name, ret); | ||
| 97 | return ret; | ||
| 98 | } | ||
| 99 | |||
| 100 | ret = regmap_read(ddata.syscfg_eng, minor_offset, &minid); | ||
| 101 | if (ret) { | ||
| 102 | dev_err(dev, | ||
| 103 | "Failed to read the minor number from syscon [%d]\n", | ||
| 104 | ret); | ||
| 105 | return ret; | ||
| 106 | } | ||
| 107 | |||
| 108 | return minid & 0xf; | ||
| 109 | } | ||
| 110 | |||
| 111 | static int sti_cpufreq_fetch_regmap_field(const struct reg_field *reg_fields, | ||
| 112 | int hw_info_offset, int field) | ||
| 113 | { | ||
| 114 | struct regmap_field *regmap_field; | ||
| 115 | struct reg_field reg_field = reg_fields[field]; | ||
| 116 | struct device *dev = ddata.cpu; | ||
| 117 | unsigned int value; | ||
| 118 | int ret; | ||
| 119 | |||
| 120 | reg_field.reg = hw_info_offset; | ||
| 121 | regmap_field = devm_regmap_field_alloc(dev, | ||
| 122 | ddata.syscfg_eng, | ||
| 123 | reg_field); | ||
| 124 | if (IS_ERR(regmap_field)) { | ||
| 125 | dev_err(dev, "Failed to allocate reg field\n"); | ||
| 126 | return PTR_ERR(regmap_field); | ||
| 127 | } | ||
| 128 | |||
| 129 | ret = regmap_field_read(regmap_field, &value); | ||
| 130 | if (ret) { | ||
| 131 | dev_err(dev, "Failed to read %s code\n", | ||
| 132 | field ? "SUBSTRATE" : "PCODE"); | ||
| 133 | return ret; | ||
| 134 | } | ||
| 135 | |||
| 136 | return value; | ||
| 137 | } | ||
| 138 | |||
| 139 | static const struct reg_field sti_stih407_dvfs_regfields[DVFS_MAX_REGFIELDS] = { | ||
| 140 | [PCODE] = REG_FIELD(0, 16, 19), | ||
| 141 | [SUBSTRATE] = REG_FIELD(0, 0, 2), | ||
| 142 | }; | ||
| 143 | |||
| 144 | static const struct reg_field *sti_cpufreq_match(void) | ||
| 145 | { | ||
| 146 | if (of_machine_is_compatible("st,stih407") || | ||
| 147 | of_machine_is_compatible("st,stih410")) | ||
| 148 | return sti_stih407_dvfs_regfields; | ||
| 149 | |||
| 150 | return NULL; | ||
| 151 | } | ||
| 152 | |||
| 153 | static int sti_cpufreq_set_opp_info(void) | ||
| 154 | { | ||
| 155 | struct device *dev = ddata.cpu; | ||
| 156 | struct device_node *np = dev->of_node; | ||
| 157 | const struct reg_field *reg_fields; | ||
| 158 | unsigned int hw_info_offset; | ||
| 159 | unsigned int version[VERSION_ELEMENTS]; | ||
| 160 | int pcode, substrate, major, minor; | ||
| 161 | int ret; | ||
| 162 | char name[MAX_PCODE_NAME_LEN]; | ||
| 163 | |||
| 164 | reg_fields = sti_cpufreq_match(); | ||
| 165 | if (!reg_fields) { | ||
| 166 | dev_err(dev, "This SoC doesn't support voltage scaling"); | ||
| 167 | return -ENODEV; | ||
| 168 | } | ||
| 169 | |||
| 170 | ret = of_property_read_u32_index(np, "st,syscfg-eng", | ||
| 171 | HW_INFO_INDEX, &hw_info_offset); | ||
| 172 | if (ret) { | ||
| 173 | dev_warn(dev, "Failed to read HW info offset from DT\n"); | ||
| 174 | substrate = DEFAULT_VERSION; | ||
| 175 | pcode = 0; | ||
| 176 | goto use_defaults; | ||
| 177 | } | ||
| 178 | |||
| 179 | pcode = sti_cpufreq_fetch_regmap_field(reg_fields, | ||
| 180 | hw_info_offset, | ||
| 181 | PCODE); | ||
| 182 | if (pcode < 0) { | ||
| 183 | dev_warn(dev, "Failed to obtain process code\n"); | ||
| 184 | /* Use default pcode */ | ||
| 185 | pcode = 0; | ||
| 186 | } | ||
| 187 | |||
| 188 | substrate = sti_cpufreq_fetch_regmap_field(reg_fields, | ||
| 189 | hw_info_offset, | ||
| 190 | SUBSTRATE); | ||
| 191 | if (substrate) { | ||
| 192 | dev_warn(dev, "Failed to obtain substrate code\n"); | ||
| 193 | /* Use default substrate */ | ||
| 194 | substrate = DEFAULT_VERSION; | ||
| 195 | } | ||
| 196 | |||
| 197 | use_defaults: | ||
| 198 | major = sti_cpufreq_fetch_major(); | ||
| 199 | if (major < 0) { | ||
| 200 | dev_err(dev, "Failed to obtain major version\n"); | ||
| 201 | /* Use default major number */ | ||
| 202 | major = DEFAULT_VERSION; | ||
| 203 | } | ||
| 204 | |||
| 205 | minor = sti_cpufreq_fetch_minor(); | ||
| 206 | if (minor < 0) { | ||
| 207 | dev_err(dev, "Failed to obtain minor version\n"); | ||
| 208 | /* Use default minor number */ | ||
| 209 | minor = DEFAULT_VERSION; | ||
| 210 | } | ||
| 211 | |||
| 212 | snprintf(name, MAX_PCODE_NAME_LEN, "pcode%d", pcode); | ||
| 213 | |||
| 214 | ret = dev_pm_opp_set_prop_name(dev, name); | ||
| 215 | if (ret) { | ||
| 216 | dev_err(dev, "Failed to set prop name\n"); | ||
| 217 | return ret; | ||
| 218 | } | ||
| 219 | |||
| 220 | version[0] = BIT(major); | ||
| 221 | version[1] = BIT(minor); | ||
| 222 | version[2] = BIT(substrate); | ||
| 223 | |||
| 224 | ret = dev_pm_opp_set_supported_hw(dev, version, VERSION_ELEMENTS); | ||
| 225 | if (ret) { | ||
| 226 | dev_err(dev, "Failed to set supported hardware\n"); | ||
| 227 | return ret; | ||
| 228 | } | ||
| 229 | |||
| 230 | dev_dbg(dev, "pcode: %d major: %d minor: %d substrate: %d\n", | ||
| 231 | pcode, major, minor, substrate); | ||
| 232 | dev_dbg(dev, "version[0]: %x version[1]: %x version[2]: %x\n", | ||
| 233 | version[0], version[1], version[2]); | ||
| 234 | |||
| 235 | return 0; | ||
| 236 | } | ||
| 237 | |||
| 238 | static int sti_cpufreq_fetch_syscon_regsiters(void) | ||
| 239 | { | ||
| 240 | struct device *dev = ddata.cpu; | ||
| 241 | struct device_node *np = dev->of_node; | ||
| 242 | |||
| 243 | ddata.syscfg = syscon_regmap_lookup_by_phandle(np, "st,syscfg"); | ||
| 244 | if (IS_ERR(ddata.syscfg)) { | ||
| 245 | dev_err(dev, "\"st,syscfg\" not supplied\n"); | ||
| 246 | return PTR_ERR(ddata.syscfg); | ||
| 247 | } | ||
| 248 | |||
| 249 | ddata.syscfg_eng = syscon_regmap_lookup_by_phandle(np, "st,syscfg-eng"); | ||
| 250 | if (IS_ERR(ddata.syscfg_eng)) { | ||
| 251 | dev_err(dev, "\"st,syscfg-eng\" not supplied\n"); | ||
| 252 | return PTR_ERR(ddata.syscfg_eng); | ||
| 253 | } | ||
| 254 | |||
| 255 | return 0; | ||
| 256 | } | ||
| 257 | |||
| 258 | static int sti_cpufreq_init(void) | ||
| 259 | { | ||
| 260 | int ret; | ||
| 261 | |||
| 262 | ddata.cpu = get_cpu_device(0); | ||
| 263 | if (!ddata.cpu) { | ||
| 264 | dev_err(ddata.cpu, "Failed to get device for CPU0\n"); | ||
| 265 | goto skip_voltage_scaling; | ||
| 266 | } | ||
| 267 | |||
| 268 | if (!of_get_property(ddata.cpu->of_node, "operating-points-v2", NULL)) { | ||
| 269 | dev_err(ddata.cpu, "OPP-v2 not supported\n"); | ||
| 270 | goto skip_voltage_scaling; | ||
| 271 | } | ||
| 272 | |||
| 273 | ret = sti_cpufreq_fetch_syscon_regsiters(); | ||
| 274 | if (ret) | ||
| 275 | goto skip_voltage_scaling; | ||
| 276 | |||
| 277 | ret = sti_cpufreq_set_opp_info(); | ||
| 278 | if (!ret) | ||
| 279 | goto register_cpufreq_dt; | ||
| 280 | |||
| 281 | skip_voltage_scaling: | ||
| 282 | dev_err(ddata.cpu, "Not doing voltage scaling\n"); | ||
| 283 | |||
| 284 | register_cpufreq_dt: | ||
| 285 | platform_device_register_simple("cpufreq-dt", -1, NULL, 0); | ||
| 286 | |||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | module_init(sti_cpufreq_init); | ||
| 290 | |||
| 291 | MODULE_DESCRIPTION("STMicroelectronics CPUFreq/OPP driver"); | ||
| 292 | MODULE_AUTHOR("Ajitpal Singh <ajitpal.singh@st.com>"); | ||
| 293 | MODULE_AUTHOR("Lee Jones <lee.jones@linaro.org>"); | ||
| 294 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/cpuidle/cpuidle-clps711x.c b/drivers/cpuidle/cpuidle-clps711x.c index 18a7f7380508..66a9f231ec41 100644 --- a/drivers/cpuidle/cpuidle-clps711x.c +++ b/drivers/cpuidle/cpuidle-clps711x.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <linux/cpuidle.h> | 12 | #include <linux/cpuidle.h> |
| 13 | #include <linux/err.h> | 13 | #include <linux/err.h> |
| 14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
| 15 | #include <linux/module.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 17 | 17 | ||
| 18 | #define CLPS711X_CPUIDLE_NAME "clps711x-cpuidle" | 18 | #define CLPS711X_CPUIDLE_NAME "clps711x-cpuidle" |
| @@ -56,8 +56,4 @@ static struct platform_driver clps711x_cpuidle_driver = { | |||
| 56 | .name = CLPS711X_CPUIDLE_NAME, | 56 | .name = CLPS711X_CPUIDLE_NAME, |
| 57 | }, | 57 | }, |
| 58 | }; | 58 | }; |
| 59 | module_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe); | 59 | builtin_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe); |
| 60 | |||
| 61 | MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>"); | ||
| 62 | MODULE_DESCRIPTION("CLPS711X CPU idle driver"); | ||
| 63 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/cpuidle/cpuidle-exynos.c b/drivers/cpuidle/cpuidle-exynos.c index b5f0a9cc8185..00cd129b10a4 100644 --- a/drivers/cpuidle/cpuidle-exynos.c +++ b/drivers/cpuidle/cpuidle-exynos.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <linux/cpuidle.h> | 14 | #include <linux/cpuidle.h> |
| 15 | #include <linux/cpu_pm.h> | 15 | #include <linux/cpu_pm.h> |
| 16 | #include <linux/export.h> | 16 | #include <linux/export.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/init.h> |
| 18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
| 20 | #include <linux/platform_data/cpuidle-exynos.h> | 20 | #include <linux/platform_data/cpuidle-exynos.h> |
| @@ -142,5 +142,4 @@ static struct platform_driver exynos_cpuidle_driver = { | |||
| 142 | .name = "exynos_cpuidle", | 142 | .name = "exynos_cpuidle", |
| 143 | }, | 143 | }, |
| 144 | }; | 144 | }; |
| 145 | 145 | builtin_platform_driver(exynos_cpuidle_driver); | |
| 146 | module_platform_driver(exynos_cpuidle_driver); | ||
diff --git a/drivers/cpuidle/cpuidle-ux500.c b/drivers/cpuidle/cpuidle-ux500.c index 8bf895c0017d..7941a090bea6 100644 --- a/drivers/cpuidle/cpuidle-ux500.c +++ b/drivers/cpuidle/cpuidle-ux500.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/module.h> | 12 | #include <linux/init.h> |
| 13 | #include <linux/cpuidle.h> | 13 | #include <linux/cpuidle.h> |
| 14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
| 15 | #include <linux/atomic.h> | 15 | #include <linux/atomic.h> |
| @@ -124,5 +124,4 @@ static struct platform_driver dbx500_cpuidle_plat_driver = { | |||
| 124 | }, | 124 | }, |
| 125 | .probe = dbx500_cpuidle_probe, | 125 | .probe = dbx500_cpuidle_probe, |
| 126 | }; | 126 | }; |
| 127 | 127 | builtin_platform_driver(dbx500_cpuidle_plat_driver); | |
| 128 | module_platform_driver(dbx500_cpuidle_plat_driver); | ||
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 22e4463d1787..7b0971d97cc3 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
| @@ -330,7 +330,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 330 | * We want to default to C1 (hlt), not to busy polling | 330 | * We want to default to C1 (hlt), not to busy polling |
| 331 | * unless the timer is happening really really soon. | 331 | * unless the timer is happening really really soon. |
| 332 | */ | 332 | */ |
| 333 | if (data->next_timer_us > 5 && | 333 | if (interactivity_req > 20 && |
| 334 | !drv->states[CPUIDLE_DRIVER_STATE_START].disabled && | 334 | !drv->states[CPUIDLE_DRIVER_STATE_START].disabled && |
| 335 | dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0) | 335 | dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0) |
| 336 | data->last_state_idx = CPUIDLE_DRIVER_STATE_START; | 336 | data->last_state_idx = CPUIDLE_DRIVER_STATE_START; |
| @@ -404,8 +404,10 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 404 | measured_us = cpuidle_get_last_residency(dev); | 404 | measured_us = cpuidle_get_last_residency(dev); |
| 405 | 405 | ||
| 406 | /* Deduct exit latency */ | 406 | /* Deduct exit latency */ |
| 407 | if (measured_us > target->exit_latency) | 407 | if (measured_us > 2 * target->exit_latency) |
| 408 | measured_us -= target->exit_latency; | 408 | measured_us -= target->exit_latency; |
| 409 | else | ||
| 410 | measured_us /= 2; | ||
| 409 | 411 | ||
| 410 | /* Make sure our coefficients do not exceed unity */ | 412 | /* Make sure our coefficients do not exceed unity */ |
| 411 | if (measured_us > data->next_timer_us) | 413 | if (measured_us > data->next_timer_us) |
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 7067b6ddc1db..8b20930ade98 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c | |||
| @@ -622,12 +622,17 @@ static void dw_dma_tasklet(unsigned long data) | |||
| 622 | static irqreturn_t dw_dma_interrupt(int irq, void *dev_id) | 622 | static irqreturn_t dw_dma_interrupt(int irq, void *dev_id) |
| 623 | { | 623 | { |
| 624 | struct dw_dma *dw = dev_id; | 624 | struct dw_dma *dw = dev_id; |
| 625 | u32 status = dma_readl(dw, STATUS_INT); | 625 | u32 status; |
| 626 | 626 | ||
| 627 | /* Check if we have any interrupt from the DMAC which is not in use */ | ||
| 628 | if (!dw->in_use) | ||
| 629 | return IRQ_NONE; | ||
| 630 | |||
| 631 | status = dma_readl(dw, STATUS_INT); | ||
| 627 | dev_vdbg(dw->dma.dev, "%s: status=0x%x\n", __func__, status); | 632 | dev_vdbg(dw->dma.dev, "%s: status=0x%x\n", __func__, status); |
| 628 | 633 | ||
| 629 | /* Check if we have any interrupt from the DMAC */ | 634 | /* Check if we have any interrupt from the DMAC */ |
| 630 | if (!status || !dw->in_use) | 635 | if (!status) |
| 631 | return IRQ_NONE; | 636 | return IRQ_NONE; |
| 632 | 637 | ||
| 633 | /* | 638 | /* |
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index 68a4815750b5..127093a0c0e8 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c | |||
| @@ -155,7 +155,6 @@ static int dw_probe(struct platform_device *pdev) | |||
| 155 | struct dw_dma_chip *chip; | 155 | struct dw_dma_chip *chip; |
| 156 | struct device *dev = &pdev->dev; | 156 | struct device *dev = &pdev->dev; |
| 157 | struct resource *mem; | 157 | struct resource *mem; |
| 158 | const struct acpi_device_id *id; | ||
| 159 | struct dw_dma_platform_data *pdata; | 158 | struct dw_dma_platform_data *pdata; |
| 160 | int err; | 159 | int err; |
| 161 | 160 | ||
| @@ -179,11 +178,6 @@ static int dw_probe(struct platform_device *pdev) | |||
| 179 | pdata = dev_get_platdata(dev); | 178 | pdata = dev_get_platdata(dev); |
| 180 | if (!pdata) | 179 | if (!pdata) |
| 181 | pdata = dw_dma_parse_dt(pdev); | 180 | pdata = dw_dma_parse_dt(pdev); |
| 182 | if (!pdata && has_acpi_companion(dev)) { | ||
| 183 | id = acpi_match_device(dev->driver->acpi_match_table, dev); | ||
| 184 | if (id) | ||
| 185 | pdata = (struct dw_dma_platform_data *)id->driver_data; | ||
| 186 | } | ||
| 187 | 181 | ||
| 188 | chip->dev = dev; | 182 | chip->dev = dev; |
| 189 | 183 | ||
| @@ -239,7 +233,19 @@ static void dw_shutdown(struct platform_device *pdev) | |||
| 239 | { | 233 | { |
| 240 | struct dw_dma_chip *chip = platform_get_drvdata(pdev); | 234 | struct dw_dma_chip *chip = platform_get_drvdata(pdev); |
| 241 | 235 | ||
| 236 | /* | ||
| 237 | * We have to call dw_dma_disable() to stop any ongoing transfer. On | ||
| 238 | * some platforms we can't do that since DMA device is powered off. | ||
| 239 | * Moreover we have no possibility to check if the platform is affected | ||
| 240 | * or not. That's why we call pm_runtime_get_sync() / pm_runtime_put() | ||
| 241 | * unconditionally. On the other hand we can't use | ||
| 242 | * pm_runtime_suspended() because runtime PM framework is not fully | ||
| 243 | * used by the driver. | ||
| 244 | */ | ||
| 245 | pm_runtime_get_sync(chip->dev); | ||
| 242 | dw_dma_disable(chip); | 246 | dw_dma_disable(chip); |
| 247 | pm_runtime_put_sync_suspend(chip->dev); | ||
| 248 | |||
| 243 | clk_disable_unprepare(chip->clk); | 249 | clk_disable_unprepare(chip->clk); |
| 244 | } | 250 | } |
| 245 | 251 | ||
| @@ -252,17 +258,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_of_id_table); | |||
| 252 | #endif | 258 | #endif |
| 253 | 259 | ||
| 254 | #ifdef CONFIG_ACPI | 260 | #ifdef CONFIG_ACPI |
| 255 | static struct dw_dma_platform_data dw_dma_acpi_pdata = { | ||
| 256 | .nr_channels = 8, | ||
| 257 | .is_private = true, | ||
| 258 | .chan_allocation_order = CHAN_ALLOCATION_ASCENDING, | ||
| 259 | .chan_priority = CHAN_PRIORITY_ASCENDING, | ||
| 260 | .block_size = 4095, | ||
| 261 | .nr_masters = 2, | ||
| 262 | }; | ||
| 263 | |||
| 264 | static const struct acpi_device_id dw_dma_acpi_id_table[] = { | 261 | static const struct acpi_device_id dw_dma_acpi_id_table[] = { |
| 265 | { "INTL9C60", (kernel_ulong_t)&dw_dma_acpi_pdata }, | 262 | { "INTL9C60", 0 }, |
| 266 | { } | 263 | { } |
| 267 | }; | 264 | }; |
| 268 | MODULE_DEVICE_TABLE(acpi, dw_dma_acpi_id_table); | 265 | MODULE_DEVICE_TABLE(acpi, dw_dma_acpi_id_table); |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 16a7b6816744..cbbb67a6f1d6 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
| @@ -417,10 +417,15 @@ static int acpi_find_gpio(struct acpi_resource *ares, void *data) | |||
| 417 | * ActiveLow is only specified for GpioInt resource. If | 417 | * ActiveLow is only specified for GpioInt resource. If |
| 418 | * GpioIo is used then the only way to set the flag is | 418 | * GpioIo is used then the only way to set the flag is |
| 419 | * to use _DSD "gpios" property. | 419 | * to use _DSD "gpios" property. |
| 420 | * Note: we expect here: | ||
| 421 | * - ACPI_ACTIVE_LOW == GPIO_ACTIVE_LOW | ||
| 422 | * - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH | ||
| 420 | */ | 423 | */ |
| 421 | if (lookup->info.gpioint) | 424 | if (lookup->info.gpioint) { |
| 422 | lookup->info.active_low = | 425 | lookup->info.polarity = agpio->polarity; |
| 423 | agpio->polarity == ACPI_ACTIVE_LOW; | 426 | lookup->info.triggering = agpio->triggering; |
| 427 | } | ||
| 428 | |||
| 424 | } | 429 | } |
| 425 | 430 | ||
| 426 | return 1; | 431 | return 1; |
| @@ -447,7 +452,7 @@ static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup, | |||
| 447 | if (info) { | 452 | if (info) { |
| 448 | *info = lookup->info; | 453 | *info = lookup->info; |
| 449 | if (lookup->active_low) | 454 | if (lookup->active_low) |
| 450 | info->active_low = lookup->active_low; | 455 | info->polarity = lookup->active_low; |
| 451 | } | 456 | } |
| 452 | return 0; | 457 | return 0; |
| 453 | } | 458 | } |
| @@ -595,6 +600,7 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, | |||
| 595 | int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) | 600 | int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) |
| 596 | { | 601 | { |
| 597 | int idx, i; | 602 | int idx, i; |
| 603 | unsigned int irq_flags; | ||
| 598 | 604 | ||
| 599 | for (i = 0, idx = 0; idx <= index; i++) { | 605 | for (i = 0, idx = 0; idx <= index; i++) { |
| 600 | struct acpi_gpio_info info; | 606 | struct acpi_gpio_info info; |
| @@ -603,8 +609,23 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) | |||
| 603 | desc = acpi_get_gpiod_by_index(adev, NULL, i, &info); | 609 | desc = acpi_get_gpiod_by_index(adev, NULL, i, &info); |
| 604 | if (IS_ERR(desc)) | 610 | if (IS_ERR(desc)) |
| 605 | break; | 611 | break; |
| 606 | if (info.gpioint && idx++ == index) | 612 | if (info.gpioint && idx++ == index) { |
| 607 | return gpiod_to_irq(desc); | 613 | int irq = gpiod_to_irq(desc); |
| 614 | |||
| 615 | if (irq < 0) | ||
| 616 | return irq; | ||
| 617 | |||
| 618 | irq_flags = acpi_dev_get_irq_type(info.triggering, | ||
| 619 | info.polarity); | ||
| 620 | |||
| 621 | /* Set type if specified and different than the current one */ | ||
| 622 | if (irq_flags != IRQ_TYPE_NONE && | ||
| 623 | irq_flags != irq_get_trigger_type(irq)) | ||
| 624 | irq_set_irq_type(irq, irq_flags); | ||
| 625 | |||
| 626 | return irq; | ||
| 627 | } | ||
| 628 | |||
| 608 | } | 629 | } |
| 609 | return -ENOENT; | 630 | return -ENOENT; |
| 610 | } | 631 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4e4c3083ae56..5d8d7ab96916 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -1879,7 +1879,7 @@ static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | |||
| 1879 | return desc; | 1879 | return desc; |
| 1880 | } | 1880 | } |
| 1881 | 1881 | ||
| 1882 | if (info.active_low) | 1882 | if (info.polarity == GPIO_ACTIVE_LOW) |
| 1883 | *flags |= GPIO_ACTIVE_LOW; | 1883 | *flags |= GPIO_ACTIVE_LOW; |
| 1884 | 1884 | ||
| 1885 | return desc; | 1885 | return desc; |
| @@ -2217,7 +2217,7 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | |||
| 2217 | 2217 | ||
| 2218 | desc = acpi_node_get_gpiod(fwnode, propname, 0, &info); | 2218 | desc = acpi_node_get_gpiod(fwnode, propname, 0, &info); |
| 2219 | if (!IS_ERR(desc)) | 2219 | if (!IS_ERR(desc)) |
| 2220 | active_low = info.active_low; | 2220 | active_low = info.polarity == GPIO_ACTIVE_LOW; |
| 2221 | } | 2221 | } |
| 2222 | 2222 | ||
| 2223 | if (IS_ERR(desc)) | 2223 | if (IS_ERR(desc)) |
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 98ab08c0aa2d..5ac3b88a2e0a 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h | |||
| @@ -26,7 +26,8 @@ struct acpi_device; | |||
| 26 | */ | 26 | */ |
| 27 | struct acpi_gpio_info { | 27 | struct acpi_gpio_info { |
| 28 | bool gpioint; | 28 | bool gpioint; |
| 29 | bool active_low; | 29 | int polarity; |
| 30 | int triggering; | ||
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | /* gpio suffixes used for ACPI and device tree lookup */ | 33 | /* gpio suffixes used for ACPI and device tree lookup */ |
diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c b/drivers/i2c/busses/i2c-designware-baytrail.c index 7d7ae97476e2..e38c2bbba940 100644 --- a/drivers/i2c/busses/i2c-designware-baytrail.c +++ b/drivers/i2c/busses/i2c-designware-baytrail.c | |||
| @@ -34,8 +34,7 @@ static int get_sem(struct device *dev, u32 *sem) | |||
| 34 | u32 data; | 34 | u32 data; |
| 35 | int ret; | 35 | int ret; |
| 36 | 36 | ||
| 37 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, PUNIT_SEMAPHORE, | 37 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &data); |
| 38 | &data); | ||
| 39 | if (ret) { | 38 | if (ret) { |
| 40 | dev_err(dev, "iosf failed to read punit semaphore\n"); | 39 | dev_err(dev, "iosf failed to read punit semaphore\n"); |
| 41 | return ret; | 40 | return ret; |
| @@ -50,21 +49,19 @@ static void reset_semaphore(struct device *dev) | |||
| 50 | { | 49 | { |
| 51 | u32 data; | 50 | u32 data; |
| 52 | 51 | ||
| 53 | if (iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 52 | if (iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &data)) { |
| 54 | PUNIT_SEMAPHORE, &data)) { | ||
| 55 | dev_err(dev, "iosf failed to reset punit semaphore during read\n"); | 53 | dev_err(dev, "iosf failed to reset punit semaphore during read\n"); |
| 56 | return; | 54 | return; |
| 57 | } | 55 | } |
| 58 | 56 | ||
| 59 | data &= ~PUNIT_SEMAPHORE_BIT; | 57 | data &= ~PUNIT_SEMAPHORE_BIT; |
| 60 | if (iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 58 | if (iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, data)) |
| 61 | PUNIT_SEMAPHORE, data)) | ||
| 62 | dev_err(dev, "iosf failed to reset punit semaphore during write\n"); | 59 | dev_err(dev, "iosf failed to reset punit semaphore during write\n"); |
| 63 | } | 60 | } |
| 64 | 61 | ||
| 65 | static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) | 62 | static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) |
| 66 | { | 63 | { |
| 67 | u32 sem; | 64 | u32 sem = PUNIT_SEMAPHORE_ACQUIRE; |
| 68 | int ret; | 65 | int ret; |
| 69 | unsigned long start, end; | 66 | unsigned long start, end; |
| 70 | 67 | ||
| @@ -77,8 +74,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) | |||
| 77 | return 0; | 74 | return 0; |
| 78 | 75 | ||
| 79 | /* host driver writes to side band semaphore register */ | 76 | /* host driver writes to side band semaphore register */ |
| 80 | ret = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 77 | ret = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, sem); |
| 81 | PUNIT_SEMAPHORE, PUNIT_SEMAPHORE_ACQUIRE); | ||
| 82 | if (ret) { | 78 | if (ret) { |
| 83 | dev_err(dev->dev, "iosf punit semaphore request failed\n"); | 79 | dev_err(dev->dev, "iosf punit semaphore request failed\n"); |
| 84 | return ret; | 80 | return ret; |
| @@ -102,8 +98,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) | |||
| 102 | dev_err(dev->dev, "punit semaphore timed out, resetting\n"); | 98 | dev_err(dev->dev, "punit semaphore timed out, resetting\n"); |
| 103 | reset_semaphore(dev->dev); | 99 | reset_semaphore(dev->dev); |
| 104 | 100 | ||
| 105 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 101 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &sem); |
| 106 | PUNIT_SEMAPHORE, &sem); | ||
| 107 | if (ret) | 102 | if (ret) |
| 108 | dev_err(dev->dev, "iosf failed to read punit semaphore\n"); | 103 | dev_err(dev->dev, "iosf failed to read punit semaphore\n"); |
| 109 | else | 104 | else |
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 6b00061c3746..bf72ae740fc1 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
| 37 | #include <linux/pm.h> | 37 | #include <linux/pm.h> |
| 38 | #include <linux/pm_runtime.h> | 38 | #include <linux/pm_runtime.h> |
| 39 | #include <linux/property.h> | ||
| 39 | #include <linux/io.h> | 40 | #include <linux/io.h> |
| 40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
| 41 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
| @@ -122,6 +123,7 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = { | |||
| 122 | { "80860F41", 0 }, | 123 | { "80860F41", 0 }, |
| 123 | { "808622C1", 0 }, | 124 | { "808622C1", 0 }, |
| 124 | { "AMD0010", ACCESS_INTR_MASK }, | 125 | { "AMD0010", ACCESS_INTR_MASK }, |
| 126 | { "APMC0D0F", 0 }, | ||
| 125 | { } | 127 | { } |
| 126 | }; | 128 | }; |
| 127 | MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); | 129 | MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); |
| @@ -134,10 +136,10 @@ static inline int dw_i2c_acpi_configure(struct platform_device *pdev) | |||
| 134 | 136 | ||
| 135 | static int dw_i2c_plat_probe(struct platform_device *pdev) | 137 | static int dw_i2c_plat_probe(struct platform_device *pdev) |
| 136 | { | 138 | { |
| 139 | struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev); | ||
| 137 | struct dw_i2c_dev *dev; | 140 | struct dw_i2c_dev *dev; |
| 138 | struct i2c_adapter *adap; | 141 | struct i2c_adapter *adap; |
| 139 | struct resource *mem; | 142 | struct resource *mem; |
| 140 | struct dw_i2c_platform_data *pdata; | ||
| 141 | int irq, r; | 143 | int irq, r; |
| 142 | u32 clk_freq, ht = 0; | 144 | u32 clk_freq, ht = 0; |
| 143 | 145 | ||
| @@ -161,33 +163,28 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) | |||
| 161 | /* fast mode by default because of legacy reasons */ | 163 | /* fast mode by default because of legacy reasons */ |
| 162 | clk_freq = 400000; | 164 | clk_freq = 400000; |
| 163 | 165 | ||
| 164 | if (has_acpi_companion(&pdev->dev)) { | 166 | if (pdata) { |
| 165 | dw_i2c_acpi_configure(pdev); | 167 | clk_freq = pdata->i2c_scl_freq; |
| 166 | } else if (pdev->dev.of_node) { | ||
| 167 | of_property_read_u32(pdev->dev.of_node, | ||
| 168 | "i2c-sda-hold-time-ns", &ht); | ||
| 169 | |||
| 170 | of_property_read_u32(pdev->dev.of_node, | ||
| 171 | "i2c-sda-falling-time-ns", | ||
| 172 | &dev->sda_falling_time); | ||
| 173 | of_property_read_u32(pdev->dev.of_node, | ||
| 174 | "i2c-scl-falling-time-ns", | ||
| 175 | &dev->scl_falling_time); | ||
| 176 | |||
| 177 | of_property_read_u32(pdev->dev.of_node, "clock-frequency", | ||
| 178 | &clk_freq); | ||
| 179 | |||
| 180 | /* Only standard mode at 100kHz and fast mode at 400kHz | ||
| 181 | * are supported. | ||
| 182 | */ | ||
| 183 | if (clk_freq != 100000 && clk_freq != 400000) { | ||
| 184 | dev_err(&pdev->dev, "Only 100kHz and 400kHz supported"); | ||
| 185 | return -EINVAL; | ||
| 186 | } | ||
| 187 | } else { | 168 | } else { |
| 188 | pdata = dev_get_platdata(&pdev->dev); | 169 | device_property_read_u32(&pdev->dev, "i2c-sda-hold-time-ns", |
| 189 | if (pdata) | 170 | &ht); |
| 190 | clk_freq = pdata->i2c_scl_freq; | 171 | device_property_read_u32(&pdev->dev, "i2c-sda-falling-time-ns", |
| 172 | &dev->sda_falling_time); | ||
| 173 | device_property_read_u32(&pdev->dev, "i2c-scl-falling-time-ns", | ||
| 174 | &dev->scl_falling_time); | ||
| 175 | device_property_read_u32(&pdev->dev, "clock-frequency", | ||
| 176 | &clk_freq); | ||
| 177 | } | ||
| 178 | |||
| 179 | if (has_acpi_companion(&pdev->dev)) | ||
| 180 | dw_i2c_acpi_configure(pdev); | ||
| 181 | |||
| 182 | /* | ||
| 183 | * Only standard mode at 100kHz and fast mode at 400kHz are supported. | ||
| 184 | */ | ||
| 185 | if (clk_freq != 100000 && clk_freq != 400000) { | ||
| 186 | dev_err(&pdev->dev, "Only 100kHz and 400kHz supported"); | ||
| 187 | return -EINVAL; | ||
| 191 | } | 188 | } |
| 192 | 189 | ||
| 193 | r = i2c_dw_eval_lock_support(dev); | 190 | r = i2c_dw_eval_lock_support(dev); |
diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c index b6fd9041f82f..06f00d60be46 100644 --- a/drivers/mfd/intel-lpss-acpi.c +++ b/drivers/mfd/intel-lpss-acpi.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
| 19 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
| 20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/property.h> | ||
| 21 | 22 | ||
| 22 | #include "intel-lpss.h" | 23 | #include "intel-lpss.h" |
| 23 | 24 | ||
| @@ -25,6 +26,20 @@ static const struct intel_lpss_platform_info spt_info = { | |||
| 25 | .clk_rate = 120000000, | 26 | .clk_rate = 120000000, |
| 26 | }; | 27 | }; |
| 27 | 28 | ||
| 29 | static struct property_entry spt_i2c_properties[] = { | ||
| 30 | PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 230), | ||
| 31 | { }, | ||
| 32 | }; | ||
| 33 | |||
| 34 | static struct property_set spt_i2c_pset = { | ||
| 35 | .properties = spt_i2c_properties, | ||
| 36 | }; | ||
| 37 | |||
| 38 | static const struct intel_lpss_platform_info spt_i2c_info = { | ||
| 39 | .clk_rate = 120000000, | ||
| 40 | .pset = &spt_i2c_pset, | ||
| 41 | }; | ||
| 42 | |||
| 28 | static const struct intel_lpss_platform_info bxt_info = { | 43 | static const struct intel_lpss_platform_info bxt_info = { |
| 29 | .clk_rate = 100000000, | 44 | .clk_rate = 100000000, |
| 30 | }; | 45 | }; |
| @@ -35,8 +50,8 @@ static const struct intel_lpss_platform_info bxt_i2c_info = { | |||
| 35 | 50 | ||
| 36 | static const struct acpi_device_id intel_lpss_acpi_ids[] = { | 51 | static const struct acpi_device_id intel_lpss_acpi_ids[] = { |
| 37 | /* SPT */ | 52 | /* SPT */ |
| 38 | { "INT3446", (kernel_ulong_t)&spt_info }, | 53 | { "INT3446", (kernel_ulong_t)&spt_i2c_info }, |
| 39 | { "INT3447", (kernel_ulong_t)&spt_info }, | 54 | { "INT3447", (kernel_ulong_t)&spt_i2c_info }, |
| 40 | /* BXT */ | 55 | /* BXT */ |
| 41 | { "80860AAC", (kernel_ulong_t)&bxt_i2c_info }, | 56 | { "80860AAC", (kernel_ulong_t)&bxt_i2c_info }, |
| 42 | { "80860ABC", (kernel_ulong_t)&bxt_info }, | 57 | { "80860ABC", (kernel_ulong_t)&bxt_info }, |
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c index 5bfdfccbb9a1..a7136c7ae9fb 100644 --- a/drivers/mfd/intel-lpss-pci.c +++ b/drivers/mfd/intel-lpss-pci.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
| 18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
| 19 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
| 20 | #include <linux/property.h> | ||
| 20 | 21 | ||
| 21 | #include "intel-lpss.h" | 22 | #include "intel-lpss.h" |
| 22 | 23 | ||
| @@ -65,9 +66,35 @@ static const struct intel_lpss_platform_info spt_info = { | |||
| 65 | .clk_rate = 120000000, | 66 | .clk_rate = 120000000, |
| 66 | }; | 67 | }; |
| 67 | 68 | ||
| 69 | static struct property_entry spt_i2c_properties[] = { | ||
| 70 | PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 230), | ||
| 71 | { }, | ||
| 72 | }; | ||
| 73 | |||
| 74 | static struct property_set spt_i2c_pset = { | ||
| 75 | .properties = spt_i2c_properties, | ||
| 76 | }; | ||
| 77 | |||
| 78 | static const struct intel_lpss_platform_info spt_i2c_info = { | ||
| 79 | .clk_rate = 120000000, | ||
| 80 | .pset = &spt_i2c_pset, | ||
| 81 | }; | ||
| 82 | |||
| 83 | static struct property_entry uart_properties[] = { | ||
| 84 | PROPERTY_ENTRY_U32("reg-io-width", 4), | ||
| 85 | PROPERTY_ENTRY_U32("reg-shift", 2), | ||
| 86 | PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"), | ||
| 87 | { }, | ||
| 88 | }; | ||
| 89 | |||
| 90 | static struct property_set uart_pset = { | ||
| 91 | .properties = uart_properties, | ||
| 92 | }; | ||
| 93 | |||
| 68 | static const struct intel_lpss_platform_info spt_uart_info = { | 94 | static const struct intel_lpss_platform_info spt_uart_info = { |
| 69 | .clk_rate = 120000000, | 95 | .clk_rate = 120000000, |
| 70 | .clk_con_id = "baudclk", | 96 | .clk_con_id = "baudclk", |
| 97 | .pset = &uart_pset, | ||
| 71 | }; | 98 | }; |
| 72 | 99 | ||
| 73 | static const struct intel_lpss_platform_info bxt_info = { | 100 | static const struct intel_lpss_platform_info bxt_info = { |
| @@ -77,6 +104,7 @@ static const struct intel_lpss_platform_info bxt_info = { | |||
| 77 | static const struct intel_lpss_platform_info bxt_uart_info = { | 104 | static const struct intel_lpss_platform_info bxt_uart_info = { |
| 78 | .clk_rate = 100000000, | 105 | .clk_rate = 100000000, |
| 79 | .clk_con_id = "baudclk", | 106 | .clk_con_id = "baudclk", |
| 107 | .pset = &uart_pset, | ||
| 80 | }; | 108 | }; |
| 81 | 109 | ||
| 82 | static const struct intel_lpss_platform_info bxt_i2c_info = { | 110 | static const struct intel_lpss_platform_info bxt_i2c_info = { |
| @@ -121,20 +149,20 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { | |||
| 121 | { PCI_VDEVICE(INTEL, 0x9d28), (kernel_ulong_t)&spt_uart_info }, | 149 | { PCI_VDEVICE(INTEL, 0x9d28), (kernel_ulong_t)&spt_uart_info }, |
| 122 | { PCI_VDEVICE(INTEL, 0x9d29), (kernel_ulong_t)&spt_info }, | 150 | { PCI_VDEVICE(INTEL, 0x9d29), (kernel_ulong_t)&spt_info }, |
| 123 | { PCI_VDEVICE(INTEL, 0x9d2a), (kernel_ulong_t)&spt_info }, | 151 | { PCI_VDEVICE(INTEL, 0x9d2a), (kernel_ulong_t)&spt_info }, |
| 124 | { PCI_VDEVICE(INTEL, 0x9d60), (kernel_ulong_t)&spt_info }, | 152 | { PCI_VDEVICE(INTEL, 0x9d60), (kernel_ulong_t)&spt_i2c_info }, |
| 125 | { PCI_VDEVICE(INTEL, 0x9d61), (kernel_ulong_t)&spt_info }, | 153 | { PCI_VDEVICE(INTEL, 0x9d61), (kernel_ulong_t)&spt_i2c_info }, |
| 126 | { PCI_VDEVICE(INTEL, 0x9d62), (kernel_ulong_t)&spt_info }, | 154 | { PCI_VDEVICE(INTEL, 0x9d62), (kernel_ulong_t)&spt_i2c_info }, |
| 127 | { PCI_VDEVICE(INTEL, 0x9d63), (kernel_ulong_t)&spt_info }, | 155 | { PCI_VDEVICE(INTEL, 0x9d63), (kernel_ulong_t)&spt_i2c_info }, |
| 128 | { PCI_VDEVICE(INTEL, 0x9d64), (kernel_ulong_t)&spt_info }, | 156 | { PCI_VDEVICE(INTEL, 0x9d64), (kernel_ulong_t)&spt_i2c_info }, |
| 129 | { PCI_VDEVICE(INTEL, 0x9d65), (kernel_ulong_t)&spt_info }, | 157 | { PCI_VDEVICE(INTEL, 0x9d65), (kernel_ulong_t)&spt_i2c_info }, |
| 130 | { PCI_VDEVICE(INTEL, 0x9d66), (kernel_ulong_t)&spt_uart_info }, | 158 | { PCI_VDEVICE(INTEL, 0x9d66), (kernel_ulong_t)&spt_uart_info }, |
| 131 | /* SPT-H */ | 159 | /* SPT-H */ |
| 132 | { PCI_VDEVICE(INTEL, 0xa127), (kernel_ulong_t)&spt_uart_info }, | 160 | { PCI_VDEVICE(INTEL, 0xa127), (kernel_ulong_t)&spt_uart_info }, |
| 133 | { PCI_VDEVICE(INTEL, 0xa128), (kernel_ulong_t)&spt_uart_info }, | 161 | { PCI_VDEVICE(INTEL, 0xa128), (kernel_ulong_t)&spt_uart_info }, |
| 134 | { PCI_VDEVICE(INTEL, 0xa129), (kernel_ulong_t)&spt_info }, | 162 | { PCI_VDEVICE(INTEL, 0xa129), (kernel_ulong_t)&spt_info }, |
| 135 | { PCI_VDEVICE(INTEL, 0xa12a), (kernel_ulong_t)&spt_info }, | 163 | { PCI_VDEVICE(INTEL, 0xa12a), (kernel_ulong_t)&spt_info }, |
| 136 | { PCI_VDEVICE(INTEL, 0xa160), (kernel_ulong_t)&spt_info }, | 164 | { PCI_VDEVICE(INTEL, 0xa160), (kernel_ulong_t)&spt_i2c_info }, |
| 137 | { PCI_VDEVICE(INTEL, 0xa161), (kernel_ulong_t)&spt_info }, | 165 | { PCI_VDEVICE(INTEL, 0xa161), (kernel_ulong_t)&spt_i2c_info }, |
| 138 | { PCI_VDEVICE(INTEL, 0xa166), (kernel_ulong_t)&spt_uart_info }, | 166 | { PCI_VDEVICE(INTEL, 0xa166), (kernel_ulong_t)&spt_uart_info }, |
| 139 | { } | 167 | { } |
| 140 | }; | 168 | }; |
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c index 6255513f54c7..1743788f1595 100644 --- a/drivers/mfd/intel-lpss.c +++ b/drivers/mfd/intel-lpss.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/mfd/core.h> | 24 | #include <linux/mfd/core.h> |
| 25 | #include <linux/pm_qos.h> | 25 | #include <linux/pm_qos.h> |
| 26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
| 27 | #include <linux/property.h> | ||
| 27 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
| 28 | #include <linux/io-64-nonatomic-lo-hi.h> | 29 | #include <linux/io-64-nonatomic-lo-hi.h> |
| 29 | 30 | ||
| @@ -72,7 +73,7 @@ struct intel_lpss { | |||
| 72 | enum intel_lpss_dev_type type; | 73 | enum intel_lpss_dev_type type; |
| 73 | struct clk *clk; | 74 | struct clk *clk; |
| 74 | struct clk_lookup *clock; | 75 | struct clk_lookup *clock; |
| 75 | const struct mfd_cell *cell; | 76 | struct mfd_cell *cell; |
| 76 | struct device *dev; | 77 | struct device *dev; |
| 77 | void __iomem *priv; | 78 | void __iomem *priv; |
| 78 | int devid; | 79 | int devid; |
| @@ -217,6 +218,7 @@ static void intel_lpss_ltr_hide(struct intel_lpss *lpss) | |||
| 217 | 218 | ||
| 218 | static int intel_lpss_assign_devs(struct intel_lpss *lpss) | 219 | static int intel_lpss_assign_devs(struct intel_lpss *lpss) |
| 219 | { | 220 | { |
| 221 | const struct mfd_cell *cell; | ||
| 220 | unsigned int type; | 222 | unsigned int type; |
| 221 | 223 | ||
| 222 | type = lpss->caps & LPSS_PRIV_CAPS_TYPE_MASK; | 224 | type = lpss->caps & LPSS_PRIV_CAPS_TYPE_MASK; |
| @@ -224,18 +226,22 @@ static int intel_lpss_assign_devs(struct intel_lpss *lpss) | |||
| 224 | 226 | ||
| 225 | switch (type) { | 227 | switch (type) { |
| 226 | case LPSS_DEV_I2C: | 228 | case LPSS_DEV_I2C: |
| 227 | lpss->cell = &intel_lpss_i2c_cell; | 229 | cell = &intel_lpss_i2c_cell; |
| 228 | break; | 230 | break; |
| 229 | case LPSS_DEV_UART: | 231 | case LPSS_DEV_UART: |
| 230 | lpss->cell = &intel_lpss_uart_cell; | 232 | cell = &intel_lpss_uart_cell; |
| 231 | break; | 233 | break; |
| 232 | case LPSS_DEV_SPI: | 234 | case LPSS_DEV_SPI: |
| 233 | lpss->cell = &intel_lpss_spi_cell; | 235 | cell = &intel_lpss_spi_cell; |
| 234 | break; | 236 | break; |
| 235 | default: | 237 | default: |
| 236 | return -ENODEV; | 238 | return -ENODEV; |
| 237 | } | 239 | } |
| 238 | 240 | ||
| 241 | lpss->cell = devm_kmemdup(lpss->dev, cell, sizeof(*cell), GFP_KERNEL); | ||
| 242 | if (!lpss->cell) | ||
| 243 | return -ENOMEM; | ||
| 244 | |||
| 239 | lpss->type = type; | 245 | lpss->type = type; |
| 240 | 246 | ||
| 241 | return 0; | 247 | return 0; |
| @@ -401,6 +407,8 @@ int intel_lpss_probe(struct device *dev, | |||
| 401 | if (ret) | 407 | if (ret) |
| 402 | return ret; | 408 | return ret; |
| 403 | 409 | ||
| 410 | lpss->cell->pset = info->pset; | ||
| 411 | |||
| 404 | intel_lpss_init_dev(lpss); | 412 | intel_lpss_init_dev(lpss); |
| 405 | 413 | ||
| 406 | lpss->devid = ida_simple_get(&intel_lpss_devid_ida, 0, 0, GFP_KERNEL); | 414 | lpss->devid = ida_simple_get(&intel_lpss_devid_ida, 0, 0, GFP_KERNEL); |
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h index 2c7f8d7c0595..0dcea9eb2d03 100644 --- a/drivers/mfd/intel-lpss.h +++ b/drivers/mfd/intel-lpss.h | |||
| @@ -16,12 +16,14 @@ | |||
| 16 | 16 | ||
| 17 | struct device; | 17 | struct device; |
| 18 | struct resource; | 18 | struct resource; |
| 19 | struct property_set; | ||
| 19 | 20 | ||
| 20 | struct intel_lpss_platform_info { | 21 | struct intel_lpss_platform_info { |
| 21 | struct resource *mem; | 22 | struct resource *mem; |
| 22 | int irq; | 23 | int irq; |
| 23 | unsigned long clk_rate; | 24 | unsigned long clk_rate; |
| 24 | const char *clk_con_id; | 25 | const char *clk_con_id; |
| 26 | struct property_set *pset; | ||
| 25 | }; | 27 | }; |
| 26 | 28 | ||
| 27 | int intel_lpss_probe(struct device *dev, | 29 | int intel_lpss_probe(struct device *dev, |
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 60b60dc63ddd..88bd1b1e47be 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/acpi.h> | 16 | #include <linux/acpi.h> |
| 17 | #include <linux/property.h> | ||
| 17 | #include <linux/mfd/core.h> | 18 | #include <linux/mfd/core.h> |
| 18 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
| 19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
| @@ -192,6 +193,12 @@ static int mfd_add_device(struct device *parent, int id, | |||
| 192 | goto fail_alias; | 193 | goto fail_alias; |
| 193 | } | 194 | } |
| 194 | 195 | ||
| 196 | if (cell->pset) { | ||
| 197 | ret = platform_device_add_properties(pdev, cell->pset); | ||
| 198 | if (ret) | ||
| 199 | goto fail_alias; | ||
| 200 | } | ||
| 201 | |||
| 195 | ret = mfd_platform_add_cell(pdev, cell, usage_count); | 202 | ret = mfd_platform_add_cell(pdev, cell, usage_count); |
| 196 | if (ret) | 203 | if (ret) |
| 197 | goto fail_alias; | 204 | goto fail_alias; |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index d3f32d6417ef..9a033e8ee9a4 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
| @@ -531,7 +531,7 @@ static bool acpi_pci_need_resume(struct pci_dev *dev) | |||
| 531 | return !!adev->power.flags.dsw_present; | 531 | return !!adev->power.flags.dsw_present; |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | static struct pci_platform_pm_ops acpi_pci_platform_pm = { | 534 | static const struct pci_platform_pm_ops acpi_pci_platform_pm = { |
| 535 | .is_manageable = acpi_pci_power_manageable, | 535 | .is_manageable = acpi_pci_power_manageable, |
| 536 | .set_state = acpi_pci_set_power_state, | 536 | .set_state = acpi_pci_set_power_state, |
| 537 | .choose_state = acpi_pci_choose_state, | 537 | .choose_state = acpi_pci_choose_state, |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 314db8c1047a..d1a7105b9276 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -527,9 +527,9 @@ static void pci_restore_bars(struct pci_dev *dev) | |||
| 527 | pci_update_resource(dev, i); | 527 | pci_update_resource(dev, i); |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | static struct pci_platform_pm_ops *pci_platform_pm; | 530 | static const struct pci_platform_pm_ops *pci_platform_pm; |
| 531 | 531 | ||
| 532 | int pci_set_platform_pm(struct pci_platform_pm_ops *ops) | 532 | int pci_set_platform_pm(const struct pci_platform_pm_ops *ops) |
| 533 | { | 533 | { |
| 534 | if (!ops->is_manageable || !ops->set_state || !ops->choose_state | 534 | if (!ops->is_manageable || !ops->set_state || !ops->choose_state |
| 535 | || !ops->sleep_wake) | 535 | || !ops->sleep_wake) |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index d390fc1475ec..f6f151a42147 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
| @@ -68,7 +68,7 @@ struct pci_platform_pm_ops { | |||
| 68 | bool (*need_resume)(struct pci_dev *dev); | 68 | bool (*need_resume)(struct pci_dev *dev); |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | int pci_set_platform_pm(struct pci_platform_pm_ops *ops); | 71 | int pci_set_platform_pm(const struct pci_platform_pm_ops *ops); |
| 72 | void pci_update_current_state(struct pci_dev *dev, pci_power_t state); | 72 | void pci_update_current_state(struct pci_dev *dev, pci_power_t state); |
| 73 | void pci_power_up(struct pci_dev *dev); | 73 | void pci_power_up(struct pci_dev *dev); |
| 74 | void pci_disable_enabled_device(struct pci_dev *dev); | 74 | void pci_disable_enabled_device(struct pci_dev *dev); |
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index f2d77fe696ac..cb8a9c2a3a1f 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
| @@ -43,8 +43,6 @@ MODULE_LICENSE("GPL"); | |||
| 43 | 43 | ||
| 44 | #define DELL_EVENT_GUID "9DBB5994-A997-11DA-B012-B622A1EF5492" | 44 | #define DELL_EVENT_GUID "9DBB5994-A997-11DA-B012-B622A1EF5492" |
| 45 | 45 | ||
| 46 | static int acpi_video; | ||
| 47 | |||
| 48 | MODULE_ALIAS("wmi:"DELL_EVENT_GUID); | 46 | MODULE_ALIAS("wmi:"DELL_EVENT_GUID); |
| 49 | 47 | ||
| 50 | /* | 48 | /* |
| @@ -159,7 +157,8 @@ static void dell_wmi_process_key(int reported_key) | |||
| 159 | 157 | ||
| 160 | /* Don't report brightness notifications that will also come via ACPI */ | 158 | /* Don't report brightness notifications that will also come via ACPI */ |
| 161 | if ((key->keycode == KEY_BRIGHTNESSUP || | 159 | if ((key->keycode == KEY_BRIGHTNESSUP || |
| 162 | key->keycode == KEY_BRIGHTNESSDOWN) && acpi_video) | 160 | key->keycode == KEY_BRIGHTNESSDOWN) && |
| 161 | acpi_video_handles_brightness_key_presses()) | ||
| 163 | return; | 162 | return; |
| 164 | 163 | ||
| 165 | sparse_keymap_report_entry(dell_wmi_input_dev, key, 1, true); | 164 | sparse_keymap_report_entry(dell_wmi_input_dev, key, 1, true); |
| @@ -398,7 +397,6 @@ static int __init dell_wmi_init(void) | |||
| 398 | } | 397 | } |
| 399 | 398 | ||
| 400 | dmi_walk(find_hk_type, NULL); | 399 | dmi_walk(find_hk_type, NULL); |
| 401 | acpi_video = acpi_video_get_backlight_type() != acpi_backlight_vendor; | ||
| 402 | 400 | ||
| 403 | err = dell_wmi_input_setup(); | 401 | err = dell_wmi_input_setup(); |
| 404 | if (err) | 402 | if (err) |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 0bed4733c4f0..f453d5dc085e 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -3488,7 +3488,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 3488 | /* Do not issue duplicate brightness change events to | 3488 | /* Do not issue duplicate brightness change events to |
| 3489 | * userspace. tpacpi_detect_brightness_capabilities() must have | 3489 | * userspace. tpacpi_detect_brightness_capabilities() must have |
| 3490 | * been called before this point */ | 3490 | * been called before this point */ |
| 3491 | if (acpi_video_get_backlight_type() != acpi_backlight_vendor) { | 3491 | if (acpi_video_handles_brightness_key_presses()) { |
| 3492 | pr_info("This ThinkPad has standard ACPI backlight " | 3492 | pr_info("This ThinkPad has standard ACPI backlight " |
| 3493 | "brightness control, supported by the ACPI " | 3493 | "brightness control, supported by the ACPI " |
| 3494 | "video driver\n"); | 3494 | "video driver\n"); |
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 153a493b5413..63452f20e3e9 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
| @@ -74,7 +74,6 @@ void pnp_device_detach(struct pnp_dev *pnp_dev) | |||
| 74 | if (pnp_dev->status == PNP_ATTACHED) | 74 | if (pnp_dev->status == PNP_ATTACHED) |
| 75 | pnp_dev->status = PNP_READY; | 75 | pnp_dev->status = PNP_READY; |
| 76 | mutex_unlock(&pnp_lock); | 76 | mutex_unlock(&pnp_lock); |
| 77 | pnp_disable_dev(pnp_dev); | ||
| 78 | } | 77 | } |
| 79 | 78 | ||
| 80 | static int pnp_device_probe(struct device *dev) | 79 | static int pnp_device_probe(struct device *dev) |
| @@ -131,6 +130,11 @@ static int pnp_device_remove(struct device *dev) | |||
| 131 | drv->remove(pnp_dev); | 130 | drv->remove(pnp_dev); |
| 132 | pnp_dev->driver = NULL; | 131 | pnp_dev->driver = NULL; |
| 133 | } | 132 | } |
| 133 | |||
| 134 | if (pnp_dev->active && | ||
| 135 | (!drv || !(drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE))) | ||
| 136 | pnp_disable_dev(pnp_dev); | ||
| 137 | |||
| 134 | pnp_device_detach(pnp_dev); | 138 | pnp_device_detach(pnp_dev); |
| 135 | return 0; | 139 | return 0; |
| 136 | } | 140 | } |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 943c1cb9566c..f700723ca5d6 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
| @@ -343,6 +343,7 @@ static void quirk_amd_mmconfig_area(struct pnp_dev *dev) | |||
| 343 | static const unsigned int mch_quirk_devices[] = { | 343 | static const unsigned int mch_quirk_devices[] = { |
| 344 | 0x0154, /* Ivy Bridge */ | 344 | 0x0154, /* Ivy Bridge */ |
| 345 | 0x0c00, /* Haswell */ | 345 | 0x0c00, /* Haswell */ |
| 346 | 0x1604, /* Broadwell */ | ||
| 346 | }; | 347 | }; |
| 347 | 348 | ||
| 348 | static struct pci_dev *get_intel_host(void) | 349 | static struct pci_dev *get_intel_host(void) |
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 48747c28a43d..6c592dc71aee 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c | |||
| @@ -388,7 +388,7 @@ static int get_domain_enable(struct powercap_zone *power_zone, bool *mode) | |||
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | /* per RAPL domain ops, in the order of rapl_domain_type */ | 390 | /* per RAPL domain ops, in the order of rapl_domain_type */ |
| 391 | static struct powercap_zone_ops zone_ops[] = { | 391 | static const struct powercap_zone_ops zone_ops[] = { |
| 392 | /* RAPL_DOMAIN_PACKAGE */ | 392 | /* RAPL_DOMAIN_PACKAGE */ |
| 393 | { | 393 | { |
| 394 | .get_energy_uj = get_energy_counter, | 394 | .get_energy_uj = get_energy_counter, |
| @@ -584,7 +584,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, | |||
| 584 | return ret; | 584 | return ret; |
| 585 | } | 585 | } |
| 586 | 586 | ||
| 587 | static struct powercap_zone_constraint_ops constraint_ops = { | 587 | static const struct powercap_zone_constraint_ops constraint_ops = { |
| 588 | .set_power_limit_uw = set_power_limit, | 588 | .set_power_limit_uw = set_power_limit, |
| 589 | .get_power_limit_uw = get_current_power_limit, | 589 | .get_power_limit_uw = get_current_power_limit, |
| 590 | .set_time_window_us = set_time_window, | 590 | .set_time_window_us = set_time_window, |
| @@ -988,16 +988,16 @@ static void set_floor_freq_atom(struct rapl_domain *rd, bool enable) | |||
| 988 | } | 988 | } |
| 989 | 989 | ||
| 990 | if (!power_ctrl_orig_val) | 990 | if (!power_ctrl_orig_val) |
| 991 | iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_PMC_READ, | 991 | iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_CR_READ, |
| 992 | rapl_defaults->floor_freq_reg_addr, | 992 | rapl_defaults->floor_freq_reg_addr, |
| 993 | &power_ctrl_orig_val); | 993 | &power_ctrl_orig_val); |
| 994 | mdata = power_ctrl_orig_val; | 994 | mdata = power_ctrl_orig_val; |
| 995 | if (enable) { | 995 | if (enable) { |
| 996 | mdata &= ~(0x7f << 8); | 996 | mdata &= ~(0x7f << 8); |
| 997 | mdata |= 1 << 8; | 997 | mdata |= 1 << 8; |
| 998 | } | 998 | } |
| 999 | iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_PMC_WRITE, | 999 | iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_CR_WRITE, |
| 1000 | rapl_defaults->floor_freq_reg_addr, mdata); | 1000 | rapl_defaults->floor_freq_reg_addr, mdata); |
| 1001 | } | 1001 | } |
| 1002 | 1002 | ||
| 1003 | static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, | 1003 | static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, |
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c index 84419af16f77..14bde0db8c24 100644 --- a/drivers/powercap/powercap_sys.c +++ b/drivers/powercap/powercap_sys.c | |||
| @@ -293,8 +293,8 @@ err_alloc: | |||
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | static int create_constraints(struct powercap_zone *power_zone, | 295 | static int create_constraints(struct powercap_zone *power_zone, |
| 296 | int nr_constraints, | 296 | int nr_constraints, |
| 297 | struct powercap_zone_constraint_ops *const_ops) | 297 | const struct powercap_zone_constraint_ops *const_ops) |
| 298 | { | 298 | { |
| 299 | int i; | 299 | int i; |
| 300 | int ret = 0; | 300 | int ret = 0; |
| @@ -492,13 +492,13 @@ static struct class powercap_class = { | |||
| 492 | }; | 492 | }; |
| 493 | 493 | ||
| 494 | struct powercap_zone *powercap_register_zone( | 494 | struct powercap_zone *powercap_register_zone( |
| 495 | struct powercap_zone *power_zone, | 495 | struct powercap_zone *power_zone, |
| 496 | struct powercap_control_type *control_type, | 496 | struct powercap_control_type *control_type, |
| 497 | const char *name, | 497 | const char *name, |
| 498 | struct powercap_zone *parent, | 498 | struct powercap_zone *parent, |
| 499 | const struct powercap_zone_ops *ops, | 499 | const struct powercap_zone_ops *ops, |
| 500 | int nr_constraints, | 500 | int nr_constraints, |
| 501 | struct powercap_zone_constraint_ops *const_ops) | 501 | const struct powercap_zone_constraint_ops *const_ops) |
| 502 | { | 502 | { |
| 503 | int result; | 503 | int result; |
| 504 | int nr_attrs; | 504 | int nr_attrs; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index dee1cb87d24f..151b01c25b40 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -1623,6 +1623,9 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level, | |||
| 1623 | return AE_OK; | 1623 | return AE_OK; |
| 1624 | } | 1624 | } |
| 1625 | 1625 | ||
| 1626 | if (spi->irq < 0) | ||
| 1627 | spi->irq = acpi_dev_gpio_irq_get(adev, 0); | ||
| 1628 | |||
| 1626 | adev->power.flags.ignore_parent = true; | 1629 | adev->power.flags.ignore_parent = true; |
| 1627 | strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias)); | 1630 | strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias)); |
| 1628 | if (spi_add_device(spi)) { | 1631 | if (spi_add_device(spi)) { |
diff --git a/drivers/thermal/intel_quark_dts_thermal.c b/drivers/thermal/intel_quark_dts_thermal.c index 5ed90e6c8a64..5d33b350da1c 100644 --- a/drivers/thermal/intel_quark_dts_thermal.c +++ b/drivers/thermal/intel_quark_dts_thermal.c | |||
| @@ -125,8 +125,8 @@ static int soc_dts_enable(struct thermal_zone_device *tzd) | |||
| 125 | struct soc_sensor_entry *aux_entry = tzd->devdata; | 125 | struct soc_sensor_entry *aux_entry = tzd->devdata; |
| 126 | int ret; | 126 | int ret; |
| 127 | 127 | ||
| 128 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 128 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 129 | QRK_DTS_REG_OFFSET_ENABLE, &out); | 129 | QRK_DTS_REG_OFFSET_ENABLE, &out); |
| 130 | if (ret) | 130 | if (ret) |
| 131 | return ret; | 131 | return ret; |
| 132 | 132 | ||
| @@ -137,8 +137,8 @@ static int soc_dts_enable(struct thermal_zone_device *tzd) | |||
| 137 | 137 | ||
| 138 | if (!aux_entry->locked) { | 138 | if (!aux_entry->locked) { |
| 139 | out |= QRK_DTS_ENABLE_BIT; | 139 | out |= QRK_DTS_ENABLE_BIT; |
| 140 | ret = iosf_mbi_write(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_WRITE, | 140 | ret = iosf_mbi_write(QRK_MBI_UNIT_RMU, MBI_REG_WRITE, |
| 141 | QRK_DTS_REG_OFFSET_ENABLE, out); | 141 | QRK_DTS_REG_OFFSET_ENABLE, out); |
| 142 | if (ret) | 142 | if (ret) |
| 143 | return ret; | 143 | return ret; |
| 144 | 144 | ||
| @@ -158,8 +158,8 @@ static int soc_dts_disable(struct thermal_zone_device *tzd) | |||
| 158 | struct soc_sensor_entry *aux_entry = tzd->devdata; | 158 | struct soc_sensor_entry *aux_entry = tzd->devdata; |
| 159 | int ret; | 159 | int ret; |
| 160 | 160 | ||
| 161 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 161 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 162 | QRK_DTS_REG_OFFSET_ENABLE, &out); | 162 | QRK_DTS_REG_OFFSET_ENABLE, &out); |
| 163 | if (ret) | 163 | if (ret) |
| 164 | return ret; | 164 | return ret; |
| 165 | 165 | ||
| @@ -170,8 +170,8 @@ static int soc_dts_disable(struct thermal_zone_device *tzd) | |||
| 170 | 170 | ||
| 171 | if (!aux_entry->locked) { | 171 | if (!aux_entry->locked) { |
| 172 | out &= ~QRK_DTS_ENABLE_BIT; | 172 | out &= ~QRK_DTS_ENABLE_BIT; |
| 173 | ret = iosf_mbi_write(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_WRITE, | 173 | ret = iosf_mbi_write(QRK_MBI_UNIT_RMU, MBI_REG_WRITE, |
| 174 | QRK_DTS_REG_OFFSET_ENABLE, out); | 174 | QRK_DTS_REG_OFFSET_ENABLE, out); |
| 175 | 175 | ||
| 176 | if (ret) | 176 | if (ret) |
| 177 | return ret; | 177 | return ret; |
| @@ -192,8 +192,8 @@ static int _get_trip_temp(int trip, int *temp) | |||
| 192 | u32 out; | 192 | u32 out; |
| 193 | 193 | ||
| 194 | mutex_lock(&dts_update_mutex); | 194 | mutex_lock(&dts_update_mutex); |
| 195 | status = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 195 | status = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 196 | QRK_DTS_REG_OFFSET_PTPS, &out); | 196 | QRK_DTS_REG_OFFSET_PTPS, &out); |
| 197 | mutex_unlock(&dts_update_mutex); | 197 | mutex_unlock(&dts_update_mutex); |
| 198 | 198 | ||
| 199 | if (status) | 199 | if (status) |
| @@ -236,8 +236,8 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry, | |||
| 236 | goto failed; | 236 | goto failed; |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 239 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 240 | QRK_DTS_REG_OFFSET_PTPS, &store_ptps); | 240 | QRK_DTS_REG_OFFSET_PTPS, &store_ptps); |
| 241 | if (ret) | 241 | if (ret) |
| 242 | goto failed; | 242 | goto failed; |
| 243 | 243 | ||
| @@ -262,8 +262,8 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry, | |||
| 262 | out |= (temp_out & QRK_DTS_MASK_TP_THRES) << | 262 | out |= (temp_out & QRK_DTS_MASK_TP_THRES) << |
| 263 | (trip * QRK_DTS_SHIFT_TP); | 263 | (trip * QRK_DTS_SHIFT_TP); |
| 264 | 264 | ||
| 265 | ret = iosf_mbi_write(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_WRITE, | 265 | ret = iosf_mbi_write(QRK_MBI_UNIT_RMU, MBI_REG_WRITE, |
| 266 | QRK_DTS_REG_OFFSET_PTPS, out); | 266 | QRK_DTS_REG_OFFSET_PTPS, out); |
| 267 | 267 | ||
| 268 | failed: | 268 | failed: |
| 269 | mutex_unlock(&dts_update_mutex); | 269 | mutex_unlock(&dts_update_mutex); |
| @@ -294,8 +294,8 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, | |||
| 294 | int ret; | 294 | int ret; |
| 295 | 295 | ||
| 296 | mutex_lock(&dts_update_mutex); | 296 | mutex_lock(&dts_update_mutex); |
| 297 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 297 | ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 298 | QRK_DTS_REG_OFFSET_TEMP, &out); | 298 | QRK_DTS_REG_OFFSET_TEMP, &out); |
| 299 | mutex_unlock(&dts_update_mutex); | 299 | mutex_unlock(&dts_update_mutex); |
| 300 | 300 | ||
| 301 | if (ret) | 301 | if (ret) |
| @@ -350,13 +350,13 @@ static void free_soc_dts(struct soc_sensor_entry *aux_entry) | |||
| 350 | if (aux_entry) { | 350 | if (aux_entry) { |
| 351 | if (!aux_entry->locked) { | 351 | if (!aux_entry->locked) { |
| 352 | mutex_lock(&dts_update_mutex); | 352 | mutex_lock(&dts_update_mutex); |
| 353 | iosf_mbi_write(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_WRITE, | 353 | iosf_mbi_write(QRK_MBI_UNIT_RMU, MBI_REG_WRITE, |
| 354 | QRK_DTS_REG_OFFSET_ENABLE, | 354 | QRK_DTS_REG_OFFSET_ENABLE, |
| 355 | aux_entry->store_dts_enable); | 355 | aux_entry->store_dts_enable); |
| 356 | 356 | ||
| 357 | iosf_mbi_write(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_WRITE, | 357 | iosf_mbi_write(QRK_MBI_UNIT_RMU, MBI_REG_WRITE, |
| 358 | QRK_DTS_REG_OFFSET_PTPS, | 358 | QRK_DTS_REG_OFFSET_PTPS, |
| 359 | aux_entry->store_ptps); | 359 | aux_entry->store_ptps); |
| 360 | mutex_unlock(&dts_update_mutex); | 360 | mutex_unlock(&dts_update_mutex); |
| 361 | } | 361 | } |
| 362 | thermal_zone_device_unregister(aux_entry->tzone); | 362 | thermal_zone_device_unregister(aux_entry->tzone); |
| @@ -378,9 +378,8 @@ static struct soc_sensor_entry *alloc_soc_dts(void) | |||
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | /* Check if DTS register is locked */ | 380 | /* Check if DTS register is locked */ |
| 381 | err = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 381 | err = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 382 | QRK_DTS_REG_OFFSET_LOCK, | 382 | QRK_DTS_REG_OFFSET_LOCK, &out); |
| 383 | &out); | ||
| 384 | if (err) | 383 | if (err) |
| 385 | goto err_ret; | 384 | goto err_ret; |
| 386 | 385 | ||
| @@ -395,16 +394,16 @@ static struct soc_sensor_entry *alloc_soc_dts(void) | |||
| 395 | /* Store DTS default state if DTS registers are not locked */ | 394 | /* Store DTS default state if DTS registers are not locked */ |
| 396 | if (!aux_entry->locked) { | 395 | if (!aux_entry->locked) { |
| 397 | /* Store DTS default enable for restore on exit */ | 396 | /* Store DTS default enable for restore on exit */ |
| 398 | err = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 397 | err = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 399 | QRK_DTS_REG_OFFSET_ENABLE, | 398 | QRK_DTS_REG_OFFSET_ENABLE, |
| 400 | &aux_entry->store_dts_enable); | 399 | &aux_entry->store_dts_enable); |
| 401 | if (err) | 400 | if (err) |
| 402 | goto err_ret; | 401 | goto err_ret; |
| 403 | 402 | ||
| 404 | /* Store DTS default PTPS register for restore on exit */ | 403 | /* Store DTS default PTPS register for restore on exit */ |
| 405 | err = iosf_mbi_read(QRK_MBI_UNIT_RMU, QRK_MBI_RMU_READ, | 404 | err = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, |
| 406 | QRK_DTS_REG_OFFSET_PTPS, | 405 | QRK_DTS_REG_OFFSET_PTPS, |
| 407 | &aux_entry->store_ptps); | 406 | &aux_entry->store_ptps); |
| 408 | if (err) | 407 | if (err) |
| 409 | goto err_ret; | 408 | goto err_ret; |
| 410 | } | 409 | } |
diff --git a/drivers/thermal/intel_soc_dts_iosf.c b/drivers/thermal/intel_soc_dts_iosf.c index 5841d1d72996..f72e1db3216f 100644 --- a/drivers/thermal/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel_soc_dts_iosf.c | |||
| @@ -90,7 +90,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip, | |||
| 90 | dts = tzd->devdata; | 90 | dts = tzd->devdata; |
| 91 | sensors = dts->sensors; | 91 | sensors = dts->sensors; |
| 92 | mutex_lock(&sensors->dts_update_lock); | 92 | mutex_lock(&sensors->dts_update_lock); |
| 93 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 93 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 94 | SOC_DTS_OFFSET_PTPS, &out); | 94 | SOC_DTS_OFFSET_PTPS, &out); |
| 95 | mutex_unlock(&sensors->dts_update_lock); | 95 | mutex_unlock(&sensors->dts_update_lock); |
| 96 | if (status) | 96 | if (status) |
| @@ -124,27 +124,27 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts, | |||
| 124 | 124 | ||
| 125 | temp_out = (sensors->tj_max - temp) / 1000; | 125 | temp_out = (sensors->tj_max - temp) / 1000; |
| 126 | 126 | ||
| 127 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 127 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 128 | SOC_DTS_OFFSET_PTPS, &store_ptps); | 128 | SOC_DTS_OFFSET_PTPS, &store_ptps); |
| 129 | if (status) | 129 | if (status) |
| 130 | return status; | 130 | return status; |
| 131 | 131 | ||
| 132 | out = (store_ptps & ~(0xFF << (thres_index * 8))); | 132 | out = (store_ptps & ~(0xFF << (thres_index * 8))); |
| 133 | out |= (temp_out & 0xFF) << (thres_index * 8); | 133 | out |= (temp_out & 0xFF) << (thres_index * 8); |
| 134 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 134 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 135 | SOC_DTS_OFFSET_PTPS, out); | 135 | SOC_DTS_OFFSET_PTPS, out); |
| 136 | if (status) | 136 | if (status) |
| 137 | return status; | 137 | return status; |
| 138 | 138 | ||
| 139 | pr_debug("update_trip_temp PTPS = %x\n", out); | 139 | pr_debug("update_trip_temp PTPS = %x\n", out); |
| 140 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 140 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 141 | SOC_DTS_OFFSET_PTMC, &out); | 141 | SOC_DTS_OFFSET_PTMC, &out); |
| 142 | if (status) | 142 | if (status) |
| 143 | goto err_restore_ptps; | 143 | goto err_restore_ptps; |
| 144 | 144 | ||
| 145 | store_ptmc = out; | 145 | store_ptmc = out; |
| 146 | 146 | ||
| 147 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 147 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 148 | SOC_DTS_TE_AUX0 + thres_index, | 148 | SOC_DTS_TE_AUX0 + thres_index, |
| 149 | &te_out); | 149 | &te_out); |
| 150 | if (status) | 150 | if (status) |
| @@ -167,12 +167,12 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts, | |||
| 167 | out &= ~SOC_DTS_AUX0_ENABLE_BIT; | 167 | out &= ~SOC_DTS_AUX0_ENABLE_BIT; |
| 168 | te_out &= ~int_enable_bit; | 168 | te_out &= ~int_enable_bit; |
| 169 | } | 169 | } |
| 170 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 170 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 171 | SOC_DTS_OFFSET_PTMC, out); | 171 | SOC_DTS_OFFSET_PTMC, out); |
| 172 | if (status) | 172 | if (status) |
| 173 | goto err_restore_te_out; | 173 | goto err_restore_te_out; |
| 174 | 174 | ||
| 175 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 175 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 176 | SOC_DTS_TE_AUX0 + thres_index, | 176 | SOC_DTS_TE_AUX0 + thres_index, |
| 177 | te_out); | 177 | te_out); |
| 178 | if (status) | 178 | if (status) |
| @@ -182,13 +182,13 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts, | |||
| 182 | 182 | ||
| 183 | return 0; | 183 | return 0; |
| 184 | err_restore_te_out: | 184 | err_restore_te_out: |
| 185 | iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 185 | iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 186 | SOC_DTS_OFFSET_PTMC, store_te_out); | 186 | SOC_DTS_OFFSET_PTMC, store_te_out); |
| 187 | err_restore_ptmc: | 187 | err_restore_ptmc: |
| 188 | iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 188 | iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 189 | SOC_DTS_OFFSET_PTMC, store_ptmc); | 189 | SOC_DTS_OFFSET_PTMC, store_ptmc); |
| 190 | err_restore_ptps: | 190 | err_restore_ptps: |
| 191 | iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 191 | iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 192 | SOC_DTS_OFFSET_PTPS, store_ptps); | 192 | SOC_DTS_OFFSET_PTPS, store_ptps); |
| 193 | /* Nothing we can do if restore fails */ | 193 | /* Nothing we can do if restore fails */ |
| 194 | 194 | ||
| @@ -235,7 +235,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, | |||
| 235 | 235 | ||
| 236 | dts = tzd->devdata; | 236 | dts = tzd->devdata; |
| 237 | sensors = dts->sensors; | 237 | sensors = dts->sensors; |
| 238 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 238 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 239 | SOC_DTS_OFFSET_TEMP, &out); | 239 | SOC_DTS_OFFSET_TEMP, &out); |
| 240 | if (status) | 240 | if (status) |
| 241 | return status; | 241 | return status; |
| @@ -259,14 +259,14 @@ static int soc_dts_enable(int id) | |||
| 259 | u32 out; | 259 | u32 out; |
| 260 | int ret; | 260 | int ret; |
| 261 | 261 | ||
| 262 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 262 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 263 | SOC_DTS_OFFSET_ENABLE, &out); | 263 | SOC_DTS_OFFSET_ENABLE, &out); |
| 264 | if (ret) | 264 | if (ret) |
| 265 | return ret; | 265 | return ret; |
| 266 | 266 | ||
| 267 | if (!(out & BIT(id))) { | 267 | if (!(out & BIT(id))) { |
| 268 | out |= BIT(id); | 268 | out |= BIT(id); |
| 269 | ret = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 269 | ret = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 270 | SOC_DTS_OFFSET_ENABLE, out); | 270 | SOC_DTS_OFFSET_ENABLE, out); |
| 271 | if (ret) | 271 | if (ret) |
| 272 | return ret; | 272 | return ret; |
| @@ -278,7 +278,7 @@ static int soc_dts_enable(int id) | |||
| 278 | static void remove_dts_thermal_zone(struct intel_soc_dts_sensor_entry *dts) | 278 | static void remove_dts_thermal_zone(struct intel_soc_dts_sensor_entry *dts) |
| 279 | { | 279 | { |
| 280 | if (dts) { | 280 | if (dts) { |
| 281 | iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 281 | iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 282 | SOC_DTS_OFFSET_ENABLE, dts->store_status); | 282 | SOC_DTS_OFFSET_ENABLE, dts->store_status); |
| 283 | thermal_zone_device_unregister(dts->tzone); | 283 | thermal_zone_device_unregister(dts->tzone); |
| 284 | } | 284 | } |
| @@ -296,9 +296,8 @@ static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts, | |||
| 296 | int i; | 296 | int i; |
| 297 | 297 | ||
| 298 | /* Store status to restor on exit */ | 298 | /* Store status to restor on exit */ |
| 299 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 299 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 300 | SOC_DTS_OFFSET_ENABLE, | 300 | SOC_DTS_OFFSET_ENABLE, &dts->store_status); |
| 301 | &dts->store_status); | ||
| 302 | if (ret) | 301 | if (ret) |
| 303 | goto err_ret; | 302 | goto err_ret; |
| 304 | 303 | ||
| @@ -311,7 +310,7 @@ static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts, | |||
| 311 | } | 310 | } |
| 312 | 311 | ||
| 313 | /* Check if the writable trip we provide is not used by BIOS */ | 312 | /* Check if the writable trip we provide is not used by BIOS */ |
| 314 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 313 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 315 | SOC_DTS_OFFSET_PTPS, &store_ptps); | 314 | SOC_DTS_OFFSET_PTPS, &store_ptps); |
| 316 | if (ret) | 315 | if (ret) |
| 317 | trip_mask = 0; | 316 | trip_mask = 0; |
| @@ -374,19 +373,19 @@ void intel_soc_dts_iosf_interrupt_handler(struct intel_soc_dts_sensors *sensors) | |||
| 374 | 373 | ||
| 375 | spin_lock_irqsave(&sensors->intr_notify_lock, flags); | 374 | spin_lock_irqsave(&sensors->intr_notify_lock, flags); |
| 376 | 375 | ||
| 377 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 376 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 378 | SOC_DTS_OFFSET_PTMC, &ptmc_out); | 377 | SOC_DTS_OFFSET_PTMC, &ptmc_out); |
| 379 | ptmc_out |= SOC_DTS_PTMC_APIC_DEASSERT_BIT; | 378 | ptmc_out |= SOC_DTS_PTMC_APIC_DEASSERT_BIT; |
| 380 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 379 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 381 | SOC_DTS_OFFSET_PTMC, ptmc_out); | 380 | SOC_DTS_OFFSET_PTMC, ptmc_out); |
| 382 | 381 | ||
| 383 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 382 | status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, |
| 384 | SOC_DTS_OFFSET_PTTSS, &sticky_out); | 383 | SOC_DTS_OFFSET_PTTSS, &sticky_out); |
| 385 | pr_debug("status %d PTTSS %x\n", status, sticky_out); | 384 | pr_debug("status %d PTTSS %x\n", status, sticky_out); |
| 386 | if (sticky_out & SOC_DTS_TRIP_MASK) { | 385 | if (sticky_out & SOC_DTS_TRIP_MASK) { |
| 387 | int i; | 386 | int i; |
| 388 | /* reset sticky bit */ | 387 | /* reset sticky bit */ |
| 389 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 388 | status = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, |
| 390 | SOC_DTS_OFFSET_PTTSS, sticky_out); | 389 | SOC_DTS_OFFSET_PTTSS, sticky_out); |
| 391 | spin_unlock_irqrestore(&sensors->intr_notify_lock, flags); | 390 | spin_unlock_irqrestore(&sensors->intr_notify_lock, flags); |
| 392 | 391 | ||
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 204f5819d464..cd84b12d1e60 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
| @@ -126,8 +126,9 @@ struct acpi_exception_info { | |||
| 126 | #define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B) | 126 | #define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B) |
| 127 | #define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) | 127 | #define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) |
| 128 | #define AE_ACCESS EXCEP_ENV (0x001D) | 128 | #define AE_ACCESS EXCEP_ENV (0x001D) |
| 129 | #define AE_IO_ERROR EXCEP_ENV (0x001E) | ||
| 129 | 130 | ||
| 130 | #define AE_CODE_ENV_MAX 0x001D | 131 | #define AE_CODE_ENV_MAX 0x001E |
| 131 | 132 | ||
| 132 | /* | 133 | /* |
| 133 | * Programmer exceptions | 134 | * Programmer exceptions |
| @@ -263,7 +264,8 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = { | |||
| 263 | "There are no more Owner IDs available for ACPI tables or control methods"), | 264 | "There are no more Owner IDs available for ACPI tables or control methods"), |
| 264 | EXCEP_TXT("AE_NOT_CONFIGURED", | 265 | EXCEP_TXT("AE_NOT_CONFIGURED", |
| 265 | "The interface is not part of the current subsystem configuration"), | 266 | "The interface is not part of the current subsystem configuration"), |
| 266 | EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation") | 267 | EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation"), |
| 268 | EXCEP_TXT("AE_IO_ERROR", "An I/O error occurred") | ||
| 267 | }; | 269 | }; |
| 268 | 270 | ||
| 269 | static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { | 271 | static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index ad0a5ff3d4cd..14362a84c78e 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -87,6 +87,8 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func, | |||
| 87 | .package.elements = (eles) \ | 87 | .package.elements = (eles) \ |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | bool acpi_dev_present(const char *hid); | ||
| 91 | |||
| 90 | #ifdef CONFIG_ACPI | 92 | #ifdef CONFIG_ACPI |
| 91 | 93 | ||
| 92 | #include <linux/proc_fs.h> | 94 | #include <linux/proc_fs.h> |
| @@ -631,7 +633,9 @@ static inline bool acpi_device_can_wakeup(struct acpi_device *adev) | |||
| 631 | 633 | ||
| 632 | static inline bool acpi_device_can_poweroff(struct acpi_device *adev) | 634 | static inline bool acpi_device_can_poweroff(struct acpi_device *adev) |
| 633 | { | 635 | { |
| 634 | return adev->power.states[ACPI_STATE_D3_COLD].flags.valid; | 636 | return adev->power.states[ACPI_STATE_D3_COLD].flags.valid || |
| 637 | ((acpi_gbl_FADT.header.revision < 6) && | ||
| 638 | adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set); | ||
| 635 | } | 639 | } |
| 636 | 640 | ||
| 637 | #else /* CONFIG_ACPI */ | 641 | #else /* CONFIG_ACPI */ |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index fbc2baf2b9dc..0d824a28522d 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
| @@ -349,12 +349,28 @@ void acpi_os_redirect_output(void *destination); | |||
| 349 | #endif | 349 | #endif |
| 350 | 350 | ||
| 351 | /* | 351 | /* |
| 352 | * Debug input | 352 | * Debug IO |
| 353 | */ | 353 | */ |
| 354 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line | 354 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line |
| 355 | acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read); | 355 | acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read); |
| 356 | #endif | 356 | #endif |
| 357 | 357 | ||
| 358 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize_command_signals | ||
| 359 | acpi_status acpi_os_initialize_command_signals(void); | ||
| 360 | #endif | ||
| 361 | |||
| 362 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate_command_signals | ||
| 363 | void acpi_os_terminate_command_signals(void); | ||
| 364 | #endif | ||
| 365 | |||
| 366 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_command_ready | ||
| 367 | acpi_status acpi_os_wait_command_ready(void); | ||
| 368 | #endif | ||
| 369 | |||
| 370 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_notify_command_complete | ||
| 371 | acpi_status acpi_os_notify_command_complete(void); | ||
| 372 | #endif | ||
| 373 | |||
| 358 | /* | 374 | /* |
| 359 | * Obtain ACPI table(s) | 375 | * Obtain ACPI table(s) |
| 360 | */ | 376 | */ |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 3aaaa8630735..012b2eed7a93 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 47 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
| 48 | 48 | ||
| 49 | #define ACPI_CA_VERSION 0x20150930 | 49 | #define ACPI_CA_VERSION 0x20151218 |
| 50 | 50 | ||
| 51 | #include <acpi/acconfig.h> | 51 | #include <acpi/acconfig.h> |
| 52 | #include <acpi/actypes.h> | 52 | #include <acpi/actypes.h> |
| @@ -190,6 +190,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE); | |||
| 190 | ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); | 190 | ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); |
| 191 | 191 | ||
| 192 | /* | 192 | /* |
| 193 | * Optionally support group module level code. | ||
| 194 | */ | ||
| 195 | ACPI_INIT_GLOBAL(u8, acpi_gbl_group_module_level_code, TRUE); | ||
| 196 | |||
| 197 | /* | ||
| 193 | * Optionally use 32-bit FADT addresses if and when there is a conflict | 198 | * Optionally use 32-bit FADT addresses if and when there is a conflict |
| 194 | * (address mismatch) between the 32-bit and 64-bit versions of the | 199 | * (address mismatch) between the 32-bit and 64-bit versions of the |
| 195 | * address. Although ACPICA adheres to the ACPI specification which | 200 | * address. Although ACPICA adheres to the ACPI specification which |
| @@ -263,6 +268,19 @@ ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_dbg_layer, ACPI_TRACE_LAYER_DEFAULT); | |||
| 263 | ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT); | 268 | ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT); |
| 264 | ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0); | 269 | ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0); |
| 265 | 270 | ||
| 271 | /* Optionally enable timer output with Debug Object output */ | ||
| 272 | |||
| 273 | ACPI_INIT_GLOBAL(u8, acpi_gbl_display_debug_timer, FALSE); | ||
| 274 | |||
| 275 | /* | ||
| 276 | * Debugger command handshake globals. Host OSes need to access these | ||
| 277 | * variables to implement their own command handshake mechanism. | ||
| 278 | */ | ||
| 279 | #ifdef ACPI_DEBUGGER | ||
| 280 | ACPI_INIT_GLOBAL(u8, acpi_gbl_method_executing, FALSE); | ||
| 281 | ACPI_GLOBAL(char, acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]); | ||
| 282 | #endif | ||
| 283 | |||
| 266 | /* | 284 | /* |
| 267 | * Other miscellaneous globals | 285 | * Other miscellaneous globals |
| 268 | */ | 286 | */ |
| @@ -366,6 +384,29 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); | |||
| 366 | 384 | ||
| 367 | #endif /* ACPI_APPLICATION */ | 385 | #endif /* ACPI_APPLICATION */ |
| 368 | 386 | ||
| 387 | /* | ||
| 388 | * Debugger prototypes | ||
| 389 | * | ||
| 390 | * All interfaces used by debugger will be configured | ||
| 391 | * out of the ACPICA build unless the ACPI_DEBUGGER | ||
| 392 | * flag is defined. | ||
| 393 | */ | ||
| 394 | #ifdef ACPI_DEBUGGER | ||
| 395 | #define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \ | ||
| 396 | ACPI_EXTERNAL_RETURN_OK(prototype) | ||
| 397 | |||
| 398 | #define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \ | ||
| 399 | ACPI_EXTERNAL_RETURN_VOID(prototype) | ||
| 400 | |||
| 401 | #else | ||
| 402 | #define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \ | ||
| 403 | static ACPI_INLINE prototype {return(AE_OK);} | ||
| 404 | |||
| 405 | #define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \ | ||
| 406 | static ACPI_INLINE prototype {return;} | ||
| 407 | |||
| 408 | #endif /* ACPI_DEBUGGER */ | ||
| 409 | |||
| 369 | /***************************************************************************** | 410 | /***************************************************************************** |
| 370 | * | 411 | * |
| 371 | * ACPICA public interface prototypes | 412 | * ACPICA public interface prototypes |
| @@ -822,17 +863,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status | |||
| 822 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) | 863 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) |
| 823 | 864 | ||
| 824 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | 865 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
| 825 | acpi_set_firmware_waking_vectors | 866 | acpi_set_firmware_waking_vector |
| 826 | (acpi_physical_address physical_address, | 867 | (acpi_physical_address physical_address, |
| 827 | acpi_physical_address physical_address64)) | 868 | acpi_physical_address physical_address64)) |
| 828 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
| 829 | acpi_set_firmware_waking_vector(u32 | ||
| 830 | physical_address)) | ||
| 831 | #if ACPI_MACHINE_WIDTH == 64 | ||
| 832 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
| 833 | acpi_set_firmware_waking_vector64(u64 | ||
| 834 | physical_address)) | ||
| 835 | #endif | ||
| 836 | /* | 869 | /* |
| 837 | * ACPI Timer interfaces | 870 | * ACPI Timer interfaces |
| 838 | */ | 871 | */ |
| @@ -929,6 +962,8 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status | |||
| 929 | void **data, | 962 | void **data, |
| 930 | void (*callback)(void *))) | 963 | void (*callback)(void *))) |
| 931 | 964 | ||
| 965 | void acpi_run_debugger(char *batch_buffer); | ||
| 966 | |||
| 932 | void acpi_set_debugger_thread_id(acpi_thread_id thread_id); | 967 | void acpi_set_debugger_thread_id(acpi_thread_id thread_id); |
| 933 | 968 | ||
| 934 | #endif /* __ACXFACE_H__ */ | 969 | #endif /* __ACXFACE_H__ */ |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index f914958c4adb..9633f606d89e 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -1148,7 +1148,7 @@ u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported); | |||
| 1148 | 1148 | ||
| 1149 | #define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ | 1149 | #define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ |
| 1150 | 1150 | ||
| 1151 | /* Structures used for device/processor HID, UID, CID, and SUB */ | 1151 | /* Structures used for device/processor HID, UID, CID */ |
| 1152 | 1152 | ||
| 1153 | struct acpi_pnp_device_id { | 1153 | struct acpi_pnp_device_id { |
| 1154 | u32 length; /* Length of string + null */ | 1154 | u32 length; /* Length of string + null */ |
| @@ -1178,7 +1178,6 @@ struct acpi_device_info { | |||
| 1178 | u64 address; /* _ADR value */ | 1178 | u64 address; /* _ADR value */ |
| 1179 | struct acpi_pnp_device_id hardware_id; /* _HID value */ | 1179 | struct acpi_pnp_device_id hardware_id; /* _HID value */ |
| 1180 | struct acpi_pnp_device_id unique_id; /* _UID value */ | 1180 | struct acpi_pnp_device_id unique_id; /* _UID value */ |
| 1181 | struct acpi_pnp_device_id subsystem_id; /* _SUB value */ | ||
| 1182 | struct acpi_pnp_device_id class_code; /* _CLS value */ | 1181 | struct acpi_pnp_device_id class_code; /* _CLS value */ |
| 1183 | struct acpi_pnp_device_id_list compatible_id_list; /* _CID list <must be last> */ | 1182 | struct acpi_pnp_device_id_list compatible_id_list; /* _CID list <must be last> */ |
| 1184 | }; | 1183 | }; |
| @@ -1193,13 +1192,12 @@ struct acpi_device_info { | |||
| 1193 | #define ACPI_VALID_ADR 0x0002 | 1192 | #define ACPI_VALID_ADR 0x0002 |
| 1194 | #define ACPI_VALID_HID 0x0004 | 1193 | #define ACPI_VALID_HID 0x0004 |
| 1195 | #define ACPI_VALID_UID 0x0008 | 1194 | #define ACPI_VALID_UID 0x0008 |
| 1196 | #define ACPI_VALID_SUB 0x0010 | ||
| 1197 | #define ACPI_VALID_CID 0x0020 | 1195 | #define ACPI_VALID_CID 0x0020 |
| 1198 | #define ACPI_VALID_CLS 0x0040 | 1196 | #define ACPI_VALID_CLS 0x0040 |
| 1199 | #define ACPI_VALID_SXDS 0x0100 | 1197 | #define ACPI_VALID_SXDS 0x0100 |
| 1200 | #define ACPI_VALID_SXWS 0x0200 | 1198 | #define ACPI_VALID_SXWS 0x0200 |
| 1201 | 1199 | ||
| 1202 | /* Flags for _STA return value (current_status above) */ | 1200 | /* Flags for _STA method */ |
| 1203 | 1201 | ||
| 1204 | #define ACPI_STA_DEVICE_PRESENT 0x01 | 1202 | #define ACPI_STA_DEVICE_PRESENT 0x01 |
| 1205 | #define ACPI_STA_DEVICE_ENABLED 0x02 | 1203 | #define ACPI_STA_DEVICE_ENABLED 0x02 |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 323e5daece54..e21857d2ec05 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
| @@ -150,6 +150,8 @@ | |||
| 150 | */ | 150 | */ |
| 151 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable | 151 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable |
| 152 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable | 152 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable |
| 153 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize_command_signals | ||
| 154 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate_command_signals | ||
| 153 | 155 | ||
| 154 | /* | 156 | /* |
| 155 | * OSL interfaces used by utilities | 157 | * OSL interfaces used by utilities |
diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h index fd6d70fe1219..f903fe64259a 100644 --- a/include/acpi/platform/aclinuxex.h +++ b/include/acpi/platform/aclinuxex.h | |||
| @@ -129,6 +129,16 @@ static inline u8 acpi_os_readable(void *pointer, acpi_size length) | |||
| 129 | return TRUE; | 129 | return TRUE; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | static inline acpi_status acpi_os_initialize_command_signals(void) | ||
| 133 | { | ||
| 134 | return AE_OK; | ||
| 135 | } | ||
| 136 | |||
| 137 | static inline void acpi_os_terminate_command_signals(void) | ||
| 138 | { | ||
| 139 | return; | ||
| 140 | } | ||
| 141 | |||
| 132 | /* | 142 | /* |
| 133 | * OSL interfaces added by Linux | 143 | * OSL interfaces added by Linux |
| 134 | */ | 144 | */ |
diff --git a/include/acpi/video.h b/include/acpi/video.h index c62392d9b52a..f11d342b4567 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __ACPI_VIDEO_H | 2 | #define __ACPI_VIDEO_H |
| 3 | 3 | ||
| 4 | #include <linux/errno.h> /* for ENODEV */ | 4 | #include <linux/errno.h> /* for ENODEV */ |
| 5 | #include <linux/types.h> /* for bool */ | ||
| 5 | 6 | ||
| 6 | struct acpi_device; | 7 | struct acpi_device; |
| 7 | 8 | ||
| @@ -31,6 +32,7 @@ extern int acpi_video_get_edid(struct acpi_device *device, int type, | |||
| 31 | int device_id, void **edid); | 32 | int device_id, void **edid); |
| 32 | extern enum acpi_backlight_type acpi_video_get_backlight_type(void); | 33 | extern enum acpi_backlight_type acpi_video_get_backlight_type(void); |
| 33 | extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); | 34 | extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); |
| 35 | extern bool acpi_video_handles_brightness_key_presses(void); | ||
| 34 | #else | 36 | #else |
| 35 | static inline int acpi_video_register(void) { return 0; } | 37 | static inline int acpi_video_register(void) { return 0; } |
| 36 | static inline void acpi_video_unregister(void) { return; } | 38 | static inline void acpi_video_unregister(void) { return; } |
| @@ -46,6 +48,10 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void) | |||
| 46 | static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) | 48 | static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) |
| 47 | { | 49 | { |
| 48 | } | 50 | } |
| 51 | static inline bool acpi_video_handles_brightness_key_presses(void) | ||
| 52 | { | ||
| 53 | return false; | ||
| 54 | } | ||
| 49 | #endif | 55 | #endif |
| 50 | 56 | ||
| 51 | #endif | 57 | #endif |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 1991aea2ec4c..06ed7e54033e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -37,6 +37,8 @@ | |||
| 37 | #include <linux/list.h> | 37 | #include <linux/list.h> |
| 38 | #include <linux/mod_devicetable.h> | 38 | #include <linux/mod_devicetable.h> |
| 39 | #include <linux/dynamic_debug.h> | 39 | #include <linux/dynamic_debug.h> |
| 40 | #include <linux/module.h> | ||
| 41 | #include <linux/mutex.h> | ||
| 40 | 42 | ||
| 41 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
| 42 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
| @@ -119,6 +121,75 @@ typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table); | |||
| 119 | typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header, | 121 | typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header, |
| 120 | const unsigned long end); | 122 | const unsigned long end); |
| 121 | 123 | ||
| 124 | /* Debugger support */ | ||
| 125 | |||
| 126 | struct acpi_debugger_ops { | ||
| 127 | int (*create_thread)(acpi_osd_exec_callback function, void *context); | ||
| 128 | ssize_t (*write_log)(const char *msg); | ||
| 129 | ssize_t (*read_cmd)(char *buffer, size_t length); | ||
| 130 | int (*wait_command_ready)(bool single_step, char *buffer, size_t length); | ||
| 131 | int (*notify_command_complete)(void); | ||
| 132 | }; | ||
| 133 | |||
| 134 | struct acpi_debugger { | ||
| 135 | const struct acpi_debugger_ops *ops; | ||
| 136 | struct module *owner; | ||
| 137 | struct mutex lock; | ||
| 138 | }; | ||
| 139 | |||
| 140 | #ifdef CONFIG_ACPI_DEBUGGER | ||
| 141 | int __init acpi_debugger_init(void); | ||
| 142 | int acpi_register_debugger(struct module *owner, | ||
| 143 | const struct acpi_debugger_ops *ops); | ||
| 144 | void acpi_unregister_debugger(const struct acpi_debugger_ops *ops); | ||
| 145 | int acpi_debugger_create_thread(acpi_osd_exec_callback function, void *context); | ||
| 146 | ssize_t acpi_debugger_write_log(const char *msg); | ||
| 147 | ssize_t acpi_debugger_read_cmd(char *buffer, size_t buffer_length); | ||
| 148 | int acpi_debugger_wait_command_ready(void); | ||
| 149 | int acpi_debugger_notify_command_complete(void); | ||
| 150 | #else | ||
| 151 | static inline int acpi_debugger_init(void) | ||
| 152 | { | ||
| 153 | return -ENODEV; | ||
| 154 | } | ||
| 155 | |||
| 156 | static inline int acpi_register_debugger(struct module *owner, | ||
| 157 | const struct acpi_debugger_ops *ops) | ||
| 158 | { | ||
| 159 | return -ENODEV; | ||
| 160 | } | ||
| 161 | |||
| 162 | static inline void acpi_unregister_debugger(const struct acpi_debugger_ops *ops) | ||
| 163 | { | ||
| 164 | } | ||
| 165 | |||
| 166 | static inline int acpi_debugger_create_thread(acpi_osd_exec_callback function, | ||
| 167 | void *context) | ||
| 168 | { | ||
| 169 | return -ENODEV; | ||
| 170 | } | ||
| 171 | |||
| 172 | static inline int acpi_debugger_write_log(const char *msg) | ||
| 173 | { | ||
| 174 | return -ENODEV; | ||
| 175 | } | ||
| 176 | |||
| 177 | static inline int acpi_debugger_read_cmd(char *buffer, u32 buffer_length) | ||
| 178 | { | ||
| 179 | return -ENODEV; | ||
| 180 | } | ||
| 181 | |||
| 182 | static inline int acpi_debugger_wait_command_ready(void) | ||
| 183 | { | ||
| 184 | return -ENODEV; | ||
| 185 | } | ||
| 186 | |||
| 187 | static inline int acpi_debugger_notify_command_complete(void) | ||
| 188 | { | ||
| 189 | return -ENODEV; | ||
| 190 | } | ||
| 191 | #endif | ||
| 192 | |||
| 122 | #ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE | 193 | #ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE |
| 123 | void acpi_initrd_override(void *data, size_t size); | 194 | void acpi_initrd_override(void *data, size_t size); |
| 124 | #else | 195 | #else |
| @@ -318,6 +389,7 @@ bool acpi_dev_resource_address_space(struct acpi_resource *ares, | |||
| 318 | bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, | 389 | bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, |
| 319 | struct resource_win *win); | 390 | struct resource_win *win); |
| 320 | unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); | 391 | unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); |
| 392 | unsigned int acpi_dev_get_irq_type(int triggering, int polarity); | ||
| 321 | bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, | 393 | bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, |
| 322 | struct resource *res); | 394 | struct resource *res); |
| 323 | 395 | ||
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 177c7680c1a8..88a4215125bc 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -278,7 +278,6 @@ struct cpufreq_driver { | |||
| 278 | struct freq_attr **attr; | 278 | struct freq_attr **attr; |
| 279 | 279 | ||
| 280 | /* platform specific boost support code */ | 280 | /* platform specific boost support code */ |
| 281 | bool boost_supported; | ||
| 282 | bool boost_enabled; | 281 | bool boost_enabled; |
| 283 | int (*set_boost)(int state); | 282 | int (*set_boost)(int state); |
| 284 | }; | 283 | }; |
| @@ -574,7 +573,6 @@ ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); | |||
| 574 | 573 | ||
| 575 | #ifdef CONFIG_CPU_FREQ | 574 | #ifdef CONFIG_CPU_FREQ |
| 576 | int cpufreq_boost_trigger_state(int state); | 575 | int cpufreq_boost_trigger_state(int state); |
| 577 | int cpufreq_boost_supported(void); | ||
| 578 | int cpufreq_boost_enabled(void); | 576 | int cpufreq_boost_enabled(void); |
| 579 | int cpufreq_enable_boost_support(void); | 577 | int cpufreq_enable_boost_support(void); |
| 580 | bool policy_has_boost_freq(struct cpufreq_policy *policy); | 578 | bool policy_has_boost_freq(struct cpufreq_policy *policy); |
| @@ -583,10 +581,6 @@ static inline int cpufreq_boost_trigger_state(int state) | |||
| 583 | { | 581 | { |
| 584 | return 0; | 582 | return 0; |
| 585 | } | 583 | } |
| 586 | static inline int cpufreq_boost_supported(void) | ||
| 587 | { | ||
| 588 | return 0; | ||
| 589 | } | ||
| 590 | static inline int cpufreq_boost_enabled(void) | 584 | static inline int cpufreq_boost_enabled(void) |
| 591 | { | 585 | { |
| 592 | return 0; | 586 | return 0; |
diff --git a/include/linux/device.h b/include/linux/device.h index b8f411b57dcb..f627ba20a46c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -191,6 +191,7 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
| 191 | unbound */ | 191 | unbound */ |
| 192 | #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound | 192 | #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound |
| 193 | from the device */ | 193 | from the device */ |
| 194 | #define BUS_NOTIFY_DRIVER_NOT_BOUND 0x00000008 /* driver fails to be bound */ | ||
| 194 | 195 | ||
| 195 | extern struct kset *bus_get_kset(struct bus_type *bus); | 196 | extern struct kset *bus_get_kset(struct bus_type *bus); |
| 196 | extern struct klist *bus_get_device_klist(struct bus_type *bus); | 197 | extern struct klist *bus_get_device_klist(struct bus_type *bus); |
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index 27dac3ff18b9..bc6f7e00fb3d 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 18 | 18 | ||
| 19 | struct irq_domain; | 19 | struct irq_domain; |
| 20 | struct property_set; | ||
| 20 | 21 | ||
| 21 | /* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */ | 22 | /* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */ |
| 22 | struct mfd_cell_acpi_match { | 23 | struct mfd_cell_acpi_match { |
| @@ -44,6 +45,10 @@ struct mfd_cell { | |||
| 44 | /* platform data passed to the sub devices drivers */ | 45 | /* platform data passed to the sub devices drivers */ |
| 45 | void *platform_data; | 46 | void *platform_data; |
| 46 | size_t pdata_size; | 47 | size_t pdata_size; |
| 48 | |||
| 49 | /* device properties passed to the sub devices drivers */ | ||
| 50 | const struct property_set *pset; | ||
| 51 | |||
| 47 | /* | 52 | /* |
| 48 | * Device Tree compatible string | 53 | * Device Tree compatible string |
| 49 | * See: Documentation/devicetree/usage-model.txt Chapter 2.2 for details | 54 | * See: Documentation/devicetree/usage-model.txt Chapter 2.2 for details |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 6abd019c76f8..03b755521fd9 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #define PLATFORM_DEVID_AUTO (-2) | 18 | #define PLATFORM_DEVID_AUTO (-2) |
| 19 | 19 | ||
| 20 | struct mfd_cell; | 20 | struct mfd_cell; |
| 21 | struct property_set; | ||
| 21 | 22 | ||
| 22 | struct platform_device { | 23 | struct platform_device { |
| 23 | const char *name; | 24 | const char *name; |
| @@ -71,6 +72,8 @@ struct platform_device_info { | |||
| 71 | const void *data; | 72 | const void *data; |
| 72 | size_t size_data; | 73 | size_t size_data; |
| 73 | u64 dma_mask; | 74 | u64 dma_mask; |
| 75 | |||
| 76 | const struct property_set *pset; | ||
| 74 | }; | 77 | }; |
| 75 | extern struct platform_device *platform_device_register_full( | 78 | extern struct platform_device *platform_device_register_full( |
| 76 | const struct platform_device_info *pdevinfo); | 79 | const struct platform_device_info *pdevinfo); |
| @@ -168,6 +171,8 @@ extern int platform_device_add_resources(struct platform_device *pdev, | |||
| 168 | unsigned int num); | 171 | unsigned int num); |
| 169 | extern int platform_device_add_data(struct platform_device *pdev, | 172 | extern int platform_device_add_data(struct platform_device *pdev, |
| 170 | const void *data, size_t size); | 173 | const void *data, size_t size); |
| 174 | extern int platform_device_add_properties(struct platform_device *pdev, | ||
| 175 | const struct property_set *pset); | ||
| 171 | extern int platform_device_add(struct platform_device *pdev); | 176 | extern int platform_device_add(struct platform_device *pdev); |
| 172 | extern void platform_device_del(struct platform_device *pdev); | 177 | extern void platform_device_del(struct platform_device *pdev); |
| 173 | extern void platform_device_put(struct platform_device *pdev); | 178 | extern void platform_device_put(struct platform_device *pdev); |
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 9a2e50337af9..95403d2ccaf5 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h | |||
| @@ -55,6 +55,11 @@ int dev_pm_opp_enable(struct device *dev, unsigned long freq); | |||
| 55 | int dev_pm_opp_disable(struct device *dev, unsigned long freq); | 55 | int dev_pm_opp_disable(struct device *dev, unsigned long freq); |
| 56 | 56 | ||
| 57 | struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev); | 57 | struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev); |
| 58 | int dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, | ||
| 59 | unsigned int count); | ||
| 60 | void dev_pm_opp_put_supported_hw(struct device *dev); | ||
| 61 | int dev_pm_opp_set_prop_name(struct device *dev, const char *name); | ||
| 62 | void dev_pm_opp_put_prop_name(struct device *dev); | ||
| 58 | #else | 63 | #else |
| 59 | static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp) | 64 | static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp) |
| 60 | { | 65 | { |
| @@ -129,6 +134,23 @@ static inline struct srcu_notifier_head *dev_pm_opp_get_notifier( | |||
| 129 | { | 134 | { |
| 130 | return ERR_PTR(-EINVAL); | 135 | return ERR_PTR(-EINVAL); |
| 131 | } | 136 | } |
| 137 | |||
| 138 | static inline int dev_pm_opp_set_supported_hw(struct device *dev, | ||
| 139 | const u32 *versions, | ||
| 140 | unsigned int count) | ||
| 141 | { | ||
| 142 | return -EINVAL; | ||
| 143 | } | ||
| 144 | |||
| 145 | static inline void dev_pm_opp_put_supported_hw(struct device *dev) {} | ||
| 146 | |||
| 147 | static inline int dev_pm_opp_set_prop_name(struct device *dev, const char *name) | ||
| 148 | { | ||
| 149 | return -EINVAL; | ||
| 150 | } | ||
| 151 | |||
| 152 | static inline void dev_pm_opp_put_prop_name(struct device *dev) {} | ||
| 153 | |||
| 132 | #endif /* CONFIG_PM_OPP */ | 154 | #endif /* CONFIG_PM_OPP */ |
| 133 | 155 | ||
| 134 | #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) | 156 | #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 3bdbb4189780..7af093d6a4dd 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -39,6 +39,7 @@ extern int pm_runtime_force_resume(struct device *dev); | |||
| 39 | extern int __pm_runtime_idle(struct device *dev, int rpmflags); | 39 | extern int __pm_runtime_idle(struct device *dev, int rpmflags); |
| 40 | extern int __pm_runtime_suspend(struct device *dev, int rpmflags); | 40 | extern int __pm_runtime_suspend(struct device *dev, int rpmflags); |
| 41 | extern int __pm_runtime_resume(struct device *dev, int rpmflags); | 41 | extern int __pm_runtime_resume(struct device *dev, int rpmflags); |
| 42 | extern int pm_runtime_get_if_in_use(struct device *dev); | ||
| 42 | extern int pm_schedule_suspend(struct device *dev, unsigned int delay); | 43 | extern int pm_schedule_suspend(struct device *dev, unsigned int delay); |
| 43 | extern int __pm_runtime_set_status(struct device *dev, unsigned int status); | 44 | extern int __pm_runtime_set_status(struct device *dev, unsigned int status); |
| 44 | extern int pm_runtime_barrier(struct device *dev); | 45 | extern int pm_runtime_barrier(struct device *dev); |
| @@ -143,6 +144,10 @@ static inline int pm_schedule_suspend(struct device *dev, unsigned int delay) | |||
| 143 | { | 144 | { |
| 144 | return -ENOSYS; | 145 | return -ENOSYS; |
| 145 | } | 146 | } |
| 147 | static inline int pm_runtime_get_if_in_use(struct device *dev) | ||
| 148 | { | ||
| 149 | return -EINVAL; | ||
| 150 | } | ||
| 146 | static inline int __pm_runtime_set_status(struct device *dev, | 151 | static inline int __pm_runtime_set_status(struct device *dev, |
| 147 | unsigned int status) { return 0; } | 152 | unsigned int status) { return 0; } |
| 148 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } | 153 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } |
diff --git a/include/linux/powercap.h b/include/linux/powercap.h index 4e250417ee30..f0a4e6257dcc 100644 --- a/include/linux/powercap.h +++ b/include/linux/powercap.h | |||
| @@ -208,7 +208,7 @@ struct powercap_zone_constraint_ops { | |||
| 208 | struct powercap_zone_constraint { | 208 | struct powercap_zone_constraint { |
| 209 | int id; | 209 | int id; |
| 210 | struct powercap_zone *power_zone; | 210 | struct powercap_zone *power_zone; |
| 211 | struct powercap_zone_constraint_ops *ops; | 211 | const struct powercap_zone_constraint_ops *ops; |
| 212 | }; | 212 | }; |
| 213 | 213 | ||
| 214 | 214 | ||
| @@ -309,7 +309,7 @@ struct powercap_zone *powercap_register_zone( | |||
| 309 | struct powercap_zone *parent, | 309 | struct powercap_zone *parent, |
| 310 | const struct powercap_zone_ops *ops, | 310 | const struct powercap_zone_ops *ops, |
| 311 | int nr_constraints, | 311 | int nr_constraints, |
| 312 | struct powercap_zone_constraint_ops *const_ops); | 312 | const struct powercap_zone_constraint_ops *const_ops); |
| 313 | 313 | ||
| 314 | /** | 314 | /** |
| 315 | * powercap_unregister_zone() - Unregister a zone device | 315 | * powercap_unregister_zone() - Unregister a zone device |
diff --git a/include/linux/property.h b/include/linux/property.h index 0a3705a7c9f2..b51fcd36d892 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
| @@ -73,8 +73,8 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode, | |||
| 73 | struct fwnode_handle *device_get_next_child_node(struct device *dev, | 73 | struct fwnode_handle *device_get_next_child_node(struct device *dev, |
| 74 | struct fwnode_handle *child); | 74 | struct fwnode_handle *child); |
| 75 | 75 | ||
| 76 | #define device_for_each_child_node(dev, child) \ | 76 | #define device_for_each_child_node(dev, child) \ |
| 77 | for (child = device_get_next_child_node(dev, NULL); child; \ | 77 | for (child = device_get_next_child_node(dev, NULL); child; \ |
| 78 | child = device_get_next_child_node(dev, child)) | 78 | child = device_get_next_child_node(dev, child)) |
| 79 | 79 | ||
| 80 | void fwnode_handle_put(struct fwnode_handle *fwnode); | 80 | void fwnode_handle_put(struct fwnode_handle *fwnode); |
| @@ -144,24 +144,100 @@ static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode, | |||
| 144 | /** | 144 | /** |
| 145 | * struct property_entry - "Built-in" device property representation. | 145 | * struct property_entry - "Built-in" device property representation. |
| 146 | * @name: Name of the property. | 146 | * @name: Name of the property. |
| 147 | * @type: Type of the property. | 147 | * @length: Length of data making up the value. |
| 148 | * @nval: Number of items of type @type making up the value. | 148 | * @is_array: True when the property is an array. |
| 149 | * @value: Value of the property (an array of @nval items of type @type). | 149 | * @is_string: True when property is a string. |
| 150 | * @pointer: Pointer to the property (an array of items of the given type). | ||
| 151 | * @value: Value of the property (when it is a single item of the given type). | ||
| 150 | */ | 152 | */ |
| 151 | struct property_entry { | 153 | struct property_entry { |
| 152 | const char *name; | 154 | const char *name; |
| 153 | enum dev_prop_type type; | 155 | size_t length; |
| 154 | size_t nval; | 156 | bool is_array; |
| 157 | bool is_string; | ||
| 155 | union { | 158 | union { |
| 156 | void *raw_data; | 159 | union { |
| 157 | u8 *u8_data; | 160 | void *raw_data; |
| 158 | u16 *u16_data; | 161 | u8 *u8_data; |
| 159 | u32 *u32_data; | 162 | u16 *u16_data; |
| 160 | u64 *u64_data; | 163 | u32 *u32_data; |
| 161 | const char **str; | 164 | u64 *u64_data; |
| 162 | } value; | 165 | const char **str; |
| 166 | } pointer; | ||
| 167 | union { | ||
| 168 | unsigned long long raw_data; | ||
| 169 | u8 u8_data; | ||
| 170 | u16 u16_data; | ||
| 171 | u32 u32_data; | ||
| 172 | u64 u64_data; | ||
| 173 | const char *str; | ||
| 174 | } value; | ||
| 175 | }; | ||
| 163 | }; | 176 | }; |
| 164 | 177 | ||
| 178 | /* | ||
| 179 | * Note: the below four initializers for the anonymous union are carefully | ||
| 180 | * crafted to avoid gcc-4.4.4's problems with initialization of anon unions | ||
| 181 | * and structs. | ||
| 182 | */ | ||
| 183 | |||
| 184 | #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_) \ | ||
| 185 | { \ | ||
| 186 | .name = _name_, \ | ||
| 187 | .length = ARRAY_SIZE(_val_) * sizeof(_type_), \ | ||
| 188 | .is_array = true, \ | ||
| 189 | .is_string = false, \ | ||
| 190 | { .pointer = { _type_##_data = _val_ } }, \ | ||
| 191 | } | ||
| 192 | |||
| 193 | #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ | ||
| 194 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u8, _val_) | ||
| 195 | #define PROPERTY_ENTRY_U16_ARRAY(_name_, _val_) \ | ||
| 196 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u16, _val_) | ||
| 197 | #define PROPERTY_ENTRY_U32_ARRAY(_name_, _val_) \ | ||
| 198 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u32, _val_) | ||
| 199 | #define PROPERTY_ENTRY_U64_ARRAY(_name_, _val_) \ | ||
| 200 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, _val_) | ||
| 201 | |||
| 202 | #define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_) \ | ||
| 203 | { \ | ||
| 204 | .name = _name_, \ | ||
| 205 | .length = ARRAY_SIZE(_val_) * sizeof(const char *), \ | ||
| 206 | .is_array = true, \ | ||
| 207 | .is_string = true, \ | ||
| 208 | { .pointer = { .str = _val_ } }, \ | ||
| 209 | } | ||
| 210 | |||
| 211 | #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_) \ | ||
| 212 | { \ | ||
| 213 | .name = _name_, \ | ||
| 214 | .length = sizeof(_type_), \ | ||
| 215 | .is_string = false, \ | ||
| 216 | { .value = { ._type_##_data = _val_ } }, \ | ||
| 217 | } | ||
| 218 | |||
| 219 | #define PROPERTY_ENTRY_U8(_name_, _val_) \ | ||
| 220 | PROPERTY_ENTRY_INTEGER(_name_, u8, _val_) | ||
| 221 | #define PROPERTY_ENTRY_U16(_name_, _val_) \ | ||
| 222 | PROPERTY_ENTRY_INTEGER(_name_, u16, _val_) | ||
| 223 | #define PROPERTY_ENTRY_U32(_name_, _val_) \ | ||
| 224 | PROPERTY_ENTRY_INTEGER(_name_, u32, _val_) | ||
| 225 | #define PROPERTY_ENTRY_U64(_name_, _val_) \ | ||
| 226 | PROPERTY_ENTRY_INTEGER(_name_, u64, _val_) | ||
| 227 | |||
| 228 | #define PROPERTY_ENTRY_STRING(_name_, _val_) \ | ||
| 229 | { \ | ||
| 230 | .name = _name_, \ | ||
| 231 | .length = sizeof(_val_), \ | ||
| 232 | .is_string = true, \ | ||
| 233 | { .value = { .str = _val_ } }, \ | ||
| 234 | } | ||
| 235 | |||
| 236 | #define PROPERTY_ENTRY_BOOL(_name_) \ | ||
| 237 | { \ | ||
| 238 | .name = _name_, \ | ||
| 239 | } | ||
| 240 | |||
| 165 | /** | 241 | /** |
| 166 | * struct property_set - Collection of "built-in" device properties. | 242 | * struct property_set - Collection of "built-in" device properties. |
| 167 | * @fwnode: Handle to be pointed to by the fwnode field of struct device. | 243 | * @fwnode: Handle to be pointed to by the fwnode field of struct device. |
| @@ -172,7 +248,8 @@ struct property_set { | |||
| 172 | struct property_entry *properties; | 248 | struct property_entry *properties; |
| 173 | }; | 249 | }; |
| 174 | 250 | ||
| 175 | void device_add_property_set(struct device *dev, struct property_set *pset); | 251 | int device_add_property_set(struct device *dev, const struct property_set *pset); |
| 252 | void device_remove_property_set(struct device *dev); | ||
| 176 | 253 | ||
| 177 | bool device_dma_supported(struct device *dev); | 254 | bool device_dma_supported(struct device *dev); |
| 178 | 255 | ||
diff --git a/kernel/power/main.c b/kernel/power/main.c index b2dd4d999900..27946975eff0 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -280,13 +280,7 @@ static ssize_t pm_wakeup_irq_show(struct kobject *kobj, | |||
| 280 | return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA; | 280 | return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA; |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | static ssize_t pm_wakeup_irq_store(struct kobject *kobj, | 283 | power_attr_ro(pm_wakeup_irq); |
| 284 | struct kobj_attribute *attr, | ||
| 285 | const char *buf, size_t n) | ||
| 286 | { | ||
| 287 | return -EINVAL; | ||
| 288 | } | ||
| 289 | power_attr(pm_wakeup_irq); | ||
| 290 | 284 | ||
| 291 | #else /* !CONFIG_PM_SLEEP_DEBUG */ | 285 | #else /* !CONFIG_PM_SLEEP_DEBUG */ |
| 292 | static inline void pm_print_times_init(void) {} | 286 | static inline void pm_print_times_init(void) {} |
| @@ -564,14 +558,7 @@ static ssize_t pm_trace_dev_match_show(struct kobject *kobj, | |||
| 564 | return show_trace_dev_match(buf, PAGE_SIZE); | 558 | return show_trace_dev_match(buf, PAGE_SIZE); |
| 565 | } | 559 | } |
| 566 | 560 | ||
| 567 | static ssize_t | 561 | power_attr_ro(pm_trace_dev_match); |
| 568 | pm_trace_dev_match_store(struct kobject *kobj, struct kobj_attribute *attr, | ||
| 569 | const char *buf, size_t n) | ||
| 570 | { | ||
| 571 | return -EINVAL; | ||
| 572 | } | ||
| 573 | |||
| 574 | power_attr(pm_trace_dev_match); | ||
| 575 | 562 | ||
| 576 | #endif /* CONFIG_PM_TRACE */ | 563 | #endif /* CONFIG_PM_TRACE */ |
| 577 | 564 | ||
diff --git a/kernel/power/power.h b/kernel/power/power.h index caadb566e82b..efe1b3b17c88 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
| @@ -77,6 +77,15 @@ static struct kobj_attribute _name##_attr = { \ | |||
| 77 | .store = _name##_store, \ | 77 | .store = _name##_store, \ |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | #define power_attr_ro(_name) \ | ||
| 81 | static struct kobj_attribute _name##_attr = { \ | ||
| 82 | .attr = { \ | ||
| 83 | .name = __stringify(_name), \ | ||
| 84 | .mode = S_IRUGO, \ | ||
| 85 | }, \ | ||
| 86 | .show = _name##_show, \ | ||
| 87 | } | ||
| 88 | |||
| 80 | /* Preferred image size in bytes (default 500 MB) */ | 89 | /* Preferred image size in bytes (default 500 MB) */ |
| 81 | extern unsigned long image_size; | 90 | extern unsigned long image_size; |
| 82 | /* Size of memory reserved for drivers (default SPARE_PAGES x PAGE_SIZE) */ | 91 | /* Size of memory reserved for drivers (default SPARE_PAGES x PAGE_SIZE) */ |
diff --git a/tools/power/acpi/Makefile b/tools/power/acpi/Makefile index e882c8320135..a8bf9081512b 100644 --- a/tools/power/acpi/Makefile +++ b/tools/power/acpi/Makefile | |||
| @@ -10,18 +10,18 @@ | |||
| 10 | 10 | ||
| 11 | include ../../scripts/Makefile.include | 11 | include ../../scripts/Makefile.include |
| 12 | 12 | ||
| 13 | all: acpidump ec | 13 | all: acpidbg acpidump ec |
| 14 | clean: acpidump_clean ec_clean | 14 | clean: acpidbg_clean acpidump_clean ec_clean |
| 15 | install: acpidump_install ec_install | 15 | install: acpidbg_install acpidump_install ec_install |
| 16 | uninstall: acpidump_uninstall ec_uninstall | 16 | uninstall: acpidbg_uninstall acpidump_uninstall ec_uninstall |
| 17 | 17 | ||
| 18 | acpidump ec: FORCE | 18 | acpidbg acpidump ec: FORCE |
| 19 | $(call descend,tools/$@,all) | 19 | $(call descend,tools/$@,all) |
| 20 | acpidump_clean ec_clean: | 20 | acpidbg_clean acpidump_clean ec_clean: |
| 21 | $(call descend,tools/$(@:_clean=),clean) | 21 | $(call descend,tools/$(@:_clean=),clean) |
| 22 | acpidump_install ec_install: | 22 | acpidbg_install acpidump_install ec_install: |
| 23 | $(call descend,tools/$(@:_install=),install) | 23 | $(call descend,tools/$(@:_install=),install) |
| 24 | acpidump_uninstall ec_uninstall: | 24 | acpidbg_uninstall acpidump_uninstall ec_uninstall: |
| 25 | $(call descend,tools/$(@:_uninstall=),uninstall) | 25 | $(call descend,tools/$(@:_uninstall=),uninstall) |
| 26 | 26 | ||
| 27 | .PHONY: FORCE | 27 | .PHONY: FORCE |
diff --git a/tools/power/acpi/common/getopt.c b/tools/power/acpi/common/getopt.c index 326e826a5d20..efefe309367a 100644 --- a/tools/power/acpi/common/getopt.c +++ b/tools/power/acpi/common/getopt.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | * Option strings: | 47 | * Option strings: |
| 48 | * "f" - Option has no arguments | 48 | * "f" - Option has no arguments |
| 49 | * "f:" - Option requires an argument | 49 | * "f:" - Option requires an argument |
| 50 | * "f+" - Option has an optional argument | ||
| 50 | * "f^" - Option has optional single-char sub-options | 51 | * "f^" - Option has optional single-char sub-options |
| 51 | * "f|" - Option has required single-char sub-options | 52 | * "f|" - Option has required single-char sub-options |
| 52 | */ | 53 | */ |
| @@ -85,6 +86,7 @@ static int current_char_ptr = 1; | |||
| 85 | 86 | ||
| 86 | int acpi_getopt_argument(int argc, char **argv) | 87 | int acpi_getopt_argument(int argc, char **argv) |
| 87 | { | 88 | { |
| 89 | |||
| 88 | acpi_gbl_optind--; | 90 | acpi_gbl_optind--; |
| 89 | current_char_ptr++; | 91 | current_char_ptr++; |
| 90 | 92 | ||
diff --git a/tools/power/acpi/os_specific/service_layers/oslibcfs.c b/tools/power/acpi/os_specific/service_layers/oslibcfs.c index b51e40a9a120..6df758302604 100644 --- a/tools/power/acpi/os_specific/service_layers/oslibcfs.c +++ b/tools/power/acpi/os_specific/service_layers/oslibcfs.c | |||
| @@ -73,6 +73,7 @@ ACPI_FILE acpi_os_open_file(const char *path, u8 modes) | |||
| 73 | if (modes & ACPI_FILE_WRITING) { | 73 | if (modes & ACPI_FILE_WRITING) { |
| 74 | modes_str[i++] = 'w'; | 74 | modes_str[i++] = 'w'; |
| 75 | } | 75 | } |
| 76 | |||
| 76 | if (modes & ACPI_FILE_BINARY) { | 77 | if (modes & ACPI_FILE_BINARY) { |
| 77 | modes_str[i++] = 'b'; | 78 | modes_str[i++] = 'b'; |
| 78 | } | 79 | } |
| @@ -101,6 +102,7 @@ ACPI_FILE acpi_os_open_file(const char *path, u8 modes) | |||
| 101 | 102 | ||
| 102 | void acpi_os_close_file(ACPI_FILE file) | 103 | void acpi_os_close_file(ACPI_FILE file) |
| 103 | { | 104 | { |
| 105 | |||
| 104 | fclose(file); | 106 | fclose(file); |
| 105 | } | 107 | } |
| 106 | 108 | ||
| @@ -202,6 +204,7 @@ acpi_status acpi_os_set_file_offset(ACPI_FILE file, long offset, u8 from) | |||
| 202 | if (from == ACPI_FILE_BEGIN) { | 204 | if (from == ACPI_FILE_BEGIN) { |
| 203 | ret = fseek(file, offset, SEEK_SET); | 205 | ret = fseek(file, offset, SEEK_SET); |
| 204 | } | 206 | } |
| 207 | |||
| 205 | if (from == ACPI_FILE_END) { | 208 | if (from == ACPI_FILE_END) { |
| 206 | ret = fseek(file, offset, SEEK_END); | 209 | ret = fseek(file, offset, SEEK_END); |
| 207 | } | 210 | } |
diff --git a/tools/power/acpi/tools/acpidbg/Makefile b/tools/power/acpi/tools/acpidbg/Makefile new file mode 100644 index 000000000000..352df4b41ae9 --- /dev/null +++ b/tools/power/acpi/tools/acpidbg/Makefile | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # tools/power/acpi/tools/acpidbg/Makefile - ACPI tool Makefile | ||
| 2 | # | ||
| 3 | # Copyright (c) 2015, Intel Corporation | ||
| 4 | # Author: Lv Zheng <lv.zheng@intel.com> | ||
| 5 | # | ||
| 6 | # This program is free software; you can redistribute it and/or | ||
| 7 | # modify it under the terms of the GNU General Public License | ||
| 8 | # as published by the Free Software Foundation; version 2 | ||
| 9 | # of the License. | ||
| 10 | |||
| 11 | include ../../Makefile.config | ||
| 12 | |||
| 13 | TOOL = acpidbg | ||
| 14 | vpath %.c \ | ||
| 15 | ../../../../../drivers/acpi/acpica\ | ||
| 16 | ../../common\ | ||
| 17 | ../../os_specific/service_layers\ | ||
| 18 | . | ||
| 19 | CFLAGS += -DACPI_APPLICATION -DACPI_SINGLE_THREAD -DACPI_DEBUGGER\ | ||
| 20 | -I.\ | ||
| 21 | -I../../../../../drivers/acpi/acpica\ | ||
| 22 | -I../../../../../include | ||
| 23 | LDFLAGS += -lpthread | ||
| 24 | TOOL_OBJS = \ | ||
| 25 | acpidbg.o | ||
| 26 | |||
| 27 | include ../../Makefile.rules | ||
diff --git a/tools/power/acpi/tools/acpidbg/acpidbg.c b/tools/power/acpi/tools/acpidbg/acpidbg.c new file mode 100644 index 000000000000..d070fccdba6d --- /dev/null +++ b/tools/power/acpi/tools/acpidbg/acpidbg.c | |||
| @@ -0,0 +1,438 @@ | |||
| 1 | /* | ||
| 2 | * ACPI AML interfacing userspace utility | ||
| 3 | * | ||
| 4 | * Copyright (C) 2015, Intel Corporation | ||
| 5 | * Authors: Lv Zheng <lv.zheng@intel.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <acpi/acpi.h> | ||
| 13 | |||
| 14 | /* Headers not included by include/acpi/platform/aclinux.h */ | ||
| 15 | #include <stdbool.h> | ||
| 16 | #include <fcntl.h> | ||
| 17 | #include <assert.h> | ||
| 18 | #include <linux/circ_buf.h> | ||
| 19 | |||
| 20 | #define ACPI_AML_FILE "/sys/kernel/debug/acpi/acpidbg" | ||
| 21 | #define ACPI_AML_SEC_TICK 1 | ||
| 22 | #define ACPI_AML_USEC_PEEK 200 | ||
| 23 | #define ACPI_AML_BUF_SIZE 4096 | ||
| 24 | |||
| 25 | #define ACPI_AML_BATCH_WRITE_CMD 0x00 /* Write command to kernel */ | ||
| 26 | #define ACPI_AML_BATCH_READ_LOG 0x01 /* Read log from kernel */ | ||
| 27 | #define ACPI_AML_BATCH_WRITE_LOG 0x02 /* Write log to console */ | ||
| 28 | |||
| 29 | #define ACPI_AML_LOG_START 0x00 | ||
| 30 | #define ACPI_AML_PROMPT_START 0x01 | ||
| 31 | #define ACPI_AML_PROMPT_STOP 0x02 | ||
| 32 | #define ACPI_AML_LOG_STOP 0x03 | ||
| 33 | #define ACPI_AML_PROMPT_ROLL 0x04 | ||
| 34 | |||
| 35 | #define ACPI_AML_INTERACTIVE 0x00 | ||
| 36 | #define ACPI_AML_BATCH 0x01 | ||
| 37 | |||
| 38 | #define circ_count(circ) \ | ||
| 39 | (CIRC_CNT((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 40 | #define circ_count_to_end(circ) \ | ||
| 41 | (CIRC_CNT_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 42 | #define circ_space(circ) \ | ||
| 43 | (CIRC_SPACE((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 44 | #define circ_space_to_end(circ) \ | ||
| 45 | (CIRC_SPACE_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) | ||
| 46 | |||
| 47 | #define acpi_aml_cmd_count() circ_count(&acpi_aml_cmd_crc) | ||
| 48 | #define acpi_aml_log_count() circ_count(&acpi_aml_log_crc) | ||
| 49 | #define acpi_aml_cmd_space() circ_space(&acpi_aml_cmd_crc) | ||
| 50 | #define acpi_aml_log_space() circ_space(&acpi_aml_log_crc) | ||
| 51 | |||
| 52 | #define ACPI_AML_DO(_fd, _op, _buf, _ret) \ | ||
| 53 | do { \ | ||
| 54 | _ret = acpi_aml_##_op(_fd, &acpi_aml_##_buf##_crc); \ | ||
| 55 | if (_ret == 0) { \ | ||
| 56 | fprintf(stderr, \ | ||
| 57 | "%s %s pipe closed.\n", #_buf, #_op); \ | ||
| 58 | return; \ | ||
| 59 | } \ | ||
| 60 | } while (0) | ||
| 61 | #define ACPI_AML_BATCH_DO(_fd, _op, _buf, _ret) \ | ||
| 62 | do { \ | ||
| 63 | _ret = acpi_aml_##_op##_batch_##_buf(_fd, \ | ||
| 64 | &acpi_aml_##_buf##_crc); \ | ||
| 65 | if (_ret == 0) \ | ||
| 66 | return; \ | ||
| 67 | } while (0) | ||
| 68 | |||
| 69 | |||
| 70 | static char acpi_aml_cmd_buf[ACPI_AML_BUF_SIZE]; | ||
| 71 | static char acpi_aml_log_buf[ACPI_AML_BUF_SIZE]; | ||
| 72 | static struct circ_buf acpi_aml_cmd_crc = { | ||
| 73 | .buf = acpi_aml_cmd_buf, | ||
| 74 | .head = 0, | ||
| 75 | .tail = 0, | ||
| 76 | }; | ||
| 77 | static struct circ_buf acpi_aml_log_crc = { | ||
| 78 | .buf = acpi_aml_log_buf, | ||
| 79 | .head = 0, | ||
| 80 | .tail = 0, | ||
| 81 | }; | ||
| 82 | static const char *acpi_aml_file_path = ACPI_AML_FILE; | ||
| 83 | static unsigned long acpi_aml_mode = ACPI_AML_INTERACTIVE; | ||
| 84 | static bool acpi_aml_exit; | ||
| 85 | |||
| 86 | static bool acpi_aml_batch_drain; | ||
| 87 | static unsigned long acpi_aml_batch_state; | ||
| 88 | static char acpi_aml_batch_prompt; | ||
| 89 | static char acpi_aml_batch_roll; | ||
| 90 | static unsigned long acpi_aml_log_state; | ||
| 91 | static char *acpi_aml_batch_cmd = NULL; | ||
| 92 | static char *acpi_aml_batch_pos = NULL; | ||
| 93 | |||
| 94 | static int acpi_aml_set_fl(int fd, int flags) | ||
| 95 | { | ||
| 96 | int ret; | ||
| 97 | |||
| 98 | ret = fcntl(fd, F_GETFL, 0); | ||
| 99 | if (ret < 0) { | ||
| 100 | perror("fcntl(F_GETFL)"); | ||
| 101 | return ret; | ||
| 102 | } | ||
| 103 | flags |= ret; | ||
| 104 | ret = fcntl(fd, F_SETFL, flags); | ||
| 105 | if (ret < 0) { | ||
| 106 | perror("fcntl(F_SETFL)"); | ||
| 107 | return ret; | ||
| 108 | } | ||
| 109 | return ret; | ||
| 110 | } | ||
| 111 | |||
| 112 | static int acpi_aml_set_fd(int fd, int maxfd, fd_set *set) | ||
| 113 | { | ||
| 114 | if (fd > maxfd) | ||
| 115 | maxfd = fd; | ||
| 116 | FD_SET(fd, set); | ||
| 117 | return maxfd; | ||
| 118 | } | ||
| 119 | |||
| 120 | static int acpi_aml_read(int fd, struct circ_buf *crc) | ||
| 121 | { | ||
| 122 | char *p; | ||
| 123 | int len; | ||
| 124 | |||
| 125 | p = &crc->buf[crc->head]; | ||
| 126 | len = circ_space_to_end(crc); | ||
| 127 | len = read(fd, p, len); | ||
| 128 | if (len < 0) | ||
| 129 | perror("read"); | ||
| 130 | else if (len > 0) | ||
| 131 | crc->head = (crc->head + len) & (ACPI_AML_BUF_SIZE - 1); | ||
| 132 | return len; | ||
| 133 | } | ||
| 134 | |||
| 135 | static int acpi_aml_read_batch_cmd(int unused, struct circ_buf *crc) | ||
| 136 | { | ||
| 137 | char *p; | ||
| 138 | int len; | ||
| 139 | int remained = strlen(acpi_aml_batch_pos); | ||
| 140 | |||
| 141 | p = &crc->buf[crc->head]; | ||
| 142 | len = circ_space_to_end(crc); | ||
| 143 | if (len > remained) { | ||
| 144 | memcpy(p, acpi_aml_batch_pos, remained); | ||
| 145 | acpi_aml_batch_pos += remained; | ||
| 146 | len = remained; | ||
| 147 | } else { | ||
| 148 | memcpy(p, acpi_aml_batch_pos, len); | ||
| 149 | acpi_aml_batch_pos += len; | ||
| 150 | } | ||
| 151 | if (len > 0) | ||
| 152 | crc->head = (crc->head + len) & (ACPI_AML_BUF_SIZE - 1); | ||
| 153 | return len; | ||
| 154 | } | ||
| 155 | |||
| 156 | static int acpi_aml_read_batch_log(int fd, struct circ_buf *crc) | ||
| 157 | { | ||
| 158 | char *p; | ||
| 159 | int len; | ||
| 160 | int ret = 0; | ||
| 161 | |||
| 162 | p = &crc->buf[crc->head]; | ||
| 163 | len = circ_space_to_end(crc); | ||
| 164 | while (ret < len && acpi_aml_log_state != ACPI_AML_LOG_STOP) { | ||
| 165 | if (acpi_aml_log_state == ACPI_AML_PROMPT_ROLL) { | ||
| 166 | *p = acpi_aml_batch_roll; | ||
| 167 | len = 1; | ||
| 168 | crc->head = (crc->head + 1) & (ACPI_AML_BUF_SIZE - 1); | ||
| 169 | ret += 1; | ||
| 170 | acpi_aml_log_state = ACPI_AML_LOG_START; | ||
| 171 | } else { | ||
| 172 | len = read(fd, p, 1); | ||
| 173 | if (len <= 0) { | ||
| 174 | if (len < 0) | ||
| 175 | perror("read"); | ||
| 176 | ret = len; | ||
| 177 | break; | ||
| 178 | } | ||
| 179 | } | ||
| 180 | switch (acpi_aml_log_state) { | ||
| 181 | case ACPI_AML_LOG_START: | ||
| 182 | if (*p == '\n') | ||
| 183 | acpi_aml_log_state = ACPI_AML_PROMPT_START; | ||
| 184 | crc->head = (crc->head + 1) & (ACPI_AML_BUF_SIZE - 1); | ||
| 185 | ret += 1; | ||
| 186 | break; | ||
| 187 | case ACPI_AML_PROMPT_START: | ||
| 188 | if (*p == ACPI_DEBUGGER_COMMAND_PROMPT || | ||
| 189 | *p == ACPI_DEBUGGER_EXECUTE_PROMPT) { | ||
| 190 | acpi_aml_batch_prompt = *p; | ||
| 191 | acpi_aml_log_state = ACPI_AML_PROMPT_STOP; | ||
| 192 | } else { | ||
| 193 | if (*p != '\n') | ||
| 194 | acpi_aml_log_state = ACPI_AML_LOG_START; | ||
| 195 | crc->head = (crc->head + 1) & (ACPI_AML_BUF_SIZE - 1); | ||
| 196 | ret += 1; | ||
| 197 | } | ||
| 198 | break; | ||
| 199 | case ACPI_AML_PROMPT_STOP: | ||
| 200 | if (*p == ' ') { | ||
| 201 | acpi_aml_log_state = ACPI_AML_LOG_STOP; | ||
| 202 | acpi_aml_exit = true; | ||
| 203 | } else { | ||
| 204 | /* Roll back */ | ||
| 205 | acpi_aml_log_state = ACPI_AML_PROMPT_ROLL; | ||
| 206 | acpi_aml_batch_roll = *p; | ||
| 207 | *p = acpi_aml_batch_prompt; | ||
| 208 | crc->head = (crc->head + 1) & (ACPI_AML_BUF_SIZE - 1); | ||
| 209 | ret += 1; | ||
| 210 | } | ||
| 211 | break; | ||
| 212 | default: | ||
| 213 | assert(0); | ||
| 214 | break; | ||
| 215 | } | ||
| 216 | } | ||
| 217 | return ret; | ||
| 218 | } | ||
| 219 | |||
| 220 | static int acpi_aml_write(int fd, struct circ_buf *crc) | ||
| 221 | { | ||
| 222 | char *p; | ||
| 223 | int len; | ||
| 224 | |||
| 225 | p = &crc->buf[crc->tail]; | ||
| 226 | len = circ_count_to_end(crc); | ||
| 227 | len = write(fd, p, len); | ||
| 228 | if (len < 0) | ||
| 229 | perror("write"); | ||
| 230 | else if (len > 0) | ||
| 231 | crc->tail = (crc->tail + len) & (ACPI_AML_BUF_SIZE - 1); | ||
| 232 | return len; | ||
| 233 | } | ||
| 234 | |||
| 235 | static int acpi_aml_write_batch_log(int fd, struct circ_buf *crc) | ||
| 236 | { | ||
| 237 | char *p; | ||
| 238 | int len; | ||
| 239 | |||
| 240 | p = &crc->buf[crc->tail]; | ||
| 241 | len = circ_count_to_end(crc); | ||
| 242 | if (!acpi_aml_batch_drain) { | ||
| 243 | len = write(fd, p, len); | ||
| 244 | if (len < 0) | ||
| 245 | perror("write"); | ||
| 246 | } | ||
| 247 | if (len > 0) | ||
| 248 | crc->tail = (crc->tail + len) & (ACPI_AML_BUF_SIZE - 1); | ||
| 249 | return len; | ||
| 250 | } | ||
| 251 | |||
| 252 | static int acpi_aml_write_batch_cmd(int fd, struct circ_buf *crc) | ||
| 253 | { | ||
| 254 | int len; | ||
| 255 | |||
| 256 | len = acpi_aml_write(fd, crc); | ||
| 257 | if (circ_count_to_end(crc) == 0) | ||
| 258 | acpi_aml_batch_state = ACPI_AML_BATCH_READ_LOG; | ||
| 259 | return len; | ||
| 260 | } | ||
| 261 | |||
| 262 | static void acpi_aml_loop(int fd) | ||
| 263 | { | ||
| 264 | fd_set rfds; | ||
| 265 | fd_set wfds; | ||
| 266 | struct timeval tv; | ||
| 267 | int ret; | ||
| 268 | int maxfd = 0; | ||
| 269 | |||
| 270 | if (acpi_aml_mode == ACPI_AML_BATCH) { | ||
| 271 | acpi_aml_log_state = ACPI_AML_LOG_START; | ||
| 272 | acpi_aml_batch_pos = acpi_aml_batch_cmd; | ||
| 273 | if (acpi_aml_batch_drain) | ||
| 274 | acpi_aml_batch_state = ACPI_AML_BATCH_READ_LOG; | ||
| 275 | else | ||
| 276 | acpi_aml_batch_state = ACPI_AML_BATCH_WRITE_CMD; | ||
| 277 | } | ||
| 278 | acpi_aml_exit = false; | ||
| 279 | while (!acpi_aml_exit) { | ||
| 280 | tv.tv_sec = ACPI_AML_SEC_TICK; | ||
| 281 | tv.tv_usec = 0; | ||
| 282 | FD_ZERO(&rfds); | ||
| 283 | FD_ZERO(&wfds); | ||
| 284 | |||
| 285 | if (acpi_aml_cmd_space()) { | ||
| 286 | if (acpi_aml_mode == ACPI_AML_INTERACTIVE) | ||
| 287 | maxfd = acpi_aml_set_fd(STDIN_FILENO, maxfd, &rfds); | ||
| 288 | else if (strlen(acpi_aml_batch_pos) && | ||
| 289 | acpi_aml_batch_state == ACPI_AML_BATCH_WRITE_CMD) | ||
| 290 | ACPI_AML_BATCH_DO(STDIN_FILENO, read, cmd, ret); | ||
| 291 | } | ||
| 292 | if (acpi_aml_cmd_count() && | ||
| 293 | (acpi_aml_mode == ACPI_AML_INTERACTIVE || | ||
| 294 | acpi_aml_batch_state == ACPI_AML_BATCH_WRITE_CMD)) | ||
| 295 | maxfd = acpi_aml_set_fd(fd, maxfd, &wfds); | ||
| 296 | if (acpi_aml_log_space() && | ||
| 297 | (acpi_aml_mode == ACPI_AML_INTERACTIVE || | ||
| 298 | acpi_aml_batch_state == ACPI_AML_BATCH_READ_LOG)) | ||
| 299 | maxfd = acpi_aml_set_fd(fd, maxfd, &rfds); | ||
| 300 | if (acpi_aml_log_count()) | ||
| 301 | maxfd = acpi_aml_set_fd(STDOUT_FILENO, maxfd, &wfds); | ||
| 302 | |||
| 303 | ret = select(maxfd+1, &rfds, &wfds, NULL, &tv); | ||
| 304 | if (ret < 0) { | ||
| 305 | perror("select"); | ||
| 306 | break; | ||
| 307 | } | ||
| 308 | if (ret > 0) { | ||
| 309 | if (FD_ISSET(STDIN_FILENO, &rfds)) | ||
| 310 | ACPI_AML_DO(STDIN_FILENO, read, cmd, ret); | ||
| 311 | if (FD_ISSET(fd, &wfds)) { | ||
| 312 | if (acpi_aml_mode == ACPI_AML_BATCH) | ||
| 313 | ACPI_AML_BATCH_DO(fd, write, cmd, ret); | ||
| 314 | else | ||
| 315 | ACPI_AML_DO(fd, write, cmd, ret); | ||
| 316 | } | ||
| 317 | if (FD_ISSET(fd, &rfds)) { | ||
| 318 | if (acpi_aml_mode == ACPI_AML_BATCH) | ||
| 319 | ACPI_AML_BATCH_DO(fd, read, log, ret); | ||
| 320 | else | ||
| 321 | ACPI_AML_DO(fd, read, log, ret); | ||
| 322 | } | ||
| 323 | if (FD_ISSET(STDOUT_FILENO, &wfds)) { | ||
| 324 | if (acpi_aml_mode == ACPI_AML_BATCH) | ||
| 325 | ACPI_AML_BATCH_DO(STDOUT_FILENO, write, log, ret); | ||
| 326 | else | ||
| 327 | ACPI_AML_DO(STDOUT_FILENO, write, log, ret); | ||
| 328 | } | ||
| 329 | } | ||
| 330 | } | ||
| 331 | } | ||
| 332 | |||
| 333 | static bool acpi_aml_readable(int fd) | ||
| 334 | { | ||
| 335 | fd_set rfds; | ||
| 336 | struct timeval tv; | ||
| 337 | int ret; | ||
| 338 | int maxfd = 0; | ||
| 339 | |||
| 340 | tv.tv_sec = 0; | ||
| 341 | tv.tv_usec = ACPI_AML_USEC_PEEK; | ||
| 342 | FD_ZERO(&rfds); | ||
| 343 | maxfd = acpi_aml_set_fd(fd, maxfd, &rfds); | ||
| 344 | ret = select(maxfd+1, &rfds, NULL, NULL, &tv); | ||
| 345 | if (ret < 0) | ||
| 346 | perror("select"); | ||
| 347 | if (ret > 0 && FD_ISSET(fd, &rfds)) | ||
| 348 | return true; | ||
| 349 | return false; | ||
| 350 | } | ||
| 351 | |||
| 352 | /* | ||
| 353 | * This is a userspace IO flush implementation, replying on the prompt | ||
| 354 | * characters and can be turned into a flush() call after kernel implements | ||
| 355 | * .flush() filesystem operation. | ||
| 356 | */ | ||
| 357 | static void acpi_aml_flush(int fd) | ||
| 358 | { | ||
| 359 | while (acpi_aml_readable(fd)) { | ||
| 360 | acpi_aml_batch_drain = true; | ||
| 361 | acpi_aml_loop(fd); | ||
| 362 | acpi_aml_batch_drain = false; | ||
| 363 | } | ||
| 364 | } | ||
| 365 | |||
| 366 | void usage(FILE *file, char *progname) | ||
| 367 | { | ||
| 368 | fprintf(file, "usage: %s [-b cmd] [-f file] [-h]\n", progname); | ||
| 369 | fprintf(file, "\nOptions:\n"); | ||
| 370 | fprintf(file, " -b Specify command to be executed in batch mode\n"); | ||
| 371 | fprintf(file, " -f Specify interface file other than"); | ||
| 372 | fprintf(file, " /sys/kernel/debug/acpi/acpidbg\n"); | ||
| 373 | fprintf(file, " -h Print this help message\n"); | ||
| 374 | } | ||
| 375 | |||
| 376 | int main(int argc, char **argv) | ||
| 377 | { | ||
| 378 | int fd = 0; | ||
| 379 | int ch; | ||
| 380 | int len; | ||
| 381 | int ret = EXIT_SUCCESS; | ||
| 382 | |||
| 383 | while ((ch = getopt(argc, argv, "b:f:h")) != -1) { | ||
| 384 | switch (ch) { | ||
| 385 | case 'b': | ||
| 386 | if (acpi_aml_batch_cmd) { | ||
| 387 | fprintf(stderr, "Already specify %s\n", | ||
| 388 | acpi_aml_batch_cmd); | ||
| 389 | ret = EXIT_FAILURE; | ||
| 390 | goto exit; | ||
| 391 | } | ||
| 392 | len = strlen(optarg); | ||
| 393 | acpi_aml_batch_cmd = calloc(len + 2, 1); | ||
| 394 | if (!acpi_aml_batch_cmd) { | ||
| 395 | perror("calloc"); | ||
| 396 | ret = EXIT_FAILURE; | ||
| 397 | goto exit; | ||
| 398 | } | ||
| 399 | memcpy(acpi_aml_batch_cmd, optarg, len); | ||
| 400 | acpi_aml_batch_cmd[len] = '\n'; | ||
| 401 | acpi_aml_mode = ACPI_AML_BATCH; | ||
| 402 | break; | ||
| 403 | case 'f': | ||
| 404 | acpi_aml_file_path = optarg; | ||
| 405 | break; | ||
| 406 | case 'h': | ||
| 407 | usage(stdout, argv[0]); | ||
| 408 | goto exit; | ||
| 409 | break; | ||
| 410 | case '?': | ||
| 411 | default: | ||
| 412 | usage(stderr, argv[0]); | ||
| 413 | ret = EXIT_FAILURE; | ||
| 414 | goto exit; | ||
| 415 | break; | ||
| 416 | } | ||
| 417 | } | ||
| 418 | |||
| 419 | fd = open(acpi_aml_file_path, O_RDWR | O_NONBLOCK); | ||
| 420 | if (fd < 0) { | ||
| 421 | perror("open"); | ||
| 422 | ret = EXIT_FAILURE; | ||
| 423 | goto exit; | ||
| 424 | } | ||
| 425 | acpi_aml_set_fl(STDIN_FILENO, O_NONBLOCK); | ||
| 426 | acpi_aml_set_fl(STDOUT_FILENO, O_NONBLOCK); | ||
| 427 | |||
| 428 | if (acpi_aml_mode == ACPI_AML_BATCH) | ||
| 429 | acpi_aml_flush(fd); | ||
| 430 | acpi_aml_loop(fd); | ||
| 431 | |||
| 432 | exit: | ||
| 433 | if (fd < 0) | ||
| 434 | close(fd); | ||
| 435 | if (acpi_aml_batch_cmd) | ||
| 436 | free(acpi_aml_batch_cmd); | ||
| 437 | return ret; | ||
| 438 | } | ||
diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c index a1c62de42a3b..bbdf9e8e25bc 100644 --- a/tools/power/acpi/tools/acpidump/apfiles.c +++ b/tools/power/acpi/tools/acpidump/apfiles.c | |||
| @@ -48,6 +48,18 @@ | |||
| 48 | 48 | ||
| 49 | static int ap_is_existing_file(char *pathname); | 49 | static int ap_is_existing_file(char *pathname); |
| 50 | 50 | ||
| 51 | /****************************************************************************** | ||
| 52 | * | ||
| 53 | * FUNCTION: ap_is_existing_file | ||
| 54 | * | ||
| 55 | * PARAMETERS: pathname - Output filename | ||
| 56 | * | ||
| 57 | * RETURN: 0 on success | ||
| 58 | * | ||
| 59 | * DESCRIPTION: Query for file overwrite if it already exists. | ||
| 60 | * | ||
| 61 | ******************************************************************************/ | ||
| 62 | |||
| 51 | static int ap_is_existing_file(char *pathname) | 63 | static int ap_is_existing_file(char *pathname) |
| 52 | { | 64 | { |
| 53 | #ifndef _GNU_EFI | 65 | #ifndef _GNU_EFI |
| @@ -136,6 +148,7 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance) | |||
| 136 | } else { | 148 | } else { |
| 137 | ACPI_MOVE_NAME(filename, table->signature); | 149 | ACPI_MOVE_NAME(filename, table->signature); |
| 138 | } | 150 | } |
| 151 | |||
| 139 | filename[0] = (char)tolower((int)filename[0]); | 152 | filename[0] = (char)tolower((int)filename[0]); |
| 140 | filename[1] = (char)tolower((int)filename[1]); | 153 | filename[1] = (char)tolower((int)filename[1]); |
| 141 | filename[2] = (char)tolower((int)filename[2]); | 154 | filename[2] = (char)tolower((int)filename[2]); |
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index 2e2ba2efa0d9..0adaf0c7c03a 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile | |||
| @@ -47,6 +47,11 @@ NLS ?= true | |||
| 47 | # cpufreq-bench benchmarking tool | 47 | # cpufreq-bench benchmarking tool |
| 48 | CPUFREQ_BENCH ?= true | 48 | CPUFREQ_BENCH ?= true |
| 49 | 49 | ||
| 50 | # Do not build libraries, but build the code in statically | ||
| 51 | # Libraries are still built, otherwise the Makefile code would | ||
| 52 | # be rather ugly. | ||
| 53 | export STATIC ?= false | ||
| 54 | |||
| 50 | # Prefix to the directories we're installing to | 55 | # Prefix to the directories we're installing to |
| 51 | DESTDIR ?= | 56 | DESTDIR ?= |
| 52 | 57 | ||
| @@ -161,6 +166,12 @@ ifeq ($(strip $(CPUFREQ_BENCH)),true) | |||
| 161 | COMPILE_BENCH += compile-bench | 166 | COMPILE_BENCH += compile-bench |
| 162 | endif | 167 | endif |
| 163 | 168 | ||
| 169 | ifeq ($(strip $(STATIC)),true) | ||
| 170 | UTIL_OBJS += $(LIB_OBJS) | ||
| 171 | UTIL_HEADERS += $(LIB_HEADERS) | ||
| 172 | UTIL_SRC += $(LIB_SRC) | ||
| 173 | endif | ||
| 174 | |||
| 164 | CFLAGS += $(WARNINGS) | 175 | CFLAGS += $(WARNINGS) |
| 165 | 176 | ||
| 166 | ifeq ($(strip $(V)),false) | 177 | ifeq ($(strip $(V)),false) |
| @@ -209,7 +220,11 @@ $(OUTPUT)%.o: %.c | |||
| 209 | 220 | ||
| 210 | $(OUTPUT)cpupower: $(UTIL_OBJS) $(OUTPUT)libcpupower.so.$(LIB_MAJ) | 221 | $(OUTPUT)cpupower: $(UTIL_OBJS) $(OUTPUT)libcpupower.so.$(LIB_MAJ) |
| 211 | $(ECHO) " CC " $@ | 222 | $(ECHO) " CC " $@ |
| 223 | ifeq ($(strip $(STATIC)),true) | ||
| 224 | $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lrt -lpci -L$(OUTPUT) -o $@ | ||
| 225 | else | ||
| 212 | $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lcpupower -lrt -lpci -L$(OUTPUT) -o $@ | 226 | $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lcpupower -lrt -lpci -L$(OUTPUT) -o $@ |
| 227 | endif | ||
| 213 | $(QUIET) $(STRIPCMD) $@ | 228 | $(QUIET) $(STRIPCMD) $@ |
| 214 | 229 | ||
| 215 | $(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC) | 230 | $(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC) |
| @@ -291,7 +306,11 @@ install-bench: | |||
| 291 | @#DESTDIR must be set from outside to survive | 306 | @#DESTDIR must be set from outside to survive |
| 292 | @sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT) install | 307 | @sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT) install |
| 293 | 308 | ||
| 309 | ifeq ($(strip $(STATIC)),true) | ||
| 310 | install: all install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH) | ||
| 311 | else | ||
| 294 | install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH) | 312 | install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH) |
| 313 | endif | ||
| 295 | 314 | ||
| 296 | uninstall: | 315 | uninstall: |
| 297 | - rm -f $(DESTDIR)${libdir}/libcpupower.* | 316 | - rm -f $(DESTDIR)${libdir}/libcpupower.* |
diff --git a/tools/power/cpupower/bench/Makefile b/tools/power/cpupower/bench/Makefile index 7ec7021a29cd..d0f879b223fc 100644 --- a/tools/power/cpupower/bench/Makefile +++ b/tools/power/cpupower/bench/Makefile | |||
| @@ -5,9 +5,15 @@ ifneq ($(O),) | |||
| 5 | endif | 5 | endif |
| 6 | endif | 6 | endif |
| 7 | 7 | ||
| 8 | ifeq ($(strip $(STATIC)),true) | ||
| 9 | LIBS = -L../ -L$(OUTPUT) -lm | ||
| 10 | OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \ | ||
| 11 | $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o | ||
| 12 | else | ||
| 8 | LIBS = -L../ -L$(OUTPUT) -lm -lcpupower | 13 | LIBS = -L../ -L$(OUTPUT) -lm -lcpupower |
| 9 | |||
| 10 | OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o | 14 | OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o |
| 15 | endif | ||
| 16 | |||
| 11 | CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\" | 17 | CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\" |
| 12 | 18 | ||
| 13 | $(OUTPUT)%.o : %.c | 19 | $(OUTPUT)%.o : %.c |
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index 0e6764330241..8f3f5bb9c74e 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <getopt.h> | 14 | #include <getopt.h> |
| 15 | 15 | ||
| 16 | #include "cpufreq.h" | 16 | #include "cpufreq.h" |
| 17 | #include "helpers/sysfs.h" | ||
| 17 | #include "helpers/helpers.h" | 18 | #include "helpers/helpers.h" |
| 18 | #include "helpers/bitmask.h" | 19 | #include "helpers/bitmask.h" |
| 19 | 20 | ||
| @@ -244,149 +245,21 @@ static int get_boost_mode(unsigned int cpu) | |||
| 244 | return 0; | 245 | return 0; |
| 245 | } | 246 | } |
| 246 | 247 | ||
| 247 | static void debug_output_one(unsigned int cpu) | ||
| 248 | { | ||
| 249 | char *driver; | ||
| 250 | struct cpufreq_affected_cpus *cpus; | ||
| 251 | struct cpufreq_available_frequencies *freqs; | ||
| 252 | unsigned long min, max, freq_kernel, freq_hardware; | ||
| 253 | unsigned long total_trans, latency; | ||
| 254 | unsigned long long total_time; | ||
| 255 | struct cpufreq_policy *policy; | ||
| 256 | struct cpufreq_available_governors *governors; | ||
| 257 | struct cpufreq_stats *stats; | ||
| 258 | |||
| 259 | if (cpufreq_cpu_exists(cpu)) | ||
| 260 | return; | ||
| 261 | |||
| 262 | freq_kernel = cpufreq_get_freq_kernel(cpu); | ||
| 263 | freq_hardware = cpufreq_get_freq_hardware(cpu); | ||
| 264 | |||
| 265 | driver = cpufreq_get_driver(cpu); | ||
| 266 | if (!driver) { | ||
| 267 | printf(_(" no or unknown cpufreq driver is active on this CPU\n")); | ||
| 268 | } else { | ||
| 269 | printf(_(" driver: %s\n"), driver); | ||
| 270 | cpufreq_put_driver(driver); | ||
| 271 | } | ||
| 272 | |||
| 273 | cpus = cpufreq_get_related_cpus(cpu); | ||
| 274 | if (cpus) { | ||
| 275 | printf(_(" CPUs which run at the same hardware frequency: ")); | ||
| 276 | while (cpus->next) { | ||
| 277 | printf("%d ", cpus->cpu); | ||
| 278 | cpus = cpus->next; | ||
| 279 | } | ||
| 280 | printf("%d\n", cpus->cpu); | ||
| 281 | cpufreq_put_related_cpus(cpus); | ||
| 282 | } | ||
| 283 | |||
| 284 | cpus = cpufreq_get_affected_cpus(cpu); | ||
| 285 | if (cpus) { | ||
| 286 | printf(_(" CPUs which need to have their frequency coordinated by software: ")); | ||
| 287 | while (cpus->next) { | ||
| 288 | printf("%d ", cpus->cpu); | ||
| 289 | cpus = cpus->next; | ||
| 290 | } | ||
| 291 | printf("%d\n", cpus->cpu); | ||
| 292 | cpufreq_put_affected_cpus(cpus); | ||
| 293 | } | ||
| 294 | |||
| 295 | latency = cpufreq_get_transition_latency(cpu); | ||
| 296 | if (latency) { | ||
| 297 | printf(_(" maximum transition latency: ")); | ||
| 298 | print_duration(latency); | ||
| 299 | printf(".\n"); | ||
| 300 | } | ||
| 301 | |||
| 302 | if (!(cpufreq_get_hardware_limits(cpu, &min, &max))) { | ||
| 303 | printf(_(" hardware limits: ")); | ||
| 304 | print_speed(min); | ||
| 305 | printf(" - "); | ||
| 306 | print_speed(max); | ||
| 307 | printf("\n"); | ||
| 308 | } | ||
| 309 | |||
| 310 | freqs = cpufreq_get_available_frequencies(cpu); | ||
| 311 | if (freqs) { | ||
| 312 | printf(_(" available frequency steps: ")); | ||
| 313 | while (freqs->next) { | ||
| 314 | print_speed(freqs->frequency); | ||
| 315 | printf(", "); | ||
| 316 | freqs = freqs->next; | ||
| 317 | } | ||
| 318 | print_speed(freqs->frequency); | ||
| 319 | printf("\n"); | ||
| 320 | cpufreq_put_available_frequencies(freqs); | ||
| 321 | } | ||
| 322 | |||
| 323 | governors = cpufreq_get_available_governors(cpu); | ||
| 324 | if (governors) { | ||
| 325 | printf(_(" available cpufreq governors: ")); | ||
| 326 | while (governors->next) { | ||
| 327 | printf("%s, ", governors->governor); | ||
| 328 | governors = governors->next; | ||
| 329 | } | ||
| 330 | printf("%s\n", governors->governor); | ||
| 331 | cpufreq_put_available_governors(governors); | ||
| 332 | } | ||
| 333 | |||
| 334 | policy = cpufreq_get_policy(cpu); | ||
| 335 | if (policy) { | ||
| 336 | printf(_(" current policy: frequency should be within ")); | ||
| 337 | print_speed(policy->min); | ||
| 338 | printf(_(" and ")); | ||
| 339 | print_speed(policy->max); | ||
| 340 | |||
| 341 | printf(".\n "); | ||
| 342 | printf(_("The governor \"%s\" may" | ||
| 343 | " decide which speed to use\n within this range.\n"), | ||
| 344 | policy->governor); | ||
| 345 | cpufreq_put_policy(policy); | ||
| 346 | } | ||
| 347 | |||
| 348 | if (freq_kernel || freq_hardware) { | ||
| 349 | printf(_(" current CPU frequency is ")); | ||
| 350 | if (freq_hardware) { | ||
| 351 | print_speed(freq_hardware); | ||
| 352 | printf(_(" (asserted by call to hardware)")); | ||
| 353 | } else | ||
| 354 | print_speed(freq_kernel); | ||
| 355 | printf(".\n"); | ||
| 356 | } | ||
| 357 | stats = cpufreq_get_stats(cpu, &total_time); | ||
| 358 | if (stats) { | ||
| 359 | printf(_(" cpufreq stats: ")); | ||
| 360 | while (stats) { | ||
| 361 | print_speed(stats->frequency); | ||
| 362 | printf(":%.2f%%", (100.0 * stats->time_in_state) / total_time); | ||
| 363 | stats = stats->next; | ||
| 364 | if (stats) | ||
| 365 | printf(", "); | ||
| 366 | } | ||
| 367 | cpufreq_put_stats(stats); | ||
| 368 | total_trans = cpufreq_get_transitions(cpu); | ||
| 369 | if (total_trans) | ||
| 370 | printf(" (%lu)\n", total_trans); | ||
| 371 | else | ||
| 372 | printf("\n"); | ||
| 373 | } | ||
| 374 | get_boost_mode(cpu); | ||
| 375 | |||
| 376 | } | ||
| 377 | |||
| 378 | /* --freq / -f */ | 248 | /* --freq / -f */ |
| 379 | 249 | ||
| 380 | static int get_freq_kernel(unsigned int cpu, unsigned int human) | 250 | static int get_freq_kernel(unsigned int cpu, unsigned int human) |
| 381 | { | 251 | { |
| 382 | unsigned long freq = cpufreq_get_freq_kernel(cpu); | 252 | unsigned long freq = cpufreq_get_freq_kernel(cpu); |
| 383 | if (!freq) | 253 | printf(_(" current CPU frequency: ")); |
| 254 | if (!freq) { | ||
| 255 | printf(_(" Unable to call to kernel\n")); | ||
| 384 | return -EINVAL; | 256 | return -EINVAL; |
| 257 | } | ||
| 385 | if (human) { | 258 | if (human) { |
| 386 | print_speed(freq); | 259 | print_speed(freq); |
| 387 | printf("\n"); | ||
| 388 | } else | 260 | } else |
| 389 | printf("%lu\n", freq); | 261 | printf("%lu", freq); |
| 262 | printf(_(" (asserted by call to kernel)\n")); | ||
| 390 | return 0; | 263 | return 0; |
| 391 | } | 264 | } |
| 392 | 265 | ||
| @@ -396,13 +269,16 @@ static int get_freq_kernel(unsigned int cpu, unsigned int human) | |||
| 396 | static int get_freq_hardware(unsigned int cpu, unsigned int human) | 269 | static int get_freq_hardware(unsigned int cpu, unsigned int human) |
| 397 | { | 270 | { |
| 398 | unsigned long freq = cpufreq_get_freq_hardware(cpu); | 271 | unsigned long freq = cpufreq_get_freq_hardware(cpu); |
| 399 | if (!freq) | 272 | printf(_(" current CPU frequency: ")); |
| 273 | if (!freq) { | ||
| 274 | printf("Unable to call hardware\n"); | ||
| 400 | return -EINVAL; | 275 | return -EINVAL; |
| 276 | } | ||
| 401 | if (human) { | 277 | if (human) { |
| 402 | print_speed(freq); | 278 | print_speed(freq); |
| 403 | printf("\n"); | ||
| 404 | } else | 279 | } else |
| 405 | printf("%lu\n", freq); | 280 | printf("%lu", freq); |
| 281 | printf(_(" (asserted by call to hardware)\n")); | ||
| 406 | return 0; | 282 | return 0; |
| 407 | } | 283 | } |
| 408 | 284 | ||
| @@ -411,9 +287,17 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human) | |||
| 411 | static int get_hardware_limits(unsigned int cpu) | 287 | static int get_hardware_limits(unsigned int cpu) |
| 412 | { | 288 | { |
| 413 | unsigned long min, max; | 289 | unsigned long min, max; |
| 414 | if (cpufreq_get_hardware_limits(cpu, &min, &max)) | 290 | |
| 291 | printf(_(" hardware limits: ")); | ||
| 292 | if (cpufreq_get_hardware_limits(cpu, &min, &max)) { | ||
| 293 | printf(_("Not Available\n")); | ||
| 415 | return -EINVAL; | 294 | return -EINVAL; |
| 416 | printf("%lu %lu\n", min, max); | 295 | } |
| 296 | |||
| 297 | print_speed(min); | ||
| 298 | printf(" - "); | ||
| 299 | print_speed(max); | ||
| 300 | printf("\n"); | ||
| 417 | return 0; | 301 | return 0; |
| 418 | } | 302 | } |
| 419 | 303 | ||
| @@ -422,9 +306,11 @@ static int get_hardware_limits(unsigned int cpu) | |||
| 422 | static int get_driver(unsigned int cpu) | 306 | static int get_driver(unsigned int cpu) |
| 423 | { | 307 | { |
| 424 | char *driver = cpufreq_get_driver(cpu); | 308 | char *driver = cpufreq_get_driver(cpu); |
| 425 | if (!driver) | 309 | if (!driver) { |
| 310 | printf(_(" no or unknown cpufreq driver is active on this CPU\n")); | ||
| 426 | return -EINVAL; | 311 | return -EINVAL; |
| 427 | printf("%s\n", driver); | 312 | } |
| 313 | printf(" driver: %s\n", driver); | ||
| 428 | cpufreq_put_driver(driver); | 314 | cpufreq_put_driver(driver); |
| 429 | return 0; | 315 | return 0; |
| 430 | } | 316 | } |
| @@ -434,9 +320,19 @@ static int get_driver(unsigned int cpu) | |||
| 434 | static int get_policy(unsigned int cpu) | 320 | static int get_policy(unsigned int cpu) |
| 435 | { | 321 | { |
| 436 | struct cpufreq_policy *policy = cpufreq_get_policy(cpu); | 322 | struct cpufreq_policy *policy = cpufreq_get_policy(cpu); |
| 437 | if (!policy) | 323 | if (!policy) { |
| 324 | printf(_(" Unable to determine current policy\n")); | ||
| 438 | return -EINVAL; | 325 | return -EINVAL; |
| 439 | printf("%lu %lu %s\n", policy->min, policy->max, policy->governor); | 326 | } |
| 327 | printf(_(" current policy: frequency should be within ")); | ||
| 328 | print_speed(policy->min); | ||
| 329 | printf(_(" and ")); | ||
| 330 | print_speed(policy->max); | ||
| 331 | |||
| 332 | printf(".\n "); | ||
| 333 | printf(_("The governor \"%s\" may decide which speed to use\n" | ||
| 334 | " within this range.\n"), | ||
| 335 | policy->governor); | ||
| 440 | cpufreq_put_policy(policy); | 336 | cpufreq_put_policy(policy); |
| 441 | return 0; | 337 | return 0; |
| 442 | } | 338 | } |
| @@ -447,8 +343,12 @@ static int get_available_governors(unsigned int cpu) | |||
| 447 | { | 343 | { |
| 448 | struct cpufreq_available_governors *governors = | 344 | struct cpufreq_available_governors *governors = |
| 449 | cpufreq_get_available_governors(cpu); | 345 | cpufreq_get_available_governors(cpu); |
| 450 | if (!governors) | 346 | |
| 347 | printf(_(" available cpufreq governors: ")); | ||
| 348 | if (!governors) { | ||
| 349 | printf(_("Not Available\n")); | ||
| 451 | return -EINVAL; | 350 | return -EINVAL; |
| 351 | } | ||
| 452 | 352 | ||
| 453 | while (governors->next) { | 353 | while (governors->next) { |
| 454 | printf("%s ", governors->governor); | 354 | printf("%s ", governors->governor); |
| @@ -465,8 +365,12 @@ static int get_available_governors(unsigned int cpu) | |||
| 465 | static int get_affected_cpus(unsigned int cpu) | 365 | static int get_affected_cpus(unsigned int cpu) |
| 466 | { | 366 | { |
| 467 | struct cpufreq_affected_cpus *cpus = cpufreq_get_affected_cpus(cpu); | 367 | struct cpufreq_affected_cpus *cpus = cpufreq_get_affected_cpus(cpu); |
| 468 | if (!cpus) | 368 | |
| 369 | printf(_(" CPUs which need to have their frequency coordinated by software: ")); | ||
| 370 | if (!cpus) { | ||
| 371 | printf(_("Not Available\n")); | ||
| 469 | return -EINVAL; | 372 | return -EINVAL; |
| 373 | } | ||
| 470 | 374 | ||
| 471 | while (cpus->next) { | 375 | while (cpus->next) { |
| 472 | printf("%d ", cpus->cpu); | 376 | printf("%d ", cpus->cpu); |
| @@ -482,8 +386,12 @@ static int get_affected_cpus(unsigned int cpu) | |||
| 482 | static int get_related_cpus(unsigned int cpu) | 386 | static int get_related_cpus(unsigned int cpu) |
| 483 | { | 387 | { |
| 484 | struct cpufreq_affected_cpus *cpus = cpufreq_get_related_cpus(cpu); | 388 | struct cpufreq_affected_cpus *cpus = cpufreq_get_related_cpus(cpu); |
| 485 | if (!cpus) | 389 | |
| 390 | printf(_(" CPUs which run at the same hardware frequency: ")); | ||
| 391 | if (!cpus) { | ||
| 392 | printf(_("Not Available\n")); | ||
| 486 | return -EINVAL; | 393 | return -EINVAL; |
| 394 | } | ||
| 487 | 395 | ||
| 488 | while (cpus->next) { | 396 | while (cpus->next) { |
| 489 | printf("%d ", cpus->cpu); | 397 | printf("%d ", cpus->cpu); |
| @@ -524,8 +432,12 @@ static int get_freq_stats(unsigned int cpu, unsigned int human) | |||
| 524 | static int get_latency(unsigned int cpu, unsigned int human) | 432 | static int get_latency(unsigned int cpu, unsigned int human) |
| 525 | { | 433 | { |
| 526 | unsigned long latency = cpufreq_get_transition_latency(cpu); | 434 | unsigned long latency = cpufreq_get_transition_latency(cpu); |
| 527 | if (!latency) | 435 | |
| 436 | printf(_(" maximum transition latency: ")); | ||
| 437 | if (!latency || latency == UINT_MAX) { | ||
| 438 | printf(_(" Cannot determine or is not supported.\n")); | ||
| 528 | return -EINVAL; | 439 | return -EINVAL; |
| 440 | } | ||
| 529 | 441 | ||
| 530 | if (human) { | 442 | if (human) { |
| 531 | print_duration(latency); | 443 | print_duration(latency); |
| @@ -535,6 +447,36 @@ static int get_latency(unsigned int cpu, unsigned int human) | |||
| 535 | return 0; | 447 | return 0; |
| 536 | } | 448 | } |
| 537 | 449 | ||
| 450 | static void debug_output_one(unsigned int cpu) | ||
| 451 | { | ||
| 452 | struct cpufreq_available_frequencies *freqs; | ||
| 453 | |||
| 454 | get_driver(cpu); | ||
| 455 | get_related_cpus(cpu); | ||
| 456 | get_affected_cpus(cpu); | ||
| 457 | get_latency(cpu, 1); | ||
| 458 | get_hardware_limits(cpu); | ||
| 459 | |||
| 460 | freqs = cpufreq_get_available_frequencies(cpu); | ||
| 461 | if (freqs) { | ||
| 462 | printf(_(" available frequency steps: ")); | ||
| 463 | while (freqs->next) { | ||
| 464 | print_speed(freqs->frequency); | ||
| 465 | printf(", "); | ||
| 466 | freqs = freqs->next; | ||
| 467 | } | ||
| 468 | print_speed(freqs->frequency); | ||
| 469 | printf("\n"); | ||
| 470 | cpufreq_put_available_frequencies(freqs); | ||
| 471 | } | ||
| 472 | |||
| 473 | get_available_governors(cpu); | ||
| 474 | get_policy(cpu); | ||
| 475 | if (get_freq_hardware(cpu, 1) < 0) | ||
| 476 | get_freq_kernel(cpu, 1); | ||
| 477 | get_boost_mode(cpu); | ||
| 478 | } | ||
| 479 | |||
| 538 | static struct option info_opts[] = { | 480 | static struct option info_opts[] = { |
| 539 | {"debug", no_argument, NULL, 'e'}, | 481 | {"debug", no_argument, NULL, 'e'}, |
| 540 | {"boost", no_argument, NULL, 'b'}, | 482 | {"boost", no_argument, NULL, 'b'}, |
| @@ -647,11 +589,14 @@ int cmd_freq_info(int argc, char **argv) | |||
| 647 | 589 | ||
| 648 | if (!bitmask_isbitset(cpus_chosen, cpu)) | 590 | if (!bitmask_isbitset(cpus_chosen, cpu)) |
| 649 | continue; | 591 | continue; |
| 650 | if (cpufreq_cpu_exists(cpu)) { | 592 | |
| 651 | printf(_("couldn't analyze CPU %d as it doesn't seem to be present\n"), cpu); | 593 | printf(_("analyzing CPU %d:\n"), cpu); |
| 594 | |||
| 595 | if (sysfs_is_cpu_online(cpu) != 1) { | ||
| 596 | printf(_(" *is offline\n")); | ||
| 597 | printf("\n"); | ||
| 652 | continue; | 598 | continue; |
| 653 | } | 599 | } |
| 654 | printf(_("analyzing CPU %d:\n"), cpu); | ||
| 655 | 600 | ||
| 656 | switch (output_param) { | 601 | switch (output_param) { |
| 657 | case 'b': | 602 | case 'b': |
| @@ -693,6 +638,7 @@ int cmd_freq_info(int argc, char **argv) | |||
| 693 | } | 638 | } |
| 694 | if (ret) | 639 | if (ret) |
| 695 | return ret; | 640 | return ret; |
| 641 | printf("\n"); | ||
| 696 | } | 642 | } |
| 697 | return ret; | 643 | return ret; |
| 698 | } | 644 | } |
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c index 750c1d82c3f7..8bf8ab5ffa25 100644 --- a/tools/power/cpupower/utils/cpuidle-info.c +++ b/tools/power/cpupower/utils/cpuidle-info.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
| 13 | #include <string.h> | 13 | #include <string.h> |
| 14 | #include <getopt.h> | 14 | #include <getopt.h> |
| 15 | #include <cpufreq.h> | ||
| 16 | 15 | ||
| 17 | #include "helpers/helpers.h" | 16 | #include "helpers/helpers.h" |
| 18 | #include "helpers/sysfs.h" | 17 | #include "helpers/sysfs.h" |
| @@ -25,8 +24,6 @@ static void cpuidle_cpu_output(unsigned int cpu, int verbose) | |||
| 25 | unsigned int idlestates, idlestate; | 24 | unsigned int idlestates, idlestate; |
| 26 | char *tmp; | 25 | char *tmp; |
| 27 | 26 | ||
| 28 | printf(_ ("Analyzing CPU %d:\n"), cpu); | ||
| 29 | |||
| 30 | idlestates = sysfs_get_idlestate_count(cpu); | 27 | idlestates = sysfs_get_idlestate_count(cpu); |
| 31 | if (idlestates == 0) { | 28 | if (idlestates == 0) { |
| 32 | printf(_("CPU %u: No idle states\n"), cpu); | 29 | printf(_("CPU %u: No idle states\n"), cpu); |
| @@ -71,7 +68,6 @@ static void cpuidle_cpu_output(unsigned int cpu, int verbose) | |||
| 71 | printf(_("Duration: %llu\n"), | 68 | printf(_("Duration: %llu\n"), |
| 72 | sysfs_get_idlestate_time(cpu, idlestate)); | 69 | sysfs_get_idlestate_time(cpu, idlestate)); |
| 73 | } | 70 | } |
| 74 | printf("\n"); | ||
| 75 | } | 71 | } |
| 76 | 72 | ||
| 77 | static void cpuidle_general_output(void) | 73 | static void cpuidle_general_output(void) |
| @@ -189,10 +185,17 @@ int cmd_idle_info(int argc, char **argv) | |||
| 189 | for (cpu = bitmask_first(cpus_chosen); | 185 | for (cpu = bitmask_first(cpus_chosen); |
| 190 | cpu <= bitmask_last(cpus_chosen); cpu++) { | 186 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
| 191 | 187 | ||
| 192 | if (!bitmask_isbitset(cpus_chosen, cpu) || | 188 | if (!bitmask_isbitset(cpus_chosen, cpu)) |
| 193 | cpufreq_cpu_exists(cpu)) | ||
| 194 | continue; | 189 | continue; |
| 195 | 190 | ||
| 191 | printf(_("analyzing CPU %d:\n"), cpu); | ||
| 192 | |||
| 193 | if (sysfs_is_cpu_online(cpu) != 1) { | ||
| 194 | printf(_(" *is offline\n")); | ||
| 195 | printf("\n"); | ||
| 196 | continue; | ||
| 197 | } | ||
| 198 | |||
| 196 | switch (output_param) { | 199 | switch (output_param) { |
| 197 | 200 | ||
| 198 | case 'o': | 201 | case 'o': |
| @@ -203,6 +206,7 @@ int cmd_idle_info(int argc, char **argv) | |||
| 203 | cpuidle_cpu_output(cpu, verbose); | 206 | cpuidle_cpu_output(cpu, verbose); |
| 204 | break; | 207 | break; |
| 205 | } | 208 | } |
| 209 | printf("\n"); | ||
| 206 | } | 210 | } |
| 207 | return EXIT_SUCCESS; | 211 | return EXIT_SUCCESS; |
| 208 | } | 212 | } |
diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c index 10299f2e9d2a..c7caa8eaa6d0 100644 --- a/tools/power/cpupower/utils/cpupower-info.c +++ b/tools/power/cpupower/utils/cpupower-info.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <string.h> | 12 | #include <string.h> |
| 13 | #include <getopt.h> | 13 | #include <getopt.h> |
| 14 | 14 | ||
| 15 | #include <cpufreq.h> | ||
| 16 | #include "helpers/helpers.h" | 15 | #include "helpers/helpers.h" |
| 17 | #include "helpers/sysfs.h" | 16 | #include "helpers/sysfs.h" |
| 18 | 17 | ||
| @@ -83,12 +82,16 @@ int cmd_info(int argc, char **argv) | |||
| 83 | for (cpu = bitmask_first(cpus_chosen); | 82 | for (cpu = bitmask_first(cpus_chosen); |
| 84 | cpu <= bitmask_last(cpus_chosen); cpu++) { | 83 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
| 85 | 84 | ||
| 86 | if (!bitmask_isbitset(cpus_chosen, cpu) || | 85 | if (!bitmask_isbitset(cpus_chosen, cpu)) |
| 87 | cpufreq_cpu_exists(cpu)) | ||
| 88 | continue; | 86 | continue; |
| 89 | 87 | ||
| 90 | printf(_("analyzing CPU %d:\n"), cpu); | 88 | printf(_("analyzing CPU %d:\n"), cpu); |
| 91 | 89 | ||
| 90 | if (sysfs_is_cpu_online(cpu) != 1){ | ||
| 91 | printf(_(" *is offline\n")); | ||
| 92 | continue; | ||
| 93 | } | ||
| 94 | |||
| 92 | if (params.perf_bias) { | 95 | if (params.perf_bias) { |
| 93 | ret = msr_intel_get_perf_bias(cpu); | 96 | ret = msr_intel_get_perf_bias(cpu); |
| 94 | if (ret < 0) { | 97 | if (ret < 0) { |
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index 3e6f374f8dd7..532f46b9a335 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <string.h> | 12 | #include <string.h> |
| 13 | #include <getopt.h> | 13 | #include <getopt.h> |
| 14 | 14 | ||
| 15 | #include <cpufreq.h> | ||
| 16 | #include "helpers/helpers.h" | 15 | #include "helpers/helpers.h" |
| 17 | #include "helpers/sysfs.h" | 16 | #include "helpers/sysfs.h" |
| 18 | #include "helpers/bitmask.h" | 17 | #include "helpers/bitmask.h" |
| @@ -78,10 +77,15 @@ int cmd_set(int argc, char **argv) | |||
| 78 | for (cpu = bitmask_first(cpus_chosen); | 77 | for (cpu = bitmask_first(cpus_chosen); |
| 79 | cpu <= bitmask_last(cpus_chosen); cpu++) { | 78 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
| 80 | 79 | ||
| 81 | if (!bitmask_isbitset(cpus_chosen, cpu) || | 80 | if (!bitmask_isbitset(cpus_chosen, cpu)) |
| 82 | cpufreq_cpu_exists(cpu)) | ||
| 83 | continue; | 81 | continue; |
| 84 | 82 | ||
| 83 | if (sysfs_is_cpu_online(cpu) != 1){ | ||
| 84 | fprintf(stderr, _("Cannot set values on CPU %d:"), cpu); | ||
| 85 | fprintf(stderr, _(" *is offline\n")); | ||
| 86 | continue; | ||
| 87 | } | ||
| 88 | |||
| 85 | if (params.perf_bias) { | 89 | if (params.perf_bias) { |
| 86 | ret = msr_intel_set_perf_bias(cpu, perf_bias); | 90 | ret = msr_intel_set_perf_bias(cpu, perf_bias); |
| 87 | if (ret) { | 91 | if (ret) { |
diff --git a/tools/power/cpupower/utils/helpers/topology.c b/tools/power/cpupower/utils/helpers/topology.c index 9cbb7fd75171..5f9c908f4557 100644 --- a/tools/power/cpupower/utils/helpers/topology.c +++ b/tools/power/cpupower/utils/helpers/topology.c | |||
| @@ -106,7 +106,7 @@ int get_cpu_topology(struct cpupower_topology *cpu_top) | |||
| 106 | cpu_top->pkgs++; | 106 | cpu_top->pkgs++; |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | if (!cpu_top->core_info[0].pkg == -1) | 109 | if (!(cpu_top->core_info[0].pkg == -1)) |
| 110 | cpu_top->pkgs++; | 110 | cpu_top->pkgs++; |
| 111 | 111 | ||
| 112 | /* Intel's cores count is not consecutively numbered, there may | 112 | /* Intel's cores count is not consecutively numbered, there may |
