# libata nv_sata makes DVDRW appear as CDROM drive [SOLVED]

## jakeluck

on nforce4 ultra board, upgraded from 2.6.16-gentoo-r13 to 2.6.23-gentoo-r3 now the internal SATA DVDRW drive will function only as a readonly drive:

before:

```

[   35.273149] nv_sata: Secondary device removed

[   35.275364]   Vendor: HL-DT-ST  Model: DVDRRW GSA-H30L   Rev: S544

[   35.277681]   Type:   CD-ROM                             ANSI SCSI revision: 05

[   36.443153] sr0: scsi3-mmc drive: 40x/40x writer dvd-ram cd/rw xa/form2 cdda tray

[   36.445373] Uniform CD-ROM driver Revision: 3.20

[   36.447615] sr 1:0:0:0: Attached scsi CD-ROM sr0

[   36.447653] sd 0:0:0:0: Attached scsi generic sg0 type 0

[   36.449897] sr 1:0:0:0: Attached scsi generic sg1 type 5

[   36.452097] sd 2:0:0:0: Attached scsi generic sg2 type 0

[   36.454269] sd 3:0:0:0: Attached scsi generic sg3 type 0

drive name:             sr0

drive speed:            40

drive # of slots:       1

Can close tray:         1

Can open tray:          1

Can lock tray:          1

Can change speed:       1

Can select disk:        0

Can read multisession:  1

Can read MCN:           1

Reports media changed:  1

Can play audio:         1

Can write CD-R:         1

Can write CD-RW:        1

Can read DVD:           1

Can write DVD-R:        1

Can write DVD-RAM:      1

Can read MRW:           1

Can write MRW:          1

Can write RAM:          1

CONFIG_IDE=y

CONFIG_BLK_DEV_IDE=y

CONFIG_BLK_DEV_IDEDISK=y

CONFIG_IDEDISK_MULTI_MODE=y

CONFIG_BLK_DEV_IDECD=y

CONFIG_BLK_DEV_IDEPCI=y

CONFIG_BLK_DEV_IDEDMA_PCI=y

CONFIG_IDEDMA_PCI_AUTO=y

CONFIG_BLK_DEV_AMD74XX=y

CONFIG_BLK_DEV_IDEDMA=y

CONFIG_IDEDMA_AUTO=y

CONFIG_SCSI=y

CONFIG_BLK_DEV_SD=y

CONFIG_BLK_DEV_SR=y

CONFIG_CHR_DEV_SG=y

CONFIG_CHR_DEV_SCH=y

CONFIG_SCSI_MULTI_LUN=y

CONFIG_SCSI_CONSTANTS=y

CONFIG_SCSI_LOGGING=y

CONFIG_SCSI_SPI_ATTRS=y

CONFIG_SCSI_SATA=y

CONFIG_SCSI_SATA_NV=y

```

after

```

[   33.343372] ata2.00: ATAPI: HL-DT-STDVDRRW GSA-H30L, S544, max UDMA/33

[   33.519149] ata2.00: configured for UDMA/33

...

[   33.559682] scsi 1:0:0:0: CD-ROM            HL-DT-ST DVDRRW GSA-H30L  S544 PQ: 0 ANSI: 5

[   33.562155] ata2: bounce limit 0xFFFFFFFF, segment boundary 0xFFFF, hw segs 127

[   33.572477] sr0: scsi3-mmc drive: 0x/0x caddy

[   33.574965] Uniform CD-ROM driver Revision: 3.20

[   33.577499] sr 1:0:0:0: Attached scsi CD-ROM sr0

[   33.577557] sr 1:0:0:0: Attached scsi generic sg1 type 5

drive name:             sr0

drive speed:            0

drive # of slots:       1

Can close tray:         0

Can open tray:          0

Can lock tray:          1

Can change speed:       1

Can select disk:        0

Can read multisession:  1

Can read MCN:           1

Reports media changed:  1

Can play audio:         1

Can write CD-R:         0

Can write CD-RW:        0

Can read DVD:           0

Can write DVD-R:        0

Can write DVD-RAM:      0

Can read MRW:           1

Can write MRW:          1

Can write RAM:          1

CONFIG_IDE=y

CONFIG_BLK_DEV_IDE=y

CONFIG_BLK_DEV_IDEDISK=y

CONFIG_IDEDISK_MULTI_MODE=y

CONFIG_BLK_DEV_IDECD=y

CONFIG_BLK_DEV_IDEPCI=y

CONFIG_IDEPCI_PCIBUS_ORDER=y

CONFIG_BLK_DEV_GENERIC=m

CONFIG_BLK_DEV_IDEDMA_PCI=y

CONFIG_BLK_DEV_AMD74XX=y

CONFIG_BLK_DEV_IDEDMA=y

CONFIG_SCSI=y

CONFIG_SCSI_DMA=y

CONFIG_BLK_DEV_SD=y

CONFIG_BLK_DEV_SR=y

CONFIG_CHR_DEV_SG=y

CONFIG_CHR_DEV_SCH=y

CONFIG_SCSI_MULTI_LUN=y

CONFIG_SCSI_CONSTANTS=y

CONFIG_SCSI_LOGGING=y

CONFIG_SCSI_WAIT_SCAN=m

CONFIG_SCSI_SPI_ATTRS=y

CONFIG_SCSI_LOWLEVEL=y

CONFIG_ATA=y

CONFIG_ATA_ACPI=y

CONFIG_SATA_NV=y

CONFIG_PATA_AMD=y

CONFIG_ATA_GENERIC=y

```

