sb[7] should contain the length of whole information sense data
descriptor while desc[1] should contain the number of following bytes
in the descriptor. ie. 14 for sb[7] but 12 for desc[1].
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
libata didn't initialize result_tf.flags which indicates transfer type
(RW/FUA) and address type (CHS/LBA/LBA48). ata_gen_fixed_sense()
assumed result_tf.flags equals command tf.flags and failed to report
the first failed block to SCSI layer because zero tf flags indicates
CHS and bad block reporting for CHS is not implemented.
Implement fill_result_tf() which sets result_tf.flags to command
tf.flags and use it to fill result_tf.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
There's no need to memset &qc->sgent manually, sg_init_one() clears
sgent inside it. Also, kill not-so-necessary sg local variable.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Improve failed qc reporting. The original message didn't include the
actual command nor full error status and it was necessary to
temporarily patch the code to find out exactly which command is
causing problem. This patch makes EH report full command and result
TFs along with data direction and length. This change will make bug
reports more useful.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Now that PCS isn't used for device detection anymore...
* esb_sata is identical to ich5_sata
* no reason to know present_shift
* no reason to store map_db in host private area
The MAP table itself is left because it can be used for SCR access.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
PATA PIIX uses reset signature + TF r/w test for device presence
detection, which doesn't always work. It sometimes reports phantom
device which results in IDENTIFY timeouts.
SATA PIIX uses some combination of PCS + reset signature + TF r/w test
for device presence detection. No combination satifies all and for
some controllers, there doesn't seem to be any combination which
works reliably.
This patch makes both PATA and SATA piix's use reset signature + TF
r/w + polling IDENTIFY for device detection. This is what the old
libata (before irq-pio and new EH) did and what IDE does.
This patch also removes now obsolete PIIX_FLAG_IGNORE_PCS, force_pcs
and related code.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
On some controllers (ICHs in piix mode), there is *NO* reliable way to
determine device presence other than issuing IDENTIFY and see how the
transaction proceeds by watching the TF status register.
libata acted this way before irq-pio and phantom devices caused very
little problem but now that IDENTIFY is performed using IRQ drive PIO,
such phantom devices now result in multiple 30sec timeouts during
boot.
This patch implements ATA_FLAG_DETECT_POLLING. If a LLD sets this
flag, libata core issues the initial IDENTIFY in polling mode and if
the initial data transfer fails w/ HSM violation, the port is
considered to be empty thus replicating the old libata and IDE
behavior.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Make ata_dev_read_id() take @flags instead of @post_reset. Currently
there is only one flag defined - ATA_READID_POSTRESET, which is
equivalent to @post_reset. This is preparation for polling presence
detection.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Many drives support LBA48 even when its capacity is smaller than
1<<28, as LBA48 is required for many functionalities. FLUSH_EXT is
mandatory for drives w/ LBA48 support.
Interestingly, at least one of such drives (ST960812A) has problems
dealing with FLUSH_EXT. It eventually completes the command but takes
around 7 seconds to finish in many cases thus drastically slowing down
IO transactions. This seems to be a firmware bug which sneaked into
production probably because no other ATA driver including linux IDE
issues FLUSH_EXT to drives which report support for LBA48 & FLUSH_EXT
but is smaller than 1<<28 blocks.
This patch adds ATA_DFLAG_FLUSH_EXT which is set iff the drive
supports LBA48 & FLUSH_EXT and is larger than LBA28 limit. Both cache
flush paths are updated to issue FLUSH_EXT only when the flag is set.
Note that the changed behavior is more inline with the rest of libata.
libata prefers shorter commands whenever possible.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Danny Kukawka <dkukawka@novell.com>
Cc: Stefan Seyfried <seife@novell.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Some ICH8s use non-linear port mapping. ahci driver didn't use to
honor PORTS_IMPL and this made ports after hole nonfunctional. This
patch makes ahci mark those ports as dummy and properly initialize all
the implemented ports after the dummies.
As it's unknown whether other AHCIs implement PORTS_IMPL register
properly, new board id board_ahci_pi is added and selectively applied
to ICH8s. All other AHCIs continue to use linear mapping regardless
of PORTS_IMPL value.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
SiS965 and SiS180 chips must support slave mode,
SiS965L and SiS964 chips must not support slave mode.
SCR_STATUS for SATA ports in powerdown state fixed.
Now returning 0x0113 instead of 0x0117. Avoids problem
on detecting sata_sis controller.
Signed-off-by: Uwe Koziolek <uwe.koziolek@gmx.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Instead of writing 0xf blindly, preserve the content of write-once
PORTS_IMPL register over host resets.
This patch is taken from Jeff Garzik's AHCI init update patch.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
pdc_* functions are part of the global namespace for the PDC on PA-RISC
systems and this means our choice of pdc_ causes collisions between the
PDC globals and our static functions. Rename them to pdc202xx where they
are for both 2024x and 2026x.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Move dev->max_sectors configuration from ata_scsi_dev_config() to
ata_dev_configure().
* more consistent.
* allows LLDs to peek at the default dev->max_sectors value.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
libata EH used to perform ata_set_mode() iff the EH session performed
reset as indicated by ATA_EHI_DID_RESET. This is incorrect because
->dev_config() called by revalidation is allowed to modify transfer
mode which ata_set_mode() should take care of. This patch implements
the following two flags.
* ATA_EHI_SETMODE: set during EH to schedule ata_set_mode(). Both new
device attachment and revalidation set this flag.
* ATA_EHI_POST_SETMODE: set while the device is revalidated after
ata_set_mode(). Post-setmode revalidation is different from initial
configuaration and EH revalidation in that ->dev_config() is not
allowed tune transfer mode. LLD can use this flag to determine
whether it's allowed to tune transfer mode. Note that POST_SETMODE
->dev_config() is guaranteed to be preceded by non-POST_SETMODE
->dev_config().
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Implement ehi flag ATA_EHI_PRINTINFO. This flag is set when device
configuration needs to print out device info. This used to be handled
by @print_info argument to ata_dev_configure() but LLDs also need to
know about it in ->dev_config() callback.
This patch replaces @print_info w/ ATA_EHI_PRINTINFO and make sata_sil
print workaround messages only on the initial configuration.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
ahci-vt8251
* requires hardreset after PHY status change
* doesn't clear BSY on signature FIS after hardreset
* needs SError cleared for the port to operate after hardreset
This patch implements ahci_vt8251_hardreset() and sets
ATA_FLAG_HRST_TO_RESUME to handle the above behaviors. This fixes EH
including hotplug on vt8251.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Separate out sata_port_hardreset() from sata_std_hardreset(). This
will be used by LLD hardreset implementation and later by PMP.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Now that ahci_softreset() is fixed to automatically perform CLO if
BSY/DRQ is set on entry, AHCI_FLAG_RESET_NEEDS_CLO is redundant. Kill
it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Make user scan wait for scan to complete. This way user can wait for
warm plug request to complete and is prevented from causing EH event
storm by repetitively issuing scan request while EH is in progress.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Fajun Chen <fajunchen@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
NV controllers sometimes fail to perform softreset after hotplug.
Make it use hardreset to resume link.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
ata_irq_on() isn't used outside of libata core layer. The function is
TF/SFF interface specific but currently used by core path with some
hack too. Move it from include/linux/libata.h to
drivers/ata/libata-sff.c.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
libata waits for !BSY even when the status register reports 0xff.
This causes long boot delays when D8 isn't pulled down properly. This
patch does the followings.
* don't wait if status register is 0xff in all wait functions
* make ata_busy_sleep() return 0 on success and -errno on failure.
-ENODEV is returned on 0xff status and -EBUSY on other failures.
* make ata_bus_softreset() succeed on 0xff status. 0xff status is not
reset failure. It indicates no device. This removes unnecessary
retries on such ports. Note that the code change assumes unoccupied
port reporting 0xff status does not produce valid device signature.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Joe Jin <lkmaillist@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
needs a changelog
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This patch adds support for ADMA mode on NVIDIA nForce4 (CK804/MCP04) SATA
controllers to the sata_nv driver. Benefits of ADMA mode include:
- NCQ support
- Reduced CPU overhead (controller DMAs command information from memory
instead of them being pushed in by the CPU)
- Full 64-bit DMA support
ADMA mode is enabled by default in this version. To disable it, set the
module parameter adma_enabled=0.
Signed-off-by: Robert Hancock <hancockr@shaw.ca>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
- use pci_iomap() [Alan, version 0.0.5t]
- fix Alan's version 0.0.5t change
- line length, trailing whitespace, case indentation cleanups
- don't use deprecated ->eng_timeout() in a driver that uses new EH
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This is a legacy mode PATA driver for the 6101/45 and will also drive
the SATA ports 1 & 2 in legacy mode as well if desired. Tested and
confirmed working by users. The chip supports AHCI type behaviour for
SATA and has a more advanced PATA interface as well so this driver will
get it working but not get best performance for now.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
pci_module_init() conversion for pata_pdc2027x
Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Alan Cox <alan@redhat.com> but please apply as follows to keep
revision id straight
Cc: Henrik Kretzschmar <henne@nachtwindheim.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
pci_module_init convertion in ata_generic.c.
Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Winbond 83759A support in non-multichip mode (afaik nobody ever used
multichip mode anyway). The 83759 is not supported by this driver as it
is already handled elsewhere and doens't use the same interfaces.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Many LLDs are missing sht->slave_destroy. The method is mandatory to
support device warm unplugging (echo 1 > /sys/.../delete). Without
it, libata might access released scsi device.
Signed-off-by: Tejun Heo <htejun@gmail.com>
JMicron AHCI controllers set PORT_IRQ_IF_ERR on device errors. The
IRQ status bit indicates interface error or protocol mismatch and ahci
driver interprets it into AC_ERR_ATA_BUS. So, whenever an ATAPI
device raises check condition, ahci interprets it as ATA bus error and
thus resets it which, in turn, raises check condition thus creating a
reset loop and rendering the device unuseable.
This patch makes JMB controllers ignore PORT_IRQ_IF_ERR when
interpreting error condition.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Justin Tsai <justin@jmicron.com>
Fixes ata_sas_queuecmd to properly handle a failure from
__ata_scsi_queuecmd.
Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This patch adds the Intel ICH9 AHCI controller DID's for SATA support.
Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Do not schedule EH for revalidation on wcache on/off if old EH. Old
EH cannot handle it and will result in WARN_ON()'s and oops.
This closes bug #7412.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Pass the work_struct pointer to the work function rather than context data.
The work function can use container_of() to work out the data.
For the cases where the container of the work_struct may go away the moment the
pending bit is cleared, it is made possible to defer the release of the
structure by deferring the clearing of the pending bit.
To make this work, an extra flag is introduced into the management side of the
work_struct. This governs auto-release of the structure upon execution.
Ordinarily, the work queue executor would release the work_struct for further
scheduling or deallocation by clearing the pending bit prior to jumping to the
work function. This means that, unless the driver makes some guarantee itself
that the work_struct won't go away, the work function may not access anything
else in the work_struct or its container lest they be deallocated.. This is a
problem if the auxiliary data is taken away (as done by the last patch).
However, if the pending bit is *not* cleared before jumping to the work
function, then the work function *may* access the work_struct and its container
with no problems. But then the work function must itself release the
work_struct by calling work_release().
In most cases, automatic release is fine, so this is the default. Special
initiators exist for the non-auto-release case (ending in _NAR).
Signed-Off-By: David Howells <dhowells@redhat.com>
Separate delayable work items from non-delayable work items be splitting them
into a separate structure (delayed_work), which incorporates a work_struct and
the timer_list removed from work_struct.
The work_struct struct is huge, and this limits it's usefulness. On a 64-bit
architecture it's nearly 100 bytes in size. This reduces that by half for the
non-delayable type of event.
Signed-Off-By: David Howells <dhowells@redhat.com>
When building a monolithic kernel, the load order of drivers does not
work for SAS libata users, resulting in a kernel oops.
Convert libata to use subsys_initcall instead of module_init, which
ensures that libata gets loaded before any LLDD.
This is the same thing that scsi core does to solve the problem. The
load order problem was observed on ipr SAS adapters and should exist for
other SAS users as well.
Signed-off-by: Brian King <brking@us.ibm.com>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
A curious thing happens, however, when ata_qc_new_init fails to get
an ata_queued_cmd:
First, ata_qc_new_init handles the failure like this:
cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
done(cmd);
Then, we return to ata_scsi_translate and do this:
err_mem:
cmd->result = (DID_ERROR << 16);
done(cmd);
It appears to me that first we set a status code indicating that we're
ok but the device queue is full and finish the command, but then
we blow away that status code and replace it with an error flag and
finish the command a second time! That does not seem to be desirable
behavior since we merely want the I/O to wait until a command slot
frees up, not send errors up the block layer.
In the err_mem case, we should simply exit out of ata_scsi_translate
instead.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Helps for PATA but SATA bridged devices lie and always set all the bits
so will need the error handling fixes from Tejun.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This reverts commit f833229c96:
According to reviewers and the lspci data provided in commit message
itself, PCI ID 0x7110 should not have been added to ata_piix.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
ahci_softreset() used to use ahci_tf_read() which reads D2H_REG area
to check for the Status register. However, this area is zeroed on
initialization and not set by initial signature FIS. Replace it with
ahci_check_status().
This bug prevented CLO code from being activated whenever BSY and/or
DRQ is set prior to softreset. This fix makes
AHCI_FLAG_RESET_NEEDS_CLO flag redundant.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
ICH7M was separated from ICH6M to allow undocumented MAP value 01b
which was spotted on an ASUS notebook. However, there is also
notebooks with MAP value 01b on ICH6M. This patch re-merges ICH6M and
ICH7M entries and allows MAP value 01b for both.
This problem has been reported and initial patch provided by Jonathan
Dieter.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Jonathan Dieter <jdieter@gmail.com>
Cc: Tom Deblauwe <tom.deblauwe@telenet.be>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
ata_dev_revalidate() isn't used outside of libata core. Unexport it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Hi Jeff,
I tested the PATA support on my old VAIO notebook, and it failed to find
my piix device:
00:07.1 Class 0101: 8086:7111 (rev 01) (prog-if 80 [Master])
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR-
Latency: 64
Region 4: I/O ports at fc90 [size=16]
This patch adds the pci id to ata_piix.c and things then work as
expected.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
sis_init_one() modifies probe_ent->port_flags after allocating and
initializing it using ata_pci_init_native_mode(). This makes port_flags
for the secondary port (probe_ent->pinfo2->flags) go out of sync resulting
in misdetection of device due to incorrectly initialized SCR access flag.
This patch make probe_ent alloc/init happen after the final port flags
value is determined. This is fragile but probe_ent and all the related
mess are scheduled to go away soon for exactly this reason. We just need
to hold everything together till then.
This has been spotted and diagnosed and tested by Patrick McHardy.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Patric McHardy <kaber@trash.net>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
There are some Linux supported platforms that simply cannot hit the low
I/O addresses used by ATA legacy mode PCI mappings. These platforms have
a window for PCI space that is fixed by the board logic and doesn't
include the neccessary locations.
Provide a config option so that such platforms faced with a controller
that they cannot support simply error it and punt
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Fix the following compile error with CONFIG_ATA=y, CONFIG_BLOCK=n:
...
CC drivers/ata/libata-scsi.o
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c: In function ‘ata_scsi_dev_config’:
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c:791: warning: implicit declaration of function ‘blk_queue_max_sectors’
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c:799: error: ‘request_queue_t’ undeclared (first use in this function)
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c:799: error: (Each undeclared identifier is reported only once
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c:799: error: for each function it appears in.)
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c:799: error: ‘q’ undeclared (first use in this function)
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c:800: warning: implicit declaration of function ‘blk_queue_max_hw_segments’
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c: In function ‘ata_scsi_slave_config’:
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/ata/libata-scsi.c:831:
warning: implicit declaration of function ‘blk_queue_max_phys_segments’
make[3]: *** [drivers/ata/libata-scsi.o] Error 1
Bug report by Jesper Juhl.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Use valid values for ICH8 map_db. With the old values, when the
controller was in Native mode, and SCC was 1 (drives configured for
IDE), any drive plugged into a slave port was not recognized. For
Combined Mode (and SCC is still 1), 2 is a value value for MAP.map_value,
and needs to be recognized.
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The following tiny patch fixes a typo in qdi_data_xfer (le32 instead
of le16).
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Make the HDIO_DRIVE_CMD ioctl in libata (ATA command pass through) return a
few ATA registers to userspace, following the same convention as the
drivers/ide implementation of the same ioctl. This is needed to support ATA
commands like CHECK POWER MODE, which return information in nsectors.
This fixes "hdparm -C" on SATA drives.
Forcing the sense data read via the cc flag causes spurious check conditions,
so we filter these out (following the ATA command pass-through specification
T10/04-262r7).
Signed-off-by: Eran Tromer <eran@tromer.org>
Acked-by: Tejun Heo <htejun@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
This fixes support for rev c8 of the ALi/ULi PATA, and keeps pcmcia in
sync so ide_cs and pata_pcmcia are interchangable, both are only changes
to constants.
Right now rev 0xC8 and higher don't work with libata but 0xc8 is in the
field now.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
[libata] pata_artop: kill gcc warning
[PATCH] libata: turn off NCQ if queue depth is adjusted to 1
[PATCH] libata: cosmetic changes to constants
[libata] DocBook minor updates, fixes
[libata] PCI ID table cleanup in various drivers
[libata] Print out Status register, if a BSY-sleep takes too long
[libata] init probe_ent->private_data in a common location
[libata] minor PCI IDE probe fixes and cleanups
[libata] Use new PCI_VDEVICE() macro to dramatically shorten ID lists
[PATCH] Fix reference of uninitialised memory in ata_device_add()
gcc complains thusly:
drivers/ata/pata_artop.c: In function ‘artop_init_one’:
drivers/ata/pata_artop.c:429: warning: ‘info’ may be used uninitialized in this function
While this warning is indeed bogus, even with improved static analysis
and value range propagation, gcc will probably never be able to detect
this.
Add a BUG_ON() to trap invalid driver_data entries in the PCI table.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
* Use PCI_VDEVICE() macro
* const-ify pci_device_id table
* standardize list terminator as "{ }"
* convert spaces to tab in pci_driver struct (Alan-ism)
* various minor whitespace cleanups
Signed-off-by: Jeff Garzik <jeff@garzik.org>
We have the info stored in an ata_busy_sleep() variable, so might as
well print it, and provide some additional diagnostic info.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Don't write the same code twice, in two different functions, when they
both call the same initialization function, with the same private_data
pointer info.
Also, note a bug found with a FIXME.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
* Replace needless 'n_ports > 2' check with a simple BUG_ON().
No existing driver ever wants more than 2 ports.
* Delete ATA_FLAG_NO_LEGACY check. No current driver uses
ata_pci_init_one(), that sets this flag.
* Move PCI_CLASS_PROG register read below pci_enable_device()
* Handle ata_device_add() failure
Signed-off-by: Jeff Garzik <jeff@garzik.org>
ata_device_add fails, calls ata_host_remove with pointers to unitialized
memory.
Signed-off-by: Dave Jones <davej@redhat.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The PATA driver set got converted to the new error handling setup, but
the old hooks were accidentally left in place. Now, removed.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Only two of three ata_port_operations structs had a ->data_xfer member,
which led to, uh, a lack of data xfer.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This removes the layering violation where drivers have to fiddle
directly with EH flags. Instead we now recognize -ENOENT means "no port"
and do the handling in the core code.
This also removes an instance of a call to disable the port, and an
identical printk from each driver doing this. Even better - future rule
changes will be in one place only.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
The legacy and QDI drivers are ISA/VLB bus [we don't have a VLB define
but ISA will do nicely].
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
We don't currently support pure polled operation so when we meet a BIOS
which forgot to assign an IRQ to a PCI device it all goes a little pear
shaped. Trap this case properly.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>