Skip to contentSkip to conversation

sata_sil problem / oops

DISCUSSION Marcus Meissner 4 participants 6 messages Jun 2, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi folks,

We see a problem in the sata_sil driver. The code looks like this:

        cls=sil_get_device_cache_line(pdev);
        cls >>= 3;
        cls++;  /* cls = (line_size/8)+1 */
        writeb(cls, mmio_base + SIL_FIFO_R0);
        writeb(cls, mmio_base + SIL_FIFO_W0);
        writeb(cls, mmio_base + SIL_FIFO_R1);
        writeb(cls, mmio_base + SIL_FIFO_W2);

We have a device where mmio_base is only 0x200 byte long, so the access to SIL_FIFO_W2 (offset 0x241) causes an Oops.

- Should it perhaps be W1 instead of W2?

- If not, does it need a range check?

sysfs PCI data:

pci device: name = 0000:00:0a.0, bus_id = 0000:00:0a.0, bus = pci

    path = /devices/pci0000:00/0000:00:0a.0
    class = 0x10400
    vendor = 0x1095
    device = 0x3112
    subvendor = 0x1095
    subdevice = 0x6112
    irq = 5
    res[0] = 0xdc00 0xdc07 0x101
    res[1] = 0xd800 0xd803 0x101
    res[2] = 0xd400 0xd407 0x101
    res[3] = 0xd000 0xd003 0x101
    res[4] = 0xcc00 0xcc0f 0x101
    res[5] = 0xcffffe00 0xcfffffff 0x200
    res[6] = 0xcff00000 0xcff7ffff 0x7200
    config[64]

Ciao, Marcus

#1 lore raw
Quoted 10 lines · Marcus Meissner

We see a problem in the sata_sil driver. The code looks like this:

	 cls=sil_get_device_cache_line(pdev);
	 cls >>= 3;
	 cls++;  /* cls = (line_size/8)+1 */
	 writeb(cls, mmio_base + SIL_FIFO_R0);
	 writeb(cls, mmio_base + SIL_FIFO_W0);
	 writeb(cls, mmio_base + SIL_FIFO_R1);
	 writeb(cls, mmio_base + SIL_FIFO_W2);
Quoted 5 lines

We have a device where mmio_base is only 0x200 byte long, so the access to SIL_FIFO_W2 (offset 0x241) causes an Oops.

- Should it perhaps be W1 instead of W2?
- If not, does it need a range check?

My OS/2 driver and the Windows driver write to the following locations:

SiI3112: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45
SiI3114: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45,

	 BAR5+0x240, BAR5+0x241, BAR5+0x244, BAR5+0x245

Ciao,
Dani

#2 lore raw
Quoted 15 lines · Daniela Engert
Quoted 13 lines · Marcus Meissner

We see a problem in the sata_sil driver. The code looks like this:

	 cls=sil_get_device_cache_line(pdev);
	 cls >>= 3;
	 cls++;  /* cls = (line_size/8)+1 */
	 writeb(cls, mmio_base + SIL_FIFO_R0);
	 writeb(cls, mmio_base + SIL_FIFO_W0);
	 writeb(cls, mmio_base + SIL_FIFO_R1);
	 writeb(cls, mmio_base + SIL_FIFO_W2);

We have a device where mmio_base is only 0x200 byte long, so the access to SIL_FIFO_W2 (offset 0x241) causes an Oops.

Quoted 8 lines
Quoted 2 lines

- Should it perhaps be W1 instead of W2?
- If not, does it need a range check?

My OS/2 driver and the Windows driver write to the following locations:

SiI3112: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45
SiI3114: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45,

	 BAR5+0x240, BAR5+0x241, BAR5+0x244, BAR5+0x245

Does the 3112 have two ports and the 3114 four?

Signature · 1 line
Jens Axboe
#3 lore raw
Quoted 19 lines · Jens Axboe
Quoted 18 lines · Daniela Engert
Quoted 15 lines · Marcus Meissner

We see a problem in the sata_sil driver. The code looks like this:

	 cls=sil_get_device_cache_line(pdev);
	 cls >>= 3;
	 cls++;  /* cls = (line_size/8)+1 */
	 writeb(cls, mmio_base + SIL_FIFO_R0);
	 writeb(cls, mmio_base + SIL_FIFO_W0);
	 writeb(cls, mmio_base + SIL_FIFO_R1);
	 writeb(cls, mmio_base + SIL_FIFO_W2);

We have a device where mmio_base is only 0x200 byte long, so the access to SIL_FIFO_W2 (offset 0x241) causes an Oops.

- Should it perhaps be W1 instead of W2?
- If not, does it need a range check?

Quoted 7 lines
Quoted 5 lines

My OS/2 driver and the Windows driver write to the following locations:

SiI3112: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45
SiI3114: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45,

	 BAR5+0x240, BAR5+0x241, BAR5+0x244, BAR5+0x245

Does the 3112 have two ports and the 3114 four?

Seems that is so, from looking at the driver. If I were to guess at a fix for this, it would be as follows.

drivers/scsi/sata_sil.c +7 -1
@@ -432,7 +432,13 @@ static int sil_init_one (struct pci_dev 
 		writeb(cls, mmio_base + SIL_FIFO_R0);
 		writeb(cls, mmio_base + SIL_FIFO_W0);
 		writeb(cls, mmio_base + SIL_FIFO_R1);
-		writeb(cls, mmio_base + SIL_FIFO_W2);
+		writeb(cls, mmio_base + SIL_FIFO_W1);
+		if (ent->driver_data == sil_3114) {
+			writeb(cls, mmio_base + SIL_FIFO_R2);
+			writeb(cls, mmio_base + SIL_FIFO_W2);
+			writeb(cls, mmio_base + SIL_FIFO_R3);
+			writeb(cls, mmio_base + SIL_FIFO_W3);
+		}
 	} else
 		printk(KERN_WARNING DRV_NAME "(%s): cache line size not set.  Driver may not function\n",
 			pci_name(pdev));
Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 8 lines · Jens Axboe

Seems that is so, from looking at the driver. If I were to guess at a fix for this, it would be as follows.

drivers/scsi/sata_sil.c +0 -0
@@ -432,7 +432,13 @@ static int sil_init_one (struct pci_dev 
 		writeb(cls, mmio_base + SIL_FIFO_R0);

drivers/scsi/sata_sil.c static int sil_init_one (struct pci_dev · line 441

Quoted 10 lines
drivers/scsi/sata_sil.c +7 -1
 		writeb(cls, mmio_base + SIL_FIFO_W0);
 		writeb(cls, mmio_base + SIL_FIFO_R1);
-		writeb(cls, mmio_base + SIL_FIFO_W2);
+		writeb(cls, mmio_base + SIL_FIFO_W1);
+		if (ent->driver_data == sil_3114) {
+			writeb(cls, mmio_base + SIL_FIFO_R2);
+			writeb(cls, mmio_base + SIL_FIFO_W2);
+			writeb(cls, mmio_base + SIL_FIFO_R3);
+			writeb(cls, mmio_base + SIL_FIFO_W3);
+		}

This definitely looks like a needed fix to me.

Can someone confirm that this fixes the reported problem?

Jeff

#5 lore raw
In reply to Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 5 lines · Daniela Engert

My OS/2 driver and the Windows driver write to the following locations:

SiI3112: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45
SiI3114: BAR5+0x40, BAR5+0x41, BAR5+0x44, BAR5+0x45,

	 BAR5+0x240, BAR5+0x241, BAR5+0x244, BAR5+0x245

Does the 3112 have two ports and the 3114 four?

Exactly.

Ciao,
Dani