2 * Copyright 1999 Egbert Eich
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the authors not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. The authors makes no representations
11 * about the suitability of this software for any purpose. It is provided
12 * "as is" without express or implied warranty.
14 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
31 #define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
33 #define vuip volatile unsigned int *
38 unsigned long result, shift;
40 if (addr >= 0xA0000 && addr <= 0xBFFFF) {
42 shift = (addr & 0x3) * 8;
43 result = *(vuip) ((unsigned long)vram_map + (addr << sparse_shift));
45 return 0xffUL & result;
54 unsigned long result, shift;
56 if (addr >= 0xA0000 && addr <= 0xBFFFF) {
58 shift = (addr & 0x2) * 8;
59 result = *(vuip)((unsigned long)vram_map+(addr<<sparse_shift)
60 +(1<<(sparse_shift-2)));
62 return 0xffffUL & result;
73 if (addr >= 0xA0000 && addr <= 0xBFFFF) {
75 result = *(vuip)((unsigned long)vram_map+(addr<<sparse_shift)+(3<<(sparse_shift-2)));
83 mem_wb(CARD32 addr, CARD8 val)
85 unsigned int b = val & 0xffU;
87 if (addr >= 0xA0000 && addr <= 0xBFFFF) {
89 *(vuip) ((unsigned long)vram_map + (addr << sparse_shift)) = b * 0x01010101;
97 mem_ww(CARD32 addr, CARD16 val)
99 unsigned int w = val & 0xffffU;
101 if (addr >= 0xA0000 && addr <= 0xBFFFF) {
103 *(vuip)((unsigned long)vram_map+(addr<<sparse_shift)
104 +(1<<(sparse_shift-2))) = w * 0x00010001;
112 mem_wl(CARD32 addr, CARD32 val)
115 if (addr >= 0xA0000 && addr <= 0xBFFFF) {
117 *(vuip)((unsigned long)vram_map+(addr<<sparse_shift)
118 +(3<<(sparse_shift-2))) = val;