1/* ********************************************************************* 2 * Broadcom Common Firmware Environment (CFE) 3 * 4 * Physical memory peek/poke routines File: lib_physio.S 5 * 6 * Little stub routines to allow access to arbitrary physical 7 * addresses. In most cases this should not be needed, as 8 * many physical addresses are within kseg1, but this handles 9 * the cases that are not automagically, so we don't need 10 * to mess up the code with icky macros and such. 11 * 12 * Author: Mitch Lichtenberg 13 * 14 ********************************************************************* 15 * 16 * Copyright 2000,2001,2002,2003 17 * Broadcom Corporation. All rights reserved. 18 * 19 * This software is furnished under license and may be used and 20 * copied only in accordance with the following terms and 21 * conditions. Subject to these conditions, you may download, 22 * copy, install, use, modify and distribute modified or unmodified 23 * copies of this software in source and/or binary form. No title 24 * or ownership is transferred hereby. 25 * 26 * 1) Any source code used, modified or distributed must reproduce 27 * and retain this copyright notice and list of conditions 28 * as they appear in the source file. 29 * 30 * 2) No right is granted to use any trade name, trademark, or 31 * logo of Broadcom Corporation. The "Broadcom Corporation" 32 * name may not be used to endorse or promote products derived 33 * from this software without the prior written permission of 34 * Broadcom Corporation. 35 * 36 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR 37 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED 38 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 39 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT 40 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN 41 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, 42 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 44 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 45 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 46 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 47 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF 48 * THE POSSIBILITY OF SUCH DAMAGE. 49 ********************************************************************* */ 50 51 52#include "ppcdefs.h" 53#include "ppcmacros.h" 54#include "cpu_config.h" /* for definition of HAZARD */ 55 56 57/* ********************************************************************* 58 * phys_read8 - read 8-bit bytes 59 ********************************************************************* */ 60 61 62LEAF(phys_read8) 63 lbz r3,0(r3) 64 blr 65END(phys_read8) 66 67/* ********************************************************************* 68 * phys_read16 - read 16-bit shorts 69 ********************************************************************* */ 70 71LEAF(phys_read16) 72 lhz r3,0(r3) 73 blr 74END(phys_read16) 75 76/* ********************************************************************* 77 * phys_read32 - read 32-bit ints 78 ********************************************************************* */ 79 80LEAF(phys_read32) 81 lwz r3,0(r3) 82 blr 83END(phys_read32) 84 85/* ********************************************************************* 86 * phys_read64 - read 64-bit longs 87 ********************************************************************* */ 88 89LEAF(phys_read64) 90 lwz r4,4(r3) 91 lwz r3,0(r3) 92 blr 93 94END(phys_read64) 95 96/* ********************************************************************* 97 * phys_write8 - write 8-bit bytes 98 ********************************************************************* */ 99 100LEAF(phys_write8) 101 stb r4,0(r3) 102 eieio 103 blr 104END(phys_write8) 105 106/* ********************************************************************* 107 * phys_write16 - write 16-bit shorts 108 ********************************************************************* */ 109 110LEAF(phys_write16) 111 sth r4,0(r3) 112 eieio 113 blr 114END(phys_write16) 115 116/* ********************************************************************* 117 * phys_write32 - write 32-bit longs 118 ********************************************************************* */ 119 120LEAF(phys_write32) 121 stw r4,0(r3) 122 eieio 123 blr 124END(phys_write32) 125 126/* ********************************************************************* 127 * phys_write64 - write 64-bit longs 128 ********************************************************************* */ 129 130LEAF(phys_write64) 131 stw r4,0(r3) 132 stw r5,4(r3) 133 blr 134END(phys_write64) 135 136 137 138/* ********************************************************************* 139 * phys_read16_swapped - read 16-bit shorts with byte swap 140 ********************************************************************* */ 141 142LEAF(phys_read16_swapped) 143 lhbrx r3,0,r3 144 blr 145END(phys_read16_swapped) 146 147/* ********************************************************************* 148 * phys_read32_swapped - read 32-bit ints with byte swap 149 ********************************************************************* */ 150 151LEAF(phys_read32_swapped) 152 lwbrx r3,0,r3 153 blr 154END(phys_read32_swapped) 155 156/* ********************************************************************* 157 * phys_write16_swapped - write 16-bit shorts with byte swap 158 ********************************************************************* */ 159 160LEAF(phys_write16_swapped) 161 sthbrx r4,0,r3 162 eieio 163 blr 164END(phys_write16_swapped) 165 166/* ********************************************************************* 167 * phys_write32_swapped - write 32-bit longs with byte swap 168 ********************************************************************* */ 169 170LEAF(phys_write32_swapped) 171 stwbrx r4,0,r3 172 eieio 173 blr 174END(phys_write32_swapped) 175 176/* ********************************************************************* 177 * End 178 ********************************************************************* */ 179