1147883Sscottl/* $FreeBSD: releng/10.2/sys/dev/mpt/mpt_reg.h 231518 2012-02-11 12:03:44Z marius $ */ 2147883Sscottl/*- 3147883Sscottl * Generic defines for LSI '909 FC adapters. 4147883Sscottl * FreeBSD Version. 5147883Sscottl * 6147883Sscottl * Copyright (c) 2000, 2001 by Greg Ansley 7147883Sscottl * 8147883Sscottl * Redistribution and use in source and binary forms, with or without 9147883Sscottl * modification, are permitted provided that the following conditions 10147883Sscottl * are met: 11147883Sscottl * 1. Redistributions of source code must retain the above copyright 12147883Sscottl * notice immediately at the beginning of the file, without modification, 13147883Sscottl * this list of conditions, and the following disclaimer. 14147883Sscottl * 2. The name of the author may not be used to endorse or promote products 15147883Sscottl * derived from this software without specific prior written permission. 16147883Sscottl * 17147883Sscottl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18147883Sscottl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19147883Sscottl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20147883Sscottl * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 21147883Sscottl * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22147883Sscottl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23147883Sscottl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24147883Sscottl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25147883Sscottl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26147883Sscottl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27147883Sscottl * SUCH DAMAGE. 28156000Smjacob */ 29156000Smjacob/*- 30156000Smjacob * Copyright (c) 2002, 2006 by Matthew Jacob 31156000Smjacob * All rights reserved. 32156000Smjacob * 33156000Smjacob * Redistribution and use in source and binary forms, with or without 34156000Smjacob * modification, are permitted provided that the following conditions are 35156000Smjacob * met: 36156000Smjacob * 1. Redistributions of source code must retain the above copyright 37156000Smjacob * notice, this list of conditions and the following disclaimer. 38156000Smjacob * 2. Redistributions in binary form must reproduce at minimum a disclaimer 39156000Smjacob * substantially similar to the "NO WARRANTY" disclaimer below 40156000Smjacob * ("Disclaimer") and any redistribution must be conditioned upon including 41156000Smjacob * a substantially similar Disclaimer requirement for further binary 42156000Smjacob * redistribution. 43156000Smjacob * 3. Neither the names of the above listed copyright holders nor the names 44156000Smjacob * of any contributors may be used to endorse or promote products derived 45156000Smjacob * from this software without specific prior written permission. 46156000Smjacob * 47156000Smjacob * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 48156000Smjacob * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 49156000Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 50156000Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 51156000Smjacob * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 52156000Smjacob * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 53156000Smjacob * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 54156000Smjacob * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 55156000Smjacob * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 56156000Smjacob * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 57156000Smjacob * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58147883Sscottl * 59156000Smjacob * Support from Chris Ellsworth in order to make SAS adapters work 60156000Smjacob * is gratefully acknowledged. 61159052Smjacob * 62159052Smjacob * Support from LSI-Logic has also gone a great deal toward making this a 63159052Smjacob * workable subsystem and is gratefully acknowledged. 64147883Sscottl */ 65147883Sscottl#ifndef _MPT_REG_H_ 66147883Sscottl#define _MPT_REG_H_ 67147883Sscottl 68147883Sscottl#define MPT_OFFSET_DOORBELL 0x00 69147883Sscottl#define MPT_OFFSET_SEQUENCE 0x04 70147883Sscottl#define MPT_OFFSET_DIAGNOSTIC 0x08 71147883Sscottl#define MPT_OFFSET_TEST 0x0C 72147883Sscottl#define MPT_OFFSET_DIAG_DATA 0x10 73147883Sscottl#define MPT_OFFSET_DIAG_ADDR 0x14 74147883Sscottl#define MPT_OFFSET_INTR_STATUS 0x30 75147883Sscottl#define MPT_OFFSET_INTR_MASK 0x34 76147883Sscottl#define MPT_OFFSET_REQUEST_Q 0x40 77147883Sscottl#define MPT_OFFSET_REPLY_Q 0x44 78147883Sscottl#define MPT_OFFSET_HOST_INDEX 0x50 79147883Sscottl#define MPT_OFFSET_FUBAR 0x90 80231518Smarius#define MPT_OFFSET_RESET_1078 0x10fc 81147883Sscottl 82147883Sscottl/* Bit Maps for DOORBELL register */ 83147883Sscottlenum DB_STATE_BITS { 84147883Sscottl MPT_DB_STATE_RESET = 0x00000000, 85147883Sscottl MPT_DB_STATE_READY = 0x10000000, 86147883Sscottl MPT_DB_STATE_RUNNING = 0x20000000, 87147883Sscottl MPT_DB_STATE_FAULT = 0x40000000, 88147883Sscottl MPT_DB_STATE_MASK = 0xf0000000 89147883Sscottl}; 90147883Sscottl 91147883Sscottl#define MPT_STATE(v) ((enum DB_STATE_BITS)((v) & MPT_DB_STATE_MASK)) 92147883Sscottl 93147883Sscottl#define MPT_DB_LENGTH_SHIFT (16) 94147883Sscottl#define MPT_DB_DATA_MASK (0xffff) 95147883Sscottl 96147883Sscottl#define MPT_DB_DB_USED 0x08000000 97147883Sscottl#define MPT_DB_IS_IN_USE(v) (((v) & MPT_DB_DB_USED) != 0) 98147883Sscottl 99147883Sscottl/* 100147883Sscottl * "Whom" initializor values 101147883Sscottl */ 102147883Sscottl#define MPT_DB_INIT_NOONE 0x00 103147883Sscottl#define MPT_DB_INIT_BIOS 0x01 104147883Sscottl#define MPT_DB_INIT_ROMBIOS 0x02 105147883Sscottl#define MPT_DB_INIT_PCIPEER 0x03 106147883Sscottl#define MPT_DB_INIT_HOST 0x04 107147883Sscottl#define MPT_DB_INIT_MANUFACTURE 0x05 108147883Sscottl 109147883Sscottl#define MPT_WHO(v) \ 110147883Sscottl ((v & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT) 111147883Sscottl 112147883Sscottl/* Function Maps for DOORBELL register */ 113147883Sscottlenum DB_FUNCTION_BITS { 114147883Sscottl MPT_FUNC_IOC_RESET = 0x40000000, 115147883Sscottl MPT_FUNC_UNIT_RESET = 0x41000000, 116147883Sscottl MPT_FUNC_HANDSHAKE = 0x42000000, 117147883Sscottl MPT_FUNC_REPLY_REMOVE = 0x43000000, 118147883Sscottl MPT_FUNC_MASK = 0xff000000 119147883Sscottl}; 120147883Sscottl 121147883Sscottl/* Function Maps for INTERRUPT request register */ 122147883Sscottlenum _MPT_INTR_REQ_BITS { 123147883Sscottl MPT_INTR_DB_BUSY = 0x80000000, 124147883Sscottl MPT_INTR_REPLY_READY = 0x00000008, 125147883Sscottl MPT_INTR_DB_READY = 0x00000001 126147883Sscottl}; 127147883Sscottl 128147883Sscottl#define MPT_DB_IS_BUSY(v) (((v) & MPT_INTR_DB_BUSY) != 0) 129147883Sscottl#define MPT_DB_INTR(v) (((v) & MPT_INTR_DB_READY) != 0) 130147883Sscottl#define MPT_REPLY_INTR(v) (((v) & MPT_INTR_REPLY_READY) != 0) 131147883Sscottl 132157117Smjacob/* Function Maps for INTERRUPT mask register */ 133147883Sscottlenum _MPT_INTR_MASK_BITS { 134147883Sscottl MPT_INTR_REPLY_MASK = 0x00000008, 135147883Sscottl MPT_INTR_DB_MASK = 0x00000001 136147883Sscottl}; 137147883Sscottl 138147883Sscottl/* Magic addresses in diagnostic memory space */ 139147883Sscottl#define MPT_DIAG_IOP_BASE (0x00000000) 140147883Sscottl#define MPT_DIAG_IOP_SIZE (0x00002000) 141147883Sscottl#define MPT_DIAG_GPIO (0x00030010) 142147883Sscottl#define MPT_DIAG_IOPQ_REG_BASE0 (0x00050004) 143147883Sscottl#define MPT_DIAG_IOPQ_REG_BASE1 (0x00051004) 144147883Sscottl#define MPT_DIAG_CTX0_BASE (0x000E0000) 145147883Sscottl#define MPT_DIAG_CTX0_SIZE (0x00002000) 146147883Sscottl#define MPT_DIAG_CTX1_BASE (0x001E0000) 147147883Sscottl#define MPT_DIAG_CTX1_SIZE (0x00002000) 148147883Sscottl#define MPT_DIAG_FLASH_BASE (0x00800000) 149147883Sscottl#define MPT_DIAG_RAM_BASE (0x01000000) 150147883Sscottl#define MPT_DIAG_RAM_SIZE (0x00400000) 151147883Sscottl#define MPT_DIAG_MEM_CFG_BASE (0x3F000000) 152147883Sscottl#define MPT_DIAG_MEM_CFG_BADFL (0x04000000) 153147883Sscottl 154147883Sscottl/* GPIO bit assignments */ 155147883Sscottl#define MPT_DIAG_GPIO_SCL (0x00010000) 156147883Sscottl#define MPT_DIAG_GPIO_SDA_OUT (0x00008000) 157147883Sscottl#define MPT_DIAG_GPIO_SDA_IN (0x00004000) 158147883Sscottl 159147883Sscottl#define MPT_REPLY_EMPTY (0xFFFFFFFF) /* Reply Queue Empty Symbol */ 160147883Sscottl#endif /* _MPT_REG_H_ */ 161