# Problems with SATA and PATA on 2.6.17

## Thorium

I am running gentoo-sources-2.6.17-r1 on a laptop with the following hardware. I have been able to get the SATA harddrive detected and working correctly, but the DVD drive has resisted all efforts thus far.

```

00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS/940GML and 945GT Express Memory Controller Hub (rev 03)

00:01.0 PCI bridge: Intel Corporation Mobile 945GM/PM/GMS/940GML and 945GT Express PCI Express Root Port (rev 03)

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)

00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)

00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)

00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 02)

00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 02)

00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 02)

00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 02)

00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 02)

00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)

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

00:1f.0 ISA bridge: Intel Corporation 82801GHM (ICH7-M DH) LPC Interface Bridge (rev 02)

00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) Serial ATA Storage Controller IDE (rev 02)

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

01:00.0 VGA compatible controller: nVidia Corporation Unknown device 0299 (rev a1)

02:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)

06:07.0 CardBus bridge: Texas Instruments PCIxx12 Cardbus Controller

06:07.1 FireWire (IEEE 1394): Texas Instruments Unknown device 803a

06:07.2 Mass storage controller: Texas Instruments 5-in-1 Multimedia Card Reader (SD/MMC/MS/MS PRO/xD)

06:07.3 Class 0805: Texas Instruments Unknown device 803c

06:0b.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)

```

Relevant dmesg output:

```

libata version 1.20 loaded.

ata_piix 0000:00:1f.2: version 1.05

ata_piix 0000:00:1f.2: MAP [ P0 P2 IDE IDE ]

ACPI: PCI Interrupt 0000:00:1f.2[B] -> GSI 19 (level, low) -> IRQ 19

PCI: Setting latency timer of device 0000:00:1f.2 to 64

ata1: SATA max UDMA/133 cmd 0x1F0 ctl 0x3F6 bmdma 0x18B0 irq 14

ata1: dev 0 cfg 49:0f00 82:746b 83:7f69 84:4063 85:7469 86:3d49 87:4063 88:203f

ata1: dev 0 ATA-7, max UDMA/100, 195371568 sectors: LBA48

ata1: dev 0 configured for UDMA/100

scsi0 : ata_piix

  Vendor: ATA       Model: HTS721010G9SA00   Rev: MCZO

  Type:   Direct-Access                      ANSI SCSI revision: 05

ata2: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0x18B8 irq 15

scsi1 : ata_piix

SCSI device sda: 195371568 512-byte hdwr sectors (100030 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: drive cache: write back

SCSI device sda: 195371568 512-byte hdwr sectors (100030 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: drive cache: write back

 sda: sda1 sda2 sda3 sda4

sd 0:0:0:0: Attached scsi disk sda

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

```

I have searched through these forums and many other sites for a solution, but none of the solutions worked for me. I have tried booting with and without combined_mode=libata and libata.atapi_enabled=1 as kernel parameters. I even tried changing a few #undef lines in  include/linux/libata.h since that had worked for people back in 2.6.15. After trying many approaches I switched over to 2.6.16 to see if I could get that to work instead. I even tried compiling kernel configs posted from people who had equivalent hardware that worked for them. 

I have tried compiling the kernel with and without ATA/ATAPI support but had no luck there either. Here is my current kernel config relevant to this problem:

```

# SCSI device support

#

# CONFIG_RAID_ATTRS is not set

CONFIG_SCSI=y

CONFIG_SCSI_PROC_FS=y

#

# SCSI support type (disk, tape, CD-ROM)

#

CONFIG_BLK_DEV_SD=y

# CONFIG_CHR_DEV_ST is not set

# CONFIG_CHR_DEV_OSST is not set

CONFIG_BLK_DEV_SR=y

# CONFIG_BLK_DEV_SR_VENDOR is not set

CONFIG_CHR_DEV_SG=y

# CONFIG_CHR_DEV_SCH is not set

#

# Some SCSI devices (e.g. CD jukebox) support multiple LUNs

#

CONFIG_SCSI_MULTI_LUN=y

# CONFIG_SCSI_CONSTANTS is not set

# CONFIG_SCSI_LOGGING is not set

...

#

# SCSI low-level drivers

#

# CONFIG_ISCSI_TCP is not set

# CONFIG_BLK_DEV_3W_XXXX_RAID is not set

# CONFIG_# CONFIG_SCSI_ACARD is not set

...

CONFIG_SCSI_SATA=y

# CONFIG_SCSI_SATA_AHCI is not set

# CONFIG_SCSI_SATA_SVW is not set

CONFIG_SCSI_ATA_PIIX=y

...

```

Everything that I skipped over with "..." is not set. Currently I am not compiling any ATA support into the kernel. I have tried using the AHCI driver, but my hardware is not supported by it. Furthermore, I have tried to get the drive to be recognized as a SCSI CD/DVD writer, but all that ever gets created is a generic scsi device node.

Does anyone have insights into this problem? Have I overlooked anything obvious in the kernel or miss any announcements about changes to the libata structure?

