Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192592
b: refs/heads/master
c: 96d6030
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Garrett authored and Jeff Garzik committed May 14, 2010
1 parent 70960b1 commit bc18a46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1c2a49f61785ebbcbfb481a2aab659020f0457f7
refs/heads/master: 96d60303fd3336893a93565d58c4f1805a327061
18 changes: 18 additions & 0 deletions trunk/drivers/ata/libahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,29 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
return -EINVAL;
}

static int ahci_is_device_present(void __iomem *port_mmio)
{
u8 status = readl(port_mmio + PORT_TFDATA) & 0xff;

/* Make sure PxTFD.STS.BSY and PxTFD.STS.DRQ are 0 */
if (status & (ATA_BUSY | ATA_DRQ))
return 0;

/* Make sure PxSSTS.DET is 3h */
status = readl(port_mmio + PORT_SCR_STAT) & 0xf;
if (status != 3)
return 0;
return 1;
}

void ahci_start_engine(struct ata_port *ap)
{
void __iomem *port_mmio = ahci_port_base(ap);
u32 tmp;

if (!ahci_is_device_present(port_mmio))
return;

/* start DMA */
tmp = readl(port_mmio + PORT_CMD);
tmp |= PORT_CMD_START;
Expand Down

0 comments on commit bc18a46

Please sign in to comment.