one thing that I had to do in order to get the 2.6.23 kernel to see the root SATA HD is to remove the CONFIG_IDE_GENERIC (Device Drivers-ATA/ATAPI->generic/default IDE chipset support) and I noticed the SATA code all got moved.

Any suggestions?Last edited by jakeluck on Tue Jan 22, 2008 3:51 am; edited 3 times in total

----------

## NeddySeagoon

jakeluck,

Turn off the IDE kernel branch altogether. Chose your devices from the  

```
<*> Serial ATA (prod) and Parallel ATA (experimental) drivers
```

menu.

Be sure to set SCSI CDROM support to on as the libata drivers treat everything as SCSI.

All your drives will become /dev/sd...

Your CDROM will be /dev/sr0

If you need more detial, please post your lspci.

----------

## jakeluck

I disabled the entire IDE branch by unsetting CONFIG_IDE now with

```
CONFIG_BLK_DEV_SD

CONFIG_BLK_DEV_SR

CONFIG_CHR_DEV_SG

CONFIG_CHR_DEV_SCH

CONFIG_SCSI_MULTI_LUN

CONFIG_SCSI_CONSTANTS

CONFIG_SCSI_LOGGING

CONFIG_ATA

CONFIG_SATA_NV

CONFIG_PATA_AMD

CONFIG_ATA_GENERIC
```

after some renaming, my internal SATA, PATA disk drives all seems to work okay. though the dvdrw drive still reports no write:

```

[   31.705874] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

[   31.877736] ata2.00: ATAPI: HL-DT-STDVDRRW GSA-H30L, S544, max UDMA/33

[   32.057512] ata2.00: configured for UDMA/33

...

[   32.089461] scsi 1:0:0:0: CD-ROM            HL-DT-ST DVDRRW GSA-H30L  S544 PQ: 0 ANSI: 5

[   32.091636] ata2: bounce limit 0xFFFFFFFF, segment boundary 0xFFFF, hw segs 127

[   32.101671] sr0: scsi3-mmc drive: 0x/0x caddy

[   32.103910] Uniform CD-ROM driver Revision: 3.20

[   32.106219] sr 1:0:0:0: Attached scsi CD-ROM sr0

[   32.106278] sr 1:0:0:0: Attached scsi generic sg1 type 5

Can write CD-R:         0

Can write CD-RW:        0

Can read DVD:           0

Can write DVD-R:        0

Can write DVD-RAM:      0

```

from lspci -v

