From 4447e221635c42579c488b9686519df9803ca987 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 01:32:19 -0500 Subject: [PATCH] --- yaml --- r: 14004 b: refs/heads/master c: 02eaa66629a29cd5712fe81a360c3ab5b1fc9531 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/scsi/ahci.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 224196e0afa2..2560776fca79 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 828d09de4a6c922517f533093583b9fe8cbf5808 +refs/heads/master: 02eaa66629a29cd5712fe81a360c3ab5b1fc9531 diff --git a/trunk/drivers/scsi/ahci.c b/trunk/drivers/scsi/ahci.c index 7b0640bc0079..4e96ec5f2ff9 100644 --- a/trunk/drivers/scsi/ahci.c +++ b/trunk/drivers/scsi/ahci.c @@ -134,6 +134,7 @@ enum { PORT_IRQ_D2H_REG_FIS, /* PORT_CMD bits */ + PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */ @@ -441,7 +442,7 @@ static void ahci_phy_reset(struct ata_port *ap) void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; struct ata_taskfile tf; struct ata_device *dev = &ap->device[0]; - u32 tmp; + u32 new_tmp, tmp; __sata_phy_reset(ap); @@ -455,8 +456,21 @@ static void ahci_phy_reset(struct ata_port *ap) tf.nsect = (tmp) & 0xff; dev->class = ata_dev_classify(&tf); - if (!ata_dev_present(dev)) + if (!ata_dev_present(dev)) { ata_port_disable(ap); + return; + } + + /* Make sure port's ATAPI bit is set appropriately */ + new_tmp = tmp = readl(port_mmio + PORT_CMD); + if (dev->class == ATA_DEV_ATAPI) + new_tmp |= PORT_CMD_ATAPI; + else + new_tmp &= ~PORT_CMD_ATAPI; + if (new_tmp != tmp) { + writel(new_tmp, port_mmio + PORT_CMD); + readl(port_mmio + PORT_CMD); /* flush */ + } } static u8 ahci_check_status(struct ata_port *ap)