1c354c096SPeter Grehan /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 31de7b4b8SPedro F. Giffuni * 4c354c096SPeter Grehan * Copyright (c) 1998 - 2008 Søren Schmidt <sos@FreeBSD.org> 5c354c096SPeter Grehan * Copyright (c) 2009-2012 Alexander Motin <mav@FreeBSD.org> 6c354c096SPeter Grehan * All rights reserved. 7c354c096SPeter Grehan * 8c354c096SPeter Grehan * Redistribution and use in source and binary forms, with or without 9c354c096SPeter Grehan * modification, are permitted provided that the following conditions 10c354c096SPeter Grehan * are met: 11c354c096SPeter Grehan * 1. Redistributions of source code must retain the above copyright 12c354c096SPeter Grehan * notice, this list of conditions and the following disclaimer, 13c354c096SPeter Grehan * without modification, immediately at the beginning of the file. 14c354c096SPeter Grehan * 2. Redistributions in binary form must reproduce the above copyright 15c354c096SPeter Grehan * notice, this list of conditions and the following disclaimer in the 16c354c096SPeter Grehan * documentation and/or other materials provided with the distribution. 17c354c096SPeter Grehan * 18c354c096SPeter Grehan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19c354c096SPeter Grehan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20c354c096SPeter Grehan * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21c354c096SPeter Grehan * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22c354c096SPeter Grehan * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23c354c096SPeter Grehan * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24c354c096SPeter Grehan * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25c354c096SPeter Grehan * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26c354c096SPeter Grehan * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27c354c096SPeter Grehan * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28c354c096SPeter Grehan */ 29c354c096SPeter Grehan 30c354c096SPeter Grehan #ifndef _AHCI_H_ 31c354c096SPeter Grehan #define _AHCI_H_ 32c354c096SPeter Grehan 33c354c096SPeter Grehan /* ATA register defines */ 34c354c096SPeter Grehan #define ATA_DATA 0 /* (RW) data */ 35c354c096SPeter Grehan 36c354c096SPeter Grehan #define ATA_FEATURE 1 /* (W) feature */ 37c354c096SPeter Grehan #define ATA_F_DMA 0x01 /* enable DMA */ 38c354c096SPeter Grehan #define ATA_F_OVL 0x02 /* enable overlap */ 39c354c096SPeter Grehan 40c354c096SPeter Grehan #define ATA_COUNT 2 /* (W) sector count */ 41c354c096SPeter Grehan 42c354c096SPeter Grehan #define ATA_SECTOR 3 /* (RW) sector # */ 43c354c096SPeter Grehan #define ATA_CYL_LSB 4 /* (RW) cylinder# LSB */ 44c354c096SPeter Grehan #define ATA_CYL_MSB 5 /* (RW) cylinder# MSB */ 45c354c096SPeter Grehan #define ATA_DRIVE 6 /* (W) Sector/Drive/Head */ 46c354c096SPeter Grehan #define ATA_D_LBA 0x40 /* use LBA addressing */ 47c354c096SPeter Grehan #define ATA_D_IBM 0xa0 /* 512 byte sectors, ECC */ 48c354c096SPeter Grehan 49c354c096SPeter Grehan #define ATA_COMMAND 7 /* (W) command */ 50c354c096SPeter Grehan 51c354c096SPeter Grehan #define ATA_ERROR 8 /* (R) error */ 52c354c096SPeter Grehan #define ATA_E_ILI 0x01 /* illegal length */ 53c354c096SPeter Grehan #define ATA_E_NM 0x02 /* no media */ 54c354c096SPeter Grehan #define ATA_E_ABORT 0x04 /* command aborted */ 55c354c096SPeter Grehan #define ATA_E_MCR 0x08 /* media change request */ 56c354c096SPeter Grehan #define ATA_E_IDNF 0x10 /* ID not found */ 57c354c096SPeter Grehan #define ATA_E_MC 0x20 /* media changed */ 58c354c096SPeter Grehan #define ATA_E_UNC 0x40 /* uncorrectable data */ 59c354c096SPeter Grehan #define ATA_E_ICRC 0x80 /* UDMA crc error */ 60c354c096SPeter Grehan #define ATA_E_ATAPI_SENSE_MASK 0xf0 /* ATAPI sense key mask */ 61c354c096SPeter Grehan 62c354c096SPeter Grehan #define ATA_IREASON 9 /* (R) interrupt reason */ 63c354c096SPeter Grehan #define ATA_I_CMD 0x01 /* cmd (1) | data (0) */ 64c354c096SPeter Grehan #define ATA_I_IN 0x02 /* read (1) | write (0) */ 65c354c096SPeter Grehan #define ATA_I_RELEASE 0x04 /* released bus (1) */ 66c354c096SPeter Grehan #define ATA_I_TAGMASK 0xf8 /* tag mask */ 67c354c096SPeter Grehan 68c354c096SPeter Grehan #define ATA_STATUS 10 /* (R) status */ 69c354c096SPeter Grehan #define ATA_ALTSTAT 11 /* (R) alternate status */ 70c354c096SPeter Grehan #define ATA_S_ERROR 0x01 /* error */ 71c354c096SPeter Grehan #define ATA_S_INDEX 0x02 /* index */ 72c354c096SPeter Grehan #define ATA_S_CORR 0x04 /* data corrected */ 73c354c096SPeter Grehan #define ATA_S_DRQ 0x08 /* data request */ 74c354c096SPeter Grehan #define ATA_S_DSC 0x10 /* drive seek completed */ 75c354c096SPeter Grehan #define ATA_S_SERVICE 0x10 /* drive needs service */ 76c354c096SPeter Grehan #define ATA_S_DWF 0x20 /* drive write fault */ 77c354c096SPeter Grehan #define ATA_S_DMA 0x20 /* DMA ready */ 78c354c096SPeter Grehan #define ATA_S_READY 0x40 /* drive ready */ 79c354c096SPeter Grehan #define ATA_S_BUSY 0x80 /* busy */ 80c354c096SPeter Grehan 81c354c096SPeter Grehan #define ATA_CONTROL 12 /* (W) control */ 82c354c096SPeter Grehan #define ATA_A_IDS 0x02 /* disable interrupts */ 83c354c096SPeter Grehan #define ATA_A_RESET 0x04 /* RESET controller */ 84c354c096SPeter Grehan #define ATA_A_4BIT 0x08 /* 4 head bits */ 85c354c096SPeter Grehan #define ATA_A_HOB 0x80 /* High Order Byte enable */ 86c354c096SPeter Grehan 87c354c096SPeter Grehan /* SATA register defines */ 88c354c096SPeter Grehan #define ATA_SSTATUS 13 89c354c096SPeter Grehan #define ATA_SS_DET_MASK 0x0000000f 90c354c096SPeter Grehan #define ATA_SS_DET_NO_DEVICE 0x00000000 91c354c096SPeter Grehan #define ATA_SS_DET_DEV_PRESENT 0x00000001 92c354c096SPeter Grehan #define ATA_SS_DET_PHY_ONLINE 0x00000003 93c354c096SPeter Grehan #define ATA_SS_DET_PHY_OFFLINE 0x00000004 94c354c096SPeter Grehan 95c354c096SPeter Grehan #define ATA_SS_SPD_MASK 0x000000f0 96c354c096SPeter Grehan #define ATA_SS_SPD_NO_SPEED 0x00000000 97c354c096SPeter Grehan #define ATA_SS_SPD_GEN1 0x00000010 98c354c096SPeter Grehan #define ATA_SS_SPD_GEN2 0x00000020 99295e61d6SAlexander Motin #define ATA_SS_SPD_GEN3 0x00000030 100c354c096SPeter Grehan 101c354c096SPeter Grehan #define ATA_SS_IPM_MASK 0x00000f00 102c354c096SPeter Grehan #define ATA_SS_IPM_NO_DEVICE 0x00000000 103c354c096SPeter Grehan #define ATA_SS_IPM_ACTIVE 0x00000100 104c354c096SPeter Grehan #define ATA_SS_IPM_PARTIAL 0x00000200 105c354c096SPeter Grehan #define ATA_SS_IPM_SLUMBER 0x00000600 106295e61d6SAlexander Motin #define ATA_SS_IPM_DEVSLEEP 0x00000800 107c354c096SPeter Grehan 108c354c096SPeter Grehan #define ATA_SERROR 14 109c354c096SPeter Grehan #define ATA_SE_DATA_CORRECTED 0x00000001 110c354c096SPeter Grehan #define ATA_SE_COMM_CORRECTED 0x00000002 111c354c096SPeter Grehan #define ATA_SE_DATA_ERR 0x00000100 112c354c096SPeter Grehan #define ATA_SE_COMM_ERR 0x00000200 113c354c096SPeter Grehan #define ATA_SE_PROT_ERR 0x00000400 114c354c096SPeter Grehan #define ATA_SE_HOST_ERR 0x00000800 115c354c096SPeter Grehan #define ATA_SE_PHY_CHANGED 0x00010000 116c354c096SPeter Grehan #define ATA_SE_PHY_IERROR 0x00020000 117c354c096SPeter Grehan #define ATA_SE_COMM_WAKE 0x00040000 118c354c096SPeter Grehan #define ATA_SE_DECODE_ERR 0x00080000 119c354c096SPeter Grehan #define ATA_SE_PARITY_ERR 0x00100000 120c354c096SPeter Grehan #define ATA_SE_CRC_ERR 0x00200000 121c354c096SPeter Grehan #define ATA_SE_HANDSHAKE_ERR 0x00400000 122c354c096SPeter Grehan #define ATA_SE_LINKSEQ_ERR 0x00800000 123c354c096SPeter Grehan #define ATA_SE_TRANSPORT_ERR 0x01000000 124c354c096SPeter Grehan #define ATA_SE_UNKNOWN_FIS 0x02000000 125c354c096SPeter Grehan #define ATA_SE_EXCHANGED 0x04000000 126c354c096SPeter Grehan 127c354c096SPeter Grehan #define ATA_SCONTROL 15 128c354c096SPeter Grehan #define ATA_SC_DET_MASK 0x0000000f 129c354c096SPeter Grehan #define ATA_SC_DET_IDLE 0x00000000 130c354c096SPeter Grehan #define ATA_SC_DET_RESET 0x00000001 131c354c096SPeter Grehan #define ATA_SC_DET_DISABLE 0x00000004 132c354c096SPeter Grehan 133c354c096SPeter Grehan #define ATA_SC_SPD_MASK 0x000000f0 134c354c096SPeter Grehan #define ATA_SC_SPD_NO_SPEED 0x00000000 135c354c096SPeter Grehan #define ATA_SC_SPD_SPEED_GEN1 0x00000010 136c354c096SPeter Grehan #define ATA_SC_SPD_SPEED_GEN2 0x00000020 137295e61d6SAlexander Motin #define ATA_SC_SPD_SPEED_GEN3 0x00000030 138c354c096SPeter Grehan 139c354c096SPeter Grehan #define ATA_SC_IPM_MASK 0x00000f00 140c354c096SPeter Grehan #define ATA_SC_IPM_NONE 0x00000000 141c354c096SPeter Grehan #define ATA_SC_IPM_DIS_PARTIAL 0x00000100 142c354c096SPeter Grehan #define ATA_SC_IPM_DIS_SLUMBER 0x00000200 143295e61d6SAlexander Motin #define ATA_SC_IPM_DIS_DEVSLEEP 0x00000400 144c354c096SPeter Grehan 145c354c096SPeter Grehan #define ATA_SACTIVE 16 146c354c096SPeter Grehan 147c354c096SPeter Grehan #define AHCI_MAX_PORTS 32 148c354c096SPeter Grehan #define AHCI_MAX_SLOTS 32 149295e61d6SAlexander Motin #define AHCI_MAX_IRQS 16 150c354c096SPeter Grehan 151c354c096SPeter Grehan /* SATA AHCI v1.0 register defines */ 152c354c096SPeter Grehan #define AHCI_CAP 0x00 153c354c096SPeter Grehan #define AHCI_CAP_NPMASK 0x0000001f 154c354c096SPeter Grehan #define AHCI_CAP_SXS 0x00000020 155c354c096SPeter Grehan #define AHCI_CAP_EMS 0x00000040 156c354c096SPeter Grehan #define AHCI_CAP_CCCS 0x00000080 157c354c096SPeter Grehan #define AHCI_CAP_NCS 0x00001F00 158c354c096SPeter Grehan #define AHCI_CAP_NCS_SHIFT 8 159c354c096SPeter Grehan #define AHCI_CAP_PSC 0x00002000 160c354c096SPeter Grehan #define AHCI_CAP_SSC 0x00004000 161c354c096SPeter Grehan #define AHCI_CAP_PMD 0x00008000 162c354c096SPeter Grehan #define AHCI_CAP_FBSS 0x00010000 163c354c096SPeter Grehan #define AHCI_CAP_SPM 0x00020000 164c354c096SPeter Grehan #define AHCI_CAP_SAM 0x00080000 165c354c096SPeter Grehan #define AHCI_CAP_ISS 0x00F00000 166c354c096SPeter Grehan #define AHCI_CAP_ISS_SHIFT 20 167c354c096SPeter Grehan #define AHCI_CAP_SCLO 0x01000000 168c354c096SPeter Grehan #define AHCI_CAP_SAL 0x02000000 169c354c096SPeter Grehan #define AHCI_CAP_SALP 0x04000000 170c354c096SPeter Grehan #define AHCI_CAP_SSS 0x08000000 171c354c096SPeter Grehan #define AHCI_CAP_SMPS 0x10000000 172c354c096SPeter Grehan #define AHCI_CAP_SSNTF 0x20000000 173c354c096SPeter Grehan #define AHCI_CAP_SNCQ 0x40000000 174c354c096SPeter Grehan #define AHCI_CAP_64BIT 0x80000000 175c354c096SPeter Grehan 176c354c096SPeter Grehan #define AHCI_GHC 0x04 177c354c096SPeter Grehan #define AHCI_GHC_AE 0x80000000 178c354c096SPeter Grehan #define AHCI_GHC_MRSM 0x00000004 179c354c096SPeter Grehan #define AHCI_GHC_IE 0x00000002 180c354c096SPeter Grehan #define AHCI_GHC_HR 0x00000001 181c354c096SPeter Grehan 182c354c096SPeter Grehan #define AHCI_IS 0x08 183c354c096SPeter Grehan #define AHCI_PI 0x0c 184c354c096SPeter Grehan #define AHCI_VS 0x10 185c354c096SPeter Grehan 186c354c096SPeter Grehan #define AHCI_CCCC 0x14 187c354c096SPeter Grehan #define AHCI_CCCC_TV_MASK 0xffff0000 188c354c096SPeter Grehan #define AHCI_CCCC_TV_SHIFT 16 189c354c096SPeter Grehan #define AHCI_CCCC_CC_MASK 0x0000ff00 190c354c096SPeter Grehan #define AHCI_CCCC_CC_SHIFT 8 191c354c096SPeter Grehan #define AHCI_CCCC_INT_MASK 0x000000f8 192c354c096SPeter Grehan #define AHCI_CCCC_INT_SHIFT 3 193c354c096SPeter Grehan #define AHCI_CCCC_EN 0x00000001 194c354c096SPeter Grehan #define AHCI_CCCP 0x18 195c354c096SPeter Grehan 196c354c096SPeter Grehan #define AHCI_EM_LOC 0x1C 197c354c096SPeter Grehan #define AHCI_EM_CTL 0x20 198c354c096SPeter Grehan #define AHCI_EM_MR 0x00000001 199c354c096SPeter Grehan #define AHCI_EM_TM 0x00000100 200c354c096SPeter Grehan #define AHCI_EM_RST 0x00000200 201c354c096SPeter Grehan #define AHCI_EM_LED 0x00010000 202c354c096SPeter Grehan #define AHCI_EM_SAFTE 0x00020000 203c354c096SPeter Grehan #define AHCI_EM_SES2 0x00040000 204c354c096SPeter Grehan #define AHCI_EM_SGPIO 0x00080000 205c354c096SPeter Grehan #define AHCI_EM_SMB 0x01000000 206c354c096SPeter Grehan #define AHCI_EM_XMT 0x02000000 207c354c096SPeter Grehan #define AHCI_EM_ALHD 0x04000000 208c354c096SPeter Grehan #define AHCI_EM_PM 0x08000000 209c354c096SPeter Grehan 210c354c096SPeter Grehan #define AHCI_CAP2 0x24 211c354c096SPeter Grehan #define AHCI_CAP2_BOH 0x00000001 212c354c096SPeter Grehan #define AHCI_CAP2_NVMP 0x00000002 213c354c096SPeter Grehan #define AHCI_CAP2_APST 0x00000004 214295e61d6SAlexander Motin #define AHCI_CAP2_SDS 0x00000008 215295e61d6SAlexander Motin #define AHCI_CAP2_SADM 0x00000010 216295e61d6SAlexander Motin #define AHCI_CAP2_DESO 0x00000020 217c354c096SPeter Grehan 218c354c096SPeter Grehan #define AHCI_OFFSET 0x100 219c354c096SPeter Grehan #define AHCI_STEP 0x80 220c354c096SPeter Grehan 221c354c096SPeter Grehan #define AHCI_P_CLB 0x00 222c354c096SPeter Grehan #define AHCI_P_CLBU 0x04 223c354c096SPeter Grehan #define AHCI_P_FB 0x08 224c354c096SPeter Grehan #define AHCI_P_FBU 0x0c 225c354c096SPeter Grehan #define AHCI_P_IS 0x10 226c354c096SPeter Grehan #define AHCI_P_IE 0x14 227c354c096SPeter Grehan #define AHCI_P_IX_DHR 0x00000001 228c354c096SPeter Grehan #define AHCI_P_IX_PS 0x00000002 229c354c096SPeter Grehan #define AHCI_P_IX_DS 0x00000004 230c354c096SPeter Grehan #define AHCI_P_IX_SDB 0x00000008 231c354c096SPeter Grehan #define AHCI_P_IX_UF 0x00000010 232c354c096SPeter Grehan #define AHCI_P_IX_DP 0x00000020 233c354c096SPeter Grehan #define AHCI_P_IX_PC 0x00000040 234c354c096SPeter Grehan #define AHCI_P_IX_MP 0x00000080 235c354c096SPeter Grehan 236c354c096SPeter Grehan #define AHCI_P_IX_PRC 0x00400000 237c354c096SPeter Grehan #define AHCI_P_IX_IPM 0x00800000 238c354c096SPeter Grehan #define AHCI_P_IX_OF 0x01000000 239c354c096SPeter Grehan #define AHCI_P_IX_INF 0x04000000 240c354c096SPeter Grehan #define AHCI_P_IX_IF 0x08000000 241c354c096SPeter Grehan #define AHCI_P_IX_HBD 0x10000000 242c354c096SPeter Grehan #define AHCI_P_IX_HBF 0x20000000 243c354c096SPeter Grehan #define AHCI_P_IX_TFE 0x40000000 244c354c096SPeter Grehan #define AHCI_P_IX_CPD 0x80000000 245c354c096SPeter Grehan 246c354c096SPeter Grehan #define AHCI_P_CMD 0x18 247c354c096SPeter Grehan #define AHCI_P_CMD_ST 0x00000001 248c354c096SPeter Grehan #define AHCI_P_CMD_SUD 0x00000002 249c354c096SPeter Grehan #define AHCI_P_CMD_POD 0x00000004 250c354c096SPeter Grehan #define AHCI_P_CMD_CLO 0x00000008 251c354c096SPeter Grehan #define AHCI_P_CMD_FRE 0x00000010 252c354c096SPeter Grehan #define AHCI_P_CMD_CCS_MASK 0x00001f00 253c354c096SPeter Grehan #define AHCI_P_CMD_CCS_SHIFT 8 254c354c096SPeter Grehan #define AHCI_P_CMD_ISS 0x00002000 255c354c096SPeter Grehan #define AHCI_P_CMD_FR 0x00004000 256c354c096SPeter Grehan #define AHCI_P_CMD_CR 0x00008000 257c354c096SPeter Grehan #define AHCI_P_CMD_CPS 0x00010000 258c354c096SPeter Grehan #define AHCI_P_CMD_PMA 0x00020000 259c354c096SPeter Grehan #define AHCI_P_CMD_HPCP 0x00040000 260c354c096SPeter Grehan #define AHCI_P_CMD_MPSP 0x00080000 261c354c096SPeter Grehan #define AHCI_P_CMD_CPD 0x00100000 262c354c096SPeter Grehan #define AHCI_P_CMD_ESP 0x00200000 263c354c096SPeter Grehan #define AHCI_P_CMD_FBSCP 0x00400000 264c354c096SPeter Grehan #define AHCI_P_CMD_APSTE 0x00800000 265c354c096SPeter Grehan #define AHCI_P_CMD_ATAPI 0x01000000 266c354c096SPeter Grehan #define AHCI_P_CMD_DLAE 0x02000000 267c354c096SPeter Grehan #define AHCI_P_CMD_ALPE 0x04000000 268c354c096SPeter Grehan #define AHCI_P_CMD_ASP 0x08000000 269c354c096SPeter Grehan #define AHCI_P_CMD_ICC_MASK 0xf0000000 270c354c096SPeter Grehan #define AHCI_P_CMD_NOOP 0x00000000 271c354c096SPeter Grehan #define AHCI_P_CMD_ACTIVE 0x10000000 272c354c096SPeter Grehan #define AHCI_P_CMD_PARTIAL 0x20000000 273c354c096SPeter Grehan #define AHCI_P_CMD_SLUMBER 0x60000000 274295e61d6SAlexander Motin #define AHCI_P_CMD_DEVSLEEP 0x80000000 275c354c096SPeter Grehan 276c354c096SPeter Grehan #define AHCI_P_TFD 0x20 277c354c096SPeter Grehan #define AHCI_P_SIG 0x24 278c354c096SPeter Grehan #define AHCI_P_SSTS 0x28 279c354c096SPeter Grehan #define AHCI_P_SCTL 0x2c 280c354c096SPeter Grehan #define AHCI_P_SERR 0x30 281c354c096SPeter Grehan #define AHCI_P_SACT 0x34 282c354c096SPeter Grehan #define AHCI_P_CI 0x38 283c354c096SPeter Grehan #define AHCI_P_SNTF 0x3C 284c354c096SPeter Grehan #define AHCI_P_FBS 0x40 285c354c096SPeter Grehan #define AHCI_P_FBS_EN 0x00000001 286c354c096SPeter Grehan #define AHCI_P_FBS_DEC 0x00000002 287c354c096SPeter Grehan #define AHCI_P_FBS_SDE 0x00000004 288c354c096SPeter Grehan #define AHCI_P_FBS_DEV 0x00000f00 289c354c096SPeter Grehan #define AHCI_P_FBS_DEV_SHIFT 8 290c354c096SPeter Grehan #define AHCI_P_FBS_ADO 0x0000f000 291c354c096SPeter Grehan #define AHCI_P_FBS_ADO_SHIFT 12 292c354c096SPeter Grehan #define AHCI_P_FBS_DWE 0x000f0000 293c354c096SPeter Grehan #define AHCI_P_FBS_DWE_SHIFT 16 294295e61d6SAlexander Motin #define AHCI_P_DEVSLP 0x44 295295e61d6SAlexander Motin #define AHCI_P_DEVSLP_ADSE 0x00000001 296295e61d6SAlexander Motin #define AHCI_P_DEVSLP_DSP 0x00000002 297295e61d6SAlexander Motin #define AHCI_P_DEVSLP_DETO 0x000003fc 298295e61d6SAlexander Motin #define AHCI_P_DEVSLP_DETO_SHIFT 2 299295e61d6SAlexander Motin #define AHCI_P_DEVSLP_MDAT 0x00007c00 300295e61d6SAlexander Motin #define AHCI_P_DEVSLP_MDAT_SHIFT 10 301295e61d6SAlexander Motin #define AHCI_P_DEVSLP_DITO 0x01ff8000 302295e61d6SAlexander Motin #define AHCI_P_DEVSLP_DITO_SHIFT 15 303295e61d6SAlexander Motin #define AHCI_P_DEVSLP_DM 0x0e000000 304295e61d6SAlexander Motin #define AHCI_P_DEVSLP_DM_SHIFT 25 305c354c096SPeter Grehan 306c354c096SPeter Grehan /* Just to be sure, if building as module. */ 307c354c096SPeter Grehan #if MAXPHYS < 512 * 1024 308c354c096SPeter Grehan #undef MAXPHYS 309c354c096SPeter Grehan #define MAXPHYS 512 * 1024 310c354c096SPeter Grehan #endif 311c354c096SPeter Grehan /* Pessimistic prognosis on number of required S/G entries */ 312c354c096SPeter Grehan #define AHCI_SG_ENTRIES (roundup(btoc(MAXPHYS) + 1, 8)) 313c354c096SPeter Grehan /* Command list. 32 commands. First, 1Kbyte aligned. */ 314c354c096SPeter Grehan #define AHCI_CL_OFFSET 0 315c354c096SPeter Grehan #define AHCI_CL_SIZE 32 316c354c096SPeter Grehan /* Command tables. Up to 32 commands, Each, 128byte aligned. */ 317c354c096SPeter Grehan #define AHCI_CT_OFFSET (AHCI_CL_OFFSET + AHCI_CL_SIZE * AHCI_MAX_SLOTS) 318c354c096SPeter Grehan #define AHCI_CT_SIZE (128 + AHCI_SG_ENTRIES * 16) 319c354c096SPeter Grehan /* Total main work area. */ 320c354c096SPeter Grehan #define AHCI_WORK_SIZE (AHCI_CT_OFFSET + AHCI_CT_SIZE * ch->numslots) 321c354c096SPeter Grehan 322c354c096SPeter Grehan #endif /* _AHCI_H_ */ 323