1 1.2 simonb /* $NetBSD: octeonreg.h,v 1.2 2020/06/18 13:52:08 simonb Exp $ */ 2 1.1 simonb 3 1.1 simonb /*- 4 1.1 simonb * Copyright (c) 2020 The NetBSD Foundation, Inc. 5 1.1 simonb * All rights reserved. 6 1.1 simonb * 7 1.1 simonb * This code is derived from software contributed to The NetBSD Foundation 8 1.1 simonb * by Simon Burge. 9 1.1 simonb * 10 1.1 simonb * Redistribution and use in source and binary forms, with or without 11 1.1 simonb * modification, are permitted provided that the following conditions 12 1.1 simonb * are met: 13 1.1 simonb * 1. Redistributions of source code must retain the above copyright 14 1.1 simonb * notice, this list of conditions and the following disclaimer. 15 1.1 simonb * 2. Redistributions in binary form must reproduce the above copyright 16 1.1 simonb * notice, this list of conditions and the following disclaimer in the 17 1.1 simonb * documentation and/or other materials provided with the distribution. 18 1.1 simonb * 19 1.1 simonb * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.1 simonb * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.1 simonb * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.1 simonb * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.1 simonb * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.1 simonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.1 simonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.1 simonb * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.1 simonb * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.1 simonb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.1 simonb * POSSIBILITY OF SUCH DAMAGE. 30 1.1 simonb */ 31 1.1 simonb 32 1.1 simonb 33 1.1 simonb #ifndef _OCTEONREG_H_ 34 1.1 simonb #define _OCTEONREG_H_ 35 1.1 simonb 36 1.1 simonb #define OCTEON_PLL_REF_CLK 50000000 /* defined as 50MHz */ 37 1.1 simonb 38 1.2 simonb /* ---- virtual addressing */ 39 1.2 simonb 40 1.2 simonb /* CVMSEG virtual addresses */ 41 1.2 simonb #define OCTEON_CVMSEG_LM UINT64_C(0xffffffffffff8000) 42 1.2 simonb #define OCTEON_CVMSEG_IO UINT64_C(0xffffffffffffa000) 43 1.2 simonb 44 1.2 simonb #define OCTEON_IOBDMA_GLOBAL_ADDR UINT64_C(0xffffffffffffa200) 45 1.2 simonb #define OCTEON_IOBDMA_LOCAL_ADDR UINT64_C(0xffffffffffffb200) 46 1.2 simonb #define OCTEON_LMTDMA_GLOBAL_ADDR UINT64_C(0xffffffffffffa400) 47 1.2 simonb #define OCTEON_LMTDMA_LOCAL_ADDR UINT64_C(0xffffffffffffb400) 48 1.2 simonb /* use globally ordered by default */ 49 1.2 simonb #define OCTEON_IOBDMA_ADDR OCTEON_IOBDMA_GLOBAL_ADDR 50 1.2 simonb #define OCTEON_LMTDMA_ADDR OCTEON_LMTDMA_GLOBAL_ADDR 51 1.2 simonb 52 1.2 simonb /* ---- physical addressing */ 53 1.2 simonb 54 1.2 simonb /* 55 1.2 simonb * Cavium Octeon has a 49 bit physical address space. 56 1.2 simonb * 57 1.2 simonb * Bit 48 == 0 defines a L2 or DRAM address 58 1.2 simonb * Bit 48 == 1 defines an IO address 59 1.2 simonb * 60 1.2 simonb * For IO addresses: 61 1.2 simonb * Bits 47-43: Major DID - directs request to correct hardware block 62 1.2 simonb * Bits 42-40: Sub DID - directs request within the hardware block 63 1.2 simonb * Bits 39-38: reserved - 0 64 1.2 simonb * Bits 37-36: reserved - 0 (on Octeon and Octeon Plus) 65 1.2 simonb * Bits 37-36: Node - selects node/chip (Octeon II) 66 1.2 simonb * Bits 35- 0: IO bus device address with the DID 67 1.2 simonb */ 68 1.2 simonb #define OCTEON_ADDR_IO __BIT(48) 69 1.2 simonb #define OCTEON_ADDR_MAJOR_DID __BITS(47,43) 70 1.2 simonb #define OCTEON_ADDR_SUB_DID __BITS(42,40) 71 1.2 simonb #define OCTEON_ADDR_NODE __BITS(37,36) 72 1.2 simonb #define OCTEON_ADDR_OFFSET __BITS(35,0) 73 1.2 simonb 74 1.2 simonb #define OCTEON_ADDR_DID(major, sub) ( \ 75 1.2 simonb __SHIFTIN((major), OCTEON_ADDR_MAJOR_DID) | \ 76 1.2 simonb __SHIFTIN((sub), OCTEON_ADDR_SUB_DID)) 77 1.2 simonb 78 1.2 simonb /* used to build addresses for load/store operations */ 79 1.2 simonb #define OCTEON_ADDR_IO_DID(major, sub) \ 80 1.2 simonb (OCTEON_ADDR_IO | OCTEON_ADDR_DID((major), (sub))) 81 1.2 simonb 82 1.2 simonb 83 1.2 simonb /* ---- core specific registers */ 84 1.1 simonb 85 1.1 simonb /* OCTEON II */ 86 1.1 simonb #define MIO_RST_BOOT UINT64_C(0x1180000001600) 87 1.1 simonb #define MIO_RST_BOOT_C_MUL __BITS(36,30) 88 1.1 simonb #define MIO_RST_BOOT_PNR_MUL __BITS(29,24) 89 1.1 simonb 90 1.1 simonb 91 1.1 simonb /* OCTEON III */ 92 1.1 simonb #define MIO_FUS_PDF UINT64_C(0x1180000001428) 93 1.1 simonb #define MIO_FUS_PDF_IS_71XX __BIT(32) 94 1.1 simonb 95 1.1 simonb #define RST_BOOT UINT64_C(0x1180006001600) 96 1.1 simonb #define RST_BOOT_C_MUL __BITS(36,30) 97 1.1 simonb #define RST_BOOT_PNR_MUL __BITS(29,24) 98 1.1 simonb #define RST_DELAY UINT64_C(0x1180006001608) 99 1.1 simonb #define RST_CFG UINT64_C(0x1180006001610) 100 1.1 simonb #define RST_OCX UINT64_C(0x1180006001618) 101 1.1 simonb #define RST_INT UINT64_C(0x1180006001628) 102 1.1 simonb #define RST_CKILL UINT64_C(0x1180006001638) 103 1.1 simonb #define RST_CTL(n) (UINT64_C(0x1180006001640) + (n) * 0x8) 104 1.1 simonb #define RST_SOFT_RST UINT64_C(0x1180006001680) 105 1.1 simonb #define RST_SOFT_PRST(n) (UINT64_C(0x11800060016c0) + (n) * 0x8) 106 1.1 simonb #define RST_PP_POWER UINT64_C(0x1180006001700) 107 1.1 simonb #define RST_POWER_DBG UINT64_C(0x1180006001708) 108 1.1 simonb #define RST_REF_CNTR UINT64_C(0x1180006001758) 109 1.1 simonb #define RST_COLD_DATA(n) (UINT64_C(0x11800060017c0) + (n) * 0x8) 110 1.1 simonb 111 1.1 simonb 112 1.2 simonb /* ---- IOBDMA */ 113 1.2 simonb 114 1.2 simonb /* 4.7 IOBDMA Operations */ 115 1.2 simonb #define IOBDMA_SCRADDR __BITS(63,56) 116 1.2 simonb #define IOBDMA_LEN __BITS(55,48) 117 1.2 simonb /* IOBDMA_MAJOR_DID same as OCTEON_MAJOR_DID */ 118 1.2 simonb /* IOBDMA_SUB_DID same as OCTEON_SUB_DID */ 119 1.2 simonb /* reserved 39:38 */ 120 1.2 simonb #define IOBDMA_NODE __BITS(37,36) /* Octeon 3 only */ 121 1.2 simonb #define IOBDMA_OFFSET __BITS(35,0) 122 1.2 simonb /* technically __BITS(2,0) are reserved as 0, address must be 64-bit aligned */ 123 1.2 simonb 124 1.2 simonb #define IOBDMA_CREATE(major, sub, scr, len, offset) ( \ 125 1.2 simonb OCTEON_ADDR_DID((major), (sub)) | \ 126 1.2 simonb __SHIFTIN((scr), IOBDMA_SCRADDR) | \ 127 1.2 simonb __SHIFTIN((len), IOBDMA_LEN) | \ 128 1.2 simonb __SHIFTIN((offset), IOBDMA_OFFSET)) 129 1.2 simonb 130 1.2 simonb 131 1.1 simonb #endif /* !_OCTEONREG_H_ */ 132