GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
16 years agoSuspend: Invoke suspend notifications after console switch
Johannes Berg [Fri, 11 Jan 2008 00:22:23 +0000 (01:22 +0100)]
Suspend: Invoke suspend notifications after console switch

In order to fix APM emulation it is necessary to enable apm-emulation
notifications for suspends triggered in various ways via the suspend
notifiers.  However, this will cause the systems using APM emulation
to lock up between X being needed to switch away from the VT and X
already waiting for resume in the APM ioctl.

This patch moves the console switch (if enabled) before the suspend
notification (and after the resume notification) to avoid this issue.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Clean up suspend_64.c
Borislav Petkov [Sun, 16 Dec 2007 23:30:22 +0000 (00:30 +0100)]
Suspend: Clean up suspend_64.c

There's a freakishly long comment in suspend_64.c, shorten it.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Add config option to disable the freezer if architecture wants that
Johannes Berg [Wed, 16 Jan 2008 04:17:00 +0000 (23:17 -0500)]
Suspend: Add config option to disable the freezer if architecture wants that

This patch makes the freezer optional for suspend to allow the
system to work (or not work) like the original PMU suspend.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: Print message before calling _PTS
Rafael J. Wysocki [Mon, 7 Jan 2008 23:10:57 +0000 (00:10 +0100)]
ACPI: Print message before calling _PTS

Make acpi_sleep_prepare() static and cause it to print a message
specifying the ACPI system sleep state to be entered (helpful for
debugging the suspend/hibernation code).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI hibernation: Call _PTS before suspending devices
Rafael J. Wysocki [Mon, 7 Jan 2008 23:09:58 +0000 (00:09 +0100)]
ACPI hibernation: Call _PTS before suspending devices

