# Odd hardware - PCI Device not showing up in lspci or scanpci

## msalerno

For starters, I am running an Intel ss4200 nas.  It's basically a headless completer with intel guts.  I have a PATA 4gb DOM for booting and 2 SATA drives (room for 4) plugged in.  In the BIOS for the disk controller config, there are 2 options, enchanced or Compatible.  If I choose compatible, I can only see 4 disks, with my DOM being the first (sda w/ DMA): DOM + 3 SATA.  If I choose enchanced, I can see only the SATA disks, and if I load the legacy ide drivers, the dom comes up as hda no DMA.  The third option is to boot this device into recovery mode with a button combo.  In recovery mode, I see all 4 SATA and the DOM w/ DMA last - sdc

Here's the difference:

When I boot into recovery mode, I see the following:

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)

00:1f.2 SATA controller: Intel Corporation 82801GR/GH (ICH7 Family) SATA AHCI Controller (rev 01)

/sys/bus/scsi/devices - 4:0:0:0 is the PATA DOM /dev/sdc w/ DMA 

0:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0

3:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0

4:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0

When I boot into compatible mode, I see the following:

Grub can only see my DOM and 1 sata (tested with the geometry command)

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)

/sys/bus/scsi/devices - 0:0:0:0 is the PATA DOM /dev/sdc w/ DMA also missing a SATA drive.

0:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0

1:0:1:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:1/1:0:1:0

When I boot into enhanced mode, I see the following:

My DOM doesn't exist without the legacy IDE drivers.

Grub can see my DOM and all sata disks (tested with the geometry command)

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.2 SATA controller: Intel Corporation N10/ICH7 Family SATA AHCI Controller (rev 01)

1:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0

5:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host5/target5:0:0/5:0:0:0

In Enhanced mode, I can get to GRUB and start booting, but then I get the VFS error, as if it cannot see my DOM.

I'm still working on pulling all of the stats from the enhanced mode, I need to reload my USB with a recovery that includes legacy IDE modules, I'll get it posted tomorrow.

Ultimately, the goal is to boot from the DOM with DMA and see all 4 SATA disks.  I have tried booting with pci=nobios, but it does not make a difference.  Does anyone have any other ideas?  Is it possible to provide the kernel with the device options at boot time?  I'm not sure what else to try.

Thanks

----------

## roarinelk

I'd say this is either a BIOS bug or a "feature".   The BIOS can hide certain

functions of a chipset from a PCI scan (in your case the 1f.1 IDE ctrl),

and it looks like that only in recovery mode all disk interface controllers

are actually made discoverable.

----------

## msalerno

Agrreed, so is there a way to tell the kernel about the device?  Grub has no problem seeing it.

----------

## roarinelk

Grub "sees" it because it uses BIOS calls to access it.

Unless the controller shows up as a PCI device, linux won't access it.

The controller can probably be revealed the same way the hidden SMBus device on

ASUS motherboards is.

----------

## roarinelk

could you please post outputs of "lspci" and "lspci -n" ?

I've made a kernelpatch against 2.6.34-rc3 which should theoretically

enable the hidden ide controller, but I need to know some PCI ids

of your system.

----------

## roarinelk

try this very hacky patch (on latest -git)  In theory it should work, usual disclaimers apply.

```

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c

index 477345d..b70b891 100644

--- a/drivers/pci/quirks.c

+++ b/drivers/pci/quirks.c

@@ -2842,3 +2842,53 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)

 

    return -ENOTTY;

 }

+

+

+/* XXX: hack to enable the PATA device on ICH7 */

+static void __iomem *xybrd_rcba_base;

+static void xybrd_hides_ide_lpc_ich7_suspend(struct pci_dev *dev)

+{

+   u32 rcba;

+

+   if (xybrd_rcba_base) {

+      printk(KERN_ALERT "WARNING: more than one ICH7 PATA!\n");

+      return;

+   }

+

+   pci_read_config_dword(dev, 0xF0, &rcba);

+   /* use bits 31:14, 16 kB aligned */

+   xybrd_rcba_base = ioremap_nocache(rcba & 0xFFFFC000, 0x4000);

+   if (xybrd_rcba_base == NULL)

+      return;

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume_early(struct pci_dev *dev)

+{

+   u32 val;

+

+   if (!xybrd_rcba_base)

+      return;

+   /* read the Function Disable register, dword mode only */

+   val = readl(xybrd_rcba_base + 0x3418);

+   writel(val & 0xFFFFFFFD, xybrd_rcba_base + 0x3418); /* enable the PATA device */

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume(struct pci_dev *dev)

+{

+   if (!xybrd_rcba_base)

+      return;

+   iounmap(xybrd_rcba_base);

+   xybrd_rcba_base = NULL;

+   dev_info(&dev->dev, "Enabled ICH7 IDE device\n");

+}

+

+static void xybrd_hides_ide_lpc_ich7(struct pci_dev *dev)

+{

+   xybrd_hides_ide_lpc_ich7_suspend(dev);

+   xybrd_hides_ide_lpc_ich7_resume_early(dev);

+   xybrd_hides_ide_lpc_ich7_resume(dev);

+}

+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_1,   xybrd_hides_ide_lpc_ich7);

+DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_1,   xybrd_hides_ide_lpc_ich7_suspend);

+DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_1,   xybrd_hides_ide_lpc_ich7_resume);

+DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_1,   xybrd_hides_ide_lpc_ich7_resume_early);

```

----------

## msalerno

Recovery Mode: lspci -n

00:00.0 0600: 8086:2770 (rev 02)

00:02.0 0300: 8086:2772 (rev 02)

00:1c.0 0604: 8086:27d0 (rev 01)

00:1c.2 0604: 8086:27d4 (rev 01)

00:1d.0 0c03: 8086:27c8 (rev 01)

00:1d.1 0c03: 8086:27c9 (rev 01)

00:1d.2 0c03: 8086:27ca (rev 01)

00:1d.3 0c03: 8086:27cb (rev 01)

00:1d.7 0c03: 8086:27cc (rev 01)

00:1e.0 0604: 8086:244e (rev e1)

00:1f.0 0601: 8086:27b8 (rev 01)

00:1f.1 0101: 8086:27df (rev 01)

00:1f.2 0106: 8086:27c1 (rev 01)

00:1f.3 0c05: 8086:27da (rev 01)

01:00.0 0200: 8086:108b (rev 03)

02:00.0 0180: 1095:3132 (rev 01)

lspci:

00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 02)

00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)

00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 01)

00:1c.2 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 3 (rev 01)

00:1d.0 USB Controller: Intel Corporation N10/ICH7 Family USB UHCI Controller #1 (rev 01)

00:1d.1 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 (rev 01)

00:1d.2 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 (rev 01)

00:1d.3 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 (rev 01)

00:1d.7 USB Controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller (rev 01)

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)

00:1f.2 SATA controller: Intel Corporation N10/ICH7 Family SATA AHCI Controller (rev 01)

00:1f.3 SMBus: Intel Corporation N10/ICH 7 Family SMBus Controller (rev 01)

01:00.0 Ethernet controller: Intel Corporation 82573V Gigabit Ethernet Controller (Copper) (rev 03)

02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3132 Serial ATA Raid II Controller (rev 01)

----------

## roarinelk

 *msalerno wrote:*   

> Recovery Mode: lspci -n
> 
> 00:1f.0 0601: 8086:27b8 (rev 01)
> 
> 

 

Ah, then in the patches' last 4 lines, change PCI_DEVICE_ID_INTEL_ICH7_1 to PCI_DEVICE_ID_INTEL_ICH7_0

----------

## msalerno

I apologize for having to ask this question, but I am not familiar with the kernel GIT repos.  My assumption is that you are using the repo i pasted below, but i'm not 100% sure.  Can you confirm?

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Thanks

----------

## roarinelk

yes its the correct one.  The patch should also apply to 2.6.34 and previous

with little or no fuzz.

----------

## roarinelk

Out of curiosity, have you ever tried booting (Free)DOS from your DOM?

I'd like to know whether DOS works from the DOM when you don't use

recovery mode in your BIOS.

Thanks!

----------

## msalerno

Ill check it out.  Freenas (freebsd) has no issues booting from dom.

----------

## msalerno

It patched perfectly against 2.6.34-stable.  I'm compiling now.  When I get home I will be able to change the settings to enhanced and see if it worked.

----------

## msalerno

Looks promising!!!!

Now I see this in compatible mode. 0:0:0:0 being the DOM.

0:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0

1:0:1:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:1/1:0:1:0

```
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)

00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)

00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
```

Now I just need to boot into enhanced and see.

----------

## msalerno

It works!!!!  The dom comes up as sdc, but i'll play with the BIOS to see if I can change that.  So now the question is...  How do we get this upstream?  I know lots of people who will be very happy once I link this thread.

Can't quite figure out how to get sdc to be sda no matter what bios settings I change.  Grub sees it has hd2 in enhanced mode.  I went with ext labels in my fstab for now.  A topic for another thread.

----------

## roarinelk

 *msalerno wrote:*   

> It works!!!!  ... So now the question is...  How do we get this upstream?
> 
> 

 