----------

## chrismortimore

For getting your optical drive to be SCSI emulated, did you remember to use "hd?=ide-scsi" in your boot parameters?

----------

## Thorium

 *Quote:*   

> For getting your optical drive to be SCSI emulated, did you remember to use "hd?=ide-scsi" in your boot parameters?

 

I just tried that, but it didn't work. The main problem is that I cannot get the drive recognized beyond being assigned a generic scsi device node. I have built the kernel without any SATA support to get the drive assigned some /dev/hd? node, but only my harddrive was recognized as usual. 

Strangely enough, the 2006.0 livecd takes care of everything flawlessly. Perhaps I should revert to using 2.6.15. I just thought more problems would have been fixed with the interface between the two kernel versions. It will be interesting to see how the 2006.1 release performs.

Is anyone who had these types of problems with earlier kernels running 2.6.17 yet? Most of the related threads in the forums deal with earlier kernels.

----------

## Thorium

I think the problem I am having can be found on this webpage. 

For those who don't want to browse the other site here is the relevant section:

 *Quote:*   

> 
> 
> DVD drive not recognized
> 
> The ata_piix SATA driver grabs ownership over the IDE ports when it is loaded, but (by default) does not support PATA ATAPI devices such as the Ultrabay optical drives. Thus, if the ide driver is compiled as a module and loaded after ata_piix, the DVD drive will not be recognized by either driver.
> ...

 

I have tried the first and second options, but neither work for me. I dread having to resort to the final measure as I like my kernels trim and mainly monolithic, especially when dealing with drivers needed to load the root partition. However, I know this option works because the 2006.0 livecd boots in this manner and works fine for me.

Does anyone (especially those with similar hardware, e.g. Thinkpad X60, and other laptops with similar chipsets) have any suggestions before I submit and use the third option?

On a sidenote, do the include/linux/libata.h hacks still do something in 2.6.17? They didn't seem to affect anything for me, which isn't too surprising.

----------

## vonr

I have the same sata controller. The livecd assigns the cdrom-drive to /dev/hdc. Gentoo-sources-2.6.17-r2 on the other hand, for me automatically assigns the drive to /dev/sr0 (this is with no ide support compiled in, just the ata_piix driver, and without passing any kernel parameters). It seems to be working okay.

If I compile in ide-support the drive gets assigned to /dev/hdc, just like the livecd does. The problem here, which is also mentioned on the website you are referring to, and which also holds true for the livecd, is that dma is not working this way.

----------

## Thorium

Perhaps my problems are stemming from a bad or out of date BIOS since you and many other people with the same sata controller have working cd/dvd drives with SCSI support. I just updated to gentoo-sources-2.6.17-r2, but my drive is still not assigned a device node beyond a generic SCSI node (/dev/sg0).

----------

## vonr

The relevant part of my .config (I still have to sort this out further since I just finished installing. Also, I have to correct myself: I have ide support compiled in, just not for the controller):