The ACPI 1.0 specification wants us to put devices into low power
states after executing the _PTS global control method, while ACPI
2.0 and later want us to do that in the reverse order.  The current
hibernation code follows ACPI 2.0 in that respect which may cause some
ACPI 1.0x systems to hang during hibernation (ref.
http://bugzilla.kernel.org/show_bug.cgi?id=9528).

Make the hibernation code execute _PTS before putting devices into
low power states (ie. in accordance with ACPI 1.0x) with the
possibility to override that using the 'acpi_new_pts_ordering' kernel
command line option.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Introduce begin() and end() callbacks
Rafael J. Wysocki [Mon, 7 Jan 2008 23:08:44 +0000 (00:08 +0100)]
Hibernation: Introduce begin() and end() callbacks

Introduce global hibernation callback .end() and rename global
hibernation callback .start() to .begin(), in analogy with the
recent modifications of the global suspend callbacks.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI suspend: Call _PTS before suspending devices
Rafael J. Wysocki [Mon, 7 Jan 2008 23:07:39 +0000 (00:07 +0100)]
ACPI suspend: Call _PTS before suspending devices

The ACPI 1.0 specification wants us to put devices into low power
states after executing the _PTS global control method, while ACPI
2.0 and later want us to do that in the reverse order.  The current
suspend code follows ACPI 2.0 in that respect which causes some
ACPI 1.0x systems to hang during suspend (ref.
http://bugzilla.kernel.org/show_bug.cgi?id=9528).

Make the suspend code execute _PTS before putting devices into low
power states (ie. in accordance with ACPI 1.0x) and provide a command
line option to override the default if need be.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: Separate disabling of GPEs from _PTS
Rafael J. Wysocki [Mon, 7 Jan 2008 23:06:16 +0000 (00:06 +0100)]
ACPI: Separate disabling of GPEs from _PTS

The preparation to enter an ACPI system sleep state is now tied to
the disabling of GPEs, but the GPEs should not be disabled before
suspending devices.  Since on ACPI 1.0x systems the _PTS global
control method should be executed before suspending devices, we
need to disable GPEs separately.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK
Rafael J. Wysocki [Mon, 7 Jan 2008 23:05:21 +0000 (00:05 +0100)]
ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

The execution of ACPI global control methods _GTS and _BFS is
currently tied to the preparation to enter a sleep state and to the
leaving of the sleep state, respectively.  However, these functions
are called before disabling the nonboot CPUs and after enabling
them, respectively (in fact, on ACPI 1.0x systems the first of them
ought to be called before suspending devices), while according to the
ACPI specification, _GTS is to be executed right prior to entering
the system sleep state and _BFS is to be executed right after the
platfor firmware has returned control to the OS on wake up.

Move the execution of _GTS and _BFS to the right places.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Introduce begin() and end() callbacks
Rafael J. Wysocki [Mon, 7 Jan 2008 23:04:17 +0000 (00:04 +0100)]
Suspend: Introduce begin() and end() callbacks

On ACPI systems the target state set by acpi_pm_set_target() is
reset by acpi_pm_finish(), but that need not be called if the
suspend fails.  All platforms that use the .set_target() global
suspend callback are affected by analogous issues.

For this reason, we need an additional global suspend callback that
will reset the target state regardless of whether or not the suspend
is successful.  Also, it is reasonable to rename the .set_target()
callback, since it will be used for a different purpose on ACPI
systems (due to ACPI 1.0x code ordering requirements).

Introduce the global suspend callback .end() to be executed at the
end of the suspend sequence and rename the .set_target() global
suspend callback to .begin().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agosuspend: fix ia64 allmodconfig build
Rafael J. Wysocki [Fri, 14 Dec 2007 00:07:13 +0000 (01:07 +0100)]
suspend: fix ia64 allmodconfig build

kernel/power/main.c:488: error: ‘pm_test_attr’ undeclared here (not in a function)

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: clear GPE earily in resume to avoid warning
Shaohua Li [Wed, 20 Jun 2007 01:17:58 +0000 (09:17 +0800)]
ACPI: clear GPE earily in resume to avoid warning

Wakeup GPE hasn't a handler. If system is waked up by such GPE like a
USB hotplug, I saw a lot of error reporting the GPE hasn't handler.
acpi_leave_sleep_state will clear the GPE but it's too late, we should
do it before interrupt is re-enabled.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Clean up Kconfig (V2)
Johannes Berg [Sat, 8 Dec 2007 01:14:00 +0000 (02:14 +0100)]
Suspend: Clean up Kconfig (V2)

This cleans up the suspend Kconfig and removes the need to
declare centrally which architectures support suspend. All
architectures that currently support suspend are modified
accordingly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Clean up Kconfig (V2)
Johannes Berg [Sat, 8 Dec 2007 01:12:39 +0000 (02:12 +0100)]
Hibernation: Clean up Kconfig (V2)

This cleans up the hibernation Kconfig and removes the need to
declare centrally which architectures support hibernation. All
architectures that currently support hibernation are modified
accordingly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Paul Mackerras <paulus@samba.org>
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Update messages
Rafael J. Wysocki [Sat, 8 Dec 2007 01:09:43 +0000 (02:09 +0100)]
Hibernation: Update messages

Make hibernation messages start with one common prefix "PM: " and use
the word "hibernation" in the messages as a synonym of "suspend to
disk".

Turn some KERN_INFO messages into debug ones.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Use common prefix in messages
Rafael J. Wysocki [Sat, 8 Dec 2007 01:08:38 +0000 (02:08 +0100)]
Suspend: Use common prefix in messages

Make suspend messages start with one common prefix "PM: ".

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Remove unnecessary variable declaration
Rafael J. Wysocki [Sat, 8 Dec 2007 01:07:40 +0000 (02:07 +0100)]
Hibernation: Remove unnecessary variable declaration

Remove the unnecessary extern declaration of resume_file[]
from kernel/power/swap.c .

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Fix comment in disk.c
Rafael J. Wysocki [Sat, 8 Dec 2007 01:06:57 +0000 (02:06 +0100)]
Hibernation: Fix comment in disk.c

Fix a comment in kernel/power/disk.c so that it doesn't contain lines
longer that 80 characters.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Fix comment in main.c
Rafael J. Wysocki [Sat, 8 Dec 2007 01:06:00 +0000 (02:06 +0100)]
Suspend: Fix comment in main.c

Fix a comment in kernel/power/main.c so that it doesn't contain lines
longer that 80 characters.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Move low level resume to disk.c
Rafael J. Wysocki [Sat, 8 Dec 2007 01:04:21 +0000 (02:04 +0100)]
Hibernation: Move low level resume to disk.c

Move the low level restore code to kernel/power/disk.c , since the
corresponding low level hibernation code is already there.

Make restore fail if device_power_down(PMSG_PRETHAW) returns an
error.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Fix compilation warning for CONFIG_SUSPEND unset
Rafael J. Wysocki [Sat, 8 Dec 2007 01:03:26 +0000 (02:03 +0100)]
Suspend: Fix compilation warning for CONFIG_SUSPEND unset

Suspend: Make debug facility depend on CONFIG_SUSPEND

Make the new suspend debug facility code depend on CONFIG_SUSPEND,
as appropriate, to remove the compiler warning printed when CONFIG_PM is set
and CONFIG_SUSPEND is not set.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoPM: Convert PM notifiers to out-of-line code
Alan Stern [Mon, 19 Nov 2007 22:49:18 +0000 (23:49 +0100)]
PM: Convert PM notifiers to out-of-line code

This patch (as1008b) converts the PM notifier routines from inline
calls to out-of-line code.  It also prevents pm_chain_head from
being created when CONFIG_PM_SLEEP isn't enabled, and EXPORTs the
notifier registration and unregistration routines.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoPM: Make PM_TRACE more architecture independent
Johannes Berg [Mon, 19 Nov 2007 22:46:16 +0000 (23:46 +0100)]
PM: Make PM_TRACE more architecture independent

When trying to debug a suspend failure I started implementing
PM_TRACE for powerpc. I then noticed that I'm debugging a suspend
failure and so PM_TRACE isn't useful at all, but thought that
nonetheless this could be useful in the future.

Basically, to support PM_TRACE, you add a Kconfig option that
selects PM_TRACE and provides the infrastructure as per the
help text of PM_TRACE.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoPM: Suspend/hibernation debug documentation update (rev. 2)
Rafael J. Wysocki [Mon, 19 Nov 2007 22:43:34 +0000 (23:43 +0100)]
PM: Suspend/hibernation debug documentation update (rev. 2)

Update the suspend/hibernation debugging and testing documentation to describe
the newly introduced testing facilities.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: New testing facility (rev. 2)
Rafael J. Wysocki [Mon, 19 Nov 2007 22:42:31 +0000 (23:42 +0100)]
Hibernation: New testing facility (rev. 2)

Make it possible to test the hibernation core code with the help of the
/sys/power/pm_test attribute introduced for suspend testing in the previous
patch.

Writing an appropriate string to this file causes the hibernation code to work
in one of the test modes defined as follows:

freezer
- test the freezing of processes

devices
- test the freezing of processes and suspending of devices

platform
- test the freezing of processes, suspending of devices and platform global
  control methods(*)

processors
- test the freezing of processes, suspending of devices, platform global
  control methods(*) and the disabling of nonboot CPUs

core
- test the freezing of processes, suspending of devices, platform global
  control methods(*), the disabling of nonboot CPUs and suspending of
  platform/system devices

(*) - the platform global control methods are only available on ACPI systems
      and are only tested if the hibernation mode is set to "platform"

Then, if a hibernation is started by normal means, the hibernation core will
perform its normal operations up to the point indicated by given test level.
Next, it will wait for 5 seconds and carry out the resume operations needed to
transition the system back to the fully functional state.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agosuspend: build fix responding to 2.6.25 kset change
Rafael J. Wysocki [Mon, 28 Jan 2008 23:29:06 +0000 (00:29 +0100)]
suspend: build fix responding to 2.6.25 kset change

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Testing facility (rev. 2)
Rafael J. Wysocki [Mon, 19 Nov 2007 22:41:19 +0000 (23:41 +0100)]
Suspend: Testing facility (rev. 2)

Introduce sysfs attribute /sys/power/pm_test allowing one to test the suspend
core code.  Namely, writing one of the strings:

freezer
devices
platform
processors
core

to this file causes the suspend code to work in one of the test modes defined as
follows:

freezer
- test the freezing of processes

devices
- test the freezing of processes and suspending of devices

platform
- test the freezing of processes, suspending of devices and platform global
  control methods(*)

processors
- test the freezing of processes, suspending of devices, platform global
  control methods and the disabling of nonboot CPUs

core
- test the freezing of processes, suspending of devices, platform global
  control methods, the disabling of nonboot CPUs and suspending of
  platform/system devices

(*) These are ACPI global control methods on ACPI systems

Then, if a suspend is started by normal means, the suspend core will perform
its normal operations up to the point indicated by given test level.  Next, it
will wait for 5 seconds and carry out the resume operations needed to transition
the system back to the fully functional state.

Writing "none" to /sys/power/pm_test turns the testing off.

When open for reading, /sys/power/pm_test contains a space-separated list of all
available tests (including "none" that represents the normal functionality) in
which the current test level is indicated by square brackets.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers (rev. 2)
Alan Stern [Mon, 19 Nov 2007 22:38:25 +0000 (23:38 +0100)]
Hibernation: Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers (rev. 2)

Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers to the PM core, to be used
in analogy with the existing PM_HIBERNATION_PREPARE and PM_POST_HIBERNATION
notifiers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Move function prototypes to header
Adrian Bunk [Mon, 19 Nov 2007 22:36:20 +0000 (23:36 +0100)]
Hibernation: Move function prototypes to header

This patch moves the prototypes of count_highmem_pages() and
restore_highmem() to kernel/power/power.h

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: Fix mismerge in acpi_hibernation_finish
Rafael J. Wysocki [Mon, 19 Nov 2007 22:33:59 +0000 (23:33 +0100)]
ACPI: Fix mismerge in acpi_hibernation_finish

Some code in acpi_hibernation_finish() was moved to acpi_hibernation_leave(),
but the old copy had been left (it's harmless, but also useless).  Remove it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Introduce exportable suspend ioctls header (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:05:05 +0000 (01:05 +0200)]
Hibernation: Introduce exportable suspend ioctls header (rev. 2)

Move the definitions of hibernation ioctls to a separate header file in
include/linux, which can be exported to the user space.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Correct definitions of some ioctls (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:03:33 +0000 (01:03 +0200)]
Hibernation: Correct definitions of some ioctls (rev. 2)

Three ioctl numbers belonging to the hibernation userland interface,
SNAPSHOT_ATOMIC_SNAPSHOT, SNAPSHOT_AVAIL_SWAP, SNAPSHOT_GET_SWAP_PAGE,
are defined in a wrong way (eg. not portable).  Provide new ioctl numbers for
these ioctls and mark the existing ones as deprecated.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Mark SNAPSHOT_SET_SWAP_FILE ioctl as deprecated (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:02:15 +0000 (01:02 +0200)]
Hibernation: Mark SNAPSHOT_SET_SWAP_FILE ioctl as deprecated (rev. 2)

Mark the SNAPSHOT_SET_SWAP_FILE ioctl belonging to the hibernation userland
interface as deprecated.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Rework platform support ioctls (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:01:10 +0000 (01:01 +0200)]
Hibernation: Rework platform support ioctls (rev. 2)

Modify the hibernation userland interface by adding two new ioctls to it,
SNAPSHOT_PLATFORM_SUPPORT and SNAPSHOT_POWER_OFF, that can be used,
respectively, to switch the hibernation platform support on/off and to make the
kernel transition the system to the hibernation state (eg. ACPI S4) using the
platform (eg. ACPI) driver.

These ioctls are intended to replace the misdesigned SNAPSHOT_PMOPS ioctl,
which from now is regarded as obsolete and will be removed in the future.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Introduce SNAPSHOT_GET_IMAGE_SIZE ioctl
Rafael J. Wysocki [Thu, 25 Oct 2007 22:59:31 +0000 (00:59 +0200)]
Hibernation: Introduce SNAPSHOT_GET_IMAGE_SIZE ioctl

Add a new ioctl, SNAPSHOT_GET_IMAGE_SIZE, returning the size of the (just
created) hibernation image, to the hibernation userland interface.

This ioctl is necessary so that the userland utilities using the interface need
not access the hibernation image header, owned by the kernel, in order to obtain
the size of the image.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agox86: fix bootup crash in native_read_tsc()
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>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Fri, 1 Feb 2008 22:58:02 +0000 (09:58 +1100)]
Merge git://git./linux/kernel/git/bart/ide-2.6

* 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
  ...

16 years agoide: move hwif_register() call out of ide_probe_port()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:36 +0000 (23:09 +0100)]
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

While at it:

* Rename hwif_register() to ide_register_port().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: factor out code for tuning devices from ide_probe_port()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:36 +0000 (23:09 +0100)]
ide: factor out code for tuning devices from ide_probe_port()

