Home | History | Annotate | Line # | Download | only in ata
satareg.h revision 1.5.102.1
      1  1.5.102.1  thorpej /*	$NetBSD: satareg.h,v 1.5.102.1 2021/01/03 16:34:57 thorpej Exp $	*/
      2        1.1  thorpej 
      3        1.1  thorpej /*-
      4        1.1  thorpej  * Copyright (c) 2003 The NetBSD Foundation, Inc.
      5        1.1  thorpej  * All rights reserved.
      6        1.1  thorpej  *
      7        1.1  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8        1.1  thorpej  * by Jason R. Thorpe of Wasabi Systems, Inc.
      9        1.1  thorpej  *
     10        1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     11        1.1  thorpej  * modification, are permitted provided that the following conditions
     12        1.1  thorpej  * are met:
     13        1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     14        1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     15        1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16        1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     17        1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     18        1.1  thorpej  *
     19        1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20        1.1  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21        1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22        1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23        1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24        1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25        1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26        1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27        1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28        1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29        1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     30        1.1  thorpej  */
     31        1.1  thorpej 
     32        1.1  thorpej #ifndef _DEV_ATA_SATAREG_H_
     33        1.1  thorpej #define	_DEV_ATA_SATAREG_H_
     34        1.1  thorpej 
     35        1.1  thorpej /*
     36        1.1  thorpej  * Serial ATA register definitions.
     37        1.1  thorpej  *
     38        1.1  thorpej  * Reference:
     39        1.1  thorpej  *
     40        1.1  thorpej  *	Serial ATA: High Speed Serialized AT Attachment
     41        1.3      wiz  *	Revision 1.0 29-August-2001
     42        1.1  thorpej  *	Serial ATA Working Group
     43        1.1  thorpej  */
     44        1.1  thorpej 
     45        1.1  thorpej /*
     46        1.1  thorpej  * SStatus (SCR0) --
     47        1.1  thorpej  *	Serial ATA interface status register
     48        1.1  thorpej  */
     49        1.1  thorpej 	/*
     50        1.1  thorpej 	 * The DET value indicates the interface device detection and
     51        1.1  thorpej 	 * PHY state.
     52        1.1  thorpej 	 */
     53        1.1  thorpej #define	SStatus_DET_NODEV	(0x0 << 0)	/* no device connected */
     54        1.1  thorpej #define	SStatus_DET_DEV_NE	(0x1 << 0)	/* device, but PHY comm not
     55        1.1  thorpej 						   established */
     56        1.1  thorpej #define	SStatus_DET_DEV		(0x3 << 0)	/* device, PHY comm
     57        1.1  thorpej 						   established */
     58        1.1  thorpej #define	SStatus_DET_OFFLINE	(0x4 << 0)	/* PHY in offline mode */
     59        1.1  thorpej #define	SStatus_DET_mask	(0xf << 0)
     60        1.1  thorpej #define	SStatus_DET_shift	0
     61        1.1  thorpej 	/*
     62        1.1  thorpej 	 * The SPD value indicates the negotiated interface communication
     63        1.1  thorpej 	 * speed established.
     64        1.1  thorpej 	 */
     65        1.1  thorpej #define	SStatus_SPD_NONE	(0x0 << 4)	/* no negotiated speed */
     66        1.1  thorpej #define	SStatus_SPD_G1		(0x1 << 4)	/* Generation 1 (1.5Gb/s) */
     67        1.2  thorpej #define	SStatus_SPD_G2		(0x2 << 4)	/* Generation 2 (3.0Gb/s) */
     68  1.5.102.1  thorpej #define	SStatus_SPD_G3		(0x3 << 4)	/* Generation 3 (6.0Gb/s) */
     69        1.1  thorpej #define	SStatus_SPD_mask	(0xf << 4)
     70        1.1  thorpej #define	SStatus_SPD_shift	4
     71        1.1  thorpej 	/*
     72        1.1  thorpej 	 * The IPM value indicates the current interface power managemnt
     73        1.1  thorpej 	 * state.
     74        1.1  thorpej 	 */
     75        1.1  thorpej #define	SStatus_IPM_NODEV	(0x0 << 8)	/* no device connected */
     76        1.1  thorpej #define	SStatus_IPM_ACTIVE	(0x1 << 8)	/* ACTIVE state */
     77        1.1  thorpej #define	SStatus_IPM_PARTIAL	(0x2 << 8)	/* PARTIAL pm state */
     78        1.1  thorpej #define	SStatus_IPM_SLUMBER	(0x6 << 8)	/* SLUMBER pm state */
     79  1.5.102.1  thorpej #define	SStatus_IPM_DEVSLEEP	(0x8 << 8)	/* DevSleep pm state */
     80        1.1  thorpej #define	SStatus_IPM_mask	(0xf << 8)
     81        1.1  thorpej #define	SStatus_IPM_shift	8
     82        1.1  thorpej 
     83        1.1  thorpej /*
     84        1.1  thorpej  * SError (SCR1) --
     85        1.1  thorpej  *	Serial ATA interface error register
     86        1.1  thorpej  */
     87        1.1  thorpej #define	SError_ERR_I		(1U << 0)	/* Recovered data integrity
     88        1.1  thorpej 						   error */
     89        1.1  thorpej #define	SError_ERR_M		(1U << 1)	/* Recovered communications
     90        1.1  thorpej 						   error */
     91        1.1  thorpej #define	SError_ERR_T		(1U << 8)	/* Non-recovered transient
     92        1.1  thorpej 						   data integrity error */
     93        1.1  thorpej #define	SError_ERR_C		(1U << 9)	/* Non-recovered persistent
     94        1.1  thorpej 						   communication or data
     95        1.1  thorpej 						   integrity error */
     96        1.1  thorpej #define	SError_ERR_P		(1U << 10)	/* Protocol error */
     97        1.1  thorpej #define	SError_ERR_E		(1U << 11)	/* Internal error */
     98        1.1  thorpej #define	SError_DIAG_N		(1U << 16)	/* PhyRdy change */
     99        1.1  thorpej #define	SError_DIAG_I		(1U << 17)	/* PHY internal error */
    100        1.1  thorpej #define	SError_DIAG_W		(1U << 18)	/* Comm Wake */
    101        1.1  thorpej #define	SError_DIAG_B		(1U << 19)	/* 10b to 8b decode error */
    102        1.1  thorpej #define	SError_DIAG_D		(1U << 20)	/* Disparity error */
    103        1.1  thorpej #define	SError_DIAG_C		(1U << 21)	/* CRC error */
    104        1.1  thorpej #define	SError_DIAG_H		(1U << 22)	/* Handshake error */
    105        1.1  thorpej #define	SError_DIAG_S		(1U << 23)	/* Link sequence error */
    106        1.1  thorpej #define	SError_DIAG_T		(1U << 24)	/* Transport state transition
    107        1.1  thorpej 						   error */
    108        1.1  thorpej #define	SError_DIAG_F		(1U << 25)	/* Unrecognized FIS type */
    109        1.2  thorpej #define	SError_DIAG_X		(1U << 26)	/* Device Exchanged */
    110        1.1  thorpej 
    111        1.1  thorpej /*
    112        1.1  thorpej  * SControl (SCR2) --
    113        1.1  thorpej  *	Serial ATA interface control register
    114        1.1  thorpej  */
    115        1.1  thorpej 	/*
    116        1.1  thorpej 	 * The DET field controls the host adapter device detection
    117        1.1  thorpej 	 * and interface initialization.
    118        1.1  thorpej 	 */
    119        1.1  thorpej #define	SControl_DET_NONE	(0x0 << 0)	/* No device detection or
    120        1.1  thorpej 						   initialization action
    121        1.1  thorpej 						   requested */
    122        1.1  thorpej #define	SControl_DET_INIT	(0x1 << 0)	/* Initialize interface
    123        1.1  thorpej 						   communication (equiv
    124        1.1  thorpej 						   of a hard reset) */
    125        1.1  thorpej #define	SControl_DET_DISABLE	(0x4 << 0)	/* disable interface and
    126        1.1  thorpej 						   take PHY offline */
    127        1.1  thorpej 	/*
    128        1.1  thorpej 	 * The SPD field represents the highest allowed communication
    129        1.1  thorpej 	 * speed the interface is allowed to negotiate when communication
    130        1.1  thorpej 	 * is established.
    131        1.1  thorpej 	 */
    132        1.1  thorpej #define	SControl_SPD_ANY	(0x0 << 4)	/* No restrictions */
    133        1.1  thorpej #define	SControl_SPD_G1		(0x1 << 4)	/* Generation 1 (1.5Gb/s) */
    134        1.2  thorpej #define	SControl_SPD_G2		(0x2 << 4)	/* Generation 2 (3.0Gb/s) */
    135  1.5.102.1  thorpej #define	SControl_SPD_G3		(0x3 << 4)	/* Generation 3 (6.0Gb/s) */
    136        1.1  thorpej 	/*
    137        1.1  thorpej 	 * The IPM field represents the enabled interface power management
    138        1.1  thorpej 	 * states that can be invoked via the Serial ATA interface power
    139        1.1  thorpej 	 * management capabilities.
    140        1.1  thorpej 	 */
    141        1.1  thorpej #define	SControl_IPM_ANY	(0x0 << 8)	/* No restrictions */
    142        1.1  thorpej #define	SControl_IPM_NOPARTIAL	(0x1 << 8)	/* PARTIAL disabled */
    143        1.1  thorpej #define	SControl_IPM_NOSLUMBER	(0x2 << 8)	/* SLUMBER disabled */
    144  1.5.102.1  thorpej #define	SControl_IPM_NODEVSLEEP	(0x4 << 8)	/* DevSleep disabled */
    145  1.5.102.1  thorpej #define	SControl_IPM_NONE	(0x7 << 8)	/* No power management */
    146        1.2  thorpej 	/*
    147        1.2  thorpej 	 * The SPM field selects a power management state.  A non-zero
    148        1.2  thorpej 	 * value written to this field causes initiation of the selected
    149        1.2  thorpej 	 * power management state.
    150        1.2  thorpej 	 */
    151        1.2  thorpej #define	SControl_SPM_PARTIAL	(0x1 << 12)	/* transition to PARTIAL */
    152        1.2  thorpej #define	SControl_SPM_SLUMBER	(0x2 << 12)	/* transition to SLUBMER */
    153        1.2  thorpej #define	SControl_SPM_ComWake	(0x4 << 12)	/* transition from PM */
    154        1.2  thorpej 	/*
    155        1.2  thorpej 	 * The PMP field identifies the selected Port Multiplier Port
    156        1.2  thorpej 	 * for accessing the SActive register.
    157        1.2  thorpej 	 */
    158        1.2  thorpej #define	SControl_PMP(x)		((x) << 16)
    159        1.1  thorpej 
    160        1.1  thorpej #endif /* _DEV_ATA_SATAREG_H_ */
    161