Skip to contentSkip to conversation

sil24: add ATAPI support

PATCH Jeff Garzik 2 participants 2 messages Nov 16, 2005 1 message not in the archive libata

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jeff Garzik

author NAK
#1 lore raw
Quoted 5 lines · Tejun Heo
(quoted diff) +5 -0
+	case ATA_PROT_ATAPI:
+	case ATA_PROT_ATAPI_DMA:
+	case ATA_PROT_ATAPI_NODATA:
+		prb = &cb->atapi.prb;
+		sge = cb->atapi.sge;

Review

Quoted 10 lines
(quoted diff) +10 -0
+		memset(cb->atapi.cdb, 0, 32);
+		memcpy(cb->atapi.cdb, qc->cdb, ap->cdb_len);
+
+		if (unlikely((ap->cdb_len == 16) ^ pp->cdb16)) {
+			pp->cdb16 = ap->cdb_len == 16;
+			if (pp->cdb16)
+				writel(PORT_CS_CDB16, port + PORT_CTRL_STAT);
+			else
+				writel(PORT_CS_CDB16, port + PORT_CTRL_CLR);
+		}

NAK:
* you should set PORT_CS_CDB16 from ->dev_config(), not needlessly test inside the fast path
* thus, no need to cache cdb16 flag. just tell the hardware once, and then everybody agrees on the correct value.

Review static int sil24_port_start(struct ata_p · line 808

Quoted 8 lines
(quoted diff) +3 -0
@@ -772,6 +802,9 @@ static int sil24_port_start(struct ata_p
 
 	ap->private_data = pp;
 
+	/* default to 12byte CDB */
+	writel(PORT_CS_CDB16, port + PORT_CTRL_CLR);
+
 	return 0;

If you set it in ->dev_config(), this should go away.

Jeff

#2 lore raw
Quoted 19 lines · Jeff Garzik
Quoted 5 lines · Tejun Heo
(quoted diff) +5 -0
+    case ATA_PROT_ATAPI:
+    case ATA_PROT_ATAPI_DMA:
+    case ATA_PROT_ATAPI_NODATA:
+        prb = &cb->atapi.prb;
+        sge = cb->atapi.sge;

Review

Quoted 10 lines
(quoted diff) +10 -0
+        memset(cb->atapi.cdb, 0, 32);
+        memcpy(cb->atapi.cdb, qc->cdb, ap->cdb_len);
+
+        if (unlikely((ap->cdb_len == 16) ^ pp->cdb16)) {
+            pp->cdb16 = ap->cdb_len == 16;
+            if (pp->cdb16)
+                writel(PORT_CS_CDB16, port + PORT_CTRL_STAT);
+            else
+                writel(PORT_CS_CDB16, port + PORT_CTRL_CLR);
+        }
Quoted 4 lines

NAK:
* you should set PORT_CS_CDB16 from ->dev_config(), not needlessly test inside the fast path
* thus, no need to cache cdb16 flag. just tell the hardware once, and then everybody agrees on the correct value.

Oh.. I didn't know about ->dev_config(). Thanks for pointing out.

Quoted 5 lines
Quoted 5 lines
(quoted diff) +0 -0
@@ -772,6 +802,9 @@ static int sil24_port_start(struct ata_p
 
     ap->private_data = pp;
 
Quoted 7 lines

Review static int sil24_port_start(struct ata_p · line 808

Quoted 4 lines
(quoted diff) +3 -0
+    /* default to 12byte CDB */
+    writel(PORT_CS_CDB16, port + PORT_CTRL_CLR);
+
     return 0;

If you set it in ->dev_config(), this should go away.

Sure.

Signature · 1 line
tejun