* Factor out code for tuning devices from ide_probe_port()
  to ide_port_tune_devices().

* Move ide_port_tune_devices() call from ide_probe_port()
  to ide_device_add_all().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move handling of I/O resources out of ide_probe_port()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:36 +0000 (23:09 +0100)]
ide: move handling of I/O resources out of ide_probe_port()

Reserve/release I/O resources in ide_device_add_all() instead of
ide_probe_port().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: make probe_hwif() return an error value
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:36 +0000 (23:09 +0100)]
ide: make probe_hwif() return an error value

Make probe_hwif() return an error value.

While at it:

* Remove comment about MAX_DRIVES == 2 limitation (it is not special to
  probe_hwif(), it is a general assumption taken by a lot of IDE code).

* Rename probe_hwif() to ide_probe_port().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: use ide_remove_port_from_hwgroup in init_irq()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:36 +0000 (23:09 +0100)]
ide: use ide_remove_port_from_hwgroup in init_irq()

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: prepare init_irq() for using ide_remove_port_from_hwgroup()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:36 +0000 (23:09 +0100)]
ide: prepare init_irq() for using ide_remove_port_from_hwgroup()

* BUG_ON() early if 'hwif->next == hwif' and there is a 'match' hwgroup.

* Remove printk() for impossible condition and add a BUG_ON(hwgroup->drive)
  to match code in ide_unregister().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: factor out code removing port from hwgroup from ide_unregister()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:35 +0000 (23:09 +0100)]
