/*
* 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 2013 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _AHCIVAR_H
#define _AHCIVAR_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* AHCI address qualifier flags (in qual field of ahci_addr struct).
*/
AHCI_ADDR_PMULT | \
/*
* AHCI address structure.
*/
struct ahci_addr {
/* HBA port number */
/* Port multiplier port number */
/*
* AHCI_ADDR_NULL
* AHCI_ADDR_PORT
* AHCI_ADDR_PMPORT
* AHCI_ADDR_PMULT
*/
};
{ \
}
/* Type for argument of event handler */
typedef struct ahci_event_arg {
void *ahciea_ctlp;
void *ahciea_portp;
void *ahciea_addrp;
/* Warlock annotation */
/*
* ahci_pmult_info stores the information of a port multiplier and its
* sub-devices in case a port multiplier is attached to an HBA port.
*/
struct ahci_pmult_info {
/* Number of the device ports */
/* Device type of the sub-devices of the port multipler */
/* State of port multiplier port */
/*
* Port multiplier port on which there is outstanding NCQ
* commands. Only make sense in command based switching mode.
*/
/* Pending asynchronous notification events tags */
};
/*
* flags for ahciport_flags
*
* AHCI_PORT_FLAG_MOPPING: this flag will be set when the HBA is stopped,
* and all the outstanding commands need to be aborted and sent to upper
* layers.
*
* AHCI_PORT_FLAG_POLLING: this flag will be set when the interrupt is
* disabled, and the command is executed in POLLING mode.
*
* AHCI_PORT_FLAG_RQSENSE: this flag will be set when a REQUEST SENSE which
* is used to retrieve sense data is being executed.
*
* AHCI_PORT_FLAG_STARTED: this flag will be set when the port is started,
* that is PxCMD.ST is set with '1', and be cleared when the port is put into
* idle, that is PxCMD.ST is changed from '1' to '0'.
*
* AHCI_PORT_FLAG_RDLOGEXT: this flag will be set when a READ LOG EXT which
* is used to retrieve NCQ failure context is being executed.
*
* AHCI_PORT_FLAG_NODEV: this flag will be set when a device is found gone
* during ahci_restart_port_wait_till_ready process.
*
* PORTMULT command is being executed.
*
* AHCI_PORT_FLAG_IGNORE_IPMS: this flag will be set when enumerating a port
* multiplier. According AHCI spec, IPMS error should be ignore during
* enumeration of port multiplier.
*
* AHCI_PORT_FLAG_PMULT_SNTF: this flag will be set when the a asynchronous
* notification event on the port multiplier is being handled.
*
* AHCI_PORT_FLAG_HOTPLUG: this flag will be set when a hot plug event is
* being handled.
*
* AHCI_PORT_FLAG_ERRPRINT: this flag will be set when error recovery message
* will be printed. Note that, for INDENTIFY DEVICE command sent to ATAPI
* device or ATAPI PACKET command, this flag won't be set.
*/
typedef struct ahci_port {
/* The physical port number */
/* Type of the device attached to the port */
/* State of the port */
/* Port multiplier struct */
/*
* AHCI_PORT_FLAG_MOPPING
* AHCI_PORT_FLAG_POLLING
* AHCI_PORT_FLAG_RQSENSE
* AHCI_PORT_FLAG_STARTED
* AHCI_PORT_FLAG_RDLOGEXT
* AHCI_PORT_FLAG_NODEV
* AHCI_PORT_FLAG_RDWR_PMULT
* AHCI_PORT_FLAG_IGNORE_IPMS
* AHCI_PORT_FLAG_PMULT_SNTF
* AHCI_PORT_FLAG_HOTPLUG
* AHCI_PORT_FLAG_ERRPRINT
*/
int ahciport_flags;
/* Pointer to received FIS structure */
/* Pointer to command list structure */
/* Pointer to cmmand table structure */
/* Condition variable used for sync mode commands */
/* The whole mutex for the port structure */
/* The maximum number of tags for native queuing command transfers */
/* Keep the tags of all pending non-ncq commands */
/*
* Keep the tags of all pending ncq commands
*/
/* Keep all the pending sata packets */
/* Used to check whether corresponding packet is timeout */
/* Queue of completed (done) sata packet */
/* Pointer of the tail of completed sata packet queue */
/* the length of the completed sata packet queue */
/* Keep the byte count of all PRD entries for every sata packet */
uint32_t \
/* Keep the error retrieval sata packet */
/*
* 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.
*/
/* Taskq for handling event */
/* This is for error recovery handler */
/* This is to calculate how many mops are in progress */
} ahci_port_t;
/* Warlock annotation */
else \
else \
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;
/*
* AHCI_CAP_PIO_MDRQ
* AHCI_CAP_NO_MCMDLIST_NONQUEUE
* AHCI_CAP_NCQ
* AHCI_CAP_PM
* AHCI_CAP_BUF_32BIT_DMA
* AHCI_CAP_SCLO
* AHCI_CAP_COMMU_32BIT_DMA
* AHCI_CAP_INIT_PORT_RESET
* AHCI_CAP_SNTF
* AHCI_CAP_PMULT_CBSS
* AHCI_CAP_PMULT_FBSS
* AHCI_CAP_SRST_NO_HOSTPORT
*/
int ahcictl_cap;
/* Pci configuration space handle */
/* Mapping into bar 5 - AHCI base address */
/* Pointer used for sata hba framework registration */
/* 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 */
/* FMA capabilities */
int ahcictl_fm_cap;
} ahci_ctl_t;
/* Warlock annotation */
/* Flags for ahcictl_flags */
/* Values for ahcictl_cap */
/* PIO Multiple DRQ Block */
/*
* Multiple command slots in the command list cannot be used for
* non-queued commands
*/
/* Native Command Queuing (NCQ) */
/* Power Management (PM) */
/* 32-bit DMA addressing for buffer block */
/* Supports Command List Override */
/* 32-bit DMA addressing for communication memory descriptors */
/* Port reset is needed for initialization */
/* Port Asychronous Notification */
/* Port Multiplier Command-Based Switching Support (PMULT_CBSS) */
/* Port Multiplier FIS-Based Switching Support (PMULT_FBSS) */
/* Software Reset FIS cannot set pmport with 0xf for direct access device */
/* Flags controlling the restart port behavior */
(ahci_portp->ahciport_flags & \
(ahci_portp->ahciport_flags & \
(!ERR_RETRI_CMD_IN_PROGRESS(ahci_portp) && \
ahci_portp->ahciport_pending_tags != 0 && \
(!ERR_RETRI_CMD_IN_PROGRESS(ahci_portp) && \
/* Command type for ahci_claim_free_slot routine */
/* State values for ahci_attach */
/* Interval used for delay */
/*
* The following values are the numbers of times to retry polled requests.
*/
/* Clearing & setting the n'th bit in a given tag */
#if DEBUG
#endif
extern uint32_t ahci_debug_flags;
#if DEBUG
if (ahci_debug_flags & (flag)) { \
else \
}
#else
if (ahci_debug_flags & (flag)) { \
else \
}
#endif /* DEBUG */
#ifdef __cplusplus
}
#endif
#endif /* _AHCIVAR_H */