17c478bd9Sstevel@tonic-gate /* 2*db194e27Sadailey * CDDL HEADER START 3*db194e27Sadailey * 4*db194e27Sadailey * The contents of this file are subject to the terms of the 5*db194e27Sadailey * Common Development and Distribution License (the "License"). 6*db194e27Sadailey * You may not use this file except in compliance with the License. 7*db194e27Sadailey * 8*db194e27Sadailey * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*db194e27Sadailey * or http://www.opensolaris.org/os/licensing. 10*db194e27Sadailey * See the License for the specific language governing permissions 11*db194e27Sadailey * and limitations under the License. 12*db194e27Sadailey * 13*db194e27Sadailey * When distributing Covered Code, include this CDDL HEADER in each 14*db194e27Sadailey * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*db194e27Sadailey * If applicable, add the following below this CDDL HEADER, with the 16*db194e27Sadailey * fields enclosed by brackets "[]" replaced with your own identifying 17*db194e27Sadailey * information: Portions Copyright [yyyy] [name of copyright owner] 18*db194e27Sadailey * 19*db194e27Sadailey * CDDL HEADER END 20*db194e27Sadailey */ 21*db194e27Sadailey /* 22*db194e27Sadailey * Copyright 1998 Sun Microsystems, Inc. All rights reserved. 23*db194e27Sadailey * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_SOCALREG_H 277c478bd9Sstevel@tonic-gate #define _SYS_SOCALREG_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* 367c478bd9Sstevel@tonic-gate * socalreg.h: 377c478bd9Sstevel@tonic-gate * 387c478bd9Sstevel@tonic-gate * SOC+ Register Definitions, Interface Adaptor to Fiber Channel 397c478bd9Sstevel@tonic-gate */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #define N_SOCAL_NPORTS 2 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * Define the SOC+ configuration register bits. 457c478bd9Sstevel@tonic-gate */ 467c478bd9Sstevel@tonic-gate typedef union socal_cr_register { 477c478bd9Sstevel@tonic-gate struct cr { 487c478bd9Sstevel@tonic-gate uint_t aaa:5; 497c478bd9Sstevel@tonic-gate uint_t ramsel:3; /* Ram bank select. */ 507c478bd9Sstevel@tonic-gate uint_t bbb:6; 517c478bd9Sstevel@tonic-gate uint_t eepromsel:2; /* Eeprom bank select. */ 527c478bd9Sstevel@tonic-gate uint_t ccc:5; 537c478bd9Sstevel@tonic-gate uint_t burst64:3; /* Sbus Burst size, 64 bit mode. */ 547c478bd9Sstevel@tonic-gate uint_t ddd:2; 557c478bd9Sstevel@tonic-gate uint_t parenable:1; /* Partity test enable. */ 567c478bd9Sstevel@tonic-gate uint_t parsbus:1; /* Sbus Parity checking. */ 577c478bd9Sstevel@tonic-gate uint_t sbusmode:1; /* Enhanced Sbus mode. */ 587c478bd9Sstevel@tonic-gate uint_t sbusburst:3; /* Sbus burst size. */ 597c478bd9Sstevel@tonic-gate } reg; 607c478bd9Sstevel@tonic-gate uint32_t w; 617c478bd9Sstevel@tonic-gate } socal_cr_reg_t; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * Define Configuration register bits. 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate #define SOCAL_CR_SBUS_BURST_SIZE_MASK 0x007 687c478bd9Sstevel@tonic-gate #define SOCAL_CR_SBUS_BURST_SIZE_64BIT_MASK 0x700 697c478bd9Sstevel@tonic-gate #define SOCAL_CR_SBUS_BURST_SIZE_64BIT(a) \ 707c478bd9Sstevel@tonic-gate (((a) & SOCAL_CR_SBUS_BURST_SIZE_64BIT_MASK) >> 8) 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate #define SOCAL_CR_BURST_4 0x0 737c478bd9Sstevel@tonic-gate #define SOCAL_CR_BURST_8 0x3 747c478bd9Sstevel@tonic-gate #define SOCAL_CR_BURST_16 0x4 757c478bd9Sstevel@tonic-gate #define SOCAL_CR_BURST_32 0x5 767c478bd9Sstevel@tonic-gate #define SOCAL_CR_BURST_64 0x6 777c478bd9Sstevel@tonic-gate #define SOCAL_CR_BURST_128 0x7 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate #define SOCAL_CR_SBUS_ENHANCED 0x08 807c478bd9Sstevel@tonic-gate #define SOCAL_CR_SBUS_PARITY_CHK 0x10 817c478bd9Sstevel@tonic-gate #define SOCAL_CR_SBUS_PARITY_TEST 0x20 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate #define SOCAL_CR_EEPROM_BANK_MASK 0x30000 847c478bd9Sstevel@tonic-gate #define SOCAL_CR_EEPROM_BANK(a) (((a) & SOCAL_CR_EEPROM_BANK_MASK) >> 16) 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #define SOCAL_CR_EXTERNAL_RAM_BANK_MASK 0x7000000 877c478bd9Sstevel@tonic-gate #define SOCAL_CR_EXTERNAL_RAM_BANK(a) \ 887c478bd9Sstevel@tonic-gate (((a) & SOCAL_CR_EXTERNAL_RAM_BANK_MASK) >> 24) 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * Define SOC+ Slave Access Register. 927c478bd9Sstevel@tonic-gate */ 937c478bd9Sstevel@tonic-gate typedef union socal_sae_register { 947c478bd9Sstevel@tonic-gate struct sae { 957c478bd9Sstevel@tonic-gate uint_t aaa:29; /* Reserved. */ 967c478bd9Sstevel@tonic-gate uint_t alignment_err:1; /* Soc Alignment Error. */ 977c478bd9Sstevel@tonic-gate uint_t bad_size_err:1; /* Bad Size error. */ 987c478bd9Sstevel@tonic-gate uint_t parity_err:1; /* Parity Error. */ 997c478bd9Sstevel@tonic-gate } reg; 1007c478bd9Sstevel@tonic-gate uint32_t w; 1017c478bd9Sstevel@tonic-gate } socal_sae_reg_t; 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* 1047c478bd9Sstevel@tonic-gate * Define the Slave Access Regsiter Bits. 1057c478bd9Sstevel@tonic-gate */ 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #define SOCAL_SAE_PARITY_ERROR 0x01 1087c478bd9Sstevel@tonic-gate #define SOCAL_SAE_UNSUPPORTED_TRANSFER 0x02 1097c478bd9Sstevel@tonic-gate #define SOCAL_SAE_ALIGNMENT_ERROR 0x04 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate /* 1127c478bd9Sstevel@tonic-gate * Define SOC+ Command and Status Register. 1137c478bd9Sstevel@tonic-gate */ 1147c478bd9Sstevel@tonic-gate typedef union socal_csr_register { 1157c478bd9Sstevel@tonic-gate struct csr { 1167c478bd9Sstevel@tonic-gate uint_t comm_param:8; /* Communication Parameters. */ 1177c478bd9Sstevel@tonic-gate uint_t aaa:4; 1187c478bd9Sstevel@tonic-gate uint_t socal_to_host:4; /* Soc to host attention. */ 1197c478bd9Sstevel@tonic-gate uint_t bbb:4; 1207c478bd9Sstevel@tonic-gate uint_t host_to_socal:4; /* Host to soc+ attention. */ 1217c478bd9Sstevel@tonic-gate uint_t sae:1; /* Slave access error indicator. */ 1227c478bd9Sstevel@tonic-gate uint_t ccc:3; 1237c478bd9Sstevel@tonic-gate uint_t int_pending:1; /* Interrupt Pending. */ 1247c478bd9Sstevel@tonic-gate uint_t nqcmd:1; /* Non queued command */ 1257c478bd9Sstevel@tonic-gate uint_t idle:1; /* SOC+ idle indicator. */ 1267c478bd9Sstevel@tonic-gate uint_t reset:1; /* Software Reset. */ 1277c478bd9Sstevel@tonic-gate } reg; 1287c478bd9Sstevel@tonic-gate uint32_t w; 1297c478bd9Sstevel@tonic-gate } socal_csr_reg_t; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate /* 1337c478bd9Sstevel@tonic-gate * Define SOC+ CSR Register Macros. 1347c478bd9Sstevel@tonic-gate */ 1357c478bd9Sstevel@tonic-gate #define SOCAL_CSR_ZEROS 0x00000070 1367c478bd9Sstevel@tonic-gate #define SOCAL_CSR_SOCAL_TO_HOST 0x000f0000 1377c478bd9Sstevel@tonic-gate #define SOCAL_CSR_HOST_TO_SOCAL 0x00000f00 1387c478bd9Sstevel@tonic-gate #define SOCAL_CSR_SLV_ACC_ERR 0x00000080 1397c478bd9Sstevel@tonic-gate #define SOCAL_CSR_INT_PENDING 0x00000008 1407c478bd9Sstevel@tonic-gate #define SOCAL_CSR_NON_Q_CMD 0x00000004 1417c478bd9Sstevel@tonic-gate #define SOCAL_CSR_IDLE 0x00000002 1427c478bd9Sstevel@tonic-gate #define SOCAL_CSR_SOFT_RESET 0x00000001 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate #define SOCAL_CSR_1ST_S_TO_H 0x00010000 1457c478bd9Sstevel@tonic-gate #define SOCAL_CSR_1ST_H_TO_S 0x00000100 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #define SOCAL_CSR_RSP_QUE_0 SOCAL_CSR_1ST_S_TO_H 1487c478bd9Sstevel@tonic-gate #define SOCAL_CSR_RSP_QUE_1 0x00020000 1497c478bd9Sstevel@tonic-gate #define SOCAL_CSR_RSP_QUE_2 0x00040000 1507c478bd9Sstevel@tonic-gate #define SOCAL_CSR_RSP_QUE_3 0x00080000 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate #define SOCAL_CSR_REQ_QUE_0 SOCAL_CSR_1ST_H_TO_S 1537c478bd9Sstevel@tonic-gate #define SOCAL_CSR_REQ_QUE_1 0x00000200 1547c478bd9Sstevel@tonic-gate #define SOCAL_CSR_REQ_QUE_2 0x00000400 1557c478bd9Sstevel@tonic-gate #define SOCAL_CSR_REQ_QUE_3 0x00000800 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate /* 1587c478bd9Sstevel@tonic-gate * Define SOC Interrupt Mask Register Bits. 1597c478bd9Sstevel@tonic-gate */ 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate #define SOCAL_IMR_NON_QUEUED_STATE 0x04 1627c478bd9Sstevel@tonic-gate #define SOCAL_IMR_SLAVE_ACCESS_ERROR 0x80 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate #define SOCAL_IMR_REQUEST_QUEUE_0 0x100 1657c478bd9Sstevel@tonic-gate #define SOCAL_IMR_REQUEST_QUEUE_1 0x200 1667c478bd9Sstevel@tonic-gate #define SOCAL_IMR_REQUEST_QUEUE_2 0x400 1677c478bd9Sstevel@tonic-gate #define SOCAL_IMR_REQUEST_QUEUE_3 0x800 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate #define SOCAL_IMR_RESPONSE_QUEUE_0 0x10000 1707c478bd9Sstevel@tonic-gate #define SOCAL_IMR_RESPONSE_QUEUE_1 0x20000 1717c478bd9Sstevel@tonic-gate #define SOCAL_IMR_RESPONSE_QUEUE_2 0x40000 1727c478bd9Sstevel@tonic-gate #define SOCAL_IMR_RESPONSE_QUEUE_3 0x80000 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate /* 1757c478bd9Sstevel@tonic-gate * Define SOC+ Request Queue Index Register 1767c478bd9Sstevel@tonic-gate */ 1777c478bd9Sstevel@tonic-gate typedef union socal_reqp_register { 1787c478bd9Sstevel@tonic-gate struct reqp { 1797c478bd9Sstevel@tonic-gate uint_t reqq0_index:8; 1807c478bd9Sstevel@tonic-gate uint_t reqq1_index:8; 1817c478bd9Sstevel@tonic-gate uint_t reqq2_index:8; 1827c478bd9Sstevel@tonic-gate uint_t reqq3_index:8; 1837c478bd9Sstevel@tonic-gate } reg; 1847c478bd9Sstevel@tonic-gate uint32_t w; 1857c478bd9Sstevel@tonic-gate } socal_reqp_reg_t; 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ0_MASK 0xff000000 1887c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ1_MASK 0x00ff0000 1897c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ2_MASK 0x0000ff00 1907c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ3_MASK 0x000000ff 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ0_INDEX(a) (((a) & SOCAL_REQUESTQ0_MASK) >> 24) 1937c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ1_INDEX(a) (((a) & SOCAL_REQUESTQ1_MASK) >> 16) 1947c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ2_INDEX(a) (((a) & SOCAL_REQUESTQ2_MASK) >> 8) 1957c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ3_INDEX(a) ((a) & SOCAL_REQUESTQ3_MASK) 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate #define SOCAL_REQUESTQ_INDEX(a, b) ((b)>>((3-(a))<<3) & 0xff) 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate /* 2007c478bd9Sstevel@tonic-gate * Define SOC+ Response Queue Index Register 2017c478bd9Sstevel@tonic-gate */ 2027c478bd9Sstevel@tonic-gate typedef union socal_rspp_register { 2037c478bd9Sstevel@tonic-gate struct rspp { 2047c478bd9Sstevel@tonic-gate uint_t rspq0_index:8; 2057c478bd9Sstevel@tonic-gate uint_t rspq1_index:8; 2067c478bd9Sstevel@tonic-gate uint_t rspq2_index:8; 2077c478bd9Sstevel@tonic-gate uint_t rspq3_index:8; 2087c478bd9Sstevel@tonic-gate } reg; 2097c478bd9Sstevel@tonic-gate uint32_t w; 2107c478bd9Sstevel@tonic-gate } socal_rspp_reg_t; 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ0_MASK 0xff000000 2137c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ1_MASK 0x00ff0000 2147c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ2_MASK 0x0000ff00 2157c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ3_MASK 0x000000ff 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ0_INDEX(a) (((a) & SOCAL_RESPONSEQ0_MASK) >> 24) 2187c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ1_INDEX(a) (((a) & SOCAL_RESPONSEQ1_MASK) >> 16) 2197c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ2_INDEX(a) (((a) & SOCAL_RESPONSEQ2_MASK) >> 8) 2207c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ3_INDEX(a) ((a) & SOCAL_RESPONSEQ3_MASK) 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate #define SOCAL_RESPONSEQ_INDEX(a, b) ((b)>>((3-(a))<<3) & 0xff) 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate typedef struct _socalreg_ { 2257c478bd9Sstevel@tonic-gate socal_cr_reg_t socal_cr; /* Configuration reg */ 2267c478bd9Sstevel@tonic-gate socal_sae_reg_t socal_sae; /* Slave access error reg */ 2277c478bd9Sstevel@tonic-gate socal_csr_reg_t socal_csr; /* Command Status reg */ 2287c478bd9Sstevel@tonic-gate uint32_t socal_imr; /* Interrupt Mask reg */ 2297c478bd9Sstevel@tonic-gate socal_reqp_reg_t socal_reqp; /* request queue index reg */ 2307c478bd9Sstevel@tonic-gate socal_rspp_reg_t socal_rspp; /* response queue index reg */ 2317c478bd9Sstevel@tonic-gate } socal_reg_t; 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate /* 2347c478bd9Sstevel@tonic-gate * Device Address Space Offsets. 2357c478bd9Sstevel@tonic-gate */ 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gate #define SOCAL_XRAM_OFFSET 0x10000 2387c478bd9Sstevel@tonic-gate #define SOCAL_XRAM_SIZE 0x10000 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate #define SOCAL_MAX_XCHG 1024 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate #define SOCAL_REG_OFFSET (SOCAL_XRAM_OFFSET + SOCAL_XRAM_SIZE) 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate #define SOCAL_CQ_REQUEST_OFFSET (SOCAL_XRAM_OFFSET + 0x200) 2457c478bd9Sstevel@tonic-gate #define SOCAL_CQ_RESPONSE_OFFSET (SOCAL_XRAM_OFFSET + 0x220) 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate #define SOCAL_INTR_CAUSE(socalp, csr) \ 2497c478bd9Sstevel@tonic-gate (((csr) & SOCAL_CSR_SOCAL_TO_HOST) | \ 2507c478bd9Sstevel@tonic-gate ((~csr) & (SOCAL_CSR_HOST_TO_SOCAL))) & socalp->socal_k_imr 2517c478bd9Sstevel@tonic-gate 2527c478bd9Sstevel@tonic-gate /* 2537c478bd9Sstevel@tonic-gate * Bus dma burst sizes 2547c478bd9Sstevel@tonic-gate */ 2557c478bd9Sstevel@tonic-gate #ifndef BURSTSIZE 2567c478bd9Sstevel@tonic-gate #define BURSTSIZE 2577c478bd9Sstevel@tonic-gate #define BURST1 0x01 2587c478bd9Sstevel@tonic-gate #define BURST2 0x02 2597c478bd9Sstevel@tonic-gate #define BURST4 0x04 2607c478bd9Sstevel@tonic-gate #define BURST8 0x08 2617c478bd9Sstevel@tonic-gate #define BURST16 0x10 2627c478bd9Sstevel@tonic-gate #define BURST32 0x20 2637c478bd9Sstevel@tonic-gate #define BURST64 0x40 2647c478bd9Sstevel@tonic-gate #define BURST128 0x80 2657c478bd9Sstevel@tonic-gate #define BURSTSIZE_MASK 0xff 2667c478bd9Sstevel@tonic-gate #define DEFAULT_BURSTSIZE BURST16|BURST8|BURST4|BURST2|BURST1 2677c478bd9Sstevel@tonic-gate #endif /* BURSTSIZE */ 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2707c478bd9Sstevel@tonic-gate } 2717c478bd9Sstevel@tonic-gate #endif 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate #endif /* !_SYS_SOCALREG_H */ 274