ide: factor out code removing port from hwgroup from ide_unregister()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: I/O resources are released too early in ide_unregister()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:35 +0000 (23:09 +0100)]
ide: I/O resources are released too early in ide_unregister()

Release I/O resources after releasing DMA.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: cleanup ide_system_bus_speed()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:35 +0000 (23:09 +0100)]
ide: cleanup ide_system_bus_speed()

Use the facts that:

* When ide_init() is called 'system_bus_speed' always equals zero.

* system_bus_clock() is never called before ide_init().

and:

* Move printk() from ide_system_bus_speed() to ide_init().

* Don't assign 'system_bus_speed' in ide_system_bus_speed().

* Don't call ide_system_bus_speed() in system_bus_clock().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove needless zeroing of hwgroup fields from init_irq()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:35 +0000 (23:09 +0100)]
ide: remove needless zeroing of hwgroup fields from init_irq()

Since kmalloc_node() is called with __GFP_ZERO flag there is no need to
explicitly zero hwgroup fields.

While at it:

* Use 'hwif' instead of 'hwif->drives[0].hwif' for kmalloc_node() call.

* Fix whitespace damage.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove unused ide_hwgroup_t fields
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:35 +0000 (23:09 +0100)]
ide: remove unused ide_hwgroup_t fields

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide_platform: remove struct hwif_prop
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:35 +0000 (23:09 +0100)]
ide_platform: remove struct hwif_prop

