si3124var.h revision b74cec98319cdf0854be09126da89ba80d5baa2e
/*
* 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
*/
/*
*/
#ifndef _SI3124VAR_H
#define _SI3124VAR_H
#ifdef __cplusplus
extern "C" {
#endif
#define SI3124_MAX_PORTS 4
#define SI3132_MAX_PORTS 2
#define SI3531_MAX_PORTS 1
#define SI_MAX_PORTS SI3124_MAX_PORTS
#define SI_LOGBUF_LEN 512
#define SI_SUCCESS (0) /* successful return */
#define SI_MAX_SGT_TABLES_PER_PRB 21844
#define SI_DEFAULT_SGT_TABLES_PER_PRB 85
#define SI_MIN_SGT_TABLES_PER_PRB 1
/*
* While the si_sge_t and si_sgt_t correspond to the actual SGE and SGT
* definitions as per the datasheet, the si_sgblock_t (i.e scatter gather
* block) is a logical data structure which can hold dynamic SGEs and it
* The idea is to use multiple tunable chained SGT tables per each PRB request.
*/
typedef struct si_sgblock {
} si_sgblock_t;
/*
* Each SGT (Scatter Gather Table) has 4 SGEs (Scatter Gather Entries).
* But each SGT effectively can host only 3 SGEs since the last SGE entry
* is used to hold a link to the next SGT in the chain. However the last
* SGT in the chain can host all the 4 entries since it does not need to
* link any more.
*/
/* Argument to be used for calls to timeout() */
typedef struct si_event_arg {
void *siea_ctlp;
int siea_port;
typedef struct si_portmult_state {
int sipm_num_ports;
/* one of PORT_TYPE_[NODEV | MULTIPLIER | ATAPI | DISK | UNKNOWN] */
/*
* sipm_port_type[] is good enough to capture the state of ports
* behind the multiplier. Since any of the port behind a multiplier
* is accessed through the same main controller port, we don't need
* additional si_port_state_t here.
*/
/* The following are for port types */
#define PORT_TYPE_NODEV 0x0
#define PORT_TYPE_MULTIPLIER 0x1
#define PORT_TYPE_ATAPI 0x2
#define PORT_TYPE_DISK 0x3
#define PORT_TYPE_UNKNOWN 0x4
/* The following are for active state */
#define PORT_INACTIVE 0x0
#define PORT_ACTIVE 0x1
typedef struct si_port_state {
/* one of PORT_TYPE_[NODEV | MULTIPLIER | ATAPI | DISK | UNKNOWN] */
/*
* While the reset is in progress, we don't accept any more commands
* until we receive the command with SATA_CLEAR_DEV_RESET_STATE flag.
* However any commands with SATA_IGNORE_DEV_RESET_STATE are allowed in
* during such blockage.
*/
/* Argument to be used for calls to timeout() */
/*
* We mop the commands for either abort, reset, timeout or
* error handling cases. This counts how many mops are in progress.
* It is also used to return BUSY in tran_start if a mop is going on.
*/
int mopping_in_progress;
/* error recovery related info */
/* Warlock annotation */
typedef struct si_ctl_state {
int sictl_num_ports; /* number of controller ports */
int sictl_devid; /* device id of the controller */
int sictl_flags; /* some important state of controller */
int sictl_power_level;
/* pci config space handle */
/* mapping into bar 0 */
/* mapping into bar 1 */
struct sata_hba_tran *sictl_sata_hba_tran;
int sictl_intr_type; /* What type of interrupt */
int sictl_intr_cnt; /* # of intrs count returned */
int sictl_intr_cap; /* Interrupt capabilities */
int fm_capabilities; /* FMA capabilities */
/* Warlock annotation */
/*
* flags for si_flags
*/
#define SI_PM 0x01
#define SI_ATTACH 0x02
#define SI_DETACH 0x04
#define SI_NO_TIMEOUTS 0x08
/* progress values for si_attach */
#define ATTACH_PROGRESS_NONE (1<<0)
#define SI_POLLRATE_SOFT_RESET 1000
#define SI_POLLRATE_SSTATUS 10
#define SI_POLLRATE_PORTREADY 50
#define SI_POLLRATE_SLOTSTATUS 50
#define SI_POLLRATE_RECOVERPORTMULT 1000
#define PORTMULT_CONTROL_PORT 0xf
/* clearing & setting the n'th bit in a given tag */
#if DEBUG
#define SI_DEBUG 1
#endif /* DEBUG */
/* si_debug_flags */
#define SIDBG_TEST 0x0001
#define SIDBG_INIT 0x0002
#define SIDBG_ENTRY 0x0004
#define SIDBG_DUMP_PRB 0x0008
#define SIDBG_EVENT 0x0010
#define SIDBG_POLL_LOOP 0x0020
#define SIDBG_PKTCOMP 0x0040
#define SIDBG_TIMEOUT 0x0080
#define SIDBG_INFO 0x0100
#define SIDBG_VERBOSE 0x0200
#define SIDBG_INTR 0x0400
#define SIDBG_ERRS 0x0800
#define SIDBG_COOKIES 0x1000
#define SIDBG_POWER 0x2000
#define SIDBG_RESET 0x4000
extern uint32_t si_debug_flags;
if (si_debug_flags & (flag)) { \
}
if (si_debug_flags & (flag)) { \
}
if (si_debug_flags & (flag)) { \
}
/* Flags controlling the reset behavior */
#ifdef __cplusplus
}
#endif
#endif /* _SI3124VAR_H */