ahcivar.h revision 2fcbc377041d659446ded306a92901b4b0753b68
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _AHCIVAR_H
#define _AHCIVAR_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ahci_port {
/* The physical port number - for debug message */
/* Type of the device attached to the port */
/* State of the port */
/* Only used for staggered spin-up */
int ahciport_flags;
/* Pointer to received FIS structure */
/* Pointer to command list structure */
/* Pointer to cmmand table structure */
/*
* SATA HBA driver is supposed to remember and maintain device
* reset state. While the reset is in progress, it doesn't accept
* any more commands until receiving the command with
* SATA_CLEAR_DEV_RESET_STATE flag and SATA_IGNORE_DEV_RESET_STATE.
*/
} ahci_port_t;
/* Warlock annotation */
typedef struct ahci_ctl {
/* To map port number to cport number */
/* To map cport number to port number */
/* Number of controller ports */
int ahcictl_num_ports;
/* Number of command slots */
/* Number of implemented ports */
/* Bit map to indicate which port is implemented */
int ahcictl_flags;
int ahcictl_power_level;
/* Pci configuration space handle */
/* Mapping into bar 5 - AHCI base address */
/* Pointer used for sata hba framework registration */
struct sata_hba_tran *ahcictl_sata_hba_tran;
/* DMA attributes for the data buffer */
/* DMA attributes for the rcvd FIS */
/* DMA attributes for the command list */
/* DMA attributes for command tables */
/* Used for watchdog handler */
/* Per controller mutex */
/* Components for interrupt */
int ahcictl_intr_type; /* What type of interrupt */
int ahcictl_intr_cnt; /* # of intrs returned */
int ahcictl_intr_cap; /* Intr capabilities */
} ahci_ctl_t;
/* Warlock annotation */
#define AHCI_SUCCESS (0) /* Successful return */
/* Port flags */
#define AHCI_PORT_STATE_SPINUP 0x1
#define AHCI_PORT_STATE_MOPPING 0x2
/* Flags for ahcictl_flags */
#define AHCI_PM 0x1
#define AHCI_ATTACH 0x2
#define AHCI_DETACH 0x4
/* PIO Multiple DRQ Block */
#define AHCI_PMD 0x8
/* Flags controlling the reset behavior */
/* State values for ahci_attach */
#define AHCI_ATTACH_STATE_NONE (0x1 << 0)
/* Interval used for delay */
/*
* The following values are the numbers of times to retry polled requests.
*/
#define AHCI_POLLRATE_HBA_RESET 100
#define AHCI_POLLRATE_PORT_COMRESET 10
#define AHCI_POLLRATE_PORT_SSTATUS 10
#define AHCI_POLLRATE_PORT_TFD_BSY 1100
#define AHCI_POLLRATE_PORT_TFD_ERROR 10
#define AHCI_POLLRATE_PORT_IDLE 50
#define AHCI_POLLRATE_PORT_SOFTRESET 100
/* Clearing & setting the n'th bit in a given tag */
#if DEBUG
#define AHCI_DEBUG 1
#define AHCIDBG_INIT 0x0001
#define AHCIDBG_ENTRY 0x0002
#define AHCIDBG_DUMP_PRB 0x0004
#define AHCIDBG_EVENT 0x0008
#define AHCIDBG_POLL_LOOP 0x0010
#define AHCIDBG_PKTCOMP 0x0020
#define AHCIDBG_TIMEOUT 0x0040
#define AHCIDBG_INFO 0x0080
#define AHCIDBG_VERBOSE 0x0100
#define AHCIDBG_INTR 0x0200
#define AHCIDBG_ERRS 0x0400
#define AHCIDBG_COOKIES 0x0800
#define AHCIDBG_POWER 0x1000
extern int ahci_debug_flag;
if (ahci_debug_flags & (flag)) { \
}
if (ahci_debug_flags & (flag)) { \
}
if (ahci_debug_flags & (flag)) { \
}
if (ahci_debug_flags & (flag)) { \
}
if (ahci_debug_flags & (flag)) { \
}
#else
#endif /* DEBUG */
#ifdef __cplusplus
}
#endif
#endif /* _AHCIVAR_H */