<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi i'm studing how work ahci in detail. I have instrumented device
    driver code libahci.c, in particular the <i>ahci_qc_issue</i>
    function in that way:<br>
    <br>
    static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)<br>
    {<br>
    .<br>
    .<br>
    .<br>
    if (qc->tf.protocol == ATA_PROT_NCQ){<br>
            printk(KERN_DEBUG "ISSUE[before SACT]: op1 = %lx, op2 =%08x,
    sact = %08x, cmd = %02x\n", 1<<qc->tag,
    port_mmio+PORT_SCR_ACT,readl(port_mmio+PORT_SCR_ACT),qc->tf.command
    & 0xff);<br>
    <br>
            writel(1 << qc->tag, port_mmio + PORT_SCR_ACT);<br>
    <br>
            printk(KERN_DEBUG "ISSUE[before SACT]: op1 = %lx, op2 =%08x,
    sact = %08x, cmd = %02x\n", 1<<qc->tag,
    port_mmio+PORT_SCR_ACT,readl(port_mmio+PORT_SCR_ACT),qc->tf.command
    & 0xff);<br>
    <br>
        }<br>
    .<br>
    .<br>
    .<br>
    printk(KERN_DEBUG "ISSUE[before CI]: op1 = %lx, op2 =%08x, ci =
    %08x, cmd = %02x\n", <br>
                                1<<qc->tag,
    port_mmio+PORT_CMD_ISSUE,readl(port_mmio+PORT_CMD_ISSUE),qc->tf.command
    & 0xff);<br>
        writel(1 << qc->tag, port_mmio + PORT_CMD_ISSUE);<br>
        printk(KERN_DEBUG "ISSUE[before CI]: op1 = %lx, op2 =%08x, ci =
    %08x, cmd = %02x\n", 1<<qc->tag,
    port_mmio+PORT_CMD_ISSUE,readl(port_mmio+PORT_CMD_ISSUE),qc->tf.command
    & 0xff);<br>
    .<br>
    .<br>
    .<br>
    }<br>
    <br>
    When running driver i observe strange behavior: when driver issues a
    NCQ command, SACT register is written with proper value, while CI
    register not. Why? Instead, when driver issues a NON-NCQ command CI
    register is written with proper value. To better explain i show a
    piece of log:<br>
    <br>
    Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before SACT]: op1
    = 1, op2 =f8408134, sact = 00000000, cmd = 61<br>
    Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before SACT]: op1
    = 1, op2 =f8408134, sact = 00000001, cmd = 61<br>
    Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 =
    1, op2 =f8408138, ci = 00000000, cmd = 61<br>
    Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 =
    1, op2 =f8408138, ci = 00000000, cmd = 61<br>
    Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 =
    1, op2 =f8408138, ci = 00000000, cmd = e7<br>
    Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 =
    1, op2 =f8408138, ci = 00000001, cmd = e7<br>
    <br>
    We note that when driver issues a FPDMA WRITE (61) we observe the
    anomaly.<br>
    <br>
    My question is: is there some simplification on device
    implementation? Is there an explanation?<br>
    <br>
    Thanks for helping.<br>
    <br>
    Luigi<br>
  </body>
</html>