I can tell you right now that these kind of patches will never be accepted upstream.

As it is the patch is far too generic, unconditionally enabling the pata device

on (almost) every ICH7.

The correct way to solve this is to bug the BIOS people to fix this. Usually there's

a reason why certain features are disabled, though.

 *Quote:*   

> 
> 
> Can't quite figure out how to get sdc to be sda no matter what bios settings I change.  Grub sees it has hd2 in enhanced mode.  I went with ext labels in my fstab for now.  A topic for another thread.

 

Which disks get assigned to sda/sdb?  It may simply be a driver probe order issue

(make the other disk controller drivers modules), or the DOM is wired to the

secondary IDE channel, in which case the sdc won't go away unless you disconnect

the disks on the primary channel.

----------

## RottenMutt

hi, i'm in the same boat as the poster, but running fedora 13, kernel 2.6.34.7-56 x86_64, can i use this same patch???

cross post in fedora forums, and then i found this thread here: 

http://forums.fedoraforum.org/showthread.php?p=1403261#post1403261Last edited by RottenMutt on Fri Oct 01, 2010 2:28 pm; edited 1 time in total

----------

## RottenMutt

 *roarinelk wrote:*   

> yes its the correct one.  The patch should also apply to 2.6.34 and previous
> 
> with little or no fuzz.

 

i got fuzz.  rpmbuild gave me an error and stoped; 

```
+ case "$patch" in

+ patch -p1 -F1 -s

+ ApplyPatch ss4200_ICH7.patch

+ local patch=ss4200_ICH7.patch

+ shift

+ '[' '!' -f /home/eric/rpmbuild/SOURCES/ss4200_ICH7.patch ']'

Patch13000: ss4200_ICH7.patch

+ case "$patch" in

+ patch -p1 -F1 -s

1 out of 1 hunk FAILED -- saving rejects to file drivers/pci/quirks.c.rej

error: Bad exit status from /var/tmp/rpm-tmp.a5qm5O (%prep)

RPM build errors:

    Bad exit status from /var/tmp/rpm-tmp.a5qm5O (%prep)
```

rpm-tmp... says:

# get rid of unwanted files resulting from patch fuzz

if i run the patch on the file i get "hunk #1 succedded at 2824 with fuzz 2 (offset -18 lines)."

so i took the new quirks.c module from the .new source and patched it and put it back then built a patch in fedora:

```
diff -uNrp kernel-2.6.34.fc13.orig/drivers/pci/quirks.c kernel-2.6.34.fc13.new/drivers/pci/quirks.c

--- kernel-2.6.34.fc13.orig/drivers/pci/quirks.c    2010-10-01 01:19:07.915256467 -0500

+++ kernel-2.6.34.fc13.new/drivers/pci/quirks.c    2010-10-01 06:21:02.560376000 -0500

@@ -2833,3 +2833,53 @@ int pci_dev_specific_reset(struct pci_de

 

     return -ENOTTY;

 }

+

+

+/* XXX: hack to enable the PATA device on ICH7 */

+static void __iomem *xybrd_rcba_base;

+static void xybrd_hides_ide_lpc_ich7_suspend(struct pci_dev *dev)

+{

+   u32 rcba;

+

+   if (xybrd_rcba_base) {

+      printk(KERN_ALERT "WARNING: more than one ICH7 PATA!\n");

+      return;

+   }

+

+   pci_read_config_dword(dev, 0xF0, &rcba);

+   /* use bits 31:14, 16 kB aligned */

+   xybrd_rcba_base = ioremap_nocache(rcba & 0xFFFFC000, 0x4000);

+   if (xybrd_rcba_base == NULL)

+      return;

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume_early(struct pci_dev *dev)

+{

+   u32 val;

+

+   if (!xybrd_rcba_base)

+      return;

+   /* read the Function Disable register, dword mode only */

+   val = readl(xybrd_rcba_base + 0x3418);

+   writel(val & 0xFFFFFFFD, xybrd_rcba_base + 0x3418); /* enable the PATA device */

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume(struct pci_dev *dev)

+{

+   if (!xybrd_rcba_base)

+      return;

+   iounmap(xybrd_rcba_base);

+   xybrd_rcba_base = NULL;

+   dev_info(&dev->dev, "Enabled ICH7 IDE device\n");

+}

+

+static void xybrd_hides_ide_lpc_ich7(struct pci_dev *dev)

+{

+   xybrd_hides_ide_lpc_ich7_suspend(dev);

+   xybrd_hides_ide_lpc_ich7_resume_early(dev);

+   xybrd_hides_ide_lpc_ich7_resume(dev);

+}

+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7);

+DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7_suspend);

+DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7_resume);

+DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7_resume_early); 
```

building a kernel at 2.0 GB per second is slow, pio mode on my root drive!  i've been following this how to http://fedoraproject.org/wiki/Docs/CustomKernel#Prepare_Build_FilesLast edited by RottenMutt on Fri Oct 01, 2010 2:11 pm; edited 2 times in total

----------

## roarinelk

 *RottenMutt wrote:*   

> hi, i'm in the same boat as the poster, but running fedora 13, kernel 2.6.34.7-56 x86_64, can i use this same patch???
> 
> http://forums.fedoraforum.org/showthread.php?p=1403261#post1403261

 

You seem to have an identical chipset, so I see no reason why it shouldn't work.

I see you already patched your fedora kernel, do you see the message

"Enabled ICH7 IDE Device" in dmesg?

----------

## RottenMutt

I'm still compiling, it is slow when your stuck in PIO mode on your root drive.  :Crying or Very sad: 

thank you for the patch.  can i ask how it works, what calls it and when?  I would guess it switches the eide controller id or tells the kernel to use different driver code.

processing files: kernel-debug....

----------

## roarinelk

 *RottenMutt wrote:*   

> I'm still compiling, it is slow when your stuck in PIO mode on your root drive.
> 
> thank you for the patch.  can i ask how it works, what calls it and when?

 

In essence it accesses one of the ICH7 configuration registers (xybrd_rcba_base + 0x3418)

to enable the IDE controller PCI function. The base address of the block which contains

this reg (xybrd_rcba_base) is read from the PCI config space of the LPC bridge function.

(The code is a clone of the ASUS SMBus unhide functionality also in the kernel).

Download the ICH7 specs from intel, they describe all the registers pretty well.

----------

## RottenMutt

the patch works, i get 33MB/s on my 2.5 system drive.  after rebooting it appeared as /dev/sde

I may be stuck in UDMA 33 mode, still huge improvement.  transfering a large iso from raid to my home file confirms 33 MB/s in gkrellm.  anyone know how to kick the drive up?

```
[root@ss4200 eric]# lspci

00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 02)

00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)

00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 01)

00:1c.2 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 3 (rev 01)

00:1d.0 USB Controller: Intel Corporation N10/ICH7 Family USB UHCI Controller #1 (rev 01)

00:1d.1 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 (rev 01)

00:1d.2 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 (rev 01)

00:1d.3 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 (rev 01)

00:1d.7 USB Controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller (rev 01)

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)

00:1f.2 SATA controller: Intel Corporation N10/ICH7 Family SATA AHCI Controller (rev 01)

00:1f.3 SMBus: Intel Corporation N10/ICH 7 Family SMBus Controller (rev 01)

01:00.0 Ethernet controller: Intel Corporation 82573V Gigabit Ethernet Controller (Copper) (rev 03)

02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3132 Serial ATA Raid II Controller (rev 01)

[root@ss4200 eric]# lspci -n

00:00.0 0600: 8086:2770 (rev 02)

00:02.0 0300: 8086:2772 (rev 02)

00:1c.0 0604: 8086:27d0 (rev 01)

00:1c.2 0604: 8086:27d4 (rev 01)

00:1d.0 0c03: 8086:27c8 (rev 01)

00:1d.1 0c03: 8086:27c9 (rev 01)

00:1d.2 0c03: 8086:27ca (rev 01)

00:1d.3 0c03: 8086:27cb (rev 01)

00:1d.7 0c03: 8086:27cc (rev 01)

00:1e.0 0604: 8086:244e (rev e1)

00:1f.0 0601: 8086:27b8 (rev 01)

00:1f.1 0101: 8086:27df (rev 01)

00:1f.2 0106: 8086:27c1 (rev 01)

00:1f.3 0c05: 8086:27da (rev 01)

01:00.0 0200: 8086:108b (rev 03)

02:00.0 0180: 1095:3132 (rev 01)
```

some stuff i found of interest in dmesg:

```
pci 0000:00:1f.0: Force enabled HPET at 0xfed00000

pci 0000:00:1f.0: Enabled ICH7 IDE device

pci 0000:00:1f.0: quirk: [io  0x0800-0x087f] claimed by ICH6 ACPI/GPIO/TCO

pci 0000:00:1f.0: quirk: [io  0x0480-0x04bf] claimed by ICH6 GPIO

pci 0000:00:1f.0: ICH7 LPC Generic IO decode 1 PIO at 0a00 (mask 00ff)

pci 0000:00:1f.1: reg 10: [io  0x0000-0x0007]

pci 0000:00:1f.1: reg 14: [io  0x0000-0x0003]

pci 0000:00:1f.1: reg 18: [io  0x08f0-0x08f7]

pci 0000:00:1f.1: reg 1c: [io  0x08f8-0x08fb]

pci 0000:00:1f.1: reg 20: [io  0xffa0-0xffaf]

pci 0000:00:1f.2: reg 10: [io  0xe080-0xe087]

pci 0000:00:1f.2: reg 14: [io  0xe000-0xe003]

pci 0000:00:1f.2: reg 18: [io  0xdc00-0xdc07]

pci 0000:00:1f.2: reg 1c: [io  0xd880-0xd883]

pci 0000:00:1f.2: reg 20: [io  0xd800-0xd80f]

pci 0000:00:1f.2: reg 24: [mem 0xffa3fc00-0xffa3ffff]

pci 0000:00:1f.2: PME# supported from D3hot

pci 0000:00:1f.2: PME# disabled

pci 0000:00:1f.3: reg 20: [io  0x0400-0x041f]

....

ata_piix 0000:00:1f.1: version 2.13

ata_piix 0000:00:1f.1: PCI INT A -> GSI 18 (level, low) -> IRQ 18

ata_piix 0000:00:1f.1: setting latency timer to 64

....

ata5.00: ATA-8: WDC WD1600BEVE-00A0HT0, 11.01A11, max UDMA/100

ata5.00: 312581808 sectors, multi 16: LBA48 

ata5.00: limited to UDMA/33 due to 40-wire cable

ata5.00: configured for UDMA/33

ata1.00: ATA-8: Hitachi HDS722020ALA330, JKAOA28A, max UDMA/133

ata1.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

ata1.00: configured for UDMA/133

ata3.00: ATA-8: Hitachi HDS722020ALA330, JKAOA28A, max UDMA/133

ata3.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

ata2.00: ATA-8: Hitachi HDS722020ALA330, JKAOA28A, max UDMA/133

ata2.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

ata4.00: ATA-8: Hitachi HDS722020ALA330, JKAOA28A, max UDMA/133

ata4.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

ata3.00: configured for UDMA/133

ata2.00: configured for UDMA/133

ata4.00: configured for UDMA/133

...

sd 0:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

sd 0:0:0:0: Attached scsi generic sg0 type 0

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

sd 0:0:0:0: [sda] Attached SCSI disk

sd 1:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

sd 1:0:0:0: Attached scsi generic sg1 type 0

sd 2:0:0:0: [sdc] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

sd 2:0:0:0: Attached scsi generic sg2 type 0

sd 2:0:0:0: [sdc] Write Protect is off

sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00

sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

sd 3:0:0:0: [sdd] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

sd 3:0:0:0: Attached scsi generic sg3 type 0

sd 3:0:0:0: [sdd] Write Protect is off

sd 3:0:0:0: [sdd] Mode Sense: 00 3a 00 00

sd 1:0:0:0: [sdb] Write Protect is off

sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00

sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

sd 4:0:0:0: [sde] 312581808 512-byte logical blocks: (160 GB/149 GiB)

sd 4:0:0:0: Attached scsi generic sg4 type 0

sd 4:0:0:0: [sde] Write Protect is off

sd 4:0:0:0: [sde] Mode Sense: 00 3a 00 00

sd 3:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

sd 4:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

sd 3:0:0:0: [sdd] Attached SCSI disk

sd 2:0:0:0: [sdc] Attached SCSI disk

sd 1:0:0:0: [sdb] Attached SCSI disk

sd 4:0:0:0: [sde] Attached SCSI disk
```

----------

## roarinelk

 *Quote:*   

> 
> 
> ata5.00: limited to UDMA/33 due to 40-wire cable
> 
> ata5.00: configured for UDMA/33 
> ...

 

Either you have a bad cable or cable detection is broken; probably the

latter.

----------

## roarinelk

Do a "lspci -vn -s 1f.1" as root and post the output, I may have a solution for your UDMA33 limit.

EDIT: open the kernel source file drivers/ata/ata_piix.c,  search for "struct ich_laptop",

copy one of the lines with 27df in the first column, and replace the other numbers with

the numbers of the "Subdevice" output of the lspci line above.  Then rebuild kernel and

it should give you ata100 speeds.

----------

## RottenMutt

 *roarinelk wrote:*   

> Do a "lspci -vn -s 1f.1" as root and post the output, I may have a solution for your UDMA33 limit.
> 
> EDIT: open the kernel source file drivers/ata/ata_piix.c,  search for "struct ich_laptop",
> 
> copy one of the lines with 27df in the first column, and replace the other numbers with
> ...

 

```
[eric@ss4200 ~]$ lspci -vn -s 1f.1

00:1f.1 0101: 8086:27df (rev 01) (prog-if 8a [Master SecP PriP])

   Subsystem: 8086:27df

   Flags: bus master, medium devsel, latency 0, IRQ 18

   I/O ports at 01f0 [size=8]

   I/O ports at 03f4 [size=1]

   I/O ports at 0170 [size=8]

   I/O ports at 0374 [size=1]

   I/O ports at ffa0 [size=16]

   Kernel driver in use: ata_piix

   Kernel modules: ata_generic, pata_acpi
```

to do it the fedora way, i would edit the kernel and generate a patch again, i believe.

here is the section in ata_piix.c refered to, if i pick "ICH7 on unknown Intel" which are the Subdevice?

```
/*

 *    List of laptops that use short cables rather than 80 wire

 */

static const struct ich_laptop ich_laptop[] = {

    /* devid, subvendor, subdev */

    { 0x27DF, 0x0005, 0x0280 },    /* ICH7 on Acer 5602WLMi */

    { 0x27DF, 0x1025, 0x0102 },    /* ICH7 on Acer 5602aWLMi */

    { 0x27DF, 0x1025, 0x0110 },    /* ICH7 on Acer 3682WLMi */

    { 0x27DF, 0x1028, 0x02b0 },    /* ICH7 on unknown Dell */

    { 0x27DF, 0x1043, 0x1267 },    /* ICH7 on Asus W5F */

    { 0x27DF, 0x103C, 0x30A1 },    /* ICH7 on HP Compaq nc2400 */

    { 0x27DF, 0x103C, 0x361a },    /* ICH7 on unknown HP  */

    { 0x27DF, 0x1071, 0xD221 },    /* ICH7 on Hercules EC-900 */

    { 0x27DF, 0x152D, 0x0778 },    /* ICH7 on unknown Intel */

    { 0x24CA, 0x1025, 0x0061 },    /* ICH4 on ACER Aspire 2023WLMi */

    { 0x24CA, 0x1025, 0x003d },    /* ICH4 on ACER TM290 */

    { 0x266F, 0x1025, 0x0066 },    /* ICH6 on ACER Aspire 1694WLMi */

    { 0x2653, 0x1043, 0x82D8 },    /* ICH6M on Asus Eee 701 */

    { 0x27df, 0x104d, 0x900e },    /* ICH7 on Sony TZ-90 */

    /* end marker */

    { 0, }
```

Last edited by RottenMutt on Fri Oct 01, 2010 7:15 pm; edited 3 times in total

----------

## roarinelk

this should do it:

```

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c

index d712675..d06135f 100644

--- a/drivers/ata/ata_piix.c

+++ b/drivers/ata/ata_piix.c

@@ -623,6 +623,7 @@ static const struct ich_laptop ich_laptop[] = {

        { 0x266F, 0x1025, 0x0066 },     /* ICH6 on ACER Aspire 1694WLMi */

        { 0x2653, 0x1043, 0x82D8 },     /* ICH6M on Asus Eee 701 */

        { 0x27df, 0x104d, 0x900e },     /* ICH7 on Sony TZ-90 */

+       { 0x27df, 0x8086, 0x27df },     /* RottenMutt's NAS */

        /* end marker */

        { 0, }

 };

```

----------

## RottenMutt

 *roarinelk wrote:*   

>  *Quote:*   
> 
> ata5.00: limited to UDMA/33 due to 40-wire cable
> 
> ata5.00: configured for UDMA/33 
> ...

 

I'm using a laptop drive converter on the end of a regular 80 pin cable.  should i try cutting down the cable to the secondary position to make it shorter?

i guess the code checks for timming for the signal to bounce back.

edit: i cut down the cable and that did work.  guess I'm compiling again, it should be a lot faster now in udma33 mode.  need a little help with the sub-device stuff.Last edited by RottenMutt on Fri Oct 01, 2010 7:40 pm; edited 1 time in total

----------

## roarinelk

 *RottenMutt wrote:*   

>  *roarinelk wrote:*    *Quote:*   
> 
> ata5.00: limited to UDMA/33 due to 40-wire cable
> 
> ata5.00: configured for UDMA/33 
> ...

 

No, don't damage the cable.  Try the patch first: stress the disk a bit and

watch for kernel errors. If the ata link produces lots of CRC errors then back it