* 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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove hwif->present manipulations from hwif_init()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:34 +0000 (23:09 +0100)]
ide: remove hwif->present manipulations from hwif_init()

* Call hwif_init() only if hwif->present is set.

* If hwif_init() fails clear hwif->present.

* Remove hwif->present manipulations from hwif_init().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move wait_hwif_ready() documentation in the right place
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:34 +0000 (23:09 +0100)]
ide: move wait_hwif_ready() documentation in the right place

* Move wait_hwif_ready() documentation before this function.

* Fix trailing whitespaces.

* s/wait-for-busy/wait-for-non-busy/

* Remove no longer valid comment about the current code behavior.

* Docbook-ize it.

* Rename wait_hwif_ready() to ide_port_wait_ready().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix handling of busy I/O resources in probe_hwif()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:34 +0000 (23:09 +0100)]
ide: fix handling of busy I/O resources in probe_hwif()

It could be that I/O resources are busy because some other host driver
has already claimed them so don't unregister the devices.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years ago<linux/hdsmart.h> is not used by kernel code
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:34 +0000 (23:09 +0100)]
<linux/hdsmart.h> is not used by kernel code

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: don't include <linux/hdsmart.h>
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:34 +0000 (23:09 +0100)]
ide: don't include <linux/hdsmart.h>

