aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-11-18 20:21:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-11-18 20:21:58 -0500
commit20afa6e2f9c129e13031cc4a21834a03641cb8a4 (patch)
treee139f30f3ea3b61d91871a91bc7f4f2be8cec31e
parent04e36857d6747e4525e68c4292c081b795b48366 (diff)
parentaab0b243b9a2fab7dcee0ce6e13789d3ab0394bf (diff)
Merge tag 'acpi-4.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "They fix an ACPI thermal management regression introduced by a recent FADT handling cleanup, an ACPI tools build issue introduced by a recent ACPICA commit and a PCC mailbox initialization bug causing lockdep to complain loudly. Specifics: - Revert a recent ACPICA cleanup that attempted to get rid of all FADT version 2 legacy, but broke ACPI thermal management on at least one system (Rafael Wysocki). - Fix cross-compiled builds of ACPI tools that stopped working after a recent cleanup related to the handling of header files in ACPICA (Lv Zheng). - Fix a locking issue in the PCC channel initialization code that invokes devm_request_irq() under a spinlock (among other things) and causes lockdep to complain (Hoan Tran)" * tag 'acpi-4.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: tools/power/acpi: Remove direct kernel source include reference mailbox: PCC: Fix lockdep warning when request PCC channel Revert "ACPICA: FADT support cleanup"
-rw-r--r--drivers/acpi/acpica/tbfadt.c10
-rw-r--r--drivers/mailbox/pcc.c13
-rw-r--r--include/acpi/actbl.h164
-rw-r--r--include/acpi/platform/aclinux.h3
-rw-r--r--tools/power/acpi/Makefile.config23
-rw-r--r--tools/power/acpi/Makefile.rules40
-rw-r--r--tools/power/acpi/tools/acpidbg/Makefile4
-rw-r--r--tools/power/acpi/tools/acpidbg/acpidbg.c8
-rw-r--r--tools/power/acpi/tools/acpidump/Makefile12
9 files changed, 137 insertions, 140 deletions
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 046c4d0394ee..5fb838e592dc 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -480,19 +480,17 @@ static void acpi_tb_convert_fadt(void)
480 u32 i; 480 u32 i;
481 481
482 /* 482 /*
483 * For ACPI 1.0 FADTs (revision 1), ensure that reserved fields which 483 * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
484 * should be zero are indeed zero. This will workaround BIOSs that 484 * should be zero are indeed zero. This will workaround BIOSs that
485 * inadvertently place values in these fields. 485 * inadvertently place values in these fields.
486 * 486 *
487 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located 487 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located
488 * at offset 45, 55, 95, and the word located at offset 109, 110. 488 * at offset 45, 55, 95, and the word located at offset 109, 110.
489 * 489 *
490 * Note: The FADT revision value is unreliable because of BIOS errors. 490 * Note: The FADT revision value is unreliable. Only the length can be
491 * The table length is instead used as the final word on the version. 491 * trusted.
492 *
493 * Note: FADT revision 3 is the ACPI 2.0 version of the FADT.
494 */ 492 */
495 if (acpi_gbl_FADT.header.length <= ACPI_FADT_V3_SIZE) { 493 if (acpi_gbl_FADT.header.length <= ACPI_FADT_V2_SIZE) {
496 acpi_gbl_FADT.preferred_profile = 0; 494 acpi_gbl_FADT.preferred_profile = 0;
497 acpi_gbl_FADT.pstate_control = 0; 495 acpi_gbl_FADT.pstate_control = 0;
498 acpi_gbl_FADT.cst_control = 0; 496 acpi_gbl_FADT.cst_control = 0;
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 08c87fadca8c..1f32688c312d 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -65,6 +65,7 @@
65#include <linux/mailbox_controller.h> 65#include <linux/mailbox_controller.h>
66#include <linux/mailbox_client.h> 66#include <linux/mailbox_client.h>
67#include <linux/io-64-nonatomic-lo-hi.h> 67#include <linux/io-64-nonatomic-lo-hi.h>
68#include <acpi/pcc.h>
68 69
69#include "mailbox.h" 70#include "mailbox.h"
70 71
@@ -267,6 +268,8 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
267 if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone) 268 if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone)
268 chan->txdone_method |= TXDONE_BY_ACK; 269 chan->txdone_method |= TXDONE_BY_ACK;
269 270
271 spin_unlock_irqrestore(&chan->lock, flags);
272
270 if (pcc_doorbell_irq[subspace_id] > 0) { 273 if (pcc_doorbell_irq[subspace_id] > 0) {
271 int rc; 274 int rc;
272 275
@@ -275,12 +278,11 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
275 if (unlikely(rc)) { 278 if (unlikely(rc)) {
276 dev_err(dev, "failed to register PCC interrupt %d\n", 279 dev_err(dev, "failed to register PCC interrupt %d\n",
277 pcc_doorbell_irq[subspace_id]); 280 pcc_doorbell_irq[subspace_id]);
281 pcc_mbox_free_channel(chan);
278 chan = ERR_PTR(rc); 282 chan = ERR_PTR(rc);
279 } 283 }
280 } 284 }
281 285
282 spin_unlock_irqrestore(&chan->lock, flags);
283
284 return chan; 286 return chan;
285} 287}
286EXPORT_SYMBOL_GPL(pcc_mbox_request_channel); 288EXPORT_SYMBOL_GPL(pcc_mbox_request_channel);
@@ -304,20 +306,19 @@ void pcc_mbox_free_channel(struct mbox_chan *chan)
304 return; 306 return;
305 } 307 }
306 308
309 if (pcc_doorbell_irq[id] > 0)
310 devm_free_irq(chan->mbox->dev, pcc_doorbell_irq[id], chan);
311
307 spin_lock_irqsave(&chan->lock, flags); 312 spin_lock_irqsave(&chan->lock, flags);
308 chan->cl = NULL; 313 chan->cl = NULL;
309 chan->active_req = NULL; 314 chan->active_req = NULL;
310 if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK)) 315 if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK))
311 chan->txdone_method = TXDONE_BY_POLL; 316 chan->txdone_method = TXDONE_BY_POLL;
312 317
313 if (pcc_doorbell_irq[id] > 0)
314 devm_free_irq(chan->mbox->dev, pcc_doorbell_irq[id], chan);
315
316 spin_unlock_irqrestore(&chan->lock, flags); 318 spin_unlock_irqrestore(&chan->lock, flags);
317} 319}
318EXPORT_SYMBOL_GPL(pcc_mbox_free_channel); 320EXPORT_SYMBOL_GPL(pcc_mbox_free_channel);
319 321
320
321/** 322/**
322 * pcc_send_data - Called from Mailbox Controller code. Used 323 * pcc_send_data - Called from Mailbox Controller code. Used
323 * here only to ring the channel doorbell. The PCC client 324 * here only to ring the channel doorbell. The PCC client
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 1b949e08015c..c19700e2a2fe 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -230,72 +230,62 @@ struct acpi_table_facs {
230/* Fields common to all versions of the FADT */ 230/* Fields common to all versions of the FADT */
231 231
232struct acpi_table_fadt { 232struct acpi_table_fadt {
233 struct acpi_table_header header; /* [V1] Common ACPI table header */ 233 struct acpi_table_header header; /* Common ACPI table header */
234 u32 facs; /* [V1] 32-bit physical address of FACS */ 234 u32 facs; /* 32-bit physical address of FACS */
235 u32 dsdt; /* [V1] 32-bit physical address of DSDT */ 235 u32 dsdt; /* 32-bit physical address of DSDT */
236 u8 model; /* [V1] System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */ 236 u8 model; /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */
237 u8 preferred_profile; /* [V1] Conveys preferred power management profile to OSPM. */ 237 u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */
238 u16 sci_interrupt; /* [V1] System vector of SCI interrupt */ 238 u16 sci_interrupt; /* System vector of SCI interrupt */
239 u32 smi_command; /* [V1] 32-bit Port address of SMI command port */ 239 u32 smi_command; /* 32-bit Port address of SMI command port */
240 u8 acpi_enable; /* [V1] Value to write to SMI_CMD to enable ACPI */ 240 u8 acpi_enable; /* Value to write to SMI_CMD to enable ACPI */
241 u8 acpi_disable; /* [V1] Value to write to SMI_CMD to disable ACPI */ 241 u8 acpi_disable; /* Value to write to SMI_CMD to disable ACPI */
242 u8 s4_bios_request; /* [V1] Value to write to SMI_CMD to enter S4BIOS state */ 242 u8 s4_bios_request; /* Value to write to SMI_CMD to enter S4BIOS state */
243 u8 pstate_control; /* [V1] Processor performance state control */ 243 u8 pstate_control; /* Processor performance state control */
244 u32 pm1a_event_block; /* [V1] 32-bit port address of Power Mgt 1a Event Reg Blk */ 244 u32 pm1a_event_block; /* 32-bit port address of Power Mgt 1a Event Reg Blk */
245 u32 pm1b_event_block; /* [V1] 32-bit port address of Power Mgt 1b Event Reg Blk */ 245 u32 pm1b_event_block; /* 32-bit port address of Power Mgt 1b Event Reg Blk */
246 u32 pm1a_control_block; /* [V1] 32-bit port address of Power Mgt 1a Control Reg Blk */ 246 u32 pm1a_control_block; /* 32-bit port address of Power Mgt 1a Control Reg Blk */
247 u32 pm1b_control_block; /* [V1] 32-bit port address of Power Mgt 1b Control Reg Blk */ 247 u32 pm1b_control_block; /* 32-bit port address of Power Mgt 1b Control Reg Blk */
248 u32 pm2_control_block; /* [V1] 32-bit port address of Power Mgt 2 Control Reg Blk */ 248 u32 pm2_control_block; /* 32-bit port address of Power Mgt 2 Control Reg Blk */
249 u32 pm_timer_block; /* [V1] 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ 249 u32 pm_timer_block; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */
250 u32 gpe0_block; /* [V1] 32-bit port address of General Purpose Event 0 Reg Blk */ 250 u32 gpe0_block; /* 32-bit port address of General Purpose Event 0 Reg Blk */
251 u32 gpe1_block; /* [V1] 32-bit port address of General Purpose Event 1 Reg Blk */ 251 u32 gpe1_block; /* 32-bit port address of General Purpose Event 1 Reg Blk */
252 u8 pm1_event_length; /* [V1] Byte Length of ports at pm1x_event_block */ 252 u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */
253 u8 pm1_control_length; /* [V1] Byte Length of ports at pm1x_control_block */ 253 u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */
254 u8 pm2_control_length; /* [V1] Byte Length of ports at pm2_control_block */ 254 u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */
255 u8 pm_timer_length; /* [V1] Byte Length of ports at pm_timer_block */ 255 u8 pm_timer_length; /* Byte Length of ports at pm_timer_block */
256 u8 gpe0_block_length; /* [V1] Byte Length of ports at gpe0_block */ 256 u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */
257 u8 gpe1_block_length; /* [V1] Byte Length of ports at gpe1_block */ 257 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */
258 u8 gpe1_base; /* [V1] Offset in GPE number space where GPE1 events start */ 258 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */
259 u8 cst_control; /* [V1] Support for the _CST object and C-States change notification */ 259 u8 cst_control; /* Support for the _CST object and C-States change notification */
260 u16 c2_latency; /* [V1] Worst case HW latency to enter/exit C2 state */ 260 u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */
261 u16 c3_latency; /* [V1] Worst case HW latency to enter/exit C3 state */ 261 u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */
262 u16 flush_size; /* [V1] Processor memory cache line width, in bytes */ 262 u16 flush_size; /* Processor memory cache line width, in bytes */
263 u16 flush_stride; /* [V1] Number of flush strides that need to be read */ 263 u16 flush_stride; /* Number of flush strides that need to be read */
264 u8 duty_offset; /* [V1] Processor duty cycle index in processor P_CNT reg */ 264 u8 duty_offset; /* Processor duty cycle index in processor P_CNT reg */
265 u8 duty_width; /* [V1] Processor duty cycle value bit width in P_CNT register */ 265 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */
266 u8 day_alarm; /* [V1] Index to day-of-month alarm in RTC CMOS RAM */ 266 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */
267 u8 month_alarm; /* [V1] Index to month-of-year alarm in RTC CMOS RAM */ 267 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */
268 u8 century; /* [V1] Index to century in RTC CMOS RAM */ 268 u8 century; /* Index to century in RTC CMOS RAM */
269 u16 boot_flags; /* [V3] IA-PC Boot Architecture Flags (see below for individual flags) */ 269 u16 boot_flags; /* IA-PC Boot Architecture Flags (see below for individual flags) */
270 u8 reserved; /* [V1] Reserved, must be zero */ 270 u8 reserved; /* Reserved, must be zero */
271 u32 flags; /* [V1] Miscellaneous flag bits (see below for individual flags) */ 271 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */
272 /* End of Version 1 FADT fields (ACPI 1.0) */ 272 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */
273 273 u8 reset_value; /* Value to write to the reset_register port to reset the system */
274 struct acpi_generic_address reset_register; /* [V3] 64-bit address of the Reset register */ 274 u16 arm_boot_flags; /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */
275 u8 reset_value; /* [V3] Value to write to the reset_register port to reset the system */ 275 u8 minor_revision; /* FADT Minor Revision (ACPI 5.1) */
276 u16 arm_boot_flags; /* [V5] ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ 276 u64 Xfacs; /* 64-bit physical address of FACS */
277 u8 minor_revision; /* [V5] FADT Minor Revision (ACPI 5.1) */ 277 u64 Xdsdt; /* 64-bit physical address of DSDT */
278 u64 Xfacs; /* [V3] 64-bit physical address of FACS */ 278 struct acpi_generic_address xpm1a_event_block; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */
279 u64 Xdsdt; /* [V3] 64-bit physical address of DSDT */ 279 struct acpi_generic_address xpm1b_event_block; /* 64-bit Extended Power Mgt 1b Event Reg Blk address */
280 struct acpi_generic_address xpm1a_event_block; /* [V3] 64-bit Extended Power Mgt 1a Event Reg Blk address */ 280 struct acpi_generic_address xpm1a_control_block; /* 64-bit Extended Power Mgt 1a Control Reg Blk address */
281 struct acpi_generic_address xpm1b_event_block; /* [V3] 64-bit Extended Power Mgt 1b Event Reg Blk address */ 281 struct acpi_generic_address xpm1b_control_block; /* 64-bit Extended Power Mgt 1b Control Reg Blk address */
282 struct acpi_generic_address xpm1a_control_block; /* [V3] 64-bit Extended Power Mgt 1a Control Reg Blk address */ 282 struct acpi_generic_address xpm2_control_block; /* 64-bit Extended Power Mgt 2 Control Reg Blk address */
283 struct acpi_generic_address xpm1b_control_block; /* [V3] 64-bit Extended Power Mgt 1b Control Reg Blk address */ 283 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
284 struct acpi_generic_address xpm2_control_block; /* [V3] 64-bit Extended Power Mgt 2 Control Reg Blk address */ 284 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
285 struct acpi_generic_address xpm_timer_block; /* [V3] 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ 285 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
286 struct acpi_generic_address xgpe0_block; /* [V3] 64-bit Extended General Purpose Event 0 Reg Blk address */ 286 struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register (ACPI 5.0) */
287 struct acpi_generic_address xgpe1_block; /* [V3] 64-bit Extended General Purpose Event 1 Reg Blk address */ 287 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register (ACPI 5.0) */
288 /* End of Version 3 FADT fields (ACPI 2.0) */ 288 u64 hypervisor_id; /* Hypervisor Vendor ID (ACPI 6.0) */
289
290 struct acpi_generic_address sleep_control; /* [V4] 64-bit Sleep Control register (ACPI 5.0) */
291 /* End of Version 4 FADT fields (ACPI 3.0 and ACPI 4.0) (Field was originally reserved in ACPI 3.0) */
292
293 struct acpi_generic_address sleep_status; /* [V5] 64-bit Sleep Status register (ACPI 5.0) */
294 /* End of Version 5 FADT fields (ACPI 5.0) */
295
296 u64 hypervisor_id; /* [V6] Hypervisor Vendor ID (ACPI 6.0) */
297 /* End of Version 6 FADT fields (ACPI 6.0) */
298
299}; 289};
300 290
301/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ 291/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */
@@ -311,8 +301,8 @@ struct acpi_table_fadt {
311 301
312/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */ 302/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */
313 303
314#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5] PSCI 0.2+ is implemented */ 304#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5+] PSCI 0.2+ is implemented */
315#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5] HVC must be used instead of SMC as the PSCI conduit */ 305#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */
316 306
317/* Masks for FADT flags */ 307/* Masks for FADT flags */
318 308
@@ -409,34 +399,20 @@ struct acpi_table_desc {
409 * match the expected length. In other words, the length of the 399 * match the expected length. In other words, the length of the
410 * FADT is the bottom line as to what the version really is. 400 * FADT is the bottom line as to what the version really is.
411 * 401 *
412 * NOTE: There is no officialy released V2 of the FADT. This 402 * For reference, the values below are as follows:
413 * version was used only for prototyping and testing during the 403 * FADT V1 size: 0x074
414 * 32-bit to 64-bit transition. V3 was the first official 64-bit 404 * FADT V2 size: 0x084
415 * version of the FADT. 405 * FADT V3 size: 0x0F4
416 * 406 * FADT V4 size: 0x0F4
417 * Update this list of defines when a new version of the FADT is 407 * FADT V5 size: 0x10C
418 * added to the ACPI specification. Note that the FADT version is 408 * FADT V6 size: 0x114
419 * only incremented when new fields are appended to the existing
420 * version. Therefore, the FADT version is competely independent
421 * from the version of the ACPI specification where it is
422 * defined.
423 *
424 * For reference, the various FADT lengths are as follows:
425 * FADT V1 size: 0x074 ACPI 1.0
426 * FADT V3 size: 0x0F4 ACPI 2.0
427 * FADT V4 size: 0x100 ACPI 3.0 and ACPI 4.0
428 * FADT V5 size: 0x10C ACPI 5.0
429 * FADT V6 size: 0x114 ACPI 6.0
430 */ 409 */
431#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4) /* ACPI 1.0 */ 410#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4)
432#define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control)) /* ACPI 2.0 */ 411#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (minor_revision) + 1)
433#define ACPI_FADT_V4_SIZE (u32) (ACPI_FADT_OFFSET (sleep_status)) /* ACPI 3.0 and ACPI 4.0 */ 412#define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control))
434#define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id)) /* ACPI 5.0 */ 413#define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id))
435#define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt)) /* ACPI 6.0 */ 414#define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt))
436
437/* Update these when new FADT versions are added */
438 415
439#define ACPI_FADT_MAX_VERSION 6
440#define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)" 416#define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)"
441 417
442#endif /* __ACTBL_H__ */ 418#endif /* __ACTBL_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a5d98d171866..e861a24f06f2 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -191,6 +191,9 @@
191#ifndef __init 191#ifndef __init
192#define __init 192#define __init
193#endif 193#endif
194#ifndef __iomem
195#define __iomem
196#endif
194 197
195/* Host-dependent types and defines for user-space ACPICA */ 198/* Host-dependent types and defines for user-space ACPICA */
196 199
diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
index a538ff44b108..a1883bbb0144 100644
--- a/tools/power/acpi/Makefile.config
+++ b/tools/power/acpi/Makefile.config
@@ -8,18 +8,19 @@
8# as published by the Free Software Foundation; version 2 8# as published by the Free Software Foundation; version 2
9# of the License. 9# of the License.
10 10
11include ../../../../scripts/Makefile.include 11ifeq ($(srctree),)
12 12srctree := $(patsubst %/,%,$(dir $(shell pwd)))
13OUTPUT=./ 13srctree := $(patsubst %/,%,$(dir $(srctree)))
14ifeq ("$(origin O)", "command line") 14#$(info Determined 'srctree' to be $(srctree))
15 OUTPUT := $(O)/
16endif 15endif
17 16
18ifneq ($(OUTPUT),) 17include $(srctree)/../../scripts/Makefile.include
19# check that the output directory actually exists 18
20OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) 19OUTPUT=$(srctree)/
21$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) 20ifeq ("$(origin O)", "command line")
21 OUTPUT := $(O)/power/acpi/
22endif 22endif
23#$(info Determined 'OUTPUT' to be $(OUTPUT))
23 24
24# --- CONFIGURATION BEGIN --- 25# --- CONFIGURATION BEGIN ---
25 26
@@ -70,8 +71,8 @@ WARNINGS := -Wall
70WARNINGS += $(call cc-supports,-Wstrict-prototypes) 71WARNINGS += $(call cc-supports,-Wstrict-prototypes)
71WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) 72WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
72 73
73KERNEL_INCLUDE := ../../../include 74KERNEL_INCLUDE := $(OUTPUT)include
74ACPICA_INCLUDE := ../../../drivers/acpi/acpica 75ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
75CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) 76CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
76CFLAGS += $(WARNINGS) 77CFLAGS += $(WARNINGS)
77 78
diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules
index ec87a9e562c0..373738338f51 100644
--- a/tools/power/acpi/Makefile.rules
+++ b/tools/power/acpi/Makefile.rules
@@ -8,28 +8,42 @@
8# as published by the Free Software Foundation; version 2 8# as published by the Free Software Foundation; version 2
9# of the License. 9# of the License.
10 10
11$(OUTPUT)$(TOOL): $(TOOL_OBJS) FORCE 11objdir := $(OUTPUT)tools/$(TOOL)/
12 $(ECHO) " LD " $@ 12toolobjs := $(addprefix $(objdir),$(TOOL_OBJS))
13 $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(TOOL_OBJS) -L$(OUTPUT) -o $@ 13$(OUTPUT)$(TOOL): $(toolobjs) FORCE
14 $(ECHO) " LD " $(subst $(OUTPUT),,$@)
15 $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(toolobjs) -L$(OUTPUT) -o $@
16 $(ECHO) " STRIP " $(subst $(OUTPUT),,$@)
14 $(QUIET) $(STRIPCMD) $@ 17 $(QUIET) $(STRIPCMD) $@
15 18
16$(OUTPUT)%.o: %.c 19$(KERNEL_INCLUDE):
17 $(ECHO) " CC " $@ 20 $(ECHO) " MKDIR " $(subst $(OUTPUT),,$@)
21 $(QUIET) mkdir -p $(KERNEL_INCLUDE)
22 $(ECHO) " CP " $(subst $(OUTPUT),,$@)
23 $(QUIET) cp -rf $(srctree)/../../../include/acpi $(KERNEL_INCLUDE)/
24
25$(objdir)%.o: %.c $(KERNEL_INCLUDE)
26 $(ECHO) " CC " $(subst $(OUTPUT),,$@)
18 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $< 27 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
19 28
20all: $(OUTPUT)$(TOOL) 29all: $(OUTPUT)$(TOOL)
21clean: 30clean:
22 -find $(OUTPUT) \( -not -type d \) \ 31 $(ECHO) " RMOBJ " $(subst $(OUTPUT),,$(objdir))
23 -and \( -name '*~' -o -name '*.[oas]' \) \ 32 $(QUIET) find $(objdir) \( -not -type d \)\
24 -type f -print \ 33 -and \( -name '*~' -o -name '*.[oas]' \)\
25 | xargs rm -f 34 -type f -print | xargs rm -f
26 -rm -f $(OUTPUT)$(TOOL) 35 $(ECHO) " RM " $(TOOL)
36 $(QUIET) rm -f $(OUTPUT)$(TOOL)
37 $(ECHO) " RMINC " $(subst $(OUTPUT),,$(KERNEL_INCLUDE))
38 $(QUIET) rm -rf $(KERNEL_INCLUDE)
27 39
28install-tools: 40install-tools:
29 $(INSTALL) -d $(DESTDIR)${sbindir} 41 $(ECHO) " INST " $(TOOL)
30 $(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)${sbindir} 42 $(QUIET) $(INSTALL) -d $(DESTDIR)$(sbindir)
43 $(QUIET) $(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)$(sbindir)
31uninstall-tools: 44uninstall-tools:
32 - rm -f $(DESTDIR)${sbindir}/$(TOOL) 45 $(ECHO) " UNINST " $(TOOL)
46 $(QUIET) rm -f $(DESTDIR)$(sbindir)/$(TOOL)
33 47
34install: all install-tools $(EXTRA_INSTALL) 48install: all install-tools $(EXTRA_INSTALL)
35uninstall: uninstall-tools $(EXTRA_UNINSTALL) 49uninstall: uninstall-tools $(EXTRA_UNINSTALL)
diff --git a/tools/power/acpi/tools/acpidbg/Makefile b/tools/power/acpi/tools/acpidbg/Makefile
index 352df4b41ae9..f2d06e773eb4 100644
--- a/tools/power/acpi/tools/acpidbg/Makefile
+++ b/tools/power/acpi/tools/acpidbg/Makefile
@@ -17,9 +17,7 @@ vpath %.c \
17 ../../os_specific/service_layers\ 17 ../../os_specific/service_layers\
18 . 18 .
19CFLAGS += -DACPI_APPLICATION -DACPI_SINGLE_THREAD -DACPI_DEBUGGER\ 19CFLAGS += -DACPI_APPLICATION -DACPI_SINGLE_THREAD -DACPI_DEBUGGER\
20 -I.\ 20 -I.
21 -I../../../../../drivers/acpi/acpica\
22 -I../../../../../include
23LDFLAGS += -lpthread 21LDFLAGS += -lpthread
24TOOL_OBJS = \ 22TOOL_OBJS = \
25 acpidbg.o 23 acpidbg.o
diff --git a/tools/power/acpi/tools/acpidbg/acpidbg.c b/tools/power/acpi/tools/acpidbg/acpidbg.c
index a88ac45b7756..4308362d7068 100644
--- a/tools/power/acpi/tools/acpidbg/acpidbg.c
+++ b/tools/power/acpi/tools/acpidbg/acpidbg.c
@@ -12,10 +12,16 @@
12#include <acpi/acpi.h> 12#include <acpi/acpi.h>
13 13
14/* Headers not included by include/acpi/platform/aclinux.h */ 14/* Headers not included by include/acpi/platform/aclinux.h */
15#include <unistd.h>
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19#include <error.h>
15#include <stdbool.h> 20#include <stdbool.h>
16#include <fcntl.h> 21#include <fcntl.h>
17#include <assert.h> 22#include <assert.h>
18#include <linux/circ_buf.h> 23#include <sys/select.h>
24#include "../../../../../include/linux/circ_buf.h"
19 25
20#define ACPI_AML_FILE "/sys/kernel/debug/acpi/acpidbg" 26#define ACPI_AML_FILE "/sys/kernel/debug/acpi/acpidbg"
21#define ACPI_AML_SEC_TICK 1 27#define ACPI_AML_SEC_TICK 1
diff --git a/tools/power/acpi/tools/acpidump/Makefile b/tools/power/acpi/tools/acpidump/Makefile
index 04b5db7c7c0b..f7c7af1f9258 100644
--- a/tools/power/acpi/tools/acpidump/Makefile
+++ b/tools/power/acpi/tools/acpidump/Makefile
@@ -19,9 +19,7 @@ vpath %.c \
19 ./\ 19 ./\
20 ../../common\ 20 ../../common\
21 ../../os_specific/service_layers 21 ../../os_specific/service_layers
22CFLAGS += -DACPI_DUMP_APP -I.\ 22CFLAGS += -DACPI_DUMP_APP -I.
23 -I../../../../../drivers/acpi/acpica\
24 -I../../../../../include
25TOOL_OBJS = \ 23TOOL_OBJS = \
26 apdump.o\ 24 apdump.o\
27 apfiles.o\ 25 apfiles.o\
@@ -49,7 +47,9 @@ TOOL_OBJS = \
49 47
50include ../../Makefile.rules 48include ../../Makefile.rules
51 49
52install-man: ../../man/acpidump.8 50install-man: $(srctree)/man/acpidump.8
53 $(INSTALL_DATA) -D $< $(DESTDIR)${mandir}/man8/acpidump.8 51 $(ECHO) " INST " acpidump.8
52 $(QUIET) $(INSTALL_DATA) -D $< $(DESTDIR)$(mandir)/man8/acpidump.8
54uninstall-man: 53uninstall-man:
55 - rm -f $(DESTDIR)${mandir}/man8/acpidump.8 54 $(ECHO) " UNINST " acpidump.8
55 $(QUIET) rm -f $(DESTDIR)$(mandir)/man8/acpidump.8