~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/dio.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* header file for DIO boards for the HP300 architecture.
  2  * Maybe this should handle DIO-II later?
  3  * The general structure of this is vaguely based on how
  4  * the Amiga port handles Zorro boards.
  5  * Copyright (C) Peter Maydell 05/1998 <pmaydell@chiark.greenend.org.uk>
  6  *
  7  * The board IDs are from the NetBSD kernel, which for once provided
  8  * helpful comments...
  9  *
 10  * This goes with arch/m68k/hp300/dio.c
 11  */
 12 
 13 #ifndef _LINUX_DIO_H
 14 #define _LINUX_DIO_H
 15 
 16 /* The DIO boards in a system are distinguished by 'select codes' which 
 17  * range from 0-63 (DIO) and 132-255 (DIO-II). 
 18  * The DIO board with select code sc is located at physical address 
 19  *     0x600000 + sc * 0x10000
 20  * So DIO cards cover [0x600000-0x800000); the areas [0x200000-0x400000) and
 21  * [0x800000-0x1000000) are for additional space required by things
 22  * like framebuffers. [0x400000-0x600000) is for miscellaneous internal I/O.
 23  * On Linux, this is currently all mapped into the virtual address space
 24  * at 0xf0000000 on bootup.
 25  * DIO-II boards are at 0x1000000 + (sc - 132) * 0x400000
 26  * which is address range [0x1000000-0x20000000) -- too big to map completely,
 27  * so currently we just don't handle DIO-II boards.  It wouldn't be hard to 
 28  * do with ioremap() though.
 29  */
 30 #ifdef __KERNEL__
 31 /* DIO/DIO-II boards all have the following 8bit registers.
 32  * These are offsets from the base of the device.
 33  */
 34 #define DIO_IDOFF     0x01                        /* primary device ID */
 35 #define DIO_IPLOFF    0x03                        /* interrupt priority level */
 36 #define DIO_SECIDOFF  0x15                        /* secondary device ID */
 37 #define DIOII_SIZEOFF 0x101                       /* device size, DIO-II only */
 38 
 39 /* The internal HPIB device is special; this is its physaddr; its select code is 7. 
 40  * The reason why we have to treat it specially is because apparently it's broken:
 41  * the device ID isn't consistent/reliable. *sigh*
 42  */
 43 #define DIO_IHPIBADDR 0x47800
 44 #define DIO_IHPIBSCODE 7
 45 
 46 /* If we don't have the internal HPIB defined, then treat select code 7 like
 47  * any other. If we *do* have internal HPIB, then we just have to assume that
 48  * select code 7 is the internal HPIB regardless of the ID register :-<
 49  */
 50 #define CONFIG_IHPIB /* hack hack : not yet a proper config option */
 51 #ifdef CONFIG_IHPIB
 52 #define DIO_ISIHPIB(scode) ((scode) == DIO_IHPIBSCODE)
 53 #else
 54 #define DIO_ISIHPIB(scode) 0
 55 #endif
 56 
 57 #define DIO_VIRADDRBASE 0xf0000000                /* vir addr where IOspace is mapped */
 58 
 59 #define DIO_BASE                0x600000        /* start of DIO space */
 60 #define DIO_END                 0x1000000       /* end of DIO space */
 61 #define DIO_DEVSIZE             0x10000         /* size of a DIO device */
 62 
 63 #define DIOII_BASE              0x01000000      /* start of DIO-II space */
 64 #define DIOII_END               0x20000000      /* end of DIO-II space */
 65 #define DIOII_DEVSIZE           0x00400000      /* size of a DIO-II device */
 66 
 67 /* Highest valid select code. If we add DIO-II support this should become
 68  * 256 for everything except HP320, which only has DIO.
 69  */
 70 #define DIO_SCMAX 32                             
 71 #define DIOII_SCBASE 132 /* lowest DIO-II select code */
 72 #define DIO_SCINHOLE(scode) (((scode) >= 32) && ((scode) < DIOII_SCBASE))
 73 
 74 /* macros to read device IDs, given base address */
 75 #define DIO_ID(baseaddr) readb((baseaddr) + DIO_IDOFF)
 76 #define DIO_SECID(baseaddr) readb((baseaddr) + DIO_SECIDOFF)
 77 
 78 /* extract the interrupt level */
 79 #define DIO_IPL(baseaddr) (((readb((baseaddr) + DIO_IPLOFF) >> 4) & 0x03) + 3)
 80 
 81 /* find the size of a DIO-II board's address space.
 82  * DIO boards are all fixed length.
 83  */
 84 #define DIOII_SIZE(baseaddr) ((readb((baseaddr) + DIOII_SIZEOFF) + 1) * 0x100000)
 85 
 86 /* general purpose macro for both DIO and DIO-II */
 87 #define DIO_SIZE(scode, base) (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE)
 88 
 89 /* The hardware has primary and secondary IDs; we encode these in a single
 90  * int as PRIMARY ID & (SECONDARY ID << 8).
 91  * In practice this is only important for framebuffers,
 92  * and everybody else just sets ID fields equal to the DIO_ID_FOO value.
 93  */
 94 #define DIO_ENCODE_ID(pr,sec) ((((int)sec & 0xff) << 8) & ((int)pr & 0xff))
 95 /* macro to determine whether a given primary ID requires a secondary ID byte */
 96 #define DIO_NEEDSSECID(id) ((id) == DIO_ID_FBUFFER)
 97 
 98 /* Now a whole slew of macros giving device IDs and descriptive strings: */
 99 #define DIO_ID_DCA0     0x02 /* 98644A serial */
