1/* ********************************************************************* 2 * Broadcom Common Firmware Environment (CFE) 3 * 4 * Hyperspace Subroutines File: lib_hssubr.S 5 * 6 * Little stub routines to allow access to KXSEG from 32-bit progs. 7 * 8 * Author: Mitch Lichtenberg (mitch@sibyte.com) 9 * 10 ********************************************************************* 11 * 12 * Copyright 2000,2001,2002,2003 13 * Broadcom Corporation. All rights reserved. 14 * 15 * This software is furnished under license and may be used and 16 * copied only in accordance with the following terms and 17 * conditions. Subject to these conditions, you may download, 18 * copy, install, use, modify and distribute modified or unmodified 19 * copies of this software in source and/or binary form. No title 20 * or ownership is transferred hereby. 21 * 22 * 1) Any source code used, modified or distributed must reproduce 23 * and retain this copyright notice and list of conditions 24 * as they appear in the source file. 25 * 26 * 2) No right is granted to use any trade name, trademark, or 27 * logo of Broadcom Corporation. The "Broadcom Corporation" 28 * name may not be used to endorse or promote products derived 29 * from this software without the prior written permission of 30 * Broadcom Corporation. 31 * 32 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR 33 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED 34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 35 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT 36 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN 37 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, 38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 40 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 41 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 42 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 43 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF 44 * THE POSSIBILITY OF SUCH DAMAGE. 45 ********************************************************************* */ 46 47 48#include "sbmips.h" 49#include "mipsmacros.h" 50#include "cpu_config.h" /* for definition of HAZARD */ 51 52 53/* ********************************************************************* 54 * hs_read8 - read 8-bit bytes 55 ********************************************************************* */ 56 57 58LEAF(hs_read8) 59 mfc0 t2,C0_SR 60 or t1,t2,M_SR_KX 61 mtc0 t1,C0_SR 62 HAZARD 63 64 lbu v0,(a0) 65 66 mtc0 t2,C0_SR 67 HAZARD 68 j ra 69END(hs_read8) 70 71/* ********************************************************************* 72 * hs_read16 - read 16-bit shorts 73 ********************************************************************* */ 74 75LEAF(hs_read16) 76 mfc0 t2,C0_SR 77 or t1,t2,M_SR_KX 78 mtc0 t1,C0_SR 79 HAZARD 80 81 lhu v0,(a0) 82 83 mtc0 t2,C0_SR 84 HAZARD 85 j ra 86END(hs_read16) 87 88/* ********************************************************************* 89 * hs_read32 - read 32-bit ints 90 ********************************************************************* */ 91 92LEAF(hs_read32) 93 mfc0 t2,C0_SR 94 or t1,t2,M_SR_KX 95 mtc0 t1,C0_SR 96 HAZARD 97 98 lw v0,(a0) 99 100 mtc0 t2,C0_SR 101 HAZARD 102 j ra 103END(hs_read32) 104 105/* ********************************************************************* 106 * hs_read64 - read 64-bit longs 107 ********************************************************************* */ 108 109LEAF(hs_read64) 110 mfc0 t2,C0_SR 111 or t1,t2,M_SR_KX 112 mtc0 t1,C0_SR 113 HAZARD 114 115 ld v0,(a0) 116 117 mtc0 t2,C0_SR 118 HAZARD 119 j ra 120END(hs_read64) 121 122/* ********************************************************************* 123 * hs_write8 - write 8-bit bytes 124 ********************************************************************* */ 125 126LEAF(hs_write8) 127 mfc0 t2,C0_SR 128 or t1,t2,M_SR_KX 129 mtc0 t1,C0_SR 130 HAZARD 131 132 sb a1,(a0) 133 134 mtc0 t2,C0_SR 135 HAZARD 136 j ra 137END(hs_write8) 138 139/* ********************************************************************* 140 * hs_write16 - write 16-bit shorts 141 ********************************************************************* */ 142 143LEAF(hs_write16) 144 mfc0 t2,C0_SR 145 or t1,t2,M_SR_KX 146 mtc0 t1,C0_SR 147 HAZARD 148 149 sh a1,(a0) 150 151 mtc0 t2,C0_SR 152 HAZARD 153 j ra 154END(hs_write16) 155 156/* ********************************************************************* 157 * hs_write32 - write 32-bit longs 158 ********************************************************************* */ 159 160LEAF(hs_write32) 161 mfc0 t2,C0_SR 162 or t1,t2,M_SR_KX 163 mtc0 t1,C0_SR 164 HAZARD 165 166 sw a1,(a0) 167 168 mtc0 t2,C0_SR 169 HAZARD 170 j ra 171END(hs_write32) 172 173/* ********************************************************************* 174 * hs_write64 - write 64-bit longs 175 ********************************************************************* */ 176 177LEAF(hs_write64) 178 mfc0 t2,C0_SR 179 or t1,t2,M_SR_KX 180 mtc0 t1,C0_SR 181 HAZARD 182 183 sd a1,(a0) 184 185 mtc0 t2,C0_SR 186 HAZARD 187 j ra 188END(hs_write64) 189 190 191/* ********************************************************************* 192 * End 193 ********************************************************************* */ 194