out again (or get a 80-wire cable with the small 44pin (2.5") connector on one end).

----------

## krinn

roarinelk: sorry if you answer that already, but did you upstream that to gentoo kernel herd? And maybe even to kernel.org (as rottenmutt proof every distro might love to get that patch)

----------

## RottenMutt

 *roarinelk wrote:*   

> this should do it:
> 
> ```
> 
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> ...

 

so just add a line is all, 27df twice?

----------

## roarinelk

 *krinn wrote:*   

> roarinelk: sorry if you answer that already, but did you upstream that to gentoo kernel herd? And maybe even to kernel.org (as rottenmutt proof every distro might love to get that patch)

 

No I don't intend to, and they shouldn't.  As is they're just hacks which

happen to work on these NAS boxes, but may cause harm on other systems.

----------

## roarinelk

 *RottenMutt wrote:*   

>  *roarinelk wrote:*   this should do it:
> 
> ```
> 
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> ...

 

aye, the code in question checks for the PCI device id, and subdevice/subvendor.

The line in the patch is according to your lspci info.

----------

## RottenMutt

 *roarinelk wrote:*   

> 
> 
> No, don't damage the cable.  Try the patch first: stress the disk a bit and
> 
> watch for kernel errors. If the ata link produces lots of CRC errors then back it
> ...

 

haa, already did.  How do i check for crc errors?

----------

## RottenMutt

 *roarinelk wrote:*   

> this should do it:
> 
> ```
> 
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> ...

 

wouldn't boot, couldn't find the drive.

----------

## roarinelk

 *RottenMutt wrote:*   

>  *roarinelk wrote:*   this should do it:
> 
> ```
> 
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> ...

 

At least cable detection works.  UDMA33 is all you'll get with your current cable setup.

----------

## RottenMutt

Bios reports UDMA-5

i can put the drive, cable and adapter in another system and it will boot up UDMA-5

i believe this is driver related.

----------

## roarinelk

 *RottenMutt wrote:*   

> Bios reports UDMA-5
> 
> i can put the drive, cable and adapter in another system and it will boot up UDMA-5
> 
> i believe this is driver related.

 

Still, there's a reason the kernel limits to UDMA33, usually to get a stable link.

----------

## RottenMutt

it worked, i was just dumb and didn't put the both patchs in the "ApplyPatch" section.  i figured that out after i researched and came to the conclusion you where correct with device id, sub system vendor id, and sub system device id.  http://en.wikipedia.org/wiki/PCI_configuration_space

```
[eric@ss4200 ~]$ dmesg | grep ata5

ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xffa0 irq 14

ata5.00: ATA-8: WDC WD1600BEVE-00A0HT0, 11.01A11, max UDMA/100

ata5.00: 312581808 sectors, multi 16: LBA48 

ata5.00: configured for UDMA/100
```

i'm getting write speeds around 54MB/s.

----------

## RottenMutt

here is the fedora 13 version of roarinelk's cable patch.

```
diff -uNrp kernel-2.6.34.fc13.orig/drivers/ata/ata_piix.c kernel-2.6.34.fc13.new/drivers/ata/ata_piix.c

--- kernel-2.6.34.fc13.orig/drivers/ata/ata_piix.c    2010-10-01 22:45:51.903535382 -0500

+++ kernel-2.6.34.fc13.new/drivers/ata/ata_piix.c    2010-10-01 22:52:37.199660503 -0500

@@ -619,6 +619,7 @@ static const struct ich_laptop ich_lapto

     { 0x266F, 0x1025, 0x0066 },    /* ICH6 on ACER Aspire 1694WLMi */

     { 0x2653, 0x1043, 0x82D8 },    /* ICH6M on Asus Eee 701 */

     { 0x27df, 0x104d, 0x900e },    /* ICH7 on Sony TZ-90 */

+    { 0x27DF, 0x8086, 0x27df },    /* ICH7 on Intel SS4200 */

     /* end marker */

     { 0, }

 };
```

i've been using this guide to spin custom kernels on fedora: http://fedoraproject.org/wiki/Docs/CustomKernel#Prepare_Build_Files

let me throw in the ICH7 patch for your one stop shopping experience.

```
diff -uNrp kernel-2.6.34.fc13.orig/drivers/pci/quirks.c kernel-2.6.34.fc13.new/drivers/pci/quirks.c

--- kernel-2.6.34.fc13.orig/drivers/pci/quirks.c    2010-10-01 01:19:07.915256467 -0500

+++ kernel-2.6.34.fc13.new/drivers/pci/quirks.c    2010-10-01 06:21:02.560376000 -0500

@@ -2833,3 +2833,53 @@ int pci_dev_specific_reset(struct pci_de

 

     return -ENOTTY;

 }

+

+

+/* XXX: hack to enable the PATA device on ICH7 */

+static void __iomem *xybrd_rcba_base;

+static void xybrd_hides_ide_lpc_ich7_suspend(struct pci_dev *dev)

+{

+   u32 rcba;

+

+   if (xybrd_rcba_base) {

+      printk(KERN_ALERT "WARNING: more than one ICH7 PATA!\n");

+      return;

+   }

+

+   pci_read_config_dword(dev, 0xF0, &rcba);

+   /* use bits 31:14, 16 kB aligned */

+   xybrd_rcba_base = ioremap_nocache(rcba & 0xFFFFC000, 0x4000);

+   if (xybrd_rcba_base == NULL)

+      return;

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume_early(struct pci_dev *dev)

+{

+   u32 val;

+

+   if (!xybrd_rcba_base)

+      return;

+   /* read the Function Disable register, dword mode only */

+   val = readl(xybrd_rcba_base + 0x3418);

+   writel(val & 0xFFFFFFFD, xybrd_rcba_base + 0x3418); /* enable the PATA device */

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume(struct pci_dev *dev)

+{

+   if (!xybrd_rcba_base)

+      return;

+   iounmap(xybrd_rcba_base);

+   xybrd_rcba_base = NULL;

+   dev_info(&dev->dev, "Enabled ICH7 IDE device\n");

+}

+

+static void xybrd_hides_ide_lpc_ich7(struct pci_dev *dev)

+{

+   xybrd_hides_ide_lpc_ich7_suspend(dev);

+   xybrd_hides_ide_lpc_ich7_resume_early(dev);

+   xybrd_hides_ide_lpc_ich7_resume(dev);

+}

+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7);

+DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7_suspend);

+DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7_resume);

+DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_0,   xybrd_hides_ide_lpc_ich7_resume_early); 
```

lets recap, it works, 64 bit linux (fedora 13), on intel ss4200, detects PATA drive in UDMA/100 mode and four SATA drives; plus boots from the PATA drive.  I'm running C2D E4600 with 1GB ram.  Installed tigerVNC and am connecting to the box thru a secure socket (ssh) into the loop back interface; provides encription of VNC session (not that i really need it).   tigerVNC makes it easier in some respect for a noob, i get to use the gui config utilities.

thanks again roarinelk for your help:)Last edited by RottenMutt on Sat Oct 09, 2010 12:25 am; edited 2 times in total

----------

## roarinelk

 *RottenMutt wrote:*   

> here is the fedora 13 version of roarinelk's cable patch.
> 
> ```
> diff -uNrp kernel-2.6.34.fc13.orig/drivers/ata/ata_piix.c kernel-2.6.34.fc13.new/drivers/ata/ata_piix.c
> 
> ...

 

Technically it's just generic ICH7 (limited to all ICH7s where the bios doesn't bother to

change the default subvendor/device ids), but that's just me nitpicking :-)

 *Quote:*   

> 
> 
> thanks again roarinelk for your help:)

 

my pleasure.

----------

## omega13333

I've patched my kernel on my SS4200 with the given patch and the IDE-Device just shows up fine. But another problem I found is that the patch still doesn't work with Suspend-To-RAM.

I boot my kernel with the options 

```
acpi_sleep=s3_bios test_suspend=mem
```

which is necessary to use standby on the SS4200 and if I do so the IDE-Device still shows up under lspci but my IDE devices are not detected anymore. dmesg shows

```
ata_piix 0000:00:1f.1: PCI INT A disabled

ata_piix 0000:00:1f.1: version 2.13

ata_piix 0000:00:1f.1: PCI INT A -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11

ata_piix 0000:00:1f.1: setting latency timer to 64

scsi9 : ata_piix

scsi10 : ata_piix

ata9: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xffa0 irq 14

ata9: port disabled. ignoring.

ata10: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0xffa8 irq 15

ata10: port disabled. ignoring.
```

If I boot the kernel without the options my IDE-devices show up and everything is fine, but I loose standby functionality

----------

## roarinelk

Add a printk(KERN_ALERT "<some text>\n") at the start of each function in the patch and post the complete dmesg after a suspend/resume cycle.

----------

## omega13333

I added printk(KERN_ALERT "<function name>\n") to the patch functions and got the following output from dmesg. The lines from printk are "ich7_suspend", "ich7_resume_early", ...

```
[  196.941814] nfsd: last server has exited, flushing export cache

[  202.615253] PM: Syncing filesystems ... done.

[  202.742609] PM: Preparing system for mem sleep

[  202.744662] Freezing user space processes ... (elapsed 0.01 seconds) done.

[  202.766666] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.

[  202.786652] PM: Entering mem sleep

[  202.786670] Suspending console(s) (use no_console_suspend to debug)

[  202.793535] sd 3:0:0:0: [sdc] Synchronizing SCSI cache

[  202.793571] sd 1:0:0:0: [sdb] Synchronizing SCSI cache

[  202.793726] sd 1:0:0:0: [sdb] Stopping disk

[  202.793736] sd 3:0:0:0: [sdc] Stopping disk

[  202.793993] serial 00:06: disabled

[  202.794085] sd 0:0:0:0: [sda] Synchronizing SCSI cache

[  202.794285] sata_sil24 0000:02:00.0: PCI INT A disabled

[  202.794297] sd 0:0:0:0: [sda] Stopping disk

[  202.794442] ata_piix 0000:00:1f.1: PCI INT A disabled

[  202.794453] ich7_suspend

[  202.794527] uhci_hcd 0000:00:1d.3: PCI INT D disabled

[  202.794536] uhci_hcd 0000:00:1d.2: PCI INT C disabled

[  202.794544] uhci_hcd 0000:00:1d.1: PCI INT B disabled

[  202.794552] uhci_hcd 0000:00:1d.0: PCI INT A disabled

[  202.822454] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX

[  202.836044] ehci_hcd 0000:00:1d.7: PCI INT A disabled

[  202.884337] e1000e 0000:01:00.0: PCI INT A disabled

[  202.884347] e1000e 0000:01:00.0: PME# enabled

[  202.884362] pcieport 0000:00:1c.0: wake-up capability enabled by ACPI

[  203.736038] PM: suspend of devices complete after 942.995 msecs

[  203.736044] PM: suspend devices took 0.944 seconds

[  203.752214] PM: late suspend of devices complete after 16.163 msecs

[  203.752314] ACPI: Preparing to enter system sleep state S3

[  203.752773] PM: Saving platform NVS memory

[  203.752803] Extended CMOS year: 2000

[  203.752803] Back to C!

[  203.752803] PM: Restoring platform NVS memory

[  203.752803] Extended CMOS year: 2000

[  203.752803] ACPI: Waking up from system sleep state S3

[  203.752803] pci 0000:00:02.0: restoring config space at offset 0x7 (was 0xffa00000, writing 0xffa40000)

[  203.752803] pcieport 0000:00:1c.0: restoring config space at offset 0xf (was 0x20100, writing 0x2010a)

[  203.752803] pcieport 0000:00:1c.0: restoring config space at offset 0x9 (was 0x1fff1, writing 0x20112001)

[  203.752803] pcieport 0000:00:1c.0: restoring config space at offset 0x3 (was 0x810000, writing 0x810008)

[  203.752803] pcieport 0000:00:1c.0: restoring config space at offset 0x1 (was 0x100107, writing 0x100507)

[  203.752803] pcieport 0000:00:1c.2: restoring config space at offset 0xf (was 0x20300, writing 0x2030b)

[  203.752803] pcieport 0000:00:1c.2: restoring config space at offset 0x9 (was 0x1fff1, writing 0x20312021)

[  203.752803] pcieport 0000:00:1c.2: restoring config space at offset 0x3 (was 0x810000, writing 0x810008)

[  203.752803] pcieport 0000:00:1c.2: restoring config space at offset 0x1 (was 0x100107, writing 0x100507)

[  203.752803] uhci_hcd 0000:00:1d.0: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  203.752803] uhci_hcd 0000:00:1d.1: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  203.752803] uhci_hcd 0000:00:1d.2: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  203.752803] uhci_hcd 0000:00:1d.3: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  203.752803] ehci_hcd 0000:00:1d.7: restoring config space at offset 0x1 (was 0x2900006, writing 0x2900002)

