11258Smlf /* 21258Smlf * CDDL HEADER START 31258Smlf * 41258Smlf * The contents of this file are subject to the terms of the 51258Smlf * Common Development and Distribution License (the "License"). 61258Smlf * You may not use this file except in compliance with the License. 71258Smlf * 81258Smlf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 91258Smlf * or http://www.opensolaris.org/os/licensing. 101258Smlf * See the License for the specific language governing permissions 111258Smlf * and limitations under the License. 121258Smlf * 131258Smlf * When distributing Covered Code, include this CDDL HEADER in each 141258Smlf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 151258Smlf * If applicable, add the following below this CDDL HEADER, with the 161258Smlf * fields enclosed by brackets "[]" replaced with your own identifying 171258Smlf * information: Portions Copyright [yyyy] [name of copyright owner] 181258Smlf * 191258Smlf * CDDL HEADER END 201258Smlf */ 211258Smlf 221258Smlf /* 2312938SPhi.Tran@Sun.COM * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 241258Smlf */ 251258Smlf 261258Smlf #ifndef _SATA_DEFS_H 271258Smlf #define _SATA_DEFS_H 281258Smlf 291258Smlf #ifdef __cplusplus 301258Smlf extern "C" { 311258Smlf #endif 321258Smlf 334836Sls24207 #include <sys/scsi/generic/mode.h> 344836Sls24207 351258Smlf /* 361258Smlf * Common ATA commands (subset) 371258Smlf */ 381258Smlf #define SATAC_DIAG 0x90 /* diagnose command */ 391258Smlf #define SATAC_RECAL 0x10 /* restore cmd, 4 bits step rate */ 401258Smlf #define SATAC_FORMAT 0x50 /* format track command */ 411258Smlf #define SATAC_SET_FEATURES 0xef /* set features */ 421258Smlf #define SATAC_IDLE_IM 0xe1 /* idle immediate */ 431258Smlf #define SATAC_STANDBY_IM 0xe0 /* standby immediate */ 441258Smlf #define SATAC_DOOR_LOCK 0xde /* door lock */ 451258Smlf #define SATAC_DOOR_UNLOCK 0xdf /* door unlock */ 461258Smlf #define SATAC_IDLE 0xe3 /* idle */ 4710131SJane.Chu@Sun.COM #define SATAC_STANDBY 0xe2 /* standby */ 481258Smlf 491258Smlf /* 501258Smlf * ATA/ATAPI disk commands (subset) 511258Smlf */ 5212938SPhi.Tran@Sun.COM #define SATAC_DSM 0x06 /* Data Set Management */ 531258Smlf #define SATAC_DEVICE_RESET 0x08 /* ATAPI device reset */ 544014Sls24207 #define SATAC_DOWNLOAD_MICROCODE 0x92 /* Download microcode */ 551258Smlf #define SATAC_EJECT 0xed /* media eject */ 561258Smlf #define SATAC_FLUSH_CACHE 0xe7 /* flush write-cache */ 571258Smlf #define SATAC_ID_DEVICE 0xec /* IDENTIFY DEVICE */ 581258Smlf #define SATAC_ID_PACKET_DEVICE 0xa1 /* ATAPI identify packet device */ 591258Smlf #define SATAC_INIT_DEVPARMS 0x91 /* initialize device parameters */ 601258Smlf #define SATAC_PACKET 0xa0 /* ATAPI packet */ 611258Smlf #define SATAC_RDMULT 0xc4 /* read multiple w/DMA */ 621258Smlf #define SATAC_RDSEC 0x20 /* read sector */ 631258Smlf #define SATAC_RDVER 0x40 /* read verify */ 641258Smlf #define SATAC_READ_DMA 0xc8 /* read DMA */ 651258Smlf #define SATAC_SEEK 0x70 /* seek */ 661258Smlf #define SATAC_SERVICE 0xa2 /* queued/overlap service */ 671258Smlf #define SATAC_SETMULT 0xc6 /* set multiple mode */ 681258Smlf #define SATAC_WRITE_DMA 0xca /* write (multiple) w/DMA */ 691258Smlf #define SATAC_WRMULT 0xc5 /* write multiple */ 701258Smlf #define SATAC_WRSEC 0x30 /* write sector */ 711258Smlf #define SATAC_RDSEC_EXT 0x24 /* read sector extended (LBA48) */ 721258Smlf #define SATAC_READ_DMA_EXT 0x25 /* read DMA extended (LBA48) */ 731258Smlf #define SATAC_RDMULT_EXT 0x29 /* read multiple extended (LBA48) */ 741258Smlf #define SATAC_WRSEC_EXT 0x34 /* read sector extended (LBA48) */ 751258Smlf #define SATAC_WRITE_DMA_EXT 0x35 /* read DMA extended (LBA48) */ 761258Smlf #define SATAC_WRMULT_EXT 0x39 /* read multiple extended (LBA48) */ 771258Smlf 781258Smlf #define SATAC_READ_DMA_QUEUED 0xc7 /* read DMA / may be queued */ 791258Smlf #define SATAC_READ_DMA_QUEUED_EXT 0x26 /* read DMA ext / may be queued */ 801258Smlf #define SATAC_WRITE_DMA_QUEUED 0xcc /* read DMA / may be queued */ 811258Smlf #define SATAC_WRITE_DMA_QUEUED_EXT 0x36 /* read DMA ext / may be queued */ 821258Smlf #define SATAC_READ_PM_REG 0xe4 /* read port mult reg */ 831258Smlf #define SATAC_WRITE_PM_REG 0xe8 /* write port mult reg */ 841258Smlf 851258Smlf #define SATAC_READ_FPDMA_QUEUED 0x60 /* First-Party-DMA read queued */ 861258Smlf #define SATAC_WRITE_FPDMA_QUEUED 0x61 /* First-Party-DMA write queued */ 871258Smlf 881258Smlf #define SATAC_READ_LOG_EXT 0x2f /* read log */ 891612Sls24207 901612Sls24207 #define SATAC_SMART 0xb0 /* SMART */ 911612Sls24207 921258Smlf #define SATA_LOG_PAGE_10 0x10 /* log page 0x10 - SATA error */ 931258Smlf /* 9410318SXiao-Yu.Zhang@Sun.COM * Port Multiplier Commands 9510318SXiao-Yu.Zhang@Sun.COM */ 9610318SXiao-Yu.Zhang@Sun.COM #define SATAC_READ_PORTMULT 0xe4 /* read port multiplier */ 9710318SXiao-Yu.Zhang@Sun.COM #define SATAC_WRITE_PORTMULT 0xe8 /* write port multiplier */ 9810318SXiao-Yu.Zhang@Sun.COM 9910318SXiao-Yu.Zhang@Sun.COM /* 1001258Smlf * Power Managment Commands (subset) 1011258Smlf */ 1021258Smlf #define SATAC_CHECK_POWER_MODE 0xe5 /* check power mode */ 1031258Smlf 10410131SJane.Chu@Sun.COM #define SATA_PWRMODE_STANDBY 0 /* standby mode */ 10510131SJane.Chu@Sun.COM #define SATA_PWRMODE_IDLE 0x80 /* idle mode */ 10610131SJane.Chu@Sun.COM #define SATA_PWRMODE_ACTIVE_SPINDOWN 0x40 /* PM0 and spinning down */ 10710131SJane.Chu@Sun.COM #define SATA_PWRMODE_ACTIVE_SPINUP 0x41 /* PM0 and spinning up */ 10810131SJane.Chu@Sun.COM #define SATA_PWRMODE_ACTIVE 0xFF /* active or idle mode */ 1091258Smlf 1101258Smlf 1111258Smlf /* 1121612Sls24207 * SMART FEATURES Subcommands 1131612Sls24207 */ 1141612Sls24207 #define SATA_SMART_READ_DATA 0xd0 1151612Sls24207 #define SATA_SMART_ATTR_AUTOSAVE 0xd2 1161612Sls24207 #define SATA_SMART_EXECUTE_OFFLINE_IMM 0xd4 1171612Sls24207 #define SATA_SMART_READ_LOG 0xd5 1181612Sls24207 #define SATA_SMART_WRITE_LOG 0xd6 1191612Sls24207 #define SATA_SMART_ENABLE_OPS 0xd8 1201612Sls24207 #define SATA_SMART_DISABLE_OPS 0xd9 1211612Sls24207 #define SATA_SMART_RETURN_STATUS 0xda 1221612Sls24207 1231612Sls24207 /* 1241258Smlf * SET FEATURES Subcommands 1251258Smlf */ 1261258Smlf #define SATAC_SF_ENABLE_WRITE_CACHE 0x02 1271258Smlf #define SATAC_SF_TRANSFER_MODE 0x03 1284862SUnknown #define SATAC_SF_DISABLE_RMSN 0x31 1294836Sls24207 #define SATAC_SF_ENABLE_ACOUSTIC 0x42 1301258Smlf #define SATAC_SF_DISABLE_READ_AHEAD 0x55 1311258Smlf #define SATAC_SF_DISABLE_WRITE_CACHE 0x82 1321258Smlf #define SATAC_SF_ENABLE_READ_AHEAD 0xaa 1334836Sls24207 #define SATAC_SF_DISABLE_ACOUSTIC 0xc2 1344862SUnknown #define SATAC_SF_ENABLE_RMSN 0x95 1351258Smlf 1361258Smlf /* 1371258Smlf * SET FEATURES transfer mode values 1381258Smlf */ 1391258Smlf #define SATAC_TRANSFER_MODE_PIO_DEFAULT 0x00 1401258Smlf #define SATAC_TRANSFER_MODE_PIO_DISABLE_IODRY 0x01 1411258Smlf #define SATAC_TRANSFER_MODE_PIO_FLOW_CONTROL 0x08 1421258Smlf #define SATAC_TRANSFER_MODE_MULTI_WORD_DMA 0x20 1431258Smlf #define SATAC_TRANSFER_MODE_ULTRA_DMA 0x40 1441258Smlf 1454014Sls24207 /* 1464014Sls24207 * Download microcode subcommands 1474014Sls24207 */ 1484014Sls24207 #define SATA_DOWNLOAD_MCODE_TEMP 1 /* Revert on/ reset/pwr cycle */ 1494014Sls24207 #define SATA_DOWNLOAD_MCODE_SAVE 7 /* No offset, keep mcode */ 1504014Sls24207 1514014Sls24207 1521258Smlf /* Generic ATA definitions */ 1531258Smlf 1541940Sls24207 #define SATA_TAG_QUEUING_SHIFT 3 1552553Sls24207 #define SATA_TAG_QUEUING_MASK 0x1f 1561258Smlf /* 1571258Smlf * Identify Device data 1584862SUnknown * Although both ATA and ATAPI devices' Identify Data have the same length, 1591258Smlf * some words have different meaning/content and/or are irrelevant for 1601258Smlf * other type of device. 1611258Smlf * Following is the ATA Device Identify data layout 1621258Smlf */ 1631258Smlf typedef struct sata_id { 16410131SJane.Chu@Sun.COM /* WORD */ 16510131SJane.Chu@Sun.COM /* OFFSET COMMENT */ 1661612Sls24207 ushort_t ai_config; /* 0 general configuration bits */ 1671612Sls24207 ushort_t ai_fixcyls; /* 1 # of cylinders (obsolete) */ 1681612Sls24207 ushort_t ai_resv0; /* 2 # reserved */ 1691612Sls24207 ushort_t ai_heads; /* 3 # of heads (obsolete) */ 1701612Sls24207 ushort_t ai_trksiz; /* 4 # of bytes/track (retired) */ 1711612Sls24207 ushort_t ai_secsiz; /* 5 # of bytes/sector (retired) */ 1721612Sls24207 ushort_t ai_sectors; /* 6 # of sectors/track (obsolete) */ 1731612Sls24207 ushort_t ai_resv1[3]; /* 7 "Vendor Unique" */ 1741612Sls24207 char ai_drvser[20]; /* 10 Serial number */ 1751612Sls24207 ushort_t ai_buftype; /* 20 Buffer type */ 1761612Sls24207 ushort_t ai_bufsz; /* 21 Buffer size in 512 byte incr */ 1771612Sls24207 ushort_t ai_ecc; /* 22 # of ecc bytes avail on rd/wr */ 1781612Sls24207 char ai_fw[8]; /* 23 Firmware revision */ 1791612Sls24207 char ai_model[40]; /* 27 Model # */ 1801612Sls24207 ushort_t ai_mult1; /* 47 Multiple command flags */ 1811612Sls24207 ushort_t ai_dwcap; /* 48 Doubleword capabilities */ 1821612Sls24207 ushort_t ai_cap; /* 49 Capabilities */ 1831612Sls24207 ushort_t ai_resv2; /* 50 Reserved */ 1841612Sls24207 ushort_t ai_piomode; /* 51 PIO timing mode */ 1851612Sls24207 ushort_t ai_dmamode; /* 52 DMA timing mode */ 1861612Sls24207 ushort_t ai_validinfo; /* 53 bit0: wds 54-58, bit1: 64-70 */ 1871612Sls24207 ushort_t ai_curcyls; /* 54 # of current cylinders */ 1881612Sls24207 ushort_t ai_curheads; /* 55 # of current heads */ 1891612Sls24207 ushort_t ai_cursectrk; /* 56 # of current sectors/track */ 1901612Sls24207 ushort_t ai_cursccp[2]; /* 57 current sectors capacity */ 1911612Sls24207 ushort_t ai_mult2; /* 59 multiple sectors info */ 1921612Sls24207 ushort_t ai_addrsec[2]; /* 60 LBA only: no of addr secs */ 1934862SUnknown ushort_t ai_dirdma; /* 62 valid in ATA/ATAPI7, DMADIR */ 1944862SUnknown ushort_t ai_dworddma; /* 63 multi word dma modes */ 1951612Sls24207 ushort_t ai_advpiomode; /* 64 advanced PIO modes supported */ 1961612Sls24207 ushort_t ai_minmwdma; /* 65 min multi-word dma cycle info */ 1971612Sls24207 ushort_t ai_recmwdma; /* 66 rec multi-word dma cycle info */ 1981612Sls24207 ushort_t ai_minpio; /* 67 min PIO cycle info */ 1991612Sls24207 ushort_t ai_minpioflow; /* 68 min PIO cycle info w/flow ctl */ 20012938SPhi.Tran@Sun.COM ushort_t ai_addsupported; /* 69 additional supported */ 20112938SPhi.Tran@Sun.COM ushort_t ai_resv3; /* 70 reserved */ 2021612Sls24207 ushort_t ai_typtime[2]; /* 71-72 timing */ 2031612Sls24207 ushort_t ai_resv4[2]; /* 73-74 reserved */ 2041612Sls24207 ushort_t ai_qdepth; /* 75 queue depth */ 2051612Sls24207 ushort_t ai_satacap; /* 76 SATA capabilities */ 2061612Sls24207 ushort_t ai_resv5; /* 77 reserved */ 2071612Sls24207 ushort_t ai_satafsup; /* 78 SATA features supported */ 2081612Sls24207 ushort_t ai_satafenbl; /* 79 SATA features enabled */ 2091612Sls24207 ushort_t ai_majorversion; /* 80 major versions supported */ 2101612Sls24207 ushort_t ai_minorversion; /* 81 minor version number supported */ 2111612Sls24207 ushort_t ai_cmdset82; /* 82 command set supported */ 2121612Sls24207 ushort_t ai_cmdset83; /* 83 more command sets supported */ 2131612Sls24207 ushort_t ai_cmdset84; /* 84 more command sets supported */ 2141612Sls24207 ushort_t ai_features85; /* 85 enabled features */ 2151612Sls24207 ushort_t ai_features86; /* 86 enabled features */ 2161612Sls24207 ushort_t ai_features87; /* 87 enabled features */ 2171612Sls24207 ushort_t ai_ultradma; /* 88 Ultra DMA mode */ 2181612Sls24207 ushort_t ai_erasetime; /* 89 security erase time */ 2191612Sls24207 ushort_t ai_erasetimex; /* 90 enhanced security erase time */ 2201612Sls24207 ushort_t ai_adv_pwr_mgmt; /* 91 advanced power management time */ 2211612Sls24207 ushort_t ai_master_pwd; /* 92 master password revision code */ 2221612Sls24207 ushort_t ai_hrdwre_reset; /* 93 hardware reset result */ 2231612Sls24207 ushort_t ai_acoustic; /* 94 accoustic management values */ 2241612Sls24207 ushort_t ai_stream_min_sz; /* 95 stream minimum request size */ 2251612Sls24207 ushort_t ai_stream_xfer_d; /* 96 streaming transfer time (DMA) */ 2261612Sls24207 ushort_t ai_stream_lat; /* 97 streaming access latency */ 2271612Sls24207 ushort_t ai_streamperf[2]; /* 98-99 streaming performance gran. */ 2281612Sls24207 ushort_t ai_addrsecxt[4]; /* 100 extended max LBA sector */ 2291612Sls24207 ushort_t ai_stream_xfer_p; /* 104 streaming transfer time (PIO) */ 23012938SPhi.Tran@Sun.COM ushort_t ai_maxcount; /* 105 max count of 512-byte blocks of */ 23112938SPhi.Tran@Sun.COM /* LBA range entries */ 2321612Sls24207 ushort_t ai_phys_sect_sz; /* 106 physical sector size */ 2331612Sls24207 ushort_t ai_seek_delay; /* 107 inter-seek delay time (usecs) */ 2341612Sls24207 ushort_t ai_naa_ieee_oui; /* 108 NAA/IEEE OUI */ 2351612Sls24207 ushort_t ai_ieee_oui_uid; /* 109 IEEE OUT/unique id */ 2361612Sls24207 ushort_t ai_uid_mid; /* 110 unique id (mid) */ 2371612Sls24207 ushort_t ai_uid_low; /* 111 unique id (low) */ 2381612Sls24207 ushort_t ai_resv_wwn[4]; /* 112-115 reserved for WWN ext. */ 2391612Sls24207 ushort_t ai_incits; /* 116 reserved for INCITS TR-37-2004 */ 2401612Sls24207 ushort_t ai_words_lsec[2]; /* 117-118 words per logical sector */ 2411612Sls24207 ushort_t ai_cmdset119; /* 119 more command sets supported */ 2421612Sls24207 ushort_t ai_features120; /* 120 enabled features */ 24312938SPhi.Tran@Sun.COM ushort_t ai_padding1[6]; /* pad to 126 */ 2441612Sls24207 ushort_t ai_rmsn; /* 127 removable media notification */ 2451612Sls24207 ushort_t ai_securestatus; /* 128 security status */ 2461612Sls24207 ushort_t ai_vendor[31]; /* 129-159 vendor specific */ 24712938SPhi.Tran@Sun.COM ushort_t ai_padding2[8]; /* 160 pad to 168 */ 24811925SPhi.Tran@Sun.COM ushort_t ai_nomformfactor; /* 168 nominal form factor */ 24912938SPhi.Tran@Sun.COM ushort_t ai_dsm; /* 169 data set management */ 25012938SPhi.Tran@Sun.COM ushort_t ai_padding3[6]; /* 170 pad to 176 */ 2511612Sls24207 ushort_t ai_curmedser[30]; /* 176-205 current media serial # */ 2521612Sls24207 ushort_t ai_sctsupport; /* 206 SCT command transport */ 25312938SPhi.Tran@Sun.COM ushort_t ai_padding4[10]; /* 207 pad to 217 */ 25411925SPhi.Tran@Sun.COM ushort_t ai_medrotrate; /* 217 nominal media rotation rate */ 25512938SPhi.Tran@Sun.COM ushort_t ai_padding5[37]; /* 218 pad to 255 */ 2561612Sls24207 ushort_t ai_integrity; /* 255 integrity word */ 2571258Smlf } sata_id_t; 2581258Smlf 2591258Smlf 2601258Smlf /* Identify Device: general config bits - word 0 */ 2611258Smlf 2621258Smlf #define SATA_ATA_TYPE_MASK 0x8001 /* ATA Device type mask */ 2631258Smlf #define SATA_ATA_TYPE 0x0000 /* ATA device */ 26410131SJane.Chu@Sun.COM #define SATA_REM_MEDIA 0x0080 /* Removable media */ 2653936Spawelw #define SATA_INCOMPLETE_DATA 0x0004 /* Incomplete Identify Device data */ 26610006SYing.Tian@Sun.COM #define SATA_CFA_TYPE 0x848a /* CFA feature set device */ 2671258Smlf 2681258Smlf #define SATA_ID_SERIAL_OFFSET 10 2691258Smlf #define SATA_ID_SERIAL_LEN 20 2701258Smlf #define SATA_ID_MODEL_OFFSET 27 2711258Smlf #define SATA_ID_MODEL_LEN 40 2724582Scth #define SATA_ID_FW_LEN 8 27311925SPhi.Tran@Sun.COM #define SATA_ID_BDC_LEN 0x3c 274*13111SPhi.Tran@Sun.COM #define SATA_ID_ATA_INFO_LEN 0x238 2751258Smlf 2761258Smlf /* Identify Device: common capability bits - word 49 */ 2771258Smlf 2781258Smlf #define SATA_DMA_SUPPORT 0x0100 2791258Smlf #define SATA_LBA_SUPPORT 0x0200 2801258Smlf #define SATA_IORDY_DISABLE 0x0400 2811258Smlf #define SATA_IORDY_SUPPORT 0x0800 2821258Smlf #define SATA_STANDBYTIMER 0x2000 2831258Smlf 2841258Smlf /* Identify Device: ai_validinfo (word 53) */ 2851258Smlf 2861258Smlf #define SATA_VALIDINFO_88 0x0004 /* word 88 supported fields valid */ 2874862SUnknown #define SATA_VALIDINFO_70_64 0x0004 /* words 70-64 fields valid */ 2881258Smlf 28912938SPhi.Tran@Sun.COM /* Identify Device: ai_addsupported (word 69) */ 29012938SPhi.Tran@Sun.COM 29112938SPhi.Tran@Sun.COM #define SATA_DETERMINISTIC_READ 0x4000 /* word 69 deterministic read supp. */ 29212938SPhi.Tran@Sun.COM #define SATA_READ_ZERO 0x0020 /* word 69 read zero after TRIM supp. */ 29312938SPhi.Tran@Sun.COM 2941258Smlf /* Identify Device: ai_majorversion (word 80) */ 2951258Smlf 2964862SUnknown #define SATA_MAJVER_7 0x0080 /* ATA/ATAPI-7 version supported */ 2974862SUnknown #define SATA_MAJVER_654 0x0070 /* ATA/ATAPI-6,5 or 4 ver supported */ 2981258Smlf #define SATA_MAJVER_6 0x0040 /* ATA/ATAPI-6 version supported */ 2994862SUnknown #define SATA_MAJVER_5 0x0020 /* ATA/ATAPI-7 version supported */ 3001258Smlf #define SATA_MAJVER_4 0x0010 /* ATA/ATAPI-4 version supported */ 3011258Smlf 3021258Smlf /* Identify Device: command set supported/enabled bits - words 83 and 86 */ 3031258Smlf 3041258Smlf #define SATA_EXT48 0x0400 /* 48 bit address feature */ 3054862SUnknown #define SATA_PWRUP_IN_STANDBY 0x0020 /* Power-up in standby mode supp/en */ 3064862SUnknown #define SATA_RM_STATUS_NOTIFIC 0x0010 /* Removable Media Stat Notification */ 3071258Smlf #define SATA_RW_DMA_QUEUED_CMD 0x0002 /* R/W DMA Queued supported */ 3081258Smlf #define SATA_DWNLOAD_MCODE_CMD 0x0001 /* Download Microcode CMD supp/enbld */ 3094836Sls24207 #define SATA_ACOUSTIC_MGMT 0x0200 /* Acoustic Management features */ 3101258Smlf 3111258Smlf /* Identify Device: command set supported/enabled bits - words 82 and 85 */ 3121258Smlf 3131612Sls24207 #define SATA_SMART_SUPPORTED 0x0001 /* SMART feature set is supported */ 3141258Smlf #define SATA_WRITE_CACHE 0x0020 /* Write Cache supported/enabled */ 3151258Smlf #define SATA_LOOK_AHEAD 0x0040 /* Look Ahead supported/enabled */ 3161258Smlf #define SATA_DEVICE_RESET_CMD 0x0200 /* Device Reset CMD supported/enbld */ 3171258Smlf #define SATA_READ_BUFFER_CMD 0x2000 /* Read Buffer CMD supported/enbld */ 3181258Smlf #define SATA_WRITE_BUFFER_CMD 0x1000 /* Write Buffer CMD supported/enbld */ 3191612Sls24207 #define SATA_SMART_ENABLED 0x0001 /* SMART feature set is enabled */ 3201612Sls24207 3211612Sls24207 /* Identify Device: command set supported/enabled bits - words 84 & 87 */ 3221612Sls24207 #define SATA_SMART_SELF_TEST_SUPPORTED 0x0002 /* SMART self-test supported */ 32310131SJane.Chu@Sun.COM /* IDLE IMMEDIATE with UNLOAD FEATURE supported */ 32410131SJane.Chu@Sun.COM #define SATA_IDLE_UNLOAD_SUPPORTED 0x2000 3251258Smlf 32612017SAlan.Perry@Sun.COM /* Identify Device: physical sector size - word 106 */ 32712017SAlan.Perry@Sun.COM #define SATA_L2PS_CHECK_BIT 0x4000 /* Set when this word valid */ 32812017SAlan.Perry@Sun.COM #define SATA_L2PS_HAS_MULT 0x2000 /* Multiple logical sectors per phys */ 32912017SAlan.Perry@Sun.COM #define SATA_L2PS_BIG_SECTORS 0x1000 /* Logical sector size > 512 */ 33012017SAlan.Perry@Sun.COM #define SATA_L2PS_EXP_MASK 0x000f /* Logical sectors per phys exponent */ 33112017SAlan.Perry@Sun.COM 3324862SUnknown /* Identify (Packet) Device word 63, ATA/ATAPI-6 & 7 */ 3331258Smlf #define SATA_MDMA_SEL_MASK 0x0700 /* Multiword DMA selected */ 3341258Smlf #define SATA_MDMA_2_SEL 0x0400 /* Multiword DMA mode 2 selected */ 3351258Smlf #define SATA_MDMA_1_SEL 0x0200 /* Multiword DMA mode 1 selected */ 3361258Smlf #define SATA_MDMA_0_SEL 0x0100 /* Multiword DMA mode 0 selected */ 3371258Smlf #define SATA_MDMA_2_SUP 0x0004 /* Multiword DMA mode 2 supported */ 3381258Smlf #define SATA_MDMA_1_SUP 0x0002 /* Multiword DMA mode 1 supported */ 3391258Smlf #define SATA_MDMA_0_SUP 0x0001 /* Multiword DMA mode 0 supported */ 3404862SUnknown #define SATA_MDMA_SUP_MASK 0x0007 /* Multiword DMA supported */ 3414862SUnknown 3424862SUnknown /* Identify (Packet) Device Word 88 */ 3434862SUnknown #define SATA_UDMA_SUP_MASK 0x007f /* UDMA modes supported */ 3444862SUnknown #define SATA_UDMA_SEL_MASK 0x7f00 /* UDMA modes selected */ 3451258Smlf 3461612Sls24207 /* Identify Device: command set supported/enabled bits - word 206 */ 3471612Sls24207 3481612Sls24207 /* All are SCT Command Transport support */ 3491612Sls24207 #define SATA_SCT_CMD_TRANS_SUP 0x0001 /* anything */ 3501612Sls24207 #define SATA_SCT_CMD_TRANS_LNG_SECT_SUP 0x0002 /* Long Sector Access */ 3511612Sls24207 #define SATA_SCT_CMD_TRANS_WR_SAME_SUP 0x0004 /* Write Same */ 3521612Sls24207 #define SATA_SCT_CMD_TRANS_ERR_RCOV_SUP 0x0008 /* Error Recovery Control */ 3531612Sls24207 #define SATA_SCT_CMD_TRANS_FEAT_CTL_SUP 0x0010 /* Features Control */ 3541612Sls24207 #define SATA_SCT_CMD_TRANS_DATA_TBL_SUP 0x0020 /* Data Tables supported */ 3551612Sls24207 3561258Smlf #define SATA_DISK_SECTOR_SIZE 512 /* HD physical sector size */ 3571258Smlf 3581258Smlf /* Identify Packet Device data definitions (ATAPI devices) */ 3591258Smlf 3601258Smlf /* Identify Packet Device: general config bits - word 0 */ 3611258Smlf 3621258Smlf #define SATA_ATAPI_TYPE_MASK 0xc000 36310131SJane.Chu@Sun.COM #define SATA_ATAPI_TYPE 0x8000 /* ATAPI device */ 36410131SJane.Chu@Sun.COM #define SATA_ATAPI_ID_PKT_SZ 0x0003 /* Packet size mask */ 3651258Smlf #define SATA_ATAPI_ID_PKT_12B 0x0000 /* Packet size 12 bytes */ 3661258Smlf #define SATA_ATAPI_ID_PKT_16B 0x0001 /* Packet size 16 bytes */ 36710131SJane.Chu@Sun.COM #define SATA_ATAPI_ID_DRQ_TYPE 0x0060 /* DRQ asserted in 3ms after pkt */ 3681612Sls24207 #define SATA_ATAPI_ID_DRQ_INTR 0x0020 /* Obsolete in ATA/ATAPI 7 */ 3691258Smlf 3701258Smlf #define SATA_ATAPI_ID_DEV_TYPE 0x0f00 /* device type/command set mask */ 3711258Smlf #define SATA_ATAPI_ID_DEV_SHFT 8 3721258Smlf #define SATA_ATAPI_DIRACC_DEV 0x0000 /* Direct Access device */ 3731612Sls24207 #define SATA_ATAPI_SQACC_DEV 0x0100 /* Sequential access dev (tape ?) */ 3741612Sls24207 #define SATA_ATAPI_CDROM_DEV 0x0500 /* CD_ROM device */ 3751258Smlf 3761258Smlf /* 3771258Smlf * Status bits from ATAPI Interrupt reason register (AT_COUNT) register 3781258Smlf */ 3791258Smlf #define SATA_ATAPI_I_COD 0x01 /* Command or Data */ 3801258Smlf #define SATA_ATAPI_I_IO 0x02 /* IO direction */ 3811258Smlf #define SATA_ATAPI_I_RELEASE 0x04 /* Release for ATAPI overlap */ 3821258Smlf 3831258Smlf /* ATAPI feature reg definitions */ 3841258Smlf 3854862SUnknown #define SATA_ATAPI_F_DATA_DIR_READ 0x04 /* DMA transfer to the host */ 3864862SUnknown #define SATA_ATAPI_F_OVERLAP 0x02 /* Not used by Sun drivers */ 3874862SUnknown #define SATA_ATAPI_F_DMA 0x01 /* Packet DMA command */ 3884862SUnknown 3891258Smlf 3904862SUnknown /* ATAPI IDENTIFY_DRIVE capabilities word (49) */ 3914862SUnknown 3924862SUnknown #define SATA_ATAPI_ID_CAP_DMA 0x0100 /* if zero, check word 62 */ 3934862SUnknown #define SATA_ATAPI_ID_CAP_OVERLAP 0x2000 3941258Smlf 3951258Smlf /* 3964862SUnknown * ATAPI Identify Packet Device word 62 3974862SUnknown * Word 62 is not valid for ATA/ATAPI-6 3984862SUnknown * Defs below are for ATA/ATAPI-7 3991258Smlf */ 4004862SUnknown #define SATA_ATAPI_ID_DMADIR_REQ 0x8000 /* DMA direction required */ 4014862SUnknown #define SATA_ATAPI_ID_DMA_SUP 0x0400 /* DMA is supported */ 4021258Smlf 4031258Smlf /* 4041258Smlf * ATAPI signature bits 4051258Smlf */ 4061258Smlf #define SATA_ATAPI_SIG_HI 0xeb /* in high cylinder register */ 4071258Smlf #define SATA_ATAPI_SIG_LO 0x14 /* in low cylinder register */ 4081258Smlf 4091258Smlf /* These values are pre-set for CD_ROM/DVD ? */ 4101258Smlf 4111258Smlf #define SATA_ATAPI_SECTOR_SIZE 2048 4121258Smlf #define SATA_ATAPI_MAX_BYTES_PER_DRQ 0xf800 /* 16 bits - 2KB ie 62KB */ 4131258Smlf #define SATA_ATAPI_HEADS 64 4141258Smlf #define SATA_ATAPI_SECTORS_PER_TRK 32 4151258Smlf 4161258Smlf /* SATA Capabilites bits (word 76) */ 4171258Smlf 4181258Smlf #define SATA_NCQ 0x100 4191258Smlf #define SATA_2_SPEED 0x004 4201258Smlf #define SATA_1_SPEED 0x002 4211258Smlf 4221258Smlf /* SATA Features Supported (word 78) - not used */ 4231258Smlf 4241258Smlf /* SATA Features Enabled (word 79) - not used */ 4251258Smlf 4269058SYing.Tian@Sun.COM #define SATA_READ_AHEAD_SUPPORTED(x) ((x).ai_cmdset82 & SATA_LOOK_AHEAD) 4279058SYing.Tian@Sun.COM #define SATA_READ_AHEAD_ENABLED(x) ((x).ai_features85 & SATA_LOOK_AHEAD) 4289058SYing.Tian@Sun.COM #define SATA_WRITE_CACHE_SUPPORTED(x) ((x).ai_cmdset82 & SATA_WRITE_CACHE) 4299058SYing.Tian@Sun.COM #define SATA_WRITE_CACHE_ENABLED(x) ((x).ai_features85 & SATA_WRITE_CACHE) 4309058SYing.Tian@Sun.COM #define SATA_RM_NOTIFIC_SUPPORTED(x) \ 4319058SYing.Tian@Sun.COM ((x).ai_cmdset83 & SATA_RM_STATUS_NOTIFIC) 4329058SYing.Tian@Sun.COM #define SATA_RM_NOTIFIC_ENABLED(x) \ 4339058SYing.Tian@Sun.COM ((x).ai_features86 & SATA_RM_STATUS_NOTIFIC) 4349058SYing.Tian@Sun.COM 4351258Smlf /* 4363821Sls24207 * Generic NCQ related defines 4373821Sls24207 */ 4383821Sls24207 4393821Sls24207 #define NQ 0x80 /* Not a queued cmd - tag not valid */ 4403821Sls24207 #define NCQ_TAG_MASK 0x1f /* NCQ command tag mask */ 4413821Sls24207 #define FIS_TYPE_REG_H2D 0x27 /* Reg FIS - Host to Device */ 4423821Sls24207 #define FIS_CMD_UPDATE 0x80 4433821Sls24207 /* 4441258Smlf * Status bits from AT_STATUS register 4451258Smlf */ 4461258Smlf #define SATA_STATUS_BSY 0x80 /* controller busy */ 44710131SJane.Chu@Sun.COM #define SATA_STATUS_DRDY 0x40 /* drive ready */ 4481258Smlf #define SATA_STATUS_DF 0x20 /* device fault */ 44910131SJane.Chu@Sun.COM #define SATA_STATUS_DSC 0x10 /* seek operation complete */ 4501258Smlf #define SATA_STATUS_DRQ 0x08 /* data request */ 4511258Smlf #define SATA_STATUS_CORR 0x04 /* obsolete */ 4521258Smlf #define SATA_STATUS_IDX 0x02 /* obsolete */ 4531258Smlf #define SATA_STATUS_ERR 0x01 /* error flag */ 4541258Smlf 4551258Smlf /* 4561258Smlf * Status bits from AT_ERROR register 4571258Smlf */ 4581258Smlf #define SATA_ERROR_ICRC 0x80 /* CRC data transfer error detected */ 4591258Smlf #define SATA_ERROR_UNC 0x40 /* uncorrectable data error */ 4601258Smlf #define SATA_ERROR_MC 0x20 /* Media change */ 4611258Smlf #define SATA_ERROR_IDNF 0x10 /* ID/Address not found */ 4621258Smlf #define SATA_ERROR_MCR 0x08 /* media change request */ 4631258Smlf #define SATA_ERROR_ABORT 0x04 /* aborted command */ 4641258Smlf #define SATA_ERROR_NM 0x02 /* no media */ 4651258Smlf #define SATA_ERROR_EOM 0x02 /* end of media (Packet cmds) */ 4661258Smlf #define SATA_ERROR_ILI 0x01 /* cmd sepcific */ 4671258Smlf 4681612Sls24207 4691612Sls24207 /* 4701612Sls24207 * Bits from the device control register 4711612Sls24207 */ 4721612Sls24207 #define SATA_DEVCTL_NIEN 0x02 /* not interrupt enabled */ 4731612Sls24207 #define SATA_DEVCTL_SRST 0x04 /* software reset */ 4741612Sls24207 #define SATA_DEVCTL_HOB 0x80 /* high order bit */ 4751612Sls24207 4761258Smlf /* device_reg */ 4771258Smlf #define SATA_ADH_LBA 0x40 /* addressing in LBA mode not chs */ 4781258Smlf 4794862SUnknown /* ATAPI transport version-in Inquiry data */ 4804862SUnknown #define SATA_ATAPI_TRANS_VERSION(inq) \ 4814862SUnknown (*((uint8_t *)(inq) + 3) >> 4) 4821612Sls24207 4831612Sls24207 #define SCSI_LOG_PAGE_HDR_LEN 4 /* # bytes of a SCSI log page header */ 4841612Sls24207 #define SCSI_LOG_PARAM_HDR_LEN 4 /* # byttes of a SCSI log param hdr */ 4851612Sls24207 4861612Sls24207 /* Number of log entries per extended selftest log block */ 4871612Sls24207 #define ENTRIES_PER_EXT_SELFTEST_LOG_BLK 19 4881612Sls24207 4891612Sls24207 /* Number of entries per SCSI LOG SENSE SELFTEST RESULTS page */ 4901612Sls24207 #define SCSI_ENTRIES_IN_LOG_SENSE_SELFTEST_RESULTS 20 4911612Sls24207 4921612Sls24207 /* Length of a SCSI LOG SENSE SELFTEST RESULTS parameter */ 4931612Sls24207 #define SCSI_LOG_SENSE_SELFTEST_PARAM_LEN 0x10 4941612Sls24207 4951612Sls24207 #define DIAGNOSTIC_FAILURE_ON_COMPONENT 0x40 4961612Sls24207 4971612Sls24207 #define SCSI_COMPONENT_81 0x81 4981612Sls24207 #define SCSI_COMPONENT_82 0x82 4991612Sls24207 #define SCSI_COMPONENT_83 0x83 5001612Sls24207 #define SCSI_COMPONENT_84 0x84 5011612Sls24207 #define SCSI_COMPONENT_85 0x85 5021612Sls24207 #define SCSI_COMPONENT_86 0x86 5031612Sls24207 #define SCSI_COMPONENT_87 0x87 5041612Sls24207 #define SCSI_COMPONENT_88 0x88 5051612Sls24207 5061612Sls24207 #define SCSI_ASC_ATA_DEV_FEAT_NOT_ENABLED 0x67 5071612Sls24207 #define SCSI_ASCQ_ATA_DEV_FEAT_NOT_ENABLED 0x0b 5081612Sls24207 5091612Sls24207 #define SCSI_PREDICTED_FAILURE 0x5d 5101612Sls24207 #define SCSI_GENERAL_HD_FAILURE 0x10 5111612Sls24207 5121940Sls24207 #define SCSI_INFO_EXCEPTIONS_PARAM_LEN 4 5131612Sls24207 5141612Sls24207 #define READ_LOG_EXT_LOG_DIRECTORY 0 5152553Sls24207 #define READ_LOG_EXT_NCQ_ERROR_RECOVERY 0x10 5161612Sls24207 #define SMART_SELFTEST_LOG_PAGE 6 5171612Sls24207 #define EXT_SMART_SELFTEST_LOG_PAGE 7 5182553Sls24207 5192553Sls24207 /* 5202553Sls24207 * SATA NCQ error recovery page (0x10) 5212553Sls24207 */ 5222553Sls24207 struct sata_ncq_error_recovery_page { 5232553Sls24207 uint8_t ncq_tag; 5242553Sls24207 uint8_t reserved1; 5252553Sls24207 uint8_t ncq_status; 5262553Sls24207 uint8_t ncq_error; 5272553Sls24207 uint8_t ncq_sector_number; 5282553Sls24207 uint8_t ncq_cyl_low; 5292553Sls24207 uint8_t ncq_cyl_high; 5302553Sls24207 uint8_t ncq_dev_head; 5312553Sls24207 uint8_t ncq_sector_number_ext; 5322553Sls24207 uint8_t ncq_cyl_low_ext; 5332553Sls24207 uint8_t ncq_cyl_high_ext; 5342553Sls24207 uint8_t reserved2; 5352553Sls24207 uint8_t ncq_sector_count; 5362553Sls24207 uint8_t ncq_sector_count_ext; 5372553Sls24207 uint8_t reserved3[242]; 5382553Sls24207 uint8_t ncq_vendor_unique[255]; 5392553Sls24207 uint8_t ncq_checksum; 5402553Sls24207 }; 5412553Sls24207 54210131SJane.Chu@Sun.COM /* SMART attribute of Start/Stop Count */ 54310131SJane.Chu@Sun.COM #define SMART_START_STOP_COUNT_ID 0x4 54410131SJane.Chu@Sun.COM 5451612Sls24207 /* 5461612Sls24207 * SMART data structures 5471612Sls24207 */ 5481612Sls24207 struct smart_data { 5491612Sls24207 uint8_t smart_vendor_specific[362]; 5501612Sls24207 uint8_t smart_offline_data_collection_status; 5511612Sls24207 uint8_t smart_selftest_exec_status; 5521612Sls24207 uint8_t smart_secs_to_complete_offline_data[2]; 5531612Sls24207 uint8_t smart_vendor_specific2; 5541612Sls24207 uint8_t smart_offline_data_collection_capability; 5551612Sls24207 uint8_t smart_capability[2]; 5561612Sls24207 uint8_t smart_error_logging_capability; 5571612Sls24207 uint8_t smart_vendor_specific3; 5581612Sls24207 uint8_t smart_short_selftest_polling_time; 5591612Sls24207 uint8_t smart_extended_selftest_polling_time; 5601612Sls24207 uint8_t smart_conveyance_selftest_polling_time; 5611612Sls24207 uint8_t smart_reserved[11]; 5621612Sls24207 uint8_t smart_vendor_specific4[125]; 5631612Sls24207 uint8_t smart_checksum; 5641612Sls24207 }; 5651612Sls24207 5661612Sls24207 struct smart_selftest_log_entry { 5671612Sls24207 uint8_t smart_selftest_log_lba_low; 5681612Sls24207 uint8_t smart_selftest_log_status; 5691612Sls24207 uint8_t smart_selftest_log_timestamp[2]; 5701612Sls24207 uint8_t smart_selftest_log_checkpoint; 5711612Sls24207 uint8_t smart_selftest_log_failing_lba[4]; /* from LSB to MSB */ 5721612Sls24207 uint8_t smart_selftest_log_vendor_specific[15]; 5731612Sls24207 }; 5741612Sls24207 5751612Sls24207 #define NUM_SMART_SELFTEST_LOG_ENTRIES 21 5761612Sls24207 struct smart_selftest_log { 5771612Sls24207 uint8_t smart_selftest_log_revision[2]; 5781612Sls24207 struct smart_selftest_log_entry 5791612Sls24207 smart_selftest_log_entries[NUM_SMART_SELFTEST_LOG_ENTRIES]; 5801612Sls24207 uint8_t smart_selftest_log_vendor_specific[2]; 5811612Sls24207 uint8_t smart_selftest_log_index; 5821612Sls24207 uint8_t smart_selftest_log_reserved[2]; 5831612Sls24207 uint8_t smart_selftest_log_checksum; 5841612Sls24207 }; 5851612Sls24207 5861612Sls24207 struct smart_ext_selftest_log_entry { 5871612Sls24207 uint8_t smart_ext_selftest_log_lba_low; 5881612Sls24207 uint8_t smart_ext_selftest_log_status; 5891612Sls24207 uint8_t smart_ext_selftest_log_timestamp[2]; 5901612Sls24207 uint8_t smart_ext_selftest_log_checkpoint; 5911612Sls24207 uint8_t smart_ext_selftest_log_failing_lba[6]; 5921612Sls24207 uint8_t smart_ext_selftest_log_vendor_specific[15]; 5931612Sls24207 }; 5941612Sls24207 5951612Sls24207 struct smart_ext_selftest_log { 5961612Sls24207 uint8_t smart_ext_selftest_log_rev; 5971612Sls24207 uint8_t smart_ext_selftest_log_reserved; 5981612Sls24207 uint8_t smart_ext_selftest_log_index[2]; 5991612Sls24207 struct smart_ext_selftest_log_entry smart_ext_selftest_log_entries[19]; 6001612Sls24207 uint8_t smart_ext_selftest_log_vendor_specific[2]; 6011612Sls24207 uint8_t smart_ext_selftest_log_reserved2[11]; 6021612Sls24207 uint8_t smart_ext_selftest_log_checksum; 6031612Sls24207 }; 6041612Sls24207 6051612Sls24207 struct read_log_ext_directory { 6061612Sls24207 uint8_t read_log_ext_vers[2]; /* general purpose log version */ 6071940Sls24207 uint8_t read_log_ext_nblks[255][2]; /* # of blks @ log addr index+1 */ 6081612Sls24207 }; 6091612Sls24207 6101612Sls24207 /* 61110131SJane.Chu@Sun.COM * The definition of CONTROL byte field in SCSI command 61210131SJane.Chu@Sun.COM * according to SAM 5 61310131SJane.Chu@Sun.COM */ 61410131SJane.Chu@Sun.COM #define CTL_BYTE_VENDOR_MASK 0xc0 61510131SJane.Chu@Sun.COM #define CTL_BYTE_NACA_MASK 0x04 61610131SJane.Chu@Sun.COM 61710131SJane.Chu@Sun.COM /* 61810131SJane.Chu@Sun.COM * The definition of mask in START STOP UNIT command 61910131SJane.Chu@Sun.COM */ 62010131SJane.Chu@Sun.COM #define START_STOP_IMMED_MASK 0x01 62110131SJane.Chu@Sun.COM #define START_STOP_POWER_COND_MASK 0xF0 62210131SJane.Chu@Sun.COM #define START_STOP_START_MASK 0x01 62310131SJane.Chu@Sun.COM #define START_STOP_LOEJ_MASK 0x02 62410131SJane.Chu@Sun.COM #define START_STOP_NOFLUSH_MASK 0x04 62510131SJane.Chu@Sun.COM #define START_STOP_MODIFIER_MASK 0x0f 62610131SJane.Chu@Sun.COM #define START_STOP_POWER_COND_SHIFT 4 62710131SJane.Chu@Sun.COM 62810131SJane.Chu@Sun.COM /* 6291612Sls24207 * SMART specific data 63012017SAlan.Perry@Sun.COM * These eventually need to go to a generic scsi header file 6311612Sls24207 * for now they will reside here 6321612Sls24207 */ 6332553Sls24207 #define PC_CUMULATIVE_VALUES 0x01 6341612Sls24207 #define PAGE_CODE_GET_SUPPORTED_LOG_PAGES 0x00 6351612Sls24207 #define PAGE_CODE_SELF_TEST_RESULTS 0x10 6361612Sls24207 #define PAGE_CODE_INFORMATION_EXCEPTIONS 0x2f 6371612Sls24207 #define PAGE_CODE_SMART_READ_DATA 0x30 63810131SJane.Chu@Sun.COM #define PAGE_CODE_START_STOP_CYCLE_COUNTER 0x0e 6391612Sls24207 6401612Sls24207 6411612Sls24207 struct log_parameter { 6421612Sls24207 uint8_t param_code[2]; /* parameter dependant */ 6431612Sls24207 uint8_t param_ctrl_flags; /* see defines below */ 6441612Sls24207 uint8_t param_len; /* # of bytes following */ 6451612Sls24207 uint8_t param_values[1]; /* # of bytes defined by param_len */ 6461612Sls24207 }; 6471612Sls24207 6481612Sls24207 /* param_ctrl_flag fields */ 6491612Sls24207 #define LOG_CTRL_LP 0x01 /* list parameter */ 6501612Sls24207 #define LOG_CTRL_LBIN 0x02 /* list is binary */ 6511612Sls24207 #define LOG_CTRL_TMC 0x0c /* threshold met criteria */ 6521612Sls24207 #define LOG_CTRL_ETC 0x10 /* enable threshold comparison */ 6531612Sls24207 #define LOG_CTRL_TSD 0x20 /* target save disable */ 6541612Sls24207 #define LOG_CTRL_DS 0x40 /* disable save */ 6551612Sls24207 #define LOG_CTRL_DU 0x80 /* disable update */ 6561612Sls24207 6571612Sls24207 #define SMART_MAGIC_VAL_1 0x4f 6581612Sls24207 #define SMART_MAGIC_VAL_2 0xc2 6591612Sls24207 #define SMART_MAGIC_VAL_3 0xf4 6601612Sls24207 #define SMART_MAGIC_VAL_4 0x2c 6611612Sls24207 6621612Sls24207 #define SCT_STATUS_LOG_PAGE 0xe0 6631612Sls24207 6644836Sls24207 /* 6654836Sls24207 * Acoustic management 6664836Sls24207 */ 6674836Sls24207 6684836Sls24207 struct mode_acoustic_management { 6694836Sls24207 struct mode_page mode_page; /* common mode page header */ 6704836Sls24207 uchar_t acoustic_manag_enable; /* Set to 1 enable, Set 0 disable */ 6714836Sls24207 uchar_t acoustic_manag_level; /* Acoustic management level */ 6724836Sls24207 uchar_t vendor_recommended_value; /* Vendor recommended value */ 6734836Sls24207 }; 6744836Sls24207 6754836Sls24207 #define PAGELENGTH_DAD_MODE_ACOUSTIC_MANAGEMENT 3 /* Acoustic manag pg len */ 6764836Sls24207 #define P_CNTRL_CURRENT 0 6774836Sls24207 #define P_CNTRL_CHANGEABLE 1 6784836Sls24207 #define P_CNTRL_DEFAULT 2 6794836Sls24207 #define P_CNTRL_SAVED 3 6804836Sls24207 6814836Sls24207 #define ACOUSTIC_DISABLED 0 6824836Sls24207 #define ACOUSTIC_ENABLED 1 6834836Sls24207 6844836Sls24207 #define MODEPAGE_ACOUSTIC_MANAG 0x30 6854836Sls24207 6864876Smlf /* 68710318SXiao-Yu.Zhang@Sun.COM * Port Multiplier registers' offsets 68810318SXiao-Yu.Zhang@Sun.COM */ 68910318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_GSCR0 0x0 69010318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_GSCR1 0x1 69110318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_GSCR2 0x2 69210318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_GSCR32 0x20 69310318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_GSCR33 0x21 69410318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_GSCR64 0x40 69510318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_GSCR96 0x60 69610318SXiao-Yu.Zhang@Sun.COM 69710318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_PORTNUM_MASK 0xf 69810318SXiao-Yu.Zhang@Sun.COM 69910318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_PSCR0 0x0 70010318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_PSCR1 0x1 70110318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_PSCR2 0x2 70210318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_PSCR3 0x3 70310318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_PSCR4 0x4 70410318SXiao-Yu.Zhang@Sun.COM 70510318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_REG_SSTS (SATA_PMULT_PSCR0) 70610318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_REG_SERR (SATA_PMULT_PSCR1) 70710318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_REG_SCTL (SATA_PMULT_PSCR2) 70810318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_REG_SACT (SATA_PMULT_PSCR3) 70910318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_REG_SNTF (SATA_PMULT_PSCR4) 71010318SXiao-Yu.Zhang@Sun.COM 71110318SXiao-Yu.Zhang@Sun.COM /* 71210318SXiao-Yu.Zhang@Sun.COM * Port Multiplier capabilities 71310318SXiao-Yu.Zhang@Sun.COM * (Indicated by GSCR64, and enabled by GSCR96) 71410318SXiao-Yu.Zhang@Sun.COM */ 71510318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_CAP_BIST (1 << 0) 71610318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_CAP_PMREQ (1 << 1) 71710318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_CAP_SSC (1 << 2) 71810318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_CAP_SNOTIF (1 << 3) 71910318SXiao-Yu.Zhang@Sun.COM #define SATA_PMULT_CAP_PHYEVENT (1 << 4) 72010318SXiao-Yu.Zhang@Sun.COM 72110318SXiao-Yu.Zhang@Sun.COM /* 7224876Smlf * sstatus field definitions 7234876Smlf */ 7244876Smlf #define SSTATUS_DET_SHIFT 0 7254876Smlf #define SSTATUS_SPD_SHIFT 4 7264876Smlf #define SSTATUS_IPM_SHIFT 8 7274876Smlf 7284876Smlf #define SSTATUS_DET (0xf << SSTATUS_DET_SHIFT) 7294876Smlf #define SSTATUS_SPD (0xf << SSTATUS_SPD_SHIFT) 7304876Smlf #define SSTATUS_IPM (0xf << SSTATUS_IPM_SHIFT) 7314876Smlf 7324876Smlf /* 7334876Smlf * sstatus DET values 7344876Smlf */ 7354876Smlf #define SSTATUS_DET_NODEV 0 /* No dev detected */ 7364876Smlf #define SSTATUS_DET_DEVPRE_NOPHYCOM 1 /* dev detected */ 7374876Smlf #define SSTATUS_DET_DEVPRE_PHYCOM 3 /* dev detected */ 7384876Smlf #define SSTATUS_DET_PHYOFFLINE 4 /* PHY is in offline */ 7394876Smlf 7404876Smlf #define SSTATUS_GET_DET(x) \ 7414876Smlf (x & SSTATUS_DET) 7424876Smlf 7434876Smlf #define SSTATUS_SET_DET(x, new_val) \ 7444876Smlf (x = (x & ~SSTATUS_DET) | (new_val & SSTATUS_DET)) 7454876Smlf 7464876Smlf #define SSTATUS_SPD_NOLIMIT 0 /* No speed limit */ 7474876Smlf #define SSTATUS_SPD_GEN1 1 /* Limit Gen 1 rate */ 7484876Smlf #define SSTATUS_SPD_GEN2 2 /* Limit Gen 2 rate */ 7494876Smlf 7504876Smlf /* 7514876Smlf * sstatus IPM values 7524876Smlf */ 7534876Smlf #define SSTATUS_IPM_NODEV_NOPHYCOM 0x0 /* No dev, no PHY */ 7544876Smlf #define SSTATUS_IPM_ACTIVE 0x1 /* Interface active */ 7554876Smlf #define SSTATUS_IPM_POWERPARTIAL 0x2 /* partial power mgmnt */ 7564876Smlf #define SSTATUS_IPM_POWERSLUMBER 0x6 /* slumber power mgmt */ 7574876Smlf 7584876Smlf #define SSTATUS_GET_IPM(x) \ 7594876Smlf ((x & SSTATUS_IPM) >> SSTATUS_IPM_SHIFT) 7604876Smlf 7614876Smlf #define SSTATUS_SET_IPM(x, new_val) \ 7624876Smlf (x = (x & ~SSTATUS_IPM) | \ 7634876Smlf ((new_val << SSTATUS_IPM_SHIFT) & SSTATUS_IPM)) 7644876Smlf 7654876Smlf 7664876Smlf /* 7674876Smlf * serror register fields 7684876Smlf */ 7694876Smlf #define SERROR_DATA_ERR_FIXED (1 << 0) /* D integrity err */ 7704876Smlf #define SERROR_COMM_ERR_FIXED (1 << 1) /* comm err recov */ 7714876Smlf #define SERROR_DATA_ERR (1 << 8) /* D integrity err */ 7724876Smlf #define SERROR_PERSISTENT_ERR (1 << 9) /* norecov com err */ 7734876Smlf #define SERROR_PROTOCOL_ERR (1 << 10) /* protocol err */ 7744876Smlf #define SERROR_INT_ERR (1 << 11) /* internal err */ 7754876Smlf #define SERROR_PHY_RDY_CHG (1 << 16) /* PHY state change */ 7764876Smlf #define SERROR_PHY_INT_ERR (1 << 17) /* PHY internal err */ 7774876Smlf #define SERROR_COMM_WAKE (1 << 18) /* COM wake */ 7784876Smlf #define SERROR_10B_TO_8B_ERR (1 << 19) /* 10B-to-8B decode */ 7794876Smlf #define SERROR_DISPARITY_ERR (1 << 20) /* disparity err */ 7804876Smlf #define SERROR_CRC_ERR (1 << 21) /* CRC err */ 7814876Smlf #define SERROR_HANDSHAKE_ERR (1 << 22) /* Handshake err */ 7824876Smlf #define SERROR_LINK_SEQ_ERR (1 << 23) /* Link seq err */ 7834876Smlf #define SERROR_TRANS_ERR (1 << 24) /* Tran state err */ 7844876Smlf #define SERROR_FIS_TYPE (1 << 25) /* FIS type err */ 7854876Smlf #define SERROR_EXCHANGED_ERR (1 << 26) /* Device exchanged */ 7864876Smlf 7874876Smlf /* 7884876Smlf * S-Control Bridge port x register fields 7894876Smlf */ 7904876Smlf #define SCONTROL_DET_SHIFT 0 7914876Smlf #define SCONTROL_SPD_SHIFT 4 7924876Smlf #define SCONTROL_IPM_SHIFT 8 7934876Smlf #define SCONTROL_SPM_SHIFT 12 7944876Smlf 7954876Smlf #define SCONTROL_DET (0xf << SSTATUS_DET_SHIFT) 7964876Smlf #define SCONTROL_SPD (0xf << SSTATUS_SPD_SHIFT) 7974876Smlf #define SCONTROL_IPM (0xf << SSTATUS_IPM_SHIFT) 7984876Smlf #define SCONTROL_SPM (0xf << SSTATUS_SPM_SHIFT) 7994876Smlf 8004876Smlf #define SCONTROL_GET_DET(x) \ 8014876Smlf (x & SCONTROL_DET) 8024876Smlf 8034876Smlf #define SCONTROL_SET_DET(x, new_val) \ 8044876Smlf (x = (x & ~SCONTROL_DET) | (new_val & SCONTROL_DET)) 8054876Smlf 8064876Smlf #define SCONTROL_DET_NOACTION 0 /* Do nothing to port */ 8074876Smlf #define SCONTROL_DET_COMRESET 1 /* Re-initialize port */ 8084876Smlf #define SCONTROL_DET_DISABLE 4 /* Disable port */ 8094876Smlf 8104876Smlf #define SCONTROL_SPD_NOLIMIT 0 /* No speed limit */ 8114876Smlf #define SCONTROL_SPD_GEN1 1 /* Limit Gen 1 rate */ 8124876Smlf #define SCONTROL_SPD_GEN2 2 /* Limit Gen 2 rate */ 8134876Smlf 8146187Syt160523 #define SCONTROL_GET_IPM(x) \ 8156187Syt160523 ((x & SCONTROL_IPM) >> SCONTROL_IPM_SHIFT) 8166187Syt160523 8176187Syt160523 #define SCONTROL_SET_IPM(x, new_val) \ 8186187Syt160523 (x = (x & ~SCONTROL_IPM) | \ 8196187Syt160523 ((new_val << SCONTROL_IPM_SHIFT) & SCONTROL_IPM)) 8206187Syt160523 8214876Smlf #define SCONTROL_IPM_NORESTRICT 0 /* No PM limit */ 8224876Smlf #define SCONTROL_IPM_DISABLE_PARTIAL 1 /* Disable partial */ 8234876Smlf #define SCONTROL_IPM_DISABLE_SLUMBER 2 /* Disable slumber */ 8244876Smlf #define SCONTROL_IPM_DISABLE_BOTH 3 /* Disable both */ 8254876Smlf 8264876Smlf #define SCONTROL_SPM_NORESTRICT 0 /* No PM limits */ 8274876Smlf #define SCONTROL_SPM_DO_PARTIAL 1 /* Go to partial */ 8284876Smlf #define SCONTROL_SPM_DO_SLUMBER 2 /* Go to slumber */ 8294876Smlf #define SCONTROL_SPM_DO_ACTIVE 4 /* Go to active */ 8304876Smlf 8311258Smlf #ifdef __cplusplus 8321258Smlf } 8331258Smlf #endif 8341258Smlf 8351258Smlf #endif /* _SATA_DEFS_H */ 836