When both CONFIG_THINKPAD_ACPI_DOCK and CONFIG_THINKPAD_ACPI_BAY are
undefined, _sta is not used and that causes a gcc warning. Fix it
(and I think this is a regression, I am pretty sure I fixed this once
before, sorry about that).
Issue reported by: Pritt Laes.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Pritt Laes <plaes@plaes.org> Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: thinkpad-acpi: wakeup on hotunplug reporting
Handle some HKEY events that the firmware uses to report the reason for a
wake up, and to also notify that the system could go back to sleep (if it
woke up just to eject something from the bay, or to undock).
The driver will report the reason of the last wake up in the sysfs
attribute "wakeup_reason": 0 for "none, unknown, or standard ACPI wake up
event", 1 for "bay ejection request" and 2 for "undock request".
The firmware will also report if the operation that triggered the wake up
has been completed, by issuing an HKEY 0x3003 or 0x4003 event. If the
operation fails, no event is sent. When such a hotunplug sucessfull
notification is issued, the driver sets the attribute
"wakeup_hotunplug_complete" to 1.
While the firmware does tell us whether we are waking from a suspend or
hibernation scenario, the Linux way of hibernating makes this information
not reliable, and therefore it is not reported.
The idea is that if any of these attributes are non-zero, userspace might
want to do something at the end of the "wake up from sleep" procedures,
such as offering to send the machine back into sleep as soon as it is safe
to do so.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: thinkpad-acpi: add CMOS NVRAM polling for hot keys (v9)
Older ThinkPad models do not export some of the hot keys over the
event-based ACPI hot key interface. For these models, one has to poll
the CMOS NVRAM to check the key state at a rate faster than the expected
rate at which the user might repeatedly press the same hot key.
This patch implements this functionality for many of the hotkeys in a
transparent way: hot keys will now Just Work, and the driver knows the
best approach (events or NVRAM polling) to employ, based on the
HKEY.MHKA ACPI method.
Also, the driver can turn off the polling when there are no users for
the hot keys that need such polling.
The NVRAM-based hot keys of the A3x series that have never been
implemented by later models are not supported, to avoid changes in the
keymap of the input devices that could cause headaches in the future.
There is a Kconfig option to avoid compiling the NVRAM polling code, as
it is not very small, and unlikely to be useful on any ThinkPad newer
than a T40, X31 or R52.
This feature is based on a previous effort by Richard Hughes.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Richard Hughes <hughsient@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: thinkpad-acpi: refactor hotkey_get and hotkey_set (v2)
Refactor and organize the code a bit for the NVRAM polling support:
1. Split hotkey_get/set into hotkey_status_get/set and hotkey_mask_get/set;
2. Cache the status of hot key mask for later driver use;
3. Make sure the cache of hot key mask is refreshed when needed;
4. log a printk notice when the firmware doesn't set the hot key
mask to exactly what we asked it to;
5. Add proper locking to the data structures.
Only (4) should be user-noticeable, but there is a chance (5) fixes
some unknown/unreported race conditions.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Publish the requirements for keymap changes. This is a documentation
change, only.
Currently, people look at the thinkpad-acpi default keymaps, and think:
"modifying this is a trivial thing, it can't break systems, and there are
keys defined for foo and bar, but the driver has them as KEY_RESERVED.
Must have been an oversight, let me change it."
And since they never get to see the bug reports, because they are not
really a part of the Linux ThinkPad users community (linux-thinkpad
mailinglist, thinkwiki wiki, thinkpad forums) and laptop users are slow
to complain to distros about any breakages...
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Ingo Molnar [Fri, 1 Feb 2008 22:45:18 +0000 (23:45 +0100)]
x86: fix bootup crash in native_read_tsc()
fix bootup crash in native_read_tsc() that was reported on an Athlon-XP
and bisected. The correct feature boundary for X86_FEATURE_MFENCE_RDTSC
is not XMM but XMM2.
Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (100 commits)
ide: move hwif_register() call out of ide_probe_port()
ide: factor out code for tuning devices from ide_probe_port()
ide: move handling of I/O resources out of ide_probe_port()
ide: make probe_hwif() return an error value
ide: use ide_remove_port_from_hwgroup in init_irq()
ide: prepare init_irq() for using ide_remove_port_from_hwgroup()
ide: factor out code removing port from hwgroup from ide_unregister()
ide: I/O resources are released too early in ide_unregister()
ide: cleanup ide_system_bus_speed()
ide: remove needless zeroing of hwgroup fields from init_irq()
ide: remove unused ide_hwgroup_t fields
ide_platform: remove struct hwif_prop
ide: remove hwif->present manipulations from hwif_init()
ide: move wait_hwif_ready() documentation in the right place
ide: fix handling of busy I/O resources in probe_hwif()
<linux/hdsmart.h> is not used by kernel code
ide: don't include <linux/hdsmart.h>
ide-floppy: cleanup header
ide: update/add my Copyrights
ide: delete filenames/versions from comments
...
ide: move hwif_register() call out of ide_probe_port()
* Add BUG_ON(hwif->present) at the start of ide_probe_port().
* Move hwif_register() call (along with setting hwif->present) from
ide_probe_port() to ide_device_add_all().
As a result the port will be registered with the device tree _after_:
- probing both devices (if both are present)
- port reset (if hwif->reset is set)
- restoring local IRQs state and re-enabling port IRQ
* Remove 'if (hwif != hwif_prop.hwif)' check from plat_ide_remove()
(pdev->dev.driver_data and hwif_prop.hwif are set at the same time
in plat_ide_probe() and are identical).
* Use hwif->index for ide_unregister() in plat_ide_remove().
* Use local variables instead of hwif_prop.plat_ide[_alt]_mapbase in
plat_ide_probe() and remove no longer needed struct hwif_prop.
* pci_map_sg() -> dma_map_sg() in ide_build_sglist().
* pci_unmap_sg() -> dma_unmap_sg() in ide_destroy_dmatable().
There should be no functionality changes caused by this patch except
for blackfin arch whose dma_[un]map_sg() implementation differs from
pci_[un]map_sg() one (on s390 arch there is no PCI, on avr32 and h8300
archs PCI is currently unsupported, on m32r arch PCI support depends
on BROKEN, on m68k arch PCI support depends on HADES which in turn
depends on BROKEN, on all other archs dma_[un]map_sg() functionality
matches with pci_[un]map_sg() one).
* Use hwif->dev instead of state->dev in icside_build_sglist(),
icside_dma_end(), icside_dma_start() and icside_dma_setup().
* Remove no longer needed 'dev' field from struct icside_state.
Cc: Russell King <rmk@arm.linux.org.uk> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Rename 'simplex_stat' variable to 'dma_stat' in ide_get_or_set_dma_base().
* Factor out code for forcing host out of "simplex" mode from
ide_get_or_set_dma_base() to ide_pci_clear_simplex() helper.
* Add IDE_HFLAG_CLEAR_SIMPLEX host flag and set it in alim15x3 (for M5229),
amd74xx (for AMD 7409), cmd64x (for CMD643), generic (for Netcell) and
serverworks (for CSB5) host drivers.
* Make ide_get_or_set_dma_base() test for IDE_HFLAG_CLEAR_SIMPLEX host flag
instead of checking dev->device (BTW the code was buggy because it didn't
check for dev->vendor, luckily none of these PCI Device IDs was used by
some other vendor for PCI IDE controller).
* Remove no longer needed assertion from amd74xx_probe().
* Factor out cable detection for AMD7409 to amd7409_cable_detect() and for
chipsets >= AMD7411 to amd7411_cable_detect().
* Use dev->vendor and dev->device instead of amd_config->udma_mask when
selecting cable detection method and checking for broken FIFO support in
init_chipset_amd74xx().
* Remove no longer needed AMD_BAD_FIFO define.
* Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro.
* Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro.
* Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe()
in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask
on Serenade mainboards.
* Remove no longer needed fixups from init_chipset_amd74xx()
and AMD_CHECK_{SWDMA,SERENADE} defines.
* Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(),
also remove incorrect comment while at it.
* Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive().
* Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from
amd_set_drive() instead of using amd_config->udma_mask.
* Move amd_config->base from AMD_* defines to users of these defines and add
0x40 the defined values. Then add amd_offset() inline helper for selecting
offset from 0x40 base (needed for nVidia controllers) and finally use it in
amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead
of amd_config->base.
* Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup
from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips
table.
* Fix init_chipset_amd74xx() comment.
* Bump driver version.
There should be no functionality changes caused by this patch.
Sergei Shtylyov [Fri, 1 Feb 2008 22:09:30 +0000 (23:09 +0100)]
ide: ide_setup_dma() assumes 8 ports
According to http://marc.info/?l=linux-ide&m=114346138611631, the drivers must
always register 8 DMA ports with ide_setup_dma(), so its last argument is not
needed. While at it, kill some useless parens in that function...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ide-{floppy,tape}: remove debug code for dumping identify data
IDE core supports dumping raw identify data in hdparm friendly format now
so verbose identify dumping in ide-{floppy,tape}.c device drivers (done iff
IDE{FLOPPY,TAPE}_DEBUG_INFO is defined to '1' and it is '0' by default)
is no longer nedeed.
* Add ide_dump_identify() debug helper for dumping raw identify data in
the hdparm friendly format (== the identify data can be extracted from
dmesg output and passed to hdparm --Istdin).
* Dump identify data in ide-probe.c::do_identify() if DEBUG is enabled.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ide-cd: merge cdrom_write_check_ireason() and cdrom_read_check_ireason()
Add 'rw' parameter to cdrom_read_check_ireason(), make it handle
both read and write checking, rename it to ide_cd_check_ireason(),
finally remove no longer needed cdrom_write_check_ireason().
There should be no functionality changes caused by this patch.
ide-cd: prepare cdrom_rw_intr() and cdrom_newpc_intr() to be merged
In cdrom_newpc_intr():
* cleanup variables in the 'transfer data' loop
In cdrom_rw_intr():
* rename 'sectors_to_transfer' to 'thislen'
* rename 'this_transfer' to 'blen'
* keep number of bytes (instead of sectors) in 'thislen' and 'blen'
* call 'xferfunc' only once for 'blen'
* cache 'rq->buffer' in 'ptr' variable
* check for 'rq->bio' before setting 'ptr' and 'blen'
* check for 'ptr' instead of 'rq->current_nr_sectors'
There should be no functionality changes caused by this patch.
ide-cd: merge cdrom_start_read_continuation() and cdrom_start_rw_cont()
* Add handling of write requests to cdrom_start_read_continuation(),
rename it to cdrom_start_rw_cont() and remove no longer needed
cdrom_start_write_cont().
ide-cd: merge cdrom_pc_intr() and cdrom_newpc_intr()
Add handling of REQ_TYPE_{SENSE,ATA_PC} requests to cdrom_newpc_intr()
(please note that these requests never have 'bio' attached to them
and they never use DMA), then remove no longer needed cdrom_pc_intr().
There should be no functionality changes caused by this patch.
ide-cd: move VERBOSE_IDE_CD_ERRORS code to ide-cd_verbose.c
* Rename ide-cd kernel module to ide-cd_mod in preparation to moving code out
from ide-cd.[c,h]. Add MODULE_ALIAS("ide-cd") to preserve compatibility.
* Move VERBOSE_IDE_CD_ERRORS code from ide-cd.[c,h] to ide-cd_verbose.c.
ide-cd_verbose.c is IDE subsystem independent and may be easily converted
into generic library usable by other drivers (i.e. libata) if needed.
* Add CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS config option to drivers/ide/Kconfig
replacing VERBOSE_IDE_CD_ERRORS define. Make this config option enabled by
default and visible only if CONFIG_EMBEDDED is defined.
before the patch:
text data bss dec hex filename
22841 360 1056 24257 5ec1 drivers/ide/ide-cd.o
after the patch w/ CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y:
text data bss dec hex filename
22857 360 1056 24273 5ed1 drivers/ide/ide-cd_mod.o
after the patch w/ CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=n:
text data bss dec hex filename
15091 360 1056 16507 407b drivers/ide/ide-cd_mod.o