[  203.752803] pci 0000:00:1e.0: restoring config space at offset 0xf (was 0x20000, writing 0x200ff)

[  203.752803] ich7_resume_early

[  203.752803] ata_piix 0000:00:1f.1: restoring config space at offset 0xb (was 0x0, writing 0x27df8086)

[  203.752803] ata_piix 0000:00:1f.1: restoring config space at offset 0x8 (was 0x1, writing 0xffa1)

[  203.752803] ata_piix 0000:00:1f.1: restoring config space at offset 0x7 (was 0x1, writing 0x8f9)

[  203.752803] ata_piix 0000:00:1f.1: restoring config space at offset 0x6 (was 0x1, writing 0x8f1)

[  203.752803] ata_piix 0000:00:1f.1: restoring config space at offset 0x1 (was 0x2800000, writing 0x2800005)

[  203.752803] ahci 0000:00:1f.2: restoring config space at offset 0x1 (was 0x2b00007, writing 0x2b00407)

[  203.752803] e1000e 0000:01:00.0: restoring config space at offset 0xf (was 0x100, writing 0x10a)

[  203.752803] e1000e 0000:01:00.0: restoring config space at offset 0x6 (was 0x1, writing 0xbc01)

[  203.752803] e1000e 0000:01:00.0: restoring config space at offset 0x4 (was 0x0, writing 0xff6e0000)

[  203.752803] e1000e 0000:01:00.0: restoring config space at offset 0x1 (was 0x100000, writing 0x100007)

[  203.752803] sata_sil24 0000:02:00.0: restoring config space at offset 0xf (was 0x100, writing 0x10b)

[  203.752803] sata_sil24 0000:02:00.0: restoring config space at offset 0xc (was 0x0, writing 0xff800000)

[  203.752803] sata_sil24 0000:02:00.0: restoring config space at offset 0x8 (was 0x1, writing 0xcc01)

[  203.752803] sata_sil24 0000:02:00.0: restoring config space at offset 0x6 (was 0x4, writing 0xff8f8004)

[  203.752803] sata_sil24 0000:02:00.0: restoring config space at offset 0x4 (was 0x4, writing 0xff8ffc04)

[  203.752803] sata_sil24 0000:02:00.0: restoring config space at offset 0x3 (was 0x0, writing 0x8)

[  203.752803] sata_sil24 0000:02:00.0: restoring config space at offset 0x1 (was 0x100000, writing 0x100007)

[  203.752803] PM: early resume of devices complete after 0.702 msecs

[  203.752803] uhci_hcd 0000:00:1d.0: PCI INT A -> Link[LNKH] -> GSI 5 (level, low) -> IRQ 5

[  203.752803] uhci_hcd 0000:00:1d.0: setting latency timer to 64

[  203.752803] usb usb1: root hub lost power or was reset

[  203.752803] uhci_hcd 0000:00:1d.1: PCI INT B -> Link[LNKD] -> GSI 3 (level, low) -> IRQ 3

[  203.752803] uhci_hcd 0000:00:1d.1: setting latency timer to 64

[  203.752803] usb usb2: root hub lost power or was reset

[  203.752803] uhci_hcd 0000:00:1d.2: PCI INT C -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11

[  203.752803] uhci_hcd 0000:00:1d.2: setting latency timer to 64

[  203.752803] usb usb3: root hub lost power or was reset

[  203.752803] uhci_hcd 0000:00:1d.3: PCI INT D -> Link[LNKA] -> GSI 10 (level, low) -> IRQ 10

[  203.752803] uhci_hcd 0000:00:1d.3: setting latency timer to 64

[  203.752803] usb usb4: root hub lost power or was reset

[  203.752803] ehci_hcd 0000:00:1d.7: PCI INT A -> Link[LNKH] -> GSI 5 (level, low) -> IRQ 5

[  203.752803] ehci_hcd 0000:00:1d.7: setting latency timer to 64

[  203.752803] pci 0000:00:1e.0: setting latency timer to 64

[  203.752803] ich7_resume

[  203.752803] leds_ss4200 0000:00:1f.0: Enabled ICH7 IDE device

[  203.752803] ata_piix 0000:00:1f.1: PCI INT A -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11

[  203.752803] ata_piix 0000:00:1f.1: setting latency timer to 64

[  203.752803] ahci 0000:00:1f.2: setting latency timer to 64

[  203.752803] pcieport 0000:00:1c.0: wake-up capability disabled by ACPI

[  203.752803] e1000e 0000:01:00.0: PME# disabled

[  203.752803] e1000e 0000:01:00.0: Disabling ASPM  L1

[  203.752803] e1000e 0000:01:00.0: irq 19 for MSI/MSI-X

[  203.763885] ata7: port disabled. ignoring.

[  203.765367] ata8: port disabled. ignoring.

[  203.765441] sata_sil24 0000:02:00.0: PCI INT A -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11

[  203.765449] sata_sil24 0000:02:00.0: setting latency timer to 64

[  203.765488] sd 0:0:0:0: [sda] Starting disk

[  203.765543] sd 1:0:0:0: [sdb] Starting disk

[  203.765558] sd 3:0:0:0: [sdc] Starting disk

[  203.767210] serial 00:06: activated

[  203.844497] e1000e: eth0 NIC Link is Down

[  204.084039] ata3: SATA link down (SStatus 0 SControl 300)

[  205.844044] ata6: SATA link down (SStatus 0 SControl 0)

[  205.844074] ata5: SATA link down (SStatus 0 SControl 0)

[  206.225001] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX

[  213.776031] ata1: softreset failed (device not ready)

[  213.776041] ata4: softreset failed (device not ready)

[  213.776054] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[  213.814529] ata2.00: configured for UDMA/133

[  214.268035] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[  214.298359] ata4.00: configured for UDMA/133

