mpt_reg.h revision 147883
1249259Sdim/* $FreeBSD: head/sys/dev/mpt/mpt_reg.h 147883 2005-07-10 15:05:39Z scottl $ */ 2249259Sdim/*- 3249259Sdim * Generic defines for LSI '909 FC adapters. 4249259Sdim * FreeBSD Version. 5249259Sdim * 6249259Sdim * Copyright (c) 2000, 2001 by Greg Ansley 7249259Sdim * 8249259Sdim * Redistribution and use in source and binary forms, with or without 9249259Sdim * modification, are permitted provided that the following conditions 10249259Sdim * are met: 11249259Sdim * 1. Redistributions of source code must retain the above copyright 12249259Sdim * notice immediately at the beginning of the file, without modification, 13249259Sdim * this list of conditions, and the following disclaimer. 14249259Sdim * 2. The name of the author may not be used to endorse or promote products 15249259Sdim * derived from this software without specific prior written permission. 16249259Sdim * 17249259Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18249259Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19249259Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20249259Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 21249259Sdim * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22249259Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23249259Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24249259Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25249259Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26249259Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27249259Sdim * SUCH DAMAGE. 28249259Sdim * 29249259Sdim * Additional Copyright (c) 2002 by Matthew Jacob under same license. 30249259Sdim */ 31249259Sdim#ifndef _MPT_REG_H_ 32249259Sdim#define _MPT_REG_H_ 33249259Sdim 34249259Sdim#define MPT_OFFSET_DOORBELL 0x00 35249259Sdim#define MPT_OFFSET_SEQUENCE 0x04 36249259Sdim#define MPT_OFFSET_DIAGNOSTIC 0x08 37249259Sdim#define MPT_OFFSET_TEST 0x0C 38249259Sdim#define MPT_OFFSET_DIAG_DATA 0x10 39249259Sdim#define MPT_OFFSET_DIAG_ADDR 0x14 40249259Sdim#define MPT_OFFSET_INTR_STATUS 0x30 41249259Sdim#define MPT_OFFSET_INTR_MASK 0x34 42249259Sdim#define MPT_OFFSET_REQUEST_Q 0x40 43249259Sdim#define MPT_OFFSET_REPLY_Q 0x44 44249259Sdim#define MPT_OFFSET_HOST_INDEX 0x50 45249259Sdim#define MPT_OFFSET_FUBAR 0x90 46249259Sdim 47249259Sdim/* Bit Maps for DOORBELL register */ 48249259Sdimenum DB_STATE_BITS { 49249259Sdim MPT_DB_STATE_RESET = 0x00000000, 50249259Sdim MPT_DB_STATE_READY = 0x10000000, 51249259Sdim MPT_DB_STATE_RUNNING = 0x20000000, 52249259Sdim MPT_DB_STATE_FAULT = 0x40000000, 53249259Sdim MPT_DB_STATE_MASK = 0xf0000000 54249259Sdim}; 55249259Sdim 56249259Sdim#define MPT_STATE(v) ((enum DB_STATE_BITS)((v) & MPT_DB_STATE_MASK)) 57249259Sdim 58249259Sdim#define MPT_DB_LENGTH_SHIFT (16) 59249259Sdim#define MPT_DB_DATA_MASK (0xffff) 60249259Sdim 61249259Sdim#define MPT_DB_DB_USED 0x08000000 62249259Sdim#define MPT_DB_IS_IN_USE(v) (((v) & MPT_DB_DB_USED) != 0) 63249259Sdim 64249259Sdim/* 65249259Sdim * "Whom" initializor values 66249259Sdim */ 67249259Sdim#define MPT_DB_INIT_NOONE 0x00 68249259Sdim#define MPT_DB_INIT_BIOS 0x01 69249259Sdim#define MPT_DB_INIT_ROMBIOS 0x02 70249259Sdim#define MPT_DB_INIT_PCIPEER 0x03 71249259Sdim#define MPT_DB_INIT_HOST 0x04 72249259Sdim#define MPT_DB_INIT_MANUFACTURE 0x05 73249259Sdim 74249259Sdim#define MPT_WHO(v) \ 75249259Sdim ((v & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT) 76249259Sdim 77249259Sdim/* Function Maps for DOORBELL register */ 78249259Sdimenum DB_FUNCTION_BITS { 79249259Sdim MPT_FUNC_IOC_RESET = 0x40000000, 80249259Sdim MPT_FUNC_UNIT_RESET = 0x41000000, 81249259Sdim MPT_FUNC_HANDSHAKE = 0x42000000, 82249259Sdim MPT_FUNC_REPLY_REMOVE = 0x43000000, 83249259Sdim MPT_FUNC_MASK = 0xff000000 84249259Sdim}; 85249259Sdim 86249259Sdim/* Function Maps for INTERRUPT request register */ 87249259Sdimenum _MPT_INTR_REQ_BITS { 88249259Sdim MPT_INTR_DB_BUSY = 0x80000000, 89249259Sdim MPT_INTR_REPLY_READY = 0x00000008, 90249259Sdim MPT_INTR_DB_READY = 0x00000001 91249259Sdim}; 92249259Sdim 93249259Sdim#define MPT_DB_IS_BUSY(v) (((v) & MPT_INTR_DB_BUSY) != 0) 94249259Sdim#define MPT_DB_INTR(v) (((v) & MPT_INTR_DB_READY) != 0) 95249259Sdim#define MPT_REPLY_INTR(v) (((v) & MPT_INTR_REPLY_READY) != 0) 96249259Sdim 97249259Sdim/* Function Maps for INTERRUPT make register */ 98249259Sdimenum _MPT_INTR_MASK_BITS { 99249259Sdim MPT_INTR_REPLY_MASK = 0x00000008, 100249259Sdim MPT_INTR_DB_MASK = 0x00000001 101249259Sdim}; 102249259Sdim 103249259Sdim/* Magic addresses in diagnostic memory space */ 104249259Sdim#define MPT_DIAG_IOP_BASE (0x00000000) 105249259Sdim#define MPT_DIAG_IOP_SIZE (0x00002000) 106249259Sdim#define MPT_DIAG_GPIO (0x00030010) 107249259Sdim#define MPT_DIAG_IOPQ_REG_BASE0 (0x00050004) 108249259Sdim#define MPT_DIAG_IOPQ_REG_BASE1 (0x00051004) 109249259Sdim#define MPT_DIAG_CTX0_BASE (0x000E0000) 110249259Sdim#define MPT_DIAG_CTX0_SIZE (0x00002000) 111249259Sdim#define MPT_DIAG_CTX1_BASE (0x001E0000) 112249259Sdim#define MPT_DIAG_CTX1_SIZE (0x00002000) 113249259Sdim#define MPT_DIAG_FLASH_BASE (0x00800000) 114249259Sdim#define MPT_DIAG_RAM_BASE (0x01000000) 115249259Sdim#define MPT_DIAG_RAM_SIZE (0x00400000) 116249259Sdim#define MPT_DIAG_MEM_CFG_BASE (0x3F000000) 117249259Sdim#define MPT_DIAG_MEM_CFG_BADFL (0x04000000) 118249259Sdim 119249259Sdim/* GPIO bit assignments */ 120249259Sdim#define MPT_DIAG_GPIO_SCL (0x00010000) 121249259Sdim#define MPT_DIAG_GPIO_SDA_OUT (0x00008000) 122249259Sdim#define MPT_DIAG_GPIO_SDA_IN (0x00004000) 123249259Sdim 124249259Sdim#define MPT_REPLY_EMPTY (0xFFFFFFFF) /* Reply Queue Empty Symbol */ 125249259Sdim#endif /* _MPT_REG_H_ */ 126249259Sdim