IDE doesn't need it.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: cleanup header
Borislav Petkov [Fri, 1 Feb 2008 22:09:33 +0000 (23:09 +0100)]
ide-floppy: cleanup header

Move ide-floppy historical changelog to
Documentation/ide/ChangeLog.ide-floppy.1996-2002

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: update/add my Copyrights
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:33 +0000 (23:09 +0100)]
ide: update/add my Copyrights

The last years stuff and a trip down memory lane...

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: delete filenames/versions from comments
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:33 +0000 (23:09 +0100)]
ide: delete filenames/versions from comments

Delete filenames/versions from comments.

I'm leaving decisions about adding DRV_VERSION defines and MODULE_VERSION()-s
to maintainers of the respective drivers.

While at it:

* Remove unused VERSION define from ide.c.

* Remove unused/stale DRV_VERSION define from au1xxx-ide.c.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide/rapide: use hwif->index for ide_unregister()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:33 +0000 (23:09 +0100)]
au1xxx-ide/rapide: use hwif->index for ide_unregister()

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-pmac: macio resource freeing bugfix
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:32 +0000 (23:09 +0100)]
ide-pmac: macio resource freeing bugfix

Release DMA resource before zeroing pmif.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide: device tree bugfix
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:32 +0000 (23:09 +0100)]
au1xxx-ide: device tree bugfix

Add missing hw.dev setup (so hwif->gendev.parent will be set by
ide_init_port_hw() to point to the parent device).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: use ide_build_sglist() and ide_destroy_dmatable() in non-PCI host drivers
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:32 +0000 (23:09 +0100)]
ide: use ide_build_sglist() and ide_destroy_dmatable() in non-PCI host drivers

* Make ide_build_sglist() and ide_destroy_dmatable() available also when
  CONFIG_BLK_DEV_IDEDMA_PCI=n.

* Use ide_build_sglist() and ide_destroy_dmatable() in {ics,au1xxx-}ide.c
  and remove no longer needed {ics,au}ide_build_sglist().

There should be no functionality changes caused by this patch.

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: switch to DMA-mapping API
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:32 +0000 (23:09 +0100)]
ide: switch to DMA-mapping API

* 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).

blackfin behavior change was ack-ed by Bryan Wu.

Cc: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoicside: use hwif->dev
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:32 +0000 (23:09 +0100)]
icside: use hwif->dev

* Setup hwif->dev in icside_setup().

* 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>
16 years agoau1xxx-ide: use hwif->dev
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:31 +0000 (23:09 +0100)]
au1xxx-ide: use hwif->dev

* Setup hwif->dev in au_ide_probe().

* Use hwif->dev instead of ahwif->dev in auide_build_sglist(),
  auide_build_dmatable(), auide_dma_end() and auide_ddma_init().

* Remove no longer needed 'dev' field from _auide_hwif type.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:31 +0000 (23:09 +0100)]
ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t

Keep pointer to struct device instead of struct pci_dev in ide_hwif_t.

While on it:
* Use *dev->dma_mask instead of pci_dev->dma_mask in ide_toggle_bounce().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: use ide_destroy_dmatable() instead of pci_unmap_sg() (take 2)
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:31 +0000 (23:09 +0100)]
ide: use ide_destroy_dmatable() instead of pci_unmap_sg() (take 2)

Use ide_destroy_dmatable() in:
* ide-dma.c::ide_build_dmatable()
* sgiioc4.c::sgiioc4_build_dma_table()
* pmac.c::pmac_ide_{build,destroy}_dmatable()

There should be no functionality changes caused by this patch.

v2:
* pmac.c build fix from Andrew Morton.

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove BUG_ON() from ide_build_sglist()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:31 +0000 (23:09 +0100)]
ide: remove BUG_ON() from ide_build_sglist()

