2019-05-19 20:08:20 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2006-08-30 06:12:40 +08:00
|
|
|
/*
|
2007-03-09 20:24:15 +08:00
|
|
|
* pata_serverworks.c - Serverworks PATA for new ATA layer
|
2006-08-30 06:12:40 +08:00
|
|
|
* (C) 2005 Red Hat Inc
|
2010-01-19 01:16:38 +08:00
|
|
|
* (C) 2010 Bartlomiej Zolnierkiewicz
|
2006-08-30 06:12:40 +08:00
|
|
|
*
|
|
|
|
* based upon
|
|
|
|
*
|
|
|
|
* serverworks.c
|
2006-08-31 12:03:49 +08:00
|
|
|
*
|
2006-08-30 06:12:40 +08:00
|
|
|
* Copyright (C) 1998-2000 Michel Aubry
|
|
|
|
* Copyright (C) 1998-2000 Andrzej Krzysztofowicz
|
|
|
|
* Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
|
|
|
|
* Portions copyright (c) 2001 Sun Microsystems
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* RCC/ServerWorks IDE driver for Linux
|
|
|
|
*
|
|
|
|
* OSB4: `Open South Bridge' IDE Interface (fn 1)
|
|
|
|
* supports UDMA mode 2 (33 MB/s)
|
|
|
|
*
|
|
|
|
* CSB5: `Champion South Bridge' IDE Interface (fn 1)
|
|
|
|
* all revisions support UDMA mode 4 (66 MB/s)
|
|
|
|
* revision A2.0 and up support UDMA mode 5 (100 MB/s)
|
|
|
|
*
|
|
|
|
* *** The CSB5 does not provide ANY register ***
|
|
|
|
* *** to detect 80-conductor cable presence. ***
|
|
|
|
*
|
|
|
|
* CSB6: `Champion South Bridge' IDE Interface (optional: third channel)
|
|
|
|
*
|
|
|
|
* Documentation:
|
|
|
|
* Available under NDA only. Errata info very hard to get.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <scsi/scsi_host.h>
|
|
|
|
#include <linux/libata.h>
|
|
|
|
|
|
|
|
#define DRV_NAME "pata_serverworks"
|
2008-01-19 23:52:56 +08:00
|
|
|
#define DRV_VERSION "0.4.3"
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
#define SVWKS_CSB5_REVISION_NEW 0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
|
|
|
|
#define SVWKS_CSB6_REVISION 0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */
|
|
|
|
|
|
|
|
/* Seagate Barracuda ATA IV Family drives in UDMA mode 5
|
|
|
|
* can overrun their FIFOs when used with the CSB5 */
|
|
|
|
|
|
|
|
static const char *csb_bad_ata100[] = {
|
|
|
|
"ST320011A",
|
|
|
|
"ST340016A",
|
|
|
|
"ST360021A",
|
|
|
|
"ST380021A",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2011-10-13 18:32:18 +08:00
|
|
|
* oem_cable - Dell/Sun serverworks cable detection
|
2006-08-30 06:12:40 +08:00
|
|
|
* @ap: ATA port to do cable detect
|
|
|
|
*
|
2011-10-13 18:32:18 +08:00
|
|
|
* Dell PowerEdge and Sun Cobalt 'Alpine' hide the 40/80 pin select
|
|
|
|
* for their interfaces in the top two bits of the subsystem ID.
|
2006-08-30 06:12:40 +08:00
|
|
|
*/
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2011-10-13 18:32:18 +08:00
|
|
|
static int oem_cable(struct ata_port *ap)
|
2011-10-12 02:09:31 +08:00
|
|
|
{
|
2006-08-30 06:12:40 +08:00
|
|
|
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2006-08-30 06:12:40 +08:00
|
|
|
if (pdev->subsystem_device & (1 << (ap->port_no + 14)))
|
|
|
|
return ATA_CBL_PATA80;
|
|
|
|
return ATA_CBL_PATA40;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct sv_cable_table {
|
|
|
|
int device;
|
|
|
|
int subvendor;
|
|
|
|
int (*cable_detect)(struct ata_port *ap);
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct sv_cable_table cable_detect[] = {
|
2011-10-13 18:32:18 +08:00
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_DELL, oem_cable },
|
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_VENDOR_ID_DELL, oem_cable },
|
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_SUN, oem_cable },
|
2011-10-12 02:09:31 +08:00
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, ata_cable_40wire },
|
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, ata_cable_unknown },
|
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, ata_cable_unknown },
|
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, ata_cable_unknown },
|
|
|
|
{ PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, ata_cable_unknown },
|
2006-08-30 06:12:40 +08:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2007-03-09 20:24:15 +08:00
|
|
|
* serverworks_cable_detect - cable detection
|
2006-08-30 06:12:40 +08:00
|
|
|
* @ap: ATA port
|
|
|
|
*
|
2006-08-31 12:03:49 +08:00
|
|
|
* Perform cable detection according to the device and subvendor
|
2006-08-30 06:12:40 +08:00
|
|
|
* identifications
|
|
|
|
*/
|
2006-08-31 12:03:49 +08:00
|
|
|
|
libata: add deadline support to prereset and reset methods
Add @deadline to prereset and reset methods and make them honor it.
ata_wait_ready() which directly takes @deadline is implemented to be
used as the wait function. This patch is in preparation for EH timing
improvements.
* ata_wait_ready() never does busy sleep. It's only used from EH and
no wait in EH is that urgent. This function also prints 'be
patient' message automatically after 5 secs of waiting if more than
3 secs is remaining till deadline.
* ata_bus_post_reset() now fails with error code if any of its wait
fails. This is important because earlier reset tries will have
shorter timeout than the spec requires. If a device fails to
respond before the short timeout, reset should be retried with
longer timeout rather than silently ignoring the device.
There are three behavior differences.
1. Timeout is applied to both devices at once, not separately. This
is more consistent with what the spec says.
2. When a device passes devchk but fails to become ready before
deadline. Previouly, post_reset would just succeed and let
device classification remove the device. New code fails the
reset thus causing reset retry. After a few times, EH will give
up disabling the port.
3. When slave device passes devchk but fails to become accessible
(TF-wise) after reset. Original code disables dev1 after 30s
timeout and continues as if the device doesn't exist, while the
patched code fails reset. When this happens, new code fails
reset on whole port rather than proceeding with only the primary
device.
If the failing device is suffering transient problems, new code
retries reset which is a better behavior. If the failing device is
actually broken, the net effect is identical to it, but not to the
other device sharing the channel. In the previous code, reset would
have succeeded after 30s thus detecting the working one. In the new
code, reset fails and whole port gets disabled. IMO, it's a
pathological case anyway (broken device sharing bus with working
one) and doesn't really matter.
* ata_bus_softreset() is changed to return error code from
ata_bus_post_reset(). It used to return 0 unconditionally.
* Spin up waiting is to be removed and not converted to honor
deadline.
* To be on the safe side, deadline is set to 40s for the time being.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-02 15:50:52 +08:00
|
|
|
static int serverworks_cable_detect(struct ata_port *ap)
|
|
|
|
{
|
2006-08-30 06:12:40 +08:00
|
|
|
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
|
|
|
|
struct sv_cable_table *cb = cable_detect;
|
|
|
|
|
|
|
|
while(cb->device) {
|
2006-08-31 12:03:49 +08:00
|
|
|
if (cb->device == pdev->device &&
|
2006-08-30 06:12:40 +08:00
|
|
|
(cb->subvendor == pdev->subsystem_vendor ||
|
|
|
|
cb->subvendor == PCI_ANY_ID)) {
|
2007-03-09 20:24:15 +08:00
|
|
|
return cb->cable_detect(ap);
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
|
|
|
cb++;
|
|
|
|
}
|
|
|
|
|
|
|
|
BUG();
|
|
|
|
return -1; /* kill compiler warning */
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* serverworks_is_csb - Check for CSB or OSB
|
|
|
|
* @pdev: PCI device to check
|
|
|
|
*
|
|
|
|
* Returns true if the device being checked is known to be a CSB
|
|
|
|
* series device.
|
|
|
|
*/
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2006-08-30 06:12:40 +08:00
|
|
|
static u8 serverworks_is_csb(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
switch (pdev->device) {
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE:
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2:
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_HT1000IDE:
|
|
|
|
return 1;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* serverworks_osb4_filter - mode selection filter
|
|
|
|
* @adev: ATA device
|
2007-03-09 22:34:07 +08:00
|
|
|
* @mask: Mask of proposed modes
|
2006-08-30 06:12:40 +08:00
|
|
|
*
|
|
|
|
* Filter the offered modes for the device to apply controller
|
|
|
|
* specific rules. OSB4 requires no UDMA for disks due to a FIFO
|
|
|
|
* bug we hit.
|
|
|
|
*/
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2007-03-09 22:34:07 +08:00
|
|
|
static unsigned long serverworks_osb4_filter(struct ata_device *adev, unsigned long mask)
|
2006-08-30 06:12:40 +08:00
|
|
|
{
|
|
|
|
if (adev->class == ATA_DEV_ATA)
|
|
|
|
mask &= ~ATA_MASK_UDMA;
|
libata-sff: clean up BMDMA initialization
When BMDMA initialization failed or BMDMA was not available for
whatever reason, bmdma_addr was left at zero and used as an indication
that BMDMA shouldn't be used. This leads to the following problems.
p1. For BMDMA drivers which don't use traditional BMDMA register,
ata_bmdma_mode_filter() incorrectly inhibits DMA modes. Those
drivers either have to inherit from ata_sff_port_ops or clear
->mode_filter explicitly.
p2. non-BMDMA drivers call into BMDMA PRD table allocation. It
doesn't actually allocate PRD table if bmdma_addr is not
initialized but is still confusing.
p3. For BMDMA drivers which don't use traditional BMDMA register, some
methods might not be invoked as expected (e.g. bmdma_stop from
ata_sff_post_internal_cmd()).
p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
worrying libata core might call into one of them.
These problems are caused by the muddy line between SFF and BMDMA and
the assumption that all BMDMA controllers initialize bmdma_addr.
This patch fixes p1 and p2 by removing the bmdma_addr assumption and
moving prd allocation to BMDMA port start. Later patches will fix the
remaining issues.
This patch improves BMDMA initialization such that
* When BMDMA register initialization fails, falls back to PIO instead
of failing. ata_pci_bmdma_init() never fails now.
* When ata_pci_bmdma_init() falls back to PIO, it clears
ap->mwdma_mask and udma_mask instead of depending on
ata_bmdma_mode_filter(). This makes ata_bmdma_mode_filter()
unnecessary thus resolving p1.
* ata_port_start() which actually is BMDMA specific is moved to
ata_bmdma_port_start(). ata_port_start() and ata_sff_port_start()
are killed.
* ata_sff_port_start32() is moved and renamed to
ata_bmdma_port_start32().
Drivers which no longer call into PRD table allocation are...
pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all
drivers which inherit from ata_sff_port_ops.
pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD
but is a BMDMA controller and doesn't have custom port_start like
other such controllers.
Note that with the previous patch which makes all and only BMDMA
drivers inherit from ata_bmdma_port_ops, this change doesn't break
drivers which need PRD table.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-11 03:41:34 +08:00
|
|
|
return mask;
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* serverworks_csb_filter - mode selection filter
|
|
|
|
* @adev: ATA device
|
2007-03-09 22:34:07 +08:00
|
|
|
* @mask: Mask of proposed modes
|
2006-08-30 06:12:40 +08:00
|
|
|
*
|
|
|
|
* Check the blacklist and disable UDMA5 if matched
|
|
|
|
*/
|
|
|
|
|
2007-03-09 22:34:07 +08:00
|
|
|
static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned long mask)
|
2006-08-30 06:12:40 +08:00
|
|
|
{
|
|
|
|
const char *p;
|
2007-01-02 19:19:40 +08:00
|
|
|
char model_num[ATA_ID_PROD_LEN + 1];
|
|
|
|
int i;
|
2006-08-30 06:12:40 +08:00
|
|
|
|
2006-08-31 12:03:49 +08:00
|
|
|
/* Disk, UDMA */
|
2006-08-30 06:12:40 +08:00
|
|
|
if (adev->class != ATA_DEV_ATA)
|
libata-sff: clean up BMDMA initialization
When BMDMA initialization failed or BMDMA was not available for
whatever reason, bmdma_addr was left at zero and used as an indication
that BMDMA shouldn't be used. This leads to the following problems.
p1. For BMDMA drivers which don't use traditional BMDMA register,
ata_bmdma_mode_filter() incorrectly inhibits DMA modes. Those
drivers either have to inherit from ata_sff_port_ops or clear
->mode_filter explicitly.
p2. non-BMDMA drivers call into BMDMA PRD table allocation. It
doesn't actually allocate PRD table if bmdma_addr is not
initialized but is still confusing.
p3. For BMDMA drivers which don't use traditional BMDMA register, some
methods might not be invoked as expected (e.g. bmdma_stop from
ata_sff_post_internal_cmd()).
p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
worrying libata core might call into one of them.
These problems are caused by the muddy line between SFF and BMDMA and
the assumption that all BMDMA controllers initialize bmdma_addr.
This patch fixes p1 and p2 by removing the bmdma_addr assumption and
moving prd allocation to BMDMA port start. Later patches will fix the
remaining issues.
This patch improves BMDMA initialization such that
* When BMDMA register initialization fails, falls back to PIO instead
of failing. ata_pci_bmdma_init() never fails now.
* When ata_pci_bmdma_init() falls back to PIO, it clears
ap->mwdma_mask and udma_mask instead of depending on
ata_bmdma_mode_filter(). This makes ata_bmdma_mode_filter()
unnecessary thus resolving p1.
* ata_port_start() which actually is BMDMA specific is moved to
ata_bmdma_port_start(). ata_port_start() and ata_sff_port_start()
are killed.
* ata_sff_port_start32() is moved and renamed to
ata_bmdma_port_start32().
Drivers which no longer call into PRD table allocation are...
pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all
drivers which inherit from ata_sff_port_ops.
pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD
but is a BMDMA controller and doesn't have custom port_start like
other such controllers.
Note that with the previous patch which makes all and only BMDMA
drivers inherit from ata_bmdma_port_ops, this change doesn't break
drivers which need PRD table.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-11 03:41:34 +08:00
|
|
|
return mask;
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
/* Actually do need to check */
|
2007-01-02 19:19:40 +08:00
|
|
|
ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2007-01-02 19:19:40 +08:00
|
|
|
for (i = 0; (p = csb_bad_ata100[i]) != NULL; i++) {
|
|
|
|
if (!strcmp(p, model_num))
|
2008-02-27 05:35:54 +08:00
|
|
|
mask &= ~(0xE0 << ATA_SHIFT_UDMA);
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
libata-sff: clean up BMDMA initialization
When BMDMA initialization failed or BMDMA was not available for
whatever reason, bmdma_addr was left at zero and used as an indication
that BMDMA shouldn't be used. This leads to the following problems.
p1. For BMDMA drivers which don't use traditional BMDMA register,
ata_bmdma_mode_filter() incorrectly inhibits DMA modes. Those
drivers either have to inherit from ata_sff_port_ops or clear
->mode_filter explicitly.
p2. non-BMDMA drivers call into BMDMA PRD table allocation. It
doesn't actually allocate PRD table if bmdma_addr is not
initialized but is still confusing.
p3. For BMDMA drivers which don't use traditional BMDMA register, some
methods might not be invoked as expected (e.g. bmdma_stop from
ata_sff_post_internal_cmd()).
p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
worrying libata core might call into one of them.
These problems are caused by the muddy line between SFF and BMDMA and
the assumption that all BMDMA controllers initialize bmdma_addr.
This patch fixes p1 and p2 by removing the bmdma_addr assumption and
moving prd allocation to BMDMA port start. Later patches will fix the
remaining issues.
This patch improves BMDMA initialization such that
* When BMDMA register initialization fails, falls back to PIO instead
of failing. ata_pci_bmdma_init() never fails now.
* When ata_pci_bmdma_init() falls back to PIO, it clears
ap->mwdma_mask and udma_mask instead of depending on
ata_bmdma_mode_filter(). This makes ata_bmdma_mode_filter()
unnecessary thus resolving p1.
* ata_port_start() which actually is BMDMA specific is moved to
ata_bmdma_port_start(). ata_port_start() and ata_sff_port_start()
are killed.
* ata_sff_port_start32() is moved and renamed to
ata_bmdma_port_start32().
Drivers which no longer call into PRD table allocation are...
pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all
drivers which inherit from ata_sff_port_ops.
pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD
but is a BMDMA controller and doesn't have custom port_start like
other such controllers.
Note that with the previous patch which makes all and only BMDMA
drivers inherit from ata_bmdma_port_ops, this change doesn't break
drivers which need PRD table.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-11 03:41:34 +08:00
|
|
|
return mask;
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* serverworks_set_piomode - set initial PIO mode data
|
|
|
|
* @ap: ATA interface
|
|
|
|
* @adev: ATA device
|
|
|
|
*
|
|
|
|
* Program the OSB4/CSB5 timing registers for PIO. The PIO register
|
|
|
|
* load is done as a simple lookup.
|
|
|
|
*/
|
|
|
|
static void serverworks_set_piomode(struct ata_port *ap, struct ata_device *adev)
|
|
|
|
{
|
|
|
|
static const u8 pio_mode[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
|
2008-01-19 23:52:56 +08:00
|
|
|
int offset = 1 + 2 * ap->port_no - adev->devno;
|
2006-08-30 06:12:40 +08:00
|
|
|
int devbits = (2 * ap->port_no + adev->devno) * 4;
|
|
|
|
u16 csb5_pio;
|
|
|
|
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
|
|
|
|
int pio = adev->pio_mode - XFER_PIO_0;
|
|
|
|
|
|
|
|
pci_write_config_byte(pdev, 0x40 + offset, pio_mode[pio]);
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2006-08-30 06:12:40 +08:00
|
|
|
/* The OSB4 just requires the timing but the CSB series want the
|
|
|
|
mode number as well */
|
|
|
|
if (serverworks_is_csb(pdev)) {
|
|
|
|
pci_read_config_word(pdev, 0x4A, &csb5_pio);
|
|
|
|
csb5_pio &= ~(0x0F << devbits);
|
2010-01-19 01:16:38 +08:00
|
|
|
pci_write_config_word(pdev, 0x4A, csb5_pio | (pio << devbits));
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* serverworks_set_dmamode - set initial DMA mode data
|
|
|
|
* @ap: ATA interface
|
|
|
|
* @adev: ATA device
|
|
|
|
*
|
|
|
|
* Program the MWDMA/UDMA modes for the serverworks OSB4/CSB5
|
|
|
|
* chipset. The MWDMA mode values are pulled from a lookup table
|
|
|
|
* while the chipset uses mode number for UDMA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev)
|
|
|
|
{
|
|
|
|
static const u8 dma_mode[] = { 0x77, 0x21, 0x20 };
|
|
|
|
int offset = 1 + 2 * ap->port_no - adev->devno;
|
2007-11-05 23:04:40 +08:00
|
|
|
int devbits = 2 * ap->port_no + adev->devno;
|
2006-08-30 06:12:40 +08:00
|
|
|
u8 ultra;
|
|
|
|
u8 ultra_cfg;
|
|
|
|
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
|
|
|
|
|
|
|
|
pci_read_config_byte(pdev, 0x54, &ultra_cfg);
|
2007-11-05 23:04:40 +08:00
|
|
|
pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra);
|
|
|
|
ultra &= ~(0x0F << (adev->devno * 4));
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
if (adev->dma_mode >= XFER_UDMA_0) {
|
|
|
|
pci_write_config_byte(pdev, 0x44 + offset, 0x20);
|
|
|
|
|
|
|
|
ultra |= (adev->dma_mode - XFER_UDMA_0)
|
2007-11-05 23:04:40 +08:00
|
|
|
<< (adev->devno * 4);
|
2006-08-30 06:12:40 +08:00
|
|
|
ultra_cfg |= (1 << devbits);
|
|
|
|
} else {
|
2006-08-31 12:03:49 +08:00
|
|
|
pci_write_config_byte(pdev, 0x44 + offset,
|
2006-08-30 06:12:40 +08:00
|
|
|
dma_mode[adev->dma_mode - XFER_MW_DMA_0]);
|
|
|
|
ultra_cfg &= ~(1 << devbits);
|
|
|
|
}
|
2007-11-05 23:04:40 +08:00
|
|
|
pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra);
|
2006-08-30 06:12:40 +08:00
|
|
|
pci_write_config_byte(pdev, 0x54, ultra_cfg);
|
|
|
|
}
|
|
|
|
|
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
The Broadcom OSB4 IDE Controller (vendor and device IDs: 1166:0211)
does not support 64-KB DMA transfers.
Whenever a 64-KB DMA transfer is attempted,
the transfer fails and messages similar to the following
are written to the console log:
[ 2431.851125] sr 0:0:0:0: [sr0] Unhandled sense code
[ 2431.851139] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2431.851152] sr 0:0:0:0: [sr0] Sense Key : Hardware Error [current]
[ 2431.851166] sr 0:0:0:0: [sr0] Add. Sense: Logical unit communication time-out
[ 2431.851182] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 76 f4 00 00 40 00
[ 2431.851210] end_request: I/O error, dev sr0, sector 121808
When the libata and pata_serverworks modules
are recompiled with ATA_DEBUG and ATA_VERBOSE_DEBUG defined in libata.h,
the 64-KB transfer size in the scatter-gather list can be seen
in the console log:
[ 2664.897267] sr 9:0:0:0: [sr0] Send:
[ 2664.897274] 0xf63d85e0
[ 2664.897283] sr 9:0:0:0: [sr0] CDB:
[ 2664.897288] Read(10): 28 00 00 00 7f b4 00 00 40 00
[ 2664.897319] buffer = 0xf6d6fbc0, bufflen = 131072, queuecommand 0xf81b7700
[ 2664.897331] ata_scsi_dump_cdb: CDB (1:0,0,0) 28 00 00 00 7f b4 00 00 40
[ 2664.897338] ata_scsi_translate: ENTER
[ 2664.897345] ata_sg_setup: ENTER, ata1
[ 2664.897356] ata_sg_setup: 3 sg elements mapped
[ 2664.897364] ata_bmdma_fill_sg: PRD[0] = (0x66FD2000, 0xE000)
[ 2664.897371] ata_bmdma_fill_sg: PRD[1] = (0x65000000, 0x10000)
------------------------------------------------------> =======
[ 2664.897378] ata_bmdma_fill_sg: PRD[2] = (0x66A10000, 0x2000)
[ 2664.897386] ata1: ata_dev_select: ENTER, device 0, wait 1
[ 2664.897422] ata_sff_tf_load: feat 0x1 nsect 0x0 lba 0x0 0x0 0xFC
[ 2664.897428] ata_sff_tf_load: device 0xA0
[ 2664.897448] ata_sff_exec_command: ata1: cmd 0xA0
[ 2664.897457] ata_scsi_translate: EXIT
[ 2664.897462] leaving scsi_dispatch_cmnd()
[ 2664.897497] Doing sr request, dev = sr0, block = 0
[ 2664.897507] sr0 : reading 64/256 512 byte blocks.
[ 2664.897553] ata_sff_hsm_move: ata1: protocol 7 task_state 1 (dev_stat 0x58)
[ 2664.897560] atapi_send_cdb: send cdb
[ 2666.910058] ata_bmdma_port_intr: ata1: host_stat 0x64
[ 2666.910079] __ata_sff_port_intr: ata1: protocol 7 task_state 3
[ 2666.910093] ata_sff_hsm_move: ata1: protocol 7 task_state 3 (dev_stat 0x51)
[ 2666.910101] ata_sff_hsm_move: ata1: protocol 7 task_state 4 (dev_stat 0x51)
[ 2666.910129] sr 9:0:0:0: [sr0] Done:
[ 2666.910136] 0xf63d85e0 TIMEOUT
lspci shows that the driver used for the Broadcom OSB4 IDE Controller is
pata_serverworks:
00:0f.1 IDE interface: Broadcom OSB4 IDE Controller (prog-if 8e [Master SecP SecO PriP])
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
I/O ports at 0170 [size=8]
I/O ports at 0374 [size=4]
I/O ports at 1440 [size=16]
Kernel driver in use: pata_serverworks
The pata_serverworks driver supports five distinct device IDs,
one being the OSB4 and the other four belonging to the CSB series.
The CSB series appears to support 64-KB DMA transfers,
as tests on a machine with an SAI2 motherboard
containing a Broadcom CSB5 IDE Controller (vendor and device IDs: 1166:0212)
showed no problems with 64-KB DMA transfers.
This problem was first discovered when attempting to install openSUSE
from a DVD on a machine with an STL2 motherboard.
Using the pata_serverworks module,
older releases of openSUSE will not install at all due to the timeouts.
Releases of openSUSE prior to 11.3 can be installed by disabling
the pata_serverworks module using the brokenmodules boot parameter,
which causes the serverworks module to be used instead.
Recent releases of openSUSE (12.2 and later) include better error recovery and
will install, though very slowly.
On all openSUSE releases, the problem can be recreated
on a machine containing a Broadcom OSB4 IDE Controller
by mounting an install DVD and running a command similar to the following:
find /mnt -type f -print | xargs cat > /dev/null
The patch below corrects the problem.
Similar to the other ATA drivers that do not support 64-KB DMA transfers,
the patch changes the ata_port_operations qc_prep vector to point to a routine
that breaks any 64-KB segment into two 32-KB segments and
changes the scsi_host_template sg_tablesize element to reduce by half
the number of scatter/gather elements allowed.
These two changes affect only the OSB4.
Signed-off-by: Scott Carter <ccscott@funsoft.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
2014-09-25 09:13:09 +08:00
|
|
|
static struct scsi_host_template serverworks_osb4_sht = {
|
|
|
|
ATA_BMDMA_SHT(DRV_NAME),
|
|
|
|
.sg_tablesize = LIBATA_DUMB_MAX_PRD,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct scsi_host_template serverworks_csb_sht = {
|
2008-03-25 11:22:49 +08:00
|
|
|
ATA_BMDMA_SHT(DRV_NAME),
|
2006-08-30 06:12:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct ata_port_operations serverworks_osb4_port_ops = {
|
libata: implement and use ops inheritance
libata lets low level drivers build ata_port_operations table and
register it with libata core layer. This allows low level drivers
high level of flexibility but also burdens them with lots of
boilerplate entries.
This becomes worse for drivers which support related similar
controllers which differ slightly. They share most of the operations
except for a few. However, the driver still needs to list all
operations for each variant. This results in large number of
duplicate entries, which is not only inefficient but also error-prone
as it becomes very difficult to tell what the actual differences are.
This duplicate boilerplates all over the low level drivers also make
updating the core layer exteremely difficult and error-prone. When
compounded with multi-branched development model, it ends up
accumulating inconsistencies over time. Some of those inconsistencies
cause immediate problems and fixed. Others just remain there dormant
making maintenance increasingly difficult.
To rectify the problem, this patch implements ata_port_operations
inheritance. To allow LLDs to easily re-use their own ops tables
overriding only specific methods, this patch implements poor man's
class inheritance. An ops table has ->inherits field which can be set
to any ops table as long as it doesn't create a loop. When the host
is started, the inheritance chain is followed and any operation which
isn't specified is taken from the nearest ancestor which has it
specified. This operation is called finalization and done only once
per an ops table and the LLD doesn't have to do anything special about
it other than making the ops table non-const such that libata can
update it.
libata provides four base ops tables lower drivers can inherit from -
base, sata, pmp, sff and bmdma. To avoid overriding these ops
accidentaly, these ops are declared const and LLDs should always
inherit these instead of using them directly.
After finalization, all the ops table are identical before and after
the patch except for setting .irq_handler to ata_interrupt in drivers
which didn't use to. The .irq_handler doesn't have any actual effect
and the field will soon be removed by later patch.
* sata_sx4 is still using old style EH and currently doesn't take
advantage of ops inheritance.
Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-03-25 11:22:49 +08:00
|
|
|
.inherits = &ata_bmdma_port_ops,
|
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
The Broadcom OSB4 IDE Controller (vendor and device IDs: 1166:0211)
does not support 64-KB DMA transfers.
Whenever a 64-KB DMA transfer is attempted,
the transfer fails and messages similar to the following
are written to the console log:
[ 2431.851125] sr 0:0:0:0: [sr0] Unhandled sense code
[ 2431.851139] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2431.851152] sr 0:0:0:0: [sr0] Sense Key : Hardware Error [current]
[ 2431.851166] sr 0:0:0:0: [sr0] Add. Sense: Logical unit communication time-out
[ 2431.851182] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 76 f4 00 00 40 00
[ 2431.851210] end_request: I/O error, dev sr0, sector 121808
When the libata and pata_serverworks modules
are recompiled with ATA_DEBUG and ATA_VERBOSE_DEBUG defined in libata.h,
the 64-KB transfer size in the scatter-gather list can be seen
in the console log:
[ 2664.897267] sr 9:0:0:0: [sr0] Send:
[ 2664.897274] 0xf63d85e0
[ 2664.897283] sr 9:0:0:0: [sr0] CDB:
[ 2664.897288] Read(10): 28 00 00 00 7f b4 00 00 40 00
[ 2664.897319] buffer = 0xf6d6fbc0, bufflen = 131072, queuecommand 0xf81b7700
[ 2664.897331] ata_scsi_dump_cdb: CDB (1:0,0,0) 28 00 00 00 7f b4 00 00 40
[ 2664.897338] ata_scsi_translate: ENTER
[ 2664.897345] ata_sg_setup: ENTER, ata1
[ 2664.897356] ata_sg_setup: 3 sg elements mapped
[ 2664.897364] ata_bmdma_fill_sg: PRD[0] = (0x66FD2000, 0xE000)
[ 2664.897371] ata_bmdma_fill_sg: PRD[1] = (0x65000000, 0x10000)
------------------------------------------------------> =======
[ 2664.897378] ata_bmdma_fill_sg: PRD[2] = (0x66A10000, 0x2000)
[ 2664.897386] ata1: ata_dev_select: ENTER, device 0, wait 1
[ 2664.897422] ata_sff_tf_load: feat 0x1 nsect 0x0 lba 0x0 0x0 0xFC
[ 2664.897428] ata_sff_tf_load: device 0xA0
[ 2664.897448] ata_sff_exec_command: ata1: cmd 0xA0
[ 2664.897457] ata_scsi_translate: EXIT
[ 2664.897462] leaving scsi_dispatch_cmnd()
[ 2664.897497] Doing sr request, dev = sr0, block = 0
[ 2664.897507] sr0 : reading 64/256 512 byte blocks.
[ 2664.897553] ata_sff_hsm_move: ata1: protocol 7 task_state 1 (dev_stat 0x58)
[ 2664.897560] atapi_send_cdb: send cdb
[ 2666.910058] ata_bmdma_port_intr: ata1: host_stat 0x64
[ 2666.910079] __ata_sff_port_intr: ata1: protocol 7 task_state 3
[ 2666.910093] ata_sff_hsm_move: ata1: protocol 7 task_state 3 (dev_stat 0x51)
[ 2666.910101] ata_sff_hsm_move: ata1: protocol 7 task_state 4 (dev_stat 0x51)
[ 2666.910129] sr 9:0:0:0: [sr0] Done:
[ 2666.910136] 0xf63d85e0 TIMEOUT
lspci shows that the driver used for the Broadcom OSB4 IDE Controller is
pata_serverworks:
00:0f.1 IDE interface: Broadcom OSB4 IDE Controller (prog-if 8e [Master SecP SecO PriP])
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
I/O ports at 0170 [size=8]
I/O ports at 0374 [size=4]
I/O ports at 1440 [size=16]
Kernel driver in use: pata_serverworks
The pata_serverworks driver supports five distinct device IDs,
one being the OSB4 and the other four belonging to the CSB series.
The CSB series appears to support 64-KB DMA transfers,
as tests on a machine with an SAI2 motherboard
containing a Broadcom CSB5 IDE Controller (vendor and device IDs: 1166:0212)
showed no problems with 64-KB DMA transfers.
This problem was first discovered when attempting to install openSUSE
from a DVD on a machine with an STL2 motherboard.
Using the pata_serverworks module,
older releases of openSUSE will not install at all due to the timeouts.
Releases of openSUSE prior to 11.3 can be installed by disabling
the pata_serverworks module using the brokenmodules boot parameter,
which causes the serverworks module to be used instead.
Recent releases of openSUSE (12.2 and later) include better error recovery and
will install, though very slowly.
On all openSUSE releases, the problem can be recreated
on a machine containing a Broadcom OSB4 IDE Controller
by mounting an install DVD and running a command similar to the following:
find /mnt -type f -print | xargs cat > /dev/null
The patch below corrects the problem.
Similar to the other ATA drivers that do not support 64-KB DMA transfers,
the patch changes the ata_port_operations qc_prep vector to point to a routine
that breaks any 64-KB segment into two 32-KB segments and
changes the scsi_host_template sg_tablesize element to reduce by half
the number of scatter/gather elements allowed.
These two changes affect only the OSB4.
Signed-off-by: Scott Carter <ccscott@funsoft.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
2014-09-25 09:13:09 +08:00
|
|
|
.qc_prep = ata_bmdma_dumb_qc_prep,
|
libata: implement and use ops inheritance
libata lets low level drivers build ata_port_operations table and
register it with libata core layer. This allows low level drivers
high level of flexibility but also burdens them with lots of
boilerplate entries.
This becomes worse for drivers which support related similar
controllers which differ slightly. They share most of the operations
except for a few. However, the driver still needs to list all
operations for each variant. This results in large number of
duplicate entries, which is not only inefficient but also error-prone
as it becomes very difficult to tell what the actual differences are.
This duplicate boilerplates all over the low level drivers also make
updating the core layer exteremely difficult and error-prone. When
compounded with multi-branched development model, it ends up
accumulating inconsistencies over time. Some of those inconsistencies
cause immediate problems and fixed. Others just remain there dormant
making maintenance increasingly difficult.
To rectify the problem, this patch implements ata_port_operations
inheritance. To allow LLDs to easily re-use their own ops tables
overriding only specific methods, this patch implements poor man's
class inheritance. An ops table has ->inherits field which can be set
to any ops table as long as it doesn't create a loop. When the host
is started, the inheritance chain is followed and any operation which
isn't specified is taken from the nearest ancestor which has it
specified. This operation is called finalization and done only once
per an ops table and the LLD doesn't have to do anything special about
it other than making the ops table non-const such that libata can
update it.
libata provides four base ops tables lower drivers can inherit from -
base, sata, pmp, sff and bmdma. To avoid overriding these ops
accidentaly, these ops are declared const and LLDs should always
inherit these instead of using them directly.
After finalization, all the ops table are identical before and after
the patch except for setting .irq_handler to ata_interrupt in drivers
which didn't use to. The .irq_handler doesn't have any actual effect
and the field will soon be removed by later patch.
* sata_sx4 is still using old style EH and currently doesn't take
advantage of ops inheritance.
Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-03-25 11:22:49 +08:00
|
|
|
.cable_detect = serverworks_cable_detect,
|
|
|
|
.mode_filter = serverworks_osb4_filter,
|
2006-08-30 06:12:40 +08:00
|
|
|
.set_piomode = serverworks_set_piomode,
|
|
|
|
.set_dmamode = serverworks_set_dmamode,
|
2006-08-31 12:03:49 +08:00
|
|
|
};
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
static struct ata_port_operations serverworks_csb_port_ops = {
|
libata: implement and use ops inheritance
libata lets low level drivers build ata_port_operations table and
register it with libata core layer. This allows low level drivers
high level of flexibility but also burdens them with lots of
boilerplate entries.
This becomes worse for drivers which support related similar
controllers which differ slightly. They share most of the operations
except for a few. However, the driver still needs to list all
operations for each variant. This results in large number of
duplicate entries, which is not only inefficient but also error-prone
as it becomes very difficult to tell what the actual differences are.
This duplicate boilerplates all over the low level drivers also make
updating the core layer exteremely difficult and error-prone. When
compounded with multi-branched development model, it ends up
accumulating inconsistencies over time. Some of those inconsistencies
cause immediate problems and fixed. Others just remain there dormant
making maintenance increasingly difficult.
To rectify the problem, this patch implements ata_port_operations
inheritance. To allow LLDs to easily re-use their own ops tables
overriding only specific methods, this patch implements poor man's
class inheritance. An ops table has ->inherits field which can be set
to any ops table as long as it doesn't create a loop. When the host
is started, the inheritance chain is followed and any operation which
isn't specified is taken from the nearest ancestor which has it
specified. This operation is called finalization and done only once
per an ops table and the LLD doesn't have to do anything special about
it other than making the ops table non-const such that libata can
update it.
libata provides four base ops tables lower drivers can inherit from -
base, sata, pmp, sff and bmdma. To avoid overriding these ops
accidentaly, these ops are declared const and LLDs should always
inherit these instead of using them directly.
After finalization, all the ops table are identical before and after
the patch except for setting .irq_handler to ata_interrupt in drivers
which didn't use to. The .irq_handler doesn't have any actual effect
and the field will soon be removed by later patch.
* sata_sx4 is still using old style EH and currently doesn't take
advantage of ops inheritance.
Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-03-25 11:22:49 +08:00
|
|
|
.inherits = &serverworks_osb4_port_ops,
|
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
The Broadcom OSB4 IDE Controller (vendor and device IDs: 1166:0211)
does not support 64-KB DMA transfers.
Whenever a 64-KB DMA transfer is attempted,
the transfer fails and messages similar to the following
are written to the console log:
[ 2431.851125] sr 0:0:0:0: [sr0] Unhandled sense code
[ 2431.851139] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2431.851152] sr 0:0:0:0: [sr0] Sense Key : Hardware Error [current]
[ 2431.851166] sr 0:0:0:0: [sr0] Add. Sense: Logical unit communication time-out
[ 2431.851182] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 76 f4 00 00 40 00
[ 2431.851210] end_request: I/O error, dev sr0, sector 121808
When the libata and pata_serverworks modules
are recompiled with ATA_DEBUG and ATA_VERBOSE_DEBUG defined in libata.h,
the 64-KB transfer size in the scatter-gather list can be seen
in the console log:
[ 2664.897267] sr 9:0:0:0: [sr0] Send:
[ 2664.897274] 0xf63d85e0
[ 2664.897283] sr 9:0:0:0: [sr0] CDB:
[ 2664.897288] Read(10): 28 00 00 00 7f b4 00 00 40 00
[ 2664.897319] buffer = 0xf6d6fbc0, bufflen = 131072, queuecommand 0xf81b7700
[ 2664.897331] ata_scsi_dump_cdb: CDB (1:0,0,0) 28 00 00 00 7f b4 00 00 40
[ 2664.897338] ata_scsi_translate: ENTER
[ 2664.897345] ata_sg_setup: ENTER, ata1
[ 2664.897356] ata_sg_setup: 3 sg elements mapped
[ 2664.897364] ata_bmdma_fill_sg: PRD[0] = (0x66FD2000, 0xE000)
[ 2664.897371] ata_bmdma_fill_sg: PRD[1] = (0x65000000, 0x10000)
------------------------------------------------------> =======
[ 2664.897378] ata_bmdma_fill_sg: PRD[2] = (0x66A10000, 0x2000)
[ 2664.897386] ata1: ata_dev_select: ENTER, device 0, wait 1
[ 2664.897422] ata_sff_tf_load: feat 0x1 nsect 0x0 lba 0x0 0x0 0xFC
[ 2664.897428] ata_sff_tf_load: device 0xA0
[ 2664.897448] ata_sff_exec_command: ata1: cmd 0xA0
[ 2664.897457] ata_scsi_translate: EXIT
[ 2664.897462] leaving scsi_dispatch_cmnd()
[ 2664.897497] Doing sr request, dev = sr0, block = 0
[ 2664.897507] sr0 : reading 64/256 512 byte blocks.
[ 2664.897553] ata_sff_hsm_move: ata1: protocol 7 task_state 1 (dev_stat 0x58)
[ 2664.897560] atapi_send_cdb: send cdb
[ 2666.910058] ata_bmdma_port_intr: ata1: host_stat 0x64
[ 2666.910079] __ata_sff_port_intr: ata1: protocol 7 task_state 3
[ 2666.910093] ata_sff_hsm_move: ata1: protocol 7 task_state 3 (dev_stat 0x51)
[ 2666.910101] ata_sff_hsm_move: ata1: protocol 7 task_state 4 (dev_stat 0x51)
[ 2666.910129] sr 9:0:0:0: [sr0] Done:
[ 2666.910136] 0xf63d85e0 TIMEOUT
lspci shows that the driver used for the Broadcom OSB4 IDE Controller is
pata_serverworks:
00:0f.1 IDE interface: Broadcom OSB4 IDE Controller (prog-if 8e [Master SecP SecO PriP])
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
I/O ports at 0170 [size=8]
I/O ports at 0374 [size=4]
I/O ports at 1440 [size=16]
Kernel driver in use: pata_serverworks
The pata_serverworks driver supports five distinct device IDs,
one being the OSB4 and the other four belonging to the CSB series.
The CSB series appears to support 64-KB DMA transfers,
as tests on a machine with an SAI2 motherboard
containing a Broadcom CSB5 IDE Controller (vendor and device IDs: 1166:0212)
showed no problems with 64-KB DMA transfers.
This problem was first discovered when attempting to install openSUSE
from a DVD on a machine with an STL2 motherboard.
Using the pata_serverworks module,
older releases of openSUSE will not install at all due to the timeouts.
Releases of openSUSE prior to 11.3 can be installed by disabling
the pata_serverworks module using the brokenmodules boot parameter,
which causes the serverworks module to be used instead.
Recent releases of openSUSE (12.2 and later) include better error recovery and
will install, though very slowly.
On all openSUSE releases, the problem can be recreated
on a machine containing a Broadcom OSB4 IDE Controller
by mounting an install DVD and running a command similar to the following:
find /mnt -type f -print | xargs cat > /dev/null
The patch below corrects the problem.
Similar to the other ATA drivers that do not support 64-KB DMA transfers,
the patch changes the ata_port_operations qc_prep vector to point to a routine
that breaks any 64-KB segment into two 32-KB segments and
changes the scsi_host_template sg_tablesize element to reduce by half
the number of scatter/gather elements allowed.
These two changes affect only the OSB4.
Signed-off-by: Scott Carter <ccscott@funsoft.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
2014-09-25 09:13:09 +08:00
|
|
|
.qc_prep = ata_bmdma_qc_prep,
|
2006-08-30 06:12:40 +08:00
|
|
|
.mode_filter = serverworks_csb_filter,
|
2006-08-31 12:03:49 +08:00
|
|
|
};
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
static int serverworks_fixup_osb4(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
u32 reg;
|
|
|
|
struct pci_dev *isa_dev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
|
|
|
|
PCI_DEVICE_ID_SERVERWORKS_OSB4, NULL);
|
|
|
|
if (isa_dev) {
|
|
|
|
pci_read_config_dword(isa_dev, 0x64, ®);
|
|
|
|
reg &= ~0x00002000; /* disable 600ns interrupt mask */
|
|
|
|
if (!(reg & 0x00004000))
|
|
|
|
printk(KERN_DEBUG DRV_NAME ": UDMA not BIOS enabled.\n");
|
|
|
|
reg |= 0x00004000; /* enable UDMA/33 support */
|
|
|
|
pci_write_config_dword(isa_dev, 0x64, reg);
|
|
|
|
pci_dev_put(isa_dev);
|
|
|
|
return 0;
|
|
|
|
}
|
2010-01-19 01:16:46 +08:00
|
|
|
printk(KERN_WARNING DRV_NAME ": Unable to find bridge.\n");
|
2006-08-30 06:12:40 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int serverworks_fixup_csb(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
u8 btr;
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2006-08-30 06:12:40 +08:00
|
|
|
/* Third Channel Test */
|
|
|
|
if (!(PCI_FUNC(pdev->devfn) & 1)) {
|
|
|
|
struct pci_dev * findev = NULL;
|
|
|
|
u32 reg4c = 0;
|
|
|
|
findev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
|
|
|
|
PCI_DEVICE_ID_SERVERWORKS_CSB5, NULL);
|
|
|
|
if (findev) {
|
|
|
|
pci_read_config_dword(findev, 0x4C, ®4c);
|
|
|
|
reg4c &= ~0x000007FF;
|
|
|
|
reg4c |= 0x00000040;
|
|
|
|
reg4c |= 0x00000020;
|
|
|
|
pci_write_config_dword(findev, 0x4C, reg4c);
|
|
|
|
pci_dev_put(findev);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
struct pci_dev * findev = NULL;
|
|
|
|
u8 reg41 = 0;
|
|
|
|
|
|
|
|
findev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
|
|
|
|
PCI_DEVICE_ID_SERVERWORKS_CSB6, NULL);
|
|
|
|
if (findev) {
|
|
|
|
pci_read_config_byte(findev, 0x41, ®41);
|
|
|
|
reg41 &= ~0x40;
|
|
|
|
pci_write_config_byte(findev, 0x41, reg41);
|
|
|
|
pci_dev_put(findev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* setup the UDMA Control register
|
|
|
|
*
|
|
|
|
* 1. clear bit 6 to enable DMA
|
|
|
|
* 2. enable DMA modes with bits 0-1
|
|
|
|
* 00 : legacy
|
|
|
|
* 01 : udma2
|
|
|
|
* 10 : udma2/udma4
|
|
|
|
* 11 : udma2/udma4/udma5
|
|
|
|
*/
|
|
|
|
pci_read_config_byte(pdev, 0x5A, &btr);
|
|
|
|
btr &= ~0x40;
|
|
|
|
if (!(PCI_FUNC(pdev->devfn) & 1))
|
|
|
|
btr |= 0x2;
|
|
|
|
else
|
2007-06-09 06:46:36 +08:00
|
|
|
btr |= (pdev->revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
|
2006-08-30 06:12:40 +08:00
|
|
|
pci_write_config_byte(pdev, 0x5A, btr);
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2006-08-30 06:12:40 +08:00
|
|
|
return btr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void serverworks_fixup_ht1000(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
u8 btr;
|
|
|
|
/* Setup HT1000 SouthBridge Controller - Single Channel Only */
|
|
|
|
pci_read_config_byte(pdev, 0x5A, &btr);
|
|
|
|
btr &= ~0x40;
|
|
|
|
btr |= 0x3;
|
|
|
|
pci_write_config_byte(pdev, 0x5A, btr);
|
|
|
|
}
|
|
|
|
|
2011-10-12 02:13:53 +08:00
|
|
|
static int serverworks_fixup(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
/* Force master latency timer to 64 PCI clocks */
|
|
|
|
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
|
|
|
|
|
|
|
|
switch (pdev->device) {
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE:
|
|
|
|
rc = serverworks_fixup_osb4(pdev);
|
|
|
|
break;
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
|
|
|
|
ata_pci_bmdma_clear_simplex(pdev);
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2011-10-12 02:13:53 +08:00
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE:
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2:
|
|
|
|
rc = serverworks_fixup_csb(pdev);
|
|
|
|
break;
|
|
|
|
case PCI_DEVICE_ID_SERVERWORKS_HT1000IDE:
|
|
|
|
serverworks_fixup_ht1000(pdev);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
|
|
|
{
|
2007-05-04 18:43:58 +08:00
|
|
|
static const struct ata_port_info info[4] = {
|
2006-08-30 06:12:40 +08:00
|
|
|
{ /* OSB4 */
|
2007-05-28 18:59:48 +08:00
|
|
|
.flags = ATA_FLAG_SLAVE_POSS,
|
2009-03-15 04:38:24 +08:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
|
|
|
.udma_mask = ATA_UDMA2,
|
2006-08-30 06:12:40 +08:00
|
|
|
.port_ops = &serverworks_osb4_port_ops
|
|
|
|
}, { /* OSB4 no UDMA */
|
2007-05-28 18:59:48 +08:00
|
|
|
.flags = ATA_FLAG_SLAVE_POSS,
|
2009-03-15 04:38:24 +08:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
|
|
|
/* No UDMA */
|
2006-08-30 06:12:40 +08:00
|
|
|
.port_ops = &serverworks_osb4_port_ops
|
|
|
|
}, { /* CSB5 */
|
2007-05-28 18:59:48 +08:00
|
|
|
.flags = ATA_FLAG_SLAVE_POSS,
|
2009-03-15 04:38:24 +08:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
2007-07-10 00:16:50 +08:00
|
|
|
.udma_mask = ATA_UDMA4,
|
2006-08-30 06:12:40 +08:00
|
|
|
.port_ops = &serverworks_csb_port_ops
|
|
|
|
}, { /* CSB5 - later revisions*/
|
2007-05-28 18:59:48 +08:00
|
|
|
.flags = ATA_FLAG_SLAVE_POSS,
|
2009-03-15 04:38:24 +08:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
2007-07-10 00:16:50 +08:00
|
|
|
.udma_mask = ATA_UDMA5,
|
2006-08-30 06:12:40 +08:00
|
|
|
.port_ops = &serverworks_csb_port_ops
|
|
|
|
}
|
|
|
|
};
|
2007-05-04 18:43:58 +08:00
|
|
|
const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL };
|
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
The Broadcom OSB4 IDE Controller (vendor and device IDs: 1166:0211)
does not support 64-KB DMA transfers.
Whenever a 64-KB DMA transfer is attempted,
the transfer fails and messages similar to the following
are written to the console log:
[ 2431.851125] sr 0:0:0:0: [sr0] Unhandled sense code
[ 2431.851139] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2431.851152] sr 0:0:0:0: [sr0] Sense Key : Hardware Error [current]
[ 2431.851166] sr 0:0:0:0: [sr0] Add. Sense: Logical unit communication time-out
[ 2431.851182] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 76 f4 00 00 40 00
[ 2431.851210] end_request: I/O error, dev sr0, sector 121808
When the libata and pata_serverworks modules
are recompiled with ATA_DEBUG and ATA_VERBOSE_DEBUG defined in libata.h,
the 64-KB transfer size in the scatter-gather list can be seen
in the console log:
[ 2664.897267] sr 9:0:0:0: [sr0] Send:
[ 2664.897274] 0xf63d85e0
[ 2664.897283] sr 9:0:0:0: [sr0] CDB:
[ 2664.897288] Read(10): 28 00 00 00 7f b4 00 00 40 00
[ 2664.897319] buffer = 0xf6d6fbc0, bufflen = 131072, queuecommand 0xf81b7700
[ 2664.897331] ata_scsi_dump_cdb: CDB (1:0,0,0) 28 00 00 00 7f b4 00 00 40
[ 2664.897338] ata_scsi_translate: ENTER
[ 2664.897345] ata_sg_setup: ENTER, ata1
[ 2664.897356] ata_sg_setup: 3 sg elements mapped
[ 2664.897364] ata_bmdma_fill_sg: PRD[0] = (0x66FD2000, 0xE000)
[ 2664.897371] ata_bmdma_fill_sg: PRD[1] = (0x65000000, 0x10000)
------------------------------------------------------> =======
[ 2664.897378] ata_bmdma_fill_sg: PRD[2] = (0x66A10000, 0x2000)
[ 2664.897386] ata1: ata_dev_select: ENTER, device 0, wait 1
[ 2664.897422] ata_sff_tf_load: feat 0x1 nsect 0x0 lba 0x0 0x0 0xFC
[ 2664.897428] ata_sff_tf_load: device 0xA0
[ 2664.897448] ata_sff_exec_command: ata1: cmd 0xA0
[ 2664.897457] ata_scsi_translate: EXIT
[ 2664.897462] leaving scsi_dispatch_cmnd()
[ 2664.897497] Doing sr request, dev = sr0, block = 0
[ 2664.897507] sr0 : reading 64/256 512 byte blocks.
[ 2664.897553] ata_sff_hsm_move: ata1: protocol 7 task_state 1 (dev_stat 0x58)
[ 2664.897560] atapi_send_cdb: send cdb
[ 2666.910058] ata_bmdma_port_intr: ata1: host_stat 0x64
[ 2666.910079] __ata_sff_port_intr: ata1: protocol 7 task_state 3
[ 2666.910093] ata_sff_hsm_move: ata1: protocol 7 task_state 3 (dev_stat 0x51)
[ 2666.910101] ata_sff_hsm_move: ata1: protocol 7 task_state 4 (dev_stat 0x51)
[ 2666.910129] sr 9:0:0:0: [sr0] Done:
[ 2666.910136] 0xf63d85e0 TIMEOUT
lspci shows that the driver used for the Broadcom OSB4 IDE Controller is
pata_serverworks:
00:0f.1 IDE interface: Broadcom OSB4 IDE Controller (prog-if 8e [Master SecP SecO PriP])
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
I/O ports at 0170 [size=8]
I/O ports at 0374 [size=4]
I/O ports at 1440 [size=16]
Kernel driver in use: pata_serverworks
The pata_serverworks driver supports five distinct device IDs,
one being the OSB4 and the other four belonging to the CSB series.
The CSB series appears to support 64-KB DMA transfers,
as tests on a machine with an SAI2 motherboard
containing a Broadcom CSB5 IDE Controller (vendor and device IDs: 1166:0212)
showed no problems with 64-KB DMA transfers.
This problem was first discovered when attempting to install openSUSE
from a DVD on a machine with an STL2 motherboard.
Using the pata_serverworks module,
older releases of openSUSE will not install at all due to the timeouts.
Releases of openSUSE prior to 11.3 can be installed by disabling
the pata_serverworks module using the brokenmodules boot parameter,
which causes the serverworks module to be used instead.
Recent releases of openSUSE (12.2 and later) include better error recovery and
will install, though very slowly.
On all openSUSE releases, the problem can be recreated
on a machine containing a Broadcom OSB4 IDE Controller
by mounting an install DVD and running a command similar to the following:
find /mnt -type f -print | xargs cat > /dev/null
The patch below corrects the problem.
Similar to the other ATA drivers that do not support 64-KB DMA transfers,
the patch changes the ata_port_operations qc_prep vector to point to a routine
that breaks any 64-KB segment into two 32-KB segments and
changes the scsi_host_template sg_tablesize element to reduce by half
the number of scatter/gather elements allowed.
These two changes affect only the OSB4.
Signed-off-by: Scott Carter <ccscott@funsoft.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
2014-09-25 09:13:09 +08:00
|
|
|
struct scsi_host_template *sht = &serverworks_csb_sht;
|
2008-03-25 11:22:47 +08:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = pcim_enable_device(pdev);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2011-10-12 02:13:53 +08:00
|
|
|
rc = serverworks_fixup(pdev);
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
/* OSB4 : South Bridge and IDE */
|
|
|
|
if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
|
|
|
|
/* Select non UDMA capable OSB4 if we can't do fixups */
|
2011-10-12 02:13:53 +08:00
|
|
|
if (rc < 0)
|
2007-05-04 18:43:58 +08:00
|
|
|
ppi[0] = &info[1];
|
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
The Broadcom OSB4 IDE Controller (vendor and device IDs: 1166:0211)
does not support 64-KB DMA transfers.
Whenever a 64-KB DMA transfer is attempted,
the transfer fails and messages similar to the following
are written to the console log:
[ 2431.851125] sr 0:0:0:0: [sr0] Unhandled sense code
[ 2431.851139] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2431.851152] sr 0:0:0:0: [sr0] Sense Key : Hardware Error [current]
[ 2431.851166] sr 0:0:0:0: [sr0] Add. Sense: Logical unit communication time-out
[ 2431.851182] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 76 f4 00 00 40 00
[ 2431.851210] end_request: I/O error, dev sr0, sector 121808
When the libata and pata_serverworks modules
are recompiled with ATA_DEBUG and ATA_VERBOSE_DEBUG defined in libata.h,
the 64-KB transfer size in the scatter-gather list can be seen
in the console log:
[ 2664.897267] sr 9:0:0:0: [sr0] Send:
[ 2664.897274] 0xf63d85e0
[ 2664.897283] sr 9:0:0:0: [sr0] CDB:
[ 2664.897288] Read(10): 28 00 00 00 7f b4 00 00 40 00
[ 2664.897319] buffer = 0xf6d6fbc0, bufflen = 131072, queuecommand 0xf81b7700
[ 2664.897331] ata_scsi_dump_cdb: CDB (1:0,0,0) 28 00 00 00 7f b4 00 00 40
[ 2664.897338] ata_scsi_translate: ENTER
[ 2664.897345] ata_sg_setup: ENTER, ata1
[ 2664.897356] ata_sg_setup: 3 sg elements mapped
[ 2664.897364] ata_bmdma_fill_sg: PRD[0] = (0x66FD2000, 0xE000)
[ 2664.897371] ata_bmdma_fill_sg: PRD[1] = (0x65000000, 0x10000)
------------------------------------------------------> =======
[ 2664.897378] ata_bmdma_fill_sg: PRD[2] = (0x66A10000, 0x2000)
[ 2664.897386] ata1: ata_dev_select: ENTER, device 0, wait 1
[ 2664.897422] ata_sff_tf_load: feat 0x1 nsect 0x0 lba 0x0 0x0 0xFC
[ 2664.897428] ata_sff_tf_load: device 0xA0
[ 2664.897448] ata_sff_exec_command: ata1: cmd 0xA0
[ 2664.897457] ata_scsi_translate: EXIT
[ 2664.897462] leaving scsi_dispatch_cmnd()
[ 2664.897497] Doing sr request, dev = sr0, block = 0
[ 2664.897507] sr0 : reading 64/256 512 byte blocks.
[ 2664.897553] ata_sff_hsm_move: ata1: protocol 7 task_state 1 (dev_stat 0x58)
[ 2664.897560] atapi_send_cdb: send cdb
[ 2666.910058] ata_bmdma_port_intr: ata1: host_stat 0x64
[ 2666.910079] __ata_sff_port_intr: ata1: protocol 7 task_state 3
[ 2666.910093] ata_sff_hsm_move: ata1: protocol 7 task_state 3 (dev_stat 0x51)
[ 2666.910101] ata_sff_hsm_move: ata1: protocol 7 task_state 4 (dev_stat 0x51)
[ 2666.910129] sr 9:0:0:0: [sr0] Done:
[ 2666.910136] 0xf63d85e0 TIMEOUT
lspci shows that the driver used for the Broadcom OSB4 IDE Controller is
pata_serverworks:
00:0f.1 IDE interface: Broadcom OSB4 IDE Controller (prog-if 8e [Master SecP SecO PriP])
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
I/O ports at 0170 [size=8]
I/O ports at 0374 [size=4]
I/O ports at 1440 [size=16]
Kernel driver in use: pata_serverworks
The pata_serverworks driver supports five distinct device IDs,
one being the OSB4 and the other four belonging to the CSB series.
The CSB series appears to support 64-KB DMA transfers,
as tests on a machine with an SAI2 motherboard
containing a Broadcom CSB5 IDE Controller (vendor and device IDs: 1166:0212)
showed no problems with 64-KB DMA transfers.
This problem was first discovered when attempting to install openSUSE
from a DVD on a machine with an STL2 motherboard.
Using the pata_serverworks module,
older releases of openSUSE will not install at all due to the timeouts.
Releases of openSUSE prior to 11.3 can be installed by disabling
the pata_serverworks module using the brokenmodules boot parameter,
which causes the serverworks module to be used instead.
Recent releases of openSUSE (12.2 and later) include better error recovery and
will install, though very slowly.
On all openSUSE releases, the problem can be recreated
on a machine containing a Broadcom OSB4 IDE Controller
by mounting an install DVD and running a command similar to the following:
find /mnt -type f -print | xargs cat > /dev/null
The patch below corrects the problem.
Similar to the other ATA drivers that do not support 64-KB DMA transfers,
the patch changes the ata_port_operations qc_prep vector to point to a routine
that breaks any 64-KB segment into two 32-KB segments and
changes the scsi_host_template sg_tablesize element to reduce by half
the number of scatter/gather elements allowed.
These two changes affect only the OSB4.
Signed-off-by: Scott Carter <ccscott@funsoft.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
2014-09-25 09:13:09 +08:00
|
|
|
sht = &serverworks_osb4_sht;
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
|
|
|
/* setup CSB5/CSB6 : South Bridge and IDE option RAID */
|
|
|
|
else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ||
|
|
|
|
(pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
|
|
|
|
(pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2006-08-30 06:12:40 +08:00
|
|
|
/* If the returned btr is the newer revision then
|
|
|
|
select the right info block */
|
2011-10-12 02:13:53 +08:00
|
|
|
if (rc == 3)
|
2007-05-04 18:43:58 +08:00
|
|
|
ppi[0] = &info[3];
|
2006-08-31 12:03:49 +08:00
|
|
|
|
2006-08-30 06:12:40 +08:00
|
|
|
/* Is this the 3rd channel CSB6 IDE ? */
|
|
|
|
if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)
|
2007-05-04 18:43:58 +08:00
|
|
|
ppi[1] = &ata_dummy_port_info;
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
2006-08-31 12:03:49 +08:00
|
|
|
|
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
The Broadcom OSB4 IDE Controller (vendor and device IDs: 1166:0211)
does not support 64-KB DMA transfers.
Whenever a 64-KB DMA transfer is attempted,
the transfer fails and messages similar to the following
are written to the console log:
[ 2431.851125] sr 0:0:0:0: [sr0] Unhandled sense code
[ 2431.851139] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2431.851152] sr 0:0:0:0: [sr0] Sense Key : Hardware Error [current]
[ 2431.851166] sr 0:0:0:0: [sr0] Add. Sense: Logical unit communication time-out
[ 2431.851182] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 76 f4 00 00 40 00
[ 2431.851210] end_request: I/O error, dev sr0, sector 121808
When the libata and pata_serverworks modules
are recompiled with ATA_DEBUG and ATA_VERBOSE_DEBUG defined in libata.h,
the 64-KB transfer size in the scatter-gather list can be seen
in the console log:
[ 2664.897267] sr 9:0:0:0: [sr0] Send:
[ 2664.897274] 0xf63d85e0
[ 2664.897283] sr 9:0:0:0: [sr0] CDB:
[ 2664.897288] Read(10): 28 00 00 00 7f b4 00 00 40 00
[ 2664.897319] buffer = 0xf6d6fbc0, bufflen = 131072, queuecommand 0xf81b7700
[ 2664.897331] ata_scsi_dump_cdb: CDB (1:0,0,0) 28 00 00 00 7f b4 00 00 40
[ 2664.897338] ata_scsi_translate: ENTER
[ 2664.897345] ata_sg_setup: ENTER, ata1
[ 2664.897356] ata_sg_setup: 3 sg elements mapped
[ 2664.897364] ata_bmdma_fill_sg: PRD[0] = (0x66FD2000, 0xE000)
[ 2664.897371] ata_bmdma_fill_sg: PRD[1] = (0x65000000, 0x10000)
------------------------------------------------------> =======
[ 2664.897378] ata_bmdma_fill_sg: PRD[2] = (0x66A10000, 0x2000)
[ 2664.897386] ata1: ata_dev_select: ENTER, device 0, wait 1
[ 2664.897422] ata_sff_tf_load: feat 0x1 nsect 0x0 lba 0x0 0x0 0xFC
[ 2664.897428] ata_sff_tf_load: device 0xA0
[ 2664.897448] ata_sff_exec_command: ata1: cmd 0xA0
[ 2664.897457] ata_scsi_translate: EXIT
[ 2664.897462] leaving scsi_dispatch_cmnd()
[ 2664.897497] Doing sr request, dev = sr0, block = 0
[ 2664.897507] sr0 : reading 64/256 512 byte blocks.
[ 2664.897553] ata_sff_hsm_move: ata1: protocol 7 task_state 1 (dev_stat 0x58)
[ 2664.897560] atapi_send_cdb: send cdb
[ 2666.910058] ata_bmdma_port_intr: ata1: host_stat 0x64
[ 2666.910079] __ata_sff_port_intr: ata1: protocol 7 task_state 3
[ 2666.910093] ata_sff_hsm_move: ata1: protocol 7 task_state 3 (dev_stat 0x51)
[ 2666.910101] ata_sff_hsm_move: ata1: protocol 7 task_state 4 (dev_stat 0x51)
[ 2666.910129] sr 9:0:0:0: [sr0] Done:
[ 2666.910136] 0xf63d85e0 TIMEOUT
lspci shows that the driver used for the Broadcom OSB4 IDE Controller is
pata_serverworks:
00:0f.1 IDE interface: Broadcom OSB4 IDE Controller (prog-if 8e [Master SecP SecO PriP])
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
I/O ports at 0170 [size=8]
I/O ports at 0374 [size=4]
I/O ports at 1440 [size=16]
Kernel driver in use: pata_serverworks
The pata_serverworks driver supports five distinct device IDs,
one being the OSB4 and the other four belonging to the CSB series.
The CSB series appears to support 64-KB DMA transfers,
as tests on a machine with an SAI2 motherboard
containing a Broadcom CSB5 IDE Controller (vendor and device IDs: 1166:0212)
showed no problems with 64-KB DMA transfers.
This problem was first discovered when attempting to install openSUSE
from a DVD on a machine with an STL2 motherboard.
Using the pata_serverworks module,
older releases of openSUSE will not install at all due to the timeouts.
Releases of openSUSE prior to 11.3 can be installed by disabling
the pata_serverworks module using the brokenmodules boot parameter,
which causes the serverworks module to be used instead.
Recent releases of openSUSE (12.2 and later) include better error recovery and
will install, though very slowly.
On all openSUSE releases, the problem can be recreated
on a machine containing a Broadcom OSB4 IDE Controller
by mounting an install DVD and running a command similar to the following:
find /mnt -type f -print | xargs cat > /dev/null
The patch below corrects the problem.
Similar to the other ATA drivers that do not support 64-KB DMA transfers,
the patch changes the ata_port_operations qc_prep vector to point to a routine
that breaks any 64-KB segment into two 32-KB segments and
changes the scsi_host_template sg_tablesize element to reduce by half
the number of scatter/gather elements allowed.
These two changes affect only the OSB4.
Signed-off-by: Scott Carter <ccscott@funsoft.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
2014-09-25 09:13:09 +08:00
|
|
|
return ata_pci_bmdma_init_one(pdev, ppi, sht, NULL, 0);
|
2006-08-30 06:12:40 +08:00
|
|
|
}
|
|
|
|
|
2014-05-07 23:17:44 +08:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2006-11-28 00:16:35 +08:00
|
|
|
static int serverworks_reinit_one(struct pci_dev *pdev)
|
|
|
|
{
|
2013-06-03 13:05:36 +08:00
|
|
|
struct ata_host *host = pci_get_drvdata(pdev);
|
2008-03-25 11:22:47 +08:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = ata_pci_device_do_resume(pdev);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
|
2011-10-12 02:13:53 +08:00
|
|
|
(void)serverworks_fixup(pdev);
|
2008-03-25 11:22:47 +08:00
|
|
|
|
|
|
|
ata_host_resume(host);
|
|
|
|
return 0;
|
2006-11-28 00:16:35 +08:00
|
|
|
}
|
2007-03-02 16:31:26 +08:00
|
|
|
#endif
|
2006-11-28 00:16:35 +08:00
|
|
|
|
2006-09-29 08:21:59 +08:00
|
|
|
static const struct pci_device_id serverworks[] = {
|
|
|
|
{ PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0},
|
|
|
|
{ PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 2},
|
|
|
|
{ PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2},
|
|
|
|
{ PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 2},
|
|
|
|
{ PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 2},
|
|
|
|
|
|
|
|
{ },
|
2006-08-30 06:12:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct pci_driver serverworks_pci_driver = {
|
|
|
|
.name = DRV_NAME,
|
|
|
|
.id_table = serverworks,
|
|
|
|
.probe = serverworks_init_one,
|
2006-11-28 00:16:35 +08:00
|
|
|
.remove = ata_pci_remove_one,
|
2014-05-07 23:17:44 +08:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2006-11-28 00:16:35 +08:00
|
|
|
.suspend = ata_pci_device_suspend,
|
|
|
|
.resume = serverworks_reinit_one,
|
2007-03-02 16:31:26 +08:00
|
|
|
#endif
|
2006-08-30 06:12:40 +08:00
|
|
|
};
|
|
|
|
|
2012-04-19 13:43:05 +08:00
|
|
|
module_pci_driver(serverworks_pci_driver);
|
2006-08-30 06:12:40 +08:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Alan Cox");
|
|
|
|
MODULE_DESCRIPTION("low-level driver for Serverworks OSB4/CSB5/CSB6");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DEVICE_TABLE(pci, serverworks);
|
|
|
|
MODULE_VERSION(DRV_VERSION);
|