100 #define DIO_DESC_DCA0 "98644A DCA0 serial"
101 #define DIO_ID_DCA0REM  0x82 /* 98644A serial */
102 #define DIO_DESC_DCA0REM "98644A DCA0REM serial"
103 #define DIO_ID_DCA1     0x42 /* 98644A serial */
104 #define DIO_DESC_DCA1 "98644A DCA1 serial"
105 #define DIO_ID_DCA1REM  0xc2 /* 98644A serial */
106 #define DIO_DESC_DCA1REM "98644A DCA1REM serial"
107 #define DIO_ID_DCM      0x05 /* 98642A serial MUX */
108 #define DIO_DESC_DCM "98642A DCM serial MUX"
109 #define DIO_ID_DCMREM   0x85 /* 98642A serial MUX */
110 #define DIO_DESC_DCMREM "98642A DCMREM serial MUX"
111 #define DIO_ID_LAN      0x15 /* 98643A LAN */
112 #define DIO_DESC_LAN "98643A LAN"
113 #define DIO_ID_FHPIB    0x08 /* 98625A/98625B fast HP-IB */
114 #define DIO_DESC_FHPIB "98625A/98625B fast HPIB"
115 #define DIO_ID_NHPIB    0x80 /* 98624A HP-IB (normal ie slow) */
116 #define DIO_DESC_NHPIB "98624A HPIB"
117 #define DIO_ID_IHPIB    0x00 /* internal HPIB (not its real ID, it hasn't got one! */
118 #define DIO_DESC_IHPIB "internal HPIB"
119 #define DIO_ID_SCSI0    0x07 /* 98625A SCSI */
120 #define DIO_DESC_SCSI0 "98625A SCSI0"
121 #define DIO_ID_SCSI1    0x27 /* ditto */
122 #define DIO_DESC_SCSI1 "98625A SCSI1"
123 #define DIO_ID_SCSI2    0x47 /* ditto */
124 #define DIO_DESC_SCSI2 "98625A SCSI2"
125 #define DIO_ID_SCSI3    0x67 /* ditto */
126 #define DIO_DESC_SCSI3 "98625A SCSI3"
127 #define DIO_ID_FBUFFER  0x39 /* framebuffer: flavour is distinguished by secondary ID */
128 #define DIO_DESC_FBUFFER "bitmapped display"
129 /* the NetBSD kernel source is a bit unsure as to what these next IDs actually do :-> */
130 #define DIO_ID_MISC0    0x03 /* 98622A */
131 #define DIO_DESC_MISC0 "98622A"
132 #define DIO_ID_MISC1    0x04 /* 98623A */
133 #define DIO_DESC_MISC1 "98623A"
134 #define DIO_ID_PARALLEL 0x06 /* internal parallel */
135 #define DIO_DESC_PARALLEL "internal parallel"
136 #define DIO_ID_MISC2    0x09 /* 98287A keyboard */
137 #define DIO_DESC_MISC2 "98287A keyboard"
138 #define DIO_ID_MISC3    0x0a /* HP98635A FP accelerator */
139 #define DIO_DESC_MISC3 "HP98635A FP accelerator"
140 #define DIO_ID_MISC4    0x0b /* timer */
141 #define DIO_DESC_MISC4 "timer"
142 #define DIO_ID_MISC5    0x12 /* 98640A */
143 #define DIO_DESC_MISC5 "98640A"
144 #define DIO_ID_MISC6    0x16 /* 98659A */
145 #define DIO_DESC_MISC6 "98659A"
146 #define DIO_ID_MISC7    0x19 /* 237 display */
147 #define DIO_DESC_MISC7 "237 display"
148 #define DIO_ID_MISC8    0x1a /* quad-wide card */
149 #define DIO_DESC_MISC8 "quad-wide card"
150 #define DIO_ID_MISC9    0x1b /* 98253A */
151 #define DIO_DESC_MISC9 "98253A"
152 #define DIO_ID_MISC10   0x1c /* 98627A */
153 #define DIO_DESC_MISC10 "98253A"
154 #define DIO_ID_MISC11   0x1d /* 98633A */
155 #define DIO_DESC_MISC11 "98633A"
156 #define DIO_ID_MISC12   0x1e /* 98259A */
157 #define DIO_DESC_MISC12 "98259A"
158 #define DIO_ID_MISC13   0x1f /* 8741 */
159 #define DIO_DESC_MISC13 "8741"
160 #define DIO_ID_VME      0x31 /* 98577A VME adapter */
161 #define DIO_DESC_VME "98577A VME adapter"
162 #define DIO_ID_DCL      0x34 /* 98628A serial */
163 #define DIO_DESC_DCL "98628A DCL serial"
164 #define DIO_ID_DCLREM   0xb4 /* 98628A serial */
165 #define DIO_DESC_DCLREM "98628A DCLREM serial"
166 /* These are the secondary IDs for the framebuffers */
167 #define DIO_ID2_GATORBOX    0x01 /* 98700/98710 "gatorbox" */
168 #define DIO_DESC2_GATORBOX       "98700/98710 \"gatorbox\" display"
169 #define DIO_ID2_TOPCAT      0x02 /* 98544/98545/98547 "topcat" */
170 #define DIO_DESC2_TOPCAT         "98544/98545/98547 \"topcat\" display"
171 #define DIO_ID2_RENAISSANCE 0x04 /* 98720/98721 "renaissance" */
172 #define DIO_DESC2_RENAISSANCE    "98720/98721 \"renaissance\" display"
173 #define DIO_ID2_LRCATSEYE   0x05 /* lowres "catseye" */
174 #define DIO_DESC2_LRCATSEYE      "low-res catseye display"
175 #define DIO_ID2_HRCCATSEYE  0x06 /* highres colour "catseye" */
176 #define DIO_DESC2_HRCCATSEYE     "high-res color catseye display"
177 #define DIO_ID2_HRMCATSEYE  0x07 /* highres mono "catseye" */
178 #define DIO_DESC2_HRMCATSEYE     "high-res mono catseye display"
179 #define DIO_ID2_DAVINCI     0x08 /* 98730/98731 "davinci" */
180 #define DIO_DESC2_DAVINCI        "98730/98731 \"davinci\" display"
181 #define DIO_ID2_XXXCATSEYE  0x09 /* "catseye" */
182 #define DIO_DESC2_XXXCATSEYE     "catseye display"
183 #define DIO_ID2_HYPERION    0x0e /* A1096A "hyperion" */
184 #define DIO_DESC2_HYPERION       "A1096A \"hyperion\" display"
185 #define DIO_ID2_XGENESIS    0x0b /* "x-genesis"; no NetBSD support */
186 #define DIO_DESC2_XGENESIS       "\"x-genesis\" display"
187 #define DIO_ID2_TIGER       0x0c /* "tiger"; no NetBSD support */
188 #define DIO_DESC2_TIGER          "\"tiger\" display"
189 #define DIO_ID2_YGENESIS    0x0d /* "y-genesis"; no NetBSD support */
190 #define DIO_DESC2_YGENESIS       "\"y-genesis\" display"
191 /* if you add new IDs then you should tell dio.c about them so it can
192  * identify them...
193  */
194 
195 extern void dio_init(void);
196 extern int dio_find(int deviceid);
197 extern void *dio_scodetoviraddr(int scode);
198 extern int dio_scodetoipl(int scode);
199 extern void dio_config_board(int scode);
200 extern void dio_unconfig_board(int scode);
201 
202 
203 #endif /* __KERNEL__ */
204 #endif /* ndef _LINUX_DIO_H */
205 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.