Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2000, 2003 Ralf Baechle
0007  * Copyright (C) 2000 Silicon Graphics, Inc.
0008  */
0009 #ifndef _ASM_SN_IO_H
0010 #define _ASM_SN_IO_H
0011 
0012 #if defined(CONFIG_SGI_IP27)
0013 #include <asm/sn/sn0/hubio.h>
0014 #endif
0015 
0016 
0017 #define IIO_ITTE_BASE       0x400160 /* base of translation table entries */
0018 #define IIO_ITTE(bigwin)    (IIO_ITTE_BASE + 8*(bigwin))
0019 
0020 #define IIO_ITTE_OFFSET_BITS    5   /* size of offset field */
0021 #define IIO_ITTE_OFFSET_MASK    ((1<<IIO_ITTE_OFFSET_BITS)-1)
0022 #define IIO_ITTE_OFFSET_SHIFT   0
0023 
0024 #define IIO_ITTE_WIDGET_BITS    4   /* size of widget field */
0025 #define IIO_ITTE_WIDGET_MASK    ((1<<IIO_ITTE_WIDGET_BITS)-1)
0026 #define IIO_ITTE_WIDGET_SHIFT   8
0027 
0028 #define IIO_ITTE_IOSP       1   /* I/O Space bit */
0029 #define IIO_ITTE_IOSP_MASK  1
0030 #define IIO_ITTE_IOSP_SHIFT 12
0031 #define HUB_PIO_MAP_TO_MEM  0
0032 #define HUB_PIO_MAP_TO_IO   1
0033 
0034 #define IIO_ITTE_INVALID_WIDGET 3   /* an invalid widget  */
0035 
0036 #define IIO_ITTE_PUT(nasid, bigwin, io_or_mem, widget, addr) \
0037     REMOTE_HUB_S((nasid), IIO_ITTE(bigwin), \
0038         (((((addr) >> BWIN_SIZE_BITS) & \
0039            IIO_ITTE_OFFSET_MASK) << IIO_ITTE_OFFSET_SHIFT) | \
0040         (io_or_mem << IIO_ITTE_IOSP_SHIFT) | \
0041         (((widget) & IIO_ITTE_WIDGET_MASK) << IIO_ITTE_WIDGET_SHIFT)))
0042 
0043 #define IIO_ITTE_DISABLE(nasid, bigwin) \
0044     IIO_ITTE_PUT((nasid), HUB_PIO_MAP_TO_MEM, \
0045              (bigwin), IIO_ITTE_INVALID_WIDGET, 0)
0046 
0047 #define IIO_ITTE_GET(nasid, bigwin) REMOTE_HUB_PTR((nasid), IIO_ITTE(bigwin))
0048 
0049 /*
0050  * Macro which takes the widget number, and returns the
0051  * IO PRB address of that widget.
0052  * value _x is expected to be a widget number in the range
0053  * 0, 8 - 0xF
0054  */
0055 #define IIO_IOPRB(_x)   (IIO_IOPRB_0 + ( ( (_x) < HUB_WIDGET_ID_MIN ? \
0056             (_x) : \
0057             (_x) - (HUB_WIDGET_ID_MIN-1)) << 3) )
0058 
0059 #endif /* _ASM_SN_IO_H */