do_rw_taskfile() has been fixed to check the return value
of ->dma_setup method so this BUG_ON() is no longer needed.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix ide_intr() for non-PCI devices and CONFIG_BLK_DEV_IDEPCI=y
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:31 +0000 (23:09 +0100)]
ide: fix ide_intr() for non-PCI devices and CONFIG_BLK_DEV_IDEPCI=y

'hwif->pci_dev && !hwif->pci_dev->vendor' condition is never true,
check for 'hwif->chipset != ide_pci' instead.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agopiix: remove stale comments
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:30 +0000 (23:09 +0100)]
piix: remove stale comments

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add IDE_HFLAG_NO_DSC host flag
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:30 +0000 (23:09 +0100)]
ide: add IDE_HFLAG_NO_DSC host flag

* Add IDE_HFLAG_NO_DSC host flag for hosts that doesn't support DSC overlap.

* Set it in aec62xx (for ATP850UF only) and hpt34x host drivers.

* Convert ide-tape device driver to check for IDE_HFLAG_NO_DSC flag.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add IDE_HFLAG_CLEAR_SIMPLEX host flag
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:30 +0000 (23:09 +0100)]
ide: add IDE_HFLAG_CLEAR_SIMPLEX host flag

* 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).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoamd74xx: remove amd_ide_chips table
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:30 +0000 (23:09 +0100)]
amd74xx: remove amd_ide_chips table

* 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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: ide_setup_dma() assumes 8 ports
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>
16 years agotrm290: cannot call ide_setup_dma()
Sergei Shtylyov [Fri, 1 Feb 2008 22:09:29 +0000 (23:09 +0100)]
trm290: cannot call ide_setup_dma()

The TRM-290 chip is *not* SFF-8038i compatible and therefore can *not* call
ide_setup_dma() -- fix this and also cleanup the code a bit...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: move the remaining cdrom.c ioctl handling code to ide-cd_ioctl.c
Borislav Petkov [Fri, 1 Feb 2008 22:09:29 +0000 (23:09 +0100)]
ide-cd: move the remaining cdrom.c ioctl handling code to ide-cd_ioctl.c

There should be no functional changes from this.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-{floppy,tape}: remove debug code for dumping identify data
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:29 +0000 (23:09 +0100)]
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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_dump_identify() debug helper
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:28 +0000 (23:09 +0100)]
ide: add ide_dump_identify() debug helper

* 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>
16 years agoide-cd: update driver version, comments and copyrights
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:28 +0000 (23:09 +0100)]
ide-cd: update driver version, comments and copyrights

* Bump driver version.

* Remove filename and stale TODO from comments.

* Add my copyrights.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: unify request end exit path in cdrom_decode_status()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:28 +0000 (23:09 +0100)]
ide-cd: unify request end exit path in cdrom_decode_status()

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: merge cdrom_write_check_ireason() and cdrom_read_check_ireason()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:28 +0000 (23:09 +0100)]
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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: merge cdrom_rw_intr() and cdrom_newpc_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:28 +0000 (23:09 +0100)]
ide-cd: merge cdrom_rw_intr() and cdrom_newpc_intr()

Add handling of fs read/write requests to cdrom_nepwc_intr()
and remove no longer needed cdrom_rw_intr().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: call blk_dump_rq_flags() on "missing data" in cdrom_rw_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:27 +0000 (23:09 +0100)]
ide-cd: call blk_dump_rq_flags() on "missing data" in cdrom_rw_intr()

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: prepare cdrom_rw_intr() and cdrom_newpc_intr() to be merged
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:27 +0000 (23:09 +0100)]
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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: unify moving to the next buffer in cdrom_rw_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:27 +0000 (23:09 +0100)]
ide-cd: unify moving to the next buffer in cdrom_rw_intr()

Use the fact that for the first loop rq->current_nr_sectors is always
set and unify moving to the next buffer for read/write requests.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: merge cdrom_start_read() and cdrom_start_write()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:27 +0000 (23:09 +0100)]
ide-cd: merge cdrom_start_read() and cdrom_start_write()

Add handling of read requests to cdrom_start_write(), rename it
to cdrom_start_rw() and remove no longer needed cdrom_start_read().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: merge cdrom_start_read_continuation() and cdrom_start_rw_cont()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:27 +0000 (23:09 +0100)]
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().

