ACPI & PM queue for 3.7-merge
Subsystems (11)
Len Brown
maintainerPATCH 6/49 ACPICA: GPE Support: Update debug info for GPE tracing.
In reply to Len BrownFrom: Bob Moore <[email protected]>
Add additional debug info to assist with GPE debugging.
--- drivers/acpi/acpica/evgpe.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/acpi/acpica/evgpe.c +19 -2
@@ -379,6 +379,18 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)*/ if (!(gpe_register_info->enable_for_run | gpe_register_info->enable_for_wake)) { +ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS , +"Ignore disabled registers for GPE%02X-GPE%02X: " +"RunEnable=%02X, WakeEnable=%02X\n" , + gpe_register_info-> + base_gpe_number, + gpe_register_info-> + base_gpe_number + + (ACPI_GPE_REGISTER_WIDTH -1 ), + gpe_register_info-> + enable_for_run, + gpe_register_info-> + enable_for_wake));continue ; }
@@ -401,9 +413,14 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) }ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS , -"Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n" , +"Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " +"RunEnable=%02X, WakeEnable=%02X\n" , gpe_register_info->base_gpe_number, - status_reg, enable_reg)); + gpe_register_info->base_gpe_number + + (ACPI_GPE_REGISTER_WIDTH -1 ), + status_reg, enable_reg, + gpe_register_info->enable_for_run, + gpe_register_info->enable_for_wake));/* Check if there is anything active at all in this register */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 12/49 ACPICA: Update version to 20120816.
In reply to Len BrownFrom: Bob Moore <[email protected]>
Version 20120816.
--- include/acpi/acpixf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
@@ -47,7 +47,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20120711 +#define ACPI_CA_VERSION 0x20120816#include "acconfig.h" #include "actypes.h"
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 13/49 ACPI: Use ACPICA native way to decode the PLD buffer
In reply to Len BrownFrom: Feng Tang <[email protected]>
This patch is on top of the ACPICA 20120816 release, which implemented a native way to decode PLD buffer, so use it instead of leting upper level users do the decoding.
v2: Modify the check for PLD buffer length to reject buffers whose length < 16
--- drivers/acpi/utils.c | 11 +++++++---- include/acpi/acpi_bus.h | 31 +------------------------------ 2 files changed, 8 insertions(+), 34 deletions(-)
drivers/acpi/utils.c +7 -4
@@ -384,7 +384,7 @@ acpi_evaluate_reference(acpi_handle handle,EXPORT_SYMBOL (acpi_evaluate_reference);acpi_status -acpi_get_physical_device_location (acpi_handle handle,struct acpi_pld *pld) +acpi_get_physical_device_location (acpi_handle handle,struct acpi_pld_info **pld) {acpi_status status;struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL };
@@ -400,13 +400,16 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld)if (!output || output->type !=ACPI_TYPE_PACKAGE || !output->package.count || output->package.elements[0 ].type !=ACPI_TYPE_BUFFER - || output->package.elements[0 ].buffer.length >sizeof (*pld)) { + || output->package.elements[0 ].buffer.length <ACPI_PLD_REV1_BUFFER_SIZE ) { status =AE_TYPE ; goto out; } -memcpy (pld, output->package.elements[0 ].buffer.pointer, - output->package.elements[0 ].buffer.length); + status =acpi_decode_pld_buffer ( + output->package.elements[0 ].buffer.pointer, + output->package.elements[0 ].buffer.length, + pld); + out:kfree (buffer.pointer);return status;
include/acpi/acpi_bus.h +1 -30
@@ -54,37 +54,8 @@ acpi_status acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, u32 status_code, struct acpi_buffer *status_buf); -struct acpi_pld { -unsigned int revision:7 ;/* 0 */ -unsigned int ignore_colour:1 ;/* 7 */ -unsigned int colour:24 ;/* 8 */ -unsigned int width:16 ;/* 32 */ -unsigned int height:16 ;/* 48 */ -unsigned int user_visible:1 ;/* 64 */ -unsigned int dock:1 ;/* 65 */ -unsigned int lid:1 ;/* 66 */ -unsigned int panel:3 ;/* 67 */ -unsigned int vertical_pos:2 ;/* 70 */ -unsigned int horizontal_pos:2 ;/* 72 */ -unsigned int shape:4 ;/* 74 */ -unsigned int group_orientation:1 ;/* 78 */ -unsigned int group_token:8 ;/* 79 */ -unsigned int group_position:8 ;/* 87 */ -unsigned int bay:1 ;/* 95 */ -unsigned int ejectable:1 ;/* 96 */ -unsigned int ospm_eject_required:1 ;/* 97 */ -unsigned int cabinet_number:8 ;/* 98 */ -unsigned int card_cage_number:8 ;/* 106 */ -unsigned int reference:1 ;/* 114 */ -unsigned int rotation:4 ;/* 115 */ -unsigned int order:5 ;/* 119 */ -unsigned int reserved:4 ;/* 124 */ -unsigned int vertical_offset:16 ;/* 128 */ -unsigned int horizontal_offset:16 ;/* 144 */ -} __attribute__((__packed__ )); -acpi_status -acpi_get_physical_device_location (acpi_handle handle,struct acpi_pld *pld); +acpi_get_physical_device_location (acpi_handle handle,struct acpi_pld_info **pld);#ifdef CONFIG_ACPI #include <linux/proc_fs.h>
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 20/49 ACPI/button: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/acpi/button.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/acpi/button.c +1 -12
@@ -450,15 +450,4 @@ static int acpi_button_remove(struct acpi_device *device, int type)return 0 ; } -static int __init acpi_button_init (void ) -{ -return acpi_bus_register_driver (&acpi_button_driver); -} - -static void __exit acpi_button_exit(void) -{ -acpi_bus_unregister_driver (&acpi_button_driver); -} - -module_init (acpi_button_init); -module_exit (acpi_button_exit); +module_acpi_driver (acpi_button_driver);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 25/49 Input: atlas_btns - convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/input/misc/atlas_btns.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/input/misc/atlas_btns.c +1 -16
@@ -151,22 +151,7 @@ static struct acpi_driver atlas_acpi_driver = { .remove = atlas_acpi_button_remove, }, }; - -static int __init atlas_acpi_init (void ) -{ -if (acpi_disabled) -return -ENODEV ; - -return acpi_bus_register_driver (&atlas_acpi_driver); -} - -static void __exit atlas_acpi_exit(void) -{ -acpi_bus_unregister_driver (&atlas_acpi_driver); -} - -module_init (atlas_acpi_init); -module_exit (atlas_acpi_exit); +module_acpi_driver (atlas_acpi_driver);MODULE_AUTHOR ("Jaya Kumar" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 26/49 hp_accel: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/platform/x86/hp_accel.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/platform/x86/hp_accel.c +1 -24
@@ -382,31 +382,8 @@ static struct acpi_driver lis3lv02d_driver = { }, .drv.pm = HP_ACCEL_PM, }; - -static int __init lis3lv02d_init_module (void ) -{ -int ret; - -if (acpi_disabled) -return -ENODEV ; - - ret =acpi_bus_register_driver (&lis3lv02d_driver); -if (ret <0 ) -return ret; - -pr_info ("driver loaded\n" ); - -return 0 ; -} - -static void __exit lis3lv02d_exit_module(void) -{ -acpi_bus_unregister_driver (&lis3lv02d_driver); -} +module_acpi_driver (lis3lv02d_driver);MODULE_DESCRIPTION ("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED." );MODULE_AUTHOR ("Yan Burman, Eric Piel, Pavel Machek" );MODULE_LICENSE ("GPL" ); - -module_init (lis3lv02d_init_module); -module_exit (lis3lv02d_exit_module);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 28/49 topstar-laptop: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/platform/x86/topstar-laptop.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-)
drivers/platform/x86/topstar-laptop.c +1 -21
@@ -186,27 +186,7 @@ static struct acpi_driver acpi_topstar_driver = { .notify = acpi_topstar_notify, }, }; - -static int __init topstar_laptop_init (void ) -{ -int ret; - - ret =acpi_bus_register_driver (&acpi_topstar_driver); -if (ret <0 ) -return ret; - -pr_info ("ACPI extras driver loaded\n" ); - -return 0 ; -} - -static void __exit topstar_laptop_exit(void) -{ -acpi_bus_unregister_driver (&acpi_topstar_driver); -} - -module_init (topstar_laptop_init); -module_exit (topstar_laptop_exit); +module_acpi_driver (acpi_topstar_driver);MODULE_AUTHOR ("Herton Ronaldo Krzesinski" );MODULE_DESCRIPTION ("Topstar Laptop ACPI Extras driver" );
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 32/49 tools/power/acpi/acpidump: version 20060606
In reply to Len BrownFrom: Len Brown <[email protected]>
This is unchanged version 20060606, plus a small bit in DEFINE_ALTERNATE_TYPES to enable building with latest kernel headers.
--- tools/power/acpi/acpidump.c | 97 +++++++++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 38 deletions(-)
tools/power/acpi/acpidump.c +59 -38
@@ -1,5 +1,5 @@/* -* (c) Alexey Starikovskiy, Intel, 2005. +* (c) Alexey Starikovskiy, Intel, 2005-2006. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -77,16 +77,16 @@ static inline u8 checksum(u8 * buffer, u32 length) }static unsigned long psz, addr, length; -static int print, connect; +static int print, connect, skip;static u8 select_sig[4 ];static unsigned long read_efi_systab (void ) { +char buffer[80 ]; +unsigned long addr;FILE *f =fopen ("/sys/firmware/efi/systab" ,"r" );if (f) { -char buffer[80 ];while (fgets (buffer,80 , f)) { -unsigned long addr;if (sscanf (buffer,"ACPI20=0x%lx" , &addr) ==1 )return addr; }
@@ -97,13 +97,15 @@ static unsigned long read_efi_systab( void )static u8 *acpi_map_memory (unsigned long where,unsigned length) { +unsigned long offset; +u8 *there;int fd =open ("/dev/mem" ,O_RDONLY );if (fd <0 ) {fprintf (stderr,"acpi_os_map_memory: cannot open /dev/mem\n" );exit (1 ); } -unsigned long offset = where % psz; -u8 *there =mmap (NULL , length + offset,PROT_READ ,MAP_PRIVATE , + offset = where % psz; + there =mmap (NULL , length + offset,PROT_READ ,MAP_PRIVATE , fd, where - offset);close (fd);if (there ==MAP_FAILED )return 0 ;
@@ -118,10 +120,11 @@ static void acpi_unmap_memory(u8 * there, unsigned length)static struct acpi_table_header *acpi_map_table (unsigned long where,char *sig) { +unsigned size;struct acpi_table_header *tbl = (struct acpi_table_header *)acpi_map_memory (where,sizeof (struct acpi_table_header ));if (!tbl || (sig &&memcmp (sig, tbl->signature,4 )))return 0 ; -unsigned size = tbl->length; + size = tbl->length;acpi_unmap_memory ((u8 *) tbl,sizeof (struct acpi_table_header ));return (struct acpi_table_header *)acpi_map_memory (where, size); }
@@ -133,12 +136,13 @@ static void acpi_unmap_table(struct acpi_table_header *tbl) static struct acpi_rsdp_descriptor *acpi_scan_for_rsdp(u8 *begin, u32 length) { + struct acpi_rsdp_descriptor *rsdp; u8 *i, *end = begin + length; /* Search from given start address for the requested length */ for (i = begin; i < end; i += ACPI_RSDP_SCAN_STEP) { /* The signature and checksum must both be correct */ if (memcmp((char *)i, "RSD PTR ", 8)) continue; - struct acpi_rsdp_descriptor *rsdp = (struct acpi_rsdp_descriptor *)i; + rsdp = (struct acpi_rsdp_descriptor *)i; /* Signature matches, check the appropriate checksum */ if (!checksum((u8 *) rsdp, (rsdp->revision < 2) ? ACPI_RSDP_CHECKSUM_LENGTH :
@@ -156,9 +160,10 @@ static struct acpi_rsdp_descriptor *acpi_scan_for_rsdp(u8 *begin, u32 length)static void acpi_show_data (int fd,u8 * data,int size) {char buffer[256 ]; +int len;int i, remain = size;while (remain >0 ) { -int len =snprintf (buffer,256 ," %04x:" , size - remain); + len =snprintf (buffer,256 ," %04x:" , size - remain);for (i =0 ; i <16 && i < remain; i++) { len +=snprintf (&buffer[len],256 - len," %02x" , data[i]);
@@ -200,6 +205,10 @@ static void write_table(int fd, struct acpi_table_header *tbl, unsigned long addwrite (fd, tbl, tbl->length); } }else if (!select_done && !memcmp (select_sig, tbl->signature,4 )) { +if (skip >0 ) { + --skip; +return ; + }if (print) {acpi_show_table (fd, tbl, addr); }else {
@@ -265,8 +274,10 @@ no_facs:static int acpi_dump_SDT (int fd,struct acpi_rsdp_descriptor *rsdp) { -struct acpi_table_header *tbl =0 ; -int xsdt =1 ; +struct acpi_table_header *sdt, *tbl =0 ; +int xsdt =1 , i, num; +char *offset; +unsigned long addr;if (rsdp->revision >1 && rsdp->xsdt_physical_address) { tbl =acpi_map_table (rsdp->xsdt_physical_address,"XSDT" ); }
@@ -275,17 +286,17 @@ static int acpi_dump_SDT(int fd, struct acpi_rsdp_descriptor *rsdp) tbl =acpi_map_table (rsdp->rsdt_physical_address,"RSDT" ); }if (!tbl)return 0 ; -struct acpi_table_header *sdt =malloc (tbl->length); + sdt =malloc (tbl->length);memcpy (sdt, tbl, tbl->length);acpi_unmap_table (tbl);if (checksum ((u8 *)sdt, sdt->length))fprintf (stderr,"Wrong checksum for %s!\n" , (xsdt)?"XSDT" :"RSDT" ); -int i, num = (sdt->length -sizeof (struct acpi_table_header ))/((xsdt)?sizeof (u64):sizeof (u32)); -char *offset = (char *)sdt +sizeof (struct acpi_table_header ); -unsigned long addr; + num = (sdt->length -sizeof (struct acpi_table_header ))/((xsdt)?sizeof (u64):sizeof (u32)); + offset = (char *)sdt +sizeof (struct acpi_table_header );for (i =0 ; i < num; ++i, offset += ((xsdt) ?sizeof (u64) :sizeof (u32))) { addr = (xsdt) ? (unsigned long )(*(u64 *)offset): (unsigned long )(*(u32 *)offset); +if (!addr)continue ; tbl =acpi_map_table (addr,0 );if (!tbl)continue ;if (!memcmp (tbl->signature,FADT_SIG ,4 )) {
@@ -330,29 +341,36 @@ static void usage(const char *progname)puts ("\t--binary or -b -- dump data in binary form rather than in hex-dump format" );puts ("\t--length 0x456 or -l 0x456 -- works only with --addr, dump physical memory" "\n\t\tregion without trying to understand it's contents" ); +puts ("\t--skip 2 or -s 2 -- skip 2 tables of the given name and output only 3rd one" );puts ("\t--help or -h -- this help message" );exit (0 ); } +static struct option long_options[] = { + {"addr" ,1 ,0 ,0 }, + {"table" ,1 ,0 ,0 }, + {"output" ,1 ,0 ,0 }, + {"binary" ,0 ,0 ,0 }, + {"length" ,1 ,0 ,0 }, + {"skip" ,1 ,0 ,0 }, + {"help" ,0 ,0 ,0 }, + {0 ,0 ,0 ,0 } +};int main (int argc,char **argv) { +int option_index, c, fd; +u8 *raw; +struct acpi_rsdp_descriptor rsdpx, *x =0 ; +char *filename =0 ; +char buff[80 ];memset (select_sig,0 ,4 ); print =1 ; connect =0 ; -char *filename =0 ; addr = length =0 ; + skip =0 ;while (1 ) { -int option_index =0 ; -static struct option long_options[] = { - {"addr" ,1 ,0 ,0 }, - {"table" ,1 ,0 ,0 }, - {"output" ,1 ,0 ,0 }, - {"binary" ,0 ,0 ,0 }, - {"length" ,1 ,0 ,0 }, - {"help" ,0 ,0 ,0 }, - {0 ,0 ,0 ,0 } - }; -int c =getopt_long (argc, argv,"a:t:o:bl:h" , + option_index =0 ; + c =getopt_long (argc, argv,"a:t:o:bl:s:h" , long_options, &option_index);if (c ==-1 )break ;
@@ -376,6 +394,9 @@ int main(int argc, char **argv) length =strtoul (optarg, (char **)NULL ,16 );break ;case 5 : + skip =strtoul (optarg, (char **)NULL ,10 ); +break ; +case 6 :usage (argv[0 ]);exit (0 ); }
@@ -395,6 +416,9 @@ int main(int argc, char **argv)case 'l' : length =strtoul (optarg, (char **)NULL ,16 );break ; +case 's' : + skip =strtoul (optarg, (char **)NULL ,10 ); +break ;case 'h' :usage (argv[0 ]);exit (0 );
@@ -404,20 +428,19 @@ int main(int argc, char **argv)exit (0 ); } } - -int fd =STDOUT_FILENO ; + + fd =STDOUT_FILENO ;if (filename) { fd =creat (filename,S_IRUSR |S_IWUSR |S_IRGRP |S_IROTH );if (fd <0 )return fd; } - +if (!select_sig[0 ] && !print) { connect =1 ; } - + psz =sysconf (_SC_PAGESIZE); -u8 *raw;if (length && addr) {/* We know length and address, it means we just want a memory dump */ if (!(raw =acpi_map_memory (addr, length)))
@@ -426,7 +449,7 @@ int main(int argc, char **argv)acpi_unmap_memory (raw, length);return 0 ; } - + length =sizeof (struct acpi_rsdp_descriptor );if (!addr) { addr =read_efi_systab ();
@@ -435,12 +458,11 @@ int main(int argc, char **argv) length =ACPI_HI_RSDP_WINDOW_SIZE ; } } - -struct acpi_rsdp_descriptor rsdpx, *x =0 ; +if (!(raw =acpi_map_memory (addr, length)) || - !(x =acpi_scan_for_rsdp (raw, length))) + !(x =acpi_scan_for_rsdp (raw, length))) goto not_found; - +/* Find RSDP and print all found tables */ memcpy (&rsdpx, x,sizeof (struct acpi_rsdp_descriptor ));acpi_unmap_memory (raw, length);
@@ -454,7 +476,6 @@ int main(int argc, char **argv)write (fd, x, (rsdpx.revision <2 ) ?ACPI_RSDP_CHECKSUM_LENGTH :ACPI_RSDP_XCHECKSUM_LENGTH ); }else if (!select_sig[0 ] || !memcmp ("RSD PTR " , select_sig,4 )) { -char buff[80 ]; addr += (long )x - (long )raw; length =snprintf (buff,80 ,"RSD PTR @ %p\n" , (void *)addr);write (fd, buff, length);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 36/49 tools/power/acpi/acpidump: create acpidump(8), local make install targets
In reply to Len BrownFrom: Len Brown <[email protected]>
--- tools/power/acpi/Makefile | 4 +++ tools/power/acpi/acpidump.8 | 59 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 tools/power/acpi/acpidump.8
tools/power/acpi/Makefile +4 -0
@@ -12,3 +12,7 @@ CLEANFILES= $(PROG) clean : rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) *~ +install : + install acpidump /usr/bin/acpidump + install acpidump.8 /usr/share/man/man8 +
tools/power/acpi/acpidump.8 new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 40/49 tools/power turbostat: run on IVB Xeon
In reply to Len BrownFrom: Len Brown <[email protected]>
This fix is required to run on IVB Xeon,
which previously had an incorrect cpuid model number listed.
--- tools/power/x86/turbostat/turbostat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/power/x86/turbostat/turbostat.c +2 -2
@@ -1038,7 +1038,7 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model)case 0x2A :/* SNB */ case 0x2D :/* SNB Xeon */ case 0x3A :/* IVB */ -case 0x3D :/* IVB Xeon */ +case 0x3E :/* IVB Xeon */ return 1 ;case 0x2E :/* Nehalem-EX Xeon - Beckton */ case 0x2F :/* Westmere-EX Xeon - Eagleton */
@@ -1056,7 +1056,7 @@ int is_snb(unsigned int family, unsigned int model)case 0x2A :case 0x2D :case 0x3A :/* IVB */ -case 0x3D :/* IVB Xeon */ +case 0x3E :/* IVB Xeon */ return 1 ; }return 0 ;
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 41/49 tools/power turbostat: delete unused line
In reply to Len BrownFrom: Len Brown <[email protected]>
MSR_TSC is no longer needed because
we now use RDTSC directly.
--- tools/power/x86/turbostat/turbostat.c | 1 - 1 file changed, 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +0 -1
@@ -35,7 +35,6 @@#include <ctype.h> #include <sched.h> -#define MSR_TSC 0x10#define MSR_NEHALEM_PLATFORM_INFO 0xCE#define MSR_NEHALEM_TURBO_RATIO_LIMIT 0x1AD#define MSR_APERF 0xE8
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerHere's my queue for 3.7
add acpidump utilityintel_idle driver now supports IVB Xeon
turbostat can now count SMIs
ACPI can now bind to USB3 hubs
misc fixes
Let me know if you have troubles with any of these patches.
thanks,
Len Brown, Intel Open Source Technology Center
Len Brown
maintainerPATCH 1/49 ACPI: delelte more BFS/GTS related definition and code
From: Feng Tang <[email protected]>
This is a follow on for commmit 3f6f49c7 "ACPI: delete _GTS/_BFS support" to do more cleanup.
--- drivers/acpi/acpica/hwxfsleep.c | 1 - include/acpi/acnames.h | 2 -- include/acpi/actypes.h | 7 ------- 3 files changed, 10 deletions(-)
drivers/acpi/acpica/hwxfsleep.c +0 -1
@@ -381,7 +381,6 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)* FUNCTION: acpi_leave_sleep_state_prep * * PARAMETERS: sleep_state - Which sleep state we are exiting -* flags - ACPI_EXECUTE_BFS to run optional method * * RETURN: Status *
include/acpi/acnames.h +0 -2
@@ -66,8 +66,6 @@/* Method names - these methods must appear at the namespace root */ -#define METHOD_PATHNAME__BFS "\\_BFS" -#define METHOD_PATHNAME__GTS "\\_GTS"#define METHOD_PATHNAME__PTS "\\_PTS"#define METHOD_PATHNAME__SST "\\_SI._SST"#define METHOD_PATHNAME__WAK "\\_WAK"
include/acpi/actypes.h +0 -7
@@ -519,13 +519,6 @@ typedef u64 acpi_integer;#define ACPI_SLEEP_TYPE_INVALID 0xFF/* -* Sleep/Wake flags -*/ -#define ACPI_NO_OPTIONAL_METHODS 0x00/* Do not execute any optional methods */ -#define ACPI_EXECUTE_GTS 0x01/* For enter sleep interface */ -#define ACPI_EXECUTE_BFS 0x02/* For leave sleep prep interface */ - -/* * Standard notify values */ #define ACPI_NOTIFY_BUS_CHECK (u8) 0x00
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 2/49 ACPICA: Enable Scope change to root during module-level code execution.
In reply to Len BrownFrom: Bob Moore <[email protected]>
Allows constructs like this:
If (XXXX)
Scope (\)
...--- drivers/acpi/acpica/dswload.c | 14 ++++++++++++++ drivers/acpi/acpica/dswload2.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+)
drivers/acpi/acpica/dswload.c +14 -0
@@ -230,6 +230,20 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, walk_state->scope_info->common.value =ACPI_TYPE_ANY ;break ; +case ACPI_TYPE_METHOD : + +/* +* Allow scope change to root during execution of module-level +* code. Root is typed METHOD during this time. +*/ +if ((node == acpi_gbl_root_node) && + (walk_state-> + parse_flags &ACPI_PARSE_MODULE_LEVEL )) { +break ; + } + +/*lint -fallthrough */ +default :/* All other types are an error */
drivers/acpi/acpica/dswload2.c +14 -0
@@ -230,6 +230,20 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, walk_state->scope_info->common.value =ACPI_TYPE_ANY ;break ; +case ACPI_TYPE_METHOD : + +/* +* Allow scope change to root during execution of module-level +* code. Root is typed METHOD during this time. +*/ +if ((node == acpi_gbl_root_node) && + (walk_state-> + parse_flags &ACPI_PARSE_MODULE_LEVEL )) { +break ; + } + +/*lint -fallthrough */ +default :/* All other types are an error */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 3/49 ACPICA: Split ACPICA initialization functions to new file, utxfinit.c
In reply to Len BrownFrom: Bob Moore <[email protected]>
Split utxface.c to improve modularity and reduce file size.
--- drivers/acpi/acpica/Makefile | 1 + drivers/acpi/acpica/utxface.c | 267 +--------------------------------- drivers/acpi/acpica/utxfinit.c | 317 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 319 insertions(+), 266 deletions(-) create mode 100644 drivers/acpi/acpica/utxfinit.c
drivers/acpi/acpica/Makefile +1 -0
@@ -158,5 +158,6 @@ acpi-y += \ utresrc.o \ utstate.o \ utxface.o \ + utxfinit.o \ utxferror.o \ utxfmutex.o
drivers/acpi/acpica/utxface.c +1 -266
278 lines not on this page · raw message
drivers/acpi/acpica/utxfinit.c new file +317 -0
317 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 4/49 ACPICA: Comment update: Fix some typos in actble.h
In reply to Len BrownFrom: Bob Moore <[email protected]>
No functional change.
--- include/acpi/actbl.h | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-)
include/acpi/actbl.h +24 -24
@@ -94,7 +94,7 @@struct acpi_table_header {char signature[ACPI_NAME_SIZE ];/* ASCII table signature */ u32 length;/* Length of table in bytes, including this header */ -u8 revision;/* ACPI Specification minor version # */ +u8 revision;/* ACPI Specification minor version number */ u8 checksum;/* To make sum of entire table == 0 */ char oem_id[ACPI_OEM_ID_SIZE ];/* ASCII OEM identification */ char oem_table_id[ACPI_OEM_TABLE_ID_SIZE ];/* ASCII OEM table identification */
@@ -108,7 +108,7 @@ struct acpi_table_header {* GAS - Generic Address Structure (ACPI 2.0+) * * Note: Since this structure is used in the ACPI tables, it is byte aligned. -* If misaliged access is not supported by the hardware, accesses to the +* If misaligned access is not supported by the hardware, accesses to the * 64-bit Address field must be performed with care. * ******************************************************************************/
@@ -210,18 +210,18 @@ struct acpi_table_fadt {u8 preferred_profile;/* Conveys preferred power management profile to OSPM. */ u16 sci_interrupt;/* System vector of SCI interrupt */ u32 smi_command;/* 32-bit Port address of SMI command port */ -u8 acpi_enable;/* Value to write to smi_cmd to enable ACPI */ -u8 acpi_disable;/* Value to write to smi_cmd to disable ACPI */ -u8 s4_bios_request;/* Value to write to SMI CMD to enter S4BIOS state */ +u8 acpi_enable;/* Value to write to SMI_CMD to enable ACPI */ +u8 acpi_disable;/* Value to write to SMI_CMD to disable ACPI */ +u8 s4_bios_request;/* Value to write to SMI_CMD to enter S4BIOS state */ u8 pstate_control;/* Processor performance state control */ -u32 pm1a_event_block;/* 32-bit Port address of Power Mgt 1a Event Reg Blk */ -u32 pm1b_event_block;/* 32-bit Port address of Power Mgt 1b Event Reg Blk */ -u32 pm1a_control_block;/* 32-bit Port address of Power Mgt 1a Control Reg Blk */ -u32 pm1b_control_block;/* 32-bit Port address of Power Mgt 1b Control Reg Blk */ -u32 pm2_control_block;/* 32-bit Port address of Power Mgt 2 Control Reg Blk */ -u32 pm_timer_block;/* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ -u32 gpe0_block;/* 32-bit Port address of General Purpose Event 0 Reg Blk */ -u32 gpe1_block;/* 32-bit Port address of General Purpose Event 1 Reg Blk */ +u32 pm1a_event_block;/* 32-bit port address of Power Mgt 1a Event Reg Blk */ +u32 pm1b_event_block;/* 32-bit port address of Power Mgt 1b Event Reg Blk */ +u32 pm1a_control_block;/* 32-bit port address of Power Mgt 1a Control Reg Blk */ +u32 pm1b_control_block;/* 32-bit port address of Power Mgt 1b Control Reg Blk */ +u32 pm2_control_block;/* 32-bit port address of Power Mgt 2 Control Reg Blk */ +u32 pm_timer_block;/* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ +u32 gpe0_block;/* 32-bit port address of General Purpose Event 0 Reg Blk */ +u32 gpe1_block;/* 32-bit port address of General Purpose Event 1 Reg Blk */ u8 pm1_event_length;/* Byte Length of ports at pm1x_event_block */ u8 pm1_control_length;/* Byte Length of ports at pm1x_control_block */ u8 pm2_control_length;/* Byte Length of ports at pm2_control_block */
@@ -229,12 +229,12 @@ struct acpi_table_fadt {u8 gpe0_block_length;/* Byte Length of ports at gpe0_block */ u8 gpe1_block_length;/* Byte Length of ports at gpe1_block */ u8 gpe1_base;/* Offset in GPE number space where GPE1 events start */ -u8 cst_control;/* Support for the _CST object and C States change notification */ +u8 cst_control;/* Support for the _CST object and C-States change notification */ u16 c2_latency;/* Worst case HW latency to enter/exit C2 state */ u16 c3_latency;/* Worst case HW latency to enter/exit C3 state */ -u16 flush_size;/* Processor's memory cache line width, in bytes */ +u16 flush_size;/* Processor memory cache line width, in bytes */ u16 flush_stride;/* Number of flush strides that need to be read */ -u8 duty_offset;/* Processor duty cycle index in processor's P_CNT reg */ +u8 duty_offset;/* Processor duty cycle index in processor P_CNT reg */ u8 duty_width;/* Processor duty cycle value bit width in P_CNT register */ u8 day_alarm;/* Index to day-of-month alarm in RTC CMOS RAM */ u8 month_alarm;/* Index to month-of-year alarm in RTC CMOS RAM */
@@ -255,11 +255,11 @@ struct acpi_table_fadt {struct acpi_generic_address xpm_timer_block;/* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ struct acpi_generic_address xgpe0_block;/* 64-bit Extended General Purpose Event 0 Reg Blk address */ struct acpi_generic_address xgpe1_block;/* 64-bit Extended General Purpose Event 1 Reg Blk address */ -struct acpi_generic_address sleep_control;/* 64-bit Sleep Control register */ -struct acpi_generic_address sleep_status;/* 64-bit Sleep Status register */ +struct acpi_generic_address sleep_control;/* 64-bit Sleep Control register (ACPI 5.0) */ +struct acpi_generic_address sleep_status;/* 64-bit Sleep Status register (ACPI 5.0) */ }; -/* Masks for FADT Boot Architecture Flags (boot_flags) */ +/* Masks for FADT Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ #define ACPI_FADT_LEGACY_DEVICES (1)/* 00: [V2] System has LPC or ISA bus devices */ #define ACPI_FADT_8042 (1<<1)/* 01: [V3] System has an 8042 controller on port 60/64 */
@@ -272,13 +272,13 @@ struct acpi_table_fadt {/* Masks for FADT flags */ -#define ACPI_FADT_WBINVD (1)/* 00: [V1] The wbinvd instruction works properly */ -#define ACPI_FADT_WBINVD_FLUSH (1<<1)/* 01: [V1] wbinvd flushes but does not invalidate caches */ +#define ACPI_FADT_WBINVD (1)/* 00: [V1] The WBINVD instruction works properly */ +#define ACPI_FADT_WBINVD_FLUSH (1<<1)/* 01: [V1] WBINVD flushes but does not invalidate caches */ #define ACPI_FADT_C1_SUPPORTED (1<<2)/* 02: [V1] All processors support C1 state */ #define ACPI_FADT_C2_MP_SUPPORTED (1<<3)/* 03: [V1] C2 state works on MP system */ #define ACPI_FADT_POWER_BUTTON (1<<4)/* 04: [V1] Power button is handled as a control method device */ #define ACPI_FADT_SLEEP_BUTTON (1<<5)/* 05: [V1] Sleep button is handled as a control method device */ -#define ACPI_FADT_FIXED_RTC (1<<6)/* 06: [V1] RTC wakeup status not in fixed register space */ +#define ACPI_FADT_FIXED_RTC (1<<6)/* 06: [V1] RTC wakeup status is not in fixed register space */ #define ACPI_FADT_S4_RTC_WAKE (1<<7)/* 07: [V1] RTC alarm can wake system from S4 */ #define ACPI_FADT_32BIT_TIMER (1<<8)/* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ #define ACPI_FADT_DOCKING_SUPPORTED (1<<9)/* 09: [V1] Docking supported */
@@ -297,7 +297,7 @@ struct acpi_table_fadt {/* Values for preferred_profile (Preferred Power Management Profiles) */ -enum acpi_prefered_pm_profiles { +enum acpi_preferred_pm_profiles {PM_UNSPECIFIED =0 ,PM_DESKTOP =1 ,PM_MOBILE =2 ,
@@ -335,7 +335,7 @@ union acpi_name_union {struct acpi_table_desc {acpi_physical_address address;struct acpi_table_header *pointer; -u32 length;/* Length fixed at 32 bits */ +u32 length;/* Length fixed at 32 bits (fixed in table header) */ union acpi_name_union signature;acpi_owner_id owner_id;u8 flags;
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 5/49 ACPICA: Add Windows8/Server2012 string for _OSI method.
In reply to Len BrownFrom: Bob Moore <[email protected]>
This change adds a new _OSI string, "Windows 2012" for both Windows 8 and Windows Server 2012.
Quoted 1 line
From Microsoft document "How to Identify the Windows Version in ACPI
by Using _OSI", July 13, 2012.
--- drivers/acpi/acpica/aclocal.h | 1 + drivers/acpi/acpica/utosi.c | 1 + 2 files changed, 2 insertions(+)
drivers/acpi/acpica/aclocal.h +1 -0
@@ -932,6 +932,7 @@ struct acpi_bit_register_info {#define ACPI_OSI_WIN_VISTA_SP1 0x09#define ACPI_OSI_WIN_VISTA_SP2 0x0A#define ACPI_OSI_WIN_7 0x0B +#define ACPI_OSI_WIN_8 0x0C#define ACPI_ALWAYS_ILLEGAL 0x00
drivers/acpi/acpica/utosi.c +1 -0
@@ -73,6 +73,7 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = { {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ + {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ /* Feature Group Strings */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 7/49 ACPICA: Debug output: Update output for Processor object.
In reply to Len BrownFrom: Bob Moore <[email protected]>
Cleanup output for Processor(). Length is a byte, not a word.
--- drivers/acpi/acpica/nsdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/nsdump.c +1 -1
@@ -264,7 +264,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,switch (type) {case ACPI_TYPE_PROCESSOR : - acpi_os_printf("ID %X Len %.4X Addr %p\n", + acpi_os_printf("ID %02X Len %02X Addr %p\n", obj_desc->processor.proc_id, obj_desc->processor.length, ACPI_CAST_PTR(void,
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 8/49 ACPICA: GPE support: Remove extraneous parameter from low-level function.
In reply to Len BrownFrom: Feng Tang <[email protected]>
The gpe_register_info argument is no longer needed, reduce it to make code simpler.
--- drivers/acpi/acpica/achware.h | 3 +-- drivers/acpi/acpica/evgpe.c | 3 +-- drivers/acpi/acpica/evxfgpe.c | 3 +-- drivers/acpi/acpica/hwgpe.c | 15 +++++---------- 4 files changed, 8 insertions(+), 16 deletions(-)
drivers/acpi/acpica/achware.h +1 -2
@@ -110,8 +110,7 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width);/* * hwgpe - GPE support */ -u32 acpi_hw_get_gpe_register_bit (struct acpi_gpe_event_info *gpe_event_info, -struct acpi_gpe_register_info *gpe_register_info); +u32 acpi_hw_get_gpe_register_bit (struct acpi_gpe_event_info *gpe_event_info);acpi_status acpi_hw_low_set_gpe (struct acpi_gpe_event_info *gpe_event_info,u32 action);
drivers/acpi/acpica/evgpe.c +1 -2
@@ -80,8 +80,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)return_ACPI_STATUS (AE_NOT_EXIST ); } - register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info, - gpe_register_info); + register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info);/* Clear the run bit up front */
drivers/acpi/acpica/evxfgpe.c +1 -2
@@ -357,8 +357,7 @@ acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 ac goto unlock_and_exit; } - register_bit = -acpi_hw_get_gpe_register_bit (gpe_event_info, gpe_register_info); + register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info);/* Perform the action */
drivers/acpi/acpica/hwgpe.c +5 -10
@@ -60,7 +60,6 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,* FUNCTION: acpi_hw_get_gpe_register_bit * * PARAMETERS: gpe_event_info - Info block for the GPE -* gpe_register_info - Info block for the GPE register * * RETURN: Register mask with a one in the GPE bit position *
@@ -69,11 +68,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,* ******************************************************************************/ -u32 acpi_hw_get_gpe_register_bit (struct acpi_gpe_event_info *gpe_event_info, -struct acpi_gpe_register_info *gpe_register_info) +u32 acpi_hw_get_gpe_register_bit (struct acpi_gpe_event_info *gpe_event_info) {return (u32 )1 << (gpe_event_info->gpe_number - - gpe_register_info->base_gpe_number); + gpe_event_info->register_info->base_gpe_number); }/******************************************************************************
@@ -115,8 +113,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)/* Set or clear just the bit that corresponds to this GPE */ - register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info, - gpe_register_info); + register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info);switch (action) {case ACPI_GPE_CONDITIONAL_ENABLE :
@@ -178,8 +175,7 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)* Write a one to the appropriate bit in the status register to * clear this GPE. */ - register_bit = -acpi_hw_get_gpe_register_bit (gpe_event_info, gpe_register_info); + register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info); status =acpi_hw_write (register_bit, &gpe_register_info->status_address);
@@ -222,8 +218,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,/* Get the register bitmask for this GPE */ - register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info, - gpe_register_info); + register_bit =acpi_hw_get_gpe_register_bit (gpe_event_info);/* GPE currently enabled? (enabled for runtime?) */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 9/49 ACPICA: Headers: Add support for CSRT and DBG2 ACPI tables.
In reply to Len BrownFrom: Bob Moore <[email protected]>
These tables are defined outside of the ACPI specification.
--- include/acpi/actbl2.h | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/acpi/actbl3.h | 1 - 2 files changed, 111 insertions(+), 1 deletion(-)
include/acpi/actbl2.h +111 -0
@@ -63,6 +63,8 @@*/ #define ACPI_SIG_ASF "ASF!"/* Alert Standard Format table */ #define ACPI_SIG_BOOT "BOOT"/* Simple Boot Flag Table */ +#define ACPI_SIG_CSRT "CSRT"/* Core System Resource Table */ +#define ACPI_SIG_DBG2 "DBG2"/* Debug Port table type 2 */ #define ACPI_SIG_DBGP "DBGP"/* Debug Port table */ #define ACPI_SIG_DMAR "DMAR"/* DMA Remapping table */ #define ACPI_SIG_HPET "HPET"/* High Precision Event Timer table */
@@ -232,6 +234,115 @@ struct acpi_table_boot {/******************************************************************************* * +* CSRT - Core System Resource Table +* Version 0 +* +* Conforms to the "Core System Resource Table (CSRT)", November 14, 2011 +* +******************************************************************************/ + +struct acpi_table_csrt { +struct acpi_table_header header;/* Common ACPI table header */ +}; + +/* Resource Group subtable */ + +struct acpi_csrt_group { +u32 length; +u32 vendor_id; +u32 subvendor_id; +u16 device_id; +u16 subdevice_id; +u16 revision; +u16 reserved; +u32 info_length; + +/* Shared data (length = info_length) immediately follows */ +}; + +/* Resource Descriptor subtable */ + +struct acpi_csrt_descriptor { +u32 length; +u16 type; +u16 subtype; +u32 uid; + +/* Resource-specific information immediately follows */ +}; + +/* Resource Types */ + +#define ACPI_CSRT_TYPE_INTERRUPT 0x0001 +#define ACPI_CSRT_TYPE_TIMER 0x0002 +#define ACPI_CSRT_TYPE_DMA 0x0003 + +/* Resource Subtypes */ + +#define ACPI_CSRT_XRUPT_LINE 0x0000 +#define ACPI_CSRT_XRUPT_CONTROLLER 0x0001 +#define ACPI_CSRT_TIMER 0x0000 +#define ACPI_CSRT_DMA_CHANNEL 0x0000 +#define ACPI_CSRT_DMA_CONTROLLER 0x0001 + +/******************************************************************************* +* +* DBG2 - Debug Port Table 2 +* Version 0 (Both main table and subtables) +* +* Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012. +* +******************************************************************************/ + +struct acpi_table_dbg2 { +struct acpi_table_header header;/* Common ACPI table header */ +u32 info_offset; +u32 info_count; +}; + +/* Debug Device Information Subtable */ + +struct acpi_dbg2_device { +u8 revision; +u16 length; +u8 register_count;/* Number of base_address registers */ +u16 namepath_length; +u16 namepath_offset; +u16 oem_data_length; +u16 oem_data_offset; +u16 port_type; +u16 port_subtype; +u16 reserved; +u16 base_address_offset; +u16 address_size_offset; +/* +* Data that follows: +* base_address (required) - Each in 12-byte Generic Address Structure format. +* address_size (required) - Array of u32 sizes corresponding to each base_address register. +* Namepath (required) - Null terminated string. Single dot if not supported. +* oem_data (optional) - Length is oem_data_length. +*/ +}; + +/* Types for port_type field above */ + +#define ACPI_DBG2_SERIAL_PORT 0x8000 +#define ACPI_DBG2_1394_PORT 0x8001 +#define ACPI_DBG2_USB_PORT 0x8002 +#define ACPI_DBG2_NET_PORT 0x8003 + +/* Subtypes for port_subtype field above */ + +#define ACPI_DBG2_16550_COMPATIBLE 0x0000 +#define ACPI_DBG2_16550_SUBSET 0x0001 + +#define ACPI_DBG2_1394_STANDARD 0x0000 + +#define ACPI_DBG2_USB_XHCI 0x0000 +#define ACPI_DBG2_USB_EHCI 0x0001 + +/******************************************************************************* +* * DBGP - Debug Port table * Version 1 *
include/acpi/actbl3.h +0 -1
@@ -75,7 +75,6 @@/* Reserved table signatures */ #define ACPI_SIG_CSRT "CSRT"/* Core System Resources Table */ -#define ACPI_SIG_DBG2 "DBG2"/* Debug Port table 2 */ #define ACPI_SIG_MATR "MATR"/* Memory Address Translation Table */ #define ACPI_SIG_MSDM "MSDM"/* Microsoft Data Management Table */ #define ACPI_SIG_WPBT "WPBT"/* Windows Platform Binary Table */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 10/49 ACPICA: Add support for complex _PLD buffers.
In reply to Len BrownFrom: Bob Moore <[email protected]>
_PLD (Physical Location of Device) returns a bit-packed buffer that is difficult to parse. This change adds a new interface, AcpiDecodePldBuffer that parses the buffer into a more usable local struct. Also adds macros to both get and set individual fields within the packed _PLD buffer. Adds a new include file, acbuffer.h - which will be expanded to add structs for other ACPI names that return buffers. ACPICA BZ 954.
Emit (in comments) the decoded contents of a static _PLD buffer in order to improve comprehension of this bit-packed buffer.
Add multi-endian support to the _PLD decode routine. Deploy the multi-endian macros to extract data from the _PLD buffer.
--- drivers/acpi/acpica/aclocal.h | 22 +++-- drivers/acpi/acpica/acmacros.h | 29 ++++++- drivers/acpi/acpica/utxface.c | 87 +++++++++++++++++++ include/acpi/acbuffer.h | 192 +++++++++++++++++++++++++++++++++++++++++ include/acpi/acnames.h | 1 + include/acpi/acpixf.h | 5 ++ include/acpi/actbl.h | 12 ++- include/acpi/actbl1.h | 12 ++- include/acpi/actbl2.h | 12 ++- include/acpi/actbl3.h | 12 ++- 10 files changed, 360 insertions(+), 24 deletions(-) create mode 100644 include/acpi/acbuffer.h
drivers/acpi/acpica/aclocal.h +13 -9
@@ -707,15 +707,18 @@ union acpi_parse_value {u8 disasm_opcode;/* Subtype used for disassembly */ \ char aml_op_name[16]) /* Op name (debug only) */ -#define ACPI_DASM_BUFFER 0x00 -#define ACPI_DASM_RESOURCE 0x01 -#define ACPI_DASM_STRING 0x02 -#define ACPI_DASM_UNICODE 0x03 -#define ACPI_DASM_EISAID 0x04 -#define ACPI_DASM_MATCHOP 0x05 -#define ACPI_DASM_LNOT_PREFIX 0x06 -#define ACPI_DASM_LNOT_SUFFIX 0x07 -#define ACPI_DASM_IGNORE 0x08 +/* Flags for disasm_flags field above */ + +#define ACPI_DASM_BUFFER 0x00/* Buffer is a simple data buffer */ +#define ACPI_DASM_RESOURCE 0x01/* Buffer is a Resource Descriptor */ +#define ACPI_DASM_STRING 0x02/* Buffer is a ASCII string */ +#define ACPI_DASM_UNICODE 0x03/* Buffer is a Unicode string */ +#define ACPI_DASM_PLD_METHOD 0x04/* Buffer is a _PLD method bit-packed buffer */ +#define ACPI_DASM_EISAID 0x05/* Integer is an EISAID */ +#define ACPI_DASM_MATCHOP 0x06/* Parent opcode is a Match() operator */ +#define ACPI_DASM_LNOT_PREFIX 0x07/* Start of a Lnot_equal (etc.) pair of opcodes */ +#define ACPI_DASM_LNOT_SUFFIX 0x08/* End of a Lnot_equal (etc.) pair of opcodes */ +#define ACPI_DASM_IGNORE 0x09/* Not used at this time */ /* * Generic operation (for example: If, While, Store)
@@ -1025,6 +1028,7 @@ struct acpi_port_info {****************************************************************************/ struct acpi_db_method_info { +acpi_handle method;acpi_handle main_thread_gate;acpi_handle thread_complete_gate;acpi_thread_id *threads;
drivers/acpi/acpica/acmacros.h +26 -3
@@ -277,10 +277,33 @@/* Bitfields within ACPI registers */ -#define ACPI_REGISTER_PREPARE_BITS (val, pos, mask) ((val << pos) & mask) -#define ACPI_REGISTER_INSERT_VALUE (reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) +#define ACPI_REGISTER_PREPARE_BITS (val, pos, mask) \ + ((val << pos) & mask) -#define ACPI_INSERT_BITS (target, mask, source) target = ((target & (~(mask))) | (source & mask)) +#define ACPI_REGISTER_INSERT_VALUE (reg, pos, mask, val) \ + reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) + +#define ACPI_INSERT_BITS (target, mask, source) \ + target = ((target & (~(mask))) | (source & mask)) + +/* Generic bitfield macros and masks */ + +#define ACPI_GET_BITS (source_ptr, position, mask) \ + ((*source_ptr >> position) & mask) + +#define ACPI_SET_BITS (target_ptr, position, mask, value) \ + (*target_ptr |= ((value & mask) << position)) + +#define ACPI_1BIT_MASK 0x00000001 +#define ACPI_2BIT_MASK 0x00000003 +#define ACPI_3BIT_MASK 0x00000007 +#define ACPI_4BIT_MASK 0x0000000F +#define ACPI_5BIT_MASK 0x0000001F +#define ACPI_6BIT_MASK 0x0000003F +#define ACPI_7BIT_MASK 0x0000007F +#define ACPI_8BIT_MASK 0x000000FF +#define ACPI_16BIT_MASK 0x0000FFFF +#define ACPI_24BIT_MASK 0x00FFFFFF/* * An object of type struct acpi_namespace_node can appear in some contexts
drivers/acpi/acpica/utxface.c +87 -0
90 lines not on this page · raw message
include/acpi/acbuffer.h new file +192 -0
192 lines not on this page · raw message
include/acpi/acnames.h +1 -0
@@ -63,6 +63,7 @@#define METHOD_NAME__PRW "_PRW"#define METHOD_NAME__SRS "_SRS"#define METHOD_NAME__CBA "_CBA" +#define METHOD_NAME__PLD "_PLD"/* Method names - these methods must appear at the namespace root */
include/acpi/acpixf.h +5 -0
@@ -52,6 +52,7 @@#include "acconfig.h" #include "actypes.h" #include "actbl.h" +#include "acbuffer.h" extern u8 acpi_gbl_permanent_mmap;
@@ -144,6 +145,10 @@ acpi_check_address_range(acpi_adr_space_type space_id,acpi_physical_address address, acpi_size length, u8 warn); +acpi_status +acpi_decode_pld_buffer (u8 *in_buffer, +acpi_size length,struct acpi_pld_info **return_buffer); +/* * ACPI Memory management */
include/acpi/actbl.h +9 -3
@@ -79,9 +79,15 @@#pragma pack(1)/* -* Note about bitfields: The u8 type is used for bitfields in ACPI tables. -* This is the only type that is even remotely portable. Anything else is not -* portable, so do not use any other bitfield types. +* Note: C bitfields are not used for this reason: +* +* "Bitfields are great and easy to read, but unfortunately the C language +* does not specify the layout of bitfields in memory, which means they are +* essentially useless for dealing with packed data in on-disk formats or +* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, +* this decision was a design error in C. Ritchie could have picked an order +* and stuck with it." Norman Ramsey. +* See http://stackoverflow.com/a/1053662/41661 */ /*******************************************************************************
include/acpi/actbl1.h +9 -3
@@ -79,9 +79,15 @@#pragma pack(1)/* -* Note about bitfields: The u8 type is used for bitfields in ACPI tables. -* This is the only type that is even remotely portable. Anything else is not -* portable, so do not use any other bitfield types. +* Note: C bitfields are not used for this reason: +* +* "Bitfields are great and easy to read, but unfortunately the C language +* does not specify the layout of bitfields in memory, which means they are +* essentially useless for dealing with packed data in on-disk formats or +* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, +* this decision was a design error in C. Ritchie could have picked an order +* and stuck with it." Norman Ramsey. +* See http://stackoverflow.com/a/1053662/41661 */ /*******************************************************************************
include/acpi/actbl2.h +9 -3
@@ -98,9 +98,15 @@#pragma pack(1)/* -* Note about bitfields: The u8 type is used for bitfields in ACPI tables. -* This is the only type that is even remotely portable. Anything else is not -* portable, so do not use any other bitfield types. +* Note: C bitfields are not used for this reason: +* +* "Bitfields are great and easy to read, but unfortunately the C language +* does not specify the layout of bitfields in memory, which means they are +* essentially useless for dealing with packed data in on-disk formats or +* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, +* this decision was a design error in C. Ritchie could have picked an order +* and stuck with it." Norman Ramsey. +* See http://stackoverflow.com/a/1053662/41661 */ /*******************************************************************************
include/acpi/actbl3.h +9 -3
@@ -86,9 +86,15 @@#pragma pack(1)/* -* Note about bitfields: The u8 type is used for bitfields in ACPI tables. -* This is the only type that is even remotely portable. Anything else is not -* portable, so do not use any other bitfield types. +* Note: C bitfields are not used for this reason: +* +* "Bitfields are great and easy to read, but unfortunately the C language +* does not specify the layout of bitfields in memory, which means they are +* essentially useless for dealing with packed data in on-disk formats or +* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, +* this decision was a design error in C. Ritchie could have picked an order +* and stuck with it." Norman Ramsey. +* See http://stackoverflow.com/a/1053662/41661 */ /*******************************************************************************
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 11/49 ACPICA: Add struct header support for _FDE, _GRT, _GTM, and _SRT names.
In reply to Len BrownFrom: Bob Moore <[email protected]>
Added structs for the buffers related to these predefined names, in acbuffer.h
--- include/acpi/acbuffer.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
include/acpi/acbuffer.h +43 -0
@@ -45,6 +45,11 @@#define __ACBUFFER_H__/* +* Contains buffer structures for these predefined names: +* _FDE, _GRT, _GTM, _PLD, _SRT +*/ + +/* * Note: C bitfields are not used for this reason: * * "Bitfields are great and easy to read, but unfortunately the C language
@@ -56,6 +61,44 @@* See http://stackoverflow.com/a/1053662/41661 */ +/* _FDE return value */ + +struct acpi_fde_info { +u32 floppy0; +u32 floppy1; +u32 floppy2; +u32 floppy3; +u32 tape; +}; + +/* +* _GRT return value +* _SRT input value +*/ +struct acpi_grt_info { +u16 year; +u8 month; +u8 day; +u8 hour; +u8 minute; +u8 second; +u8 valid; +u16 milliseconds; +u16 timezone; +u8 daylight; +u8 reserved[3 ]; +}; + +/* _GTM return value */ + +struct acpi_gtm_info { +u32 pio_speed0; +u32 dma_speed0; +u32 pio_speed1; +u32 dma_speed1; +u32 flags; +}; +/* * Formatted _PLD return value. The minimum size is a package containing * one buffer.
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 14/49 usb-acpi: Comply with the ACPI API change
In reply to Len BrownFrom: Feng Tang <[email protected]>
acpi_get_physical_device_location()'s 2nd argument has been changed in ACPI implementaion, so need a follow-on change in usb_acpi_check_pld().
--- drivers/usb/core/usb-acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/core/usb-acpi.c +3 -2
@@ -52,18 +52,19 @@ out:static int usb_acpi_check_pld (struct usb_device *udev,acpi_handle handle) {acpi_status status; -struct acpi_pld pld; +struct acpi_pld_info *pld; status =acpi_get_physical_device_location (handle, &pld);if (ACPI_FAILURE (status))return -ENODEV ; -if (pld.user_visible) +if (pld->user_visible) udev->removable =USB_DEVICE_REMOVABLE ;else udev->removable =USB_DEVICE_FIXED ; +ACPI_FREE (pld);return 0 ; }
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 15/49 ACPICA: Headers: Add new ACPI 5 HEST notify type values.
In reply to Len BrownFrom: Bob Moore <[email protected]>
Add values 5 (CMCI) and 6 (MCE).
--- include/acpi/actbl1.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/acpi/actbl1.h +3 -1
@@ -495,7 +495,9 @@ enum acpi_hest_notify_types {ACPI_HEST_NOTIFY_LOCAL =2 ,ACPI_HEST_NOTIFY_SCI =3 ,ACPI_HEST_NOTIFY_NMI =4 , - ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ +ACPI_HEST_NOTIFY_CMCI =5 ,/* ACPI 5.0 */ +ACPI_HEST_NOTIFY_MCE =6 ,/* ACPI 5.0 */ + ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */ };/* Values for config_write_enable bitfield above */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 16/49 ACPICA: Table Manager: Merge duplicate code (root table)
In reply to Len BrownFrom: Lv Zheng <[email protected]>
Merge/remove duplicate code in the root table resize functions One function is external, the other is internal. Lv Zheng,
ACPICA BZ 846:
https://acpica.org/bugzilla/show_bug.cgi?id=846
--- drivers/acpi/acpica/tbinstal.c | 20 +++++++++++++------- drivers/acpi/acpica/tbxface.c | 41 +++++------------------------------------ 2 files changed, 18 insertions(+), 43 deletions(-)
drivers/acpi/acpica/tbinstal.c +13 -7
@@ -350,6 +350,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_headeracpi_status acpi_tb_resize_root_table_list (void ) {struct acpi_table_desc *tables; +u32 table_count;ACPI_FUNCTION_TRACE (tb_resize_root_table_list);
@@ -363,8 +364,13 @@ acpi_status acpi_tb_resize_root_table_list(void)/* Increase the Table Array size */ - tables =ACPI_ALLOCATE_ZEROED (((acpi_size ) acpi_gbl_root_table_list. - max_table_count + +if (acpi_gbl_root_table_list.flags &ACPI_ROOT_ORIGIN_ALLOCATED ) { + table_count = acpi_gbl_root_table_list.max_table_count; + }else { + table_count = acpi_gbl_root_table_list.current_table_count; + } + + tables =ACPI_ALLOCATE_ZEROED (((acpi_size ) table_count +ACPI_ROOT_TABLE_SIZE_INCREMENT ) *sizeof (struct acpi_table_desc ));if (!tables) {
@@ -377,8 +383,8 @@ acpi_status acpi_tb_resize_root_table_list(void)if (acpi_gbl_root_table_list.tables) {ACPI_MEMCPY (tables, acpi_gbl_root_table_list.tables, - (acpi_size ) acpi_gbl_root_table_list. - max_table_count *sizeof (struct acpi_table_desc )); + (acpi_size ) table_count * +sizeof (struct acpi_table_desc ));if (acpi_gbl_root_table_list.flags &ACPI_ROOT_ORIGIN_ALLOCATED ) {ACPI_FREE (acpi_gbl_root_table_list.tables);
@@ -386,9 +392,9 @@ acpi_status acpi_tb_resize_root_table_list(void) } acpi_gbl_root_table_list.tables = tables; - acpi_gbl_root_table_list.max_table_count += -ACPI_ROOT_TABLE_SIZE_INCREMENT ; - acpi_gbl_root_table_list.flags |= (u8 )ACPI_ROOT_ORIGIN_ALLOCATED ; + acpi_gbl_root_table_list.max_table_count = + table_count +ACPI_ROOT_TABLE_SIZE_INCREMENT ; + acpi_gbl_root_table_list.flags |=ACPI_ROOT_ORIGIN_ALLOCATED ;return_ACPI_STATUS (AE_OK ); }
drivers/acpi/acpica/tbxface.c +5 -36
58 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 17/49 ACPICA: Update version to 20120913
In reply to Len BrownFrom: Bob Moore <[email protected]>
Version 20120913.
--- include/acpi/acpixf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
@@ -47,7 +47,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20120816 +#define ACPI_CA_VERSION 0x20120913#include "acconfig.h" #include "actypes.h"
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 18/49 ACPI: Allow ACPI binding with USB-3.0 hub
In reply to Len BrownFrom: Lan Tianyu <[email protected]>
A USB port's position and connectability can't be identified on some boards via USB hub registers. ACPI _UPC and _PLD can help to resolve this issue and so it is necessary to bind USB with ACPI. This patch is to allow ACPI binding with USB-3.0 hub.
Current ACPI only can bind one struct-device to one ACPI device node. This can not work with USB-3.0 hub, because the USB-3.0 hub has two logical devices. Each works for USB-2.0 and USB-3.0 devices. In the Linux USB subsystem, those two logical hubs are treated as two seperate devices that have two struct devices. But in the ACPI DSDT, these two logical hubs share one ACPI device node. So there is a requirement to bind multi struct-devices to one ACPI device node. This patch is to resolve such problem.
Following is the ACPI device nodes' description under xhci hcd.
Device (XHC)
Device (RHUB)
Device (HSP1)
Device (HSP2)
Device (HSP3)
Device (HSP4)
Device (SSP1)
Device (SSP2)
Device (SSP3)
Device (SSP4)
Topology in the Linux
device XHC USB-2.0 logical hub USB-3.0 logical hub HSP1 SSP1 HSP2 SSP2 HSP3 SSP3 HSP4 SSP4
This patch also modifies the output of /proc/acpi/wakeup. One ACPI node can be associated with multiple devices:
XHC S4 *enabled pci:0000:00:14.0
RHUB S0 disabled usb:usb1
disabled usb:usb2
--- drivers/acpi/glue.c | 135 +++++++++++++++++++++++++++++---------------- drivers/acpi/proc.c | 57 ++++++++++++------- drivers/acpi/scan.c | 2 + drivers/pnp/pnpacpi/core.c | 7 +-- include/acpi/acpi_bus.h | 15 ++++- 5 files changed, 139 insertions(+), 77 deletions(-)
drivers/acpi/glue.c +86 -49
@@ -25,6 +25,8 @@static LIST_HEAD (bus_type_list);static DECLARE_RWSEM (bus_type_sem); +#define PHYSICAL_NODE_STRING "physical_node" +int register_acpi_bus_type (struct acpi_bus_type *type) {if (acpi_disabled)
@@ -124,84 +126,119 @@ acpi_handle acpi_get_child(acpi_handle parent, u64 address)EXPORT_SYMBOL (acpi_get_child); -/* Link ACPI devices with physical devices */ -static void acpi_glue_data_handler (acpi_handle handle, -void *context) -{ -/* we provide an empty handler */ -} - -/* Note: a success call will increase reference count by one */ -struct device *acpi_get_physical_device (acpi_handle handle) -{ -acpi_status status; -struct device *dev; - - status =acpi_get_data (handle, acpi_glue_data_handler, (void **)&dev); -if (ACPI_SUCCESS (status)) -return get_device (dev); -return NULL ; -} - -EXPORT_SYMBOL (acpi_get_physical_device); -static int acpi_bind_one (struct device *dev,acpi_handle handle) {struct acpi_device *acpi_dev;acpi_status status; +struct acpi_device_physical_node *physical_node; +char physical_node_name[sizeof (PHYSICAL_NODE_STRING ) +2 ]; +int retval = -EINVAL ;if (dev->archdata.acpi_handle) {dev_warn (dev,"Drivers changed 'acpi_handle'\n" );return -EINVAL ; } +get_device (dev); - status =acpi_attach_data (handle, acpi_glue_data_handler, dev); -if (ACPI_FAILURE (status)) { -put_device (dev); -return -EINVAL ; + status =acpi_bus_get_device (handle, &acpi_dev); +if (ACPI_FAILURE (status)) + goto err; + + physical_node =kzalloc (sizeof (struct acpi_device_physical_node ), +GFP_KERNEL ); +if (!physical_node) { + retval = -ENOMEM ; + goto err; } - dev->archdata.acpi_handle = handle; - status =acpi_bus_get_device (handle, &acpi_dev); -if (!ACPI_FAILURE (status)) { -int ret; - - ret =sysfs_create_link (&dev->kobj, &acpi_dev->dev.kobj, -"firmware_node" ); - ret =sysfs_create_link (&acpi_dev->dev.kobj, &dev->kobj, -"physical_node" ); -if (acpi_dev->wakeup.flags.valid) -device_set_wakeup_capable (dev, true); +mutex_lock (&acpi_dev->physical_node_lock); +/* allocate physical node id according to physical_node_id_bitmap */ + physical_node->node_id = +find_first_zero_bit (acpi_dev->physical_node_id_bitmap, +ACPI_MAX_PHYSICAL_NODE ); +if (physical_node->node_id >=ACPI_MAX_PHYSICAL_NODE ) { + retval = -ENOSPC ; +mutex_unlock (&acpi_dev->physical_node_lock); + goto err; } +set_bit (physical_node->node_id, acpi_dev->physical_node_id_bitmap); + physical_node->dev = dev; +list_add_tail (&physical_node->node, &acpi_dev->physical_node_list); + acpi_dev->physical_node_count++; +mutex_unlock (&acpi_dev->physical_node_lock); + + dev->archdata.acpi_handle = handle; + +if (!physical_node->node_id) +strcpy (physical_node_name,PHYSICAL_NODE_STRING ); +else +sprintf (physical_node_name, +"physical_node%d" , physical_node->node_id); + retval =sysfs_create_link (&acpi_dev->dev.kobj, &dev->kobj, + physical_node_name); + retval =sysfs_create_link (&dev->kobj, &acpi_dev->dev.kobj, +"firmware_node" ); + +if (acpi_dev->wakeup.flags.valid) +device_set_wakeup_capable (dev, true); +return 0 ; + + err: +put_device (dev); +return retval; }static int acpi_unbind_one (struct device *dev) { +struct acpi_device_physical_node *entry; +struct acpi_device *acpi_dev; +acpi_status status; +struct list_head *node, *next; +if (!dev->archdata.acpi_handle)return 0 ; -if (dev ==acpi_get_physical_device (dev->archdata.acpi_handle)) { -struct acpi_device *acpi_dev; -/* acpi_get_physical_device increase refcnt by one */ -put_device (dev); + status =acpi_bus_get_device (dev->archdata.acpi_handle, + &acpi_dev); +if (ACPI_FAILURE (status)) + goto err; -if (!acpi_bus_get_device (dev->archdata.acpi_handle, - &acpi_dev)) { -sysfs_remove_link (&dev->kobj,"firmware_node" ); -sysfs_remove_link (&acpi_dev->dev.kobj,"physical_node" ); - } +mutex_lock (&acpi_dev->physical_node_lock); +list_for_each_safe (node, next, &acpi_dev->physical_node_list) { +char physical_node_name[sizeof (PHYSICAL_NODE_STRING ) +2 ]; + + entry = list_entry(node, struct acpi_device_physical_node, + node); +if (entry->dev != dev) +continue ; + +list_del (node); +clear_bit (entry->node_id, acpi_dev->physical_node_id_bitmap); -acpi_detach_data (dev->archdata.acpi_handle, - acpi_glue_data_handler); + acpi_dev->physical_node_count--; + +if (!entry->node_id) +strcpy (physical_node_name,PHYSICAL_NODE_STRING ); +else +sprintf (physical_node_name, +"physical_node%d" , entry->node_id); + +sysfs_remove_link (&acpi_dev->dev.kobj, physical_node_name); +sysfs_remove_link (&dev->kobj,"firmware_node" ); dev->archdata.acpi_handle =NULL ;/* acpi_bind_one increase refcnt by one */ put_device (dev); - }else { -dev_err (dev,"Oops, 'acpi_handle' corrupt\n" ); +kfree (entry); } +mutex_unlock (&acpi_dev->physical_node_lock); +return 0 ; + +err: +dev_err (dev,"Oops, 'acpi_handle' corrupt\n" ); +return -EINVAL ; }static int acpi_platform_notify (struct device *dev)
drivers/acpi/proc.c +37 -20
75 lines not on this page · raw message
drivers/acpi/scan.c +2 -0
@@ -481,6 +481,8 @@ static int acpi_device_register(struct acpi_device *device)INIT_LIST_HEAD (&device->children);INIT_LIST_HEAD (&device->node);INIT_LIST_HEAD (&device->wakeup_list); +INIT_LIST_HEAD (&device->physical_node_list); +mutex_init (&device->physical_node_lock); new_bus_id =kzalloc (sizeof (struct acpi_device_bus_id ),GFP_KERNEL );if (!new_bus_id) {
drivers/pnp/pnpacpi/core.c +1 -6
@@ -321,14 +321,9 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp) {struct acpi_device *acpi =to_acpi_device (dev);struct pnp_dev *pnp = _pnp; -struct device *physical_device; - - physical_device =acpi_get_physical_device (acpi->handle); -if (physical_device) -put_device (physical_device);/* true means it matched */ -return !physical_device +return !acpi->physical_node_count &&compare_pnp_id (pnp->id,acpi_device_hid (acpi)); }
include/acpi/acpi_bus.h +13 -2
@@ -282,8 +282,16 @@ struct acpi_device_wakeup {int prepare_count; }; -/* Device */ +struct acpi_device_physical_node { +u8 node_id; +struct list_head node; +struct device *dev; +}; +/* set maximum of physical nodes to 32 for expansibility */ +#define ACPI_MAX_PHYSICAL_NODE 32 + +/* Device */ struct acpi_device {int device_type;acpi_handle handle;/* no handle for fixed hardware */
@@ -304,6 +312,10 @@ struct acpi_device {struct device dev;struct acpi_bus_ops bus_ops;/* workaround for different code path for hotplug */ enum acpi_bus_removal_type removal_type;/* indicate for different removal type */ +u8 physical_node_count; +struct list_head physical_node_list; +struct mutex physical_node_lock; +DECLARE_BITMAP (physical_node_id_bitmap,ACPI_MAX_PHYSICAL_NODE ); };static inline void *acpi_driver_data (struct acpi_device *d)
@@ -394,7 +406,6 @@ struct acpi_bus_type { };int register_acpi_bus_type (struct acpi_bus_type *);int unregister_acpi_bus_type (struct acpi_bus_type *); -struct device *acpi_get_physical_device (acpi_handle );struct acpi_pci_root {struct list_head node;
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 19/49 ACPI: introduce module_acpi_driver() helper macro
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
Add a helper macro module_acpi_driver() which reduces the boilerplate code for ACPI drivers. This is similar what is done for other busses (PCI, SPI, I2C etc).
--- include/acpi/acpi_bus.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
include/acpi/acpi_bus.h +13 -0
@@ -381,6 +381,19 @@ int acpi_match_device_ids(struct acpi_device *device,int acpi_create_dir (struct acpi_device *);void acpi_remove_dir (struct acpi_device *); + +/** +* module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver +* @__acpi_driver: acpi_driver struct +* +* Helper macro for ACPI drivers which do not do anything special in module +* init/exit. This eliminates a lot of boilerplate. Each module may only +* use this macro once, and calling it replaces module_init() and module_exit() +*/ +#define module_acpi_driver (__acpi_driver) \ + module_driver(__acpi_driver, acpi_bus_register_driver, \ + acpi_bus_unregister_driver) +/* * Bind physical devices with ACPI devices */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 21/49 ACPI/fan: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/acpi/fan.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-)
drivers/acpi/fan.c +1 -21
@@ -212,24 +212,4 @@ static int acpi_fan_resume(struct device *dev) }#endif -static int __init acpi_fan_init (void ) -{ -int result =0 ; - - result =acpi_bus_register_driver (&acpi_fan_driver); -if (result <0 ) -return -ENODEV ; - -return 0 ; -} - -static void __exit acpi_fan_exit(void) -{ - -acpi_bus_unregister_driver (&acpi_fan_driver); - -return ; -} - -module_init (acpi_fan_init); -module_exit (acpi_fan_exit); +module_acpi_driver (acpi_fan_driver);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 22/49 ACPI/hed: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/acpi/hed.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
drivers/acpi/hed.c +1 -19
@@ -86,25 +86,7 @@ static struct acpi_driver acpi_hed_driver = { .notify = acpi_hed_notify, }, }; - -static int __init acpi_hed_init (void ) -{ -if (acpi_disabled) -return -ENODEV ; - -if (acpi_bus_register_driver (&acpi_hed_driver) <0 ) -return -ENODEV ; - -return 0 ; -} - -static void __exit acpi_hed_exit(void) -{ -acpi_bus_unregister_driver (&acpi_hed_driver); -} - -module_init (acpi_hed_init); -module_exit (acpi_hed_exit); +module_acpi_driver (acpi_hed_driver);ACPI_MODULE_NAME ("hed" );MODULE_AUTHOR ("Huang Ying" );
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 23/49 ACPI/sbshc: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/acpi/sbshc.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/acpi/sbshc.c +1 -17
@@ -310,23 +310,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device, int type)return 0 ; } -static int __init acpi_smb_hc_init (void ) -{ -int result; - - result =acpi_bus_register_driver (&acpi_smb_hc_driver); -if (result <0 ) -return -ENODEV ; -return 0 ; -} - -static void __exit acpi_smb_hc_exit(void) -{ -acpi_bus_unregister_driver (&acpi_smb_hc_driver); -} - -module_init (acpi_smb_hc_init); -module_exit (acpi_smb_hc_exit); +module_acpi_driver (acpi_smb_hc_driver);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Alexey Starikovskiy" );
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 24/49 i2c-scmi: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/i2c/busses/i2c-scmi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/i2c/busses/i2c-scmi.c +1 -13
@@ -426,19 +426,7 @@ static struct acpi_driver acpi_smbus_cmi_driver = { .remove = acpi_smbus_cmi_remove, }, }; - -static int __init acpi_smbus_cmi_init (void ) -{ -return acpi_bus_register_driver (&acpi_smbus_cmi_driver); -} - -static void __exit acpi_smbus_cmi_exit(void) -{ -acpi_bus_unregister_driver (&acpi_smbus_cmi_driver); -} - -module_init (acpi_smbus_cmi_init); -module_exit (acpi_smbus_cmi_exit); +module_acpi_driver (acpi_smbus_cmi_driver);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Crane Cai <[email protected]>" );
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 27/49 ideapad: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/platform/x86/ideapad-laptop.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/platform/x86/ideapad-laptop.c +1 -13
@@ -917,20 +917,8 @@ static struct acpi_driver ideapad_acpi_driver = { .drv.pm = &ideapad_pm, .owner = THIS_MODULE, }; - -static int __init ideapad_acpi_module_init (void ) -{ -return acpi_bus_register_driver (&ideapad_acpi_driver); -} - -static void __exit ideapad_acpi_module_exit(void) -{ -acpi_bus_unregister_driver (&ideapad_acpi_driver); -} +module_acpi_driver (ideapad_acpi_driver);MODULE_AUTHOR ("David Woodhouse <[email protected]>" );MODULE_DESCRIPTION ("IdeaPad ACPI Extras" );MODULE_LICENSE ("GPL" ); - -module_init (ideapad_acpi_module_init); -module_exit (ideapad_acpi_module_exit);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 29/49 toshiba_bluetooth: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/platform/x86/toshiba_bluetooth.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-)
drivers/platform/x86/toshiba_bluetooth.c +1 -21
@@ -122,30 +122,10 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device)return result; } -static int __init toshiba_bt_rfkill_init (void ) -{ -int result; - - result =acpi_bus_register_driver (&toshiba_bt_rfkill_driver); -if (result <0 ) { -ACPI_DEBUG_PRINT ((ACPI_DB_ERROR , -"Error registering driver\n" )); -return result; - } - -return 0 ; -} -static int toshiba_bt_rfkill_remove (struct acpi_device *device,int type) {/* clean up */ return 0 ; } -static void __exit toshiba_bt_rfkill_exit(void) -{ -acpi_bus_unregister_driver (&toshiba_bt_rfkill_driver); -} - -module_init (toshiba_bt_rfkill_init); -module_exit (toshiba_bt_rfkill_exit); +module_acpi_driver (toshiba_bt_rfkill_driver);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 30/49 xo15-ebook: convert to module_acpi_driver()
In reply to Len BrownFrom: Mika Westerberg <[email protected]>
--- drivers/platform/x86/xo15-ebook.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/platform/x86/xo15-ebook.c +1 -13
@@ -170,16 +170,4 @@ static struct acpi_driver xo15_ebook_driver = { }, .drv.pm = &ebook_switch_pm, }; - -static int __init xo15_ebook_init (void ) -{ -return acpi_bus_register_driver (&xo15_ebook_driver); -} - -static void __exit xo15_ebook_exit(void) -{ -acpi_bus_unregister_driver (&xo15_ebook_driver); -} - -module_init (xo15_ebook_init); -module_exit (xo15_ebook_exit); +module_acpi_driver (xo15_ebook_driver);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 31/49 tools/power/acpi/acpidump: version 20051111
In reply to Len BrownFrom: Len Brown <[email protected]>
This is unchanged version 20051111, plus a small bit in DEFINE_ALTERNATE_TYPES to enable building with latest kernel headers.
--- tools/power/acpi/Makefile | 15 ++ tools/power/acpi/acpidump.c | 472 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 487 insertions(+) create mode 100644 tools/power/acpi/Makefile create mode 100644 tools/power/acpi/acpidump.c
tools/power/acpi/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +PROG= acpidump +SRCS= acpidump.c +KERNEL_INCLUDE := ../../../include +CFLAGS += -Wall -Wstrict-prototypes -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE) + +all: acpidump + +acpidump : $(SRCS) + $(CC) $(CFLAGS) $(SRCS) -o $(PROG) + +CLEANFILES= $(PROG) + +clean : + rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) *~ +
tools/power/acpi/acpidump.c new file +472 -0
472 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 33/49 tools/power/acpi/acpidump: version 20070714
In reply to Len BrownFrom: Len Brown <[email protected]>
This is unchanged version 20070714, plus a small bit in DEFINE_ALTERNATE_TYPES to enable building with latest kernel headers.
--- tools/power/acpi/Makefile | 7 ++- tools/power/acpi/acpidump.c | 127 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 103 insertions(+), 31 deletions(-)
tools/power/acpi/Makefile +3 -4
@@ -1,11 +1,10 @@ -PROG= acpidump +PROG= acpidump SRCS= acpidump.c KERNEL_INCLUDE := ../../../include -CFLAGS += -Wall -Wstrict-prototypes -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE) +CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE) all: acpidump - -acpidump : $(SRCS) +$(PROG) : $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o $(PROG) CLEANFILES= $(PROG)
tools/power/acpi/acpidump.c +100 -27
188 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 34/49 tools/power/acpi/acpidump: version 20071116
In reply to Len BrownFrom: Len Brown <[email protected]>
This is unchanged version 20071116, plus a small bit in DEFINE_ALTERNATE_TYPES to enable building with latest kernel headers.
--- tools/power/acpi/acpidump.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/power/acpi/acpidump.c +5 -2
@@ -540,8 +540,11 @@ int main(int argc, char **argv)if (connect) {lseek (fd,sizeof (struct acpi_rsdp_descriptor ),SEEK_SET ); } -if (!acpi_dump_XSDT (fd, &rsdpx)) - goto not_found; +if (rsdpx.revision >1 && rsdpx.xsdt_physical_address) { +/* ACPIDUMP uses xsdt table */ +if (!acpi_dump_XSDT (fd, &rsdpx)) + goto not_found; + }if (!acpi_dump_RSDT (fd, &rsdpx)) goto not_found;if (connect) {
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 35/49 tools/power/acpi/acpidump: version 20101221 - find dynamic tables in sysfs
In reply to Len BrownFrom: Len Brown <[email protected]>
This is unchanged version 20101221, plus a small bit in DEFINE_ALTERNATE_TYPES to enable building with latest kernel headers.
This version finds dynamic tables exported by Linux in /sys/firmware/acpi/tables/dynamic
--- tools/power/acpi/acpidump.c | 187 +++++++++++++++++++++----------------------- 1 file changed, 89 insertions(+), 98 deletions(-)
tools/power/acpi/acpidump.c +89 -98
@@ -1,6 +1,5 @@/* * (c) Alexey Starikovskiy, Intel, 2005-2006. -* (c) Len Brown, Intel, 2007. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -63,6 +62,8 @@ typedef long long s64;#include <unistd.h> #include <getopt.h> +#include <sys/types.h> +#include <dirent.h> #include <acpi/acconfig.h> #include <acpi/platform/acenv.h>
@@ -186,40 +187,6 @@ static void acpi_show_data(int fd, u8 * data, int size)/* * Output ACPI table */ - -#define MAX_TABLES 128 -int next_table_dump; -u64 dumped_tables[MAX_TABLES ]; - -void -set_table_dumped (u64 address) { -if (next_table_dump >=MAX_TABLES ) { -printf ("increase MAX_TABLES\n" ); -exit (1 ); - } - dumped_tables[next_table_dump++] = address; -} - -/* -* list the tables as they are dumped -* check the list so that they are not dumped twice. -* -* this is needed because we follow both the XSDT and RSDT -* which generally point to all duplicate tables -* except the FADT -*/ -int -check_table_dumped (u64 address) { -int i; - -for (i =0 ; i <MAX_TABLES ; ++i) { -if (address == dumped_tables[i]) -return 1 ; -if (dumped_tables[i] ==0 ) -return 0 ; - } -return 0 ; -}static void acpi_show_table (int fd,struct acpi_table_header *table,unsigned long addr) {char buff[80 ];
@@ -233,10 +200,6 @@ static void acpi_show_table(int fd, struct acpi_table_header *table, unsigned lostatic void write_table (int fd,struct acpi_table_header *tbl,unsigned long addr) {static int select_done =0 ; - -if (check_table_dumped ((u64 )addr)) -return ; -if (!select_sig[0 ]) {if (print) {acpi_show_table (fd, tbl, addr);
@@ -255,7 +218,6 @@ static void write_table(int fd, struct acpi_table_header *tbl, unsigned long add } select_done =1 ; } -set_table_dumped ((u64 ) addr); }static void acpi_dump_FADT (int fd,struct acpi_table_header *tbl,unsigned long xaddr) {
@@ -312,26 +274,30 @@ no_facs:write_table (fd, (struct acpi_table_header *)&x, xaddr); } - -static int acpi_dump_RSDT (int fd,struct acpi_rsdp_descriptor *rsdp) +static int acpi_dump_SDT (int fd,struct acpi_rsdp_descriptor *rsdp) {struct acpi_table_header *sdt, *tbl =0 ; -int i, num; +int xsdt =1 , i, num;char *offset;unsigned long addr; - - tbl =acpi_map_table (rsdp->rsdt_physical_address,"RSDT" ); +if (rsdp->revision >1 && rsdp->xsdt_physical_address) { + tbl =acpi_map_table (rsdp->xsdt_physical_address,"XSDT" ); + } +if (!tbl && rsdp->rsdt_physical_address) { + xsdt =0 ; + tbl =acpi_map_table (rsdp->rsdt_physical_address,"RSDT" ); + }if (!tbl)return 0 ; - sdt =malloc (tbl->length);memcpy (sdt, tbl, tbl->length);acpi_unmap_table (tbl);if (checksum ((u8 *)sdt, sdt->length)) -fprintf (stderr,"Wrong checksum for %s!\n" ,"RSDT" ); - num = (sdt->length -sizeof (struct acpi_table_header ))/sizeof (u32); +fprintf (stderr,"Wrong checksum for %s!\n" , (xsdt)?"XSDT" :"RSDT" ); + num = (sdt->length -sizeof (struct acpi_table_header ))/((xsdt)?sizeof (u64):sizeof (u32)); offset = (char *)sdt +sizeof (struct acpi_table_header ); -for (i =0 ; i < num; ++i, offset +=sizeof (u32)) { - addr = (unsigned long )(*(u32 *)offset); +for (i =0 ; i < num; ++i, offset += ((xsdt) ?sizeof (u64) :sizeof (u32))) { + addr = (xsdt) ? (unsigned long )(*(u64 *)offset): + (unsigned long )(*(u32 *)offset);if (!addr)continue ; tbl =acpi_map_table (addr,0 );if (!tbl)continue ;
@@ -339,66 +305,92 @@ static int acpi_dump_RSDT(int fd, struct acpi_rsdp_descriptor *rsdp)acpi_dump_FADT (fd, tbl, addr); }else {if (checksum ((u8 *)tbl, tbl->length)) -fprintf (stderr,"Wrong checksum for %.4s!\n" , tbl->signature); +fprintf (stderr,"Wrong checksum for generic table!\n" );write_table (fd, tbl, addr); }acpi_unmap_table (tbl);if (connect) { - (*(u32 *)offset) =lseek (fd,0 ,SEEK_CUR ); +if (xsdt) + (*(u64 *)offset) =lseek (fd,0 ,SEEK_CUR ); +else + (*(u32 *)offset) =lseek (fd,0 ,SEEK_CUR ); } } - addr = (unsigned long )rsdp->rsdt_physical_address; -if (connect) { - rsdp->rsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); +if (xsdt) { + addr = (unsigned long )rsdp->xsdt_physical_address; +if (connect) { + rsdp->xsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); + } + }else { + addr = (unsigned long )rsdp->rsdt_physical_address; +if (connect) { + rsdp->rsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); + } }write_table (fd, sdt, addr);free (sdt);return 1 ; } +#define DYNAMIC_SSDT "/sys/firmware/acpi/tables/dynamic" -static int acpi_dump_XSDT (int fd,struct acpi_rsdp_descriptor *rsdp) +static void acpi_dump_dynamic_SSDT (int fd) { -struct acpi_table_header *sdt, *tbl =0 ; -int i, num; -char *offset; -unsigned long addr; -if (rsdp->revision >1 && rsdp->xsdt_physical_address) { - tbl =acpi_map_table (rsdp->xsdt_physical_address,"XSDT" ); +struct stat file_stat; +char filename[256 ], *ptr; +DIR *tabledir; +struct dirent *entry; +FILE *fp; +int count, readcount, length; +struct acpi_table_header table_header, *ptable; + +if (stat (DYNAMIC_SSDT , &file_stat) ==-1 ) { +/* The directory doesn't exist */ +return ; } -if (!tbl)return 0 ; - - sdt =malloc (tbl->length); -memcpy (sdt, tbl, tbl->length); -acpi_unmap_table (tbl); -if (checksum ((u8 *)sdt, sdt->length)) -fprintf (stderr,"Wrong checksum for %s!\n" ,"XSDT" ); - num = (sdt->length -sizeof (struct acpi_table_header ))/sizeof (u64); - offset = (char *)sdt +sizeof (struct acpi_table_header ); -for (i =0 ; i < num; ++i, offset +=sizeof (u64)) { - addr = (unsigned long )(*(u64 *)offset); -if (!addr)continue ; - tbl =acpi_map_table (addr,0 ); -if (!tbl)continue ; -if (!memcmp (tbl->signature,FADT_SIG ,4 )) { -acpi_dump_FADT (fd, tbl, addr); - }else { -if (checksum ((u8 *)tbl, tbl->length)) -fprintf (stderr,"Wrong checksum for %.4s\n" , tbl->signature); -write_table (fd, tbl, addr); + tabledir =opendir (DYNAMIC_SSDT ); +if (!tabledir){ +/*can't open the directory */ +return ; + } + +while ((entry =readdir (tabledir)) !=0 ){ +/* skip the file of . /.. */ +if (entry->d_name[0 ] =='.' ) +continue ; + +sprintf (filename,"%s/%s" ,DYNAMIC_SSDT , entry->d_name); + fp =fopen (filename,"r" ); +if (fp ==NULL ) { +fprintf (stderr,"Can't open the file of %s\n" , + filename); +continue ; } -acpi_unmap_table (tbl); -if (connect) { - (*(u64 *)offset) =lseek (fd,0 ,SEEK_CUR ); +/* Read the Table header to parse the table length */ + count =fread (&table_header,1 ,sizeof (struct acpi_table_header ), fp); +if (count <sizeof (table_header)) { +/* the length is lessn than ACPI table header. skip it */ +fclose (fp); +continue ; } + length = table_header.length; + ptr =malloc (table_header.length); +fseek (fp,0 ,SEEK_SET ); + readcount =0 ; +while (!feof (fp) && readcount < length) { + count =fread (ptr + readcount,1 ,256 , fp); + readcount += count; + } +fclose (fp); + ptable = (struct acpi_table_header *) ptr; +if (checksum ((u8 *) ptable, ptable->length)) +fprintf (stderr,"Wrong checksum " +"for dynamic SSDT table!\n" ); +write_table (fd, ptable,0 ); +free (ptr); } - addr = (unsigned long )rsdp->xsdt_physical_address; -if (connect) { - rsdp->xsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); - } -write_table (fd, sdt, addr); -free (sdt); -return 1 ; +closedir (tabledir); +return ; }static void usage (const char *progname)
@@ -518,6 +510,7 @@ int main(int argc, char **argv) goto not_found;write (fd, raw, length);acpi_unmap_memory (raw, length); +close (fd);return 0 ; }
@@ -540,12 +533,7 @@ int main(int argc, char **argv)if (connect) {lseek (fd,sizeof (struct acpi_rsdp_descriptor ),SEEK_SET ); } -if (rsdpx.revision >1 && rsdpx.xsdt_physical_address) { -/* ACPIDUMP uses xsdt table */ -if (!acpi_dump_XSDT (fd, &rsdpx)) - goto not_found; - } -if (!acpi_dump_RSDT (fd, &rsdpx)) +if (!acpi_dump_SDT (fd, &rsdpx)) goto not_found;if (connect) {lseek (fd,0 ,SEEK_SET );
@@ -560,8 +548,11 @@ int main(int argc, char **argv) buff[0 ] ='\n' ;write (fd, buff,1 ); } +acpi_dump_dynamic_SSDT (fd); +close (fd);return 0 ; not_found: +close (fd);fprintf (stderr,"ACPI tables were not found. If you know location " "of RSD PTR table (from dmesg, etc), " "supply it with either --addr or -a option\n" );
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 37/49 ACPI: run _OSC after ACPI_FULL_INITIALIZATION
In reply to Len BrownFrom: Lin Ming <[email protected]>
The _OSC method may exist in module level code, so it must be called after ACPI_FULL_INITIALIZATION
On some new platforms with Zero-Power-Optical-Disk-Drive (ZPODD) support, this fix is necessary to save power.
--- drivers/acpi/bus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/acpi/bus.c +6 -2
@@ -994,8 +994,6 @@ static int __init acpi_bus_init(void) status =acpi_ec_ecdt_probe ();/* Ignore result. Not having an ECDT is not fatal. */ -acpi_bus_osc_support (); - status =acpi_initialize_objects (ACPI_FULL_INITIALIZATION );if (ACPI_FAILURE (status)) { printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
@@ -1003,6 +1001,12 @@ static int __init acpi_bus_init(void) }/* +* _OSC method may exist in module level code, +* so it must be run after ACPI_FULL_INITIALIZATION +*/ +acpi_bus_osc_support (); + +/* * _PDC control method may load dynamic SSDT tables, * and we need to install the table handler before that. */
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 38/49 tools/power/acpi/acpidump: version 20101221 - find dynamic tables in sysfs
In reply to Len BrownFrom: Yakui Zhao <[email protected]>
This is unchanged version 20101221, plus a small bit in DEFINE_ALTERNATE_TYPES to enable building with latest kernel headers.
This version finds dynamic tables exported by Linux in /sys/firmware/acpi/tables/dynamic
--- tools/power/acpi/acpidump.c | 187 +++++++++++++++++++++----------------------- 1 file changed, 89 insertions(+), 98 deletions(-)
tools/power/acpi/acpidump.c +89 -98
@@ -1,6 +1,5 @@/* * (c) Alexey Starikovskiy, Intel, 2005-2006. -* (c) Len Brown, Intel, 2007. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -63,6 +62,8 @@ typedef long long s64;#include <unistd.h> #include <getopt.h> +#include <sys/types.h> +#include <dirent.h> #include <acpi/acconfig.h> #include <acpi/platform/acenv.h>
@@ -186,40 +187,6 @@ static void acpi_show_data(int fd, u8 * data, int size)/* * Output ACPI table */ - -#define MAX_TABLES 128 -int next_table_dump; -u64 dumped_tables[MAX_TABLES ]; - -void -set_table_dumped (u64 address) { -if (next_table_dump >=MAX_TABLES ) { -printf ("increase MAX_TABLES\n" ); -exit (1 ); - } - dumped_tables[next_table_dump++] = address; -} - -/* -* list the tables as they are dumped -* check the list so that they are not dumped twice. -* -* this is needed because we follow both the XSDT and RSDT -* which generally point to all duplicate tables -* except the FADT -*/ -int -check_table_dumped (u64 address) { -int i; - -for (i =0 ; i <MAX_TABLES ; ++i) { -if (address == dumped_tables[i]) -return 1 ; -if (dumped_tables[i] ==0 ) -return 0 ; - } -return 0 ; -}static void acpi_show_table (int fd,struct acpi_table_header *table,unsigned long addr) {char buff[80 ];
@@ -233,10 +200,6 @@ static void acpi_show_table(int fd, struct acpi_table_header *table, unsigned lostatic void write_table (int fd,struct acpi_table_header *tbl,unsigned long addr) {static int select_done =0 ; - -if (check_table_dumped ((u64 )addr)) -return ; -if (!select_sig[0 ]) {if (print) {acpi_show_table (fd, tbl, addr);
@@ -255,7 +218,6 @@ static void write_table(int fd, struct acpi_table_header *tbl, unsigned long add } select_done =1 ; } -set_table_dumped ((u64 ) addr); }static void acpi_dump_FADT (int fd,struct acpi_table_header *tbl,unsigned long xaddr) {
@@ -312,26 +274,30 @@ no_facs:write_table (fd, (struct acpi_table_header *)&x, xaddr); } - -static int acpi_dump_RSDT (int fd,struct acpi_rsdp_descriptor *rsdp) +static int acpi_dump_SDT (int fd,struct acpi_rsdp_descriptor *rsdp) {struct acpi_table_header *sdt, *tbl =0 ; -int i, num; +int xsdt =1 , i, num;char *offset;unsigned long addr; - - tbl =acpi_map_table (rsdp->rsdt_physical_address,"RSDT" ); +if (rsdp->revision >1 && rsdp->xsdt_physical_address) { + tbl =acpi_map_table (rsdp->xsdt_physical_address,"XSDT" ); + } +if (!tbl && rsdp->rsdt_physical_address) { + xsdt =0 ; + tbl =acpi_map_table (rsdp->rsdt_physical_address,"RSDT" ); + }if (!tbl)return 0 ; - sdt =malloc (tbl->length);memcpy (sdt, tbl, tbl->length);acpi_unmap_table (tbl);if (checksum ((u8 *)sdt, sdt->length)) -fprintf (stderr,"Wrong checksum for %s!\n" ,"RSDT" ); - num = (sdt->length -sizeof (struct acpi_table_header ))/sizeof (u32); +fprintf (stderr,"Wrong checksum for %s!\n" , (xsdt)?"XSDT" :"RSDT" ); + num = (sdt->length -sizeof (struct acpi_table_header ))/((xsdt)?sizeof (u64):sizeof (u32)); offset = (char *)sdt +sizeof (struct acpi_table_header ); -for (i =0 ; i < num; ++i, offset +=sizeof (u32)) { - addr = (unsigned long )(*(u32 *)offset); +for (i =0 ; i < num; ++i, offset += ((xsdt) ?sizeof (u64) :sizeof (u32))) { + addr = (xsdt) ? (unsigned long )(*(u64 *)offset): + (unsigned long )(*(u32 *)offset);if (!addr)continue ; tbl =acpi_map_table (addr,0 );if (!tbl)continue ;
@@ -339,66 +305,92 @@ static int acpi_dump_RSDT(int fd, struct acpi_rsdp_descriptor *rsdp)acpi_dump_FADT (fd, tbl, addr); }else {if (checksum ((u8 *)tbl, tbl->length)) -fprintf (stderr,"Wrong checksum for %.4s!\n" , tbl->signature); +fprintf (stderr,"Wrong checksum for generic table!\n" );write_table (fd, tbl, addr); }acpi_unmap_table (tbl);if (connect) { - (*(u32 *)offset) =lseek (fd,0 ,SEEK_CUR ); +if (xsdt) + (*(u64 *)offset) =lseek (fd,0 ,SEEK_CUR ); +else + (*(u32 *)offset) =lseek (fd,0 ,SEEK_CUR ); } } - addr = (unsigned long )rsdp->rsdt_physical_address; -if (connect) { - rsdp->rsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); +if (xsdt) { + addr = (unsigned long )rsdp->xsdt_physical_address; +if (connect) { + rsdp->xsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); + } + }else { + addr = (unsigned long )rsdp->rsdt_physical_address; +if (connect) { + rsdp->rsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); + } }write_table (fd, sdt, addr);free (sdt);return 1 ; } +#define DYNAMIC_SSDT "/sys/firmware/acpi/tables/dynamic" -static int acpi_dump_XSDT (int fd,struct acpi_rsdp_descriptor *rsdp) +static void acpi_dump_dynamic_SSDT (int fd) { -struct acpi_table_header *sdt, *tbl =0 ; -int i, num; -char *offset; -unsigned long addr; -if (rsdp->revision >1 && rsdp->xsdt_physical_address) { - tbl =acpi_map_table (rsdp->xsdt_physical_address,"XSDT" ); +struct stat file_stat; +char filename[256 ], *ptr; +DIR *tabledir; +struct dirent *entry; +FILE *fp; +int count, readcount, length; +struct acpi_table_header table_header, *ptable; + +if (stat (DYNAMIC_SSDT , &file_stat) ==-1 ) { +/* The directory doesn't exist */ +return ; } -if (!tbl)return 0 ; - - sdt =malloc (tbl->length); -memcpy (sdt, tbl, tbl->length); -acpi_unmap_table (tbl); -if (checksum ((u8 *)sdt, sdt->length)) -fprintf (stderr,"Wrong checksum for %s!\n" ,"XSDT" ); - num = (sdt->length -sizeof (struct acpi_table_header ))/sizeof (u64); - offset = (char *)sdt +sizeof (struct acpi_table_header ); -for (i =0 ; i < num; ++i, offset +=sizeof (u64)) { - addr = (unsigned long )(*(u64 *)offset); -if (!addr)continue ; - tbl =acpi_map_table (addr,0 ); -if (!tbl)continue ; -if (!memcmp (tbl->signature,FADT_SIG ,4 )) { -acpi_dump_FADT (fd, tbl, addr); - }else { -if (checksum ((u8 *)tbl, tbl->length)) -fprintf (stderr,"Wrong checksum for %.4s\n" , tbl->signature); -write_table (fd, tbl, addr); + tabledir =opendir (DYNAMIC_SSDT ); +if (!tabledir){ +/*can't open the directory */ +return ; + } + +while ((entry =readdir (tabledir)) !=0 ){ +/* skip the file of . /.. */ +if (entry->d_name[0 ] =='.' ) +continue ; + +sprintf (filename,"%s/%s" ,DYNAMIC_SSDT , entry->d_name); + fp =fopen (filename,"r" ); +if (fp ==NULL ) { +fprintf (stderr,"Can't open the file of %s\n" , + filename); +continue ; } -acpi_unmap_table (tbl); -if (connect) { - (*(u64 *)offset) =lseek (fd,0 ,SEEK_CUR ); +/* Read the Table header to parse the table length */ + count =fread (&table_header,1 ,sizeof (struct acpi_table_header ), fp); +if (count <sizeof (table_header)) { +/* the length is lessn than ACPI table header. skip it */ +fclose (fp); +continue ; } + length = table_header.length; + ptr =malloc (table_header.length); +fseek (fp,0 ,SEEK_SET ); + readcount =0 ; +while (!feof (fp) && readcount < length) { + count =fread (ptr + readcount,1 ,256 , fp); + readcount += count; + } +fclose (fp); + ptable = (struct acpi_table_header *) ptr; +if (checksum ((u8 *) ptable, ptable->length)) +fprintf (stderr,"Wrong checksum " +"for dynamic SSDT table!\n" ); +write_table (fd, ptable,0 ); +free (ptr); } - addr = (unsigned long )rsdp->xsdt_physical_address; -if (connect) { - rsdp->xsdt_physical_address =lseek (fd,0 ,SEEK_CUR ); - } -write_table (fd, sdt, addr); -free (sdt); -return 1 ; +closedir (tabledir); +return ; }static void usage (const char *progname)
@@ -518,6 +510,7 @@ int main(int argc, char **argv) goto not_found;write (fd, raw, length);acpi_unmap_memory (raw, length); +close (fd);return 0 ; }
@@ -540,12 +533,7 @@ int main(int argc, char **argv)if (connect) {lseek (fd,sizeof (struct acpi_rsdp_descriptor ),SEEK_SET ); } -if (rsdpx.revision >1 && rsdpx.xsdt_physical_address) { -/* ACPIDUMP uses xsdt table */ -if (!acpi_dump_XSDT (fd, &rsdpx)) - goto not_found; - } -if (!acpi_dump_RSDT (fd, &rsdpx)) +if (!acpi_dump_SDT (fd, &rsdpx)) goto not_found;if (connect) {lseek (fd,0 ,SEEK_SET );
@@ -560,8 +548,11 @@ int main(int argc, char **argv) buff[0 ] ='\n' ;write (fd, buff,1 ); } +acpi_dump_dynamic_SSDT (fd); +close (fd);return 0 ; not_found: +close (fd);fprintf (stderr,"ACPI tables were not found. If you know location " "of RSD PTR table (from dmesg, etc), " "supply it with either --addr or -a option\n" );
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 39/49 tools/power/acpi/acpidump: create acpidump(8), local make install targets
In reply to Len BrownFrom: Len Brown <[email protected]>
--- tools/power/acpi/Makefile | 4 +++ tools/power/acpi/acpidump.8 | 59 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 tools/power/acpi/acpidump.8
tools/power/acpi/Makefile +4 -0
@@ -12,3 +12,7 @@ CLEANFILES= $(PROG) clean : rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) *~ +install : + install acpidump /usr/bin/acpidump + install acpidump.8 /usr/share/man/man8 +
tools/power/acpi/acpidump.8 new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 42/49 tools/power turbostat: print more turbo-limit information
In reply to Len BrownFrom: Len Brown <[email protected]>
The "turbo-limit" is the maximum opportunistic processor speed, assuming no electrical or thermal constraints. For a given processor, the turbo-limit varies, depending on the number of active cores. Generally, there is more opportunity when fewer cores are active.
Under the "-v" verbose option, turbostat would
print the turbo-limits for the four cases
of 1 to 4 cores active.
Expand that capability to cover the cases of turbo opportunities with up to 16 cores active.
Note that not all hardware platforms supply this information, and that sometimes a valid limit may be specified for a core which is not actually present.
--- tools/power/x86/turbostat/turbostat.c | 95 ++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-)
tools/power/x86/turbostat/turbostat.c +93 -2
@@ -37,6 +37,7 @@#define MSR_NEHALEM_PLATFORM_INFO 0xCE#define MSR_NEHALEM_TURBO_RATIO_LIMIT 0x1AD +#define MSR_IVT_TURBO_RATIO_LIMIT 0x1AE#define MSR_APERF 0xE8#define MSR_MPERF 0xE7#define MSR_PKG_C2_RESIDENCY 0x60D/* SNB only */
@@ -61,6 +62,7 @@ unsigned int genuine_intel;unsigned int has_invariant_tsc;unsigned int do_nehalem_platform_info;unsigned int do_nehalem_turbo_ratio_limit; +unsigned int do_ivt_turbo_ratio_limit;unsigned int extra_msr_offset;double bclk;unsigned int show_pkg;
@@ -676,6 +678,9 @@ void print_verbose_header(void)get_msr (0 ,MSR_NEHALEM_PLATFORM_INFO , &msr); +if (verbose >1 ) +fprintf (stderr,"MSR_NEHALEM_PLATFORM_INFO: 0x%llx\n" , msr); + ratio = (msr >>40 ) &0xFF ;fprintf (stderr,"%d * %.0f = %.0f MHz max efficiency\n" , ratio, bclk, ratio * bclk);
@@ -684,14 +689,84 @@ void print_verbose_header(void)fprintf (stderr,"%d * %.0f = %.0f MHz TSC frequency\n" , ratio, bclk, ratio * bclk); +if (!do_ivt_turbo_ratio_limit) + goto print_nhm_turbo_ratio_limits; + +get_msr (0 ,MSR_IVT_TURBO_RATIO_LIMIT , &msr); +if (verbose >1 ) -fprintf (stderr,"MSR_NEHALEM_PLATFORM_INFO: 0x%llx\n" , msr); +fprintf (stderr,"MSR_IVT_TURBO_RATIO_LIMIT: 0x%llx\n" , msr); + + ratio = (msr >>56 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 16 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>48 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 15 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>40 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 14 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>32 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 13 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>24 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 12 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>16 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 11 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>8 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 10 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>0 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 9 active cores\n" , + ratio, bclk, ratio * bclk); + +print_nhm_turbo_ratio_limits:if (!do_nehalem_turbo_ratio_limit)return ;get_msr (0 ,MSR_NEHALEM_TURBO_RATIO_LIMIT , &msr); +if (verbose >1 ) +fprintf (stderr,"MSR_NEHALEM_TURBO_RATIO_LIMIT: 0x%llx\n" , msr); + + ratio = (msr >>56 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 8 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>48 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 7 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>40 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 6 active cores\n" , + ratio, bclk, ratio * bclk); + + ratio = (msr >>32 ) &0xFF ; +if (ratio) +fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 5 active cores\n" , + ratio, bclk, ratio * bclk); + ratio = (msr >>24 ) &0xFF ;if (ratio) fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 4 active cores\n",
@@ -711,7 +786,6 @@ void print_verbose_header(void)if (ratio)fprintf (stderr,"%d * %.0f = %.0f MHz max turbo 1 active cores\n" , ratio, bclk, ratio * bclk); - }void free_all_buffers (void )
@@ -1045,6 +1119,22 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model)return 0 ; } } +int has_ivt_turbo_ratio_limit (unsigned int family,unsigned int model) +{ +if (!genuine_intel) +return 0 ; + +if (family !=6 ) +return 0 ; + +switch (model) { +case 0x3E :/* IVB Xeon */ +return 1 ; +default : +return 0 ; + } +} +int is_snb (unsigned int family,unsigned int model) {
@@ -1144,6 +1234,7 @@ void check_cpuid() bclk =discover_bclk (family, model); do_nehalem_turbo_ratio_limit =has_nehalem_turbo_ratio_limit (family, model); + do_ivt_turbo_ratio_limit =has_ivt_turbo_ratio_limit (family, model); }
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 43/49 tools/power turbostat: make -M output pretty
In reply to Len BrownFrom: Len Brown <[email protected]>
The -M option dumps the specified 64-bit MSR with every sample.
Previously it was output at the end of each line. However, with the v2 style of printing, the lines are now staggered, making MSR output hard to read.
So move the MSR output column to the left where things are aligned.
--- tools/power/x86/turbostat/turbostat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/power/x86/turbostat/turbostat.c +6 -4
@@ -223,6 +223,8 @@ void print_header(void)if (has_aperf) outp +=sprintf (outp," GHz" ); outp +=sprintf (outp," TSC" ); +if (extra_msr_offset) + outp +=sprintf (outp," MSR 0x%04X" , extra_msr_offset);if (do_nhm_cstates) outp +=sprintf (outp," %%c1" );if (do_nhm_cstates)
@@ -239,8 +241,6 @@ void print_header(void) outp +=sprintf (outp," %%pc6" );if (do_snb_cstates) outp +=sprintf (outp," %%pc7" ); -if (extra_msr_offset) - outp +=sprintf (outp," MSR 0x%x " , extra_msr_offset); outp +=sprintf (outp,"\n" ); }
@@ -361,6 +361,10 @@ int format_counters(struct thread_data *t, struct core_data *c,/* TSC */ outp +=sprintf (outp,"%5.2f" ,1.0 * t->tsc/units/interval_float); +/* MSR */ +if (extra_msr_offset) + outp +=sprintf (outp," 0x%016llx" , t->extra_msr); +if (do_nhm_cstates) {if (!skip_c1) outp +=sprintf (outp," %6.2f" ,100.0 * t->c1/t->tsc);
@@ -392,8 +396,6 @@ int format_counters(struct thread_data *t, struct core_data *c,if (do_snb_cstates) outp +=sprintf (outp," %6.2f" ,100.0 * p->pc7/t->tsc); done: -if (extra_msr_offset) - outp +=sprintf (outp," 0x%016llx" , t->extra_msr); outp +=sprintf (outp,"\n" );return 0 ;
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 44/49 tools/power turbostat: add [-m MSR#] option
In reply to Len BrownFrom: Len Brown <[email protected]>
-m MSR# prints the specified MSR in 32-bit format
-M MSR# prints the specified MSR in 64-bit format
--- tools/power/x86/turbostat/turbostat.8 | 14 +++++++- tools/power/x86/turbostat/turbostat.c | 68 +++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 16 deletions(-)
tools/power/x86/turbostat/turbostat.8 +13 -1
@@ -6,12 +6,14 @@ turbostat \- Report processor frequency and idle statistics .B turbostat .RB [ "\-s" ] .RB [ "\-v" ] +.RB [ "\-m MSR#" ] .RB [ "\-M MSR#" ] .RB command .br .B turbostat .RB [ "\-s" ] .RB [ "\-v" ] +.RB [ "\-m MSR#" ] .RB [ "\-M MSR#" ] .RB [ "\-i interval_sec" ] .SH DESCRIPTION
@@ -35,7 +37,10 @@ The \fB-p\fP option limits output to the 1st thread in each package. .PP The \fB-v\fP option increases verbosity. .PP -The \fB-M MSR#\fP option dumps the specified MSR, +The \fB-m MSR#\fP option dumps the specified 32-bit MSR, +in addition to the usual frequency and idle statistics. +.PP +The \fB-M MSR#\fP option dumps the specified 64-bit MSR, in addition to the usual frequency and idle statistics. .PP The \fB-i interval_sec\fP option prints statistics every \fiinterval_sec\fP seconds.
@@ -165,6 +170,13 @@ may work poorly on Linux-2.6.20 through 2.6.29, as \fBacpi-cpufreq \fPperiodically cleared the APERF and MPERF in those kernels. +If the TSC column does not make sense, then +the other numbers will also make no sense. +Turbostat is lightweight, and its data collection is not atomic. +These issues are usually caused by an extremely short measurement +interval (much less than 1 second), or system activity that prevents +turbostat from being able to run on all CPUS to quickly collect data. + The APERF, MPERF MSRs are defined to count non-halted cycles. Although it is not guaranteed by the architecture, turbostat assumes that they count at TSC rate, which is true on all processors tested to date.
tools/power/x86/turbostat/turbostat.c +53 -15
139 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 46/49 tools/power turbostat: add [-d MSR#][-D MSR#] options to print counter deltas
In reply to Len BrownFrom: Len Brown <[email protected]>
# turbostat -d 0x34 is useful for printing the number of SMI's within an interval on Nehalem and newer processors.
where
# turbostat -m 0x34 will simply print out the total SMI count since reset.
--- tools/power/x86/turbostat/turbostat.8 | 43 +++++++++++----- tools/power/x86/turbostat/turbostat.c | 95 +++++++++++++++++++++++------------ 2 files changed, 94 insertions(+), 44 deletions(-)
tools/power/x86/turbostat/turbostat.8 +31 -12
@@ -4,17 +4,11 @@ turbostat \- Report processor frequency and idle statistics .SH SYNOPSIS .ft B .B turbostat -.RB [ "\-s" ] -.RB [ "\-v" ] -.RB [ "\-m MSR#" ] -.RB [ "\-M MSR#" ] +.RB [ Options ] .RB command .br .B turbostat -.RB [ "\-s" ] -.RB [ "\-v" ] -.RB [ "\-m MSR#" ] -.RB [ "\-M MSR#" ] +.RB [ Options ] .RB [ "\-i interval_sec" ] .SH DESCRIPTION \fBturbostat \fP reports processor topology, frequency
@@ -37,11 +31,13 @@ The \fB-p\fP option limits output to the 1st thread in each package. .PP The \fB-v\fP option increases verbosity. .PP -The \fB-m MSR#\fP option dumps the specified 32-bit MSR, -in addition to the usual frequency and idle statistics. +The \fB-d MSR#\fP option includes the delta of the specified 32-bit MSR counter. .PP -The \fB-M MSR#\fP option dumps the specified 64-bit MSR, -in addition to the usual frequency and idle statistics. +The \fB-D MSR#\fP option includes the delta of the specified 64-bit MSR counter. +.PP +The \fB-m MSR#\fP option includes the the specified 32-bit MSR value. +.PP +The \fB-M MSR#\fP option includes the the specified 64-bit MSR value. .PP The \fB-i interval_sec\fP option prints statistics every \fiinterval_sec\fP seconds. The default is 5 seconds.
@@ -155,6 +151,29 @@ Note that turbostat reports average GHz of 3.63, while the arithmetic average of the GHz column above is lower. This is a weighted average, where the weight is %c0. ie. it is the total number of un-halted cycles elapsed per time divided by the number of CPUs. +.SH SMI COUNTING EXAMPLE +On Intel Nehalem and newer processors, MSR 0x34 is a System Management Mode Interrupt (SMI) counter. +Using the -m option, you can display how many SMIs have fired since reset, or if there +are SMIs during the measurement interval, you can display the delta using the -d option. +.nf +[root@x980 ~]# turbostat -m 0x34 +cor CPU %c0 GHz TSC MSR 0x034 %c1 %c3 %c6 %pc3 %pc6 + 1.41 1.82 3.38 0x00000000 8.92 37.82 51.85 17.37 0.55 + 0 0 3.73 2.03 3.38 0x00000055 1.72 48.25 46.31 17.38 0.55 + 0 6 0.14 1.63 3.38 0x00000056 5.30 + 1 2 2.51 1.80 3.38 0x00000056 15.65 29.33 52.52 + 1 8 0.10 1.65 3.38 0x00000056 18.05 + 2 4 1.16 1.68 3.38 0x00000056 5.87 24.47 68.50 + 2 10 0.10 1.63 3.38 0x00000056 6.93 + 8 1 3.84 1.91 3.38 0x00000056 1.36 50.65 44.16 + 8 7 0.08 1.64 3.38 0x00000056 5.12 + 9 3 1.82 1.73 3.38 0x00000056 7.59 24.21 66.38 + 9 9 0.09 1.68 3.38 0x00000056 9.32 + 10 5 1.66 1.65 3.38 0x00000056 15.10 50.00 33.23 + 10 11 1.72 1.65 3.38 0x00000056 15.05 +^C +[root@x980 ~]# +.fi .SH NOTES .B "turbostat "
tools/power/x86/turbostat/turbostat.c +63 -32
191 lines not on this page · raw message
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 47/49 tools/power/turbostat: add option to count SMIs, re-name some options
In reply to Len BrownFrom: Len Brown <[email protected]>
Counting SMIs is popular, so add a dedicated "-s" option to do it, and juggle some of the other option letters.
-S is now system summary (was -s)
-c is 32 bit counter (was -d)
-C is 64-bit counter (was -D)
-p is 1st thread in core (was -c)
-P is 1st thread in package (was -p)
bump the minor version number
--- tools/power/x86/turbostat/turbostat.8 | 12 +++++++----- tools/power/x86/turbostat/turbostat.c | 23 +++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-)
tools/power/x86/turbostat/turbostat.8 +7 -5
@@ -23,17 +23,19 @@ supports an "invariant" TSC, plus the APERF and MPERF MSRs. on processors that additionally support C-state residency counters. .SS Options -The \fB-s\fP option limits output to a 1-line system summary for each interval. +The \fB-p\fP option limits output to the 1st thread in 1st core of each package. .PP -The \fB-c\fP option limits output to the 1st thread in each core. +The \fB-P\fP option limits output to the 1st thread in each Package. .PP -The \fB-p\fP option limits output to the 1st thread in each package. +The \fB-S\fP option limits output to a 1-line System Summary for each interval. .PP The \fB-v\fP option increases verbosity. .PP -The \fB-d MSR#\fP option includes the delta of the specified 32-bit MSR counter. +The \fB-s\fP option prints the SMI counter, equivalent to "-c 0x34" .PP -The \fB-D MSR#\fP option includes the delta of the specified 64-bit MSR counter. +The \fB-c MSR#\fP option includes the delta of the specified 32-bit MSR counter. +.PP +The \fB-C MSR#\fP option includes the delta of the specified 64-bit MSR counter. .PP The \fB-m MSR#\fP option includes the the specified 32-bit MSR value. .PP
tools/power/x86/turbostat/turbostat.c +13 -10
@@ -230,9 +230,9 @@ void print_header(void) outp +=sprintf (outp," GHz" ); outp +=sprintf (outp," TSC" );if (extra_delta_offset32) - outp +=sprintf (outp," delta 0x%03X" , extra_delta_offset32); + outp +=sprintf (outp," count 0x%03X" , extra_delta_offset32);if (extra_delta_offset64) - outp +=sprintf (outp," DELTA 0x%03X" , extra_delta_offset64); + outp +=sprintf (outp," COUNT 0x%03X" , extra_delta_offset64);if (extra_msr_offset32) outp +=sprintf (outp," MSR 0x%03X" , extra_msr_offset32);if (extra_msr_offset64)
@@ -1304,7 +1304,7 @@ void check_cpuid()void usage () { -fprintf (stderr,"%s: [-v][-d MSR#][-D MSR#][-m MSR#][-M MSR#][-i interval_sec | command ...]\n" , +fprintf (stderr,"%s: [-v][-p|-P|-S][-c MSR# | -s]][-C MSR#][-m MSR#][-M MSR#][-i interval_sec | command ...]\n" , progname);exit (1 ); }
@@ -1594,15 +1594,15 @@ void cmdline(int argc, char **argv) progname = argv[0 ]; -while ((opt =getopt (argc, argv,"+cpsvid:D:m:M:" )) !=-1 ) { +while ((opt =getopt (argc, argv,"+pPSvisc:sC:m:M:" )) !=-1 ) {switch (opt) { -case 'c' : +case 'p' : show_core_only++;break ; -case 'p' : +case 'P' : show_pkg_only++;break ; -case 's' : +case 'S' : summary_only++;break ;case 'v' :
@@ -1611,10 +1611,13 @@ void cmdline(int argc, char **argv)case 'i' : interval_sec =atoi (optarg);break ; -case 'd' : +case 'c' :sscanf (optarg,"%x" , &extra_delta_offset32);break ; -case 'D' : +case 's' : + extra_delta_offset32 =0x34 ;/* SMI counter */ +break ; +case 'C' :sscanf (optarg,"%x" , &extra_delta_offset64);break ;case 'm' :
@@ -1634,7 +1637,7 @@ int main(int argc, char **argv)cmdline (argc, argv);if (verbose >1 ) -fprintf (stderr,"turbostat v2.0 May 16, 2012" +fprintf (stderr,"turbostat v2.1 October 6, 2012" " - Len Brown <[email protected]>\n" );turbostat_init ();
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 48/49 ACPI: Harden acpi_table_parse_entries() against BIOS bug
In reply to Len BrownFrom: Fenghua Yu <[email protected]>
Parsing acpi table entries may fall into an infinite loop on a buggy BIOS which has entry length=0 in acpi table.
Instead of kernel hang with few failure clue which leads to heavy lifting debug effort, this patch hardens kernel boot by booting into non NUMA mode. The debug info left in log buffer helps people identify the issue.
--- drivers/acpi/tables.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/acpi/tables.c +14 -4
@@ -240,10 +240,17 @@ acpi_table_parse_entries(char *id, table_end) {if (entry->type == entry_id && (!max_entries || count++ < max_entries)) -if (handler (entry, table_end)) { -early_acpi_os_unmap_memory ((char *)table_header, tbl_size); -return -EINVAL ; - } +if (handler (entry, table_end)) + goto err; + +/* +* If entry->length is 0, break from this loop to avoid +* infinite loop. +*/ +if (entry->length ==0 ) { +pr_err (PREFIX "[%4.4s:0x%02x] Invalid zero length\n" , id, entry_id); + goto err; + } entry = (struct acpi_subtable_header *) ((unsigned long )entry + entry->length);
@@ -255,6 +262,9 @@ acpi_table_parse_entries(char *id,early_acpi_os_unmap_memory ((char *)table_header, tbl_size);return count; +err: +early_acpi_os_unmap_memory ((char *)table_header, tbl_size); +return -EINVAL ; }int __init
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerACPI & PM queue for 3.7-merge - part 2
completing the series that started with
Subject: ACPI & PM queue for 3.7-merge
cheers,
Len Brown, Intel Open Source Technology Center
Len Brown
maintainerPATCH 45/49 intel_idle: enable IVB Xeon support
From: Len Brown <[email protected]>
IVB Xeon currently shares the same parameters IVB client.
--- drivers/idle/intel_idle.c | 1 + 1 file changed, 1 insertion(+)
drivers/idle/intel_idle.c +1 -0
@@ -413,6 +413,7 @@ static const struct x86_cpu_id intel_idle_ids[] = {ICPU (0x2a , idle_cpu_snb),ICPU (0x2d , idle_cpu_snb),ICPU (0x3a , idle_cpu_ivb), +ICPU (0x3e , idle_cpu_ivb), {} };MODULE_DEVICE_TABLE (x86cpu, intel_idle_ids);
Signature · 1 line
1.8.0.rc0.18.gf84667d
Len Brown
maintainerPATCH 49/49 ACPI: Add new sysfs interface to export device description
In reply to Len BrownFrom: Lance Ortiz <[email protected]>
Add support to export the device description obtained from the ACPI _STR method, if one exists for a device, to user-space via a sysfs interface. This new interface provides a standard and platform neutral way for users to obtain the description text stored in the ACPI _STR method. If no _STR method exists for the device, no sysfs 'description' file will be created. The 'description' file will be located in the /sys/devices/ directory using the device's path.
/sys/device/<bus>/<bridge path>/<device path>.../firmware_node/description
Example:
/sys/devices/pci0000:00/0000:00.07.0/0000:0e:00.0/firmware_node/description
It can also be located using the ACPI device path, for example:
/sys/devices/LNXSYSTM:00/device:00/ACPI0004:00/PNP0A08:00/device:13/device:15/description /sys/devices/LNXSYSTM:00/device:00/ACPI0004:00/ACPI0004:01/ACPI0007:02/description
Execute the 'cat' command on the 'description' file to obtain the description string for that device.
This patch also includes documentation describing how the new sysfs interface works
Changes from v1-v2 based on comments by Len Brown and Fengguang Wu
* Removed output "No Description" and leaving a NULL attribute if the _STR method failed to evaluate.
* In acpi_device_remove_files() removed the redundent check of dev->pnp.str_obj before calling free. This check triggered a message from smatch.
--- .../ABI/testing/sysfs-devices-firmware_node | 17 +++++++ drivers/acpi/scan.c | 54 +++++++++++++++++++++- include/acpi/acpi_bus.h | 1 + 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-firmware_node
Documentation/ABI/testing/sysfs-devices-firmware_node new file +17 -0
@@ -0,0 +1,17 @@ +What: /sys/devices/.../firmware_node/ +Date: September 2012 +Contact: <> +Description: + The /sys/devices/.../firmware_node directory contains attributes + allowing the user space to check and modify some firmware + related properties of given device. + +What: /sys/devices/.../firmware_node/description +Date: September 2012 +Contact: Lance Ortiz <[email protected]> +Description: + The /sys/devices/.../firmware/description attribute contains a string + that describes the device as provided by the _STR method in the ACPI + namespace. This attribute is read-only. If the device does not have + an _STR method associated with it in the ACPI namespace, this + attribute is not present.
drivers/acpi/scan.c +52 -2
80 lines not on this page · raw message
include/acpi/acpi_bus.h +1 -0
@@ -208,6 +208,7 @@ struct acpi_device_pnp {struct list_head ids;/* _HID and _CIDs */ acpi_device_name device_name;/* Driver-determined */ acpi_device_class device_class;/* " */ +union acpi_object *str_obj;/* unicode string for _STR method */ };#define acpi_device_bid (d) ((d)->pnp.bus_id)
Signature · 1 line
1.8.0.rc0.18.gf84667d
Re: [PATCH 01/49] ACPI: delelte more BFS/GTS related definition and code
In reply to Len BrownQuoted 1 line · Len Brown
From: Feng Tang <[email protected]>
The title has 'delete' misspelled.
Quoted 64 lines
This is a follow on for commmit
3f6f49c7"ACPI: delete _GTS/_BFS support" to do more cleanup.Signed-off-by Feng Tang <[email protected]>Signed-off-by Bob Moore <[email protected]>Signed-off-by Len Brown <[email protected]>--- drivers/acpi/acpica/hwxfsleep.c | 1 - include/acpi/acnames.h | 2 -- include/acpi/actypes.h | 7 ------- 3 files changed, 10 deletions(-)drivers/acpi/acpica/hwxfsleep.c +0
-1@@ -381,7 +381,6 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)* FUNCTION: acpi_leave_sleep_state_prep * * PARAMETERS: sleep_state - Which sleep state we are exiting -* flags - ACPI_EXECUTE_BFS to run optional method * * RETURN: Status * include/acpi/acnames.h +0
-2@@ -66,8 +66,6 @@/* Method names - these methods must appear at the namespace root */ -#define METHOD_PATHNAME__BFS "\\_BFS" -#define METHOD_PATHNAME__GTS "\\_GTS"#define METHOD_PATHNAME__PTS "\\_PTS"#define METHOD_PATHNAME__SST "\\_SI._SST"#define METHOD_PATHNAME__WAK "\\_WAK"include/acpi/actypes.h +0
-7@@ -519,13 +519,6 @@ typedef u64 acpi_integer;#define ACPI_SLEEP_TYPE_INVALID 0xFF/* -* Sleep/Wake flags -*/ -#define ACPI_NO_OPTIONAL_METHODS 0x00/* Do not execute any optional methods */ -#define ACPI_EXECUTE_GTS 0x01/* For enter sleep interface */ -#define ACPI_EXECUTE_BFS 0x02/* For leave sleep prep interface */ - -/* * Standard notify values */ #define ACPI_NOTIFY_BUS_CHECK (u8) 0x00Signature · 6 lines
1.8.0.rc0.18.gf84667d -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html