From ap25164@groomlake.sfbay.sun.com Tue Jul 15 13:32:19 2008
Received: from sunmail2sca.sfbay.sun.com (sunmail2sca.SFBay.Sun.COM [129.145.155.234])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m6FKWJof024579
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 15 Jul 2008 13:32:19 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail2sca.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m6FKWH3b017214
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@Sun.Com>; Tue, 15 Jul 2008 13:32:18 -0700 (PDT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K4200807EDTUG00@brm-avmta-1.central.sun.com> for PSARC-ext@Sun.Com
 (ORCPT PSARC-ext@Sun.Com); Tue, 15 Jul 2008 14:32:17 -0600 (MDT)
Received: from unknown.sfbay.sun.com ([192.29.77.113])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K4200065EDR7Y80@brm-avmta-1.central.sun.com> for
 PSARC-ext@Sun.Com (ORCPT PSARC-ext@Sun.Com); Tue,
 15 Jul 2008 14:32:15 -0600 (MDT)
Received: from groomlake.sfbay.sun.com (localhost [127.0.0.1])
	by unknown.sfbay.sun.com (8.14.3+Sun/8.14.3) with ESMTP id m6FKVqdn003201;
 Tue, 15 Jul 2008 13:31:52 -0700 (PDT)
Received: (from ap25164@localhost)	by groomlake.sfbay.sun.com
 (8.14.3+Sun/8.14.3/Submit) id m6FKVq9v003198; Tue,
 15 Jul 2008 13:31:52 -0700 (PDT)
Date: Tue, 15 Jul 2008 13:31:52 -0700 (PDT)
From: Alan Perry <ap25164@groomlake.sfbay.sun.com>
Subject: SATA Framework Interface Addition [PSARC/2008/448 Self Review]
To: PSARC-ext@sun.com
Message-id: <200807152031.m6FKVq9v003198@groomlake.sfbay.sun.com>
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
Status: RO
Content-Length: 4238


I am sponsoring the following self-review case for myself.

The producer and consumer of this new interface are basically the same group,
so a PSARC case may seem like overkill.  However, the interfaces and its
updates have all been documented through PSARC cases, so this change should
be documented here as well.

Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 SATA Framework Interface Addition
    1.2. Name of Document Author/Supplier:
	 Author:  Alan Perry
    1.3  Date of This Document:
	15 July, 2008
4. Technical Description

4.1 Background

PSARC 2004/779 defined the HBA module interfaces for the SATA framework.
PSARC 2005/679 expanded those interfaces as needed by the marvell88sx
and si3124 SATA HBA drivers.  PSARC 2007/274 expanded those interfaces
further to support Native Command Queueing (NCQ) and ATAPI devices.

This fast-track details an additional interface for the SATA framework.
 
 
4.2 The Problem

When the SATA framework initializes a SATA command packet structure,
it allocates DMA resources for the buffer associated with the command.
After the command is completed, the SATA framework performs a DMA
sync as part of releasing and freeing resources.

Unfortunately, if the SATA HBA driver writes directly to the buffer,
instead of using DMA, the DMA sync done at command completion can
overwrite the data that the SATA HBA driver wrote to the buffer,
primarly on systems with more than 4GB of memory.


4.3 The Proposal

4.3.1 Summary

Revise the SATA interface to add a function that allows the SATA HBA
to direct the SATA framework to release the DMA resources associated
with a command's buffer.  This will result in the command completion
code not doing a DMA sync on the buffer as part of releasing and
freeing resources.
 
This is being done this way to provide more freedom to the the SATA HBA
drivers to make the determination of how to process commands on a
command-by-command basis (rather than for all commands that the SATA
HBA received).  It will also minimize the impact on existing SATA HBA
drivers.


4.4 Stability level
 
The stability level of the new interface will be the same as the
other interfaces between SATA HBA Framework (SATA module) and
SATA HBA driver, i.e. Consolidation Private.

The requested release binding is micro release and patch release.
 

4.5 Packaging Changes

4.5.1 Binaries Modified
 
/kernel/misc/sata
/kernel/misc/amd64/sata
/usr/include/sys/sata/sata_hba.h
 

4.5.2 Packages Affected

SUNWckr
SUNWhea
 

4.6 References

1. PSARC/2004/779 - SATA Framework Support
2. PSARC/2005/679 - SATA Framework Support (Updated)
3. PSARC/2007/274 - SATA Framework Interface Revision
 
 
5. Interface Table
 
5.1 Exported Interfaces
 
------------------------------------------------------------------------
Interface                    Level          Comments
------------------------------------------------------------------------
 
sata_free_dma_resources()    Consolidation  interface function (new)
                             Private
 
 
5.2 New Interface Function

5.2.1 sata_free_dma_resources
 
NAME
    sata_free_dma_resources

SYNOPSIS
    #include <sys/sata/impl/sata_hba.h>

    void sata_free_dma_resources(sata_pkt_t *sata_pkt);

INTERFACE LEVEL
 
    Consolidation Private

PARAMETERS

    sata_pkt
    Pointer to a sata_pkt_t structure, referring to the SATA command
    packet

DESCRIPTION
    The sata_free_dma_resources function is called by a SATA HBA driver
    to direct the SATA framework to release the DMA resources associated
    with the SATA command packet's buffer.  The SATA framework allocates
    those resources when it initializes the command packet.

    This function is used when the SATA HBA driver directly writes data
    to the buffer that could be overwritten should the SATA framework
    perform a DMA sync.

RETURN VALUES
    Does not return a value.

CONTEXT
    This function can be called from the interrupt context.


6. Resources and Schedule
    6.4. Steering Committee requested information
   	6.4.1. Consolidation C-team Name:
		ON
    6.5. ARC review type: Automatic
    6.6. ARC Exposure: open


