Bug 60565 - NATIVE SECTORS set to 1 on sata_inic162x
Summary: NATIVE SECTORS set to 1 on sata_inic162x
Status: NEW
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: Serial ATA (show other bugs)
Hardware: All Linux
: P1 high
Assignee: Jeff Garzik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-17 10:22 UTC by DE
Modified: 2016-03-19 16:55 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.9.6
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description DE 2013-07-17 10:22:29 UTC
Hello to the libata team again. Guys it is high time to fix some bugs. We have tried to come in contact with the previous maintainer but got no reply. Is libata maintained or what?

After reading:
http://marc.info/?t=137260386000001&r=1&w=2
, we took a look at our initio card using a verified HDD to reproduce it. After booting, we fell into another bug. It appears that the driver is broken. Linux itself identifies that something is wrong:

[    2.132038] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[    2.133114] ata2.00: native sectors (1) is smaller than sectors (78125000)
[    2.133118] ata2.00: ATA-7: ST340212AS, 8.04, max UDMA/133
[    2.133122] ata2.00: 78125000 sectors, multi 0: LBA48 NCQ (depth 0/32)
[    2.134292] ata2.00: configured for UDMA/133
[    2.134414] scsi 1:0:0:0: Direct-Access     ATA      ST340212AS       8.04 PQ: 0 ANSI: 5
[    2.166651] sd 1:0:0:0: [sda] 78125000 512-byte logical blocks: (40.0 GB/37.2 GiB)

Apparently NATIVE MAX ADDRESS EXT is set or read as 1 in our 48bit LBA HDD! HPA is currently not used on this disk. 

hdparm -N detects that problem and gives a warning:

 max sectors   = 78125000/1, HPA setting seems invalid (buggy kernel device driver?)

Tested on debian 7.1.0(kernel 3.2.?) and knoppix 7.2.0(kernel 3.9.6). Switching the disk to the mb AMD AHCI SATA as well as to a PCI SiI HBA removes the issue.
Comment 1 Tejun Heo 2013-07-22 20:43:31 UTC
Unfortunately, at this point, I think the only realistic thing to do about sata_inic162x is marking it unsupported and emit warning during boot. It has never reached production quality with data corruption and we don't have vendor support or people tinkering with it. :(

Thanks.
Comment 2 DE 2013-07-26 12:11:51 UTC
Hello, sadly this driver is not a working driver and not actively maintained... Lets try to fix that! Are you in? We can test any patch you submit.

Our INIC card has one eSATA and one SATA port. Despite that, it was shipped with a RAID ROM! ROM version is 2005 v1.11. When we bought the card, initio had some documents on their site and we still have them. Those are databook v1.3 and v1.4. Reading the databooks versus the driver 0.4 explains the poor results. Driver appears to support only one SATA port. Thus one FIFO, one IDMA engine, one SATA SCR, one LED and so on! You must not have those databooks right?

While driver correctly defines:
	/* IDMA register */
	PORT_IDMA_CTL		= 0x14,
	PORT_IDMA_STAT		= 0x16,

and

	PORT_TF_DATA		= 0x00,
.
.
.

,it fails to mention that those are for channel 0!! Our databook says that Channel 1 CTL is at 0x54, STAT at 0x56 and TF_DATA at 0x40. Also PRD_WRITE is not reserved in our databook. Our SATA port is routed to channel 1 and eSATA port is routed to channel 0 for board layout simplicity. That is verified by following the PCB traces from SATA and eSATA connectors to the SATA IC. We bought today an eSATA to SATA cable but neither SATA channel work right. This driver should not have been present on stable kernels, maybe staging would be appropriate! Didn't anyone test it? Is NR_PORTS		= 2 usefull for anything? Will continue reading to find out what is wrong.
Comment 3 Tejun Heo 2013-07-26 12:42:04 UTC
Yeah, it probably should have been marked broken from the beginning. The controller I tested with had one port and it did work okay with my test setup and the chip never have been popular so it never got too much attention. The driver will print out a warning message during boot now and I'll mark it broken in a cycle or two. Unfortunately, I'm currently a bit too occupied to work on the driver and don't have access to the hardware. If you're interested in it, please go ahead and work on it.

Thanks!
Comment 4 DE 2013-11-05 21:30:27 UTC
Driver has two broken includes(pci_set_dma_max_seg_size replaced blk_queue_max_segment_size thus #include <linux/blkdev.h> can be removed and struct scsi_device *sdev is no longer used so #include <scsi/scsi_device.h> can be removed as well). Further digging is needed. When time permits I will test it with old distributions to detect a working driver version. A person at the mailing list is willing to give his inic PC Card for testing, I will get in touch with him as it will be using only one channel.

I am not happy to inform you that another driver is broken in similar ways. That is an unidentified AIC94xx version. What is worse, my brother has observed sector corruption on a Debian installation that made bad sectors repeatedly in 3 perfectly working stand alone(no RAID sw-hw) IDE HDDs...After that, some configuration changes fixed the problem and we haven't been able to reproduce it again. Be carefull on all libata patches as the wrong ones have license to kill hardware!

Closing I will update the page I have stared for inic at the wiki three years ago. To be specific an addition to limitations concerning single engine operation and an addition to known problems of a big fat warning that 0.4 driver is not working.

Note You need to log in before you can comment on or make changes to this bug.