[  214.492033] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[  214.530575] ata1.00: configured for UDMA/133

[  214.546678] PM: resume of devices complete after 10792.435 msecs

[  214.546777] PM: resume devices took 10.792 seconds

[  214.546780] ------------[ cut here ]------------

[  214.546790] WARNING: at kernel/power/suspend_test.c:53 suspend_devices_and_enter+0x196/0x1d0()

[  214.546794] Hardware name: SS4200-E

[  214.546796] Component: resume devices, time: 10792

[  214.546799] Modules linked in: nfsd nfs lockd nfs_acl auth_rpcgss sunrpc 8021q i2c_i801 leds_ss4200 led_class i2c_core serio_raw rng_core processor button usb_storage sd_mod ata_piix ehci_hcd sata_sil24 uhci_hcd e1000e thermal fan thermal_sys ahci libahci libata scsi_mod [last unloaded: scsi_wait_scan]

[  214.546829] Pid: 2738, comm: s2ram Not tainted 2.6.36-nas #7

[  214.546832] Call Trace:

[  214.546839]  [<ffffffff8104abf1>] ? suspend_devices_and_enter+0x196/0x1d0

[  214.546845]  [<ffffffff8104abf1>] ? suspend_devices_and_enter+0x196/0x1d0

[  214.546851]  [<ffffffff81025e84>] ? warn_slowpath_common+0x78/0x8d

[  214.546856]  [<ffffffff81025f58>] ? warn_slowpath_fmt+0x56/0x5e

[  214.546863]  [<ffffffff8114aa3d>] ? kobject_get+0x12/0x17

[  214.546869]  [<ffffffff811b6170>] ? dpm_resume_end+0x339/0x346

[  214.546873]  [<ffffffff8104adf4>] ? suspend_test_finish+0x49/0x79

[  214.546879]  [<ffffffff8104abf1>] ? suspend_devices_and_enter+0x196/0x1d0

[  214.546884]  [<ffffffff8104ad24>] ? enter_state+0xf9/0x13a

[  214.546889]  [<ffffffff8104a551>] ? state_store+0xb2/0xd4

[  214.546894]  [<ffffffff810cba77>] ? sysfs_write_file+0xd0/0x107

[  214.546900]  [<ffffffff81081bb9>] ? vfs_write+0xac/0x133

[  214.546905]  [<ffffffff81081cfc>] ? sys_write+0x45/0x6e

[  214.546910]  [<ffffffff81002768>] ? system_call_fastpath+0x16/0x1b

[  214.546914] ---[ end trace 61ecc54a71f50ba2 ]---

[  215.024048] PM: Finishing wakeup.

[  215.024051] Restarting tasks ... done.

[  216.118388] svc: failed to register lockdv1 RPC service (errno 97).

[  216.124852] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory

[  216.132687] NFSD: starting 90-second grace period

[  245.968040] usb 5-1: reset high speed USB device using ehci_hcd and address 2
```

----------

## roarinelk

 *omega13333 wrote:*   

> I added printk(KERN_ALERT "<function name>\n") to the patch functions and got the following output from dmesg. The lines from printk are "ich7_suspend", "ich7_resume_early", ...
> 
> ```
> 
> [  203.752803] ich7_resume
> ...

 

According to this output the patch seems to work as intended.

EDIT: no scratch that, I have a hunch.  I'll cook up an updated patch for you to try. Stay tuned

----------

## roarinelk

Please try this patch and send me the dmesg output again:

```

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c

index 857ae01..faa9da5 100644

--- a/drivers/pci/quirks.c

+++ b/drivers/pci/quirks.c

@@ -2902,3 +2902,92 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)

 

    return -ENOTTY;

 }

+

+

+/* XXX: hack to enable the PATA device on ICH7 */

+static void __iomem *xybrd_rcba_base;

+static void xybrd_hides_ide_lpc_ich7_suspend(struct pci_dev *dev)

+{

+   u32 rcba;

+

+   dev_info(&dev->dev, "ICH7_IDE_HACK_suspend ENTER\n");

+

+   if (xybrd_rcba_base) {

+      printk(KERN_ALERT "WARNING: more than one ICH7 PATA!\n");

+      goto out;

+   }

+

+   pci_read_config_dword(dev, 0xF0, &rcba);

+   /* use bits 31:14, 16 kB aligned */

+   xybrd_rcba_base = ioremap_nocache(rcba & 0xFFFFC000, 0x4000);

+   if (xybrd_rcba_base == NULL)

+      dev_info(&dev->dev, "ICH7_IDE_HACK_suspend: ioremap() failed\n");

+

+out:

+   dev_info(&dev->dev, "ICH7_IDE_HACK_suspend DONE\n");

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume_early(struct pci_dev *dev)

+{

+   u32 val;

+

+   dev_info(&dev->dev, "ICH7_IDE_HACK_resume_early ENTER\n");

+

+   if (!xybrd_rcba_base) {

+      dev_info(&dev->dev, "ICH7_IDE_HACK_resume_early: no base\n");

+      goto out;

+   }

+

+   /* read the Function Disable register, dword mode only */

+   val = readl(xybrd_rcba_base + 0x3418);

+   writel(val & 0xFFFFFFFD, xybrd_rcba_base + 0x3418); /* enable the PATA device */

+

+out:

+   dev_info(&dev->dev, "ICH7_IDE_HACK_resume_early DONE\n");

+}

+

+static void xybrd_hides_ide_lpc_ich7_resume(struct pci_dev *dev)

+{

+   u32 val;

+

+   dev_info(&dev->dev, "ICH7_IDE_HACK_resume ENTER\n");

+

+   if (!xybrd_rcba_base) {

+      dev_info(&dev->dev, "ICH7_IDE_HACK_resume: no base\n");

+      goto out;

+   }

+

+   /* look if someone disable the bloody thing in the meantime */

+   val = readl(xybrd_rcba_base + 0x3418);

+   if (val & ~0xfffffffd) {

+      dev_info(&dev->dev, "ICH7_IDE_HACK_resume: someone "

+                "disabled IDE again! Enabling again\n");

+      xybrd_hides_ide_lpc_ich7_resume_early(dev);

+   }

+

+   iounmap(xybrd_rcba_base);

+   xybrd_rcba_base = NULL;

+out:

+   dev_info(&dev->dev, "ICH7_IDE_HACK_resume DONE\n");

+}

+

+static void xybrd_hides_ide_lpc_ich7(struct pci_dev *dev)

+{

+   dev_info(&dev->dev, "ICH7_IDE_HACK ENTER\n");

+   xybrd_hides_ide_lpc_ich7_suspend(dev);

+   xybrd_hides_ide_lpc_ich7_resume_early(dev);

+   xybrd_hides_ide_lpc_ich7_resume(dev);

+   dev_info(&dev->dev, "ICH7_IDE_HACK DONE\n");

+}

+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,

+          PCI_DEVICE_ID_INTEL_ICH7_0,

+          xybrd_hides_ide_lpc_ich7);

+DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_INTEL,

+           PCI_DEVICE_ID_INTEL_ICH7_0,

+           xybrd_hides_ide_lpc_ich7_suspend);

+DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL,

+          PCI_DEVICE_ID_INTEL_ICH7_0,

+          xybrd_hides_ide_lpc_ich7_resume);

+DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL,

+                PCI_DEVICE_ID_INTEL_ICH7_0,

+                xybrd_hides_ide_lpc_ich7_resume_early);

```

----------

## omega13333

The new patch has not changed the behavior.

Here is my dmesg output with the new patch

