GIT 819c17cb3f8e01954488ba0f8bedfcbeda174b3f git+ssh://master.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git#test commit e6f1f3c54974a30c65ea0b699809d12f0aa04272 Author: Bjorn Helgaas Date: Mon Apr 3 13:14:00 2006 -0400 ACPI: Don't print internal BIOS names of wakeup devices Internal BIOS names like these should be exposed to the user as little as possible: ACPI wakeup devices: C069 C0CE C1D1 C0DE C1D4 Eventually, the "wakeup" property of a device should be exported via the device tree, not by a printk of an internal BIOS name. For the hard-core, these are still available in /proc/acpi/wakeup_devices, just not printed to dmesg. Signed-off-by: Bjorn Helgaas Signed-off-by: Len Brown commit 144c87b4e03759214c362d267e01c2905f1ab095 Author: Len Brown Date: Sun Apr 2 00:15:39 2006 -0500 ACPI: ia64 buildfix arch/ia64/hp/common/sba_iommu.c used ACPI_MEM_FREE instead of kfree() Signed-off-by: Len Brown Date: Sat Apr 1 23:45:39 2006 -0500 ACPI: ia64 buildfix Signed-off-by: Len Brown commit c12ea918ee175ceb3a258cd81f1c43e897d0c0bc Author: Ashok Raj Date: Tue Mar 28 17:04:00 2006 -0500 x86_64: Remove stale lapic definition from apicdef.h Signed-off-by: Ashok Raj Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit eefa27a93a0490902f33837ac86dbcf344b3aa29 Author: Ashok Raj Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: Allow hot-add of ejected processor acpi_eject_store() didn't trim processors, causing subsequent hot-add to fail. Signed-off-by: Ashok Raj Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit ff2fc3e9e3edb918b6c6b288485c6cb267bc865e Author: Jiri Slaby Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: EC acpi-ecdt-uid-hack On some boxes ecdt uid may be equal to 0, so do not test for uids equality, so that fake handler will be unconditionally removed to allow loading the real one. See http://bugzilla.kernel.org/show_bug.cgi?id=6111 Signed-off-by: Jiri Slaby Cc: Luming Yu Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit df42baa0d8e54df18dd9366dd7c93d6be7d5d063 Author: Ashok Raj Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: build fix for u8 cpu_index Local apic entries are only 8 bits, but it seemed to not be caught with u8 return value result in the check cpu_index >= NR_CPUS becomming always false. drivers/acpi/processor_core.c: In function `acpi_processor_get_info': drivers/acpi/processor_core.c:483: warning: comparison is always false due to limited range of data type Signed-off-by: Ashok Raj Cc: Dave Jones Cc: Kenji Kaneshige Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 200739c179c63d21804e9e8e2ced265243831579 Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: remove __init/__exit from Asus .add()/.remove() methods Even though the devices claimed by asus_acpi.c can not be hot-plugged, the driver registration infrastructure allows the .add() and .remove() methods to be called at any time while the driver is registered. So remove __init and __exit from them. Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 5e15b92d07fb11490c886c5dd7567f523ea43e2d Author: Davi Arnaut Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: acpi_os_acquire_object (GFP_KERNEL) called with IRQs disabled through suspend-resume acpi_os_acquire_object() gets called, with IRQs disabled, from: Debug: sleeping function called from invalid context at mm/slab.c:2499 in_atomic():0, irqs_disabled():1 [] kmem_cache_alloc+0x40/0x4f [] acpi_os_acquire_object+0xb/0x3c [] acpi_ut_allocate_object_desc_dbg+0x13/0x49 [] acpi_ut_create_internal_object_dbg+0xf/0x5e [] acpi_rs_set_srs_method_data+0x3d/0xb9 [] acpi_pci_link_set+0x102/0x17b [] irqrouter_resume+0x1e/0x3c [] __sysdev_resume+0x11/0x6b [] sysdev_resume+0x34/0x52 [] device_power_up+0x5/0xa [] suspend_enter+0x44/0x46 [] suspend_prepare+0x63/0xc1 [] enter_state+0x5e/0x7c [] state_store+0x81/0x8f [] state_store+0x0/0x8f [] subsys_attr_store+0x1e/0x22 [] flush_write_buffer+0x22/0x28 [] sysfs_write_file+0x4c/0x71 [] sysfs_write_file+0x0/0x71 [] vfs_write+0xa2/0x15a [] sys_write+0x41/0x6a [] syscall_call+0x7/0xb The patch also fixes a missing check for NULL return from acpi_os_acquire_object(). Signed-off-by: Davi Arnaut Cc: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 9224a867c497053842dc595e594ca6d32112221f Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 HPET: fix ACPI memory range length handling ACPI address space descriptors contain _MIN, _MAX, and _LEN. _MIN and _MAX are the bounds within which the region can be moved (this is clarified in Table 6-38 of the ACPI 3.0 spec). We should use _LEN to determine the size of the region, not _MAX - _MIN + 1. Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 459c7266d7a5c1730169258217e25fdd1b7ca854 Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: fix memory hotplug range length handling Address space descriptors contain _MIN, _MAX, and _LEN. _MIN and _MAX are the bounds within which the region can be moved (this is clarified in Table 6-38 of the ACPI 3.0 spec). We should use _LEN to determine the size of the region, not _MAX - _MIN + 1. Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 1a36561607abf1405b56a41aac2fd163429cd1f8 Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: simplify scan.c coding No functional changes; just remove leftover, unused "buffer" and simplify control flow (no need to remember error values and goto the end, when we can simply return the value directly). Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit e4513a57ef719d3d6d1cee0ca4d9f4016aa452bb Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: fix sonypi ACPI driver registration to unregister on failure Remove the assumption that acpi_bus_register_driver() returns the number of devices claimed. Returning the count is unreliable because devices may be hot-plugged in the future (admittedly not applicable for this driver). This also fixes a bug: if sonypi_acpi_driver was registered but found no devices, sonypi_exit() did not unregister it. Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 578b333bfe8eb1360207a08a53c321822a8f40f3 Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: update asus_acpi driver registration to unload on failure Remove the assumption that acpi_bus_register_driver() returns the number of devices claimed. Returning the count is unreliable because devices may be hot-plugged in the future (admittedly not applicable for this driver). Since the hardware for this driver is not hot-pluggable, determine whether the hardware is present by noticing calls to the .add() method. It would be better to probe the ACPI namespace for the ASUS HIDs, and load the driver only when we find one, but ACPI doesn't support that yet. I don't have an ASUS laptop to test on, but on my HP dl360, it does report the appropriate error when attempting to load the module: $ sudo insmod drivers/acpi/asus_acpi.ko insmod: error inserting 'drivers/acpi/asus_acpi.ko': -1 No such device Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 9d9f749b316ac21cb59ad3e595cbce469b409e1a Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: make acpi_bus_register_driver() return success/failure, not device count acpi_bus_register_driver() should not return the number of devices claimed. We're not asking to find devices, we're making a driver available to devices, including hot-pluggable devices that may appear in the future. I audited all callers of acpi_bus_register_driver(), and except asus_acpi.c and sonypi.c (fixed in previous patches), all either ignore the return value or test only for failure (<0). Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit cd090eedd85256829f762677d0752a846c1b88b9 Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: Display "ACPI" to motherboard resources in /proc/io{mem,port} Add "ACPI" to motherboard resource allocation names, so people have a clue about where to look. And remove some trailing spaces. Changes these /proc/iomem entries from this: ff5c1004-ff5c1007 : PM_TMR ff5c1008-ff5c100b : PM1a_EVT_BLK ff5c100c-ff5c100d : PM1a_CNT_BLK ff5c1010-ff5c1013 : GPE0_BLK ff5c1014-ff5c1017 : GPE1_BLK to this: ff5c1004-ff5c1007 : ACPI PM_TMR ff5c1008-ff5c100b : ACPI PM1a_EVT_BLK ff5c100c-ff5c100d : ACPI PM1a_CNT_BLK ff5c1010-ff5c1013 : ACPI GPE0_BLK ff5c1014-ff5c1017 : ACPI GPE1_BLK Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 81507ea9cfa64e9851b53e0fefebfa776eda9ecb Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: request correct fixed hardware resource type (MMIO vs I/O port) ACPI supports fixed hardware (PM_TMR, GPE blocks, etc) in either I/O port or MMIO space, but used to always request the regions from I/O space because it didn't check the address_space_id. Sample ACPI fixed hardware in MMIO space (HP rx2600), was incorrectly reported in /proc/ioports, now reported in /proc/iomem: ff5c1004-ff5c1007 : PM_TMR ff5c1008-ff5c100b : PM1a_EVT_BLK ff5c100c-ff5c100d : PM1a_CNT_BLK ff5c1010-ff5c1013 : GPE0_BLK ff5c1014-ff5c1017 : GPE1_BLK Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 1c6e7d0aeecac38e66b1bb63e3eff07b2a1c2f2c Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 PNPACPI: whitespace cleanup Tidy up whitespace. No functional change. Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit b5f2490b6e3317059e87ba40d4f659d1c30afc1f Author: Bjorn Helgaas Date: Tue Mar 28 17:04:00 2006 -0500 PNPACPI: remove some code duplication Factor out the duplicated switch from pnpacpi_count_resources() and pnpacpi_type_resources(). Remove the unnecessary re-initialization of resource->type and length from all the encode functions (id and length are originally set in the pnpacpi_build_resource_template() -> pnpacpi_type_resources() path). Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 1acfb7f2b0d460ee86bdb25ad0679070ec8a5f0d Author: Bjorn Helgaas Date: Tue Mar 28 17:03:00 2006 -0500 PNPACPI: fix non-memory address space descriptor handling Fix resource_type handling for QWORD, DWORD, and WORD Address Space Descriptors. Previously we ignored the resource_type, so I/O ports and bus number ranges were incorrectly parsed as memory ranges. Sample PCI root bridge resources from HP rx2600 before this patch: # cat /sys/bus/pnp/devices/00:02/resources state = active mem 0x0-0x1f mem 0x0-0x3af mem 0x3e0-0x1fff mem 0x80000000-0x8fffffff With this patch: # cat /sys/bus/pnp/devices/00:02/resources state = active io 0x0-0x3af io 0x3e0-0x1fff mem 0x80000000-0x8fffffff mem 0x80004000000-0x80103fffffe Changes: 0x0-0x1f PCI bus number range was incorrectly reported as memory, now not reported at all 0x0-0x3af I/O port range was incorrectly reported as memory 0x3e0-0x1fff I/O port range was incorrectly reported as memory 0x80004000000-0x80103fffffe memory range wasn't reported at all because we only support PNP_MAX_MEM (4) memory resources Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 7e1f19e50371e1d148226b64c8edc77fec47fa5b Author: Andrew Morton Date: Tue Mar 28 17:03:00 2006 -0500 ACPI: UP build fix for bugzilla-5737 cpu_online_map doesn't exist if !CONFIG_SMP. Signed-off-by: Venkatesh Pallipadi Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit 1300124f69cafc54331bc06e968a8dd67863f989 Author: Adrian Bunk Date: Tue Mar 28 17:04:00 2006 -0500 ACPI: Kconfig: ACPI should depend on, not select PCI Otherwise, illegal configurations like X86_VOYAGER=y, PCI=y are possible. This patch also fixes the options select'ing ACPI to also select PCI. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Len Brown commit ec7381d6bfd3e7b8d2880dd5e9d03b131b0603f6 Author: Len Brown Date: Sat Apr 1 05:12:23 2006 -0500 ACPI: inline trivial acpi_os_get_thread_id() acpi_os_get_thread_id() is used only for debugging code that is not enabled on Linux, so stub it out. Signed-off-by: Len Brown commit 8313524a0d466f451a62709aaedf988d8257b21c Author: Bob Moore Date: Tue Oct 3 00:00:00 2006 -0400 ACPI: ACPICA 20060310 Tagged all external interfaces to the subsystem with the new ACPI_EXPORT_SYMBOL macro. This macro can be defined as necessary to assist kernel integration. For Linux, the macro resolves to the EXPORT_SYMBOL macro. The default definition is NULL. Added the ACPI_THREAD_ID type for the return value from acpi_os_get_thread_id(). This allows the host to define this as necessary to simplify kernel integration. The default definition is ACPI_NATIVE_UINT. Valery Podrezov fixed two interpreter problems related to error processing, the deletion of objects, and placing invalid pointers onto the internal operator result stack. http://bugzilla.kernel.org/show_bug.cgi?id=6028 http://bugzilla.kernel.org/show_bug.cgi?id=6151 Increased the reference count threshold where a warning is emitted for large reference counts in order to eliminate unnecessary warnings on systems with large namespaces (especially 64-bit.) Increased the value from 0x400 to 0x800. Due to universal disagreement as to the meaning of the 'c' in the calloc() function, the ACPI_MEM_CALLOCATE macro has been renamed to ACPI_ALLOCATE_ZEROED so that the purpose of the interface is 'clear'. ACPI_MEM_ALLOCATE and ACPI_MEM_FREE are renamed to ACPI_ALLOCATE and ACPI_FREE. Signed-off-by: Bob Moore Signed-off-by: Len Brown commit ea936b78f46cbe089a4ac363e1682dee7d427096 Author: Bob Moore Date: Fri Feb 17 00:00:00 2006 -0500 ACPI: ACPICA 20060217 Implemented a change to the IndexField support to match the behavior of the Microsoft AML interpreter. The value written to the Index register is now a byte offset, no longer an index based upon the width of the Data register. This should fix IndexField problems seen on some machines where the Data register is not exactly one byte wide. The ACPI specification will be clarified on this point. Fixed a problem where several resource descriptor types could overrun the internal descriptor buffer due to size miscalculation: VendorShort, VendorLong, and Interrupt. This was noticed on IA64 machines, but could affect all platforms. Fixed a problem where individual resource descriptors were misaligned within the internal buffer, causing alignment faults on IA64 platforms. Signed-off-by: Bob Moore Signed-off-by: Len Brown commit 52fc0b026e99b5d5d585095148d997d5634bbc25 Author: Bob Moore Date: Mon Oct 2 00:00:00 2006 -0400 [ACPI] ACPICA 20060210 Removed a couple of extraneous ACPI_ERROR messages that appeared during normal execution. These became apparent after the conversion from ACPI_DEBUG_PRINT. Fixed a problem where the CreateField operator could hang if the BitIndex or NumBits parameter referred to a named object. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5359 Fixed a problem where a DeRefOf operation on a buffer object incorrectly failed with an exception. This also fixes a couple of related RefOf and DeRefOf issues. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5360 http://bugzilla.kernel.org/show_bug.cgi?id=5387 http://bugzilla.kernel.org/show_bug.cgi?id=5392 Fixed a problem where the AE_BUFFER_LIMIT exception was returned instead of AE_STRING_LIMIT on an out-of-bounds Index() operation. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5480 Implemented a memory cleanup at the end of the execution of each iteration of an AML While() loop, preventing the accumulation of outstanding objects. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5427 Eliminated a chunk of duplicate code in the object resolution code. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5336 Fixed several warnings during the 64-bit code generation. Signed-off-by: Bob Moore Signed-off-by: Len Brown commit 46358614ed5b031797522f1020e989c959a8d8a6 Author: Len Brown Date: Fri Mar 31 02:16:19 2006 -0500 Revert "[PATCH] ACPI: fix vendor resource length computation" fixed in a different way by a subsequent ACPICA patch This reverts 35b73ceb9a7d10c81bd9e79e8485f7079ef2b40e commit. commit 6665bda76461308868bd1e52caf627f4cb29ed32 Author: Adrian Bunk Date: Sat Mar 11 10:12:00 2006 -0500 [ACPI] drivers/acpi/video.c: fix error path NULL pointer dereference The Coverity checker spotted this bug in acpi_video_device_lcd_query_levels(). Signed-off-by: Adrian Bunk Signed-off-by: Len Brown commit fdc136ccd3332938e989439c025c363f8479f3e6 Author: Dave Jones Date: Wed Mar 8 22:12:00 2006 -0500 [ACPI] fix possible acpi thermal leak in failure path Coverity: #601 Signed-off-by: Dave Jones Signed-off-by: Len Brown commit a1f9e65e2085e0a87f28a4d5a8ae43b32c087f24 Author: Len Brown Date: Wed Jan 25 23:47:36 2006 -0500 [ACPI] document cmdline acpi_os_name= This can sometimes be used to work around broken BIOS. Use "Microsoft Windows" to take the same path through the BIOS as Windows98 would. The default is "Microsoft Windows NT", which is what NT and later versions of Windows use, and is the most tested path through most BIOS. Set it to anything else, including "Linux", at your own risk, as it seems that virtually no BIOS has been tested with anything but the two options above. Note that this uses the legacy _OS interface, so we don't expect this to ever change. Signed-off-by: Len Brown commit 1fee94034917aa711fcbd4ebf4c36f7ebd9fa7d6 Author: Irwan Djajadi Date: Fri Jan 20 15:28:00 2006 -0500 [ACPI] drivers/acpi/hotkey.c: check kmalloc return value Signed-off-by: Irwan Djajadi Signed-off-by: Alexey Dobriyan Signed-off-by: Len Brown commit 0eacee585a89ce5827b572a73a024931506bef48 Author: Len Brown Date: Fri Mar 31 00:37:23 2006 -0500 ACPI: enable BIOS warning http://bugzilla.kernel.org/show_bug.cgi?id=5452 Signed-off-by: Len Brown commit 9cfda2c94df61c9f859b474abe774c65a4464d0a Author: Andi Kleen Date: Mon Mar 27 02:24:32 2006 -0500 [ACPI] fix "nolapic" flag in ACPI mode Signed-off-by: Len Brown commit d52bb94d56676acd9bdac8e097257a87b4b1b2e1 Author: Venkatesh Pallipadi Date: Wed Dec 14 15:05:00 2005 -0500 Enable P-state software coordination via _PDC http://bugzilla.kernel.org/show_bug.cgi?id=5737 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown commit c52851b60cc0aaaf974ff0e49989fb698220447d Author: Venkatesh Pallipadi Date: Wed Dec 14 15:05:00 2005 -0500 P-state software coordination for speedstep-centrino http://bugzilla.kernel.org/show_bug.cgi?id=5737 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown commit 09b4d1ee881c8593bfad2a42f838d85070365c3e Author: Venkatesh Pallipadi Date: Wed Dec 14 15:05:00 2005 -0500 P-state software coordination for acpi-cpufreq http://bugzilla.kernel.org/show_bug.cgi?id=5737 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown commit 3b2d99429e3386b6e2ac949fc72486509c8bbe36 Author: Venkatesh Pallipadi Date: Wed Dec 14 15:05:00 2005 -0500 P-state software coordination for ACPI core http://bugzilla.kernel.org/show_bug.cgi?id=5737 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown commit ffd642e748c867a7339b57225b8bf8b9a0dcd9c5 Author: David Shaohua Li Date: Wed Feb 8 17:35:00 2006 -0500 [ACPI] enable SMP C-states on x86_64 http://bugzilla.kernel.org/show_bug.cgi?id=5653 Signed-off-by: David Shaohua Li Signed-off-by: Len Brown commit f9ea7fd8be9827791f407ca1191ff70ec25eb2d9 Author: Thomas Renninger Date: Fri Jun 2 15:58:00 2006 -0400 [ACPI] Print error message if remove/install notify handler fails Signed-off-by: Thomas Renniger Signed-off-by: Len Brown commit b60e49b2383db0334bef1f0d9cdad9bec2336050 Author: Thomas Renninger Date: Fri Jun 2 15:58:00 2006 -0400 [ACPI] Export symbols for ACPI_ERROR/EXCEPTION/WARNING macros Signed-off-by: Thomas Renninger Signed-off-by: Len Brown commit 1ca218d3bd6acca0922a349cb76e3244d27ebfba Author: Thomas Renniger Date: Fri Jun 2 15:58:00 2006 -0400 [ACPI] Enable ACPI error messages w/o CONFIG_ACPI_DEBUG Signed-off-by: Thomas Renniger Signed-off-by: Len Brown --- Signed-off-by: Andrew Morton --- dev/null | 72 -- Documentation/kernel-parameters.txt | 3 arch/i386/kernel/acpi/boot.c | 5 arch/i386/kernel/acpi/processor.c | 2 arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 289 ++++++++---- arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | 256 +++++++--- arch/ia64/Kconfig | 1 arch/ia64/hp/common/sba_iommu.c | 2 arch/x86_64/Kconfig | 1 arch/x86_64/kernel/acpi/Makefile | 1 drivers/acpi/Kconfig | 3 drivers/acpi/ac.c | 12 drivers/acpi/acpi_memhotplug.c | 79 +-- drivers/acpi/asus_acpi.c | 28 - drivers/acpi/battery.c | 31 - drivers/acpi/bus.c | 22 drivers/acpi/button.c | 18 drivers/acpi/container.c | 2 drivers/acpi/debug.c | 5 drivers/acpi/dispatcher/dsfield.c | 1 drivers/acpi/dispatcher/dsmethod.c | 5 drivers/acpi/dispatcher/dsmthdat.c | 3 drivers/acpi/dispatcher/dsobject.c | 15 drivers/acpi/dispatcher/dsopcode.c | 4 drivers/acpi/dispatcher/dsutils.c | 9 drivers/acpi/dispatcher/dswexec.c | 3 drivers/acpi/dispatcher/dswload.c | 10 drivers/acpi/dispatcher/dswscope.c | 2 drivers/acpi/dispatcher/dswstate.c | 13 drivers/acpi/ec.c | 33 - drivers/acpi/event.c | 5 drivers/acpi/events/evevent.c | 2 drivers/acpi/events/evgpe.c | 5 drivers/acpi/events/evgpeblk.c | 52 +- drivers/acpi/events/evmisc.c | 6 drivers/acpi/events/evregion.c | 12 drivers/acpi/events/evrgnini.c | 14 drivers/acpi/events/evxface.c | 82 +-- drivers/acpi/events/evxfevnt.c | 41 - drivers/acpi/events/evxfregn.c | 9 drivers/acpi/executer/exconfig.c | 9 drivers/acpi/executer/exconvrt.c | 2 drivers/acpi/executer/exdump.c | 4 drivers/acpi/executer/exfield.c | 6 drivers/acpi/executer/exfldio.c | 5 drivers/acpi/executer/exmisc.c | 1 drivers/acpi/executer/exmutex.c | 3 drivers/acpi/executer/exnames.c | 10 drivers/acpi/executer/exoparg1.c | 61 ++ drivers/acpi/executer/exoparg2.c | 79 ++- drivers/acpi/executer/exoparg3.c | 11 drivers/acpi/executer/exoparg6.c | 1 drivers/acpi/executer/exprep.c | 17 drivers/acpi/executer/exregion.c | 11 drivers/acpi/executer/exresnte.c | 5 drivers/acpi/executer/exresolv.c | 43 - drivers/acpi/executer/exresop.c | 4 drivers/acpi/executer/exstore.c | 2 drivers/acpi/executer/exstoren.c | 3 drivers/acpi/executer/exstorob.c | 11 drivers/acpi/executer/exsystem.c | 2 drivers/acpi/executer/exutils.c | 3 drivers/acpi/fan.c | 7 drivers/acpi/hardware/hwgpe.c | 2 drivers/acpi/hardware/hwregs.c | 12 drivers/acpi/hardware/hwsleep.c | 19 drivers/acpi/hardware/hwtimer.c | 10 drivers/acpi/hotkey.c | 40 - drivers/acpi/motherboard.c | 73 +-- drivers/acpi/namespace/nsaccess.c | 26 - drivers/acpi/namespace/nsalloc.c | 14 drivers/acpi/namespace/nsdump.c | 4 drivers/acpi/namespace/nsdumpdv.c | 2 drivers/acpi/namespace/nseval.c | 5 drivers/acpi/namespace/nsinit.c | 7 drivers/acpi/namespace/nsload.c | 3 drivers/acpi/namespace/nsnames.c | 10 drivers/acpi/namespace/nsobject.c | 3 drivers/acpi/namespace/nsparse.c | 2 drivers/acpi/namespace/nssearch.c | 5 drivers/acpi/namespace/nsutils.c | 23 drivers/acpi/namespace/nswalk.c | 4 drivers/acpi/namespace/nsxfeval.c | 84 +-- drivers/acpi/namespace/nsxfname.c | 17 drivers/acpi/namespace/nsxfobj.c | 11 drivers/acpi/osl.c | 27 - drivers/acpi/parser/psargs.c | 7 drivers/acpi/parser/psloop.c | 7 drivers/acpi/parser/psopcode.c | 2 drivers/acpi/parser/psparse.c | 8 drivers/acpi/parser/psscope.c | 1 drivers/acpi/parser/pstree.c | 8 drivers/acpi/parser/psutils.c | 9 drivers/acpi/parser/pswalk.c | 3 drivers/acpi/parser/psxface.c | 2 drivers/acpi/pci_bind.c | 50 +- drivers/acpi/pci_irq.c | 20 drivers/acpi/pci_link.c | 90 +-- drivers/acpi/pci_root.c | 15 drivers/acpi/power.c | 22 drivers/acpi/processor_core.c | 70 +- drivers/acpi/processor_idle.c | 14 drivers/acpi/processor_perflib.c | 265 ++++++++++- drivers/acpi/processor_thermal.c | 11 drivers/acpi/processor_throttling.c | 2 drivers/acpi/resources/rscalc.c | 104 ++-- drivers/acpi/resources/rscreate.c | 2 drivers/acpi/resources/rsinfo.c | 1 drivers/acpi/resources/rslist.c | 18 drivers/acpi/resources/rsmisc.c | 10 drivers/acpi/resources/rsutils.c | 55 +- drivers/acpi/resources/rsxface.c | 31 - drivers/acpi/scan.c | 64 -- drivers/acpi/sleep/wakeup.c | 3 drivers/acpi/system.c | 3 drivers/acpi/tables/tbconvrt.c | 11 drivers/acpi/tables/tbget.c | 11 drivers/acpi/tables/tbgetall.c | 1 drivers/acpi/tables/tbinstal.c | 9 drivers/acpi/tables/tbrsdt.c | 1 drivers/acpi/tables/tbutils.c | 2 drivers/acpi/tables/tbxface.c | 18 drivers/acpi/tables/tbxfroot.c | 33 - drivers/acpi/thermal.c | 62 -- drivers/acpi/utilities/utalloc.c | 7 drivers/acpi/utilities/utcache.c | 10 drivers/acpi/utilities/utcopy.c | 25 - drivers/acpi/utilities/utdebug.c | 27 - drivers/acpi/utilities/utdelete.c | 7 drivers/acpi/utilities/uteval.c | 8 drivers/acpi/utilities/utglobal.c | 8 drivers/acpi/utilities/utinit.c | 8 drivers/acpi/utilities/utmisc.c | 39 - drivers/acpi/utilities/utmutex.c | 4 drivers/acpi/utilities/utobject.c | 7 drivers/acpi/utilities/utresrc.c | 4 drivers/acpi/utilities/utstate.c | 2 drivers/acpi/utilities/utxface.c | 24 drivers/acpi/utils.c | 50 -- drivers/acpi/video.c | 56 -- drivers/char/agp/hp-agp.c | 2 drivers/char/hpet.c | 5 drivers/char/sonypi.c | 10 drivers/pnp/pnpacpi/rsparser.c | 199 +++----- include/acpi/acconfig.h | 6 include/acpi/acdisasm.h | 24 include/acpi/aclocal.h | 8 include/acpi/acmacros.h | 48 + include/acpi/acnamesp.h | 5 include/acpi/acpiosxf.h | 2 include/acpi/actypes.h | 25 - include/acpi/acutils.h | 2 include/acpi/amlresrc.h | 61 +- include/acpi/pdc_intel.h | 5 include/acpi/platform/acenv.h | 6 include/acpi/platform/aclinux.h | 23 include/acpi/processor.h | 27 + include/asm-i386/apicdef.h | 1 include/asm-x86_64/acpi.h | 2 include/asm-x86_64/apicdef.h | 2 include/linux/cpufreq.h | 4 161 files changed, 2117 insertions(+), 1542 deletions(-) diff -puN arch/i386/kernel/acpi/boot.c~git-acpi arch/i386/kernel/acpi/boot.c --- devel/arch/i386/kernel/acpi/boot.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/i386/kernel/acpi/boot.c 2006-04-26 13:41:00.000000000 -0700 @@ -168,7 +168,7 @@ int __init acpi_parse_mcfg(unsigned long unsigned long i; int config_size; - if (!phys_addr || !size) + if (!phys_addr || !size || !cpu_has_apic) return -EINVAL; mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size); @@ -744,6 +744,9 @@ static int __init acpi_parse_madt_ioapic { int count; + if (!cpu_has_apic) + return -ENODEV; + /* * ACPI interpreter is required to complete interrupt setup, * so if it is off, don't enumerate the io-apics with ACPI. diff -puN arch/i386/kernel/acpi/processor.c~git-acpi arch/i386/kernel/acpi/processor.c --- devel/arch/i386/kernel/acpi/processor.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/i386/kernel/acpi/processor.c 2006-04-26 13:41:00.000000000 -0700 @@ -47,7 +47,7 @@ static void init_intel_pdc(struct acpi_p buf[2] = ACPI_PDC_C_CAPABILITY_SMP; if (cpu_has(c, X86_FEATURE_EST)) - buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; + buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; obj->type = ACPI_TYPE_BUFFER; obj->buffer.length = 12; diff -puN arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c~git-acpi arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c --- devel/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c 2006-04-26 13:41:00.000000000 -0700 @@ -48,12 +48,13 @@ MODULE_LICENSE("GPL"); struct cpufreq_acpi_io { - struct acpi_processor_performance acpi_data; + struct acpi_processor_performance *acpi_data; struct cpufreq_frequency_table *freq_table; unsigned int resume; }; static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; +static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; static struct cpufreq_driver acpi_cpufreq_driver; @@ -104,64 +105,43 @@ acpi_processor_set_performance ( { u16 port = 0; u8 bit_width = 0; + int i = 0; int ret = 0; u32 value = 0; - int i = 0; - struct cpufreq_freqs cpufreq_freqs; - cpumask_t saved_mask; int retval; + struct acpi_processor_performance *perf; dprintk("acpi_processor_set_performance\n"); - /* - * TBD: Use something other than set_cpus_allowed. - * As set_cpus_allowed is a bit racy, - * with any other set_cpus_allowed for this process. - */ - saved_mask = current->cpus_allowed; - set_cpus_allowed(current, cpumask_of_cpu(cpu)); - if (smp_processor_id() != cpu) { - return (-EAGAIN); - } - - if (state == data->acpi_data.state) { + retval = 0; + perf = data->acpi_data; + if (state == perf->state) { if (unlikely(data->resume)) { dprintk("Called after resume, resetting to P%d\n", state); data->resume = 0; } else { dprintk("Already at target state (P%d)\n", state); - retval = 0; - goto migrate_end; + return (retval); } } - dprintk("Transitioning from P%d to P%d\n", - data->acpi_data.state, state); - - /* cpufreq frequency struct */ - cpufreq_freqs.cpu = cpu; - cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency; - cpufreq_freqs.new = data->freq_table[state].frequency; - - /* notify cpufreq */ - cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); + dprintk("Transitioning from P%d to P%d\n", perf->state, state); /* * First we write the target state's 'control' value to the * control_register. */ - port = data->acpi_data.control_register.address; - bit_width = data->acpi_data.control_register.bit_width; - value = (u32) data->acpi_data.states[state].control; + port = perf->control_register.address; + bit_width = perf->control_register.bit_width; + value = (u32) perf->states[state].control; dprintk("Writing 0x%08x to port 0x%04x\n", value, port); ret = acpi_processor_write_port(port, bit_width, value); if (ret) { dprintk("Invalid port width 0x%04x\n", bit_width); - retval = ret; - goto migrate_end; + return (ret); } /* @@ -177,49 +157,36 @@ acpi_processor_set_performance ( * before giving up. */ - port = data->acpi_data.status_register.address; - bit_width = data->acpi_data.status_register.bit_width; + port = perf->status_register.address; + bit_width = perf->status_register.bit_width; dprintk("Looking for 0x%08x from port 0x%04x\n", - (u32) data->acpi_data.states[state].status, port); + (u32) perf->states[state].status, port); - for (i=0; i<100; i++) { + for (i = 0; i < 100; i++) { ret = acpi_processor_read_port(port, bit_width, &value); if (ret) { dprintk("Invalid port width 0x%04x\n", bit_width); - retval = ret; - goto migrate_end; + return (ret); } - if (value == (u32) data->acpi_data.states[state].status) + if (value == (u32) perf->states[state].status) break; udelay(10); } } else { i = 0; - value = (u32) data->acpi_data.states[state].status; + value = (u32) perf->states[state].status; } - /* notify cpufreq */ - cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); - - if (unlikely(value != (u32) data->acpi_data.states[state].status)) { - unsigned int tmp = cpufreq_freqs.new; - cpufreq_freqs.new = cpufreq_freqs.old; - cpufreq_freqs.old = tmp; - cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); - cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); + if (unlikely(value != (u32) perf->states[state].status)) { printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); retval = -ENODEV; - goto migrate_end; + return (retval); } dprintk("Transition successful after %d microseconds\n", i * 10); - data->acpi_data.state = state; - - retval = 0; -migrate_end: - set_cpus_allowed(current, saved_mask); + perf->state = state; return (retval); } @@ -231,8 +198,17 @@ acpi_cpufreq_target ( unsigned int relation) { struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; + struct acpi_processor_performance *perf; + struct cpufreq_freqs freqs; + cpumask_t online_policy_cpus; + cpumask_t saved_mask; + cpumask_t set_mask; + cpumask_t covered_cpus; + unsigned int cur_state = 0; unsigned int next_state = 0; unsigned int result = 0; + unsigned int j; + unsigned int tmp; dprintk("acpi_cpufreq_setpolicy\n"); @@ -241,11 +217,95 @@ acpi_cpufreq_target ( target_freq, relation, &next_state); - if (result) + if (unlikely(result)) return (result); - result = acpi_processor_set_performance (data, policy->cpu, next_state); + perf = data->acpi_data; + cur_state = perf->state; + freqs.old = data->freq_table[cur_state].frequency; + freqs.new = data->freq_table[next_state].frequency; + +#ifdef CONFIG_HOTPLUG_CPU + /* cpufreq holds the hotplug lock, so we are safe from here on */ + cpus_and(online_policy_cpus, cpu_online_map, policy->cpus); +#else + online_policy_cpus = policy->cpus; +#endif + + for_each_cpu_mask(j, online_policy_cpus) { + freqs.cpu = j; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + } + + /* + * We need to call driver->target() on all or any CPU in + * policy->cpus, depending on policy->shared_type. + */ + saved_mask = current->cpus_allowed; + cpus_clear(covered_cpus); + for_each_cpu_mask(j, online_policy_cpus) { + /* + * Support for SMP systems. + * Make sure we are running on CPU that wants to change freq + */ + cpus_clear(set_mask); + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) + cpus_or(set_mask, set_mask, online_policy_cpus); + else + cpu_set(j, set_mask); + + set_cpus_allowed(current, set_mask); + if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { + dprintk("couldn't limit to CPUs in this domain\n"); + result = -EAGAIN; + break; + } + + result = acpi_processor_set_performance (data, j, next_state); + if (result) { + result = -EAGAIN; + break; + } + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) + break; + + cpu_set(j, covered_cpus); + } + + for_each_cpu_mask(j, online_policy_cpus) { + freqs.cpu = j; + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } + + if (unlikely(result)) { + /* + * We have failed halfway through the frequency change. + * We have sent callbacks to online_policy_cpus and + * acpi_processor_set_performance() has been called on + * coverd_cpus. Best effort undo.. + */ + + if (!cpus_empty(covered_cpus)) { + for_each_cpu_mask(j, covered_cpus) { + policy->cpu = j; + acpi_processor_set_performance (data, + j, + cur_state); + } + } + + tmp = freqs.new; + freqs.new = freqs.old; + freqs.old = tmp; + for_each_cpu_mask(j, online_policy_cpus) { + freqs.cpu = j; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } + } + + set_cpus_allowed(current, saved_mask); return (result); } @@ -271,30 +331,65 @@ acpi_cpufreq_guess_freq ( struct cpufreq_acpi_io *data, unsigned int cpu) { + struct acpi_processor_performance *perf = data->acpi_data; + if (cpu_khz) { /* search the closest match to cpu_khz */ unsigned int i; unsigned long freq; - unsigned long freqn = data->acpi_data.states[0].core_frequency * 1000; + unsigned long freqn = perf->states[0].core_frequency * 1000; - for (i=0; i < (data->acpi_data.state_count - 1); i++) { + for (i = 0; i < (perf->state_count - 1); i++) { freq = freqn; - freqn = data->acpi_data.states[i+1].core_frequency * 1000; + freqn = perf->states[i+1].core_frequency * 1000; if ((2 * cpu_khz) > (freqn + freq)) { - data->acpi_data.state = i; + perf->state = i; return (freq); } } - data->acpi_data.state = data->acpi_data.state_count - 1; + perf->state = perf->state_count - 1; return (freqn); - } else + } else { /* assume CPU is at P0... */ - data->acpi_data.state = 0; - return data->acpi_data.states[0].core_frequency * 1000; - + perf->state = 0; + return perf->states[0].core_frequency * 1000; + } } +/* + * acpi_cpufreq_early_init - initialize ACPI P-States library + * + * Initialize the ACPI P-States library (drivers/acpi/processor_perflib.c) + * in order to determine correct frequency and voltage pairings. We can + * do _PDC and _PSD and find out the processor dependency for the + * actual init that will happen later... + */ +static int acpi_cpufreq_early_init_acpi(void) +{ + struct acpi_processor_performance *data; + unsigned int i, j; + + dprintk("acpi_cpufreq_early_init\n"); + + for_each_cpu(i) { + data = kzalloc(sizeof(struct acpi_processor_performance), + GFP_KERNEL); + if (!data) { + for_each_cpu(j) { + kfree(acpi_perf_data[j]); + acpi_perf_data[j] = NULL; + } + return (-ENOMEM); + } + acpi_perf_data[i] = data; + } + + /* Do initialization in ACPI core */ + acpi_processor_preregister_performance(acpi_perf_data); + return 0; +} + static int acpi_cpufreq_cpu_init ( struct cpufreq_policy *policy) @@ -304,41 +399,51 @@ acpi_cpufreq_cpu_init ( struct cpufreq_acpi_io *data; unsigned int result = 0; struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; + struct acpi_processor_performance *perf; dprintk("acpi_cpufreq_cpu_init\n"); + if (!acpi_perf_data[cpu]) + return (-ENODEV); + data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); if (!data) return (-ENOMEM); + data->acpi_data = acpi_perf_data[cpu]; acpi_io_data[cpu] = data; - result = acpi_processor_register_performance(&data->acpi_data, cpu); + result = acpi_processor_register_performance(data->acpi_data, cpu); if (result) goto err_free; + perf = data->acpi_data; + policy->cpus = perf->shared_cpu_map; + policy->shared_type = perf->shared_type; + if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; } /* capability check */ - if (data->acpi_data.state_count <= 1) { + if (perf->state_count <= 1) { dprintk("No P-States\n"); result = -ENODEV; goto err_unreg; } - if ((data->acpi_data.control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || - (data->acpi_data.status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { + + if ((perf->control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || + (perf->status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { dprintk("Unsupported address space [%d, %d]\n", - (u32) (data->acpi_data.control_register.space_id), - (u32) (data->acpi_data.status_register.space_id)); + (u32) (perf->control_register.space_id), + (u32) (perf->status_register.space_id)); result = -ENODEV; goto err_unreg; } /* alloc freq_table */ - data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (data->acpi_data.state_count + 1), GFP_KERNEL); + data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count + 1), GFP_KERNEL); if (!data->freq_table) { result = -ENOMEM; goto err_unreg; @@ -346,9 +451,9 @@ acpi_cpufreq_cpu_init ( /* detect transition latency */ policy->cpuinfo.transition_latency = 0; - for (i=0; iacpi_data.state_count; i++) { - if ((data->acpi_data.states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) - policy->cpuinfo.transition_latency = data->acpi_data.states[i].transition_latency * 1000; + for (i=0; istate_count; i++) { + if ((perf->states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) + policy->cpuinfo.transition_latency = perf->states[i].transition_latency * 1000; } policy->governor = CPUFREQ_DEFAULT_GOVERNOR; @@ -356,11 +461,11 @@ acpi_cpufreq_cpu_init ( policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); /* table init */ - for (i=0; i<=data->acpi_data.state_count; i++) + for (i=0; i<=perf->state_count; i++) { data->freq_table[i].index = i; - if (iacpi_data.state_count) - data->freq_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000; + if (istate_count) + data->freq_table[i].frequency = perf->states[i].core_frequency * 1000; else data->freq_table[i].frequency = CPUFREQ_TABLE_END; } @@ -375,12 +480,12 @@ acpi_cpufreq_cpu_init ( printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", cpu); - for (i = 0; i < data->acpi_data.state_count; i++) + for (i = 0; i < perf->state_count; i++) dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", - (i == data->acpi_data.state?'*':' '), i, - (u32) data->acpi_data.states[i].core_frequency, - (u32) data->acpi_data.states[i].power, - (u32) data->acpi_data.states[i].transition_latency); + (i == perf->state?'*':' '), i, + (u32) perf->states[i].core_frequency, + (u32) perf->states[i].power, + (u32) perf->states[i].transition_latency); cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); @@ -395,7 +500,7 @@ acpi_cpufreq_cpu_init ( err_freqfree: kfree(data->freq_table); err_unreg: - acpi_processor_unregister_performance(&data->acpi_data, cpu); + acpi_processor_unregister_performance(perf, cpu); err_free: kfree(data); acpi_io_data[cpu] = NULL; @@ -416,7 +521,7 @@ acpi_cpufreq_cpu_exit ( if (data) { cpufreq_frequency_table_put_attr(policy->cpu); acpi_io_data[policy->cpu] = NULL; - acpi_processor_unregister_performance(&data->acpi_data, policy->cpu); + acpi_processor_unregister_performance(data->acpi_data, policy->cpu); kfree(data); } @@ -462,7 +567,10 @@ acpi_cpufreq_init (void) dprintk("acpi_cpufreq_init\n"); - result = cpufreq_register_driver(&acpi_cpufreq_driver); + result = acpi_cpufreq_early_init_acpi(); + + if (!result) + result = cpufreq_register_driver(&acpi_cpufreq_driver); return (result); } @@ -471,10 +579,15 @@ acpi_cpufreq_init (void) static void __exit acpi_cpufreq_exit (void) { + unsigned int i; dprintk("acpi_cpufreq_exit\n"); cpufreq_unregister_driver(&acpi_cpufreq_driver); + for_each_cpu(i) { + kfree(acpi_perf_data[i]); + acpi_perf_data[i] = NULL; + } return; } diff -puN arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c~git-acpi arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c --- devel/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c 2006-04-26 13:41:00.000000000 -0700 @@ -351,7 +351,36 @@ static unsigned int get_cur_freq(unsigne #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI -static struct acpi_processor_performance p; +static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; + +/* + * centrino_cpu_early_init_acpi - Do the preregistering with ACPI P-States + * library + * + * Before doing the actual init, we need to do _PSD related setup whenever + * supported by the BIOS. These are handled by this early_init routine. + */ +static int centrino_cpu_early_init_acpi(void) +{ + unsigned int i, j; + struct acpi_processor_performance *data; + + for_each_cpu(i) { + data = kzalloc(sizeof(struct acpi_processor_performance), + GFP_KERNEL); + if (!data) { + for_each_cpu(j) { + kfree(acpi_perf_data[j]); + acpi_perf_data[j] = NULL; + } + return (-ENOMEM); + } + acpi_perf_data[i] = data; + } + + acpi_processor_preregister_performance(acpi_perf_data); + return 0; +} /* * centrino_cpu_init_acpi - register with ACPI P-States library @@ -365,46 +394,51 @@ static int centrino_cpu_init_acpi(struct unsigned long cur_freq; int result = 0, i; unsigned int cpu = policy->cpu; + struct acpi_processor_performance *p; + + p = acpi_perf_data[cpu]; /* register with ACPI core */ - if (acpi_processor_register_performance(&p, cpu)) { + if (acpi_processor_register_performance(p, cpu)) { dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); return -EIO; } + policy->cpus = p->shared_cpu_map; + policy->shared_type = p->shared_type; /* verify the acpi_data */ - if (p.state_count <= 1) { + if (p->state_count <= 1) { dprintk("No P-States\n"); result = -ENODEV; goto err_unreg; } - if ((p.control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || - (p.status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { + if ((p->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || + (p->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { dprintk("Invalid control/status registers (%x - %x)\n", - p.control_register.space_id, p.status_register.space_id); + p->control_register.space_id, p->status_register.space_id); result = -EIO; goto err_unreg; } - for (i=0; istate_count; i++) { + if (p->states[i].control != p->states[i].status) { dprintk("Different control (%llu) and status values (%llu)\n", - p.states[i].control, p.states[i].status); + p->states[i].control, p->states[i].status); result = -EINVAL; goto err_unreg; } - if (!p.states[i].core_frequency) { + if (!p->states[i].core_frequency) { dprintk("Zero core frequency for state %u\n", i); result = -EINVAL; goto err_unreg; } - if (p.states[i].core_frequency > p.states[0].core_frequency) { + if (p->states[i].core_frequency > p->states[0].core_frequency) { dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i, - p.states[i].core_frequency, p.states[0].core_frequency); - p.states[i].core_frequency = 0; + p->states[i].core_frequency, p->states[0].core_frequency); + p->states[i].core_frequency = 0; continue; } } @@ -416,26 +450,26 @@ static int centrino_cpu_init_acpi(struct } centrino_model[cpu]->model_name=NULL; - centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000; + centrino_model[cpu]->max_freq = p->states[0].core_frequency * 1000; centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) * - (p.state_count + 1), GFP_KERNEL); + (p->state_count + 1), GFP_KERNEL); if (!centrino_model[cpu]->op_points) { result = -ENOMEM; goto err_kfree; } - for (i=0; iop_points[i].index = p.states[i].control; - centrino_model[cpu]->op_points[i].frequency = p.states[i].core_frequency * 1000; + for (i=0; istate_count; i++) { + centrino_model[cpu]->op_points[i].index = p->states[i].control; + centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000; dprintk("adding state %i with frequency %u and control value %04x\n", i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); } - centrino_model[cpu]->op_points[p.state_count].frequency = CPUFREQ_TABLE_END; + centrino_model[cpu]->op_points[p->state_count].frequency = CPUFREQ_TABLE_END; cur_freq = get_cur_freq(cpu); - for (i=0; istate_count; i++) { + if (!p->states[i].core_frequency) { dprintk("skipping state %u\n", i); centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID; continue; @@ -451,7 +485,7 @@ static int centrino_cpu_init_acpi(struct } if (cur_freq == centrino_model[cpu]->op_points[i].frequency) - p.state = i; + p->state = i; } /* notify BIOS that we exist */ @@ -464,12 +498,13 @@ static int centrino_cpu_init_acpi(struct err_kfree: kfree(centrino_model[cpu]); err_unreg: - acpi_processor_unregister_performance(&p, cpu); + acpi_processor_unregister_performance(p, cpu); dprintk(KERN_INFO PFX "invalid ACPI data\n"); return (result); } #else static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; } +static inline int centrino_cpu_early_init_acpi(void) { return 0; } #endif static int centrino_cpu_init(struct cpufreq_policy *policy) @@ -555,10 +590,15 @@ static int centrino_cpu_exit(struct cpuf #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI if (!centrino_model[cpu]->model_name) { - dprintk("unregistering and freeing ACPI data\n"); - acpi_processor_unregister_performance(&p, cpu); - kfree(centrino_model[cpu]->op_points); - kfree(centrino_model[cpu]); + static struct acpi_processor_performance *p; + + if (acpi_perf_data[cpu]) { + p = acpi_perf_data[cpu]; + dprintk("unregistering and freeing ACPI data\n"); + acpi_processor_unregister_performance(p, cpu); + kfree(centrino_model[cpu]->op_points); + kfree(centrino_model[cpu]); + } } #endif @@ -592,63 +632,128 @@ static int centrino_target (struct cpufr unsigned int relation) { unsigned int newstate = 0; - unsigned int msr, oldmsr, h, cpu = policy->cpu; + unsigned int msr, oldmsr = 0, h = 0, cpu = policy->cpu; struct cpufreq_freqs freqs; + cpumask_t online_policy_cpus; cpumask_t saved_mask; - int retval; + cpumask_t set_mask; + cpumask_t covered_cpus; + int retval = 0; + unsigned int j, k, first_cpu, tmp; - if (centrino_model[cpu] == NULL) + if (unlikely(centrino_model[cpu] == NULL)) return -ENODEV; - /* - * Support for SMP systems. - * Make sure we are running on the CPU that wants to change frequency - */ - saved_mask = current->cpus_allowed; - set_cpus_allowed(current, policy->cpus); - if (!cpu_isset(smp_processor_id(), policy->cpus)) { - dprintk("couldn't limit to CPUs in this domain\n"); - return(-EAGAIN); - } - - if (cpufreq_frequency_table_target(policy, centrino_model[cpu]->op_points, target_freq, - relation, &newstate)) { - retval = -EINVAL; - goto migrate_end; - } - - msr = centrino_model[cpu]->op_points[newstate].index; - rdmsr(MSR_IA32_PERF_CTL, oldmsr, h); - - if (msr == (oldmsr & 0xffff)) { - retval = 0; - dprintk("no change needed - msr was and needs to be %x\n", oldmsr); - goto migrate_end; + if (unlikely(cpufreq_frequency_table_target(policy, + centrino_model[cpu]->op_points, + target_freq, + relation, + &newstate))) { + return -EINVAL; } - freqs.cpu = cpu; - freqs.old = extract_clock(oldmsr, cpu, 0); - freqs.new = extract_clock(msr, cpu, 0); +#ifdef CONFIG_HOTPLUG_CPU + /* cpufreq holds the hotplug lock, so we are safe from here on */ + cpus_and(online_policy_cpus, cpu_online_map, policy->cpus); +#else + online_policy_cpus = policy->cpus; +#endif - dprintk("target=%dkHz old=%d new=%d msr=%04x\n", - target_freq, freqs.old, freqs.new, msr); + saved_mask = current->cpus_allowed; + first_cpu = 1; + cpus_clear(covered_cpus); + for_each_cpu_mask(j, online_policy_cpus) { + /* + * Support for SMP systems. + * Make sure we are running on CPU that wants to change freq + */ + cpus_clear(set_mask); + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) + cpus_or(set_mask, set_mask, online_policy_cpus); + else + cpu_set(j, set_mask); + + set_cpus_allowed(current, set_mask); + if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { + dprintk("couldn't limit to CPUs in this domain\n"); + retval = -EAGAIN; + if (first_cpu) { + /* We haven't started the transition yet. */ + goto migrate_end; + } + break; + } - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + msr = centrino_model[cpu]->op_points[newstate].index; - /* all but 16 LSB are "reserved", so treat them with - care */ - oldmsr &= ~0xffff; - msr &= 0xffff; - oldmsr |= msr; + if (first_cpu) { + rdmsr(MSR_IA32_PERF_CTL, oldmsr, h); + if (msr == (oldmsr & 0xffff)) { + dprintk("no change needed - msr was and needs " + "to be %x\n", oldmsr); + retval = 0; + goto migrate_end; + } + + freqs.old = extract_clock(oldmsr, cpu, 0); + freqs.new = extract_clock(msr, cpu, 0); + + dprintk("target=%dkHz old=%d new=%d msr=%04x\n", + target_freq, freqs.old, freqs.new, msr); + + for_each_cpu_mask(k, online_policy_cpus) { + freqs.cpu = k; + cpufreq_notify_transition(&freqs, + CPUFREQ_PRECHANGE); + } + + first_cpu = 0; + /* all but 16 LSB are reserved, treat them with care */ + oldmsr &= ~0xffff; + msr &= 0xffff; + oldmsr |= msr; + } - wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); + wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) + break; + + cpu_set(j, covered_cpus); + } + + for_each_cpu_mask(k, online_policy_cpus) { + freqs.cpu = k; + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } + + if (unlikely(retval)) { + /* + * We have failed halfway through the frequency change. + * We have sent callbacks to policy->cpus and + * MSRs have already been written on coverd_cpus. + * Best effort undo.. + */ + + if (!cpus_empty(covered_cpus)) { + for_each_cpu_mask(j, covered_cpus) { + set_cpus_allowed(current, cpumask_of_cpu(j)); + wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); + } + } - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + tmp = freqs.new; + freqs.new = freqs.old; + freqs.old = tmp; + for_each_cpu_mask(j, online_policy_cpus) { + freqs.cpu = j; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } + } - retval = 0; migrate_end: set_cpus_allowed(current, saved_mask); - return (retval); + return 0; } static struct freq_attr* centrino_attr[] = { @@ -690,12 +795,25 @@ static int __init centrino_init(void) if (!cpu_has(cpu, X86_FEATURE_EST)) return -ENODEV; + centrino_cpu_early_init_acpi(); + return cpufreq_register_driver(¢rino_driver); } static void __exit centrino_exit(void) { +#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI + unsigned int j; +#endif + cpufreq_unregister_driver(¢rino_driver); + +#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI + for_each_cpu(j) { + kfree(acpi_perf_data[j]); + acpi_perf_data[j] = NULL; + } +#endif } MODULE_AUTHOR ("Jeremy Fitzhardinge "); diff -puN arch/ia64/hp/common/sba_iommu.c~git-acpi arch/ia64/hp/common/sba_iommu.c --- devel/arch/ia64/hp/common/sba_iommu.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/ia64/hp/common/sba_iommu.c 2006-04-26 13:41:00.000000000 -0700 @@ -1999,7 +1999,7 @@ acpi_sba_ioc_add(struct acpi_device *dev if (!iovp_shift) iovp_shift = min(PAGE_SHIFT, 16); } - ACPI_MEM_FREE(dev_info); + kfree(dev_info); /* * default anything not caught above or specified on cmdline to 4k diff -puN arch/ia64/Kconfig~git-acpi arch/ia64/Kconfig --- devel/arch/ia64/Kconfig~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/ia64/Kconfig 2006-04-26 13:41:00.000000000 -0700 @@ -77,6 +77,7 @@ choice config IA64_GENERIC bool "generic" select ACPI + select PCI select NUMA select ACPI_NUMA help diff -puN arch/x86_64/Kconfig~git-acpi arch/x86_64/Kconfig --- devel/arch/x86_64/Kconfig~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/x86_64/Kconfig 2006-04-26 13:41:00.000000000 -0700 @@ -299,6 +299,7 @@ config X86_64_ACPI_NUMA bool "ACPI NUMA detection" depends on NUMA select ACPI + select PCI select ACPI_NUMA default y help diff -puN arch/x86_64/kernel/acpi/Makefile~git-acpi arch/x86_64/kernel/acpi/Makefile --- devel/arch/x86_64/kernel/acpi/Makefile~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/arch/x86_64/kernel/acpi/Makefile 2006-04-26 13:41:00.000000000 -0700 @@ -4,5 +4,6 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wake ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += processor.o +processor-y := ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o endif diff -L arch/x86_64/kernel/acpi/processor.c -puN arch/x86_64/kernel/acpi/processor.c~git-acpi /dev/null --- devel/arch/x86_64/kernel/acpi/processor.c +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,72 +0,0 @@ -/* - * arch/x86_64/kernel/acpi/processor.c - * - * Copyright (C) 2005 Intel Corporation - * Venkatesh Pallipadi - * - Added _PDC for platforms with Intel CPUs - */ - -#include -#include -#include -#include - -#include -#include - -static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) -{ - struct acpi_object_list *obj_list; - union acpi_object *obj; - u32 *buf; - - /* allocate and initialize pdc. It will be used later. */ - obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); - if (!obj_list) { - printk(KERN_ERR "Memory allocation error\n"); - return; - } - - obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); - if (!obj) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj_list); - return; - } - - buf = kmalloc(12, GFP_KERNEL); - if (!buf) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj); - kfree(obj_list); - return; - } - - buf[0] = ACPI_PDC_REVISION_ID; - buf[1] = 1; - buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; - - obj->type = ACPI_TYPE_BUFFER; - obj->buffer.length = 12; - obj->buffer.pointer = (u8 *) buf; - obj_list->count = 1; - obj_list->pointer = obj; - pr->pdc = obj_list; - - return; -} - -/* Initialize _PDC data based on the CPU vendor */ -void arch_acpi_processor_init_pdc(struct acpi_processor *pr) -{ - unsigned int cpu = pr->id; - struct cpuinfo_x86 *c = cpu_data + cpu; - - pr->pdc = NULL; - if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST)) - init_intel_pdc(pr, c); - - return; -} - -EXPORT_SYMBOL(arch_acpi_processor_init_pdc); diff -puN Documentation/kernel-parameters.txt~git-acpi Documentation/kernel-parameters.txt --- devel/Documentation/kernel-parameters.txt~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/Documentation/kernel-parameters.txt 2006-04-26 13:40:59.000000000 -0700 @@ -147,6 +147,9 @@ running once the system is up. acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA Format: ,... + acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS + Format: To spoof as Windows 98: ="Microsoft Windows" + acpi_osi= [HW,ACPI] empty param disables _OSI acpi_serialize [HW,ACPI] force serialization of AML methods diff -puN drivers/acpi/ac.c~git-acpi drivers/acpi/ac.c --- devel/drivers/acpi/ac.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/ac.c 2006-04-26 13:41:00.000000000 -0700 @@ -91,8 +91,7 @@ static int acpi_ac_get_state(struct acpi status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading AC Adapter state\n")); + ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); ac->state = ACPI_AC_STATUS_UNKNOWN; return_VALUE(-ENODEV); } @@ -159,9 +158,7 @@ static int acpi_ac_add_fs(struct acpi_de entry = create_proc_entry(ACPI_AC_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_AC_FILE_STATE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_ac_fops; entry->data = acpi_driver_data(device); @@ -249,8 +246,6 @@ static int acpi_ac_add(struct acpi_devic ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -282,9 +277,6 @@ static int acpi_ac_remove(struct acpi_de status = acpi_remove_notify_handler(ac->handle, ACPI_DEVICE_NOTIFY, acpi_ac_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_ac_remove_fs(device); diff -puN drivers/acpi/acpi_memhotplug.c~git-acpi drivers/acpi/acpi_memhotplug.c --- devel/drivers/acpi/acpi_memhotplug.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/acpi_memhotplug.c 2006-04-26 13:41:00.000000000 -0700 @@ -74,7 +74,7 @@ struct acpi_memory_device { unsigned short caching; /* memory cache attribute */ unsigned short write_protect; /* memory read/write attribute */ u64 start_addr; /* Memory Range start physical addr */ - u64 end_addr; /* Memory Range end physical addr */ + u64 length; /* Memory Range length */ }; static int @@ -97,12 +97,11 @@ acpi_memory_get_device_resources(struct if (ACPI_SUCCESS(status)) { if (address64.resource_type == ACPI_MEMORY_RANGE) { /* Populate the structure */ - mem_device->caching = - address64.info.mem.caching; + mem_device->caching = address64.info.mem.caching; mem_device->write_protect = address64.info.mem.write_protect; mem_device->start_addr = address64.minimum; - mem_device->end_addr = address64.maximum; + mem_device->length = address64.address_length; } } @@ -126,15 +125,14 @@ acpi_memory_get_device(acpi_handle handl status = acpi_get_parent(handle, &phandle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); return_VALUE(-EINVAL); } /* Get the parent device */ status = acpi_bus_get_device(phandle, &pdevice); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_bus_get_device\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); return_VALUE(-EINVAL); } @@ -144,7 +142,7 @@ acpi_memory_get_device(acpi_handle handl */ status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); return_VALUE(-EINVAL); } @@ -189,8 +187,7 @@ static int acpi_memory_enable_device(str /* Get the range from the _CRS */ result = acpi_memory_get_device_resources(mem_device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "\nget_device_resources failed\n")); + ACPI_ERROR((AE_INFO, "get_device_resources failed")); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -199,10 +196,9 @@ static int acpi_memory_enable_device(str * Tell the VM there is more memory here... * Note: Assume that this function returns zero on success */ - result = add_memory(mem_device->start_addr, - (mem_device->end_addr - mem_device->start_addr) + 1); + result = add_memory(mem_device->start_addr, mem_device->length); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); + ACPI_ERROR((AE_INFO, "add_memory failed")); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -228,7 +224,7 @@ static int acpi_memory_powerdown_device( "_EJ0", &arg_list, NULL); /* Return on _EJ0 failure */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n")); + ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed")); return_VALUE(-ENODEV); } @@ -249,7 +245,7 @@ static int acpi_memory_disable_device(st { int result; u64 start = mem_device->start_addr; - u64 len = mem_device->end_addr - start + 1; + u64 len = mem_device->length; ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); @@ -258,16 +254,12 @@ static int acpi_memory_disable_device(st * Note: Assume that this function returns zero on success */ result = remove_memory(start, len); - if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Hot-Remove failed.\n")); + if (result) return_VALUE(result); - } /* Power-off and eject the device */ result = acpi_memory_powerdown_device(mem_device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device Power Down failed.\n")); /* Set the status of the device to invalid */ mem_device->state = MEMORY_INVALID_STATE; return result; @@ -294,15 +286,14 @@ static void acpi_memory_device_notify(ac ACPI_DEBUG_PRINT((ACPI_DB_INFO, "\nReceived DEVICE CHECK notification for device\n")); if (acpi_memory_get_device(handle, &mem_device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in finding driver data\n")); + ACPI_ERROR((AE_INFO, "Cannot find driver data")); return_VOID; } if (!acpi_memory_check_device(mem_device)) { if (acpi_memory_enable_device(mem_device)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_enable_device\n")); + ACPI_ERROR((AE_INFO, + "Cannot enable memory device")); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -310,14 +301,12 @@ static void acpi_memory_device_notify(ac "\nReceived EJECT REQUEST notification for device\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device doesn't exist\n")); + ACPI_ERROR((AE_INFO, "Device doesn't exist")); break; } mem_device = acpi_driver_data(device); if (!mem_device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver Data is NULL\n")); + ACPI_ERROR((AE_INFO, "Driver Data is NULL")); break; } @@ -328,8 +317,8 @@ static void acpi_memory_device_notify(ac * with generic sysfs driver */ if (acpi_memory_disable_device(mem_device)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_disable_device\n")); + ACPI_ERROR((AE_INFO, + "Disable memory device\n")); /* * TBD: Invoke acpi_bus_remove to cleanup data structures */ @@ -407,7 +396,7 @@ static acpi_status is_memory_device(acpi status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status)) - return_ACPI_STATUS(AE_ERROR); + return_ACPI_STATUS(status); info = buffer.pointer; if (!(info->valid & ACPI_VALID_HID)) { @@ -433,18 +422,15 @@ acpi_memory_register_notify_handler(acpi ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler"); status = is_memory_device(handle); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)){ + ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); return_ACPI_STATUS(AE_OK); /* continue */ + } status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify, NULL); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); - return_ACPI_STATUS(AE_OK); /* continue */ - } - - return_ACPI_STATUS(status); + /* continue */ + return_ACPI_STATUS(AE_OK); } static acpi_status @@ -456,19 +442,16 @@ acpi_memory_deregister_notify_handler(ac ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler"); status = is_memory_device(handle); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)){ + ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); return_ACPI_STATUS(AE_OK); /* continue */ + } status = acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - return_ACPI_STATUS(AE_OK); /* continue */ - } - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); /* continue */ } static int __init acpi_memory_device_init(void) @@ -489,7 +472,7 @@ static int __init acpi_memory_device_ini NULL, NULL); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); + ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); return_VALUE(-ENODEV); } @@ -513,7 +496,7 @@ static void __exit acpi_memory_device_ex NULL, NULL); if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); + ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); diff -puN drivers/acpi/asus_acpi.c~git-acpi drivers/acpi/asus_acpi.c --- devel/drivers/acpi/asus_acpi.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/asus_acpi.c 2006-04-26 13:41:00.000000000 -0700 @@ -817,7 +817,7 @@ typedef int (proc_writefunc) (struct fil unsigned long count, void *data); static int -__init asus_proc_add(char *name, proc_writefunc * writefunc, +asus_proc_add(char *name, proc_writefunc * writefunc, proc_readfunc * readfunc, mode_t mode, struct acpi_device *device) { @@ -836,7 +836,7 @@ __init asus_proc_add(char *name, proc_wr return 0; } -static int __init asus_hotk_add_fs(struct acpi_device *device) +static int asus_hotk_add_fs(struct acpi_device *device) { struct proc_dir_entry *proc; mode_t mode; @@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle * This function is used to initialize the hotk with right values. In this * method, we can make all the detection we want, and modify the hotk struct */ -static int __init asus_hotk_get_info(void) +static int asus_hotk_get_info(void) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -1101,7 +1101,7 @@ static int __init asus_hotk_get_info(voi return AE_OK; } -static int __init asus_hotk_check(void) +static int asus_hotk_check(void) { int result = 0; @@ -1119,7 +1119,9 @@ static int __init asus_hotk_check(void) return result; } -static int __init asus_hotk_add(struct acpi_device *device) +static int asus_hotk_found; + +static int asus_hotk_add(struct acpi_device *device) { acpi_status status = AE_OK; int result; @@ -1180,6 +1182,8 @@ static int __init asus_hotk_add(struct a } } + asus_hotk_found = 1; + end: if (result) { kfree(hotk); @@ -1226,7 +1230,19 @@ static int __init asus_acpi_init(void) asus_proc_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&asus_hotk_driver); - if (result < 1) { + if (result < 0) { + remove_proc_entry(PROC_ASUS, acpi_root_dir); + return -ENODEV; + } + + /* + * This is a bit of a kludge. We only want this module loaded + * for ASUS systems, but there's currently no way to probe the + * ACPI namespace for ASUS HIDs. So we just return failure if + * we didn't find one, which will cause the module to be + * unloaded. + */ + if (!asus_hotk_found) { acpi_bus_unregister_driver(&asus_hotk_driver); remove_proc_entry(PROC_ASUS, acpi_root_dir); return -ENODEV; diff -puN drivers/acpi/battery.c~git-acpi drivers/acpi/battery.c --- devel/drivers/acpi/battery.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/battery.c 2006-04-26 13:41:00.000000000 -0700 @@ -141,7 +141,7 @@ acpi_battery_get_info(struct acpi_batter status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); return_VALUE(-ENODEV); } @@ -151,7 +151,7 @@ acpi_battery_get_info(struct acpi_batter status = acpi_extract_package(package, &format, &data); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); result = -ENODEV; goto end; } @@ -165,7 +165,7 @@ acpi_battery_get_info(struct acpi_batter status = acpi_extract_package(package, &format, &data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); kfree(data.pointer); result = -ENODEV; goto end; @@ -202,7 +202,7 @@ acpi_battery_get_status(struct acpi_batt status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); return_VALUE(-ENODEV); } @@ -212,7 +212,7 @@ acpi_battery_get_status(struct acpi_batt status = acpi_extract_package(package, &format, &data); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); result = -ENODEV; goto end; } @@ -226,7 +226,7 @@ acpi_battery_get_status(struct acpi_batt status = acpi_extract_package(package, &format, &data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); kfree(data.pointer); result = -ENODEV; goto end; @@ -458,8 +458,6 @@ static int acpi_battery_read_state(struc if ((bst->state & 0x01) && (bst->state & 0x02)) { seq_printf(seq, "charging state: charging/discharging\n"); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Battery Charging and Discharging?\n")); } else if (bst->state & 0x01) seq_printf(seq, "charging state: discharging\n"); else if (bst->state & 0x02) @@ -609,9 +607,7 @@ static int acpi_battery_add_fs(struct ac entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_INFO)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_battery_info_ops; entry->data = acpi_driver_data(device); @@ -622,9 +618,7 @@ static int acpi_battery_add_fs(struct ac entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_STATUS)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_battery_state_ops; entry->data = acpi_driver_data(device); @@ -636,9 +630,7 @@ static int acpi_battery_add_fs(struct ac S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_ALARM)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_battery_alarm_ops; entry->data = acpi_driver_data(device); @@ -732,8 +724,6 @@ static int acpi_battery_add(struct acpi_ ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -766,9 +756,6 @@ static int acpi_battery_remove(struct ac status = acpi_remove_notify_handler(battery->handle, ACPI_DEVICE_NOTIFY, acpi_battery_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_battery_remove_fs(device); diff -puN drivers/acpi/bus.c~git-acpi drivers/acpi/bus.c --- devel/drivers/acpi/bus.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/bus.c 2006-04-26 13:41:00.000000000 -0700 @@ -69,8 +69,7 @@ int acpi_bus_get_device(acpi_handle hand status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device); if (ACPI_FAILURE(status) || !*device) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n", - handle)); + ACPI_EXCEPTION((AE_INFO, status, "No context for object [%p]", handle)); return_VALUE(-ENODEV); } @@ -197,8 +196,7 @@ int acpi_bus_set_power(acpi_handle handl /* Make sure this is a valid target state */ if (!device->flags.power_manageable) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Device is not power manageable\n")); + ACPI_INFO((AE_INFO, "Device is not power manageable")); return_VALUE(-ENODEV); } /* @@ -213,13 +211,13 @@ int acpi_bus_set_power(acpi_handle handl return_VALUE(0); } if (!device->power.states[state].flags.valid) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", - state)); + ACPI_WARNING((AE_INFO, "Device does not support D%d", state)); return_VALUE(-ENODEV); } if (device->parent && (state < device->parent->power.state)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Cannot set device to a higher-powered state than parent\n")); + ACPI_WARNING((AE_INFO, + "Cannot set device to a higher-powered" + " state than parent")); return_VALUE(-ENODEV); } @@ -262,9 +260,9 @@ int acpi_bus_set_power(acpi_handle handl end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + ACPI_WARNING((AE_INFO, + "Transitioning device [%s] to D%d", + device->pnp.bus_id, state)); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n", @@ -579,7 +577,7 @@ static int __init acpi_bus_init_irq(void status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PIC\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); return_VALUE(-ENODEV); } diff -puN drivers/acpi/button.c~git-acpi drivers/acpi/button.c --- devel/drivers/acpi/button.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/button.c 2006-04-26 13:41:00.000000000 -0700 @@ -207,9 +207,7 @@ static int acpi_button_add_fs(struct acp entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_button_info_fops; entry->data = acpi_driver_data(device); @@ -221,9 +219,7 @@ static int acpi_button_add_fs(struct acp entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + return -ENODEV; else { entry->proc_fops = &acpi_button_state_fops; entry->data = acpi_driver_data(device); @@ -349,8 +345,8 @@ static int acpi_button_add(struct acpi_d sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n", - acpi_device_hid(device))); + ACPI_ERROR((AE_INFO, "Unsupported hid [%s]", + acpi_device_hid(device))); result = -ENODEV; goto end; } @@ -381,8 +377,6 @@ static int acpi_button_add(struct acpi_d } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -440,10 +434,6 @@ static int acpi_button_remove(struct acp break; } - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - acpi_button_remove_fs(device); kfree(button); diff -puN drivers/acpi/container.c~git-acpi drivers/acpi/container.c --- devel/drivers/acpi/container.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/container.c 2006-04-26 13:41:00.000000000 -0700 @@ -94,7 +94,7 @@ static int acpi_container_add(struct acp ACPI_FUNCTION_TRACE("acpi_container_add"); if (!device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "device is NULL\n")); + ACPI_ERROR((AE_INFO, "device is NULL")); return_VALUE(-EINVAL); } diff -puN drivers/acpi/debug.c~git-acpi drivers/acpi/debug.c --- devel/drivers/acpi/debug.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/debug.c 2006-04-26 13:41:00.000000000 -0700 @@ -216,12 +216,9 @@ static int __init acpi_debug_init(void) return_VALUE(error); Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); - remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); - error = -EFAULT; + error = -ENODEV; goto Done; } diff -puN drivers/acpi/dispatcher/dsfield.c~git-acpi drivers/acpi/dispatcher/dsfield.c --- devel/drivers/acpi/dispatcher/dsfield.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dsfield.c 2006-04-26 13:41:00.000000000 -0700 @@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_pa * Walk the list of entries in the field_list */ while (arg) { + /* Ignore OFFSET and ACCESSAS terms here */ if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { diff -puN drivers/acpi/dispatcher/dsmethod.c~git-acpi drivers/acpi/dispatcher/dsmethod.c --- devel/drivers/acpi/dispatcher/dsmethod.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dsmethod.c 2006-04-26 13:41:00.000000000 -0700 @@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, /* Invoke the global exception handler */ if (acpi_gbl_exception_handler) { + /* Exit the interpreter, allow handler to execute methods */ acpi_ex_exit_interpreter(); @@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, } #ifdef ACPI_DISASSEMBLER if (ACPI_FAILURE(status)) { + /* Display method locals/args if disassembler is present */ acpi_dm_dump_method_info(status, walk_state, walk_state->op); @@ -249,6 +251,7 @@ acpi_ds_call_control_method(struct acpi_ } if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { + /* 1) Parse: Create a new walk state for the preempting walk */ next_walk_state = @@ -378,9 +381,11 @@ acpi_ds_restart_control_method(struct ac /* Did the called method return a value? */ if (return_desc) { + /* Are we actually going to use the return value? */ if (walk_state->return_used) { + /* Save the return value from the previous method */ status = acpi_ds_result_push(return_desc, walk_state); diff -puN drivers/acpi/dispatcher/dsmthdat.c~git-acpi drivers/acpi/dispatcher/dsmthdat.c --- devel/drivers/acpi/dispatcher/dsmthdat.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dsmthdat.c 2006-04-26 13:41:00.000000000 -0700 @@ -81,7 +81,7 @@ acpi_ds_method_data_get_type(u16 opcode, * special data types. * * NOTES: walk_state fields are initialized to zero by the - * ACPI_MEM_CALLOCATE(). + * ACPI_ALLOCATE_ZEROED(). * * A pseudo-Namespace Node is assigned to each argument and local * so that ref_of() can return a pointer to the Node. @@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode, object = acpi_ns_get_attached_object(node); if (!object) { + /* Uninitialized local/arg, return TYPE_ANY */ return_VALUE(ACPI_TYPE_ANY); diff -puN drivers/acpi/dispatcher/dsobject.c~git-acpi drivers/acpi/dispatcher/dsobject.c --- devel/drivers/acpi/dispatcher/dsobject.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dsobject.c 2006-04-26 13:41:00.000000000 -0700 @@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acp common. node))); if (ACPI_FAILURE(status)) { + /* Check if we are resolving a named reference within a package */ if ((status == AE_NOT_FOUND) @@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct */ obj_desc = *obj_desc_ptr; if (!obj_desc) { + /* Create a new buffer object */ obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); @@ -243,7 +245,7 @@ acpi_ds_build_internal_buffer_obj(struct "Buffer defined with zero length in AML, creating\n")); } else { obj_desc->buffer.pointer = - ACPI_MEM_CALLOCATE(obj_desc->buffer.length); + ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length); if (!obj_desc->buffer.pointer) { acpi_ut_delete_object_desc(obj_desc); return_ACPI_STATUS(AE_NO_MEMORY); @@ -339,9 +341,10 @@ acpi_ds_build_internal_package_obj(struc * individual objects). Add an extra pointer slot so * that the list is always null terminated. */ - obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> - package.count + - 1) * sizeof(void *)); + obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) + obj_desc->package. + count + + 1) * sizeof(void *)); if (!obj_desc->package.elements) { acpi_ut_delete_object_desc(obj_desc); @@ -355,6 +358,7 @@ acpi_ds_build_internal_package_obj(struc arg = arg->common.next; for (i = 0; arg; i++) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { + /* Object (package or buffer) is already built */ obj_desc->package.elements[i] = @@ -408,6 +412,7 @@ acpi_ds_create_node(struct acpi_walk_sta } if (!op->common.value.arg) { + /* No arguments, there is nothing to do */ return_ACPI_STATUS(AE_OK); @@ -469,6 +474,7 @@ acpi_ds_init_object_from_op(struct acpi_ obj_desc = *ret_obj_desc; op_info = acpi_ps_get_opcode_info(opcode); if (op_info->class == AML_CLASS_UNKNOWN) { + /* Unknown opcode */ return_ACPI_STATUS(AE_TYPE); @@ -626,6 +632,7 @@ acpi_ds_init_object_from_op(struct acpi_ default: /* Other literals, etc.. */ if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { + /* Node was saved in Op */ obj_desc->reference.node = op->common.node; diff -puN drivers/acpi/dispatcher/dsopcode.c~git-acpi drivers/acpi/dispatcher/dsopcode.c --- devel/drivers/acpi/dispatcher/dsopcode.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dsopcode.c 2006-04-26 13:41:00.000000000 -0700 @@ -640,6 +640,7 @@ acpi_ds_eval_buffer_field_operands(struc /* Initialize the Buffer Field */ if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { + /* NOTE: Slightly different operands for this opcode */ status = @@ -984,6 +985,7 @@ acpi_ds_exec_end_control_op(struct acpi_ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); if (walk_state->control_state->common.value) { + /* Predicate was true, go back and evaluate it again! */ status = AE_CTRL_PENDING; @@ -1014,6 +1016,7 @@ acpi_ds_exec_end_control_op(struct acpi_ * has been bubbled up the tree */ if (op->common.value.arg) { + /* Since we have a real Return(), delete any implicit return */ acpi_ds_clear_implicit_return(walk_state); @@ -1047,6 +1050,7 @@ acpi_ds_exec_end_control_op(struct acpi_ walk_state->return_desc = walk_state->operands[0]; } else if ((walk_state->results) && (walk_state->results->results.num_results > 0)) { + /* Since we have a real Return(), delete any implicit return */ acpi_ds_clear_implicit_return(walk_state); diff -puN drivers/acpi/dispatcher/dsutils.c~git-acpi drivers/acpi/dispatcher/dsutils.c --- devel/drivers/acpi/dispatcher/dsutils.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dsutils.c 2006-04-26 13:41:00.000000000 -0700 @@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_ */ if ((!op->common.parent) || (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { + /* No parent, the return value cannot possibly be used */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, @@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union } if (!acpi_ds_is_result_used(op, walk_state)) { + /* Must pop the result stack (obj_desc should be equal to result_obj) */ status = acpi_ds_result_pop(&obj_desc, walk_state); @@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_ */ if ((walk_state->deferred_node) && (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) - && (arg_index != 0)) { + && (arg_index == + (u32) ((walk_state->opcode == + AML_CREATE_FIELD_OP) ? 3 : 2))) { obj_desc = ACPI_CAST_PTR(union acpi_operand_object, walk_state->deferred_node); @@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_ && (parent_op->common.aml_opcode != AML_REGION_OP) && (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) { + /* Enter name into namespace if not found */ interpreter_mode = ACPI_IMODE_LOAD_PASS2; @@ -572,7 +577,7 @@ acpi_ds_create_operand(struct acpi_walk_ /* Free the namestring created above */ - ACPI_MEM_FREE(name_string); + ACPI_FREE(name_string); /* Check status from the lookup */ diff -puN drivers/acpi/dispatcher/dswexec.c~git-acpi drivers/acpi/dispatcher/dswexec.c --- devel/drivers/acpi/dispatcher/dswexec.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dswexec.c 2006-04-26 13:41:00.000000000 -0700 @@ -409,6 +409,7 @@ acpi_status acpi_ds_exec_end_op(struct a * being the object_type and size_of operators. */ if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { + /* Resolve all operands */ status = acpi_ex_resolve_operands(walk_state->opcode, @@ -548,6 +549,7 @@ acpi_status acpi_ds_exec_end_op(struct a */ status = acpi_ds_resolve_operands(walk_state); if (ACPI_FAILURE(status)) { + /* On error, clear all resolved operands */ acpi_ds_clear_operands(walk_state); @@ -722,6 +724,7 @@ acpi_status acpi_ds_exec_end_op(struct a cleanup: if (walk_state->result_obj) { + /* Break to debugger to display result */ ACPI_DEBUGGER_EXEC(acpi_db_display_result_object diff -puN drivers/acpi/dispatcher/dswload.c~git-acpi drivers/acpi/dispatcher/dswload.c --- devel/drivers/acpi/dispatcher/dswload.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dswload.c 2006-04-26 13:41:00.000000000 -0700 @@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_ */ if (walk_state->deferred_node) { + /* This name is already in the namespace, get the node */ node = walk_state->deferred_node; @@ -311,6 +312,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_ /* Common exit */ if (!op) { + /* Create a new op */ op = acpi_ps_alloc_op(walk_state->opcode); @@ -413,6 +415,7 @@ acpi_status acpi_ds_load1_end_op(struct #endif if (op->common.aml_opcode == AML_NAME_OP) { + /* For Name opcode, get the object type from the argument */ if (op->common.value.arg) { @@ -521,6 +524,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_ if ((walk_state->control_state) && (walk_state->control_state->common.state == ACPI_CONTROL_CONDITIONAL_EXECUTING)) { + /* We are executing a while loop outside of a method */ status = acpi_ds_exec_begin_op(walk_state, out_op); @@ -554,10 +558,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_ /* Get the name we are going to enter or lookup in the namespace */ if (walk_state->opcode == AML_INT_NAMEPATH_OP) { + /* For Namepath op, get the path string */ buffer_ptr = op->common.value.string; if (!buffer_ptr) { + /* No name, just exit */ return_ACPI_STATUS(AE_OK); @@ -680,6 +686,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_ /* All other opcodes */ if (op && op->common.node) { + /* This op/node was previously entered into the namespace */ node = op->common.node; @@ -705,6 +712,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_ * Note: Name may already exist if we are executing a deferred opcode. */ if (walk_state->deferred_node) { + /* This name is already in the namespace, get the node */ node = walk_state->deferred_node; @@ -727,6 +735,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_ } if (!op) { + /* Create a new op */ op = acpi_ps_alloc_op(walk_state->opcode); @@ -1104,7 +1113,6 @@ acpi_status acpi_ds_load2_end_op(struct ACPI_NS_DONT_OPEN_SCOPE, walk_state, &(new_node)); if (ACPI_SUCCESS(status)) { - /* * Make sure that what we found is indeed a method * We didn't search for a method on purpose, to see if the name diff -puN drivers/acpi/dispatcher/dswscope.c~git-acpi drivers/acpi/dispatcher/dswscope.c --- devel/drivers/acpi/dispatcher/dswscope.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dswscope.c 2006-04-26 13:41:00.000000000 -0700 @@ -66,6 +66,7 @@ void acpi_ds_scope_stack_clear(struct ac ACPI_FUNCTION_NAME("ds_scope_stack_clear"); while (walk_state->scope_info) { + /* Pop a scope off the stack */ scope_info = walk_state->scope_info; @@ -105,6 +106,7 @@ acpi_ds_scope_stack_push(struct acpi_nam ACPI_FUNCTION_TRACE("ds_scope_stack_push"); if (!node) { + /* Invalid scope */ ACPI_ERROR((AE_INFO, "Null scope parameter")); diff -puN drivers/acpi/dispatcher/dswstate.c~git-acpi drivers/acpi/dispatcher/dswstate.c --- devel/drivers/acpi/dispatcher/dswstate.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/dispatcher/dswstate.c 2006-04-26 13:41:00.000000000 -0700 @@ -66,7 +66,6 @@ void *acpi_ds_obj_stack_get_value(u32 in #endif #ifdef ACPI_FUTURE_USAGE - /******************************************************************************* * * FUNCTION: acpi_ds_result_remove @@ -128,7 +127,6 @@ acpi_ds_result_remove(union acpi_operand return (AE_OK); } - #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -170,6 +168,7 @@ acpi_ds_result_pop(union acpi_operand_ob state->results.num_results--; for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { + /* Check for a valid result object */ if (state->results.obj_desc[index - 1]) { @@ -448,6 +447,7 @@ acpi_ds_obj_stack_pop(u32 pop_count, str ACPI_FUNCTION_NAME("ds_obj_stack_pop"); for (i = 0; i < pop_count; i++) { + /* Check for stack underflow */ if (walk_state->num_operands == 0) { @@ -494,6 +494,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); for (i = 0; i < pop_count; i++) { + /* Check for stack underflow */ if (walk_state->num_operands == 0) { @@ -598,6 +599,7 @@ struct acpi_walk_state *acpi_ds_pop_walk walk_state = thread->walk_state_list; if (walk_state) { + /* Next walk state becomes the current walk state */ thread->walk_state_list = walk_state->next; @@ -641,7 +643,7 @@ struct acpi_walk_state *acpi_ds_create_w ACPI_FUNCTION_TRACE("ds_create_walk_state"); - walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); + walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state)); if (!walk_state) { return_PTR(NULL); } @@ -664,7 +666,7 @@ struct acpi_walk_state *acpi_ds_create_w status = acpi_ds_result_stack_push(walk_state); if (ACPI_FAILURE(status)) { - ACPI_MEM_FREE(walk_state); + ACPI_FREE(walk_state); return_PTR(NULL); } @@ -778,6 +780,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_s } if (parser_state->start_node) { + /* Push start scope on scope stack and make it current */ status = @@ -854,7 +857,7 @@ void acpi_ds_delete_walk_state(struct ac acpi_ut_delete_generic_state(state); } - ACPI_MEM_FREE(walk_state); + ACPI_FREE(walk_state); return_VOID; } diff -puN drivers/acpi/ec.c~git-acpi drivers/acpi/ec.c --- devel/drivers/acpi/ec.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/ec.c 2006-04-26 13:41:00.000000000 -0700 @@ -279,7 +279,7 @@ int acpi_ec_enter_burst_mode(union acpi_ atomic_set(&ec->intr.leaving_burst, 0); return_VALUE(0); end: - printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n"); + ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); return_VALUE(-1); } @@ -300,7 +300,7 @@ int acpi_ec_leave_burst_mode(union acpi_ atomic_set(&ec->intr.leaving_burst, 1); return_VALUE(0); end: - printk(KERN_WARNING PREFIX "leave burst_mode:error\n"); + ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); return_VALUE(-1); } #endif /* ACPI_FUTURE_USAGE */ @@ -957,9 +957,7 @@ static int acpi_ec_add_fs(struct acpi_de entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to create '%s' fs entry\n", - ACPI_EC_FILE_INFO)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_ec_info_ops; entry->data = acpi_driver_data(device); @@ -991,7 +989,6 @@ static int acpi_ec_poll_add(struct acpi_ int result = 0; acpi_status status = AE_OK; union acpi_ec *ec = NULL; - unsigned long uid; ACPI_FUNCTION_TRACE("acpi_ec_add"); @@ -1014,10 +1011,9 @@ static int acpi_ec_poll_add(struct acpi_ acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); - /* If our UID matches the UID for the ECDT-enumerated EC, - we now have the *real* EC info, so kill the makeshift one. */ - acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); - if (ec_ecdt && ec_ecdt->common.uid == uid) { + /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: + http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ + if (ec_ecdt) { acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); @@ -1034,8 +1030,7 @@ static int acpi_ec_poll_add(struct acpi_ acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit")); result = -ENODEV; goto end; } @@ -1062,7 +1057,6 @@ static int acpi_ec_intr_add(struct acpi_ int result = 0; acpi_status status = AE_OK; union acpi_ec *ec = NULL; - unsigned long uid; ACPI_FUNCTION_TRACE("acpi_ec_add"); @@ -1088,10 +1082,9 @@ static int acpi_ec_intr_add(struct acpi_ acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); - /* If our UID matches the UID for the ECDT-enumerated EC, - we now have the *real* EC info, so kill the makeshift one. */ - acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); - if (ec_ecdt && ec_ecdt->common.uid == uid) { + /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: + http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ + if (ec_ecdt) { acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); @@ -1108,8 +1101,7 @@ static int acpi_ec_intr_add(struct acpi_ acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + ACPI_ERROR((AE_INFO, "Obtaining GPE bit assignment")); result = -ENODEV; goto end; } @@ -1203,8 +1195,7 @@ static int acpi_ec_start(struct acpi_dev acpi_ec_io_ports, ec); if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting I/O port addresses")); + ACPI_ERROR((AE_INFO, "Error getting I/O port addresses")); return_VALUE(-ENODEV); } diff -puN drivers/acpi/event.c~git-acpi drivers/acpi/event.c --- devel/drivers/acpi/event.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/event.c 2006-04-26 13:41:00.000000000 -0700 @@ -122,10 +122,7 @@ static int __init acpi_event_init(void) if (entry) entry->proc_fops = &acpi_system_event_ops; else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", - "event")); - error = -EFAULT; + error = -ENODEV; } return_VALUE(error); } diff -puN drivers/acpi/events/evevent.c~git-acpi drivers/acpi/events/evevent.c --- devel/drivers/acpi/events/evevent.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evevent.c 2006-04-26 13:41:00.000000000 -0700 @@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void) * Check for all possible Fixed Events and dispatch those that are active */ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { + /* Both the status and enable bits must be on for this event */ if ((fixed_status & acpi_gbl_fixed_event_info[i]. status_bit_mask) && (fixed_enable & acpi_gbl_fixed_event_info[i]. enable_bit_mask)) { + /* Found an active (signalled) event */ int_status |= acpi_ev_fixed_event_dispatch((u32) i); diff -puN drivers/acpi/events/evgpeblk.c~git-acpi drivers/acpi/events/evgpeblk.c --- devel/drivers/acpi/events/evgpeblk.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evgpeblk.c 2006-04-26 13:41:00.000000000 -0700 @@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_G gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; while (gpe_xrupt_info) { + /* Walk all Gpe Blocks attached to this interrupt level */ gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { + /* One callback per GPE block */ status = gpe_walk_callback(gpe_xrupt_info, gpe_block); @@ -195,6 +197,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_ /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { + /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { @@ -204,7 +207,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_ if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { - ACPI_MEM_FREE(gpe_event_info->dispatch.handler); + ACPI_FREE(gpe_event_info->dispatch.handler); gpe_event_info->dispatch.handler = NULL; gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; @@ -289,6 +292,7 @@ acpi_ev_save_method_info(acpi_handle obj gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); if (gpe_number == ACPI_UINT32_MAX) { + /* Conversion failed; invalid method, just ignore it */ ACPI_ERROR((AE_INFO, @@ -371,6 +375,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle ob status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, ACPI_BTYPE_PACKAGE, &pkg_desc); if (ACPI_FAILURE(status)) { + /* Ignore all errors from _PRW, we don't want to abort the subsystem */ return_ACPI_STATUS(AE_OK); @@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle ob obj_desc = pkg_desc->package.elements[0]; if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { + /* Use FADT-defined GPE device (from definition of _PRW) */ target_gpe_device = acpi_gbl_fadt_gpe_device; @@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle ob gpe_number = (u32) obj_desc->integer.value; } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { + /* Package contains a GPE reference and GPE number within a GPE block */ if ((obj_desc->package.count < 2) || @@ -497,7 +504,7 @@ static struct acpi_gpe_xrupt_info *acpi_ /* Not found, must allocate a new xrupt descriptor */ - gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); + gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info)); if (!gpe_xrupt) { return_PTR(NULL); } @@ -588,7 +595,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe /* Free the block */ - ACPI_MEM_FREE(gpe_xrupt); + ACPI_FREE(gpe_xrupt); return_ACPI_STATUS(AE_OK); } @@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(str status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); if (!gpe_block->previous && !gpe_block->next) { + /* This is the last gpe_block on this interrupt */ status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); @@ -704,9 +712,9 @@ acpi_status acpi_ev_delete_gpe_block(str /* Free the gpe_block */ - ACPI_MEM_FREE(gpe_block->register_info); - ACPI_MEM_FREE(gpe_block->event_info); - ACPI_MEM_FREE(gpe_block); + ACPI_FREE(gpe_block->register_info); + ACPI_FREE(gpe_block->event_info); + ACPI_FREE(gpe_block); unlock_and_exit: status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); @@ -740,10 +748,10 @@ acpi_ev_create_gpe_info_blocks(struct ac /* Allocate the GPE register information block */ - gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> - register_count * - sizeof(struct - acpi_gpe_register_info)); + gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block-> + register_count * + sizeof(struct + acpi_gpe_register_info)); if (!gpe_register_info) { ACPI_ERROR((AE_INFO, "Could not allocate the gpe_register_info table")); @@ -754,10 +762,11 @@ acpi_ev_create_gpe_info_blocks(struct ac * Allocate the GPE event_info block. There are eight distinct GPEs * per register. Initialization to zeros is sufficient. */ - gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> - register_count * - ACPI_GPE_REGISTER_WIDTH) * - sizeof(struct acpi_gpe_event_info)); + gpe_event_info = ACPI_ALLOCATE_ZEROED(((acpi_size) gpe_block-> + register_count * + ACPI_GPE_REGISTER_WIDTH) * + sizeof(struct + acpi_gpe_event_info)); if (!gpe_event_info) { ACPI_ERROR((AE_INFO, "Could not allocate the gpe_event_info table")); @@ -780,6 +789,7 @@ acpi_ev_create_gpe_info_blocks(struct ac this_event = gpe_event_info; for (i = 0; i < gpe_block->register_count; i++) { + /* Init the register_info for this GPE register (8 GPEs) */ this_register->base_gpe_number = @@ -839,10 +849,10 @@ acpi_ev_create_gpe_info_blocks(struct ac error_exit: if (gpe_register_info) { - ACPI_MEM_FREE(gpe_register_info); + ACPI_FREE(gpe_register_info); } if (gpe_event_info) { - ACPI_MEM_FREE(gpe_event_info); + ACPI_FREE(gpe_event_info); } return_ACPI_STATUS(status); @@ -886,7 +896,7 @@ acpi_ev_create_gpe_block(struct acpi_nam /* Allocate a new GPE block */ - gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); + gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info)); if (!gpe_block) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -906,7 +916,7 @@ acpi_ev_create_gpe_block(struct acpi_nam */ status = acpi_ev_create_gpe_info_blocks(gpe_block); if (ACPI_FAILURE(status)) { - ACPI_MEM_FREE(gpe_block); + ACPI_FREE(gpe_block); return_ACPI_STATUS(status); } @@ -914,7 +924,7 @@ acpi_ev_create_gpe_block(struct acpi_nam status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); if (ACPI_FAILURE(status)) { - ACPI_MEM_FREE(gpe_block); + ACPI_FREE(gpe_block); return_ACPI_STATUS(status); } @@ -1013,6 +1023,7 @@ acpi_ev_initialize_gpe_block(struct acpi for (i = 0; i < gpe_block->register_count; i++) { for (j = 0; j < 8; j++) { + /* Get the info block for this particular GPE */ gpe_event_info = @@ -1099,6 +1110,7 @@ acpi_status acpi_ev_gpe_initialize(void) * particular block is not supported. */ if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { + /* GPE block 0 exists (has both length and address > 0) */ register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); @@ -1121,6 +1133,7 @@ acpi_status acpi_ev_gpe_initialize(void) } if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { + /* GPE block 1 exists (has both length and address > 0) */ register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); @@ -1168,6 +1181,7 @@ acpi_status acpi_ev_gpe_initialize(void) /* Exit if there are no GPE registers */ if ((register_count0 + register_count1) == 0) { + /* GPEs are not required by ACPI, this is OK */ ACPI_DEBUG_PRINT((ACPI_DB_INIT, diff -puN drivers/acpi/events/evgpe.c~git-acpi drivers/acpi/events/evgpe.c --- devel/drivers/acpi/events/evgpe.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evgpe.c 2006-04-26 13:41:00.000000000 -0700 @@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); if (write_to_hardware) { + /* Clear the GPE (of stale events), then enable it */ status = acpi_hw_clear_gpe(gpe_event_info); @@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_ /* A NULL gpe_block means use the FADT-defined GPE block(s) */ if (!gpe_device) { + /* Examine GPE Block 0 and 1 (These blocks are permanent) */ for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { @@ -402,6 +404,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_x * Find all currently active GP events. */ for (i = 0; i < gpe_block->register_count; i++) { + /* Get the next status/enable pair */ gpe_register_info = &gpe_block->register_info[i]; @@ -437,6 +440,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_x enabled_status_byte = (u8) (status_reg & enable_reg); if (!enabled_status_byte) { + /* No active GPEs in this register, move on */ continue; @@ -445,6 +449,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_x /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { + /* Examine one GPE bit */ if (enabled_status_byte & diff -puN drivers/acpi/events/evmisc.c~git-acpi drivers/acpi/events/evmisc.c --- devel/drivers/acpi/events/evmisc.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evmisc.c 2006-04-26 13:41:00.000000000 -0700 @@ -150,6 +150,7 @@ acpi_ev_queue_notify_request(struct acpi obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { + /* We have the notify object, Get the right handler */ switch (node->type) { @@ -240,6 +241,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_no * to the device. */ if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { + /* Global system notification handler */ if (acpi_gbl_system_notify.handler) { @@ -297,6 +299,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_gl /* Signal threads that are waiting for the lock */ if (acpi_gbl_global_lock_thread_count) { + /* Send sufficient units to the semaphore */ status = @@ -335,6 +338,7 @@ static u32 acpi_ev_global_lock_handler(v */ ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); if (acquired) { + /* Got the lock, now wake all threads waiting for it */ acpi_gbl_global_lock_acquired = TRUE; @@ -439,6 +443,7 @@ acpi_status acpi_ev_acquire_global_lock( ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); if (acquired) { + /* We got the lock */ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -492,6 +497,7 @@ acpi_status acpi_ev_release_global_lock( acpi_gbl_global_lock_thread_count--; if (acpi_gbl_global_lock_thread_count) { + /* There are still some threads holding the lock, cannot release */ return_ACPI_STATUS(AE_OK); diff -puN drivers/acpi/events/evregion.c~git-acpi drivers/acpi/events/evregion.c --- devel/drivers/acpi/events/evregion.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evregion.c 2006-04-26 13:41:00.000000000 -0700 @@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_region * Run the _REG methods for op_regions in each default address space */ for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { + /* TBD: Make sure handler is the DEFAULT handler, otherwise * _REG will have already been run. */ @@ -315,6 +316,7 @@ acpi_ev_address_space_dispatch(union acp */ region_setup = handler_desc->address_space.setup; if (!region_setup) { + /* No initialization routine, exit with error */ ACPI_ERROR((AE_INFO, @@ -361,9 +363,10 @@ acpi_ev_address_space_dispatch(union acp region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; if (region_obj2->extra.region_context) { + /* The handler for this region was already installed */ - ACPI_MEM_FREE(region_context); + ACPI_FREE(region_context); } else { /* * Save the returned context for use in all accesses to @@ -463,6 +466,7 @@ acpi_ev_detach_region(union acpi_operand handler_obj = region_obj->region.handler; if (!handler_obj) { + /* This region has no handler, all done */ return_VOID; @@ -474,6 +478,7 @@ acpi_ev_detach_region(union acpi_operand last_obj_ptr = &handler_obj->address_space.region_list; while (obj_desc) { + /* Is this the correct Region? */ if (obj_desc == region_obj) { @@ -666,6 +671,7 @@ acpi_ev_install_handler(acpi_handle obj_ obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { + /* No object, just exit */ return (AE_OK); @@ -674,10 +680,12 @@ acpi_ev_install_handler(acpi_handle obj_ /* Devices are handled different than regions */ if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { + /* Check if this Device already has a handler for this address space */ next_handler_obj = obj_desc->device.handler; while (next_handler_obj) { + /* Found a handler, is it for the same address space? */ if (next_handler_obj->address_space.space_id == @@ -839,6 +847,7 @@ acpi_ev_install_space_handler(struct acp /* Walk the handler list for this device */ while (handler_obj) { + /* Same space_id indicates a handler already installed */ if (handler_obj->address_space.space_id == space_id) { @@ -1035,6 +1044,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { + /* No object, just exit */ return (AE_OK); diff -puN drivers/acpi/events/evrgnini.c~git-acpi drivers/acpi/events/evrgnini.c --- devel/drivers/acpi/events/evrgnini.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evrgnini.c 2006-04-26 13:41:00.000000000 -0700 @@ -75,7 +75,7 @@ acpi_ev_system_memory_region_setup(acpi_ if (function == ACPI_REGION_DEACTIVATE) { if (*region_context) { - ACPI_MEM_FREE(*region_context); + ACPI_FREE(*region_context); *region_context = NULL; } return_ACPI_STATUS(AE_OK); @@ -84,7 +84,7 @@ acpi_ev_system_memory_region_setup(acpi_ /* Create a new context */ local_region_context = - ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); + ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context)); if (!(local_region_context)) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -178,7 +178,7 @@ acpi_ev_pci_config_region_setup(acpi_han *region_context = NULL; if (function == ACPI_REGION_DEACTIVATE) { if (pci_id) { - ACPI_MEM_FREE(pci_id); + ACPI_FREE(pci_id); } return_ACPI_STATUS(status); } @@ -199,6 +199,7 @@ acpi_ev_pci_config_region_setup(acpi_han * handlers with that device. */ if (handler_obj->address_space.node == acpi_gbl_root_node) { + /* Start search from the parent object */ pci_root_node = parent_node; @@ -220,6 +221,7 @@ acpi_ev_pci_config_region_setup(acpi_han PCI_EXPRESS_ROOT_HID_STRING, sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) { + /* Install a handler for this PCI root bridge */ status = @@ -262,7 +264,7 @@ acpi_ev_pci_config_region_setup(acpi_han /* Region is still not initialized. Create a new context */ - pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); + pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id)); if (!pci_id) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -478,11 +480,13 @@ acpi_ev_initialize_region(union acpi_ope * ie: acpi_gbl_root_node->parent_entry being set to NULL */ while (node) { + /* Check to see if a handler exists */ handler_obj = NULL; obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { + /* Can only be a handler if the object exists */ switch (node->type) { @@ -507,10 +511,12 @@ acpi_ev_initialize_region(union acpi_ope } while (handler_obj) { + /* Is this handler of the correct type? */ if (handler_obj->address_space.space_id == space_id) { + /* Found correct handler */ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, diff -puN drivers/acpi/events/evxface.c~git-acpi drivers/acpi/events/evxface.c --- devel/drivers/acpi/events/evxface.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evxface.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -90,6 +88,8 @@ acpi_status acpi_install_exception_handl (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } + +ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -107,7 +107,6 @@ acpi_status acpi_install_exception_handl * event. * ******************************************************************************/ - acpi_status acpi_install_fixed_event_handler(u32 event, acpi_event_handler handler, void *context) @@ -161,7 +160,7 @@ acpi_install_fixed_event_handler(u32 eve return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_fixed_event_handler); +ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) /******************************************************************************* * @@ -175,7 +174,6 @@ EXPORT_SYMBOL(acpi_install_fixed_event_h * DESCRIPTION: Disables the event and unregisters the event handler. * ******************************************************************************/ - acpi_status acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) { @@ -216,7 +214,7 @@ acpi_remove_fixed_event_handler(u32 even return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_fixed_event_handler); +ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) /******************************************************************************* * @@ -235,7 +233,6 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_ha * DESCRIPTION: Install a handler for notifies on an ACPI device * ******************************************************************************/ - acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type, @@ -275,6 +272,7 @@ acpi_install_notify_handler(acpi_handle * only one global handler can be regsitered (per notify type). */ if (device == ACPI_ROOT_OBJECT) { + /* Make sure the handler is not already installed */ if (((handler_type & ACPI_SYSTEM_NOTIFY) && @@ -317,6 +315,7 @@ acpi_install_notify_handler(acpi_handle obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { + /* Object exists - make sure there's no handler */ if (((handler_type & ACPI_SYSTEM_NOTIFY) && @@ -370,6 +369,7 @@ acpi_install_notify_handler(acpi_handle } if (handler_type == ACPI_ALL_NOTIFY) { + /* Extra ref if installed in both */ acpi_ut_add_reference(notify_obj); @@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_notify_handler); +ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) /******************************************************************************* * @@ -399,7 +399,6 @@ EXPORT_SYMBOL(acpi_install_notify_handle * DESCRIPTION: Remove a handler for notifies on an ACPI device * ******************************************************************************/ - acpi_status acpi_remove_notify_handler(acpi_handle device, u32 handler_type, acpi_notify_handler handler) @@ -415,12 +414,13 @@ acpi_remove_notify_handler(acpi_handle d if ((!device) || (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Convert and validate the device handle */ @@ -428,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle d node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Root Object */ @@ -442,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle d ((handler_type & ACPI_DEVICE_NOTIFY) && !acpi_gbl_device_notify.handler)) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -451,7 +451,7 @@ acpi_remove_notify_handler(acpi_handle d acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } if (handler_type & ACPI_SYSTEM_NOTIFY) { @@ -474,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle d if (!acpi_ev_is_notify_object(node)) { status = AE_TYPE; - goto unlock_and_exit; + goto unlock; } /* Check for an existing internal object */ @@ -482,7 +482,7 @@ acpi_remove_notify_handler(acpi_handle d obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Object exists - make sure there's an existing handler */ @@ -492,7 +492,7 @@ acpi_remove_notify_handler(acpi_handle d if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -500,7 +500,7 @@ acpi_remove_notify_handler(acpi_handle d acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -513,7 +513,7 @@ acpi_remove_notify_handler(acpi_handle d if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -521,7 +521,7 @@ acpi_remove_notify_handler(acpi_handle d acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -530,12 +530,15 @@ acpi_remove_notify_handler(acpi_handle d } } - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_notify_handler); +ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) /******************************************************************************* * @@ -554,7 +557,6 @@ EXPORT_SYMBOL(acpi_remove_notify_handler * DESCRIPTION: Install a handler for a General Purpose Event. * ******************************************************************************/ - acpi_status acpi_install_gpe_handler(acpi_handle gpe_device, u32 gpe_number, @@ -570,12 +572,13 @@ acpi_install_gpe_handler(acpi_handle gpe /* Parameter validation */ if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Ensure that we have a valid GPE number */ @@ -583,7 +586,7 @@ acpi_install_gpe_handler(acpi_handle gpe gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure that there isn't a handler there already */ @@ -591,15 +594,15 @@ acpi_install_gpe_handler(acpi_handle gpe if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { status = AE_ALREADY_EXISTS; - goto unlock_and_exit; + goto unlock; } /* Allocate and init handler object */ - handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); + handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); if (!handler) { status = AE_NO_MEMORY; - goto unlock_and_exit; + goto unlock; } handler->address = address; @@ -610,7 +613,7 @@ acpi_install_gpe_handler(acpi_handle gpe status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - goto unlock_and_exit; + goto unlock; } /* Install the handler */ @@ -625,12 +628,16 @@ acpi_install_gpe_handler(acpi_handle gpe acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, + "Installing notify handler failed")); return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_gpe_handler); +ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) /******************************************************************************* * @@ -646,7 +653,6 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); * DESCRIPTION: Remove a handler for a General Purpose acpi_event. * ******************************************************************************/ - acpi_status acpi_remove_gpe_handler(acpi_handle gpe_device, u32 gpe_number, acpi_event_handler address) @@ -724,14 +730,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_ /* Now we can free the handler object */ - ACPI_MEM_FREE(handler); + ACPI_FREE(handler); unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_gpe_handler); +ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) /******************************************************************************* * @@ -746,7 +752,6 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); * DESCRIPTION: Acquire the ACPI Global Lock * ******************************************************************************/ - acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) { acpi_status status; @@ -771,7 +776,7 @@ acpi_status acpi_acquire_global_lock(u16 return (status); } -EXPORT_SYMBOL(acpi_acquire_global_lock); +ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) /******************************************************************************* * @@ -784,7 +789,6 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. * ******************************************************************************/ - acpi_status acpi_release_global_lock(u32 handle) { acpi_status status; @@ -797,4 +801,4 @@ acpi_status acpi_release_global_lock(u32 return (status); } -EXPORT_SYMBOL(acpi_release_global_lock); +ACPI_EXPORT_SYMBOL(acpi_release_global_lock) diff -puN drivers/acpi/events/evxfevnt.c~git-acpi drivers/acpi/events/evxfevnt.c --- devel/drivers/acpi/events/evxfevnt.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evxfevnt.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -94,6 +92,8 @@ acpi_status acpi_enable(void) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_enable) + /******************************************************************************* * * FUNCTION: acpi_disable @@ -105,7 +105,6 @@ acpi_status acpi_enable(void) * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. * ******************************************************************************/ - acpi_status acpi_disable(void) { acpi_status status = AE_OK; @@ -137,6 +136,8 @@ acpi_status acpi_disable(void) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_disable) + /******************************************************************************* * * FUNCTION: acpi_enable_event @@ -149,7 +150,6 @@ acpi_status acpi_disable(void) * DESCRIPTION: Enable an ACPI event (fixed) * ******************************************************************************/ - acpi_status acpi_enable_event(u32 event, u32 flags) { acpi_status status = AE_OK; @@ -193,7 +193,7 @@ acpi_status acpi_enable_event(u32 event, return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_enable_event); +ACPI_EXPORT_SYMBOL(acpi_enable_event) /******************************************************************************* * @@ -208,7 +208,6 @@ EXPORT_SYMBOL(acpi_enable_event); * DESCRIPTION: Set the type of an individual GPE * ******************************************************************************/ - acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) { acpi_status status = AE_OK; @@ -236,7 +235,7 @@ acpi_status acpi_set_gpe_type(acpi_handl return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_set_gpe_type); +ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) /******************************************************************************* * @@ -252,7 +251,6 @@ EXPORT_SYMBOL(acpi_set_gpe_type); * DESCRIPTION: Enable an ACPI event (general purpose) * ******************************************************************************/ - acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { acpi_status status = AE_OK; @@ -288,7 +286,7 @@ acpi_status acpi_enable_gpe(acpi_handle return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_enable_gpe); +ACPI_EXPORT_SYMBOL(acpi_enable_gpe) /******************************************************************************* * @@ -304,7 +302,6 @@ EXPORT_SYMBOL(acpi_enable_gpe); * DESCRIPTION: Disable an ACPI event (general purpose) * ******************************************************************************/ - acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { acpi_status status = AE_OK; @@ -338,6 +335,8 @@ acpi_status acpi_disable_gpe(acpi_handle return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_disable_gpe) + /******************************************************************************* * * FUNCTION: acpi_disable_event @@ -350,7 +349,6 @@ acpi_status acpi_disable_gpe(acpi_handle * DESCRIPTION: Disable an ACPI event (fixed) * ******************************************************************************/ - acpi_status acpi_disable_event(u32 event, u32 flags) { acpi_status status = AE_OK; @@ -392,7 +390,7 @@ acpi_status acpi_disable_event(u32 event return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_disable_event); +ACPI_EXPORT_SYMBOL(acpi_disable_event) /******************************************************************************* * @@ -405,7 +403,6 @@ EXPORT_SYMBOL(acpi_disable_event); * DESCRIPTION: Clear an ACPI event (fixed) * ******************************************************************************/ - acpi_status acpi_clear_event(u32 event) { acpi_status status = AE_OK; @@ -429,7 +426,7 @@ acpi_status acpi_clear_event(u32 event) return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_clear_event); +ACPI_EXPORT_SYMBOL(acpi_clear_event) /******************************************************************************* * @@ -444,7 +441,6 @@ EXPORT_SYMBOL(acpi_clear_event); * DESCRIPTION: Clear an ACPI event (general purpose) * ******************************************************************************/ - acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { acpi_status status = AE_OK; @@ -478,6 +474,8 @@ acpi_status acpi_clear_gpe(acpi_handle g return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_clear_gpe) + #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -492,7 +490,6 @@ acpi_status acpi_clear_gpe(acpi_handle g * DESCRIPTION: Obtains and returns the current status of the event * ******************************************************************************/ - acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) { acpi_status status = AE_OK; @@ -518,6 +515,8 @@ acpi_status acpi_get_event_status(u32 ev return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_get_event_status) + /******************************************************************************* * * FUNCTION: acpi_get_gpe_status @@ -533,7 +532,6 @@ acpi_status acpi_get_event_status(u32 ev * DESCRIPTION: Get status of an event (general purpose) * ******************************************************************************/ - acpi_status acpi_get_gpe_status(acpi_handle gpe_device, u32 gpe_number, u32 flags, acpi_event_status * event_status) @@ -570,6 +568,8 @@ acpi_get_gpe_status(acpi_handle gpe_devi } return_ACPI_STATUS(status); } + +ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -586,7 +586,6 @@ acpi_get_gpe_status(acpi_handle gpe_devi * DESCRIPTION: Create and Install a block of GPE registers * ******************************************************************************/ - acpi_status acpi_install_gpe_block(acpi_handle gpe_device, struct acpi_generic_address *gpe_block_address, @@ -636,6 +635,7 @@ acpi_install_gpe_block(acpi_handle gpe_d obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { + /* No object, create a new one */ obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); @@ -665,7 +665,7 @@ acpi_install_gpe_block(acpi_handle gpe_d return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_gpe_block); +ACPI_EXPORT_SYMBOL(acpi_install_gpe_block) /******************************************************************************* * @@ -678,7 +678,6 @@ EXPORT_SYMBOL(acpi_install_gpe_block); * DESCRIPTION: Remove a previously installed block of GPE registers * ******************************************************************************/ - acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) { union acpi_operand_object *obj_desc; @@ -721,4 +720,4 @@ acpi_status acpi_remove_gpe_block(acpi_h return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_gpe_block); +ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) diff -puN drivers/acpi/events/evxfregn.c~git-acpi drivers/acpi/events/evxfregn.c --- devel/drivers/acpi/events/evxfregn.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/events/evxfregn.c 2006-04-26 13:41:00.000000000 -0700 @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -114,7 +112,7 @@ acpi_install_address_space_handler(acpi_ return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_address_space_handler); +ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler) /******************************************************************************* * @@ -129,7 +127,6 @@ EXPORT_SYMBOL(acpi_install_address_space * DESCRIPTION: Remove a previously installed handler. * ******************************************************************************/ - acpi_status acpi_remove_address_space_handler(acpi_handle device, acpi_adr_space_type space_id, @@ -176,9 +173,11 @@ acpi_remove_address_space_handler(acpi_h handler_obj = obj_desc->device.handler; last_obj_ptr = &obj_desc->device.handler; while (handler_obj) { + /* We have a handler, see if user requested this one */ if (handler_obj->address_space.space_id == space_id) { + /* Matched space_id, first dereference this in the Regions */ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, @@ -240,4 +239,4 @@ acpi_remove_address_space_handler(acpi_h return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_address_space_handler); +ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler) diff -puN drivers/acpi/executer/exconfig.c~git-acpi drivers/acpi/executer/exconfig.c --- devel/drivers/acpi/executer/exconfig.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exconfig.c 2006-04-26 13:41:00.000000000 -0700 @@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_head if (ACPI_FAILURE(status)) { if (status == AE_ALREADY_EXISTS) { + /* Table already exists, just return the handle */ return_ACPI_STATUS(AE_OK); @@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_head status = acpi_ns_load_table(table_info.installed_desc, parent_node); if (ACPI_FAILURE(status)) { + /* Uninstall table on error */ (void)acpi_tb_uninstall_table(table_info.installed_desc); @@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_s */ status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); if (status == AE_OK) { + /* Signature matched -- don't allow override */ return_ACPI_STATUS(AE_ALREADY_EXISTS); @@ -252,6 +255,7 @@ acpi_ex_load_table_op(struct acpi_walk_s /* Parameter Data (optional) */ if (parameter_node) { + /* Store the parameter data into the optional parameter object */ status = acpi_ex_store(operand[5], @@ -345,7 +349,7 @@ acpi_ex_load_op(union acpi_operand_objec /* Allocate a buffer for the entire table */ - table_ptr = ACPI_MEM_ALLOCATE(table_header.length); + table_ptr = ACPI_ALLOCATE(table_header.length); if (!table_ptr) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -424,6 +428,7 @@ acpi_ex_load_op(union acpi_operand_objec status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); if (ACPI_FAILURE(status)) { + /* On error, table_ptr was deallocated above */ return_ACPI_STATUS(status); @@ -442,7 +447,7 @@ acpi_ex_load_op(union acpi_operand_objec cleanup: if (ACPI_FAILURE(status)) { - ACPI_MEM_FREE(table_ptr); + ACPI_FREE(table_ptr); } return_ACPI_STATUS(status); } diff -puN drivers/acpi/executer/exconvrt.c~git-acpi drivers/acpi/executer/exconvrt.c --- devel/drivers/acpi/executer/exconvrt.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exconvrt.c 2006-04-26 13:41:00.000000000 -0700 @@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer in remainder = 0; for (i = decimal_length; i > 0; i--) { + /* Divide by nth factor of 10 */ digit = integer; @@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer in hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { + /* Get one hex digit, most significant digits first */ string[k] = diff -puN drivers/acpi/executer/exdump.c~git-acpi drivers/acpi/executer/exdump.c --- devel/drivers/acpi/executer/exdump.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exdump.c 2006-04-26 13:41:00.000000000 -0700 @@ -463,6 +463,7 @@ void acpi_ex_dump_operand(union acpi_ope } if (!obj_desc) { + /* This could be a null element of a package */ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); @@ -532,6 +533,7 @@ void acpi_ex_dump_operand(union acpi_ope obj_desc->reference.offset); if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { + /* Value is an Integer */ acpi_os_printf(" value is [%8.8X%8.8x]", @@ -901,7 +903,7 @@ static void acpi_ex_dump_reference_obj(u acpi_os_printf("Could not convert name to pathname\n"); } else { acpi_os_printf("%s\n", (char *)ret_buf.pointer); - ACPI_MEM_FREE(ret_buf.pointer); + ACPI_FREE(ret_buf.pointer); } } else if (obj_desc->reference.object) { acpi_os_printf("\nReferenced Object: %p\n", diff -puN drivers/acpi/executer/exfield.c~git-acpi drivers/acpi/executer/exfield.c --- devel/drivers/acpi/executer/exfield.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exfield.c 2006-04-26 13:41:00.000000000 -0700 @@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); if (length > acpi_gbl_integer_byte_width) { + /* Field is too large for an Integer, create a Buffer instead */ buffer_desc = acpi_ut_create_buffer_object(length); @@ -329,9 +330,10 @@ acpi_ex_write_data_to_field(union acpi_o ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); if (length < required_length) { + /* We need to create a new buffer */ - new_buffer = ACPI_MEM_CALLOCATE(required_length); + new_buffer = ACPI_ALLOCATE_ZEROED(required_length); if (!new_buffer) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -375,7 +377,7 @@ acpi_ex_write_data_to_field(union acpi_o /* Free temporary buffer if we used one */ if (new_buffer) { - ACPI_MEM_FREE(new_buffer); + ACPI_FREE(new_buffer); } return_ACPI_STATUS(status); diff -puN drivers/acpi/executer/exfldio.c~git-acpi drivers/acpi/executer/exfldio.c --- devel/drivers/acpi/executer/exfldio.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exfldio.c 2006-04-26 13:41:00.000000000 -0700 @@ -113,6 +113,7 @@ acpi_ex_setup_region(union acpi_operand_ } if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { + /* SMBus has a non-linear address space */ return_ACPI_STATUS(AE_OK); @@ -491,6 +492,7 @@ acpi_ex_field_datum_io(union acpi_operan value)); if (read_write == ACPI_READ) { + /* Read the datum from the data_register */ status = @@ -568,6 +570,7 @@ acpi_ex_write_with_update_rule(union acp /* If the mask is all ones, we don't need to worry about the update rule */ if (mask != ACPI_INTEGER_MAX) { + /* Decode the update rule */ switch (obj_desc->common_field. @@ -704,6 +707,7 @@ acpi_ex_extract_from_field(union acpi_op /* Read the rest of the field */ for (i = 1; i < field_datum_count; i++) { + /* Get next input datum from the field */ field_offset += obj_desc->common_field.access_byte_width; @@ -817,6 +821,7 @@ acpi_ex_insert_into_field(union acpi_ope /* Write the entire field */ for (i = 1; i < field_datum_count; i++) { + /* Write merged datum to the target field */ merged_datum &= mask; diff -puN drivers/acpi/executer/exmisc.c~git-acpi drivers/acpi/executer/exmisc.c --- devel/drivers/acpi/executer/exmisc.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exmisc.c 2006-04-26 13:41:00.000000000 -0700 @@ -649,6 +649,7 @@ acpi_ex_do_logical_op(u16 opcode, /* Length and all bytes must be equal */ if ((length0 == length1) && (compare == 0)) { + /* Length and all bytes match ==> TRUE */ local_result = TRUE; diff -puN drivers/acpi/executer/exmutex.c~git-acpi drivers/acpi/executer/exmutex.c --- devel/drivers/acpi/executer/exmutex.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exmutex.c 2006-04-26 13:41:00.000000000 -0700 @@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand /* Support for multiple acquires by the owning thread */ if (obj_desc->mutex.owner_thread) { + /* Special case for Global Lock, allow all threads */ if ((obj_desc->mutex.owner_thread->thread_id == @@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); if (ACPI_FAILURE(status)) { + /* Includes failure from a timeout on time_desc */ return_ACPI_STATUS(status); @@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand obj_desc->mutex.acquisition_depth--; if (obj_desc->mutex.acquisition_depth != 0) { + /* Just decrement the depth and return */ return_ACPI_STATUS(AE_OK); diff -puN drivers/acpi/executer/exnames.c~git-acpi drivers/acpi/executer/exnames.c --- devel/drivers/acpi/executer/exnames.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exnames.c 2006-04-26 13:41:00.000000000 -0700 @@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_strin * This may actually be somewhat longer than needed. */ if (prefix_count == ACPI_UINT32_MAX) { + /* Special case for root */ size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; @@ -97,7 +98,7 @@ static char *acpi_ex_allocate_name_strin * Allocate a buffer for the name. * This buffer must be deleted by the caller! */ - name_string = ACPI_MEM_ALLOCATE(size_needed); + name_string = ACPI_ALLOCATE(size_needed); if (!name_string) { ACPI_ERROR((AE_INFO, "Could not allocate size %d", size_needed)); @@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_strin /* Set up Dual or Multi prefixes if needed */ if (num_name_segs > 2) { + /* Set up multi prefixes */ *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; *temp_ptr++ = (char)num_name_segs; } else if (2 == num_name_segs) { + /* Set up dual prefixes */ *temp_ptr++ = AML_DUAL_NAME_PREFIX; @@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment( /* Valid name segment */ if (index == 4) { + /* Found 4 valid characters */ char_buf[4] = '\0'; @@ -254,6 +258,7 @@ acpi_ex_get_name_string(acpi_object_type if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || ACPI_TYPE_LOCAL_BANK_FIELD == data_type || ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { + /* Disallow prefixes for types associated with field_unit names */ name_string = acpi_ex_allocate_name_string(0, 1); @@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type } if (AE_CTRL_PENDING == status && has_prefix) { + /* Ran out of segments after processing a prefix */ ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); @@ -418,7 +424,7 @@ acpi_ex_get_name_string(acpi_object_type if (ACPI_FAILURE(status)) { if (name_string) { - ACPI_MEM_FREE(name_string); + ACPI_FREE(name_string); } return_ACPI_STATUS(status); } diff -puN drivers/acpi/executer/exoparg1.c~git-acpi drivers/acpi/executer/exoparg1.c --- devel/drivers/acpi/executer/exoparg1.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exoparg1.c 2006-04-26 13:41:00.000000000 -0700 @@ -342,6 +342,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(stru for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { + /* Get the least significant 4-bit BCD digit */ temp32 = ((u32) digit) & 0xF; @@ -487,6 +488,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(stru status = acpi_ex_convert_to_string(operand[0], &return_desc, ACPI_EXPLICIT_CONVERT_DECIMAL); if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -497,6 +499,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(stru status = acpi_ex_convert_to_string(operand[0], &return_desc, ACPI_EXPLICIT_CONVERT_HEX); if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -506,6 +509,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(stru status = acpi_ex_convert_to_buffer(operand[0], &return_desc); if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -516,6 +520,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(stru status = acpi_ex_convert_to_integer(operand[0], &return_desc, ACPI_ANY_BASE); if (return_desc == operand[0]) { + /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -541,6 +546,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(stru } if (ACPI_SUCCESS(status)) { + /* Store the return value computed above into the target object */ status = acpi_ex_store(return_desc, operand[1], walk_state); @@ -548,16 +554,18 @@ acpi_status acpi_ex_opcode_1A_1T_1R(stru cleanup: - if (!walk_state->result_obj) { - walk_state->result_obj = return_desc; - } - /* Delete return object on error */ if (ACPI_FAILURE(status)) { acpi_ut_remove_reference(return_desc); } + /* Save return object on success */ + + else if (!walk_state->result_obj) { + walk_state->result_obj = return_desc; + } + return_ACPI_STATUS(status); } @@ -625,6 +633,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(stru temp_desc = operand[0]; if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == ACPI_DESC_TYPE_OPERAND) { + /* Internal reference object - prevent deletion */ acpi_ut_add_reference(temp_desc); @@ -777,8 +786,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(stru /* Check for a method local or argument, or standalone String */ - if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != + if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == ACPI_DESC_TYPE_NAMED) { + temp_desc = + acpi_ns_get_attached_object((struct + acpi_namespace_node *) + operand[0]); + if (temp_desc + && + ((ACPI_GET_OBJECT_TYPE(temp_desc) == + ACPI_TYPE_STRING) + || (ACPI_GET_OBJECT_TYPE(temp_desc) == + ACPI_TYPE_LOCAL_REFERENCE))) { + operand[0] = temp_desc; + acpi_ut_add_reference(temp_desc); + } else { + status = AE_AML_OPERAND_TYPE; + goto cleanup; + } + } else { switch (ACPI_GET_OBJECT_TYPE(operand[0])) { case ACPI_TYPE_LOCAL_REFERENCE: /* @@ -827,13 +853,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(stru break; case ACPI_TYPE_STRING: + break; + + default: + status = AE_AML_OPERAND_TYPE; + goto cleanup; + } + } + if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != + ACPI_DESC_TYPE_NAMED) { + if (ACPI_GET_OBJECT_TYPE(operand[0]) == + ACPI_TYPE_STRING) { /* * This is a deref_of (String). The string is a reference * to a named ACPI object. * * 1) Find the owning Node - * 2) Dereference the node to an actual object. Could be a + * 2) Dereference the node to an actual object. Could be a * Field, so we need to resolve the node to a value. */ status = @@ -857,11 +894,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(stru (struct acpi_namespace_node, &return_desc), walk_state); goto cleanup; - - default: - - status = AE_AML_OPERAND_TYPE; - goto cleanup; } } @@ -998,6 +1030,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(stru acpi_ut_remove_reference(return_desc); } - walk_state->result_obj = return_desc; + /* Save return object on success */ + + else { + walk_state->result_obj = return_desc; + } + return_ACPI_STATUS(status); } diff -puN drivers/acpi/executer/exoparg2.c~git-acpi drivers/acpi/executer/exoparg2.c --- devel/drivers/acpi/executer/exoparg2.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exoparg2.c 2006-04-26 13:41:00.000000000 -0700 @@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(stru acpi_ev_check_for_wake_only_gpe(walk_state-> gpe_event_info); if (ACPI_FAILURE(status)) { + /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ return_ACPI_STATUS(AE_OK) @@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(stru acpi_ut_remove_reference(return_desc2); if (ACPI_FAILURE(status)) { + /* Delete the return object */ acpi_ut_remove_reference(return_desc1); @@ -287,6 +289,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(stru /* Execute the opcode */ if (walk_state->op_info->flags & AML_MATH) { + /* All simple math opcodes (add, etc.) */ return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); @@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(stru goto cleanup; } + /* Initialize the Index reference object */ + index = operand[1]->integer.value; + return_desc->reference.offset = (u32) index; + return_desc->reference.opcode = AML_INDEX_OP; + + /* + * At this point, the Source operand is a String, Buffer, or Package. + * Verify that the index is within range. + */ + switch (ACPI_GET_OBJECT_TYPE(operand[0])) { + case ACPI_TYPE_STRING: + + if (index >= operand[0]->string.length) { + status = AE_AML_STRING_LIMIT; + } + + return_desc->reference.target_type = + ACPI_TYPE_BUFFER_FIELD; + break; + + case ACPI_TYPE_BUFFER: + + if (index >= operand[0]->buffer.length) { + status = AE_AML_BUFFER_LIMIT; + } - /* At this point, the Source operand is a Package, Buffer, or String */ + return_desc->reference.target_type = + ACPI_TYPE_BUFFER_FIELD; + break; - if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { - /* Object to be indexed is a Package */ + case ACPI_TYPE_PACKAGE: if (index >= operand[0]->package.count) { - ACPI_ERROR((AE_INFO, - "Index value (%X%8.8X) beyond package end (%X)", - ACPI_FORMAT_UINT64(index), - operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; - goto cleanup; } return_desc->reference.target_type = ACPI_TYPE_PACKAGE; - return_desc->reference.object = operand[0]; return_desc->reference.where = &operand[0]->package.elements[index]; - } else { - /* Object to be indexed is a Buffer/String */ + break; - if (index >= operand[0]->buffer.length) { - ACPI_ERROR((AE_INFO, - "Index value (%X%8.8X) beyond end of buffer (%X)", - ACPI_FORMAT_UINT64(index), - operand[0]->buffer.length)); - status = AE_AML_BUFFER_LIMIT; - goto cleanup; - } + default: - return_desc->reference.target_type = - ACPI_TYPE_BUFFER_FIELD; - return_desc->reference.object = operand[0]; + status = AE_AML_INTERNAL; + goto cleanup; + } + + /* Failure means that the Index was beyond the end of the object */ + + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, + "Index (%X%8.8X) is beyond end of object", + ACPI_FORMAT_UINT64(index))); + goto cleanup; } /* - * Add a reference to the target package/buffer/string for the life - * of the index. + * Save the target object and add a reference to it for the life + * of the index */ + return_desc->reference.object = operand[0]; acpi_ut_add_reference(operand[0]); - /* Complete the Index reference object */ - - return_desc->reference.opcode = AML_INDEX_OP; - return_desc->reference.offset = (u32) index; - /* Store the reference to the Target */ status = acpi_ex_store(return_desc, operand[2], walk_state); @@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(stru /* Execute the Opcode */ if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { + /* logical_op (Operand0, Operand1) */ status = acpi_ex_do_logical_numeric_op(walk_state->opcode, @@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(stru value, &logical_result); goto store_logical_result; } else if (walk_state->op_info->flags & AML_LOGICAL) { + /* logical_op (Operand0, Operand1) */ status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], diff -puN drivers/acpi/executer/exoparg3.c~git-acpi drivers/acpi/executer/exoparg3.c --- devel/drivers/acpi/executer/exoparg3.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exoparg3.c 2006-04-26 13:41:00.000000000 -0700 @@ -100,8 +100,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(stru (u32) operand[1]->integer.value, (u32) operand[2]->integer.value)); - fatal = - ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); + fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); if (fatal) { fatal->type = (u32) operand[0]->integer.value; fatal->code = (u32) operand[1]->integer.value; @@ -114,7 +113,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(stru /* Might return while OS is shutting down, just continue */ - ACPI_MEM_FREE(fatal); + ACPI_FREE(fatal); break; default: @@ -196,7 +195,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(stru /* Always allocate a new buffer for the String */ - buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); + buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); if (!buffer) { status = AE_NO_MEMORY; goto cleanup; @@ -208,9 +207,10 @@ acpi_status acpi_ex_opcode_3A_1T_1R(stru /* If the requested length is zero, don't allocate a buffer */ if (length > 0) { + /* Allocate a new buffer for the Buffer */ - buffer = ACPI_MEM_CALLOCATE(length); + buffer = ACPI_ALLOCATE_ZEROED(length); if (!buffer) { status = AE_NO_MEMORY; goto cleanup; @@ -225,6 +225,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(stru } if (buffer) { + /* We have a buffer, copy the portion requested */ ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, diff -puN drivers/acpi/executer/exoparg6.c~git-acpi drivers/acpi/executer/exoparg6.c --- devel/drivers/acpi/executer/exoparg6.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exoparg6.c 2006-04-26 13:41:00.000000000 -0700 @@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(stru * match was found. */ for (; index < operand[0]->package.count; index++) { + /* Get the current package element */ this_element = operand[0]->package.elements[index]; diff -puN drivers/acpi/executer/exprep.c~git-acpi drivers/acpi/executer/exprep.c --- devel/drivers/acpi/executer/exprep.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exprep.c 2006-04-26 13:41:00.000000000 -0700 @@ -519,13 +519,20 @@ acpi_status acpi_ex_prep_field_value(str acpi_ut_add_reference(obj_desc->index_field.index_obj); /* + * February 2006: Changed to match MS behavior + * * The value written to the Index register is the byte offset of the - * target field - * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position) + * target field. + * + * Previously, the value was calculated as an index in terms of the + * width of the Data register, as below: + * + * obj_desc->index_field.Value = (u32) + * (Info->field_bit_position / ACPI_MUL_8 ( + * obj_desc->Field.access_byte_width)); */ - obj_desc->index_field.value = (u32) - (info->field_bit_position / - ACPI_MUL_8(obj_desc->field.access_byte_width)); + obj_desc->index_field.value = + (u32) ACPI_DIV_8(info->field_bit_position); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", diff -puN drivers/acpi/executer/exregion.c~git-acpi drivers/acpi/executer/exregion.c --- devel/drivers/acpi/executer/exregion.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exregion.c 2006-04-26 13:41:00.000000000 -0700 @@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 * Delete the existing mapping and create a new one. */ if (mem_info->mapped_length) { + /* Valid mapping, delete it */ acpi_os_unmap_memory(mem_info->mapped_logical_address, @@ -181,8 +182,8 @@ acpi_ex_system_memory_space_handler(u32 (acpi_integer) mem_info->mapped_physical_address); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "system_memory %d (%d width) Address=%8.8X%8.8X\n", - function, bit_width, ACPI_FORMAT_UINT64(address))); + "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", + bit_width, function, ACPI_FORMAT_UINT64(address))); /* * Perform the memory read or write @@ -286,8 +287,8 @@ acpi_ex_system_io_space_handler(u32 func ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "system_iO %d (%d width) Address=%8.8X%8.8X\n", - function, bit_width, ACPI_FORMAT_UINT64(address))); + "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", + bit_width, function, ACPI_FORMAT_UINT64(address))); /* Decode the function parameter */ @@ -360,7 +361,7 @@ acpi_ex_pci_config_space_handler(u32 fun pci_register = (u16) (u32) address; ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", + "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", function, bit_width, pci_id->segment, pci_id->bus, pci_id->device, pci_id->function, pci_register)); diff -puN drivers/acpi/executer/exresnte.c~git-acpi drivers/acpi/executer/exresnte.c --- devel/drivers/acpi/executer/exresnte.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exresnte.c 2006-04-26 13:41:00.000000000 -0700 @@ -103,6 +103,7 @@ acpi_ex_resolve_node_to_value(struct acp if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { + /* There is always exactly one level of indirection */ node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); @@ -141,6 +142,7 @@ acpi_ex_resolve_node_to_value(struct acp status = acpi_ds_get_package_arguments(source_desc); if (ACPI_SUCCESS(status)) { + /* Return an additional reference to the object */ obj_desc = source_desc; @@ -158,6 +160,7 @@ acpi_ex_resolve_node_to_value(struct acp status = acpi_ds_get_buffer_arguments(source_desc); if (ACPI_SUCCESS(status)) { + /* Return an additional reference to the object */ obj_desc = source_desc; @@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acp /* This is a ddb_handle */ /* Return an additional reference to the object */ + case AML_REF_OF_OP: + obj_desc = source_desc; acpi_ut_add_reference(obj_desc); break; diff -puN drivers/acpi/executer/exresolv.c~git-acpi drivers/acpi/executer/exresolv.c --- devel/drivers/acpi/executer/exresolv.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exresolv.c 2006-04-26 13:41:00.000000000 -0700 @@ -382,10 +382,16 @@ acpi_ex_resolve_multiple(struct acpi_wal while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { switch (obj_desc->reference.opcode) { case AML_REF_OF_OP: + case AML_INT_NAMEPATH_OP: /* Dereference the reference pointer */ - node = obj_desc->reference.object; + if (obj_desc->reference.opcode == AML_REF_OF_OP) { + node = obj_desc->reference.object; + } else { /* AML_INT_NAMEPATH_OP */ + + node = obj_desc->reference.node; + } /* All "References" point to a NS node */ @@ -401,6 +407,7 @@ acpi_ex_resolve_multiple(struct acpi_wal obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { + /* No object, use the NS node type */ type = acpi_ns_get_type(node); @@ -432,6 +439,7 @@ acpi_ex_resolve_multiple(struct acpi_wal */ obj_desc = *(obj_desc->reference.where); if (!obj_desc) { + /* NULL package elements are allowed */ type = 0; /* Uninitialized */ @@ -439,39 +447,6 @@ acpi_ex_resolve_multiple(struct acpi_wal } break; - case AML_INT_NAMEPATH_OP: - - /* Dereference the reference pointer */ - - node = obj_desc->reference.node; - - /* All "References" point to a NS node */ - - if (ACPI_GET_DESCRIPTOR_TYPE(node) != - ACPI_DESC_TYPE_NAMED) { - ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]", - node, - acpi_ut_get_descriptor_name(node))); - return_ACPI_STATUS(AE_AML_INTERNAL); - } - - /* Get the attached object */ - - obj_desc = acpi_ns_get_attached_object(node); - if (!obj_desc) { - /* No object, use the NS node type */ - - type = acpi_ns_get_type(node); - goto exit; - } - - /* Check for circular references */ - - if (obj_desc == operand) { - return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); - } - break; - case AML_LOCAL_OP: case AML_ARG_OP: diff -puN drivers/acpi/executer/exresop.c~git-acpi drivers/acpi/executer/exresop.c --- devel/drivers/acpi/executer/exresop.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exresop.c 2006-04-26 13:41:00.000000000 -0700 @@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_ty ACPI_FUNCTION_ENTRY(); if (type_needed == ACPI_TYPE_ANY) { + /* All types OK, so we don't perform any typechecks */ return (AE_OK); @@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode, } if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { + /* Decode the Reference */ op_info = acpi_ps_get_opcode_info(opcode); @@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode, } if (obj_desc->reference.opcode == AML_NAME_OP) { + /* Convert a named reference to the actual named object */ temp_node = obj_desc->reference.object; @@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode, } if (target_op == AML_DEBUG_OP) { + /* Allow store of any object to the Debug object */ break; diff -puN drivers/acpi/executer/exstore.c~git-acpi drivers/acpi/executer/exstore.c --- devel/drivers/acpi/executer/exstore.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exstore.c 2006-04-26 13:41:00.000000000 -0700 @@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi } if (obj_desc) { + /* Decrement reference count by the ref count of the parent package */ for (i = 0; i < ((union acpi_operand_object *) @@ -572,6 +573,7 @@ acpi_ex_store_object_to_node(union acpi_ /* If no implicit conversion, drop into the default case below */ if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { + /* Force execution of default (no implicit conversion) */ target_type = ACPI_TYPE_ANY; diff -puN drivers/acpi/executer/exstoren.c~git-acpi drivers/acpi/executer/exstoren.c --- devel/drivers/acpi/executer/exstoren.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exstoren.c 2006-04-26 13:41:00.000000000 -0700 @@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operan */ if (ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_LOCAL_REFERENCE) { + /* Resolve a reference object first */ status = @@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operan !((ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { + /* Conversion successful but still not a valid type */ ACPI_ERROR((AE_INFO, @@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acp } if (actual_src_desc != source_desc) { + /* Delete the intermediate (temporary) source object */ acpi_ut_remove_reference(actual_src_desc); diff -puN drivers/acpi/executer/exstorob.c~git-acpi drivers/acpi/executer/exstorob.c --- devel/drivers/acpi/executer/exstorob.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exstorob.c 2006-04-26 13:41:00.000000000 -0700 @@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acp */ if ((target_desc->buffer.length == 0) || (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { - target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); + target_desc->buffer.pointer = ACPI_ALLOCATE(length); if (!target_desc->buffer.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acp /* Copy source buffer to target buffer */ if (length <= target_desc->buffer.length) { + /* Clear existing buffer and copy in the new one */ ACPI_MEMSET(target_desc->buffer.pointer, 0, @@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acp * copy must not truncate the original buffer. */ if (original_src_type == ACPI_TYPE_STRING) { + /* Set the new length of the target */ target_desc->buffer.length = length; @@ -183,13 +185,14 @@ acpi_ex_store_string_to_string(union acp */ if (target_desc->string.pointer && (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { + /* Only free if not a pointer into the DSDT */ - ACPI_MEM_FREE(target_desc->string.pointer); + ACPI_FREE(target_desc->string.pointer); } - target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) - length + 1); + target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size) + length + 1); if (!target_desc->string.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } diff -puN drivers/acpi/executer/exsystem.c~git-acpi drivers/acpi/executer/exsystem.c --- devel/drivers/acpi/executer/exsystem.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exsystem.c 2006-04-26 13:41:00.000000000 -0700 @@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphor } if (status == AE_TIME) { + /* We must wait, so unlock the interpreter */ acpi_ex_exit_interpreter(); @@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphor status2 = acpi_ex_enter_interpreter(); if (ACPI_FAILURE(status2)) { + /* Report fatal error, could not acquire interpreter */ return_ACPI_STATUS(status2); diff -puN drivers/acpi/executer/exutils.c~git-acpi drivers/acpi/executer/exutils.c --- devel/drivers/acpi/executer/exutils.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/executer/exutils.c 2006-04-26 13:41:00.000000000 -0700 @@ -194,6 +194,7 @@ u8 acpi_ex_acquire_global_lock(u32 field /* Only attempt lock if the always_lock bit is set */ if (field_flags & AML_FIELD_LOCK_RULE_MASK) { + /* We should attempt to get the lock, wait forever */ status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); @@ -230,10 +231,12 @@ void acpi_ex_release_global_lock(u8 lock /* Only attempt unlock if the caller locked it */ if (locked_by_me) { + /* OK, now release the lock */ status = acpi_ev_release_global_lock(); if (ACPI_FAILURE(status)) { + /* Report the error, but there isn't much else we can do */ ACPI_EXCEPTION((AE_INFO, status, diff -puN drivers/acpi/fan.c~git-acpi drivers/acpi/fan.c --- devel/drivers/acpi/fan.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/fan.c 2006-04-26 13:41:00.000000000 -0700 @@ -149,9 +149,7 @@ static int acpi_fan_add_fs(struct acpi_d S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_FAN_FILE_STATE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_fan_state_ops; entry->data = acpi_driver_data(device); @@ -201,8 +199,7 @@ static int acpi_fan_add(struct acpi_devi result = acpi_bus_get_power(fan->handle, &state); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading power state\n")); + ACPI_ERROR((AE_INFO, "Reading power state")); goto end; } diff -puN drivers/acpi/hardware/hwgpe.c~git-acpi drivers/acpi/hardware/hwgpe.c --- devel/drivers/acpi/hardware/hwgpe.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/hardware/hwgpe.c 2006-04-26 13:41:00.000000000 -0700 @@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gp /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { + /* Disable all GPEs in this register */ status = acpi_hw_low_level_write(8, 0x00, @@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_ /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { + /* Clear status on all GPEs in this register */ status = acpi_hw_low_level_write(8, 0xFF, diff -puN drivers/acpi/hardware/hwregs.c~git-acpi drivers/acpi/hardware/hwregs.c --- devel/drivers/acpi/hardware/hwregs.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/hardware/hwregs.c 2006-04-26 13:41:00.000000000 -0700 @@ -43,8 +43,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -220,7 +218,7 @@ acpi_get_sleep_type_data(u8 sleep_state, return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_sleep_type_data); +ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) /******************************************************************************* * @@ -233,7 +231,6 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); * DESCRIPTION: Map register_id into a register bitmask. * ******************************************************************************/ - struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) { ACPI_FUNCTION_ENTRY(); @@ -295,6 +292,7 @@ acpi_status acpi_get_register(u32 regist } if (ACPI_SUCCESS(status)) { + /* Normalize the value that was read */ register_value = @@ -311,7 +309,7 @@ acpi_status acpi_get_register(u32 regist return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_register); +ACPI_EXPORT_SYMBOL(acpi_get_register) /******************************************************************************* * @@ -327,7 +325,6 @@ EXPORT_SYMBOL(acpi_get_register); * DESCRIPTION: ACPI Bit Register write function. * ******************************************************************************/ - acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) { u32 register_value = 0; @@ -474,7 +471,7 @@ acpi_status acpi_set_register(u32 regist return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_set_register); +ACPI_EXPORT_SYMBOL(acpi_set_register) /****************************************************************************** * @@ -490,7 +487,6 @@ EXPORT_SYMBOL(acpi_set_register); * given offset. * ******************************************************************************/ - acpi_status acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) { diff -puN drivers/acpi/hardware/hwsleep.c~git-acpi drivers/acpi/hardware/hwsleep.c --- devel/drivers/acpi/hardware/hwsleep.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/hardware/hwsleep.c 2006-04-26 13:41:00.000000000 -0700 @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include #include #define _COMPONENT ACPI_HARDWARE @@ -79,6 +78,8 @@ acpi_set_firmware_waking_vector(acpi_phy return_ACPI_STATUS(AE_OK); } +ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) + /******************************************************************************* * * FUNCTION: acpi_get_firmware_waking_vector @@ -92,7 +93,6 @@ acpi_set_firmware_waking_vector(acpi_phy * DESCRIPTION: Access function for the firmware_waking_vector field in FACS * ******************************************************************************/ - #ifdef ACPI_FUTURE_USAGE acpi_status acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) @@ -118,6 +118,8 @@ acpi_get_firmware_waking_vector(acpi_phy return_ACPI_STATUS(AE_OK); } + +ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) #endif /******************************************************************************* @@ -134,7 +136,6 @@ acpi_get_firmware_waking_vector(acpi_phy * various OS-specific tasks between the two steps. * ******************************************************************************/ - acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) { acpi_status status; @@ -206,6 +207,8 @@ acpi_status acpi_enter_sleep_state_prep( return_ACPI_STATUS(AE_OK); } +ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) + /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state @@ -218,7 +221,6 @@ acpi_status acpi_enter_sleep_state_prep( * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ - acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) { u32 PM1Acontrol; @@ -378,7 +380,7 @@ acpi_status asmlinkage acpi_enter_sleep_ return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_enter_sleep_state); +ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) /******************************************************************************* * @@ -392,7 +394,6 @@ EXPORT_SYMBOL(acpi_enter_sleep_state); * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ - acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) { u32 in_value; @@ -443,7 +444,7 @@ acpi_status asmlinkage acpi_enter_sleep_ return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); +ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) /******************************************************************************* * @@ -457,7 +458,6 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4b * Called with interrupts ENABLED. * ******************************************************************************/ - acpi_status acpi_leave_sleep_state(u8 sleep_state) { struct acpi_object_list arg_list; @@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sl ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); if (ACPI_SUCCESS(status)) { + /* Clear SLP_EN and SLP_TYP fields */ PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | @@ -583,3 +584,5 @@ acpi_status acpi_leave_sleep_state(u8 sl return_ACPI_STATUS(status); } + +ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state) diff -puN drivers/acpi/hardware/hwtimer.c~git-acpi drivers/acpi/hardware/hwtimer.c --- devel/drivers/acpi/hardware/hwtimer.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/hardware/hwtimer.c 2006-04-26 13:41:00.000000000 -0700 @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include #include #define _COMPONENT ACPI_HARDWARE @@ -76,6 +75,8 @@ acpi_status acpi_get_timer_resolution(u3 return_ACPI_STATUS(AE_OK); } +ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution) + /****************************************************************************** * * FUNCTION: acpi_get_timer @@ -87,7 +88,6 @@ acpi_status acpi_get_timer_resolution(u3 * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). * ******************************************************************************/ - acpi_status acpi_get_timer(u32 * ticks) { acpi_status status; @@ -103,7 +103,7 @@ acpi_status acpi_get_timer(u32 * ticks) return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_timer); +ACPI_EXPORT_SYMBOL(acpi_get_timer) /****************************************************************************** * @@ -133,7 +133,6 @@ EXPORT_SYMBOL(acpi_get_timer); * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes * ******************************************************************************/ - acpi_status acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) { @@ -155,6 +154,7 @@ acpi_get_timer_duration(u32 start_ticks, delta_ticks = end_ticks - start_ticks; } else if (start_ticks > end_ticks) { if (0 == acpi_gbl_FADT->tmr_val_ext) { + /* 24-bit Timer */ delta_ticks = @@ -183,4 +183,4 @@ acpi_get_timer_duration(u32 start_ticks, return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_timer_duration); +ACPI_EXPORT_SYMBOL(acpi_get_timer_duration) diff -puN drivers/acpi/hotkey.c~git-acpi drivers/acpi/hotkey.c --- devel/drivers/acpi/hotkey.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/hotkey.c 2006-04-26 13:41:00.000000000 -0700 @@ -356,9 +356,6 @@ static int create_polling_proc(union acp proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); if (!proc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - device->poll_hotkey.poll_method)); return_VALUE(-ENODEV); } else { proc->proc_fops = &hotkey_polling_fops; @@ -723,6 +720,8 @@ get_parms(char *config_record, goto do_fail; count = tmp1 - tmp; *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); + if (!*action_handle) + goto do_fail; strncpy(*action_handle, tmp, count); *(*action_handle + count) = 0; @@ -769,7 +768,7 @@ static ssize_t hotkey_write_config(struc if (copy_from_user(config_record, buffer, count)) { kfree(config_record); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); + ACPI_ERROR((AE_INFO, "Invalid data")); return_VALUE(-EINVAL); } config_record[count] = 0; @@ -790,8 +789,7 @@ static ssize_t hotkey_write_config(struc kfree(bus_method); kfree(action_handle); kfree(method); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid data format ret=%d\n", ret)); + ACPI_ERROR((AE_INFO, "Invalid data format ret=%d", ret)); return_VALUE(-EINVAL); } @@ -804,7 +802,7 @@ static ssize_t hotkey_write_config(struc tmp = get_hotkey_by_event(&global_hotkey_list, internal_event_num); if (!tmp) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key")); + ACPI_ERROR((AE_INFO, "Invalid key")); else memcpy(key, tmp, sizeof(union acpi_hotkey)); goto cont_cmd; @@ -826,7 +824,7 @@ static ssize_t hotkey_write_config(struc else free_poll_hotkey_buffer(key); kfree(key); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); + ACPI_ERROR((AE_INFO, "Invalid hotkey")); return_VALUE(-EINVAL); } @@ -860,7 +858,7 @@ static ssize_t hotkey_write_config(struc else free_poll_hotkey_buffer(key); kfree(key); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "invalid key\n")); + ACPI_ERROR((AE_INFO, "invalid key")); return_VALUE(-EINVAL); } @@ -905,7 +903,7 @@ static int read_acpi_int(acpi_handle han val->integer.value = out_obj.integer.value; val->type = out_obj.type; } else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "null val pointer")); + ACPI_ERROR((AE_INFO, "null val pointer")); return_VALUE((status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER)); } @@ -952,14 +950,14 @@ static ssize_t hotkey_execute_aml_method if (copy_from_user(arg, buffer, count)) { kfree(arg); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); + ACPI_ERROR((AE_INFO, "Invalid argument 2")); return_VALUE(-EINVAL); } if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { kfree(arg); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); + ACPI_ERROR((AE_INFO, "Invalid argument 3")); return_VALUE(-EINVAL); } kfree(arg); @@ -985,7 +983,7 @@ static ssize_t hotkey_execute_aml_method } } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); + ACPI_WARNING((AE_INFO, "Not supported")); return_VALUE(-EINVAL); } return_VALUE(count); @@ -1011,9 +1009,6 @@ static int __init hotkey_init(void) hotkey_proc_dir = proc_mkdir(HOTKEY_PROC, acpi_root_dir); if (!hotkey_proc_dir) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_PROC)); return (-ENODEV); } hotkey_proc_dir->owner = THIS_MODULE; @@ -1021,9 +1016,6 @@ static int __init hotkey_init(void) hotkey_config = create_proc_entry(HOTKEY_EV_CONFIG, mode, hotkey_proc_dir); if (!hotkey_config) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_EV_CONFIG)); goto do_fail1; } else { hotkey_config->proc_fops = &hotkey_config_fops; @@ -1036,10 +1028,6 @@ static int __init hotkey_init(void) hotkey_poll_config = create_proc_entry(HOTKEY_PL_CONFIG, mode, hotkey_proc_dir); if (!hotkey_poll_config) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_EV_CONFIG)); - goto do_fail2; } else { hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; @@ -1051,9 +1039,6 @@ static int __init hotkey_init(void) hotkey_action = create_proc_entry(HOTKEY_ACTION, mode, hotkey_proc_dir); if (!hotkey_action) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_ACTION)); goto do_fail3; } else { hotkey_action->proc_fops = &hotkey_action_fops; @@ -1064,9 +1049,6 @@ static int __init hotkey_init(void) hotkey_info = create_proc_entry(HOTKEY_INFO, mode, hotkey_proc_dir); if (!hotkey_info) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_INFO)); goto do_fail4; } else { hotkey_info->proc_fops = &hotkey_info_fops; diff -puN drivers/acpi/Kconfig~git-acpi drivers/acpi/Kconfig --- devel/drivers/acpi/Kconfig~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/Kconfig 2006-04-26 13:41:00.000000000 -0700 @@ -10,9 +10,8 @@ menu "ACPI (Advanced Configuration and P config ACPI bool "ACPI Support" depends on IA64 || X86 + depends on PCI select PM - select PCI - default y ---help--- Advanced Configuration and Power Interface (ACPI) support for diff -puN drivers/acpi/motherboard.c~git-acpi drivers/acpi/motherboard.c --- devel/drivers/acpi/motherboard.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/motherboard.c 2006-04-26 13:41:00.000000000 -0700 @@ -37,7 +37,7 @@ ACPI_MODULE_NAME("acpi_motherboard") #define ACPI_MB_HID2 "PNP0C02" /** * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved - * Doesn't care about the failure of 'request_region', since other may reserve + * Doesn't care about the failure of 'request_region', since other may reserve * the io ports as well */ #define IS_RESERVED_ADDR(base, len) \ @@ -46,7 +46,7 @@ ACPI_MODULE_NAME("acpi_motherboard") /* * Clearing the flag (IORESOURCE_BUSY) allows drivers to use * the io ports if they really know they can use it, while - * still preventing hotplug PCI devices from using it. + * still preventing hotplug PCI devices from using it. */ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) { @@ -123,49 +123,54 @@ static struct acpi_driver acpi_motherboa }, }; +static void __init acpi_request_region (struct acpi_generic_address *addr, + unsigned int length, char *desc) +{ + if (!addr->address || !length) + return; + + if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO) + request_region(addr->address, length, desc); + else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) + request_mem_region(addr->address, length, desc); +} + static void __init acpi_reserve_resources(void) { - if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) - request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, - acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); - - if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) - request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, - acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); - - if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) - request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, - acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); - - if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) - request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, - acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); - - if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) - request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); - - if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) - request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, - acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); + acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk, + acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK"); + + acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk, + acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK"); + + acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk, + acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK"); + + acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk, + acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK"); + + if (acpi_gbl_FADT->pm_tm_len == 4) + acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR"); + + acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk, + acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK"); /* Length of GPE blocks must be a non-negative multiple of 2 */ - if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && - !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) - request_region(acpi_gbl_FADT->xgpe0_blk.address, - acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); - - if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && - !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) - request_region(acpi_gbl_FADT->xgpe1_blk.address, - acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); + if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1)) + acpi_request_region(&acpi_gbl_FADT->xgpe0_blk, + acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK"); + + if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1)) + acpi_request_region(&acpi_gbl_FADT->xgpe1_blk, + acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK"); } static int __init acpi_motherboard_init(void) { acpi_bus_register_driver(&acpi_motherboard_driver1); acpi_bus_register_driver(&acpi_motherboard_driver2); - /* + /* * Guarantee motherboard IO reservation first * This module must run after scan.c */ diff -puN drivers/acpi/namespace/nsaccess.c~git-acpi drivers/acpi/namespace/nsaccess.c --- devel/drivers/acpi/namespace/nsaccess.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsaccess.c 2006-04-26 13:41:00.000000000 -0700 @@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void "Entering predefined entries into namespace\n")); for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { + /* _OSI is optional for now, will be permanent later */ if (!ACPI_STRCMP(init_val->name, "_OSI") @@ -346,14 +347,17 @@ acpi_ns_lookup(union acpi_generic_state return_ACPI_STATUS(AE_AML_INTERNAL); } - /* - * This node might not be a actual "scope" node (such as a - * Device/Method, etc.) It could be a Package or other object node. - * Backup up the tree to find the containing scope node. - */ - while (!acpi_ns_opens_scope(prefix_node->type) && - prefix_node->type != ACPI_TYPE_ANY) { - prefix_node = acpi_ns_get_parent_node(prefix_node); + if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { + /* + * This node might not be a actual "scope" node (such as a + * Device/Method, etc.) It could be a Package or other object node. + * Backup up the tree to find the containing scope node. + */ + while (!acpi_ns_opens_scope(prefix_node->type) && + prefix_node->type != ACPI_TYPE_ANY) { + prefix_node = + acpi_ns_get_parent_node(prefix_node); + } } } @@ -365,6 +369,7 @@ acpi_ns_lookup(union acpi_generic_state * Begin examination of the actual pathname */ if (!pathname) { + /* A Null name_path is allowed and refers to the root */ num_segments = 0; @@ -389,6 +394,7 @@ acpi_ns_lookup(union acpi_generic_state * to the current scope). */ if (*path == (u8) AML_ROOT_PREFIX) { + /* Pathname is fully qualified, start from the root */ this_node = acpi_gbl_root_node; @@ -416,6 +422,7 @@ acpi_ns_lookup(union acpi_generic_state this_node = prefix_node; num_carats = 0; while (*path == (u8) AML_PARENT_PREFIX) { + /* Name is fully qualified, no search rules apply */ search_parent_flag = ACPI_NS_NO_UPSEARCH; @@ -430,6 +437,7 @@ acpi_ns_lookup(union acpi_generic_state num_carats++; this_node = acpi_ns_get_parent_node(this_node); if (!this_node) { + /* Current scope has no parent scope */ ACPI_ERROR((AE_INFO, @@ -569,6 +577,7 @@ acpi_ns_lookup(union acpi_generic_state &this_node); if (ACPI_FAILURE(status)) { if (status == AE_NOT_FOUND) { + /* Name not found in ACPI namespace */ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, @@ -602,6 +611,7 @@ acpi_ns_lookup(union acpi_generic_state (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && (this_node->type != ACPI_TYPE_ANY) && (this_node->type != type_to_check_for)) { + /* Complain about a type mismatch */ ACPI_WARNING((AE_INFO, diff -puN drivers/acpi/namespace/nsalloc.c~git-acpi drivers/acpi/namespace/nsalloc.c --- devel/drivers/acpi/namespace/nsalloc.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsalloc.c 2006-04-26 13:41:00.000000000 -0700 @@ -68,7 +68,7 @@ struct acpi_namespace_node *acpi_ns_crea ACPI_FUNCTION_TRACE("ns_create_node"); - node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node)); + node = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node)); if (!node) { return_PTR(NULL); } @@ -115,6 +115,7 @@ void acpi_ns_delete_node(struct acpi_nam } if (prev_node) { + /* Node is not first child, unlink it */ prev_node->peer = next_node->peer; @@ -125,6 +126,7 @@ void acpi_ns_delete_node(struct acpi_nam /* Node is first child (has no previous peer) */ if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { + /* No peers at all */ parent_node->child = NULL; @@ -140,7 +142,7 @@ void acpi_ns_delete_node(struct acpi_nam * Detach an object if there is one then delete the node */ acpi_ns_detach_object(node); - ACPI_MEM_FREE(node); + ACPI_FREE(node); return_VOID; } @@ -264,6 +266,7 @@ void acpi_ns_delete_children(struct acpi * Deallocate all children at this level */ do { + /* Get the things we need */ next_node = child_node->peer; @@ -308,7 +311,7 @@ void acpi_ns_delete_children(struct acpi /* Now we can delete the node */ - ACPI_MEM_FREE(child_node); + ACPI_FREE(child_node); /* And move on to the next child in the list */ @@ -352,11 +355,13 @@ void acpi_ns_delete_namespace_subtree(st * to where we started. */ while (level > 0) { + /* Get the next node in this scope (NULL if none) */ child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, child_node); if (child_node) { + /* Found a child node - detach any attached object */ acpi_ns_detach_object(child_node); @@ -427,6 +432,7 @@ static void acpi_ns_remove_reference(str */ this_node = node; while (this_node) { + /* Prepare to move up to parent */ parent_node = acpi_ns_get_parent_node(this_node); @@ -438,6 +444,7 @@ static void acpi_ns_remove_reference(str /* Delete the node if no more references */ if (!this_node->reference_count) { + /* Delete all children and delete the node */ acpi_ns_delete_children(this_node); @@ -500,6 +507,7 @@ void acpi_ns_delete_namespace_by_owner(a if (child_node) { if (child_node->owner_id == owner_id) { + /* Found a matching child node - detach any attached object */ acpi_ns_detach_object(child_node); diff -puN drivers/acpi/namespace/nsdump.c~git-acpi drivers/acpi/namespace/nsdump.c --- devel/drivers/acpi/namespace/nsdump.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsdump.c 2006-04-26 13:41:00.000000000 -0700 @@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_ } if (!(info->display_type & ACPI_DISPLAY_SHORT)) { + /* Indent the object according to the level */ acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); @@ -226,6 +227,7 @@ acpi_ns_dump_one_object(acpi_handle obj_ case ACPI_DISPLAY_SUMMARY: if (!obj_desc) { + /* No attached object, we are done */ acpi_os_printf("\n"); @@ -419,6 +421,7 @@ acpi_ns_dump_one_object(acpi_handle obj_ acpi_os_printf("O:%p", obj_desc); if (!obj_desc) { + /* No attached object, we are done */ acpi_os_printf("\n"); @@ -682,6 +685,7 @@ void acpi_ns_dump_tables(acpi_handle sea } if (ACPI_NS_ALL == search_base) { + /* Entire namespace */ search_handle = acpi_gbl_root_node; diff -puN drivers/acpi/namespace/nsdumpdv.c~git-acpi drivers/acpi/namespace/nsdumpdv.c --- devel/drivers/acpi/namespace/nsdumpdv.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsdumpdv.c 2006-04-26 13:41:00.000000000 -0700 @@ -92,7 +92,7 @@ acpi_ns_dump_one_device(acpi_handle obj_ info->hardware_id.value, ACPI_FORMAT_UINT64(info->address), info->current_status)); - ACPI_MEM_FREE(info); + ACPI_FREE(info); } return (status); diff -puN drivers/acpi/namespace/nseval.c~git-acpi drivers/acpi/namespace/nseval.c --- devel/drivers/acpi/namespace/nseval.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nseval.c 2006-04-26 13:41:00.000000000 -0700 @@ -151,7 +151,7 @@ acpi_ns_evaluate_relative(char *pathname acpi_ut_delete_generic_state(scope_info); cleanup1: - ACPI_MEM_FREE(internal_path); + ACPI_FREE(internal_path); return_ACPI_STATUS(status); } @@ -228,7 +228,7 @@ acpi_ns_evaluate_by_name(char *pathname, /* Cleanup */ if (internal_path) { - ACPI_MEM_FREE(internal_path); + ACPI_FREE(internal_path); } return_ACPI_STATUS(status); @@ -326,6 +326,7 @@ acpi_status acpi_ns_evaluate_by_handle(s * Check if there is a return value on the stack that must be dealt with */ if (status == AE_CTRL_RETURN_VALUE) { + /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ status = AE_OK; diff -puN drivers/acpi/namespace/nsinit.c~git-acpi drivers/acpi/namespace/nsinit.c --- devel/drivers/acpi/namespace/nsinit.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsinit.c 2006-04-26 13:41:00.000000000 -0700 @@ -366,6 +366,7 @@ acpi_ns_init_one_device(acpi_handle obj_ status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), device_node, ACPI_TYPE_METHOD, &ini_node); if (ACPI_FAILURE(status)) { + /* No _INI method found - move on to next device */ return_ACPI_STATUS(AE_OK); @@ -386,6 +387,7 @@ acpi_ns_init_one_device(acpi_handle obj_ status = acpi_ut_execute_STA(pinfo.node, &flags); if (ACPI_FAILURE(status)) { + /* Ignore error and move on to next device */ return_ACPI_STATUS(AE_OK); @@ -396,6 +398,7 @@ acpi_ns_init_one_device(acpi_handle obj_ } if (!(flags & ACPI_STA_DEVICE_PRESENT)) { + /* Don't look at children of a not present device */ return_ACPI_STATUS(AE_CTRL_DEPTH); @@ -412,6 +415,7 @@ acpi_ns_init_one_device(acpi_handle obj_ pinfo.node = ini_node; status = acpi_ns_evaluate_by_handle(&pinfo); if (ACPI_FAILURE(status)) { + /* Ignore error and move on to next device */ #ifdef ACPI_DEBUG_OUTPUT @@ -420,7 +424,7 @@ acpi_ns_init_one_device(acpi_handle obj_ ACPI_WARNING((AE_INFO, "%s._INI failed: %s", scope_name, acpi_format_exception(status))); - ACPI_MEM_FREE(scope_name); + ACPI_FREE(scope_name); #endif } else { /* Delete any return object (especially if implicit_return is enabled) */ @@ -435,6 +439,7 @@ acpi_ns_init_one_device(acpi_handle obj_ } if (acpi_gbl_init_handler) { + /* External initialization handler is present, call it */ status = diff -puN drivers/acpi/namespace/nsload.c~git-acpi drivers/acpi/namespace/nsload.c --- devel/drivers/acpi/namespace/nsload.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsload.c 2006-04-26 13:41:00.000000000 -0700 @@ -84,6 +84,7 @@ acpi_ns_load_table(struct acpi_table_des if (! (acpi_gbl_table_data[table_desc->type]. flags & ACPI_TABLE_EXECUTABLE)) { + /* Just ignore this table */ return_ACPI_STATUS(AE_OK); @@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtre * to where we started. */ while (level > 0) { + /* Attempt to get the next object in this scope */ status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, @@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtre /* Did we get a new object? */ if (ACPI_SUCCESS(status)) { + /* Check if this object has any children */ if (ACPI_SUCCESS diff -puN drivers/acpi/namespace/nsnames.c~git-acpi drivers/acpi/namespace/nsnames.c --- devel/drivers/acpi/namespace/nsnames.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsnames.c 2006-04-26 13:41:00.000000000 -0700 @@ -48,11 +48,6 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsnames") -/* Local prototypes */ -static void -acpi_ns_build_external_path(struct acpi_namespace_node *node, - acpi_size size, char *name_buffer); - /******************************************************************************* * * FUNCTION: acpi_ns_build_external_path @@ -67,8 +62,7 @@ acpi_ns_build_external_path(struct acpi_ * DESCRIPTION: Generate a full pathaname * ******************************************************************************/ - -static void +void acpi_ns_build_external_path(struct acpi_namespace_node *node, acpi_size size, char *name_buffer) { @@ -146,7 +140,7 @@ char *acpi_ns_get_external_pathname(stru /* Allocate a buffer to be returned to caller */ - name_buffer = ACPI_MEM_CALLOCATE(size); + name_buffer = ACPI_ALLOCATE_ZEROED(size); if (!name_buffer) { ACPI_ERROR((AE_INFO, "Allocation failure")); return_PTR(NULL); diff -puN drivers/acpi/namespace/nsobject.c~git-acpi drivers/acpi/namespace/nsobject.c --- devel/drivers/acpi/namespace/nsobject.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsobject.c 2006-04-26 13:41:00.000000000 -0700 @@ -82,6 +82,7 @@ acpi_ns_attach_object(struct acpi_namesp * Parameter validation */ if (!node) { + /* Invalid handle */ ACPI_ERROR((AE_INFO, "Null named_obj handle")); @@ -89,6 +90,7 @@ acpi_ns_attach_object(struct acpi_namesp } if (!object && (ACPI_TYPE_ANY != type)) { + /* Null object */ ACPI_ERROR((AE_INFO, @@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namesp } if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { + /* Not a name handle */ ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", diff -puN drivers/acpi/namespace/nsparse.c~git-acpi drivers/acpi/namespace/nsparse.c --- devel/drivers/acpi/namespace/nsparse.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsparse.c 2006-04-26 13:41:00.000000000 -0700 @@ -62,7 +62,7 @@ ACPI_MODULE_NAME("nsparse") * ******************************************************************************/ acpi_status -acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) +acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) { union acpi_parse_object *parse_root; acpi_status status; diff -puN drivers/acpi/namespace/nssearch.c~git-acpi drivers/acpi/namespace/nssearch.c --- devel/drivers/acpi/namespace/nssearch.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nssearch.c 2006-04-26 13:41:00.000000000 -0700 @@ -103,7 +103,7 @@ acpi_ns_search_node(u32 target_name, &target_name), acpi_ut_get_type_name(type))); - ACPI_MEM_FREE(scope_name); + ACPI_FREE(scope_name); } } #endif @@ -114,9 +114,11 @@ acpi_ns_search_node(u32 target_name, */ next_node = node->child; while (next_node) { + /* Check for match against the name */ if (next_node->name.integer == target_name) { + /* Resolve a control method alias if any */ if (acpi_ns_get_type(next_node) == @@ -146,6 +148,7 @@ acpi_ns_search_node(u32 target_name, * so a flag is used to indicate the end-of-list */ if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { + /* Searched entire list, we are done */ break; diff -puN drivers/acpi/namespace/nsutils.c~git-acpi drivers/acpi/namespace/nsutils.c --- devel/drivers/acpi/namespace/nsutils.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsutils.c 2006-04-26 13:41:00.000000000 -0700 @@ -78,15 +78,17 @@ acpi_ns_report_error(char *module_name, char *internal_name, acpi_status lookup_status) { acpi_status status; + u32 bad_name; char *name = NULL; acpi_ut_report_error(module_name, line_number); if (lookup_status == AE_BAD_CHARACTER) { + /* There is a non-ascii character in the name */ - acpi_os_printf("[0x%4.4X] (NON-ASCII)", - *(ACPI_CAST_PTR(u32, internal_name))); + ACPI_MOVE_32_TO_32(&bad_name, internal_name); + acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); } else { /* Convert path to external format */ @@ -102,7 +104,7 @@ acpi_ns_report_error(char *module_name, } if (name) { - ACPI_MEM_FREE(name); + ACPI_FREE(name); } } @@ -185,7 +187,7 @@ acpi_ns_print_node_pathname(struct acpi_ } acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); - ACPI_MEM_FREE(buffer.pointer); + ACPI_FREE(buffer.pointer); } } @@ -267,6 +269,7 @@ u32 acpi_ns_local(acpi_object_type type) ACPI_FUNCTION_TRACE("ns_local"); if (!acpi_ut_valid_object_type(type)) { + /* Type code out of range */ ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); @@ -411,6 +414,7 @@ acpi_status acpi_ns_build_internal_name( for (i = 0; i < ACPI_NAME_SIZE; i++) { if (acpi_ns_valid_path_separator(*external_name) || (*external_name == 0)) { + /* Pad the segment with underscore(s) if segment is short */ result[i] = '_'; @@ -486,7 +490,7 @@ acpi_status acpi_ns_internalize_name(cha /* We need a segment to store the internal name */ - internal_name = ACPI_MEM_CALLOCATE(info.length); + internal_name = ACPI_ALLOCATE_ZEROED(info.length); if (!internal_name) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -496,7 +500,7 @@ acpi_status acpi_ns_internalize_name(cha info.internal_name = internal_name; status = acpi_ns_build_internal_name(&info); if (ACPI_FAILURE(status)) { - ACPI_MEM_FREE(internal_name); + ACPI_FREE(internal_name); return_ACPI_STATUS(status); } @@ -628,7 +632,7 @@ acpi_ns_externalize_name(u32 internal_na /* * Build converted_name */ - *converted_name = ACPI_MEM_CALLOCATE(required_length); + *converted_name = ACPI_ALLOCATE_ZEROED(required_length); if (!(*converted_name)) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -795,6 +799,7 @@ u32 acpi_ns_opens_scope(acpi_object_type ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); if (!acpi_ut_valid_object_type(type)) { + /* type code out of range */ ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); @@ -838,6 +843,7 @@ acpi_ns_get_node_by_path(char *pathname, ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); if (pathname) { + /* Convert path to internal representation */ status = acpi_ns_internalize_name(pathname, &internal_path); @@ -873,7 +879,7 @@ acpi_ns_get_node_by_path(char *pathname, cleanup: if (internal_path) { - ACPI_MEM_FREE(internal_path); + ACPI_FREE(internal_path); } return_ACPI_STATUS(status); } @@ -963,6 +969,7 @@ acpi_name acpi_ns_find_parent_name(struc ACPI_FUNCTION_TRACE("ns_find_parent_name"); if (child_node) { + /* Valid entry. Get the parent Node */ parent_node = acpi_ns_get_parent_node(child_node); diff -puN drivers/acpi/namespace/nswalk.c~git-acpi drivers/acpi/namespace/nswalk.c --- devel/drivers/acpi/namespace/nswalk.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nswalk.c 2006-04-26 13:41:00.000000000 -0700 @@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_ ACPI_FUNCTION_ENTRY(); if (!child_node) { + /* It's really the parent's _scope_ that we want */ if (parent_node->child) { @@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_ /* If any type is OK, we are done */ if (type == ACPI_TYPE_ANY) { + /* next_node is NULL if we are at the end-of-list */ return (next_node); @@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_ /* Must search for the node -- but within this scope only */ while (next_node) { + /* If type matches, we are done */ if (next_node->type == type) { @@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type * bubbled up to (and passed) the original parent handle (start_entry) */ while (level > 0) { + /* Get the next node in this scope. Null if not found */ status = AE_OK; diff -puN drivers/acpi/namespace/nsxfeval.c~git-acpi drivers/acpi/namespace/nsxfeval.c --- devel/drivers/acpi/namespace/nsxfeval.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsxfeval.c 2006-04-26 13:41:00.000000000 -0700 @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -51,6 +49,7 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsxfeval") +#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * * FUNCTION: acpi_evaluate_object_typed @@ -71,12 +70,11 @@ ACPI_MODULE_NAME("nsxfeval") * be valid (non-null) * ******************************************************************************/ -#ifdef ACPI_FUTURE_USAGE acpi_status acpi_evaluate_object_typed(acpi_handle handle, acpi_string pathname, - struct acpi_object_list *external_params, - struct acpi_buffer *return_buffer, + struct acpi_object_list * external_params, + struct acpi_buffer * return_buffer, acpi_object_type return_type) { acpi_status status; @@ -110,6 +108,7 @@ acpi_evaluate_object_typed(acpi_handle h } if (return_buffer->length == 0) { + /* Error because caller specifically asked for a return value */ ACPI_ERROR((AE_INFO, "No return value")); @@ -131,6 +130,7 @@ acpi_evaluate_object_typed(acpi_handle h acpi_ut_get_type_name(return_type))); if (must_free) { + /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ acpi_os_free(return_buffer->pointer); @@ -140,6 +140,8 @@ acpi_evaluate_object_typed(acpi_handle h return_buffer->length = 0; return_ACPI_STATUS(AE_TYPE); } + +ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -161,7 +163,6 @@ acpi_evaluate_object_typed(acpi_handle h * be valid (non-null) * ******************************************************************************/ - acpi_status acpi_evaluate_object(acpi_handle handle, acpi_string pathname, @@ -191,9 +192,9 @@ acpi_evaluate_object(acpi_handle handle, * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list */ - info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) - external_params->count + - 1) * sizeof(void *)); + info.parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) + external_params->count + + 1) * sizeof(void *)); if (!info.parameters) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -224,9 +225,9 @@ acpi_evaluate_object(acpi_handle handle, * 3) Valid handle */ if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { - /* - * The path is fully qualified, just evaluate by name - */ + + /* The path is fully qualified, just evaluate by name */ + status = acpi_ns_evaluate_by_name(pathname, &info); } else if (!handle) { /* @@ -235,11 +236,12 @@ acpi_evaluate_object(acpi_handle handle, * qualified names above, this is an error */ if (!pathname) { - ACPI_ERROR((AE_INFO, - "Both Handle and Pathname are NULL")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Both Handle and Pathname are NULL")); } else { - ACPI_ERROR((AE_INFO, - "Handle is NULL and Pathname is relative")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Null Handle with relative pathname [%s]", + pathname)); } status = AE_BAD_PARAMETER; @@ -256,9 +258,8 @@ acpi_evaluate_object(acpi_handle handle, */ status = acpi_ns_evaluate_by_handle(&info); } else { - /* - * Both a Handle and a relative Pathname - */ + /* Both a Handle and a relative Pathname */ + status = acpi_ns_evaluate_relative(pathname, &info); } } @@ -295,6 +296,7 @@ acpi_evaluate_object(acpi_handle handle, acpi_ut_get_object_size(info.return_object, &buffer_space_needed); if (ACPI_SUCCESS(status)) { + /* Validate/Allocate/Clear caller buffer */ status = @@ -303,7 +305,8 @@ acpi_evaluate_object(acpi_handle handle, buffer_space_needed); if (ACPI_FAILURE(status)) { /* - * Caller's buffer is too small or a new one can't be allocated + * Caller's buffer is too small or a new one can't + * be allocated */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Needed buffer size %X, %s\n", @@ -312,9 +315,8 @@ acpi_evaluate_object(acpi_handle handle, acpi_format_exception (status))); } else { - /* - * We have enough space for the object, build it - */ + /* We have enough space for the object, build it */ + status = acpi_ut_copy_iobject_to_eobject (info.return_object, @@ -341,10 +343,10 @@ acpi_evaluate_object(acpi_handle handle, } } - /* - * Free the input parameter list (if we created one), - */ + /* Free the input parameter list (if we created one) */ + if (info.parameters) { + /* Free the allocated parameter block */ acpi_ut_delete_internal_object_list(info.parameters); @@ -353,7 +355,7 @@ acpi_evaluate_object(acpi_handle handle, return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_evaluate_object); +ACPI_EXPORT_SYMBOL(acpi_evaluate_object) /******************************************************************************* * @@ -384,7 +386,6 @@ EXPORT_SYMBOL(acpi_evaluate_object); * function, etc. * ******************************************************************************/ - acpi_status acpi_walk_namespace(acpi_object_type type, acpi_handle start_object, @@ -421,7 +422,7 @@ acpi_walk_namespace(acpi_object_type typ return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_walk_namespace); +ACPI_EXPORT_SYMBOL(acpi_walk_namespace) /******************************************************************************* * @@ -436,7 +437,6 @@ EXPORT_SYMBOL(acpi_walk_namespace); * on that. * ******************************************************************************/ - static acpi_status acpi_ns_get_device_callback(acpi_handle obj_handle, u32 nesting_level, @@ -473,6 +473,7 @@ acpi_ns_get_device_callback(acpi_handle } if (!(flags & ACPI_STA_DEVICE_PRESENT)) { + /* Don't examine children of the device if not present */ return (AE_CTRL_DEPTH); @@ -489,6 +490,7 @@ acpi_ns_get_device_callback(acpi_handle } if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { + /* Get the list of Compatible IDs */ status = acpi_ut_execute_CID(node, &cid); @@ -505,11 +507,11 @@ acpi_ns_get_device_callback(acpi_handle sizeof(struct acpi_compatible_id)) != 0) { - ACPI_MEM_FREE(cid); + ACPI_FREE(cid); return (AE_OK); } } - ACPI_MEM_FREE(cid); + ACPI_FREE(cid); } } @@ -563,9 +565,9 @@ acpi_get_devices(char *HID, * We're going to call their callback from OUR callback, so we need * to know what it is, and their context parameter. */ + info.hid = HID; info.context = context; info.user_function = user_function; - info.hid = HID; /* * Lock the namespace around the walk. @@ -578,9 +580,8 @@ acpi_get_devices(char *HID, return_ACPI_STATUS(status); } - status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, + status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ns_get_device_callback, &info, return_value); @@ -588,7 +589,7 @@ acpi_get_devices(char *HID, return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_devices); +ACPI_EXPORT_SYMBOL(acpi_get_devices) /******************************************************************************* * @@ -603,7 +604,6 @@ EXPORT_SYMBOL(acpi_get_devices); * DESCRIPTION: Attach arbitrary data and handler to a namespace node. * ******************************************************************************/ - acpi_status acpi_attach_data(acpi_handle obj_handle, acpi_object_handler handler, void *data) @@ -637,6 +637,8 @@ acpi_attach_data(acpi_handle obj_handle, return (status); } +ACPI_EXPORT_SYMBOL(acpi_attach_data) + /******************************************************************************* * * FUNCTION: acpi_detach_data @@ -649,7 +651,6 @@ acpi_attach_data(acpi_handle obj_handle, * DESCRIPTION: Remove data that was previously attached to a node. * ******************************************************************************/ - acpi_status acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) { @@ -682,6 +683,8 @@ acpi_detach_data(acpi_handle obj_handle, return (status); } +ACPI_EXPORT_SYMBOL(acpi_detach_data) + /******************************************************************************* * * FUNCTION: acpi_get_data @@ -695,7 +698,6 @@ acpi_detach_data(acpi_handle obj_handle, * DESCRIPTION: Retrieve data that was previously attached to a namespace node. * ******************************************************************************/ - acpi_status acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) { @@ -727,3 +729,5 @@ acpi_get_data(acpi_handle obj_handle, ac (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } + +ACPI_EXPORT_SYMBOL(acpi_get_data) diff -puN drivers/acpi/namespace/nsxfname.c~git-acpi drivers/acpi/namespace/nsxfname.c --- devel/drivers/acpi/namespace/nsxfname.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsxfname.c 2006-04-26 13:41:00.000000000 -0700 @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include @@ -126,7 +124,7 @@ acpi_get_handle(acpi_handle parent, return (status); } -EXPORT_SYMBOL(acpi_get_handle); +ACPI_EXPORT_SYMBOL(acpi_get_handle) /****************************************************************************** * @@ -143,7 +141,6 @@ EXPORT_SYMBOL(acpi_get_handle); * complementary functions. * ******************************************************************************/ - acpi_status acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) { @@ -162,6 +159,7 @@ acpi_get_name(acpi_handle handle, u32 na } if (name_type == ACPI_FULL_PATHNAME) { + /* Get the full pathname (From the namespace root) */ status = acpi_ns_handle_to_pathname(handle, buffer); @@ -203,7 +201,7 @@ acpi_get_name(acpi_handle handle, u32 na return (status); } -EXPORT_SYMBOL(acpi_get_name); +ACPI_EXPORT_SYMBOL(acpi_get_name) /****************************************************************************** * @@ -219,7 +217,6 @@ EXPORT_SYMBOL(acpi_get_name); * control methods (Such as in the case of a device.) * ******************************************************************************/ - acpi_status acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) { @@ -241,7 +238,7 @@ acpi_get_object_info(acpi_handle handle, return (status); } - info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); + info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); if (!info) { return (AE_NO_MEMORY); } @@ -345,11 +342,11 @@ acpi_get_object_info(acpi_handle handle, } cleanup: - ACPI_MEM_FREE(info); + ACPI_FREE(info); if (cid_list) { - ACPI_MEM_FREE(cid_list); + ACPI_FREE(cid_list); } return (status); } -EXPORT_SYMBOL(acpi_get_object_info); +ACPI_EXPORT_SYMBOL(acpi_get_object_info) diff -puN drivers/acpi/namespace/nsxfobj.c~git-acpi drivers/acpi/namespace/nsxfobj.c --- devel/drivers/acpi/namespace/nsxfobj.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/namespace/nsxfobj.c 2006-04-26 13:41:00.000000000 -0700 @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include @@ -101,7 +99,7 @@ acpi_status acpi_get_type(acpi_handle ha return (status); } -EXPORT_SYMBOL(acpi_get_type); +ACPI_EXPORT_SYMBOL(acpi_get_type) /******************************************************************************* * @@ -116,7 +114,6 @@ EXPORT_SYMBOL(acpi_get_type); * Handle. * ******************************************************************************/ - acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) { struct acpi_namespace_node *node; @@ -162,7 +159,7 @@ acpi_status acpi_get_parent(acpi_handle return (status); } -EXPORT_SYMBOL(acpi_get_parent); +ACPI_EXPORT_SYMBOL(acpi_get_parent) /******************************************************************************* * @@ -181,7 +178,6 @@ EXPORT_SYMBOL(acpi_get_parent); * Scope is returned. * ******************************************************************************/ - acpi_status acpi_get_next_object(acpi_object_type type, acpi_handle parent, @@ -206,6 +202,7 @@ acpi_get_next_object(acpi_object_type ty /* If null handle, use the parent */ if (!child) { + /* Start search at the beginning of the specified scope */ parent_node = acpi_ns_map_handle_to_node(parent); @@ -242,4 +239,4 @@ acpi_get_next_object(acpi_object_type ty return (status); } -EXPORT_SYMBOL(acpi_get_next_object); +ACPI_EXPORT_SYMBOL(acpi_get_next_object) diff -puN drivers/acpi/osl.c~git-acpi drivers/acpi/osl.c --- devel/drivers/acpi/osl.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/osl.c 2006-04-26 13:41:00.000000000 -0700 @@ -136,6 +136,7 @@ void acpi_os_vprintf(const char *fmt, va #endif } + extern int acpi_in_resume; void *acpi_os_allocate(acpi_size size) { @@ -589,7 +590,7 @@ static void acpi_os_execute_deferred(voi dpc = (struct acpi_os_dpc *)context; if (!dpc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); + ACPI_ERROR((AE_INFO, "Invalid (NULL) context")); return_VOID; } @@ -641,8 +642,7 @@ acpi_os_queue_for_execution(u32 priority INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); if (!queue_work(kacpid_wq, task)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Call to queue_work() failed.\n")); + ACPI_ERROR((AE_INFO, "Call to queue_work() failed")); kfree(dpc); status = AE_ERROR; } @@ -816,13 +816,13 @@ acpi_status acpi_os_wait_semaphore(acpi_ } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Failed to acquire semaphore[%p|%d|%d], %s\n", + ACPI_EXCEPTION((AE_INFO, status, + "Failed to acquire semaphore[%p|%d|%d], %s", handle, units, timeout, acpi_format_exception(status))); } else { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, - "Acquired semaphore[%p|%d|%d]\n", handle, + "Acquired semaphore[%p|%d|%d]", handle, units, timeout)); } @@ -896,14 +896,6 @@ u8 acpi_os_writable(void *ptr, acpi_size } #endif -u32 acpi_os_get_thread_id(void) -{ - if (!in_atomic()) - return current->pid; - - return 0; -} - acpi_status acpi_os_signal(u32 function, void *info) { switch (function) { @@ -1141,7 +1133,12 @@ acpi_status acpi_os_release_object(acpi_ void *acpi_os_acquire_object(acpi_cache_t * cache) { - void *object = kmem_cache_alloc(cache, GFP_KERNEL); + void *object; + + if (acpi_in_resume) + object = kmem_cache_alloc(cache, GFP_ATOMIC); + else + object = kmem_cache_alloc(cache, GFP_KERNEL); WARN_ON(!object); return object; } diff -puN drivers/acpi/parser/psargs.c~git-acpi drivers/acpi/parser/psargs.c --- devel/drivers/acpi/parser/psargs.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/psargs.c 2006-04-26 13:41:00.000000000 -0700 @@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_wa */ if (ACPI_SUCCESS(status) && possible_method_call && (node->type == ACPI_TYPE_METHOD)) { + /* This name is actually a control method invocation */ method_desc = acpi_ns_get_attached_object(node); @@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_wa * some not_found cases are allowed */ if (status == AE_NOT_FOUND) { + /* 1) not_found is ok during load pass 1/2 (allow forward references) */ if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != @@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_wa if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { + /* Report a control method execution error */ status = acpi_ds_method_error(status, walk_state); @@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_st case ARGP_FIELDLIST: if (parser_state->aml < parser_state->pkg_end) { + /* Non-empty list */ while (parser_state->aml < parser_state->pkg_end) { @@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_st case ARGP_BYTELIST: if (parser_state->aml < parser_state->pkg_end) { + /* Non-empty list */ arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); @@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_st if (subop == 0 || acpi_ps_is_leading_char(subop) || acpi_ps_is_prefix_char(subop)) { + /* null_name or name_string */ arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); @@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_st case ARGP_OBJLIST: if (parser_state->aml < parser_state->pkg_end) { + /* Non-empty list of variable arguments, nothing returned */ walk_state->arg_count = ACPI_VAR_ARGS; diff -puN drivers/acpi/parser/psloop.c~git-acpi drivers/acpi/parser/psloop.c --- devel/drivers/acpi/parser/psloop.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/psloop.c 2006-04-26 13:41:00.000000000 -0700 @@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct ac #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { + /* We are restarting a preempted control method */ if (acpi_ps_has_completed_scope(parser_state)) { @@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct ac ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); } else if (walk_state->prev_op) { + /* We were in the middle of an op */ op = walk_state->prev_op; @@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct ac while ((parser_state->aml < parser_state->aml_end) || (op)) { aml_op_start = parser_state->aml; if (!op) { + /* Get the next opcode from the AML stream */ walk_state->aml_offset = @@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct ac /* Create Op structure and append to parent's argument list */ if (walk_state->op_info->flags & AML_NAMED) { + /* Allocate a new pre_op if necessary */ if (!pre_op) { @@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct ac /* Are there any arguments that must be processed? */ if (walk_state->arg_types) { + /* Get arguments */ switch (op->common.aml_opcode) { @@ -762,6 +767,7 @@ acpi_status acpi_ps_parse_loop(struct ac return_ACPI_STATUS(status2); } } + acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); @@ -853,6 +859,7 @@ acpi_status acpi_ps_parse_loop(struct ac } else if (ACPI_FAILURE(status)) { + /* First error is most important */ (void) diff -puN drivers/acpi/parser/psopcode.c~git-acpi drivers/acpi/parser/psopcode.c --- devel/drivers/acpi/parser/psopcode.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/psopcode.c 2006-04-26 13:41:00.000000000 -0700 @@ -731,6 +731,7 @@ const struct acpi_opcode_info *acpi_ps_g * Detect normal 8-bit opcode or extended 16-bit opcode */ if (!(opcode & 0xFF00)) { + /* Simple (8-bit) opcode: 0-255, can't index beyond table */ return (&acpi_gbl_aml_op_info @@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_g if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { + /* Valid extended (16-bit) opcode */ return (&acpi_gbl_aml_op_info diff -puN drivers/acpi/parser/psparse.c~git-acpi drivers/acpi/parser/psparse.c --- devel/drivers/acpi/parser/psparse.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/psparse.c 2006-04-26 13:41:00.000000000 -0700 @@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_pars opcode = (u16) ACPI_GET8(aml); if (opcode == AML_EXTENDED_OP_PREFIX) { + /* Extended opcode, get the second opcode byte */ aml++; @@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_wal if (op->common.parent) { prev = op->common.parent->common.value.arg; if (!prev) { + /* Nothing more to do */ goto cleanup; @@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_wal /* We must unlink this op from the parent tree */ if (prev == op) { + /* This op is the first in the list */ if (replacement_op) { @@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_wal else while (prev) { + /* Traverse all siblings in the parent's argument list */ next = prev->common.next; @@ -510,6 +514,7 @@ acpi_status acpi_ps_parse_aml(struct acp } else if (status == AE_CTRL_TERMINATE) { status = AE_OK; } else if ((status != AE_OK) && (walk_state->method_desc)) { + /* Either the method parse or actual execution failed */ ACPI_ERROR_METHOD("Method parse/execution failed", @@ -551,6 +556,7 @@ acpi_status acpi_ps_parse_aml(struct acp if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { if (walk_state->method_desc) { + /* Decrement the thread count on the method parse tree */ if (walk_state->method_desc->method. @@ -633,12 +639,14 @@ acpi_status acpi_ps_parse_aml(struct acp } } else { if (previous_walk_state->return_desc) { + /* Caller doesn't want it, must delete it */ acpi_ut_remove_reference(previous_walk_state-> return_desc); } if (previous_walk_state->implicit_return_obj) { + /* Caller doesn't want it, must delete it */ acpi_ut_remove_reference(previous_walk_state-> diff -puN drivers/acpi/parser/psscope.c~git-acpi drivers/acpi/parser/psscope.c --- devel/drivers/acpi/parser/psscope.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/psscope.c 2006-04-26 13:41:00.000000000 -0700 @@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_sta acpi_ut_push_generic_state(&parser_state->scope, scope); if (arg_count == ACPI_VAR_ARGS) { + /* Multiple arguments */ scope->parse_scope.arg_end = parser_state->pkg_end; diff -puN drivers/acpi/parser/pstree.c~git-acpi drivers/acpi/parser/pstree.c --- devel/drivers/acpi/parser/pstree.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/pstree.c 2006-04-26 13:41:00.000000000 -0700 @@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); if (op_info->class == AML_CLASS_UNKNOWN) { + /* Invalid opcode or ASCII character */ return (NULL); @@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg /* Check if this opcode requires argument sub-objects */ if (!(op_info->flags & AML_HAS_ARGS)) { + /* Has no linked argument objects */ return (NULL); @@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_obje op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); if (op_info->class == AML_CLASS_UNKNOWN) { + /* Invalid opcode */ ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", @@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_obje /* Check if this opcode requires argument sub-objects */ if (!(op_info->flags & AML_HAS_ARGS)) { + /* Has no linked argument objects */ return; @@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_obje /* Append the argument to the linked argument list */ if (op->common.value.arg) { + /* Append to existing argument list */ prev_arg = op->common.value.arg; @@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_dep } if (arg == origin) { + /* Reached parent of origin, end search */ return (NULL); } if (parent->common.next) { + /* Found sibling of parent */ return (parent->common.next); @@ -299,5 +306,4 @@ union acpi_parse_object *acpi_ps_get_chi return (child); } #endif - #endif /* ACPI_FUTURE_USAGE */ diff -puN drivers/acpi/parser/psutils.c~git-acpi drivers/acpi/parser/psutils.c --- devel/drivers/acpi/parser/psutils.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/psutils.c 2006-04-26 13:41:00.000000000 -0700 @@ -135,15 +135,20 @@ union acpi_parse_object *acpi_ps_alloc_o /* Allocate the minimum required size object */ if (flags == ACPI_PARSEOP_GENERIC) { + /* The generic op (default) is by far the most common (16 to 1) */ op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); - memset(op, 0, sizeof(struct acpi_parse_obj_common)); + + if (op) + memset(op, 0, sizeof(struct acpi_parse_obj_common)); } else { /* Extended parseop */ op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache); - memset(op, 0, sizeof(struct acpi_parse_obj_named)); + + if (op) + memset(op, 0, sizeof(struct acpi_parse_obj_named)); } /* Initialize the Op */ diff -puN drivers/acpi/parser/pswalk.c~git-acpi drivers/acpi/parser/pswalk.c --- devel/drivers/acpi/parser/pswalk.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/pswalk.c 2006-04-26 13:41:00.000000000 -0700 @@ -69,13 +69,16 @@ void acpi_ps_delete_parse_tree(union acp /* Visit all nodes in the subtree */ while (op) { + /* Check if we are not ascending */ if (op != parent) { + /* Look for an argument or child of the current op */ next = acpi_ps_get_arg(op, 0); if (next) { + /* Still going downward in tree (Op is not completed yet) */ op = next; diff -puN drivers/acpi/parser/psxface.c~git-acpi drivers/acpi/parser/psxface.c --- devel/drivers/acpi/parser/psxface.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/parser/psxface.c 2006-04-26 13:41:00.000000000 -0700 @@ -317,9 +317,11 @@ acpi_ps_update_parameter_list(struct acp acpi_native_uint i; if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { + /* Update reference count for each parameter */ for (i = 0; info->parameters[i]; i++) { + /* Ignore errors, just do them all */ (void)acpi_ut_update_object_reference(info-> diff -puN drivers/acpi/pci_bind.c~git-acpi drivers/acpi/pci_bind.c --- devel/drivers/acpi/pci_bind.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/pci_bind.c 2006-04-26 13:41:00.000000000 -0700 @@ -75,17 +75,17 @@ acpi_status acpi_get_pci_id(acpi_handle result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI Bus context for device %s\n", - acpi_device_bid(device))); + ACPI_ERROR((AE_INFO, + "Invalid ACPI Bus context for device %s", + acpi_device_bid(device))); return_ACPI_STATUS(AE_NOT_EXIST); } status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data); if (ACPI_FAILURE(status) || !data) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid ACPI-PCI context for device %s", + acpi_device_bid(device))); return_ACPI_STATUS(status); } @@ -151,9 +151,9 @@ int acpi_pci_bind(struct acpi_device *de status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, (void **)&pdata); if (ACPI_FAILURE(status) || !pdata || !pdata->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for parent device %s\n", - acpi_device_bid(device->parent))); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid ACPI-PCI context for parent device %s", + acpi_device_bid(device->parent))); result = -ENODEV; goto end; } @@ -206,10 +206,10 @@ int acpi_pci_bind(struct acpi_device *de goto end; } if (!data->dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", - data->id.segment, data->id.bus, - data->id.device, data->id.function)); + ACPI_ERROR((AE_INFO, + "Device %02x:%02x:%02x.%02x has invalid 'bus' field", + data->id.segment, data->id.bus, + data->id.device, data->id.function)); result = -ENODEV; goto end; } @@ -237,9 +237,9 @@ int acpi_pci_bind(struct acpi_device *de */ status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to attach ACPI-PCI context to device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -301,18 +301,18 @@ int acpi_pci_unbind(struct acpi_device * acpi_get_data(device->handle, acpi_pci_data_handler, (void **)&data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to get data from device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to get data from device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } status = acpi_detach_data(device->handle, acpi_pci_data_handler); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to detach data from device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to detach data from device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -369,9 +369,9 @@ acpi_pci_bind_root(struct acpi_device *d status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - pathname)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to attach ACPI-PCI context to device %s", + pathname)); result = -ENODEV; goto end; } diff -puN drivers/acpi/pci_irq.c~git-acpi drivers/acpi/pci_irq.c --- devel/drivers/acpi/pci_irq.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/pci_irq.c 2006-04-26 13:41:00.000000000 -0700 @@ -197,8 +197,8 @@ int acpi_pci_irq_add_prt(acpi_handle han kfree(pathname); status = acpi_get_irq_routing_table(handle, &buffer); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", + acpi_format_exception(status))); return_VALUE(-ENODEV); } @@ -211,8 +211,8 @@ int acpi_pci_irq_add_prt(acpi_handle han status = acpi_get_irq_routing_table(handle, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", + acpi_format_exception(status))); kfree(buffer.pointer); return_VALUE(-ENODEV); } @@ -269,8 +269,8 @@ acpi_pci_allocate_irq(struct acpi_prt_en entry->link.index, triggering, polarity, link); if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ link routing entry\n")); + ACPI_WARNING((AE_INFO, + "Invalid IRQ link routing entry")); return_VALUE(-1); } } else { @@ -379,9 +379,8 @@ acpi_pci_irq_derive(struct pci_dev *dev, } if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to derive IRQ for device %s\n", - pci_name(dev))); + ACPI_WARNING((AE_INFO, "Unable to derive IRQ for device %s", + pci_name(dev))); return_VALUE(-1); } @@ -421,8 +420,7 @@ int acpi_pci_irq_enable(struct pci_dev * pin--; if (!dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid (NULL) 'bus' field\n")); + ACPI_ERROR((AE_INFO, "Invalid (NULL) 'bus' field")); return_VALUE(-ENODEV); } diff -puN drivers/acpi/pci_link.c~git-acpi drivers/acpi/pci_link.c --- devel/drivers/acpi/pci_link.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/pci_link.c 2006-04-26 13:41:00.000000000 -0700 @@ -115,17 +115,15 @@ acpi_pci_link_check_possible(struct acpi { struct acpi_resource_irq *p = &resource->data.irq; if (!p || !p->interrupt_count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank IRQ resource\n")); + ACPI_WARNING((AE_INFO, "Blank IRQ resource")); return_ACPI_STATUS(AE_OK); } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ %d\n", - p->interrupts[i])); + ACPI_WARNING((AE_INFO, "Invalid IRQ %d", + p->interrupts[i])); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -141,17 +139,16 @@ acpi_pci_link_check_possible(struct acpi struct acpi_resource_extended_irq *p = &resource->data.extended_irq; if (!p || !p->interrupt_count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); + ACPI_WARNING((AE_INFO, + "Blank EXT IRQ resource")); return_ACPI_STATUS(AE_OK); } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ %d\n", - p->interrupts[i])); + ACPI_WARNING((AE_INFO, "Invalid IRQ %d", + p->interrupts[i])); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -163,8 +160,7 @@ acpi_pci_link_check_possible(struct acpi break; } default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Resource is not an IRQ entry\n")); + ACPI_ERROR((AE_INFO, "Resource is not an IRQ entry\n")); return_ACPI_STATUS(AE_OK); } @@ -183,7 +179,7 @@ static int acpi_pci_link_get_possible(st status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, acpi_pci_link_check_possible, link); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); return_VALUE(-ENODEV); } @@ -226,8 +222,8 @@ acpi_pci_link_check_current(struct acpi_ * extended IRQ descriptors must * return at least 1 IRQ */ - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); + ACPI_WARNING((AE_INFO, + "Blank EXT IRQ resource")); return_ACPI_STATUS(AE_OK); } *irq = p->interrupts[0]; @@ -235,7 +231,7 @@ acpi_pci_link_check_current(struct acpi_ } break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type)); + ACPI_ERROR((AE_INFO, "Resource %d isn't an IRQ", resource->type)); case ACPI_RESOURCE_TYPE_END_TAG: return_ACPI_STATUS(AE_OK); } @@ -267,8 +263,7 @@ static int acpi_pci_link_get_current(str /* Query _STA, set link->device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to read status\n")); + ACPI_ERROR((AE_INFO, "Unable to read status")); goto end; } @@ -285,13 +280,13 @@ static int acpi_pci_link_get_current(str status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, acpi_pci_link_check_current, &irq); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); result = -ENODEV; goto end; } if (acpi_strict && !irq) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_CRS returned 0\n")); + ACPI_ERROR((AE_INFO, "_CRS returned 0")); result = -ENODEV; } @@ -361,7 +356,7 @@ static int acpi_pci_link_set(struct acpi /* ignore resource_source, it's optional */ break; default: - printk("ACPI BUG: resource_type %d\n", link->irq.resource_type); + ACPI_ERROR((AE_INFO, "Invalid Resource_type %d\n", link->irq.resource_type)); result = -EINVAL; goto end; @@ -373,7 +368,7 @@ static int acpi_pci_link_set(struct acpi /* check for total failure */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS")); result = -ENODEV; goto end; } @@ -381,14 +376,14 @@ static int acpi_pci_link_set(struct acpi /* Query _STA, set device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); + ACPI_ERROR((AE_INFO, "Unable to read status")); goto end; } if (!link->device->status.enabled) { - printk(KERN_WARNING PREFIX - "%s [%s] disabled and referenced, BIOS bug.\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + ACPI_WARNING((AE_INFO, + "%s [%s] disabled and referenced, BIOS bug", + acpi_device_name(link->device), + acpi_device_bid(link->device))); } /* Query _CRS, set link->irq.active */ @@ -406,10 +401,10 @@ static int acpi_pci_link_set(struct acpi * policy: when _CRS doesn't return what we just _SRS * assume _SRS worked and override _CRS value. */ - printk(KERN_WARNING PREFIX - "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", - acpi_device_name(link->device), - acpi_device_bid(link->device), link->irq.active, irq); + ACPI_WARNING((AE_INFO, + "%s [%s] BIOS reported IRQ %d, using IRQ %d", + acpi_device_name(link->device), + acpi_device_bid(link->device), link->irq.active, irq)); link->irq.active = irq; } @@ -500,8 +495,7 @@ int __init acpi_irq_penalty_init(void) link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); continue; } @@ -560,8 +554,8 @@ static int acpi_pci_link_allocate(struct */ if (i == link->irq.possible_count) { if (acpi_strict) - printk(KERN_WARNING PREFIX "_CRS %d not found" - " in _PRS\n", link->irq.active); + ACPI_WARNING((AE_INFO, "_CRS %d not found" + " in _PRS", link->irq.active)); link->irq.active = 0; } @@ -588,11 +582,10 @@ static int acpi_pci_link_allocate(struct /* Attempt to enable the link device at this IRQ. */ if (acpi_pci_link_set(link, irq)) { - printk(PREFIX - "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" - "Try pci=noacpi or acpi=off\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + ACPI_ERROR((AE_INFO, "Unable to set IRQ for %s [%s]. " + "Try pci=noacpi or acpi=off", + acpi_device_name(link->device), + acpi_device_bid(link->device))); return_VALUE(-ENODEV); } else { acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; @@ -625,19 +618,19 @@ acpi_pci_link_allocate_irq(acpi_handle h result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); + ACPI_ERROR((AE_INFO, "Invalid link device")); return_VALUE(-1); } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); return_VALUE(-1); } /* TBD: Support multiple index (IRQ) entries per Link Device */ if (index) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid index %d\n", index)); + ACPI_ERROR((AE_INFO, "Invalid index %d", index)); return_VALUE(-1); } @@ -649,7 +642,7 @@ acpi_pci_link_allocate_irq(acpi_handle h if (!link->irq.active) { up(&acpi_link_lock); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); + ACPI_ERROR((AE_INFO, "Link active IRQ is 0!")); return_VALUE(-1); } link->refcnt++; @@ -681,20 +674,20 @@ int acpi_pci_link_free_irq(acpi_handle h result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); + ACPI_ERROR((AE_INFO, "Invalid link device")); return_VALUE(-1); } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); return_VALUE(-1); } down(&acpi_link_lock); if (!link->irq.initialized) { up(&acpi_link_lock); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); + ACPI_ERROR((AE_INFO, "Link isn't initialized")); return_VALUE(-1); } #ifdef FUTURE_USE @@ -816,8 +809,7 @@ static int irqrouter_resume(struct sys_d list_for_each(node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); continue; } acpi_pci_link_resume(link); diff -puN drivers/acpi/pci_root.c~git-acpi drivers/acpi/pci_root.c --- devel/drivers/acpi/pci_root.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/pci_root.c 2006-04-26 13:41:00.000000000 -0700 @@ -198,7 +198,7 @@ static int acpi_pci_root_add(struct acpi root->id.segment = 0; break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SEG\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SEG")); result = -ENODEV; goto end; } @@ -219,7 +219,7 @@ static int acpi_pci_root_add(struct acpi root->id.bus = 0; break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BBN\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BBN")); result = -ENODEV; goto end; } @@ -231,8 +231,9 @@ static int acpi_pci_root_add(struct acpi int bus = 0; acpi_status status; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n")); + ACPI_ERROR((AE_INFO, + "Wrong _BBN value, reboot" + " and use option 'pci=noacpi'")); status = try_get_root_bridge_busnr(root->handle, &bus); if (ACPI_FAILURE(status)) @@ -273,9 +274,9 @@ static int acpi_pci_root_add(struct acpi */ root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); if (!root->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bus %04x:%02x not present in PCI namespace\n", - root->id.segment, root->id.bus)); + ACPI_ERROR((AE_INFO, + "Bus %04x:%02x not present in PCI namespace", + root->id.segment, root->id.bus)); result = -ENODEV; goto end; } diff -puN drivers/acpi/power.c~git-acpi drivers/acpi/power.c --- devel/drivers/acpi/power.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/power.c 2006-04-26 13:41:00.000000000 -0700 @@ -105,8 +105,7 @@ acpi_power_get_context(acpi_handle handl result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n", - handle)); + ACPI_WARNING((AE_INFO, "Getting context [%p]", handle)); return_VALUE(result); } @@ -292,8 +291,7 @@ int acpi_enable_wakeup_device_power(stru for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_on(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + ACPI_ERROR((AE_INFO, "Transition power state")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -302,7 +300,7 @@ int acpi_enable_wakeup_device_power(stru /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); + ACPI_ERROR((AE_INFO, "Evaluate _PSW")); dev->wakeup.flags.valid = 0; ret = -1; } @@ -332,7 +330,7 @@ int acpi_disable_wakeup_device_power(str /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); + ACPI_ERROR((AE_INFO, "Evaluate _PSW")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -341,8 +339,7 @@ int acpi_disable_wakeup_device_power(str for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + ACPI_ERROR((AE_INFO, "Transition power state")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -444,9 +441,8 @@ int acpi_power_transition(struct acpi_de device->power.state = state; end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + ACPI_WARNING((AE_INFO, "Transitioning device [%s] to D%d", + device->pnp.bus_id, state)); return_VALUE(result); } @@ -516,9 +512,7 @@ static int acpi_power_add_fs(struct acpi entry = create_proc_entry(ACPI_POWER_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_POWER_FILE_STATUS)); + return_VALUE(-EIO); else { entry->proc_fops = &acpi_power_fops; entry->data = acpi_driver_data(device); diff -puN drivers/acpi/processor_core.c~git-acpi drivers/acpi/processor_core.c --- devel/drivers/acpi/processor_core.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/processor_core.c 2006-04-26 13:41:00.000000000 -0700 @@ -328,9 +328,7 @@ static int acpi_processor_add_fs(struct entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_INFO)); + return_VALUE(-EIO); else { entry->proc_fops = &acpi_processor_info_fops; entry->data = acpi_driver_data(device); @@ -342,9 +340,7 @@ static int acpi_processor_add_fs(struct S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_THROTTLING)); + return_VALUE(-EIO); else { entry->proc_fops = &acpi_processor_throttling_fops; entry->data = acpi_driver_data(device); @@ -356,9 +352,7 @@ static int acpi_processor_add_fs(struct S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_LIMIT)); + return_VALUE( -EIO); else { entry->proc_fops = &acpi_processor_limit_fops; entry->data = acpi_driver_data(device); @@ -388,7 +382,7 @@ static int acpi_processor_remove_fs(stru /* Use the acpiid in MADT to map cpus in case of SMP */ #ifndef CONFIG_SMP -#define convert_acpiid_to_cpu(acpi_id) (0xff) +#define convert_acpiid_to_cpu(acpi_id) (-1) #else #ifdef CONFIG_IA64 @@ -401,7 +395,7 @@ static int acpi_processor_remove_fs(stru #define ARCH_BAD_APICID (0xff) #endif -static u8 convert_acpiid_to_cpu(u8 acpi_id) +static int convert_acpiid_to_cpu(u8 acpi_id) { u16 apic_id; int i; @@ -427,7 +421,7 @@ static int acpi_processor_get_info(struc acpi_status status = 0; union acpi_object object = { 0 }; struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; - u8 cpu_index; + int cpu_index; static int cpu0_initialized; ACPI_FUNCTION_TRACE("acpi_processor_get_info"); @@ -459,8 +453,7 @@ static int acpi_processor_get_info(struc */ status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error evaluating processor object\n")); + ACPI_ERROR((AE_INFO, "Evaluating processor object")); return_VALUE(-ENODEV); } @@ -473,7 +466,7 @@ static int acpi_processor_get_info(struc cpu_index = convert_acpiid_to_cpu(pr->acpi_id); /* Handle UP system running SMP kernel, with no LAPIC in MADT */ - if (!cpu0_initialized && (cpu_index == 0xff) && + if (!cpu0_initialized && (cpu_index == -1) && (num_online_cpus() == 1)) { cpu_index = 0; } @@ -487,12 +480,12 @@ static int acpi_processor_get_info(struc * less than the max # of CPUs. They should be ignored _iff * they are physically not present. */ - if (cpu_index >= NR_CPUS) { + if (cpu_index == -1) { if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting cpuindex for acpiid 0x%x\n", - pr->acpi_id)); + ACPI_ERROR((AE_INFO, + "Getting cpuindex for acpiid 0x%x", + pr->acpi_id)); return_VALUE(-ENODEV); } } @@ -503,8 +496,8 @@ static int acpi_processor_get_info(struc if (!object.processor.pblk_address) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); else if (object.processor.pblk_length != 6) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid PBLK length [%d]\n", - object.processor.pblk_length)); + ACPI_ERROR((AE_INFO, "Invalid PBLK length [%d]", + object.processor.pblk_length)); else { pr->throttling.address = object.processor.pblk_address; pr->throttling.duty_offset = acpi_fadt.duty_offset; @@ -558,8 +551,8 @@ static int acpi_processor_start(struct a */ if (processor_device_array[pr->id] != NULL && processor_device_array[pr->id] != (void *)device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id" - "for the processor\n")); + printk(KERN_WARNING "BIOS reported wrong ACPI id" + "for the processor\n"); return_VALUE(-ENODEV); } processor_device_array[pr->id] = (void *)device; @@ -572,10 +565,6 @@ static int acpi_processor_start(struct a status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, acpi_processor_notify, pr); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing device notify handler\n")); - } /* _PDC call should be done before doing anything else (if reqd.). */ arch_acpi_processor_init_pdc(pr); @@ -675,10 +664,6 @@ static int acpi_processor_remove(struct status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, acpi_processor_notify); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - } acpi_processor_remove_fs(device); @@ -705,8 +690,7 @@ static int is_processor_present(acpi_han status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Processor Device is not present\n")); + ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); return_VALUE(0); } return_VALUE(1); @@ -767,15 +751,14 @@ acpi_processor_hotplug_notify(acpi_handl if (acpi_bus_get_device(handle, &device)) { result = acpi_processor_device_add(handle, &device); if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to add the device\n")); + ACPI_ERROR((AE_INFO, + "Unable to add the device")); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver data is NULL\n")); + ACPI_ERROR((AE_INFO, "Driver data is NULL")); break; } @@ -788,9 +771,8 @@ acpi_processor_hotplug_notify(acpi_handl if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { kobject_uevent(&device->kobj, KOBJ_ONLINE); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device [%s] failed to start\n", - acpi_device_bid(device))); + ACPI_ERROR((AE_INFO, "Device [%s] failed to start", + acpi_device_bid(device))); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -798,14 +780,14 @@ acpi_processor_hotplug_notify(acpi_handl "received ACPI_NOTIFY_EJECT_REQUEST\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device don't exist, dropping EJECT\n")); + ACPI_ERROR((AE_INFO, + "Device don't exist, dropping EJECT")); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver data is NULL, dropping EJECT\n")); + ACPI_ERROR((AE_INFO, + "Driver data is NULL, dropping EJECT")); return_VOID; } diff -puN drivers/acpi/processor_idle.c~git-acpi drivers/acpi/processor_idle.c --- devel/drivers/acpi/processor_idle.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/processor_idle.c 2006-04-26 13:41:00.000000000 -0700 @@ -665,8 +665,7 @@ static int acpi_processor_get_power_info /* There must be at least 2 elements */ if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "not enough elements in _CST\n")); + ACPI_ERROR((AE_INFO, "not enough elements in _CST")); status = -EFAULT; goto end; } @@ -675,8 +674,7 @@ static int acpi_processor_get_power_info /* Validate number of power states. */ if (count < 1 || count != cst->package.count - 1) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "count given by _CST is not valid\n")); + ACPI_ERROR((AE_INFO, "count given by _CST is not valid")); status = -EFAULT; goto end; } @@ -1103,8 +1101,8 @@ int acpi_processor_power_init(struct acp status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Notifying BIOS of _CST ability failed\n")); + ACPI_EXCEPTION((AE_INFO, status, + "Notifying BIOS of _CST ability failed")); } } @@ -1133,9 +1131,7 @@ int acpi_processor_power_init(struct acp entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_POWER)); + return -EIO; else { entry->proc_fops = &acpi_processor_power_fops; entry->data = acpi_driver_data(device); diff -puN drivers/acpi/processor_perflib.c~git-acpi drivers/acpi/processor_perflib.c --- devel/drivers/acpi/processor_perflib.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/processor_perflib.c 2006-04-26 13:41:00.000000000 -0700 @@ -122,7 +122,7 @@ static int acpi_processor_get_platform_l acpi_processor_ppc_status |= PPC_IN_USE; if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); return_VALUE(-ENODEV); } @@ -171,14 +171,14 @@ static int acpi_processor_get_performanc status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT")); return_VALUE(-ENODEV); } pct = (union acpi_object *)buffer.pointer; if (!pct || (pct->type != ACPI_TYPE_PACKAGE) || (pct->package.count != 2)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); + ACPI_ERROR((AE_INFO, "Invalid _PCT data")); result = -EFAULT; goto end; } @@ -192,8 +192,7 @@ static int acpi_processor_get_performanc if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (control_register)\n")); + ACPI_ERROR((AE_INFO, "Invalid _PCT data (control_register)")); result = -EFAULT; goto end; } @@ -209,8 +208,7 @@ static int acpi_processor_get_performanc if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (status_register)\n")); + ACPI_ERROR((AE_INFO, "Invalid _PCT data (status_register)")); result = -EFAULT; goto end; } @@ -238,13 +236,13 @@ static int acpi_processor_get_performanc status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS")); return_VALUE(-ENODEV); } pss = (union acpi_object *)buffer.pointer; if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); + ACPI_ERROR((AE_INFO, "Invalid _PSS data")); result = -EFAULT; goto end; } @@ -273,8 +271,7 @@ static int acpi_processor_get_performanc status = acpi_extract_package(&(pss->package.elements[i]), &format, &state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PSS data\n")); + ACPI_EXCEPTION((AE_INFO, status, "Invalid _PSS data")); result = -EFAULT; kfree(pr->performance->states); goto end; @@ -290,8 +287,8 @@ static int acpi_processor_get_performanc (u32) px->control, (u32) px->status)); if (!px->core_frequency) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PSS data: freq is zero\n")); + ACPI_ERROR((AE_INFO, + "Invalid _PSS data: freq is zero")); result = -EFAULT; kfree(pr->performance->states); goto end; @@ -386,10 +383,10 @@ int acpi_processor_notify_smm(struct mod status = acpi_os_write_port(acpi_fadt.smi_cmd, (u32) acpi_fadt.pstate_cnt, 8); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Failed to write pstate_cnt [0x%x] to " - "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, - acpi_fadt.smi_cmd)); + ACPI_EXCEPTION((AE_INFO, status, + "Failed to write pstate_cnt [0x%x] to " + "smi_cmd [0x%x]", acpi_fadt.pstate_cnt, + acpi_fadt.smi_cmd)); module_put(calling_module); return_VALUE(status); } @@ -513,11 +510,7 @@ static void acpi_cpufreq_add_file(struct entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_PERFORMANCE)); - else { + if (entry){ acpi_processor_perf_fops.write = acpi_processor_write_performance; entry->proc_fops = &acpi_processor_perf_fops; entry->data = acpi_driver_data(device); @@ -553,6 +546,234 @@ static void acpi_cpufreq_remove_file(str } #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ +static int acpi_processor_get_psd(struct acpi_processor *pr) +{ + int result = 0; + acpi_status status = AE_OK; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_buffer format = {sizeof("NNNNN"), "NNNNN"}; + struct acpi_buffer state = {0, NULL}; + union acpi_object *psd = NULL; + struct acpi_psd_package *pdomain; + + ACPI_FUNCTION_TRACE("acpi_processor_get_psd"); + + status = acpi_evaluate_object(pr->handle, "_PSD", NULL, &buffer); + if (ACPI_FAILURE(status)) { + return_VALUE(-ENODEV); + } + + psd = (union acpi_object *) buffer.pointer; + if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); + result = -EFAULT; + goto end; + } + + if (psd->package.count != 1) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); + result = -EFAULT; + goto end; + } + + pdomain = &(pr->performance->domain_info); + + state.length = sizeof(struct acpi_psd_package); + state.pointer = pdomain; + + status = acpi_extract_package(&(psd->package.elements[0]), + &format, &state); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); + result = -EFAULT; + goto end; + } + + if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:num_entries\n")); + result = -EFAULT; + goto end; + } + + if (pdomain->revision != ACPI_PSD_REV0_REVISION) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:revision\n")); + result = -EFAULT; + goto end; + } + +end: + acpi_os_free(buffer.pointer); + return_VALUE(result); +} + +int acpi_processor_preregister_performance( + struct acpi_processor_performance **performance) +{ + int count, count_target; + int retval = 0; + unsigned int i, j; + cpumask_t covered_cpus; + struct acpi_processor *pr; + struct acpi_psd_package *pdomain; + struct acpi_processor *match_pr; + struct acpi_psd_package *match_pdomain; + + ACPI_FUNCTION_TRACE("acpi_processor_preregister_performance"); + + down(&performance_sem); + + retval = 0; + + /* Call _PSD for all CPUs */ + for_each_cpu(i) { + pr = processors[i]; + if (!pr) { + /* Look only at processors in ACPI namespace */ + continue; + } + + if (pr->performance) { + retval = -EBUSY; + continue; + } + + if (!performance || !performance[i]) { + retval = -EINVAL; + continue; + } + + pr->performance = performance[i]; + cpu_set(i, pr->performance->shared_cpu_map); + if (acpi_processor_get_psd(pr)) { + retval = -EINVAL; + continue; + } + } + if (retval) + goto err_ret; + + /* + * Now that we have _PSD data from all CPUs, lets setup P-state + * domain info. + */ + for_each_cpu(i) { + pr = processors[i]; + if (!pr) + continue; + + /* Basic validity check for domain info */ + pdomain = &(pr->performance->domain_info); + if ((pdomain->revision != ACPI_PSD_REV0_REVISION) || + (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES)) { + retval = -EINVAL; + goto err_ret; + } + if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL && + pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY && + pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) { + retval = -EINVAL; + goto err_ret; + } + } + + cpus_clear(covered_cpus); + for_each_cpu(i) { + pr = processors[i]; + if (!pr) + continue; + + if (cpu_isset(i, covered_cpus)) + continue; + + pdomain = &(pr->performance->domain_info); + cpu_set(i, pr->performance->shared_cpu_map); + cpu_set(i, covered_cpus); + if (pdomain->num_processors <= 1) + continue; + + /* Validate the Domain info */ + count_target = pdomain->num_processors; + count = 1; + if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL || + pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) { + pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; + } else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) { + pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ANY; + } + + for_each_cpu(j) { + if (i == j) + continue; + + match_pr = processors[j]; + if (!match_pr) + continue; + + match_pdomain = &(match_pr->performance->domain_info); + if (match_pdomain->domain != pdomain->domain) + continue; + + /* Here i and j are in the same domain */ + + if (match_pdomain->num_processors != count_target) { + retval = -EINVAL; + goto err_ret; + } + + if (pdomain->coord_type != match_pdomain->coord_type) { + retval = -EINVAL; + goto err_ret; + } + + cpu_set(j, covered_cpus); + cpu_set(j, pr->performance->shared_cpu_map); + count++; + } + + for_each_cpu(j) { + if (i == j) + continue; + + match_pr = processors[j]; + if (!match_pr) + continue; + + match_pdomain = &(match_pr->performance->domain_info); + if (match_pdomain->domain != pdomain->domain) + continue; + + match_pr->performance->shared_type = + pr->performance->shared_type; + match_pr->performance->shared_cpu_map = + pr->performance->shared_cpu_map; + } + } + +err_ret: + if (retval) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error while parsing _PSD domain information. Assuming no coordination\n")); + } + + for_each_cpu(i) { + pr = processors[i]; + if (!pr || !pr->performance) + continue; + + /* Assume no coordination on any error parsing domain info */ + if (retval) { + cpus_clear(pr->performance->shared_cpu_map); + cpu_set(i, pr->performance->shared_cpu_map); + pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; + } + pr->performance = NULL; /* Will be set for real in register */ + } + + up(&performance_sem); + return_VALUE(retval); +} +EXPORT_SYMBOL(acpi_processor_preregister_performance); + + int acpi_processor_register_performance(struct acpi_processor_performance *performance, unsigned int cpu) diff -puN drivers/acpi/processor_thermal.c~git-acpi drivers/acpi/processor_thermal.c --- devel/drivers/acpi/processor_thermal.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/processor_thermal.c 2006-04-26 13:41:00.000000000 -0700 @@ -82,7 +82,7 @@ static int acpi_processor_apply_limit(st end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to set limit\n")); + ACPI_ERROR((AE_INFO, "Unable to set limit")); return_VALUE(result); } @@ -289,8 +289,7 @@ int acpi_processor_set_thermal_limit(acp result = acpi_processor_apply_limit(pr); if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to set thermal limit\n")); + ACPI_ERROR((AE_INFO, "Unable to set thermal limit")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", pr->limit.thermal.px, pr->limit.thermal.tx)); @@ -362,25 +361,23 @@ static ssize_t acpi_processor_write_limi ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); if (!pr || (count > sizeof(limit_string) - 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); return_VALUE(-EINVAL); } if (copy_from_user(limit_string, buffer, count)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); return_VALUE(-EFAULT); } limit_string[count] = '\0'; if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); + ACPI_ERROR((AE_INFO, "Invalid data format")); return_VALUE(-EINVAL); } if (pr->flags.throttling) { if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid tx\n")); + ACPI_ERROR((AE_INFO, "Invalid tx")); return_VALUE(-EINVAL); } pr->limit.user.tx = tx; diff -puN drivers/acpi/processor_throttling.c~git-acpi drivers/acpi/processor_throttling.c --- devel/drivers/acpi/processor_throttling.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/processor_throttling.c 2006-04-26 13:41:00.000000000 -0700 @@ -196,7 +196,7 @@ int acpi_processor_get_throttling_info(s } /* TBD: Support duty_cycle values that span bit 4. */ else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "duty_cycle spans bit 4\n")); + ACPI_WARNING((AE_INFO, "duty_cycle spans bit 4")); return_VALUE(0); } diff -puN drivers/acpi/resources/rscalc.c~git-acpi drivers/acpi/resources/rscalc.c --- devel/drivers/acpi/resources/rscalc.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/resources/rscalc.c 2006-04-26 13:41:00.000000000 -0700 @@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit ACPI_FUNCTION_ENTRY(); for (bits_set = 0; bit_field; bits_set++) { + /* Zero the least significant bit that is set */ bit_field &= (bit_field - 1); @@ -154,15 +155,18 @@ acpi_rs_stream_option_length(u32 resourc * length, minus one byte for the resource_source_index itself. */ if (resource_length > minimum_aml_resource_length) { + /* Compute the length of the optional string */ string_length = resource_length - minimum_aml_resource_length - 1; } - /* Round up length to 32 bits for internal structure alignment */ - - return (ACPI_ROUND_UP_to_32_bITS(string_length)); + /* + * Round the length up to a multiple of the native word in order to + * guarantee that the entire resource descriptor is native word aligned + */ + return ((u32) ACPI_ROUND_UP_TO_NATIVE_WORD(string_length)); } /******************************************************************************* @@ -191,6 +195,7 @@ acpi_rs_get_aml_length(struct acpi_resou /* Traverse entire list of internal resource descriptors */ while (resource) { + /* Validate the descriptor type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { @@ -214,6 +219,7 @@ acpi_rs_get_aml_length(struct acpi_resou * is a Large Resource data type. */ if (resource->data.vendor.byte_length > 7) { + /* Base size of a Large resource descriptor */ total_size = @@ -332,7 +338,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, acpi_status status; u8 *end_aml; u8 *buffer; - u32 buffer_size = 0; + u32 buffer_size; u16 temp16; u16 resource_length; u32 extra_struct_bytes; @@ -341,11 +347,13 @@ acpi_rs_get_list_length(u8 * aml_buffer, ACPI_FUNCTION_TRACE("rs_get_list_length"); + *size_needed = 0; end_aml = aml_buffer + aml_buffer_length; /* Walk the list of AML resource descriptors */ while (aml_buffer < end_aml) { + /* Validate the Resource Type and Resource Length */ status = acpi_ut_validate_resource(aml_buffer, &resource_index); @@ -386,35 +394,28 @@ acpi_rs_get_list_length(u8 * aml_buffer, break; case ACPI_RESOURCE_NAME_VENDOR_SMALL: + case ACPI_RESOURCE_NAME_VENDOR_LARGE: /* * Vendor Resource: - * Ensure a 32-bit boundary for the structure + * Get the number of vendor data bytes */ - extra_struct_bytes = - ACPI_ROUND_UP_to_32_bITS(resource_length); + extra_struct_bytes = resource_length; break; case ACPI_RESOURCE_NAME_END_TAG: /* - * End Tag: This is the normal exit, add size of end_tag + * End Tag: + * This is the normal exit, add size of end_tag */ - *size_needed = buffer_size + ACPI_RS_SIZE_MIN; + *size_needed += ACPI_RS_SIZE_MIN; return_ACPI_STATUS(AE_OK); - case ACPI_RESOURCE_NAME_VENDOR_LARGE: - /* - * Vendor Resource: - * Add vendor data and ensure a 32-bit boundary for the structure - */ - extra_struct_bytes = - ACPI_ROUND_UP_to_32_bITS(resource_length); - break; - case ACPI_RESOURCE_NAME_ADDRESS32: case ACPI_RESOURCE_NAME_ADDRESS16: + case ACPI_RESOURCE_NAME_ADDRESS64: /* - * 32-Bit or 16-bit Address Resource: - * Add the size of any optional data (resource_source) + * Address Resource: + * Add the size of the optional resource_source */ extra_struct_bytes = acpi_rs_stream_option_length(resource_length, @@ -423,50 +424,46 @@ acpi_rs_get_list_length(u8 * aml_buffer, case ACPI_RESOURCE_NAME_EXTENDED_IRQ: /* - * Extended IRQ: - * Point past the interrupt_vector_flags to get the - * interrupt_table_length. + * Extended IRQ Resource: + * Using the interrupt_table_length, add 4 bytes for each additional + * interrupt. Note: at least one interrupt is required and is + * included in the minimum descriptor size (reason for the -1) */ - buffer++; + extra_struct_bytes = (buffer[1] - 1) * sizeof(u32); - extra_struct_bytes = - /* - * Add 4 bytes for each additional interrupt. Note: at - * least one interrupt is required and is included in - * the minimum descriptor size - */ - ((*buffer - 1) * sizeof(u32)) + - /* Add the size of any optional data (resource_source) */ + /* Add the size of the optional resource_source */ + + extra_struct_bytes += acpi_rs_stream_option_length(resource_length - extra_struct_bytes, minimum_aml_resource_length); break; - case ACPI_RESOURCE_NAME_ADDRESS64: - /* - * 64-Bit Address Resource: - * Add the size of any optional data (resource_source) - * Ensure a 64-bit boundary for the structure - */ - extra_struct_bytes = - ACPI_ROUND_UP_to_64_bITS - (acpi_rs_stream_option_length - (resource_length, minimum_aml_resource_length)); - break; - default: break; } - /* Update the required buffer size for the internal descriptor structs */ - - temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + - extra_struct_bytes); - buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); + /* + * Update the required buffer size for the internal descriptor structs + * + * Important: Round the size up for the appropriate alignment. This + * is a requirement on IA64. + */ + buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + + extra_struct_bytes; + buffer_size = ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); + + *size_needed += buffer_size; + + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, + "Type %.2X, Aml %.2X internal %.2X\n", + acpi_ut_get_resource_type(aml_buffer), + acpi_ut_get_descriptor_length(aml_buffer), + buffer_size)); /* - * Point to the next resource within the stream - * using the size of the header plus the length contained in the header + * Point to the next resource within the AML stream using the length + * contained in the resource descriptor header */ aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); } @@ -523,6 +520,7 @@ acpi_rs_get_pci_routing_table_length(uni top_object_list = package_object->package.elements; for (index = 0; index < number_of_elements; index++) { + /* Dereference the sub-package */ package_element = *top_object_list; @@ -581,7 +579,7 @@ acpi_rs_get_pci_routing_table_length(uni /* Round up the size since each element must be aligned */ - temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); + temp_size_needed = ACPI_ROUND_UP_to_64_bIT(temp_size_needed); /* Point to the next union acpi_operand_object */ @@ -589,7 +587,7 @@ acpi_rs_get_pci_routing_table_length(uni } /* - * Adding an extra element to the end of the list, essentially a + * Add an extra element to the end of the list, essentially a * NULL terminator */ *buffer_size_needed = diff -puN drivers/acpi/resources/rscreate.c~git-acpi drivers/acpi/resources/rscreate.c --- devel/drivers/acpi/resources/rscreate.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/resources/rscreate.c 2006-04-26 13:41:00.000000000 -0700 @@ -332,7 +332,7 @@ acpi_rs_create_pci_routing_table(union a /* Now align the current length */ user_prt->length = - (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); + (u32) ACPI_ROUND_UP_to_64_bIT(user_prt->length); /* 4) Fourth subobject: Dereference the PRT.source_index */ diff -puN drivers/acpi/resources/rsinfo.c~git-acpi drivers/acpi/resources/rsinfo.c --- devel/drivers/acpi/resources/rsinfo.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/resources/rsinfo.c 2006-04-26 13:41:00.000000000 -0700 @@ -141,6 +141,7 @@ struct acpi_rsdump_info *acpi_gbl_dump_r acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; #endif + #endif /* ACPI_FUTURE_USAGE */ /* * Base sizes for external AML resource descriptors, indexed by internal type. diff -puN drivers/acpi/resources/rslist.c~git-acpi drivers/acpi/resources/rslist.c --- devel/drivers/acpi/resources/rslist.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/resources/rslist.c 2006-04-26 13:41:00.000000000 -0700 @@ -77,6 +77,16 @@ acpi_rs_convert_aml_to_resources(u8 * am /* Loop until end-of-buffer or an end_tag is found */ while (aml < end_aml) { + /* + * Check that the input buffer and all subsequent pointers into it + * are aligned on a native word boundary. Most important on IA64 + */ + if (ACPI_IS_MISALIGNED(resource)) { + ACPI_WARNING((AE_INFO, + "Misaligned resource pointer %p", + resource)); + } + /* Validate the Resource Type and Resource Length */ status = acpi_ut_validate_resource(aml, &resource_index); @@ -100,6 +110,12 @@ acpi_rs_convert_aml_to_resources(u8 * am return_ACPI_STATUS(status); } + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, + "Type %.2X, Aml %.2X internal %.2X\n", + acpi_ut_get_resource_type(aml), + acpi_ut_get_descriptor_length(aml), + resource->length)); + /* Normal exit on completion of an end_tag resource descriptor */ if (acpi_ut_get_resource_type(aml) == @@ -155,6 +171,7 @@ acpi_rs_convert_resources_to_aml(struct /* Walk the resource descriptor list, convert each descriptor */ while (aml < end_aml) { + /* Validate the (internal) Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { @@ -191,6 +208,7 @@ acpi_rs_convert_resources_to_aml(struct /* Check for end-of-list, normal exit */ if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + /* An End Tag indicates the end of the input Resource Template */ return_ACPI_STATUS(AE_OK); diff -puN drivers/acpi/resources/rsmisc.c~git-acpi drivers/acpi/resources/rsmisc.c --- devel/drivers/acpi/resources/rsmisc.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/resources/rsmisc.c 2006-04-26 13:41:00.000000000 -0700 @@ -81,9 +81,10 @@ acpi_rs_convert_aml_to_resource(struct a u16 item_count = 0; u16 temp16 = 0; - ACPI_FUNCTION_TRACE("rs_get_resource"); + ACPI_FUNCTION_TRACE("rs_convert_aml_to_resource"); if (((acpi_native_uint) resource) & 0x3) { + /* Each internal resource struct is expected to be 32-bit aligned */ ACPI_WARNING((AE_INFO, @@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct a exit: if (!flags_mode) { - /* Round the resource struct length up to the next 32-bit boundary */ - resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); + /* Round the resource struct length up to the next boundary (32 or 64) */ + + resource->length = + (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); } return_ACPI_STATUS(AE_OK); } @@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || resource->data.extended_irq.interrupt_count = temp8; if (temp8 < 1) { + /* Must have at least one IRQ */ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); diff -puN drivers/acpi/resources/rsutils.c~git-acpi drivers/acpi/resources/rsutils.c --- devel/drivers/acpi/resources/rsutils.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/resources/rsutils.c 2006-04-26 13:41:00.000000000 -0700 @@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_ /* Length is stored differently for large and small descriptors */ if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large descriptor -- bytes 1-2 contain the 16-bit length */ ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, @@ -298,7 +299,8 @@ static u16 acpi_rs_strcpy(char *destinat * string_ptr - (optional) where to store the actual * resource_source string * - * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit + * RETURN: Length of the string plus NULL terminator, rounded up to native + * word boundary * * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor * to an internal resource descriptor @@ -328,6 +330,7 @@ acpi_rs_get_resource_source(acpi_rs_leng * we add 1 to the minimum length. */ if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { + /* Get the resource_source_index */ resource_source->index = aml_resource_source[0]; @@ -344,23 +347,25 @@ acpi_rs_get_resource_source(acpi_rs_leng } /* - * In order for the struct_size to fall on a 32-bit boundary, calculate - * the length of the string (+1 for the NULL terminator) and expand the - * struct_size to the next 32-bit boundary. + * In order for the Resource length to be a multiple of the native + * word, calculate the length of the string (+1 for NULL terminator) + * and expand to the next word multiple. * * Zero the entire area of the buffer. */ total_length = - ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN - ((char *)&aml_resource_source[1]) + - 1); + ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + + 1; + total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); + ACPI_MEMSET(resource_source->string_ptr, 0, total_length); /* Copy the resource_source string to the destination */ resource_source->string_length = acpi_rs_strcpy(resource_source->string_ptr, - (char *)&aml_resource_source[1]); + ACPI_CAST_PTR(char, + &aml_resource_source[1])); return ((acpi_rs_length) total_length); } @@ -405,6 +410,7 @@ acpi_rs_set_resource_source(union aml_re /* Non-zero string length indicates presence of a resource_source */ if (resource_source->string_length) { + /* Point to the end of the AML descriptor */ aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); @@ -415,7 +421,7 @@ acpi_rs_set_resource_source(union aml_re /* Copy the resource_source string */ - ACPI_STRCPY((char *)&aml_resource_source[1], + ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]), resource_source->string_ptr); /* @@ -435,9 +441,9 @@ acpi_rs_set_resource_source(union aml_re * * FUNCTION: acpi_rs_get_prt_method_data * - * PARAMETERS: Handle - a handle to the containing object - * ret_buffer - a pointer to a buffer structure for the - * results + * PARAMETERS: Handle - Handle to the containing object + * ret_buffer - Pointer to a buffer structure for the + * results * * RETURN: Status * @@ -483,9 +489,9 @@ acpi_rs_get_prt_method_data(acpi_handle * * FUNCTION: acpi_rs_get_crs_method_data * - * PARAMETERS: Handle - a handle to the containing object - * ret_buffer - a pointer to a buffer structure for the - * results + * PARAMETERS: Handle - Handle to the containing object + * ret_buffer - Pointer to a buffer structure for the + * results * * RETURN: Status * @@ -532,9 +538,9 @@ acpi_rs_get_crs_method_data(acpi_handle * * FUNCTION: acpi_rs_get_prs_method_data * - * PARAMETERS: Handle - a handle to the containing object - * ret_buffer - a pointer to a buffer structure for the - * results + * PARAMETERS: Handle - Handle to the containing object + * ret_buffer - Pointer to a buffer structure for the + * results * * RETURN: Status * @@ -583,10 +589,10 @@ acpi_rs_get_prs_method_data(acpi_handle * * FUNCTION: acpi_rs_get_method_data * - * PARAMETERS: Handle - a handle to the containing object + * PARAMETERS: Handle - Handle to the containing object * Path - Path to method, relative to Handle - * ret_buffer - a pointer to a buffer structure for the - * results + * ret_buffer - Pointer to a buffer structure for the + * results * * RETURN: Status * @@ -634,9 +640,9 @@ acpi_rs_get_method_data(acpi_handle hand * * FUNCTION: acpi_rs_set_srs_method_data * - * PARAMETERS: Handle - a handle to the containing object - * in_buffer - a pointer to a buffer structure of the - * parameter + * PARAMETERS: Handle - Handle to the containing object + * in_buffer - Pointer to a buffer structure of the + * parameter * * RETURN: Status * @@ -696,6 +702,7 @@ acpi_rs_set_srs_method_data(acpi_handle status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); if (ACPI_SUCCESS(status)) { + /* Delete any return object (especially if implicit_return is enabled) */ if (info.return_object) { diff -puN drivers/acpi/resources/rsxface.c~git-acpi drivers/acpi/resources/rsxface.c --- devel/drivers/acpi/resources/rsxface.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/resources/rsxface.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include @@ -118,6 +116,8 @@ acpi_get_irq_routing_table(acpi_handle d return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_get_irq_routing_table) + /******************************************************************************* * * FUNCTION: acpi_get_current_resources @@ -141,7 +141,6 @@ acpi_get_irq_routing_table(acpi_handle d * the object indicated by the passed device_handle. * ******************************************************************************/ - acpi_status acpi_get_current_resources(acpi_handle device_handle, struct acpi_buffer *ret_buffer) @@ -169,8 +168,9 @@ acpi_get_current_resources(acpi_handle d return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_current_resources); +ACPI_EXPORT_SYMBOL(acpi_get_current_resources) +#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * * FUNCTION: acpi_get_possible_resources @@ -191,8 +191,6 @@ EXPORT_SYMBOL(acpi_get_current_resources * and the value of ret_buffer is undefined. * ******************************************************************************/ - -#ifdef ACPI_FUTURE_USAGE acpi_status acpi_get_possible_resources(acpi_handle device_handle, struct acpi_buffer *ret_buffer) @@ -220,7 +218,7 @@ acpi_get_possible_resources(acpi_handle return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_possible_resources); +ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -241,7 +239,6 @@ EXPORT_SYMBOL(acpi_get_possible_resource * each resource in the list. * ******************************************************************************/ - acpi_status acpi_walk_resources(acpi_handle device_handle, char *name, @@ -279,6 +276,7 @@ acpi_walk_resources(acpi_handle device_h /* Walk the resource list until the end_tag is found (or buffer end) */ while (resource < resource_end) { + /* Sanity check the resource */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { @@ -291,6 +289,7 @@ acpi_walk_resources(acpi_handle device_h status = user_function(resource, context); if (ACPI_FAILURE(status)) { if (status == AE_CTRL_TERMINATE) { + /* This is an OK termination by the user function */ status = AE_OK; @@ -311,11 +310,11 @@ acpi_walk_resources(acpi_handle device_h resource->length); } - ACPI_MEM_FREE(buffer.pointer); + ACPI_FREE(buffer.pointer); return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_walk_resources); +ACPI_EXPORT_SYMBOL(acpi_walk_resources) /******************************************************************************* * @@ -334,7 +333,6 @@ EXPORT_SYMBOL(acpi_walk_resources); * the buffer pointed to by the in_buffer variable. * ******************************************************************************/ - acpi_status acpi_set_current_resources(acpi_handle device_handle, struct acpi_buffer *in_buffer) @@ -354,7 +352,7 @@ acpi_set_current_resources(acpi_handle d return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_set_current_resources); +ACPI_EXPORT_SYMBOL(acpi_set_current_resources) /****************************************************************************** * @@ -373,7 +371,6 @@ EXPORT_SYMBOL(acpi_set_current_resources * addresses. * ******************************************************************************/ - acpi_status acpi_resource_to_address64(struct acpi_resource *resource, struct acpi_resource_address64 *out) @@ -415,7 +412,7 @@ acpi_resource_to_address64(struct acpi_r return (AE_OK); } -EXPORT_SYMBOL(acpi_resource_to_address64); +ACPI_EXPORT_SYMBOL(acpi_resource_to_address64) /******************************************************************************* * @@ -435,7 +432,6 @@ EXPORT_SYMBOL(acpi_resource_to_address64 * UUID subtype. Returns a struct acpi_resource of type Vendor. * ******************************************************************************/ - acpi_status acpi_get_vendor_resource(acpi_handle device_handle, char *name, @@ -467,6 +463,8 @@ acpi_get_vendor_resource(acpi_handle dev return (info.status); } +ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource) + /******************************************************************************* * * FUNCTION: acpi_rs_match_vendor_resource @@ -478,7 +476,6 @@ acpi_get_vendor_resource(acpi_handle dev * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID * ******************************************************************************/ - static acpi_status acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) { @@ -526,3 +523,5 @@ acpi_rs_match_vendor_resource(struct acp info->status = AE_OK; return (AE_CTRL_TERMINATE); } + +ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource) diff -puN drivers/acpi/scan.c~git-acpi drivers/acpi/scan.c --- devel/drivers/acpi/scan.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/scan.c 2006-04-26 13:41:00.000000000 -0700 @@ -234,12 +234,9 @@ static int acpi_bus_get_power_flags(stru int acpi_match_ids(struct acpi_device *device, char *ids) { - int error = 0; - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - if (device->flags.hardware_id) if (strstr(ids, device->pnp.hardware_id)) - goto Done; + return 0; if (device->flags.compatible_ids) { struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; @@ -248,15 +245,10 @@ int acpi_match_ids(struct acpi_device *d /* compare multiple _CID entries against driver ids */ for (i = 0; i < cid_list->count; i++) { if (strstr(ids, cid_list->id[i].value)) - goto Done; + return 0; } } - error = -ENOENT; - - Done: - if (buffer.pointer) - acpi_os_free(buffer.pointer); - return error; + return -ENOENT; } static acpi_status @@ -320,15 +312,14 @@ static int acpi_bus_get_wakeup_device_fl /* _PRW */ status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRW\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW")); goto end; } package = (union acpi_object *)buffer.pointer; status = acpi_bus_extract_wakeup_device_power_package(device, package); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error extracting _PRW package\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package")); goto end; } @@ -441,10 +432,7 @@ acpi_eject_store(struct acpi_device *dev islockable = device->flags.lockable; handle = device->handle; - if (type == ACPI_TYPE_PROCESSOR) - result = acpi_bus_trim(device, 0); - else - result = acpi_bus_trim(device, 1); + result = acpi_bus_trim(device, 1); if (!result) result = acpi_eject_operation(handle, islockable); @@ -548,10 +536,9 @@ static int acpi_start_single_object(stru return_VALUE(result); } -static int acpi_driver_attach(struct acpi_driver *drv) +static void acpi_driver_attach(struct acpi_driver *drv) { struct list_head *node, *next; - int count = 0; ACPI_FUNCTION_TRACE("acpi_driver_attach"); @@ -568,7 +555,6 @@ static int acpi_driver_attach(struct acp if (!acpi_bus_driver_init(dev, drv)) { acpi_start_single_object(dev); atomic_inc(&drv->references); - count++; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", drv->name, dev->pnp.bus_id)); @@ -577,7 +563,6 @@ static int acpi_driver_attach(struct acp spin_lock(&acpi_device_lock); } spin_unlock(&acpi_device_lock); - return_VALUE(count); } static int acpi_driver_detach(struct acpi_driver *drv) @@ -610,14 +595,11 @@ static int acpi_driver_detach(struct acp * @driver: driver being registered * * Registers a driver with the ACPI bus. Searches the namespace for all - * devices that match the driver's criteria and binds. Returns the - * number of devices that were claimed by the driver, or a negative - * error status for failure. + * devices that match the driver's criteria and binds. Returns zero for + * success or a negative error status for failure. */ int acpi_bus_register_driver(struct acpi_driver *driver) { - int count; - ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); if (acpi_disabled) @@ -629,9 +611,9 @@ int acpi_bus_register_driver(struct acpi spin_lock(&acpi_device_lock); list_add_tail(&driver->node, &acpi_bus_drivers); spin_unlock(&acpi_device_lock); - count = acpi_driver_attach(driver); + acpi_driver_attach(driver); - return_VALUE(count); + return_VALUE(0); } EXPORT_SYMBOL(acpi_bus_register_driver); @@ -645,21 +627,19 @@ EXPORT_SYMBOL(acpi_bus_register_driver); */ int acpi_bus_unregister_driver(struct acpi_driver *driver) { - int error = 0; - ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver"); - if (driver) { - acpi_driver_detach(driver); + if (!driver) + return_VALUE(-EINVAL); - if (!atomic_read(&driver->references)) { - spin_lock(&acpi_device_lock); - list_del_init(&driver->node); - spin_unlock(&acpi_device_lock); - } - } else - error = -EINVAL; - return_VALUE(error); + acpi_driver_detach(driver); + + if (!atomic_read(&driver->references)) { + spin_lock(&acpi_device_lock); + list_del_init(&driver->node); + spin_unlock(&acpi_device_lock); + } + return_VALUE(0); } EXPORT_SYMBOL(acpi_bus_unregister_driver); @@ -1000,7 +980,7 @@ acpi_add_single_object(struct acpi_devic device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); if (!device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); + ACPI_ERROR((AE_INFO, "Memory allocation error")); return_VALUE(-ENOMEM); } memset(device, 0, sizeof(struct acpi_device)); diff -puN drivers/acpi/sleep/wakeup.c~git-acpi drivers/acpi/sleep/wakeup.c --- devel/drivers/acpi/sleep/wakeup.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/sleep/wakeup.c 2006-04-26 13:41:00.000000000 -0700 @@ -155,7 +155,6 @@ static int __init acpi_wakeup_device_ini if (acpi_disabled) return 0; - printk("ACPI wakeup devices: \n"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { @@ -174,10 +173,8 @@ static int __init acpi_wakeup_device_ini dev->wakeup.state.enabled = 1; spin_lock(&acpi_device_lock); } - printk("%4s ", dev->pnp.bus_id); } spin_unlock(&acpi_device_lock); - printk("\n"); return 0; } diff -puN drivers/acpi/system.c~git-acpi drivers/acpi/system.c --- devel/drivers/acpi/system.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/system.c 2006-04-26 13:41:00.000000000 -0700 @@ -161,9 +161,6 @@ static int __init acpi_system_init(void) return_VALUE(error); Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); - remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir); diff -puN drivers/acpi/tables/tbconvrt.c~git-acpi drivers/acpi/tables/tbconvrt.c --- devel/drivers/acpi/tables/tbconvrt.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbconvrt.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include @@ -64,7 +62,7 @@ acpi_tb_convert_fadt2(struct fadt_descri struct fadt_descriptor_rev2 *original_fadt); u8 acpi_fadt_is_v1; -EXPORT_SYMBOL(acpi_fadt_is_v1); +ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1) /******************************************************************************* * @@ -133,7 +131,7 @@ acpi_status acpi_tb_convert_to_xsdt(stru /* Allocate an XSDT */ - new_table = ACPI_MEM_CALLOCATE(table_size); + new_table = ACPI_ALLOCATE_ZEROED(table_size); if (!new_table) { return (AE_NO_MEMORY); } @@ -147,6 +145,7 @@ acpi_status acpi_tb_convert_to_xsdt(stru /* Copy the table pointers */ for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { + /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { @@ -508,13 +507,14 @@ acpi_status acpi_tb_convert_table_fadt(v /* Allocate buffer for the ACPI 2.0(+) FADT */ - local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); + local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor_rev2)); if (!local_fadt) { return_ACPI_STATUS(AE_NO_MEMORY); } if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { + /* Length is too short to be a V2.0 table */ ACPI_WARNING((AE_INFO, @@ -603,6 +603,7 @@ acpi_status acpi_tb_build_common_facs(st if ((acpi_gbl_RSDP->revision < 2) || (acpi_gbl_FACS->length < 32) || (!(acpi_gbl_FACS->xfirmware_waking_vector))) { + /* ACPI 1.0 FACS or short table or optional X_ field is zero */ acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, diff -puN drivers/acpi/tables/tbgetall.c~git-acpi drivers/acpi/tables/tbgetall.c --- devel/drivers/acpi/tables/tbgetall.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbgetall.c 2006-04-26 13:41:00.000000000 -0700 @@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables( * any SSDTs. */ for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { + /* Get the table address from the common internal XSDT */ address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; diff -puN drivers/acpi/tables/tbget.c~git-acpi drivers/acpi/tables/tbget.c --- devel/drivers/acpi/tables/tbget.c~git-acpi 2006-04-26 13:40:58.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbget.c 2006-04-26 13:41:00.000000000 -0700 @@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_poi sizeof(struct acpi_table_header), (void *)&header); if (ACPI_FAILURE(status)) { + ACPI_ERROR((AE_INFO, + "Could not map memory at %8.8X%8.8X for table header", + ACPI_FORMAT_UINT64(address->pointer. + physical))); return_ACPI_STATUS(status); } @@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_point status = acpi_tb_table_override(header, table_info); if (ACPI_SUCCESS(status)) { + /* Table was overridden by the host OS */ return_ACPI_STATUS(status); @@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table */ status = acpi_os_table_override(header, &new_table); if (ACPI_FAILURE(status)) { + /* Some severe error from the OSL, but we basically ignore it */ ACPI_EXCEPTION((AE_INFO, status, @@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table } if (!new_table) { + /* No table override */ return_ACPI_STATUS(AE_NO_ACPI_TABLES); @@ -323,7 +330,7 @@ acpi_tb_get_this_table(struct acpi_point /* Pointer matches processor mode, copy the table to a new buffer */ - full_table = ACPI_MEM_ALLOCATE(header->length); + full_table = ACPI_ALLOCATE(header->length); if (!full_table) { ACPI_ERROR((AE_INFO, "Could not allocate table memory for [%4.4s] length %X", @@ -381,6 +388,7 @@ acpi_tb_get_this_table(struct acpi_point #if (!ACPI_CHECKSUM_ABORT) if (ACPI_FAILURE(status)) { + /* Ignore the error if configuration says so */ status = AE_OK; @@ -440,6 +448,7 @@ acpi_tb_get_table_ptr(acpi_table_type ta * instance is always in the list head. */ if (instance == 1) { + /* Get the first */ *table_ptr_loc = NULL; diff -puN drivers/acpi/tables/tbinstal.c~git-acpi drivers/acpi/tables/tbinstal.c --- devel/drivers/acpi/tables/tbinstal.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbinstal.c 2006-04-26 13:41:00.000000000 -0700 @@ -84,6 +84,7 @@ acpi_tb_match_signature(char *signature, if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, acpi_gbl_table_data[i].sig_length)) { + /* Found a signature match, return index if requested */ if (table_info) { @@ -247,7 +248,7 @@ acpi_tb_init_table_descriptor(acpi_table /* Allocate a descriptor for this table */ - table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); + table_desc = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); if (!table_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -274,7 +275,7 @@ acpi_tb_init_table_descriptor(acpi_table * at this location, so return an error. */ if (list_head->next) { - ACPI_MEM_FREE(table_desc); + ACPI_FREE(table_desc); return_ACPI_STATUS(AE_ALREADY_EXISTS); } @@ -471,7 +472,7 @@ void acpi_tb_delete_single_table(struct case ACPI_MEM_ALLOCATED: - ACPI_MEM_FREE(table_desc->pointer); + ACPI_FREE(table_desc->pointer); break; case ACPI_MEM_MAPPED: @@ -530,7 +531,7 @@ struct acpi_table_desc *acpi_tb_uninstal /* Free the table descriptor */ next_desc = table_desc->next; - ACPI_MEM_FREE(table_desc); + ACPI_FREE(table_desc); /* Return pointer to the next descriptor */ diff -puN drivers/acpi/tables/tbrsdt.c~git-acpi drivers/acpi/tables/tbrsdt.c --- devel/drivers/acpi/tables/tbrsdt.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbrsdt.c 2006-04-26 13:41:00.000000000 -0700 @@ -190,6 +190,7 @@ acpi_status acpi_tb_validate_rsdt(struct } if (no_match) { + /* Invalid RSDT or XSDT signature */ ACPI_ERROR((AE_INFO, diff -puN drivers/acpi/tables/tbutils.c~git-acpi drivers/acpi/tables/tbutils.c --- devel/drivers/acpi/tables/tbutils.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbutils.c 2006-04-26 13:41:00.000000000 -0700 @@ -96,6 +96,7 @@ acpi_status acpi_tb_is_table_installed(s (!ACPI_MEMCMP (table_desc->pointer, new_table_desc->pointer, new_table_desc->pointer->length))) { + /* Match: this table is already installed */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, @@ -249,6 +250,7 @@ u8 acpi_tb_generate_checksum(void *buffe u8 sum = 0; if (buffer && length) { + /* Buffer and Length are valid */ end_buffer = ACPI_ADD_PTR(u8, buffer, length); diff -puN drivers/acpi/tables/tbxface.c~git-acpi drivers/acpi/tables/tbxface.c --- devel/drivers/acpi/tables/tbxface.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbxface.c 2006-04-26 13:41:00.000000000 -0700 @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -123,6 +121,8 @@ acpi_status acpi_load_tables(void) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_load_tables) + #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -139,7 +139,6 @@ acpi_status acpi_load_tables(void) * is determined that the table is invalid, the call will fail. * ******************************************************************************/ - acpi_status acpi_load_table(struct acpi_table_header *table_ptr) { acpi_status status; @@ -174,6 +173,7 @@ acpi_status acpi_load_table(struct acpi_ status = acpi_tb_install_table(&table_info); if (ACPI_FAILURE(status)) { if (status == AE_ALREADY_EXISTS) { + /* Table already exists, no error */ status = AE_OK; @@ -208,6 +208,7 @@ acpi_status acpi_load_table(struct acpi_ } if (ACPI_FAILURE(status)) { + /* Uninstall table and free the buffer */ (void)acpi_tb_uninstall_table(table_info.installed_desc); @@ -216,6 +217,8 @@ acpi_status acpi_load_table(struct acpi_ return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_load_table) + /******************************************************************************* * * FUNCTION: acpi_unload_table @@ -227,7 +230,6 @@ acpi_status acpi_load_table(struct acpi_ * DESCRIPTION: This routine is used to force the unload of a table * ******************************************************************************/ - acpi_status acpi_unload_table(acpi_table_type table_type) { struct acpi_table_desc *table_desc; @@ -261,6 +263,8 @@ acpi_status acpi_unload_table(acpi_table return_ACPI_STATUS(AE_OK); } +ACPI_EXPORT_SYMBOL(acpi_unload_table) + /******************************************************************************* * * FUNCTION: acpi_get_table_header @@ -281,7 +285,6 @@ acpi_status acpi_unload_table(acpi_table * have a standard header and is fixed length. * ******************************************************************************/ - acpi_status acpi_get_table_header(acpi_table_type table_type, u32 instance, struct acpi_table_header *out_table_header) @@ -325,6 +328,7 @@ acpi_get_table_header(acpi_table_type ta return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_get_table_header) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -349,7 +353,6 @@ acpi_get_table_header(acpi_table_type ta * a complete table including the header. * ******************************************************************************/ - acpi_status acpi_get_table(acpi_table_type table_type, u32 instance, struct acpi_buffer *ret_buffer) @@ -397,6 +400,7 @@ acpi_get_table(acpi_table_type table_typ /* Get the table length */ if (table_type == ACPI_TABLE_RSDP) { + /* RSD PTR is the only "table" without a header */ table_length = sizeof(struct rsdp_descriptor); @@ -417,4 +421,4 @@ acpi_get_table(acpi_table_type table_typ return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_get_table); +ACPI_EXPORT_SYMBOL(acpi_get_table) diff -puN drivers/acpi/tables/tbxfroot.c~git-acpi drivers/acpi/tables/tbxfroot.c --- devel/drivers/acpi/tables/tbxfroot.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/tables/tbxfroot.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include @@ -75,6 +73,7 @@ acpi_status acpi_tb_validate_rsdp(struct * The signature and checksum must both be correct */ if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { + /* Nope, BAD Signature */ return (AE_BAD_SIGNATURE); @@ -217,6 +216,7 @@ acpi_get_firmware_table(acpi_string sign /* Ensure that we have a RSDP */ if (!acpi_gbl_RSDP) { + /* Get the RSDP */ status = acpi_os_get_root_pointer(flags, &address); @@ -261,7 +261,7 @@ acpi_get_firmware_table(acpi_string sign /* Get and validate the RSDT */ - rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); + rsdt_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); if (!rsdt_info) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -278,13 +278,13 @@ acpi_get_firmware_table(acpi_string sign /* Allocate a scratch table header and table descriptor */ - header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); + header = ACPI_ALLOCATE(sizeof(struct acpi_table_header)); if (!header) { status = AE_NO_MEMORY; goto cleanup; } - table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); + table_info = ACPI_ALLOCATE(sizeof(struct acpi_table_desc)); if (!table_info) { status = AE_NO_MEMORY; goto cleanup; @@ -327,10 +327,12 @@ acpi_get_firmware_table(acpi_string sign /* Compare table signatures and table instance */ if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { + /* An instance of the table was found */ j++; if (j >= instance) { + /* Found the correct instance, get the entire table */ status = @@ -355,23 +357,21 @@ acpi_get_firmware_table(acpi_string sign acpi_os_unmap_memory(rsdt_info->pointer, (acpi_size) rsdt_info->pointer->length); } - ACPI_MEM_FREE(rsdt_info); + ACPI_FREE(rsdt_info); if (header) { - ACPI_MEM_FREE(header); + ACPI_FREE(header); } if (table_info) { - ACPI_MEM_FREE(table_info); + ACPI_FREE(table_info); } return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_get_firmware_table); +ACPI_EXPORT_SYMBOL(acpi_get_firmware_table) /* TBD: Move to a new file */ - #if ACPI_MACHINE_WIDTH != 16 - /******************************************************************************* * * FUNCTION: acpi_find_root_pointer @@ -384,7 +384,6 @@ EXPORT_SYMBOL(acpi_get_firmware_table); * DESCRIPTION: Find the RSDP * ******************************************************************************/ - acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) { struct acpi_table_desc table_info; @@ -407,6 +406,8 @@ acpi_status acpi_find_root_pointer(u32 f return_ACPI_STATUS(AE_OK); } +ACPI_EXPORT_SYMBOL(acpi_find_root_pointer) + /******************************************************************************* * * FUNCTION: acpi_tb_scan_memory_for_rsdp @@ -419,7 +420,6 @@ acpi_status acpi_find_root_pointer(u32 f * DESCRIPTION: Search a block of memory for the RSDP signature * ******************************************************************************/ - static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) { acpi_status status; @@ -434,12 +434,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp( for (mem_rover = start_address; mem_rover < end_address; mem_rover += ACPI_RSDP_SCAN_STEP) { + /* The RSDP signature and checksum must both be correct */ status = acpi_tb_validate_rsdp(ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover)); if (ACPI_SUCCESS(status)) { + /* Sig and checksum valid, we have found a real RSDP */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -495,6 +497,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc * Scan supports either logical addressing or physical addressing */ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { + /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ status = acpi_os_map_memory((acpi_physical_address) @@ -542,6 +545,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { + /* Return the physical address */ physical_address += @@ -576,6 +580,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { + /* Return the physical address */ physical_address = @@ -609,6 +614,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc (physical_address), ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { + /* Return the physical address */ table_info->physical_address = @@ -624,6 +630,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc (ACPI_HI_RSDP_WINDOW_BASE), ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { + /* Found it, return the physical address */ table_info->physical_address = diff -puN drivers/acpi/thermal.c~git-acpi drivers/acpi/thermal.c --- devel/drivers/acpi/thermal.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/thermal.c 2006-04-26 13:41:00.000000000 -0700 @@ -323,7 +323,7 @@ static int acpi_thermal_get_trip_points( &tz->trips.critical.temperature); if (ACPI_FAILURE(status)) { tz->trips.critical.flags.valid = 0; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n")); + ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); return_VALUE(-ENODEV); } else { tz->trips.critical.flags.valid = 1; @@ -382,8 +382,7 @@ static int acpi_thermal_get_trip_points( tz->trips.passive.flags.valid = 0; if (!tz->trips.passive.flags.valid) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid passive threshold\n")); + ACPI_WARNING((AE_INFO, "Invalid passive threshold")); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found passive threshold [%lu]\n", @@ -412,9 +411,8 @@ static int acpi_thermal_get_trip_points( "Found active threshold [%d]:[%lu]\n", i, tz->trips.active[i].temperature)); } else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid active threshold [%d]\n", - i)); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid active threshold [%d]", i)); } return_VALUE(0); @@ -469,7 +467,7 @@ static int acpi_thermal_critical(struct return_VALUE(-EINVAL); if (tz->temperature >= tz->trips.critical.temperature) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n")); + ACPI_WARNING((AE_INFO, "Critical trip point")); tz->trips.critical.flags.enabled = 1; } else if (tz->trips.critical.flags.enabled) tz->trips.critical.flags.enabled = 0; @@ -500,7 +498,7 @@ static int acpi_thermal_hot(struct acpi_ return_VALUE(-EINVAL); if (tz->temperature >= tz->trips.hot.temperature) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Hot trip point\n")); + ACPI_WARNING((AE_INFO, "Hot trip point")); tz->trips.hot.flags.enabled = 1; } else if (tz->trips.hot.flags.enabled) tz->trips.hot.flags.enabled = 0; @@ -640,10 +638,10 @@ static void acpi_thermal_active(struct a handles[j], ACPI_STATE_D0); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'on'\n", - active->devices. - handles[j])); + ACPI_WARNING((AE_INFO, + "Unable to turn cooling device [%p] 'on'", + active->devices. + handles[j])); continue; } active->flags.enabled = 1; @@ -665,9 +663,9 @@ static void acpi_thermal_active(struct a result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D3); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'off'\n", - active->devices.handles[j])); + ACPI_WARNING((AE_INFO, + "Unable to turn cooling device [%p] 'off'", + active->devices.handles[j])); continue; } active->flags.enabled = 0; @@ -699,7 +697,7 @@ static void acpi_thermal_check(void *dat ACPI_FUNCTION_TRACE("acpi_thermal_check"); if (!tz) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); + ACPI_ERROR((AE_INFO, "Invalid (NULL) context")); return_VOID; } @@ -942,17 +940,17 @@ acpi_thermal_write_trip_points(struct fi memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); - if (!active) + if (!active) { + kfree(limit_string); return_VALUE(-ENOMEM); + } if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); count = -EINVAL; goto end; } if (copy_from_user(limit_string, buffer, count)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); count = -EFAULT; goto end; } @@ -965,7 +963,6 @@ acpi_thermal_write_trip_points(struct fi &active[5], &active[6], &active[7], &active[8], &active[9]); if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); count = -EINVAL; goto end; } @@ -1125,9 +1122,7 @@ static int acpi_thermal_add_fs(struct ac entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_STATE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_state_fops; entry->data = acpi_driver_data(device); @@ -1138,9 +1133,7 @@ static int acpi_thermal_add_fs(struct ac entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TEMPERATURE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_temp_fops; entry->data = acpi_driver_data(device); @@ -1152,9 +1145,7 @@ static int acpi_thermal_add_fs(struct ac S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TRIP_POINTS)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_trip_fops; entry->data = acpi_driver_data(device); @@ -1166,9 +1157,7 @@ static int acpi_thermal_add_fs(struct ac S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_COOLING_MODE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_cooling_fops; entry->data = acpi_driver_data(device); @@ -1180,9 +1169,7 @@ static int acpi_thermal_add_fs(struct ac S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_POLLING_FREQ)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_polling_fops; entry->data = acpi_driver_data(device); @@ -1352,8 +1339,6 @@ static int acpi_thermal_add(struct acpi_ ACPI_DEVICE_NOTIFY, acpi_thermal_notify, tz); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -1395,9 +1380,6 @@ static int acpi_thermal_remove(struct ac status = acpi_remove_notify_handler(tz->handle, ACPI_DEVICE_NOTIFY, acpi_thermal_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); /* Terminate policy */ if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { diff -puN drivers/acpi/utilities/utalloc.c~git-acpi drivers/acpi/utilities/utalloc.c --- devel/drivers/acpi/utilities/utalloc.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utalloc.c 2006-04-26 13:41:00.000000000 -0700 @@ -252,7 +252,7 @@ acpi_ut_initialize_buffer(struct acpi_bu /* Allocate a new buffer with local interface to allow tracking */ - buffer->pointer = ACPI_MEM_CALLOCATE(required_length); + buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length); if (!buffer->pointer) { return (AE_NO_MEMORY); } @@ -308,6 +308,7 @@ void *acpi_ut_allocate(acpi_size size, u allocation = acpi_os_allocate(size); if (!allocation) { + /* Report allocation error */ ACPI_ERROR((module, line, @@ -351,6 +352,7 @@ void *acpi_ut_callocate(acpi_size size, allocation = acpi_os_allocate(size); if (!allocation) { + /* Report allocation error */ ACPI_ERROR((module, line, @@ -477,6 +479,7 @@ void *acpi_ut_callocate_and_track(acpi_s acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), component, module, line); if (!allocation) { + /* Report allocation error */ ACPI_ERROR((module, line, @@ -681,6 +684,7 @@ acpi_ut_remove_allocation(struct acpi_de mem_list = acpi_gbl_global_list; if (NULL == mem_list->list_head) { + /* No allocations! */ ACPI_ERROR((module, line, @@ -807,6 +811,7 @@ void acpi_ut_dump_allocations(u32 compon if ((element->component & component) && ((module == NULL) || (0 == ACPI_STRCMP(module, element->module)))) { + /* Ignore allocated objects that are in a cache */ descriptor = diff -puN drivers/acpi/utilities/utcache.c~git-acpi drivers/acpi/utilities/utcache.c --- devel/drivers/acpi/utilities/utcache.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utcache.c 2006-04-26 13:41:00.000000000 -0700 @@ -118,13 +118,14 @@ acpi_status acpi_os_purge_cache(struct a /* Walk the list of objects in this cache */ while (cache->list_head) { + /* Delete and unlink one cached state object */ next = *(ACPI_CAST_INDIRECT_PTR(char, &(((char *)cache-> list_head)[cache-> link_offset]))); - ACPI_MEM_FREE(cache->list_head); + ACPI_FREE(cache->list_head); cache->list_head = next; cache->current_depth--; @@ -193,7 +194,7 @@ acpi_os_release_object(struct acpi_memor /* If cache is full, just free this object */ if (cache->current_depth >= cache->max_depth) { - ACPI_MEM_FREE(object); + ACPI_FREE(object); ACPI_MEM_TRACKING(cache->total_freed++); } @@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi /* Check the cache first */ if (cache->list_head) { + /* There is an object available, use it */ object = cache->list_head; @@ -287,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi ACPI_MEM_TRACKING(cache->total_allocated++); - /* Avoid deadlock with ACPI_MEM_CALLOCATE */ + /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ status = acpi_ut_release_mutex(ACPI_MTX_CACHES); if (ACPI_FAILURE(status)) { return (NULL); } - object = ACPI_MEM_CALLOCATE(cache->object_size); + object = ACPI_ALLOCATE_ZEROED(cache->object_size); if (!object) { return (NULL); } diff -puN drivers/acpi/utilities/utcopy.c~git-acpi drivers/acpi/utilities/utcopy.c --- devel/drivers/acpi/utilities/utcopy.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utcopy.c 2006-04-26 13:41:00.000000000 -0700 @@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union ac case ACPI_TYPE_STRING: internal_object->string.pointer = - ACPI_MEM_CALLOCATE((acpi_size) external_object->string. - length + 1); + ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string. + length + 1); if (!internal_object->string.pointer) { goto error_exit; } @@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union ac case ACPI_TYPE_BUFFER: internal_object->buffer.pointer = - ACPI_MEM_CALLOCATE(external_object->buffer.length); + ACPI_ALLOCATE_ZEROED(external_object->buffer.length); if (!internal_object->buffer.pointer) { goto error_exit; } @@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_op if ((source_desc->buffer.pointer) && (source_desc->buffer.length)) { dest_desc->buffer.pointer = - ACPI_MEM_ALLOCATE(source_desc->buffer.length); + ACPI_ALLOCATE(source_desc->buffer.length); if (!dest_desc->buffer.pointer) { return (AE_NO_MEMORY); } @@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_op */ if (source_desc->string.pointer) { dest_desc->string.pointer = - ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. - length + 1); + ACPI_ALLOCATE((acpi_size) source_desc->string. + length + 1); if (!dest_desc->string.pointer) { return (AE_NO_MEMORY); } @@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 obj /* * Create the object array */ - target_object->package.elements = - ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. - count + 1) * sizeof(void *)); + target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); if (!target_object->package.elements) { status = AE_NO_MEMORY; goto error_exit; @@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union /* * Create the object array and walk the source package tree */ - dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) - source_obj->package. - count + - 1) * sizeof(void *)); + dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) + source_obj->package. + count + + 1) * sizeof(void *)); if (!dest_obj->package.elements) { ACPI_ERROR((AE_INFO, "Package allocation failure")); return_ACPI_STATUS(AE_NO_MEMORY); @@ -882,6 +880,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_ut_copy_ielement_to_ielement, walk_state); if (ACPI_FAILURE(status)) { + /* On failure, delete the destination package object */ acpi_ut_remove_reference(dest_obj); diff -puN drivers/acpi/utilities/utdebug.c~git-acpi drivers/acpi/utilities/utdebug.c --- devel/drivers/acpi/utilities/utdebug.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utdebug.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #define _COMPONENT ACPI_UTILITIES @@ -123,12 +121,14 @@ static const char *acpi_ut_trim_function /* All Function names are longer than 4 chars, check is safe */ if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { + /* This is the case where the original source has not been modified */ return (function_name + 4); } if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { + /* This is the case where the source has been 'linuxized' */ return (function_name + 5); @@ -162,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_ const char *function_name, char *module_name, u32 component_id, char *format, ...) { - u32 thread_id; + acpi_thread_id thread_id; va_list args; /* @@ -177,7 +177,6 @@ acpi_ut_debug_print(u32 requested_debug_ * Thread tracking and context switch notification */ thread_id = acpi_os_get_thread_id(); - if (thread_id != acpi_gbl_prev_thread_id) { if (ACPI_LV_THREADS & acpi_dbg_level) { acpi_os_printf @@ -206,7 +205,7 @@ acpi_ut_debug_print(u32 requested_debug_ acpi_os_vprintf(format, args); } -EXPORT_SYMBOL(acpi_ut_debug_print); +ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) /******************************************************************************* * @@ -226,7 +225,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print); * debug_print so that the same macros can be used. * ******************************************************************************/ - void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw(u32 requested_debug_level, u32 line_number, @@ -244,7 +242,7 @@ acpi_ut_debug_print_raw(u32 requested_de acpi_os_vprintf(format, args); } -EXPORT_SYMBOL(acpi_ut_debug_print_raw); +ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) /******************************************************************************* * @@ -261,7 +259,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); * set in debug_level * ******************************************************************************/ - void acpi_ut_trace(u32 line_number, const char *function_name, char *module_name, u32 component_id) @@ -275,7 +272,7 @@ acpi_ut_trace(u32 line_number, component_id, "%s\n", acpi_gbl_fn_entry_str); } -EXPORT_SYMBOL(acpi_ut_trace); +ACPI_EXPORT_SYMBOL(acpi_ut_trace) /******************************************************************************* * @@ -293,7 +290,6 @@ EXPORT_SYMBOL(acpi_ut_trace); * set in debug_level * ******************************************************************************/ - void acpi_ut_trace_ptr(u32 line_number, const char *function_name, @@ -400,7 +396,7 @@ acpi_ut_exit(u32 line_number, acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_exit); +ACPI_EXPORT_SYMBOL(acpi_ut_exit) /******************************************************************************* * @@ -418,7 +414,6 @@ EXPORT_SYMBOL(acpi_ut_exit); * set in debug_level. Prints exit status also. * ******************************************************************************/ - void acpi_ut_status_exit(u32 line_number, const char *function_name, @@ -442,7 +437,7 @@ acpi_ut_status_exit(u32 line_number, acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_status_exit); +ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) /******************************************************************************* * @@ -460,7 +455,6 @@ EXPORT_SYMBOL(acpi_ut_status_exit); * set in debug_level. Prints exit value also. * ******************************************************************************/ - void acpi_ut_value_exit(u32 line_number, const char *function_name, @@ -475,7 +469,7 @@ acpi_ut_value_exit(u32 line_number, acpi_gbl_nesting_level--; } -EXPORT_SYMBOL(acpi_ut_value_exit); +ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) /******************************************************************************* * @@ -493,7 +487,6 @@ EXPORT_SYMBOL(acpi_ut_value_exit); * set in debug_level. Prints exit value also. * ******************************************************************************/ - void acpi_ut_ptr_exit(u32 line_number, const char *function_name, @@ -545,6 +538,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u3 /* Nasty little dump buffer routine! */ while (i < count) { + /* Print current offset */ acpi_os_printf("%6.4X: ", (u32) i); @@ -553,6 +547,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u3 for (j = 0; j < 16;) { if (i + j >= count) { + /* Dump fill spaces */ acpi_os_printf("%*s", ((display * 2) + 1), " "); diff -puN drivers/acpi/utilities/utdelete.c~git-acpi drivers/acpi/utilities/utdelete.c --- devel/drivers/acpi/utilities/utdelete.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utdelete.c 2006-04-26 13:41:00.000000000 -0700 @@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj( /* Free the actual string buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { + /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->string.pointer; @@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj( /* Free the actual buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { + /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->buffer.pointer; @@ -234,7 +236,7 @@ static void acpi_ut_delete_internal_obj( if (obj_pointer) { ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", obj_pointer)); - ACPI_MEM_FREE(obj_pointer); + ACPI_FREE(obj_pointer); } /* Now the object can be safely deleted */ @@ -273,7 +275,7 @@ void acpi_ut_delete_internal_object_list /* Free the combined parameter pointer list and object array */ - ACPI_MEM_FREE(obj_list); + ACPI_FREE(obj_list); return_VOID; } @@ -415,6 +417,7 @@ acpi_ut_update_object_reference(union ac ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); while (object) { + /* Make sure that this isn't a namespace handle */ if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { diff -puN drivers/acpi/utilities/uteval.c~git-acpi drivers/acpi/utilities/uteval.c --- devel/drivers/acpi/utilities/uteval.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/uteval.c 2006-04-26 13:41:00.000000000 -0700 @@ -98,6 +98,7 @@ acpi_status acpi_ut_osi_implementation(s ACPI_CAST_PTR(char, acpi_gbl_valid_osi_strings[i]))) { + /* This string is supported */ return_desc->integer.value = 0xFFFFFFFF; @@ -343,6 +344,7 @@ acpi_ut_execute_HID(struct acpi_namespac } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { + /* Convert the Numeric HID to string */ acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, @@ -459,7 +461,7 @@ acpi_ut_execute_CID(struct acpi_namespac size = (((count - 1) * sizeof(struct acpi_compatible_id)) + sizeof(struct acpi_compatible_id_list)); - cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); + cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); if (!cid_list) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -479,6 +481,7 @@ acpi_ut_execute_CID(struct acpi_namespac /* The _CID object can be either a single CID or a package (list) of CIDs */ if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { + /* Translate each package element */ for (i = 0; i < count; i++) { @@ -499,7 +502,7 @@ acpi_ut_execute_CID(struct acpi_namespac /* Cleanup on error */ if (ACPI_FAILURE(status)) { - ACPI_MEM_FREE(cid_list); + ACPI_FREE(cid_list); } else { *return_cid_list = cid_list; } @@ -543,6 +546,7 @@ acpi_ut_execute_UID(struct acpi_namespac } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { + /* Convert the Numeric UID to string */ acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, diff -puN drivers/acpi/utilities/utglobal.c~git-acpi drivers/acpi/utilities/utglobal.c --- devel/drivers/acpi/utilities/utglobal.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utglobal.c 2006-04-26 13:41:00.000000000 -0700 @@ -43,7 +43,6 @@ #define DEFINE_ACPI_GLOBALS -#include #include #include @@ -119,6 +118,7 @@ const char *acpi_format_exception(acpi_s } if (!exception) { + /* Exception code was not recognized */ ACPI_ERROR((AE_INFO, @@ -143,12 +143,10 @@ const char *acpi_format_exception(acpi_s /* Debug switch - level and trace mask */ u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; -EXPORT_SYMBOL(acpi_dbg_level); /* Debug switch - layer (component) mask */ u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; -EXPORT_SYMBOL(acpi_dbg_layer); u32 acpi_gbl_nesting_level = 0; /* Debugger globals */ @@ -747,6 +745,7 @@ u8 acpi_ut_valid_object_type(acpi_object { if (type > ACPI_TYPE_LOCAL_MAX) { + /* Note: Assumes all TYPEs are contiguous (external/local) */ return (FALSE); @@ -869,3 +868,6 @@ void acpi_ut_init_globals(void) return_VOID; } + +ACPI_EXPORT_SYMBOL(acpi_dbg_level) +ACPI_EXPORT_SYMBOL(acpi_dbg_layer) diff -puN drivers/acpi/utilities/utinit.c~git-acpi drivers/acpi/utilities/utinit.c --- devel/drivers/acpi/utilities/utinit.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utinit.c 2006-04-26 13:41:00.000000000 -0700 @@ -186,14 +186,14 @@ static void acpi_ut_terminate(void) gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { next_gpe_block = gpe_block->next; - ACPI_MEM_FREE(gpe_block->event_info); - ACPI_MEM_FREE(gpe_block->register_info); - ACPI_MEM_FREE(gpe_block); + ACPI_FREE(gpe_block->event_info); + ACPI_FREE(gpe_block->register_info); + ACPI_FREE(gpe_block); gpe_block = next_gpe_block; } next_gpe_xrupt_info = gpe_xrupt_info->next; - ACPI_MEM_FREE(gpe_xrupt_info); + ACPI_FREE(gpe_xrupt_info); gpe_xrupt_info = next_gpe_xrupt_info; } diff -puN drivers/acpi/utilities/utmisc.c~git-acpi drivers/acpi/utilities/utmisc.c --- devel/drivers/acpi/utilities/utmisc.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utmisc.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include @@ -97,6 +99,7 @@ acpi_status acpi_ut_allocate_owner_id(ac for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { + /* There are no free IDs in this mask */ break; @@ -273,6 +276,7 @@ void acpi_ut_print_string(char *string, acpi_os_printf("\""); for (i = 0; string[i] && (i < max_length); i++) { + /* Escape sequences */ switch (string[i]) { @@ -461,7 +465,7 @@ acpi_ut_display_init_pathname(u8 type, } acpi_os_printf("\n"); - ACPI_MEM_FREE(buffer.pointer); + ACPI_FREE(buffer.pointer); } #endif @@ -601,11 +605,13 @@ acpi_ut_strtoul64(char *string, u32 base while (*string) { if (ACPI_IS_DIGIT(*string)) { + /* Convert ASCII 0-9 to Decimal value */ this_digit = ((u8) * string) - '0'; } else { if (base == 10) { + /* Digit is out of range */ goto error_exit; @@ -613,6 +619,7 @@ acpi_ut_strtoul64(char *string, u32 base this_digit = (u8) ACPI_TOUPPER(*string); if (ACPI_IS_XDIGIT((char)this_digit)) { + /* Convert ASCII Hex char to value */ this_digit = this_digit - 'A' + 10; @@ -727,6 +734,7 @@ acpi_ut_walk_package_tree(union acpi_ope } while (state) { + /* Get one element of the package */ this_index = state->pkg.index; @@ -814,31 +822,6 @@ acpi_ut_walk_package_tree(union acpi_ope /******************************************************************************* * - * FUNCTION: acpi_ut_generate_checksum - * - * PARAMETERS: Buffer - Buffer to be scanned - * Length - number of bytes to examine - * - * RETURN: The generated checksum - * - * DESCRIPTION: Generate a checksum on a raw buffer - * - ******************************************************************************/ - -u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) -{ - u32 i; - signed char sum = 0; - - for (i = 0; i < length; i++) { - sum = (signed char)(sum + buffer[i]); - } - - return ((u8) (0 - sum)); -} - -/******************************************************************************* - * * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info * * PARAMETERS: module_name - Caller's module name (for error output) @@ -862,6 +845,7 @@ acpi_ut_error(char *module_name, u32 lin acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } +EXPORT_SYMBOL(acpi_ut_error); void ACPI_INTERNAL_VAR_XFACE acpi_ut_exception(char *module_name, @@ -876,6 +860,7 @@ acpi_ut_exception(char *module_name, acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } +EXPORT_SYMBOL(acpi_ut_exception); void ACPI_INTERNAL_VAR_XFACE acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) @@ -888,7 +873,7 @@ acpi_ut_warning(char *module_name, u32 l acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } - +EXPORT_SYMBOL(acpi_ut_warning); void ACPI_INTERNAL_VAR_XFACE acpi_ut_info(char *module_name, u32 line_number, char *format, ...) { diff -puN drivers/acpi/utilities/utmutex.c~git-acpi drivers/acpi/utilities/utmutex.c --- devel/drivers/acpi/utilities/utmutex.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utmutex.c 2006-04-26 13:41:00.000000000 -0700 @@ -192,7 +192,7 @@ static acpi_status acpi_ut_delete_mutex( acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - u32 this_thread_id; + acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME("ut_acquire_mutex"); @@ -275,7 +275,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_m acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - u32 this_thread_id; + acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME("ut_release_mutex"); diff -puN drivers/acpi/utilities/utobject.c~git-acpi drivers/acpi/utilities/utobject.c --- devel/drivers/acpi/utilities/utobject.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utobject.c 2006-04-26 13:41:00.000000000 -0700 @@ -173,9 +173,10 @@ union acpi_operand_object *acpi_ut_creat /* Create an actual buffer only if size > 0 */ if (buffer_size > 0) { + /* Allocate the actual buffer */ - buffer = ACPI_MEM_CALLOCATE(buffer_size); + buffer = ACPI_ALLOCATE_ZEROED(buffer_size); if (!buffer) { ACPI_ERROR((AE_INFO, "Could not allocate size %X", (u32) buffer_size)); @@ -227,7 +228,7 @@ union acpi_operand_object *acpi_ut_creat * Allocate the actual string buffer -- (Size + 1) for NULL terminator. * NOTE: Zero-length strings are NULL terminated */ - string = ACPI_MEM_CALLOCATE(string_size + 1); + string = ACPI_ALLOCATE_ZEROED(string_size + 1); if (!string) { ACPI_ERROR((AE_INFO, "Could not allocate size %X", (u32) string_size)); @@ -319,6 +320,7 @@ void *acpi_ut_allocate_object_desc_dbg(c } /* Mark the descriptor type */ + memset(object, 0, sizeof(union acpi_operand_object)); ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); @@ -397,6 +399,7 @@ acpi_ut_get_simple_object_size(union acp length = sizeof(union acpi_object); if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { + /* Object is a named object (reference), just return the length */ *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); diff -puN drivers/acpi/utilities/utresrc.c~git-acpi drivers/acpi/utilities/utresrc.c --- devel/drivers/acpi/utilities/utresrc.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utresrc.c 2006-04-26 13:41:00.000000000 -0700 @@ -273,6 +273,7 @@ acpi_status acpi_ut_validate_resource(vo * Examine the large/small bit in the resource header */ if (resource_type & ACPI_RESOURCE_NAME_LARGE) { + /* Verify the large resource type (name) against the max */ if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { @@ -376,6 +377,7 @@ u8 acpi_ut_get_resource_type(void *aml) * Examine the large/small bit in the resource header */ if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ return (ACPI_GET8(aml)); @@ -411,6 +413,7 @@ u16 acpi_ut_get_resource_length(void *am * Examine the large/small bit in the resource header */ if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); @@ -515,6 +518,7 @@ acpi_ut_get_resource_end_tag(union acpi_ /* Walk the resource template, one descriptor per iteration */ while (aml < end_aml) { + /* Validate the Resource Type and Resource Length */ status = acpi_ut_validate_resource(aml, NULL); diff -puN drivers/acpi/utilities/utstate.c~git-acpi drivers/acpi/utilities/utstate.c --- devel/drivers/acpi/utilities/utstate.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utstate.c 2006-04-26 13:41:00.000000000 -0700 @@ -129,6 +129,7 @@ union acpi_generic_state *acpi_ut_pop_ge state = *list_head; if (state) { + /* Update the list head */ *list_head = state->common.next; @@ -158,6 +159,7 @@ union acpi_generic_state *acpi_ut_create state = acpi_os_acquire_object(acpi_gbl_state_cache); if (state) { + /* Initialize */ memset(state, 0, sizeof(union acpi_generic_state)); state->common.data_type = ACPI_DESC_TYPE_STATE; diff -puN drivers/acpi/utilities/utxface.c~git-acpi drivers/acpi/utilities/utxface.c --- devel/drivers/acpi/utilities/utxface.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utilities/utxface.c 2006-04-26 13:41:00.000000000 -0700 @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -109,6 +107,8 @@ acpi_status acpi_initialize_subsystem(vo return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) + /******************************************************************************* * * FUNCTION: acpi_enable_subsystem @@ -121,7 +121,6 @@ acpi_status acpi_initialize_subsystem(vo * Puts system into ACPI mode if it isn't already. * ******************************************************************************/ - acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; @@ -229,6 +228,8 @@ acpi_status acpi_enable_subsystem(u32 fl return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) + /******************************************************************************* * * FUNCTION: acpi_initialize_objects @@ -241,7 +242,6 @@ acpi_status acpi_enable_subsystem(u32 fl * objects and executing AML code for Regions, buffers, etc. * ******************************************************************************/ - acpi_status acpi_initialize_objects(u32 flags) { acpi_status status = AE_OK; @@ -305,6 +305,8 @@ acpi_status acpi_initialize_objects(u32 return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_initialize_objects) + /******************************************************************************* * * FUNCTION: acpi_terminate @@ -316,7 +318,6 @@ acpi_status acpi_initialize_objects(u32 * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. * ******************************************************************************/ - acpi_status acpi_terminate(void) { acpi_status status; @@ -348,6 +349,8 @@ acpi_status acpi_terminate(void) return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_terminate) + #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -362,7 +365,6 @@ acpi_status acpi_terminate(void) * initialized successfully. * ******************************************************************************/ - acpi_status acpi_subsystem_status(void) { @@ -373,6 +375,8 @@ acpi_status acpi_subsystem_status(void) } } +ACPI_EXPORT_SYMBOL(acpi_subsystem_status) + /******************************************************************************* * * FUNCTION: acpi_get_system_info @@ -390,7 +394,6 @@ acpi_status acpi_subsystem_status(void) * and the value of out_buffer is undefined. * ******************************************************************************/ - acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) { struct acpi_system_info *info_ptr; @@ -456,7 +459,7 @@ acpi_status acpi_get_system_info(struct return_ACPI_STATUS(AE_OK); } -EXPORT_SYMBOL(acpi_get_system_info); +ACPI_EXPORT_SYMBOL(acpi_get_system_info) /***************************************************************************** * @@ -472,7 +475,6 @@ EXPORT_SYMBOL(acpi_get_system_info); * TBD: When a second function is added, must save the Function also. * ****************************************************************************/ - acpi_status acpi_install_initialization_handler(acpi_init_handler handler, u32 function) { @@ -489,6 +491,7 @@ acpi_install_initialization_handler(acpi return AE_OK; } +ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) #endif /* ACPI_FUTURE_USAGE */ /***************************************************************************** @@ -502,7 +505,6 @@ acpi_install_initialization_handler(acpi * DESCRIPTION: Empty all caches (delete the cached objects) * ****************************************************************************/ - acpi_status acpi_purge_cached_objects(void) { ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); @@ -513,3 +515,5 @@ acpi_status acpi_purge_cached_objects(vo (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); return_ACPI_STATUS(AE_OK); } + +ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) diff -puN drivers/acpi/utils.c~git-acpi drivers/acpi/utils.c --- devel/drivers/acpi/utils.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/utils.c 2006-04-26 13:41:00.000000000 -0700 @@ -62,26 +62,25 @@ acpi_extract_package(union acpi_object * if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid 'package' argument\n")); + ACPI_WARNING((AE_INFO, "Invalid package argument")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!format || !format->pointer || (format->length < 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'format' argument\n")); + ACPI_WARNING((AE_INFO, "Invalid format argument")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!buffer) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'buffer' argument\n")); + ACPI_WARNING((AE_INFO, "Invalid buffer argument")); return_ACPI_STATUS(AE_BAD_PARAMETER); } format_count = (format->length / sizeof(char)) - 1; if (format_count > package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Format specifies more objects [%d] than exist in package [%d].", - format_count, package->package.count)); + ACPI_WARNING((AE_INFO, "Format specifies more objects [%d]" + " than exist in package [%d].", + format_count, package->package.count)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -113,9 +112,10 @@ acpi_extract_package(union acpi_object * tail_offset += sizeof(char *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid package element [%d]: got number, expecing [%c].\n", - i, format_string[i])); + ACPI_WARNING((AE_INFO, "Invalid package element" + " [%d]: got number, expecing" + " [%c]", + i, format_string[i])); return_ACPI_STATUS(AE_BAD_DATA); break; } @@ -138,9 +138,10 @@ acpi_extract_package(union acpi_object * tail_offset += sizeof(u8 *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid package element [%d] got string/buffer, expecing [%c].\n", - i, format_string[i])); + ACPI_WARNING((AE_INFO, "Invalid package element" + " [%d] got string/buffer," + " expecing [%c]", + i, format_string[i])); return_ACPI_STATUS(AE_BAD_DATA); break; } @@ -323,7 +324,7 @@ acpi_evaluate_string(acpi_handle handle, *data = kmalloc(element->string.length + 1, GFP_KERNEL); if (!data) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); + ACPI_ERROR((AE_INFO, "Memory allocation")); return_VALUE(-ENOMEM); } memset(*data, 0, element->string.length + 1); @@ -365,25 +366,22 @@ acpi_evaluate_reference(acpi_handle hand package = (union acpi_object *)buffer.pointer; if ((buffer.length == 0) || !package) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No return object (len %X ptr %p)\n", - (unsigned)buffer.length, package)); + ACPI_ERROR((AE_INFO, "No return object (len %X ptr %p)", + (unsigned)buffer.length, package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->type != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Package], found type %X\n", - package->type)); + ACPI_ERROR((AE_INFO, "Expecting a [Package], found type %X", + package->type)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "[Package] has zero elements (%p)\n", - package)); + ACPI_ERROR((AE_INFO, "[Package] has zero elements (%p)", + package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; @@ -402,9 +400,9 @@ acpi_evaluate_reference(acpi_handle hand if (element->type != ACPI_TYPE_ANY) { status = AE_BAD_DATA; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Reference] package element, found type %X\n", - element->type)); + ACPI_ERROR((AE_INFO, + "Expecting a [Reference] package element, found type %X", + element->type)); acpi_util_eval_error(handle, pathname, status); break; } diff -puN drivers/acpi/video.c~git-acpi drivers/acpi/video.c --- devel/drivers/acpi/video.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/acpi/video.c 2006-04-26 13:41:00.000000000 -0700 @@ -323,8 +323,8 @@ acpi_video_device_lcd_query_levels(struc if (!ACPI_SUCCESS(status)) return_VALUE(status); obj = (union acpi_object *)buffer.pointer; - if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); + if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { + ACPI_ERROR((AE_INFO, "Invalid _BCL data")); status = -EFAULT; goto err; } @@ -399,7 +399,7 @@ acpi_video_device_EDID(struct acpi_video if (obj && obj->type == ACPI_TYPE_BUFFER) *edid = obj; else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DDC data\n")); + ACPI_ERROR((AE_INFO, "Invalid _DDC data")); status = -EFAULT; kfree(obj); } @@ -560,8 +560,7 @@ static void acpi_video_device_find_cap(s o = (union acpi_object *)&obj->package. elements[i]; if (o->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid data\n")); + ACPI_ERROR((AE_INFO, "Invalid data")); continue; } br->levels[count] = (u32) o->integer.value; @@ -904,8 +903,7 @@ static int acpi_video_device_add_fs(stru /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'info' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_device_info_fops; entry->data = acpi_driver_data(device); @@ -917,8 +915,7 @@ static int acpi_video_device_add_fs(stru create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'state' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_device_state_fops.write = acpi_video_device_write_state; entry->proc_fops = &acpi_video_device_state_fops; @@ -931,8 +928,7 @@ static int acpi_video_device_add_fs(stru create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; entry->proc_fops = &acpi_video_device_brightness_fops; @@ -943,8 +939,7 @@ static int acpi_video_device_add_fs(stru /* 'EDID' [R] */ entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_device_EDID_fops; entry->data = acpi_driver_data(device); @@ -1200,8 +1195,7 @@ static int acpi_video_bus_add_fs(struct /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'info' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_bus_info_fops; entry->data = acpi_driver_data(device); @@ -1211,8 +1205,7 @@ static int acpi_video_bus_add_fs(struct /* 'ROM' [R] */ entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'ROM' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_bus_ROM_fops; entry->data = acpi_driver_data(device); @@ -1223,8 +1216,7 @@ static int acpi_video_bus_add_fs(struct entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'POST_info' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_bus_POST_info_fops; entry->data = acpi_driver_data(device); @@ -1236,8 +1228,7 @@ static int acpi_video_bus_add_fs(struct create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'POST' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; entry->proc_fops = &acpi_video_bus_POST_fops; @@ -1250,8 +1241,7 @@ static int acpi_video_bus_add_fs(struct create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'DOS' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; entry->proc_fops = &acpi_video_bus_DOS_fops; @@ -1344,8 +1334,6 @@ acpi_video_bus_get_one_device(struct acp acpi_video_device_notify, data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -1444,13 +1432,13 @@ static int acpi_video_device_enumerate(s status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); if (!ACPI_SUCCESS(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _DOD\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); return_VALUE(status); } dod = (union acpi_object *)buffer.pointer; if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); + ACPI_EXCEPTION((AE_INFO, status, "Invalid _DOD data")); status = -EFAULT; goto out; } @@ -1474,8 +1462,7 @@ static int acpi_video_device_enumerate(s obj = (union acpi_object *)&dod->package.elements[i]; if (obj->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _DOD data\n")); + ACPI_ERROR((AE_INFO, "Invalid _DOD data")); active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID; } @@ -1589,8 +1576,7 @@ acpi_video_bus_get_devices(struct acpi_v status = acpi_video_bus_get_one_device(dev, video); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Cant attach device\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); continue; } @@ -1618,9 +1604,6 @@ static int acpi_video_bus_put_one_device status = acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, acpi_video_device_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); return_VALUE(0); } @@ -1783,8 +1766,6 @@ static int acpi_video_bus_add(struct acp ACPI_DEVICE_NOTIFY, acpi_video_bus_notify, video); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -1821,9 +1802,6 @@ static int acpi_video_bus_remove(struct status = acpi_remove_notify_handler(video->handle, ACPI_DEVICE_NOTIFY, acpi_video_bus_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_video_bus_put_devices(video); acpi_video_bus_remove_fs(device); diff -puN drivers/char/agp/hp-agp.c~git-acpi drivers/char/agp/hp-agp.c --- devel/drivers/char/agp/hp-agp.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/char/agp/hp-agp.c 2006-04-26 13:41:00.000000000 -0700 @@ -497,7 +497,7 @@ zx1_gart_probe (acpi_handle obj, u32 dep info = buffer.pointer; info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; match = (strcmp(info->hardware_id.value, "HWP0001") == 0); - ACPI_MEM_FREE(info); + kfree(info); if (match) { status = hp_acpi_csr_space(handle, &sba_hpa, &length); if (ACPI_SUCCESS(status)) diff -puN drivers/char/hpet.c~git-acpi drivers/char/hpet.c --- devel/drivers/char/hpet.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/char/hpet.c 2006-04-26 13:41:00.000000000 -0700 @@ -925,11 +925,8 @@ static acpi_status hpet_resources(struct status = acpi_resource_to_address64(res, &addr); if (ACPI_SUCCESS(status)) { - unsigned long size; - - size = addr.maximum - addr.minimum + 1; hdp->hd_phys_address = addr.minimum; - hdp->hd_address = ioremap(addr.minimum, size); + hdp->hd_address = ioremap(addr.minimum, addr.address_length); if (hpet_is_known(hdp)) { printk(KERN_DEBUG "%s: 0x%lx is busy\n", diff -puN drivers/char/sonypi.c~git-acpi drivers/char/sonypi.c --- devel/drivers/char/sonypi.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/char/sonypi.c 2006-04-26 13:41:00.000000000 -0700 @@ -512,7 +512,7 @@ static struct sonypi_device { #ifdef CONFIG_ACPI static struct acpi_device *sonypi_acpi_device; -static int acpi_enabled; +static int acpi_driver_registered; #endif static int sonypi_ec_write(u8 addr, u8 value) @@ -869,7 +869,7 @@ found: sonypi_report_input_event(event); #ifdef CONFIG_ACPI - if (acpi_enabled) + if (sonypi_acpi_device) acpi_bus_generate_event(sonypi_acpi_device, 1, event); #endif @@ -1551,8 +1551,8 @@ static int __init sonypi_init(void) goto err_free_device; #ifdef CONFIG_ACPI - if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) - acpi_enabled = 1; + if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) + acpi_driver_registered = 1; #endif return 0; @@ -1567,7 +1567,7 @@ static int __init sonypi_init(void) static void __exit sonypi_exit(void) { #ifdef CONFIG_ACPI - if (acpi_enabled) + if (acpi_driver_registered) acpi_bus_unregister_driver(&sonypi_acpi_driver); #endif platform_device_unregister(sonypi_platform_device); diff -puN drivers/pnp/pnpacpi/rsparser.c~git-acpi drivers/pnp/pnpacpi/rsparser.c --- devel/drivers/pnp/pnpacpi/rsparser.c~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/drivers/pnp/pnpacpi/rsparser.c 2006-04-26 13:41:00.000000000 -0700 @@ -36,13 +36,13 @@ static int irq_flags(int triggering, int { int flag; if (triggering == ACPI_LEVEL_SENSITIVE) { - if(polarity == ACPI_ACTIVE_LOW) + if (polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWLEVEL; else flag = IORESOURCE_IRQ_HIGHLEVEL; } else { - if(polarity == ACPI_ACTIVE_LOW) + if (polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWEDGE; else flag = IORESOURCE_IRQ_HIGHEDGE; @@ -57,7 +57,7 @@ static void decode_irq_flags(int flag, i *triggering = ACPI_LEVEL_SENSITIVE; *polarity = ACPI_ACTIVE_LOW; break; - case IORESOURCE_IRQ_HIGHLEVEL: + case IORESOURCE_IRQ_HIGHLEVEL: *triggering = ACPI_LEVEL_SENSITIVE; *polarity = ACPI_ACTIVE_HIGH; break; @@ -73,7 +73,7 @@ static void decode_irq_flags(int flag, i } static void -pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, +pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, int triggering, int polarity) { int i = 0; @@ -101,7 +101,7 @@ pnpacpi_parse_allocated_irqresource(stru } static void -pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) +pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) { int i = 0; while (i < PNP_MAX_DMA && @@ -119,8 +119,8 @@ pnpacpi_parse_allocated_dmaresource(stru } static void -pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, - u32 io, u32 len) +pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, + u64 io, u64 len) { int i = 0; while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && @@ -138,7 +138,7 @@ pnpacpi_parse_allocated_ioresource(struc } static void -pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, +pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, u64 mem, u64 len) { int i = 0; @@ -156,11 +156,32 @@ pnpacpi_parse_allocated_memresource(stru } } +static void +pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, + struct acpi_resource *res) +{ + struct acpi_resource_address64 addr, *p = &addr; + acpi_status status; + + status = acpi_resource_to_address64(res, p); + if (!ACPI_SUCCESS(status)) { + pnp_warn("PnPACPI: failed to convert resource type %d", + res->type); + return; + } + + if (p->resource_type == ACPI_MEMORY_RANGE) + pnpacpi_parse_allocated_memresource(res_table, + p->minimum, p->address_length); + else if (p->resource_type == ACPI_IO_RANGE) + pnpacpi_parse_allocated_ioresource(res_table, + p->minimum, p->address_length); +} static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, void *data) { - struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; + struct pnp_resource_table *res_table = (struct pnp_resource_table *)data; int i; switch (res->type) { @@ -221,19 +242,9 @@ static acpi_status pnpacpi_allocated_res res->data.fixed_memory32.address_length); break; case ACPI_RESOURCE_TYPE_ADDRESS16: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address16.minimum, - res->data.address16.address_length); - break; case ACPI_RESOURCE_TYPE_ADDRESS32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address32.minimum, - res->data.address32.address_length); - break; case ACPI_RESOURCE_TYPE_ADDRESS64: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address64.minimum, - res->data.address64.address_length); + pnpacpi_parse_allocated_address_space(res_table, res); break; case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: @@ -255,11 +266,11 @@ static acpi_status pnpacpi_allocated_res pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; } - + return AE_OK; } -acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table * res) +acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res) { /* Blank the resource table values */ pnp_init_resource_table(res); @@ -317,17 +328,17 @@ static void pnpacpi_parse_dma_option(str pnp_err("Invalid DMA transfer type"); } - pnp_register_dma_resource(option,dma); + pnp_register_dma_resource(option, dma); return; } - + static void pnpacpi_parse_irq_option(struct pnp_option *option, struct acpi_resource_irq *p) { int i; - struct pnp_irq * irq; - + struct pnp_irq *irq; + if (p->interrupt_count == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); @@ -347,7 +358,7 @@ static void pnpacpi_parse_ext_irq_option struct acpi_resource_extended_irq *p) { int i; - struct pnp_irq * irq; + struct pnp_irq *irq; if (p->interrupt_count == 0) return; @@ -368,7 +379,7 @@ static void pnpacpi_parse_port_option(struct pnp_option *option, struct acpi_resource_io *io) { - struct pnp_port * port; + struct pnp_port *port; if (io->address_length == 0) return; @@ -381,7 +392,7 @@ pnpacpi_parse_port_option(struct pnp_opt port->size = io->address_length; port->flags = ACPI_DECODE_16 == io->io_decode ? PNP_PORT_FLAG_16BITADDR : 0; - pnp_register_port_resource(option,port); + pnp_register_port_resource(option, port); return; } @@ -389,7 +400,7 @@ static void pnpacpi_parse_fixed_port_option(struct pnp_option *option, struct acpi_resource_fixed_io *io) { - struct pnp_port * port; + struct pnp_port *port; if (io->address_length == 0) return; @@ -400,7 +411,7 @@ pnpacpi_parse_fixed_port_option(struct p port->size = io->address_length; port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; - pnp_register_port_resource(option,port); + pnp_register_port_resource(option, port); return; } @@ -408,7 +419,7 @@ static void pnpacpi_parse_mem24_option(struct pnp_option *option, struct acpi_resource_memory24 *p) { - struct pnp_mem * mem; + struct pnp_mem *mem; if (p->address_length == 0) return; @@ -423,7 +434,7 @@ pnpacpi_parse_mem24_option(struct pnp_op mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option,mem); + pnp_register_mem_resource(option, mem); return; } @@ -431,7 +442,7 @@ static void pnpacpi_parse_mem32_option(struct pnp_option *option, struct acpi_resource_memory32 *p) { - struct pnp_mem * mem; + struct pnp_mem *mem; if (p->address_length == 0) return; @@ -446,7 +457,7 @@ pnpacpi_parse_mem32_option(struct pnp_op mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option,mem); + pnp_register_mem_resource(option, mem); return; } @@ -454,7 +465,7 @@ static void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, struct acpi_resource_fixed_memory32 *p) { - struct pnp_mem * mem; + struct pnp_mem *mem; if (p->address_length == 0) return; @@ -468,7 +479,7 @@ pnpacpi_parse_fixed_mem32_option(struct mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option,mem); + pnp_register_mem_resource(option, mem); return; } @@ -477,8 +488,8 @@ pnpacpi_parse_address_option(struct pnp_ { struct acpi_resource_address64 addr, *p = &addr; acpi_status status; - struct pnp_mem * mem; - struct pnp_port * port; + struct pnp_mem *mem; + struct pnp_port *port; status = acpi_resource_to_address64(r, p); if (!ACPI_SUCCESS(status)) { @@ -498,7 +509,7 @@ pnpacpi_parse_address_option(struct pnp_ mem->align = 0; mem->flags = (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option,mem); + pnp_register_mem_resource(option, mem); } else if (p->resource_type == ACPI_IO_RANGE) { port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) @@ -507,7 +518,7 @@ pnpacpi_parse_address_option(struct pnp_ port->size = p->address_length; port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; - pnp_register_port_resource(option,port); + pnp_register_port_resource(option, port); } } @@ -531,7 +542,7 @@ static acpi_status pnpacpi_option_resour break; case ACPI_RESOURCE_TYPE_DMA: - pnpacpi_parse_dma_option(option, &res->data.dma); + pnpacpi_parse_dma_option(option, &res->data.dma); break; case ACPI_RESOURCE_TYPE_START_DEPENDENT: @@ -539,7 +550,7 @@ static acpi_status pnpacpi_option_resour case ACPI_GOOD_CONFIGURATION: priority = PNP_RES_PRIORITY_PREFERRED; break; - + case ACPI_ACCEPTABLE_CONFIGURATION: priority = PNP_RES_PRIORITY_ACCEPTABLE; break; @@ -555,7 +566,7 @@ static acpi_status pnpacpi_option_resour option = pnp_register_dependent_option(dev, priority); if (!option) return AE_ERROR; - parse_data->option = option; + parse_data->option = option; break; case ACPI_RESOURCE_TYPE_END_DEPENDENT: @@ -615,7 +626,7 @@ static acpi_status pnpacpi_option_resour pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; } - + return AE_OK; } @@ -636,13 +647,8 @@ acpi_status pnpacpi_parse_resource_optio return status; } -/* - * Set resource - */ -static acpi_status pnpacpi_count_resources(struct acpi_resource *res, - void *data) +static int pnpacpi_supported_resource(struct acpi_resource *res) { - int *res_cnt = (int *)data; switch (res->type) { case ACPI_RESOURCE_TYPE_IRQ: case ACPI_RESOURCE_TYPE_DMA: @@ -655,43 +661,32 @@ static acpi_status pnpacpi_count_resourc case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - (*res_cnt) ++; - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - case ACPI_RESOURCE_TYPE_END_DEPENDENT: - case ACPI_RESOURCE_TYPE_VENDOR: - case ACPI_RESOURCE_TYPE_END_TAG: - case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: - default: - return AE_OK; + return 1; } - return AE_OK; + return 0; } -static acpi_status pnpacpi_type_resources(struct acpi_resource *res, +/* + * Set resource + */ +static acpi_status pnpacpi_count_resources(struct acpi_resource *res, void *data) { - struct acpi_resource **resource = (struct acpi_resource **)data; - switch (res->type) { - case ACPI_RESOURCE_TYPE_IRQ: - case ACPI_RESOURCE_TYPE_DMA: - case ACPI_RESOURCE_TYPE_IO: - case ACPI_RESOURCE_TYPE_FIXED_IO: - case ACPI_RESOURCE_TYPE_MEMORY24: - case ACPI_RESOURCE_TYPE_MEMORY32: - case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: - case ACPI_RESOURCE_TYPE_ADDRESS16: - case ACPI_RESOURCE_TYPE_ADDRESS32: - case ACPI_RESOURCE_TYPE_ADDRESS64: - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + int *res_cnt = (int *)data; + + if (pnpacpi_supported_resource(res)) + (*res_cnt)++; + return AE_OK; +} + +static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) +{ + struct acpi_resource **resource = (struct acpi_resource **)data; + + if (pnpacpi_supported_resource(res)) { (*resource)->type = res->type; + (*resource)->length = sizeof(struct acpi_resource); (*resource)++; - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - case ACPI_RESOURCE_TYPE_END_DEPENDENT: - case ACPI_RESOURCE_TYPE_VENDOR: - case ACPI_RESOURCE_TYPE_END_TAG: - case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: - default: - return AE_OK; } return AE_OK; @@ -735,11 +730,8 @@ static void pnpacpi_encode_irq(struct ac struct resource *p) { int triggering, polarity; - - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, - &polarity); - resource->type = ACPI_RESOURCE_TYPE_IRQ; - resource->length = sizeof(struct acpi_resource); + + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); resource->data.irq.triggering = triggering; resource->data.irq.polarity = polarity; if (triggering == ACPI_EDGE_SENSITIVE) @@ -754,11 +746,8 @@ static void pnpacpi_encode_ext_irq(struc struct resource *p) { int triggering, polarity; - - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, - &polarity); - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; - resource->length = sizeof(struct acpi_resource); + + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; resource->data.extended_irq.triggering = triggering; resource->data.extended_irq.polarity = polarity; @@ -773,8 +762,6 @@ static void pnpacpi_encode_ext_irq(struc static void pnpacpi_encode_dma(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_DMA; - resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ if (p->flags & IORESOURCE_DMA_COMPATIBLE) resource->data.dma.type = ACPI_COMPATIBILITY; @@ -798,8 +785,6 @@ static void pnpacpi_encode_dma(struct ac static void pnpacpi_encode_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_IO; - resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? ACPI_DECODE_16 : ACPI_DECODE_10; @@ -812,8 +797,6 @@ static void pnpacpi_encode_io(struct acp static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; - resource->length = sizeof(struct acpi_resource); resource->data.fixed_io.address = p->start; resource->data.fixed_io.address_length = p->end - p->start + 1; } @@ -821,8 +804,6 @@ static void pnpacpi_encode_fixed_io(stru static void pnpacpi_encode_mem24(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_MEMORY24; - resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ resource->data.memory24.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? @@ -836,8 +817,6 @@ static void pnpacpi_encode_mem24(struct static void pnpacpi_encode_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_MEMORY32; - resource->length = sizeof(struct acpi_resource); resource->data.memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; @@ -850,8 +829,6 @@ static void pnpacpi_encode_mem32(struct static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; - resource->length = sizeof(struct acpi_resource); resource->data.fixed_memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; @@ -882,37 +859,37 @@ int pnpacpi_encode_resources(struct pnp_ pnp_dbg("Encode dma"); pnpacpi_encode_dma(resource, &res_table->dma_resource[dma]); - dma ++; + dma++; break; case ACPI_RESOURCE_TYPE_IO: pnp_dbg("Encode io"); pnpacpi_encode_io(resource, &res_table->port_resource[port]); - port ++; + port++; break; case ACPI_RESOURCE_TYPE_FIXED_IO: pnp_dbg("Encode fixed io"); pnpacpi_encode_fixed_io(resource, &res_table->port_resource[port]); - port ++; + port++; break; case ACPI_RESOURCE_TYPE_MEMORY24: pnp_dbg("Encode mem24"); pnpacpi_encode_mem24(resource, &res_table->mem_resource[mem]); - mem ++; + mem++; break; case ACPI_RESOURCE_TYPE_MEMORY32: pnp_dbg("Encode mem32"); pnpacpi_encode_mem32(resource, &res_table->mem_resource[mem]); - mem ++; + mem++; break; case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: pnp_dbg("Encode fixed mem32"); pnpacpi_encode_fixed_mem32(resource, &res_table->mem_resource[mem]); - mem ++; + mem++; break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: pnp_dbg("Encode ext irq"); @@ -933,8 +910,8 @@ int pnpacpi_encode_resources(struct pnp_ pnp_warn("unknown resource type %d", resource->type); return -EINVAL; } - resource ++; - i ++; + resource++; + i++; } return 0; } diff -puN include/acpi/acconfig.h~git-acpi include/acpi/acconfig.h --- devel/include/acpi/acconfig.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/acconfig.h 2006-04-26 13:41:00.000000000 -0700 @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060127 +#define ACPI_CA_VERSION 0x20060310 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -102,9 +102,9 @@ #define ACPI_MAX_SEMAPHORE_COUNT 256 -/* Max reference count (for debug only) */ +/* Maximum object reference count (detects object deletion issues) */ -#define ACPI_MAX_REFERENCE_COUNT 0x400 +#define ACPI_MAX_REFERENCE_COUNT 0x800 /* Size of cached memory mapping for system memory operation region */ diff -puN include/acpi/acdisasm.h~git-acpi include/acpi/acdisasm.h --- devel/include/acpi/acdisasm.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/acdisasm.h 2006-04-26 13:41:00.000000000 -0700 @@ -50,6 +50,7 @@ #define BLOCK_PAREN 1 #define BLOCK_BRACE 2 #define BLOCK_COMMA_LIST 4 +#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD" struct acpi_external_list { char *path; @@ -70,6 +71,7 @@ extern const char *acpi_gbl_match_ops[AC struct acpi_op_walk_info { u32 level; u32 bit_offset; + u32 flags; struct acpi_walk_state *walk_state; }; @@ -77,6 +79,11 @@ typedef acpi_status(*asl_walk_callback) (union acpi_parse_object * op, u32 level, void *context); +struct acpi_resource_tag { + u32 bit_index; + char *tag; +}; + /* * dmwalk */ @@ -84,6 +91,11 @@ void acpi_dm_disassemble(struct acpi_walk_state *walk_state, union acpi_parse_object *origin, u32 num_opcodes); +void +acpi_dm_walk_parse_tree(union acpi_parse_object *op, + asl_walk_callback descending_callback, + asl_walk_callback ascending_callback, void *context); + /* * dmopcode */ @@ -166,6 +178,7 @@ void acpi_dm_dump_integer64(u64 value, c void acpi_dm_resource_template(struct acpi_op_walk_info *info, + union acpi_parse_object *op, u8 * byte_data, u32 byte_count); u8 acpi_dm_is_resource_template(union acpi_parse_object *op); @@ -176,6 +189,8 @@ void acpi_dm_bit_list(u16 mask); void acpi_dm_decode_attribute(u8 attribute); +void acpi_dm_descriptor_name(void); + /* * dmresrcl */ @@ -250,4 +265,13 @@ acpi_dm_vendor_small_descriptor(union am */ void acpi_dm_add_to_external_list(char *path); +/* + * dmrestag + */ +void acpi_dm_find_resources(union acpi_parse_object *root); + +void +acpi_dm_check_resource_reference(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); + #endif /* __ACDISASM_H__ */ diff -puN include/acpi/aclocal.h~git-acpi include/acpi/aclocal.h --- devel/include/acpi/aclocal.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/aclocal.h 2006-04-26 13:41:00.000000000 -0700 @@ -129,7 +129,7 @@ typedef u8 acpi_owner_id; struct acpi_mutex_info { acpi_mutex mutex; u32 use_count; - u32 thread_id; + acpi_thread_id thread_id; }; /* Lock flag parameter for various interfaces */ @@ -181,9 +181,9 @@ struct acpi_namespace_node { u8 owner_id; /* Who created this node */ u8 flags; - /* Fields used by the ASL compiler only */ + /* Fields used by the ASL compiler and disassembler only */ -#ifdef ACPI_ASL_COMPILER +#ifdef ACPI_LARGE_NAMESPACE_NODE u32 value; union acpi_parse_object *op; #endif @@ -479,7 +479,7 @@ struct acpi_pscope_state { struct acpi_thread_state { ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ - u32 thread_id; /* Running thread ID */ + acpi_thread_id thread_id; /* Running thread ID */ u8 current_sync_level; /* Mutex Sync (nested acquire) level */ }; diff -puN include/acpi/acmacros.h~git-acpi include/acpi/acmacros.h --- devel/include/acpi/acmacros.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/acmacros.h 2006-04-26 13:41:00.000000000 -0700 @@ -341,29 +341,33 @@ /* * Rounding macros (Power of two boundaries only) */ -#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ +#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ (~(((acpi_native_uint) boundary)-1))) -#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ +#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ (((acpi_native_uint) boundary)-1)) & \ (~(((acpi_native_uint) boundary)-1))) -#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) -#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) -#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) - -#define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4) -#define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) -#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) +/* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */ -#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) -#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) +#define ACPI_ROUND_DOWN_to_32_bIT(a) ACPI_ROUND_DOWN(a,4) +#define ACPI_ROUND_DOWN_to_64_bIT(a) ACPI_ROUND_DOWN(a,8) +#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint)) -#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) +#define ACPI_ROUND_UP_to_32_bIT(a) ACPI_ROUND_UP(a,4) +#define ACPI_ROUND_UP_to_64_bIT(a) ACPI_ROUND_UP(a,8) +#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_native_uint)) + +#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) +#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) + +#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) /* Generic (non-power-of-two) rounding */ -#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) +#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) + +#define ACPI_IS_MISALIGNED(value) (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1)) /* * Bitmask creation @@ -371,10 +375,10 @@ * MASK_BITS_ABOVE creates a mask starting AT the position and above * MASK_BITS_BELOW creates a mask starting one bit BELOW the position */ -#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) -#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) +#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) +#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) -#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) +#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) /* Bitfields within ACPI registers */ @@ -709,18 +713,18 @@ /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_MEM_FREE(a) acpi_os_free(a) +#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_FREE(a) acpi_os_free(a) #define ACPI_MEM_TRACKING(a) #else /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_TRACKING(a) a #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ diff -puN include/acpi/acnamesp.h~git-acpi include/acpi/acnamesp.h --- devel/include/acpi/acnamesp.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/acnamesp.h 2006-04-26 13:41:00.000000000 -0700 @@ -63,6 +63,7 @@ #define ACPI_NS_DONT_OPEN_SCOPE 0x02 #define ACPI_NS_NO_PEER_SEARCH 0x04 #define ACPI_NS_ERROR_IF_FOUND 0x08 +#define ACPI_NS_PREFIX_IS_SCOPE 0x10 #define ACPI_NS_WALK_UNLOCK TRUE #define ACPI_NS_WALK_NO_UNLOCK FALSE @@ -184,6 +185,10 @@ acpi_ns_evaluate_relative(char *pathname */ u32 acpi_ns_opens_scope(acpi_object_type type); +void +acpi_ns_build_external_path(struct acpi_namespace_node *node, + acpi_size size, char *name_buffer); + char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); diff -puN include/acpi/acpiosxf.h~git-acpi include/acpi/acpiosxf.h --- devel/include/acpi/acpiosxf.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/acpiosxf.h 2006-04-26 13:41:00.000000000 -0700 @@ -161,7 +161,7 @@ acpi_os_remove_interrupt_handler(u32 gsi /* * Threads and Scheduling */ -u32 acpi_os_get_thread_id(void); +acpi_thread_id acpi_os_get_thread_id(void); acpi_status acpi_os_queue_for_execution(u32 priority, diff -puN include/acpi/actypes.h~git-acpi include/acpi/actypes.h --- devel/include/acpi/actypes.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/actypes.h 2006-04-26 13:41:00.000000000 -0700 @@ -154,7 +154,6 @@ typedef u64 acpi_physical_address; #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX -#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ /* @@ -195,8 +194,6 @@ typedef u64 acpi_physical_address; #define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX -#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 - /******************************************************************************* * * Types specific to 16-bit targets @@ -223,7 +220,6 @@ typedef char *acpi_physical_address; #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX -#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ /* 64-bit integers cannot be supported */ @@ -292,6 +288,21 @@ typedef acpi_native_uint acpi_size; #define ACPI_UNUSED_VAR #endif +/* + * All ACPICA functions that are available to the rest of the kernel are + * tagged with this macro which can be defined as appropriate for the host. + */ +#ifndef ACPI_EXPORT_SYMBOL +#define ACPI_EXPORT_SYMBOL(symbol) +#endif + +/* + * thread_id is returned by acpi_os_get_thread_id. + */ +#ifndef acpi_thread_id +#define acpi_thread_id acpi_native_uint +#endif + /******************************************************************************* * * Independent types @@ -1297,12 +1308,6 @@ struct acpi_resource { #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#define ACPI_ALIGN_RESOURCE_SIZE(length) (length) -#else -#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) -#endif - /* * END: of definitions for Resource Attributes */ diff -puN include/acpi/acutils.h~git-acpi include/acpi/acutils.h --- devel/include/acpi/acutils.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/acutils.h 2006-04-26 13:41:00.000000000 -0700 @@ -483,8 +483,6 @@ acpi_status acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 ** end_tag); -u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); - u32 acpi_ut_dword_byte_swap(u32 value); void acpi_ut_set_integer_width(u8 revision); diff -puN include/acpi/amlresrc.h~git-acpi include/acpi/amlresrc.h --- devel/include/acpi/amlresrc.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/amlresrc.h 2006-04-26 13:41:00.000000000 -0700 @@ -45,36 +45,36 @@ #ifndef __AMLRESRC_H #define __AMLRESRC_H -#define ASL_RESNAME_ADDRESS "_ADR" -#define ASL_RESNAME_ALIGNMENT "_ALN" -#define ASL_RESNAME_ADDRESSSPACE "_ASI" -#define ASL_RESNAME_ACCESSSIZE "_ASZ" -#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" -#define ASL_RESNAME_BASEADDRESS "_BAS" -#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ -#define ASL_RESNAME_DECODE "_DEC" -#define ASL_RESNAME_DMA "_DMA" -#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ -#define ASL_RESNAME_GRANULARITY "_GRA" -#define ASL_RESNAME_INTERRUPT "_INT" -#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ -#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ -#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ -#define ASL_RESNAME_LENGTH "_LEN" -#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ -#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ -#define ASL_RESNAME_MAXADDR "_MAX" -#define ASL_RESNAME_MINADDR "_MIN" -#define ASL_RESNAME_MAXTYPE "_MAF" -#define ASL_RESNAME_MINTYPE "_MIF" -#define ASL_RESNAME_REGISTERBITOFFSET "_RBO" -#define ASL_RESNAME_REGISTERBITWIDTH "_RBW" -#define ASL_RESNAME_RANGETYPE "_RNG" -#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ -#define ASL_RESNAME_TRANSLATION "_TRA" -#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ -#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ -#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ +#define ACPI_RESTAG_ADDRESS "_ADR" +#define ACPI_RESTAG_ALIGNMENT "_ALN" +#define ACPI_RESTAG_ADDRESSSPACE "_ASI" +#define ACPI_RESTAG_ACCESSSIZE "_ASZ" +#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" +#define ACPI_RESTAG_BASEADDRESS "_BAS" +#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ +#define ACPI_RESTAG_DECODE "_DEC" +#define ACPI_RESTAG_DMA "_DMA" +#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ +#define ACPI_RESTAG_GRANULARITY "_GRA" +#define ACPI_RESTAG_INTERRUPT "_INT" +#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ +#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ +#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ +#define ACPI_RESTAG_LENGTH "_LEN" +#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ +#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ +#define ACPI_RESTAG_MAXADDR "_MAX" +#define ACPI_RESTAG_MINADDR "_MIN" +#define ACPI_RESTAG_MAXTYPE "_MAF" +#define ACPI_RESTAG_MINTYPE "_MIF" +#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" +#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" +#define ACPI_RESTAG_RANGETYPE "_RNG" +#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ +#define ACPI_RESTAG_TRANSLATION "_TRA" +#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ +#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ +#define ACPI_RESTAG_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ /* Default sizes for "small" resource descriptors */ @@ -266,6 +266,7 @@ struct aml_resource_generic_register { union aml_resource { /* Descriptor headers */ + u8 descriptor_type; struct aml_resource_small_header small_header; struct aml_resource_large_header large_header; diff -puN include/acpi/pdc_intel.h~git-acpi include/acpi/pdc_intel.h --- devel/include/acpi/pdc_intel.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/pdc_intel.h 2006-04-26 13:41:00.000000000 -0700 @@ -18,6 +18,11 @@ ACPI_PDC_C_C1_HALT | \ ACPI_PDC_P_FFH) +#define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \ + ACPI_PDC_C_C1_HALT | \ + ACPI_PDC_SMP_P_SWCOORD | \ + ACPI_PDC_P_FFH) + #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ ACPI_PDC_SMP_C1PT | \ ACPI_PDC_C_C1_HALT) diff -puN include/acpi/platform/acenv.h~git-acpi include/acpi/platform/acenv.h --- devel/include/acpi/platform/acenv.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/platform/acenv.h 2006-04-26 13:41:00.000000000 -0700 @@ -59,6 +59,7 @@ #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_NO_METHOD_EXECUTION +#define ACPI_LARGE_NAMESPACE_NODE #endif #ifdef ACPI_EXEC_APP @@ -76,6 +77,7 @@ #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_CONSTANT_EVAL_ONLY +#define ACPI_LARGE_NAMESPACE_NODE #endif #ifdef ACPI_APPLICATION @@ -271,8 +273,8 @@ typedef char *va_list; /* * Storage alignment properties */ -#define _AUPBND (sizeof (acpi_native_uint) - 1) -#define _ADNBND (sizeof (acpi_native_uint) - 1) +#define _AUPBND (sizeof (acpi_native_int) - 1) +#define _ADNBND (sizeof (acpi_native_int) - 1) /* * Variable argument list macro definitions diff -puN include/acpi/platform/aclinux.h~git-acpi include/acpi/platform/aclinux.h --- devel/include/acpi/platform/aclinux.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/platform/aclinux.h 2006-04-26 13:41:00.000000000 -0700 @@ -52,27 +52,22 @@ #include #include #include +#include #include #include #include #include #include +#include -#define strtoul simple_strtoul - -#define ACPI_MACHINE_WIDTH BITS_PER_LONG +/* Host-dependent types and defines */ -/* Type(s) for the OSL */ - -#ifdef ACPI_USE_LOCAL_CACHE -#define acpi_cache_t struct acpi_memory_list -#else -#include -#define acpi_cache_t kmem_cache_t -#endif +#define ACPI_MACHINE_WIDTH BITS_PER_LONG +#define acpi_cache_t kmem_cache_t +#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); +#define strtoul simple_strtoul /* Full namespace pathname length limit - arbitrary */ - #define ACPI_PATHNAME_MAX 256 #else /* !__KERNEL__ */ @@ -104,4 +99,8 @@ #define acpi_cpu_flags unsigned long +#define acpi_thread_id u32 + +static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; } + #endif /* __ACLINUX_H__ */ diff -puN include/acpi/processor.h~git-acpi include/acpi/processor.h --- devel/include/acpi/processor.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/acpi/processor.h 2006-04-26 13:41:00.000000000 -0700 @@ -3,6 +3,7 @@ #include #include +#include #include @@ -18,6 +19,17 @@ #define ACPI_PDC_REVISION_ID 0x1 +#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */ +#define ACPI_PSD_REV0_ENTRIES 5 + +/* + * Types of coordination defined in ACPI 3.0. Same macros can be used across + * P, C and T states + */ +#define DOMAIN_COORD_TYPE_SW_ALL 0xfc +#define DOMAIN_COORD_TYPE_SW_ANY 0xfd +#define DOMAIN_COORD_TYPE_HW_ALL 0xfe + /* Power Management */ struct acpi_processor_cx; @@ -66,6 +78,14 @@ struct acpi_processor_power { /* Performance Management */ +struct acpi_psd_package { + acpi_integer num_entries; + acpi_integer revision; + acpi_integer domain; + acpi_integer coord_type; + acpi_integer num_processors; +} __attribute__ ((packed)); + struct acpi_pct_register { u8 descriptor; u16 length; @@ -92,7 +112,9 @@ struct acpi_processor_performance { struct acpi_pct_register status_register; unsigned int state_count; struct acpi_processor_px *states; - + struct acpi_psd_package domain_info; + cpumask_t shared_cpu_map; + unsigned int shared_type; }; /* Throttling Control */ @@ -161,6 +183,9 @@ struct acpi_processor_errata { } piix4; }; +extern int acpi_processor_preregister_performance( + struct acpi_processor_performance **performance); + extern int acpi_processor_register_performance(struct acpi_processor_performance *performance, unsigned int cpu); extern void acpi_processor_unregister_performance(struct diff -puN include/asm-i386/apicdef.h~git-acpi include/asm-i386/apicdef.h --- devel/include/asm-i386/apicdef.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/asm-i386/apicdef.h 2006-04-26 13:41:00.000000000 -0700 @@ -121,7 +121,6 @@ */ #define u32 unsigned int -#define lapic ((volatile struct local_apic *)APIC_BASE) struct local_apic { diff -puN include/asm-x86_64/acpi.h~git-acpi include/asm-x86_64/acpi.h --- devel/include/asm-x86_64/acpi.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/asm-x86_64/acpi.h 2006-04-26 13:41:00.000000000 -0700 @@ -162,6 +162,8 @@ extern int acpi_pci_disabled; extern u8 x86_acpiid_to_apicid[]; +#define ARCH_HAS_POWER_INIT 1 + extern int acpi_skip_timer_override; #endif /*__KERNEL__*/ diff -puN include/asm-x86_64/apicdef.h~git-acpi include/asm-x86_64/apicdef.h --- devel/include/asm-x86_64/apicdef.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/asm-x86_64/apicdef.h 2006-04-26 13:41:00.000000000 -0700 @@ -137,8 +137,6 @@ */ #define u32 unsigned int -#define lapic ((volatile struct local_apic *)APIC_BASE) - struct local_apic { /*000*/ struct { u32 __reserved[4]; } __reserved_01; diff -puN include/linux/cpufreq.h~git-acpi include/linux/cpufreq.h --- devel/include/linux/cpufreq.h~git-acpi 2006-04-26 13:40:59.000000000 -0700 +++ devel-akpm/include/linux/cpufreq.h 2006-04-26 13:41:00.000000000 -0700 @@ -73,6 +73,8 @@ struct cpufreq_real_policy { struct cpufreq_policy { cpumask_t cpus; /* affected CPUs */ + unsigned int shared_type; /* ANY or ALL affected CPUs + should set cpufreq */ unsigned int cpu; /* cpu nr of registered CPU */ struct cpufreq_cpuinfo cpuinfo;/* see above */ @@ -99,6 +101,8 @@ struct cpufreq_policy { #define CPUFREQ_INCOMPATIBLE (1) #define CPUFREQ_NOTIFY (2) +#define CPUFREQ_SHARED_TYPE_ALL (0) /* All dependent CPUs should set freq */ +#define CPUFREQ_SHARED_TYPE_ANY (1) /* Freq can be set from any dependent CPU */ /******************** cpufreq transition notifiers *******************/ _