```
....

00:06.0 IDE interface: nVidia Corporation CK804 IDE (rev a2) (prog-if 8a [Master SecP PriP])

    Subsystem: Unknown device f695:1011

    Flags: bus master, 66MHz, fast devsel, latency 0

    [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled] [size=8]

    [virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled] [size=1]

    [virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled] [size=8]

    [virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled] [size=1]

    I/O ports at e000 [size=16]

    Capabilities: [44] Power Management version 2

00:07.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev a3) (prog-if 85 [Master SecO PriO])

    Subsystem: EPoX Computer Co., Ltd. Unknown device 1011

    Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 22

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

    I/O ports at 0bf0 [size=4]

    I/O ports at 0970 [size=8]

    I/O ports at 0b70 [size=4]

    I/O ports at cc00 [size=16]

    Memory at fe02b000 (32-bit, non-prefetchable) [size=4K]

    Capabilities: [44] Power Management version 2

00:08.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev a3) (prog-if 85 [Master SecO PriO])

    Subsystem: nVidia Corporation Unknown device cb84

    Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 21

    I/O ports at 09e0 [size=8]

    I/O ports at 0be0 [size=4]

    I/O ports at 0960 [size=8]

    I/O ports at 0b60 [size=4]

    I/O ports at b800 [size=16]

    Memory at fe02a000 (32-bit, non-prefetchable) [size=4K]

    Capabilities: [44] Power Management version 2

...
```

what should I try next?

----------

## NeddySeagoon

jakeluck,

You should have two dev nodes for each CDROM.

/dev/sr0, which is the block device you can mount

/dev/sg0 which is the controlling character device.

If you put a blank CD-R in the drive, can you do a test burn ?

You need to be in the cdrom and cdrw groups

----------

## jakeluck

```
$ id

uid=501(j) gid=100(users) groups=0(root),6(disk),10(wheel),11(floppy),12(mail),14(uucp),17(console),18(audio),19(cdrom),27(video),31(squid),35(games),80(cdrw),85(usb),100(users),250(portage),407(vmware)

brw-rw---- 1 root cdrom 11, 0 Jan 13 20:32 /dev/sr0

crw-rw---- 1 root root  21, 0 Jan 13 20:32 /dev/sg0

lrwxrwxrwx 1 root root 3 Jan 13 20:32 cdrom1 -> sr0

lrwxrwxrwx 1 root root 3 Jan 13 20:32 cdrw1 -> sr0

```

yes, i am both in the cdrom and cdrw group, k3b won't let me burn anything because the drive is identified as a read-only device, (i put in a cdr nonetheless as suggested):

```
No CD/DVD writer found.

K3b did not find an optical writing device in your system. Thus, you will not be able to burn CDs or DVDs. However, you can still use other K3b features like audio track extraction or audio transcoding or ISO9660 image creation.
```

note how the kernel(2.6.23-gentoo-r3)  incorrectly reports the drive as 0x

```
[   32.101671] sr0: scsi3-mmc drive: 0x/0x caddy

[   32.103910] Uniform CD-ROM driver Revision: 3.20

```

vs the previously identified with 2.6.16-gentoo-r13:

```
[   36.443153] sr0: scsi3-mmc drive: 40x/40x writer dvd-ram cd/rw xa/form2 cdda tray

[   36.445373] Uniform CD-ROM driver Revision: 3.20

```

and adding  

```
libata.atapi_enabled=1
```

to the kernel commandline didn't help either.

help.

----------

## jakeluck

just tested on the latest vanilla 2.6.24-rc7, same problem, /proc/sys/dev/cdrom/info reports the drive as 0x speed. could this be a libata bug?

----------

## NeddySeagoon

jakeluck,

Post your kernel config please. I have different hardware to you but I can write CDs/DVDs ok with those kernels.

----------

## jakeluck

here is the kernel config

http://10k.org/jake/config-0cdrom.txt

----------

## NeddySeagoon

jakeluck,

You should not need 

```
CONFIG_ATA_GENERIC=y
```

```
CONFIG_SATA_NV=y

CONFIG_PATA_AMD=y
```

cover your hardware

----------

## jakeluck

disabled CONFIG_ATA_GENERIC in 2.6.23-gentoo-r3, 

issue remains, still see:

```
drive name:             sr0

drive speed:            0

....

```

help.

----------

## jakeluck

working 2.6.16 kernel boot log

http://tinyurl.com/2xtzjf

broken 2.6.23.9 kernel boot log

http://tinyurl.com/yvkq6v

----------

## jakeluck

Thanks to Tejun Heo from the linux-ide dev team for insight,  it turns out 

there is a bug in the nv_sata driver where ADMA fails for a system 

with >=4GB of memory 

adding the boot flag 

```
sata_nv.adma=0
```

in grub works around this bug.

I hope this note will save someone else a few hours down the road. yahoo,

back to burning dvds!

----------