```
[  144.753759] PM: Syncing filesystems ... done.

[  144.866605] PM: Preparing system for mem sleep

[  144.868653] Freezing user space processes ... (elapsed 0.01 seconds) done.

[  144.890662] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.

[  144.910647] PM: Entering mem sleep

[  144.910662] Suspending console(s) (use no_console_suspend to debug)

[  144.917540] sd 3:0:0:0: [sdc] Synchronizing SCSI cache

[  144.917575] sd 1:0:0:0: [sdb] Synchronizing SCSI cache

[  144.917591] sd 0:0:0:0: [sda] Synchronizing SCSI cache

[  144.917724] sd 3:0:0:0: [sdc] Stopping disk

[  144.917734] sd 1:0:0:0: [sdb] Stopping disk

[  144.917741] sd 0:0:0:0: [sda] Stopping disk

[  144.918015] serial 00:06: disabled

[  144.918242] sata_sil24 0000:02:00.0: PCI INT A disabled

[  144.918375] ata_piix 0000:00:1f.1: PCI INT A disabled

[  144.918386] leds_ss4200 0000:00:1f.0: ICH7_IDE_HACK_suspend ENTER

[  144.918427] leds_ss4200 0000:00:1f.0: ICH7_IDE_HACK_suspend DONE

[  144.918459] uhci_hcd 0000:00:1d.3: PCI INT D disabled

[  144.918467] uhci_hcd 0000:00:1d.2: PCI INT C disabled

[  144.918475] uhci_hcd 0000:00:1d.1: PCI INT B disabled

[  144.918484] uhci_hcd 0000:00:1d.0: PCI INT A disabled

[  144.948043] ehci_hcd 0000:00:1d.7: PCI INT A disabled

[  144.996326] e1000e 0000:01:00.0: PCI INT A disabled

[  144.996335] e1000e 0000:01:00.0: PME# enabled

[  144.996349] pcieport 0000:00:1c.0: wake-up capability enabled by ACPI

[  145.860039] PM: suspend of devices complete after 942.996 msecs

[  145.860043] PM: suspend devices took 0.944 seconds

[  145.876207] PM: late suspend of devices complete after 16.158 msecs

[  145.876303] ACPI: Preparing to enter system sleep state S3

[  145.876775] PM: Saving platform NVS memory

[  145.876804] Extended CMOS year: 2000

[  145.876804] Back to C!

[  145.876804] PM: Restoring platform NVS memory

[  145.876804] Extended CMOS year: 2000

[  145.876804] ACPI: Waking up from system sleep state S3

[  145.876804] pci 0000:00:02.0: restoring config space at offset 0x7 (was 0xffa00000, writing 0xffa40000)

[  145.876804] pcieport 0000:00:1c.0: restoring config space at offset 0xf (was 0x20100, writing 0x2010a)

[  145.876804] pcieport 0000:00:1c.0: restoring config space at offset 0x9 (was 0x1fff1, writing 0x20112001)

[  145.876804] pcieport 0000:00:1c.0: restoring config space at offset 0x3 (was 0x810000, writing 0x810008)

[  145.876804] pcieport 0000:00:1c.0: restoring config space at offset 0x1 (was 0x100107, writing 0x100507)

[  145.876804] pcieport 0000:00:1c.2: restoring config space at offset 0xf (was 0x20300, writing 0x2030b)

[  145.876804] pcieport 0000:00:1c.2: restoring config space at offset 0x9 (was 0x1fff1, writing 0x20312021)

[  145.876804] pcieport 0000:00:1c.2: restoring config space at offset 0x3 (was 0x810000, writing 0x810008)

[  145.876804] pcieport 0000:00:1c.2: restoring config space at offset 0x1 (was 0x100107, writing 0x100507)

[  145.876804] uhci_hcd 0000:00:1d.0: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  145.876804] uhci_hcd 0000:00:1d.1: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  145.876804] uhci_hcd 0000:00:1d.2: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  145.876804] uhci_hcd 0000:00:1d.3: restoring config space at offset 0x1 (was 0x2800005, writing 0x2800001)

[  145.876804] ehci_hcd 0000:00:1d.7: restoring config space at offset 0x1 (was 0x2900006, writing 0x2900002)

[  145.876804] pci 0000:00:1e.0: restoring config space at offset 0xf (was 0x20000, writing 0x200ff)

[  145.876804] leds_ss4200 0000:00:1f.0: ICH7_IDE_HACK_resume_early ENTER

[  145.876804] leds_ss4200 0000:00:1f.0: ICH7_IDE_HACK_resume_early DONE

[  145.876804] ata_piix 0000:00:1f.1: restoring config space at offset 0xb (was 0x0, writing 0x27df8086)

[  145.876804] ata_piix 0000:00:1f.1: restoring config space at offset 0x8 (was 0x1, writing 0xffa1)

[  145.876804] ata_piix 0000:00:1f.1: restoring config space at offset 0x7 (was 0x1, writing 0x8f9)

[  145.876804] ata_piix 0000:00:1f.1: restoring config space at offset 0x6 (was 0x1, writing 0x8f1)

[  145.876804] ata_piix 0000:00:1f.1: restoring config space at offset 0x1 (was 0x2800000, writing 0x2800005)

[  145.876804] ahci 0000:00:1f.2: restoring config space at offset 0x1 (was 0x2b00007, writing 0x2b00407)

[  145.876804] e1000e 0000:01:00.0: restoring config space at offset 0xf (was 0x100, writing 0x10a)

[  145.876804] e1000e 0000:01:00.0: restoring config space at offset 0x6 (was 0x1, writing 0xbc01)

[  145.876804] e1000e 0000:01:00.0: restoring config space at offset 0x4 (was 0x0, writing 0xff6e0000)

[  145.876804] e1000e 0000:01:00.0: restoring config space at offset 0x1 (was 0x100000, writing 0x100007)

[  145.876804] sata_sil24 0000:02:00.0: restoring config space at offset 0xf (was 0x100, writing 0x10b)

[  145.876804] sata_sil24 0000:02:00.0: restoring config space at offset 0xc (was 0x0, writing 0xff800000)

[  145.876804] sata_sil24 0000:02:00.0: restoring config space at offset 0x8 (was 0x1, writing 0xcc01)

[  145.876804] sata_sil24 0000:02:00.0: restoring config space at offset 0x6 (was 0x4, writing 0xff8f8004)

[  145.876804] sata_sil24 0000:02:00.0: restoring config space at offset 0x4 (was 0x4, writing 0xff8ffc04)

[  145.876804] sata_sil24 0000:02:00.0: restoring config space at offset 0x3 (was 0x0, writing 0x8)

[  145.876804] sata_sil24 0000:02:00.0: restoring config space at offset 0x1 (was 0x100000, writing 0x100007)

[  145.876804] PM: early resume of devices complete after 0.707 msecs

[  145.876804] uhci_hcd 0000:00:1d.0: PCI INT A -> Link[LNKH] -> GSI 5 (level, low) -> IRQ 5

[  145.876804] uhci_hcd 0000:00:1d.0: setting latency timer to 64

[  145.876804] usb usb1: root hub lost power or was reset

[  145.876804] uhci_hcd 0000:00:1d.1: PCI INT B -> Link[LNKD] -> GSI 3 (level, low) -> IRQ 3

[  145.876804] uhci_hcd 0000:00:1d.1: setting latency timer to 64

[  145.876804] usb usb2: root hub lost power or was reset

[  145.876804] uhci_hcd 0000:00:1d.2: PCI INT C -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11

[  145.876804] uhci_hcd 0000:00:1d.2: setting latency timer to 64

[  145.876804] usb usb3: root hub lost power or was reset

[  145.876804] uhci_hcd 0000:00:1d.3: PCI INT D -> Link[LNKA] -> GSI 10 (level, low) -> IRQ 10

[  145.876804] uhci_hcd 0000:00:1d.3: setting latency timer to 64

[  145.876804] usb usb4: root hub lost power or was reset

[  145.876804] ehci_hcd 0000:00:1d.7: PCI INT A -> Link[LNKH] -> GSI 5 (level, low) -> IRQ 5

[  145.876804] ehci_hcd 0000:00:1d.7: setting latency timer to 64

[  145.876804] pci 0000:00:1e.0: setting latency timer to 64

[  145.876804] leds_ss4200 0000:00:1f.0: ICH7_IDE_HACK_resume ENTER

[  145.876804] leds_ss4200 0000:00:1f.0: ICH7_IDE_HACK_resume DONE

[  145.876804] ata_piix 0000:00:1f.1: PCI INT A -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11

[  145.876804] ata_piix 0000:00:1f.1: setting latency timer to 64

[  145.876804] ahci 0000:00:1f.2: setting latency timer to 64

[  145.876804] pcieport 0000:00:1c.0: wake-up capability disabled by ACPI

[  145.876804] e1000e 0000:01:00.0: PME# disabled

[  145.876804] e1000e 0000:01:00.0: Disabling ASPM  L1

[  145.876804] e1000e 0000:01:00.0: irq 19 for MSI/MSI-X

[  145.887854] ata7: port disabled. ignoring.

[  145.889344] ata8: port disabled. ignoring.

[  145.889415] sata_sil24 0000:02:00.0: PCI INT A -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11

[  145.889423] sata_sil24 0000:02:00.0: setting latency timer to 64

[  145.889461] sd 0:0:0:0: [sda] Starting disk

[  145.889519] sd 1:0:0:0: [sdb] Starting disk

[  145.889534] sd 3:0:0:0: [sdc] Starting disk

[  145.891184] serial 00:06: activated

[  146.208043] ata3: SATA link down (SStatus 0 SControl 300)

[  147.968043] ata5: SATA link down (SStatus 0 SControl 0)

[  147.968074] ata6: SATA link down (SStatus 0 SControl 0)

[  148.368997] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX

[  155.228039] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[  155.259362] ata2.00: configured for UDMA/133

[  155.508038] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[  155.547453] ata4.00: configured for UDMA/133

[  155.900027] ata1: softreset failed (device not ready)

[  156.392033] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[  156.424078] ata1.00: configured for UDMA/133

[  156.451305] PM: resume of devices complete after 10573.046 msecs

[  156.451407] PM: resume devices took 10.572 seconds

[  156.451410] ------------[ cut here ]------------

[  156.451420] WARNING: at kernel/power/suspend_test.c:53 suspend_devices_and_enter+0x196/0x1d0()

[  156.451424] Hardware name: SS4200-E

[  156.451426] Component: resume devices, time: 10572

[  156.451429] Modules linked in: nfsd nfs lockd nfs_acl auth_rpcgss sunrpc 8021q i2c_i801 serio_raw leds_ss4200 led_class i2c_core rng_core button processor usb_storage sd_mod ata_piix ehci_hcd sata_sil24 uhci_hcd e1000e thermal fan thermal_sys ahci libahci libata scsi_mod [last unloaded: scsi_wait_scan]

[  156.451458] Pid: 2706, comm: s2ram Not tainted 2.6.36-nas #9

[  156.451460] Call Trace:

[  156.451468]  [<ffffffff8104abf1>] ? suspend_devices_and_enter+0x196/0x1d0

[  156.451474]  [<ffffffff8104abf1>] ? suspend_devices_and_enter+0x196/0x1d0

[  156.451480]  [<ffffffff81025e84>] ? warn_slowpath_common+0x78/0x8d

[  156.451485]  [<ffffffff81025f58>] ? warn_slowpath_fmt+0x56/0x5e

[  156.451492]  [<ffffffff8114aa3d>] ? kobject_get+0x12/0x17

[  156.451499]  [<ffffffff811b6238>] ? dpm_resume_end+0x339/0x346

[  156.451504]  [<ffffffff8104adf4>] ? suspend_test_finish+0x49/0x79

[  156.451509]  [<ffffffff8104abf1>] ? suspend_devices_and_enter+0x196/0x1d0

[  156.451514]  [<ffffffff8104ad24>] ? enter_state+0xf9/0x13a

[  156.451519]  [<ffffffff8104a551>] ? state_store+0xb2/0xd4

[  156.451525]  [<ffffffff810cba77>] ? sysfs_write_file+0xd0/0x107

[  156.451532]  [<ffffffff81081bb9>] ? vfs_write+0xac/0x133

[  156.451536]  [<ffffffff81081cfc>] ? sys_write+0x45/0x6e

[  156.451541]  [<ffffffff81002768>] ? system_call_fastpath+0x16/0x1b

[  156.451545] ---[ end trace 41e358c54a3f99a4 ]---

[  156.935351] PM: Finishing wakeup.

[  156.935354] Restarting tasks ... done.
```

