si3124reg.h revision 81a0678e1c5837dd278edbcc4a617a6c976e7673
/*
* 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 _SI3124REG_H
#define _SI3124REG_H
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(1)
typedef struct si_sge {
/* offset 0x00 */
union {
} _sge_addr_un;
/* offset 0x08 */
/* offset 0x0c */
} si_sge_t;
/* Scatter Gather Table consists of four SGE entries */
typedef struct si_sgt {
} si_sgt_t;
/* Register - Host to Device FIS (from SATA spec) */
typedef struct fis_reg_h2d {
/* offset 0x00 */
((&fis)->fish_type_pmp_rsvd_cmddevctl_cmd_features |= \
((&fis)->fish_type_pmp_rsvd_cmddevctl_cmd_features |= \
((&fis)->fish_type_pmp_rsvd_cmddevctl_cmd_features |= \
#define GET_FIS_COMMAND(fis) \
((&fis)->fish_type_pmp_rsvd_cmddevctl_cmd_features |= \
#define GET_FIS_FEATURES(fis) \
/* offset 0x04 */
#define GET_FIS_SECTOR(fis) \
#define GET_FIS_CYL_LOW(fis) \
#define GET_FIS_CYL_HI(fis) \
#define GET_FIS_DEV_HEAD(fis) \
/* offset 0x08 */
((sectorexp & 0xff)))
#define GET_FIS_SECTOR_EXP(fis) \
#define GET_FIS_CYL_LOW_EXP(fis) \
#define GET_FIS_CYL_HI_EXP(fis) \
/* offset 0x0c */
((&fis)->fish_sectcount_sectcountexp_rsvd_devctl |= \
((sector_count & 0xff)))
#define GET_FIS_SECTOR_COUNT(fis) \
((&fis)->fish_sectcount_sectcountexp_rsvd_devctl |= \
#define GET_FIS_SECTOR_COUNT_EXP(fis) \
((&fis)->fish_sectcount_sectcountexp_rsvd_devctl |= \
/* offset 0x10 */
/*
* Port Request Block
*/
typedef struct si_prb {
/* offset 0x00 */
#define SET_PRB_CONTROL_PKT_READ(prb) \
#define SET_PRB_CONTROL_PKT_WRITE(prb) \
#define SET_PRB_CONTROL_SOFT_RESET(prb) \
/* offset 0x04 */
/* offset 0x08 */
/* offset 0x1c */
/* offset 0x20 */
/* offset 0x30 */
} si_prb_t;
#pragma pack()
/* Various interrupt bits */
#define INTR_COMMAND_COMPLETE (0x1 << 0)
#define INTR_MASK (0xfff)
/* Device signatures */
#define SI_SIGNATURE_PORT_MULTIPLIER 0x96690101
#define SI_SIGNATURE_ATAPI 0xeb140101
#define SI_SIGNATURE_DISK 0x00000101
/* Global definitions */
/* Per port definitions */
/* Interesting bits of Port Control Set register */
#define PORT_CONTROL_SET_BITS_PORT_RESET 0x1
#define PORT_CONTROL_SET_BITS_DEV_RESET 0x2
#define PORT_CONTROL_SET_BITS_PORT_INITIALIZE 0x4
#define PORT_CONTROL_SET_BITS_PACKET_LEN 0x20
#define PORT_CONTROL_SET_BITS_RESUME 0x40
#define PORT_CONTROL_SET_BITS_PM_ENABLE 0x2000
/* Interesting bits of Port Control Clear register */
#define PORT_CONTROL_CLEAR_BITS_PORT_RESET 0x1
#define PORT_CONTROL_CLEAR_BITS_INTR_NCoR 0x8
#define PORT_CONTROL_CLEAR_BITS_PACKET_LEN 0x20
#define PORT_CONTROL_CLEAR_BITS_RESUME 0x40
/* Interesting bits of Port Status register */
#define PORT_STATUS_BITS_PORT_READY 0x80000000
/* Interesting bits of Global Control register */
#define GLOBAL_CONTROL_REG_BITS_CLEAR 0x00000000
sizeof (si_prb_t), \
\
sizeof (si_sgblock_t) * si_dma_sg_number, \
\
#define SI_SLOT_MASK 0x7fffffff
#define ATTENTION_BIT 0x80000000
#define SI3124_DEV_ID 0x3124
#define SI3132_DEV_ID 0x3132
#define REGISTER_FIS_H2D 0x27
#define SI31xx_INTR_PORT_MASK 0xf
/* PCI BAR registers */
/* Port Status and Control Registers (from port multiplier spec) */
#define PSCR_REG0 0
#define PSCR_REG1 1
#define PSCR_REG2 2
#define PSCR_REG3 3
/* SStatus bit fields */
#define SSTATUS_DET_MASK 0x0000000f
#define SSTATUS_SPD_MASK 0x000000f0
#define SSTATUS_SPD_SHIFT 4
#define SSTATUS_IPM_MASK 0x00000f00
#define SSTATUS_IPM_SHIFT 8
/* SControl bit fields */
#define SCONTROL_DET_MASK 0x0000000f
/* Command Error codes */
#define CMD_ERR_DEVICEERRROR 1
#define CMD_ERR_SDBERROR 2
#define CMD_ERR_DATAFISERROR 3
#define CMD_ERR_SENDFISERROR 4
#define CMD_ERR_INCONSISTENTSTATE 5
#define CMD_ERR_DIRECTIONERROR 6
#define CMD_ERR_UNDERRUNERROR 7
#define CMD_ERR_OVERRUNERROR 8
#define CMD_ERR_PACKETPROTOCOLERROR 11
#define CMD_ERR_PLDSGTERRORBOUNDARY 16
#define CMD_ERR_PLDSGTERRORTARETABORT 17
#define CMD_ERR_PLDSGTERRORMASTERABORT 18
#define CMD_ERR_PLDSGTERRORPCIERR 19
#define CMD_ERR_PLDCMDERRORBOUNDARY 24
#define CMD_ERR_PLDCMDERRORTARGETABORT 25
#define CMD_ERR_PLDCMDERRORMASTERABORT 26
#define CMD_ERR_PLDCMDERORPCIERR 27
#define CMD_ERR_PSDERRORTARGETABORT 33
#define CMD_ERR_PSDERRORMASTERABORT 34
#define CMD_ERR_PSDERRORPCIERR 35
#define CMD_ERR_SENDSERVICEERROR 36
#ifdef __cplusplus
}
#endif
#endif /* _SI3124REG_H */