2 * Copyright 1993-2003 NVIDIA, Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #ifndef __NV_LOCAL_H__
24 #define __NV_LOCAL_H__
27 * This file includes any environment or machine specific values to access the
28 * HW. Put all affected includes, typdefs, etc. here so the riva_hw.* files
29 * can stay generic in nature.
32 #include "xf86_OSproc.h"
34 //#define NOUVEAU_MODESET_TRACE
35 #ifdef NOUVEAU_MODESET_TRACE
36 #define DDXMMIOH(f, h, r, v) ErrorF(f, h, r, v)
37 #define DDXMMIOW(f, r, w) (ErrorF(f, r, w), w)
39 #define DDXMMIOH(f, h, r, v)
40 #define DDXMMIOW(f, r, w) w
44 * HW access macros. These assume memory-mapped I/O, and not normal I/O space.
46 #define NV_WR08(p,i,d) MMIO_OUT8((pointer)(p), (i), (d))
47 #define NV_RD08(p,i) MMIO_IN8((pointer)(p), (i))
48 #define NV_WR16(p,i,d) MMIO_OUT16((pointer)(p), (i), (d))
49 #define NV_RD16(p,i) MMIO_IN16((pointer)(p), (i))
50 #define NV_WR32(p,i,d) MMIO_OUT32((pointer)(p), (i), (d))
51 #define NV_RD32(p,i) MMIO_IN32((pointer)(p), (i))
53 /* VGA I/O is now always done through MMIO */
54 #define VGA_WR08(p,i,d) NV_WR08(p, i, DDXMMIOW("VGA_WR08 port 0x%04x val 0x%02x\n", i, d))
55 #define VGA_RD08(p,i) DDXMMIOW("VGA_RD08 port 0x%04x val 0x%02x\n", i, NV_RD08(p,i))
57 static inline int log2i(int i)
83 #endif /* __NV_LOCAL_H__ */