Looks like the patch works like expected (the IDE controller shows up after standby) but I assume the problem is that the driver thinks that the two ports are disabled in BIOS. Maybe the pci config for this is not restored properly after standby.

Perhaps these are the bits checked by the following function in ata_piix.c.

```
static int piix_pata_prereset(struct ata_link *link, unsigned long deadline)

{

        struct ata_port *ap = link->ap;

        struct pci_dev *pdev = to_pci_dev(ap->host->dev);

        if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))

                return -ENOENT;

        return ata_sff_prereset(link, deadline);

}
```

```
static struct pci_bits piix_enable_bits[] = {

        { 0x41U, 1U, 0x80UL, 0x80UL },  /* port 0 */

        { 0x43U, 1U, 0x80UL, 0x80UL },  /* port 1 */

};
```

----------

## roarinelk

You seem to know C, so I suggest you add some printk()s to ata_piix and trace where

resume gets stuck.  The patch does what it's supposed to do it seems.

----------

## omega13333

I have played around a little bit and actually the problem is like I assumed.

I analyzed the bits that are checked by

```
 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))
```

in function "piix_pata_prereset" and found out that the bits differ when I boot the kernel with option "test_suspend=mem" from booting without it. I then added a line ata_piix.c to manually override these values with the correct ones and now my IDE disk shows up.   :Very Happy: 

I've changed the function "piix_pata_prereset" in ata_piix.c as shown bellow

```
static int piix_pata_prereset(struct ata_link *link, unsigned long deadline)

{

        struct ata_port *ap = link->ap;

        struct pci_dev *pdev = to_pci_dev(ap->host->dev);

        struct pci_bits *bits = &piix_enable_bits[ap->port_no];

        pci_write_config_byte(pdev, bits->reg, 0xc0);

                /% To control the state of the bits %/

                u8 tmp8 = 0;

                pci_read_config_byte(pdev, bits->reg, &tmp8);

                printk(KERN_ALERT "ICH7 piix_pata_prereset bits %x\n", tmp8);

                dev_info(&pdev->dev, "ICH7 piix_pata_prereset\n");

        if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))

                return -ENOENT;

        return ata_sff_prereset(link, deadline);

}
```

The patch is quite dirty, but I am not so experienced in C or kernel-hacking. For the moment it does the job for me.

EDIT: When I unload the ata_piix module the system freezes immediatly, so I suggest not to use this patch if you like to keep your data safe.Last edited by omega13333 on Mon Nov 22, 2010 6:44 pm; edited 1 time in total

----------

## RottenMutt

omega, how quick does your nas return from standby when accessing your shares?  what is your drive configuration?

mine is 4x hard disks in raid5 off of the sata controllers, and a pata disk with OS.

----------

## RottenMutt

omega, are u able to get speed step working?  I'm running e4600 cpu, and because it isn't throttling I'm leaving 5 watts on the table.  I've enable power management on my four Hitachi 2 TB drives so they spin down which gets me to 42 watts.

----------

## omega13333

My unit is accessible about 10 seconds after wakeup from standby. Im running 3 WD-1TB-drives in a RAID5 setup and my operating system (debian) runs inside a LVM volume on the raid itself. (I'm not using a dedicated drive at the IDE-port at the moment, because I have not found time to migrate it) Therefor my drives also don't spin down, but I've configured my NAS to go back to standby after 30 min of inactivity.

I can't tell you anything about speedstep because I have not changed the celeron CPU.

----------

## buzzone

I have got the SS4200 hardware and am using 4 SATA drives and one PATA drives with Gentoo installed.

I had exactly the same problem that the PATA drive was not recognized by the kernel. Then I found this thread applied the patch, recompiled. Now the PATA drive is recognized:

```

[    4.559614] ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xffa0 irq 14

[    4.724088] ata5.00: ATA-8: SAMSUNG HM160HC, LQ100-10, max UDMA/100

[    4.724093] ata5.00: 312581808 sectors, multi 16: LBA48 

[    4.732066] ata5.00: configured for UDMA/100

```

This is a 2.5 inch notebook PATA HDD. I am using a brand-new modern 80-pin IDE cable and then a 3.5" to 2.5" adapter. What happens now about once every five minutes or so is this:

```

[ 4567.000062] ata5: lost interrupt (Status 0x58)

[ 4567.000112] ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen

[ 4567.000117] ata5.00: BMDMA stat 0x4

[ 4567.000122] ata5.00: failed command: WRITE DMA

[ 4567.000132] ata5.00: cmd ca/00:08:6d:f3:62/00:00:00:00:00/e3 tag 0 dma 4096 out

[ 4567.000134]          res 58/00:08:6d:f3:62/00:00:00:00:00/e3 Emask 0x2 (HSM violation)

[ 4567.000140] ata5.00: status: { DRDY DRQ }

[ 4567.000173] ata5: soft resetting link

[ 4567.164069] ata5.00: configured for UDMA/100

[ 4567.164081] ata5: EH complete

```

I tried to manually set a lower UDMA mode using hdparm. But I can't:

```

$ sudo hdparm -d -X udma3 /dev/sde

/dev/sde:

 setting xfermode to 67 (UltraDMA mode3)

 HDIO_DRIVE_CMD(setxfermode) failed: Input/output error

 HDIO_GET_DMA failed: Inappropriate ioctl for device

```

I tried to set the UDMA mode in the BIOS to a lower value (UDMA3). But Linux still sets it to UDMA5 always.

It can't really check the HDD because I don't have replacement hardware right now. Maybe it is the setup with my cable/adapter or the HDD is really failing?

Does somebody else experience such behavior using the patch? Probably it doesn't have anything to do with the patch?

----------

## roarinelk

either get shorter cables or don't use the ones with 80 wires.

shorter cables mean less surface for EMI;  using 40 wire cables

should make the ata driver omit the >=udma5 modes when it does

cable detection.

hdparm is useless with a modern 2.6 kernel btw.

----------

## VoidMage

 *roarinelk wrote:*   

> hdparm is useless with a modern 2.6 kernel btw.

 

And why is that ?

----------

## roarinelk

I meant to say "not useful for setting DMA modes".  it still has some other uses of course (like spindown time, ...)

----------

## buzzone

great!   :Smile: 

and thanks! i'll go for 40-pin/shorter cables. will report on the results then.

----------

## buzzone

just for the archive:

i tried a 40-pin cable. the hdd was detected by the bios but didn't show up as a boot device. (was a very old cable. presumably broken)

but i was switching now to another solution anyway: i used a compact flash ide adapter that sits directly on the mainboard. now i have a read-only root filesystem on the CF with a rw tmpfs on top (using aufs2) which works just great.

i have no issues anymore with "soft resetting link". also the hdd works perfectly in another setup. so i'm quite confident that it was EMI because of the long IDE cable.

thanks everyone for the replies.   :Smile: 

i consider this post solved/closed for now.

----------

## garyn_87048

Are there any updates to this project?  I realize this thread is about 3yr old.  I also have an ss4200 that I would like to run FreeNAS on.  I'm relatively new to linux, but I would like to build a version of FreeNAS to work in this box.  I recently purchased a 4G DOM to use for this project.

The thread mentioned a possible BIOS update for the ss4200.  Any chance that occurred (wishful thinking!!!)?

Thanks!

Gary

----------