```

[...]

#

# ATA/ATAPI/MFM/RLL support

#

CONFIG_IDE=y

CONFIG_BLK_DEV_IDE=y

#

# Please see Documentation/ide.txt for help/info on IDE drives

#

# CONFIG_BLK_DEV_IDE_SATA is not set

# CONFIG_BLK_DEV_HD_IDE is not set

CONFIG_BLK_DEV_IDEDISK=y

# CONFIG_IDEDISK_MULTI_MODE is not set

CONFIG_BLK_DEV_IDECD=y

# CONFIG_BLK_DEV_IDETAPE is not set

# CONFIG_BLK_DEV_IDEFLOPPY is not set

# CONFIG_BLK_DEV_IDESCSI is not set

# CONFIG_IDE_TASK_IOCTL is not set

#

# IDE chipset support/bugfixes

#

# CONFIG_IDE_GENERIC is not set

# CONFIG_BLK_DEV_CMD640 is not set

# CONFIG_BLK_DEV_IDEPNP is not set

# CONFIG_BLK_DEV_IDEPCI is not set

# CONFIG_IDE_ARM is not set

# CONFIG_BLK_DEV_IDEDMA is not set

# CONFIG_IDEDMA_AUTO is not set

# CONFIG_BLK_DEV_HD is not set

#

# SCSI device support

#

# CONFIG_RAID_ATTRS is not set

CONFIG_SCSI=y

# CONFIG_SCSI_PROC_FS is not set

#

# SCSI support type (disk, tape, CD-ROM)

#

CONFIG_BLK_DEV_SD=y

# CONFIG_CHR_DEV_ST is not set

# CONFIG_CHR_DEV_OSST is not set

CONFIG_BLK_DEV_SR=y

# CONFIG_BLK_DEV_SR_VENDOR is not set

CONFIG_CHR_DEV_SG=y

# CONFIG_CHR_DEV_SCH is not set

#

# Some SCSI devices (e.g. CD jukebox) support multiple LUNs

#

CONFIG_SCSI_MULTI_LUN=y

# CONFIG_SCSI_CONSTANTS is not set

# CONFIG_SCSI_LOGGING is not set

#

# SCSI Transport Attributes

#

# CONFIG_SCSI_SPI_ATTRS is not set

# CONFIG_SCSI_FC_ATTRS is not set

# CONFIG_SCSI_ISCSI_ATTRS is not set

# CONFIG_SCSI_SAS_ATTRS is not set

#

# SCSI low-level drivers

#

# CONFIG_ISCSI_TCP is not set

# CONFIG_BLK_DEV_3W_XXXX_RAID is not set

# CONFIG_SCSI_3W_9XXX is not set

# CONFIG_SCSI_ACARD is not set

# CONFIG_SCSI_AACRAID is not set

# CONFIG_SCSI_AIC7XXX is not set

# CONFIG_SCSI_AIC7XXX_OLD is not set

# CONFIG_SCSI_AIC79XX is not set

# CONFIG_SCSI_DPT_I2O is not set

# CONFIG_SCSI_ADVANSYS is not set

# CONFIG_MEGARAID_NEWGEN is not set

# CONFIG_MEGARAID_LEGACY is not set

# CONFIG_MEGARAID_SAS is not set

CONFIG_SCSI_SATA=y

# CONFIG_SCSI_SATA_AHCI is not set

# CONFIG_SCSI_SATA_SVW is not set

CONFIG_SCSI_ATA_PIIX=y

# CONFIG_SCSI_SATA_MV is not set

# CONFIG_SCSI_SATA_NV is not set

# CONFIG_SCSI_PDC_ADMA is not set

# CONFIG_SCSI_SATA_QSTOR is not set

# CONFIG_SCSI_SATA_PROMISE is not set

# CONFIG_SCSI_SATA_SX4 is not set

# CONFIG_SCSI_SATA_SIL is not set

# CONFIG_SCSI_SATA_SIL24 is not set

# CONFIG_SCSI_SATA_SIS is not set

# CONFIG_SCSI_SATA_ULI is not set

# CONFIG_SCSI_SATA_VIA is not set

# CONFIG_SCSI_SATA_VITESSE is not set

CONFIG_SCSI_SATA_INTEL_COMBINED=y

[...]

```

Relevant part of /var/log/messages:

```

[...]

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

libata version 1.20 loaded.

ata_piix 0000:00:1f.2: version 1.05

ata_piix 0000:00:1f.2: MAP [ P0 P2 IDE IDE ]

PCI: Setting latency timer of device 0000:00:1f.2 to 64

ata1: SATA max UDMA/133 cmd 0x1F0 ctl 0x3F6 bmdma 0x18B0 irq 14

ata1: dev 0 cfg 49:2f00 82:746b 83:7d09 84:6063 85:7469 86:3d09 87:6063 88:203f

ata1: dev 0 ATA-7, max UDMA/100, 117210240 sectors: LBA48

ata1: dev 0 configured for UDMA/100

scsi0 : ata_piix

Vendor: ATA       Model: TOSHIBA MK6034GS  Rev: AH10

Type:   Direct-Access                      ANSI SCSI revision: 05

ata2: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0x18B8 irq 15

ata2: dev 0 cfg 49:0f00 82:0000 83:0000 84:0000 85:0000 86:0000 87:0000 88:0407

ata2: dev 0 ATAPI, max UDMA/33

ata2: dev 0 configured for UDMA/33

scsi1 : ata_piix

Vendor: MATSHITA  Model: DVD-RAM UJ-841S   Rev: 1.60

Type:   CD-ROM                             ANSI SCSI revision: 05

SCSI device sda: 117210240 512-byte hdwr sectors (60012 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: drive cache: write back

SCSI device sda: 117210240 512-byte hdwr sectors (60012 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: drive cache: write back

sda: sda1 sda2 sda3 sda4 < sda5 >

sd 0:0:0:0: Attached scsi disk sda

sr0: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray

Uniform CD-ROM driver Revision: 3.20

sr 1:0:0:0: Attached scsi CD-ROM sr0

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

sr 1:0:0:0: Attached scsi generic sg1 type 5

[...]

```

Looking at the line ata2: dev 0 ATAPI, max UDMA/33, it would appear the ATAPI driver is used for the cdrom.

----------

## Thorium

Well, your using your kernel options didn't change anything for me. My kernel log looks exactly the same as the one in my first post. Thanks anyway, I am open to trying almost anything to get this drive working. 

I also tried using mm-sources-2.6.18_rc1-r1 to see if the updated libata system altered anything, but nothing changed. Tomorrow I may check if there are bios updates available. If that doesn't work, I may have to submit to a genkernel-type approach so I can force the ATA module to load before the libata driver takes control.

It is strange that the PATA support in the libata system doesn't work for me, but others are having few problems with it running recent kernel versions (at least it seems like most of the threads dealing with similar topics use 2.6.12-2.6.15).

----------