* Remove redundant '(rq->sector & (sectors_per_frame - 1)' check.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: merge cdrom_read_intr() and cdrom_write_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:26 +0000 (23:09 +0100)]
ide-cd: merge cdrom_read_intr() and cdrom_write_intr()

Add handling of read requests to cdrom_write_intr(), rename it
to cdrom_rw_intr() and remove no longer needed cdrom_read_intr().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: factor out transfer size checking from cdrom_read_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:26 +0000 (23:09 +0100)]
ide-cd: factor out transfer size checking from cdrom_read_intr()

This is a preparation for cdrom_read_intr() and cdrom_write_intr() merge.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: add ide_cd_drain_data() helper
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:26 +0000 (23:09 +0100)]
ide-cd: add ide_cd_drain_data() helper

Add ide_cd_drain_data() and use it in cdrom_{buffer_sectors,read_intr}()
(as a nice side-effect this cuts 0.5kB of code from ide-cd.o).

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: merge cdrom_do_packet_command() and cdrom_do_block_pc()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:26 +0000 (23:09 +0100)]
ide-cd: merge cdrom_do_packet_command() and cdrom_do_block_pc()

Add REQ_TYPE_{SENSE,ATA_PC} requests handling to cdrom_do_block_pc()
and remove cdrom_do_packet_command().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: remove cdrom_do_pc_continuation()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:26 +0000 (23:09 +0100)]
ide-cd: remove cdrom_do_pc_continuation()

cdrom_do_pc_continuation() is now identical to cdrom_do_newpc_cont()
so just always use the latter function.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: merge cdrom_pc_intr() and cdrom_newpc_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:25 +0000 (23:09 +0100)]
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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: unify request end exit path in cdrom_pc_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:25 +0000 (23:09 +0100)]
ide-cd: unify request end exit path in cdrom_pc_intr()

This is a preparation for cdrom_pc_intr() and cdrom_newpc_intr() merge.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: factor out request sense fixup from cdrom_pc_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:25 +0000 (23:09 +0100)]
ide-cd: factor out request sense fixup from cdrom_pc_intr()

This is a preparation for cdrom_pc_intr() and cdrom_newpc_intr() merge.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: call blk_dump_rq_flags() on "missing data" in cdrom_newpc_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:25 +0000 (23:09 +0100)]
ide-cd: call blk_dump_rq_flags() on "missing data" in cdrom_newpc_intr()

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: remove BUG_ON() from cdrom_newpc_intr()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:25 +0000 (23:09 +0100)]
ide-cd: remove BUG_ON() from cdrom_newpc_intr()

There is no need for it anylonger and ide_set_handler() complains
if ->handler is not NULL anyway.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: move code handling cdrom.c IOCTLs to ide-cd_ioctl.c
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:25 +0000 (23:09 +0100)]
ide-cd: move code handling cdrom.c IOCTLs to ide-cd_ioctl.c

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: rename cdrom_* functions to ide_cd_*
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:24 +0000 (23:09 +0100)]
ide-cd: rename cdrom_* functions to ide_cd_*

* cdrom_prepare_request() -> ide_cd_init_rq()
* cdrom_queue_packet_command() -> ide_cd_queue_pc()
* cdrom_lockdoor() -> ide_cd_lockdoor()
* cdrom_read_toc() -> ide_cd_read_toc()
* cdrom_get_toc_entry() -> ide_cd_get_toc_entry()

This is a preparation to move code handling cdrom.c IOCTLs out of ide-cd.c.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: coding style fixes for cdrom_get_toc_entry()
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:24 +0000 (23:09 +0100)]
ide-cd: coding style fixes for cdrom_get_toc_entry()

This is a preparation to move code handling cdrom.c IOCTLs out of ide-cd.c.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: move lba_to_msf() and msf_to_lba() to <linux/cdrom.h>
Bartlomiej Zolnierkiewicz [Fri, 1 Feb 2008 22:09:24 +0000 (23:09 +0100)]
ide-cd: move lba_to_msf() and msf_to_lba() to <linux/cdrom.h>

* Move lba_to_msf() and msf_to_lba() to <linux/cdrom.h>
  (use 'u8' type instead of 'byte' while at it).

* Remove msf_to_lba() copy from drivers/cdrom/cdrom.c.

Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>