pccreg.h revision 1.5 1 1.5 thorpej /* $NetBSD: pccreg.h,v 1.5 1996/09/12 04:54:19 thorpej Exp $ */
2 1.1 chuck
3 1.1 chuck /*
4 1.1 chuck *
5 1.1 chuck * Copyright (c) 1995 Charles D. Cranor
6 1.1 chuck * All rights reserved.
7 1.1 chuck *
8 1.1 chuck * Redistribution and use in source and binary forms, with or without
9 1.1 chuck * modification, are permitted provided that the following conditions
10 1.1 chuck * are met:
11 1.1 chuck * 1. Redistributions of source code must retain the above copyright
12 1.1 chuck * notice, this list of conditions and the following disclaimer.
13 1.1 chuck * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 chuck * notice, this list of conditions and the following disclaimer in the
15 1.1 chuck * documentation and/or other materials provided with the distribution.
16 1.1 chuck * 3. All advertising materials mentioning features or use of this software
17 1.1 chuck * must display the following acknowledgement:
18 1.1 chuck * This product includes software developed by Charles D. Cranor.
19 1.1 chuck * 4. The name of the author may not be used to endorse or promote products
20 1.1 chuck * derived from this software without specific prior written permission.
21 1.1 chuck *
22 1.1 chuck * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1 chuck * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1 chuck * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1 chuck * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1 chuck * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1 chuck * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 chuck * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 chuck * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 chuck * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1 chuck * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 chuck */
33 1.1 chuck
34 1.1 chuck /*
35 1.3 chuck * peripheral channel controller (at pa fffe0000)
36 1.1 chuck */
37 1.1 chuck
38 1.3 chuck #define PCC_BASE 0xfffe0000 /* PA of PCC chip space */
39 1.3 chuck #define PCC_CLOCK_OFF 0x0000 /* offset of Mostek clock chip */
40 1.3 chuck #define PCC_RTC_OFF 0x07f8 /* offset of clock registers in MK */
41 1.3 chuck #define PCC_REG_OFF 0x1000 /* offset of PCC chip registers */
42 1.3 chuck #define PCC_LE_OFF 0x1800 /* offset of LANCE ethernet chip */
43 1.3 chuck #define PCC_VME_OFF 0x2000 /* offset of VME chip */
44 1.3 chuck #define PCC_LPT_OFF 0x2800 /* offset of parallel port register */
45 1.3 chuck #define PCC_ZS0_OFF 0x3000 /* offset of first 8530 UART */
46 1.3 chuck #define PCC_ZS1_OFF 0x3800 /* offset of second 8530 UART */
47 1.3 chuck #define PCC_WDSC_OFF 0x4000 /* offset of 33c93 SCSI chip */
48 1.3 chuck
49 1.3 chuck #define PCC_PADDR(off) ((void *)(PCC_BASE + (off)))
50 1.3 chuck
51 1.3 chuck /*
52 1.3 chuck * The PCC space is permanently mapped by pmap_bootstrap(). This
53 1.3 chuck * macro translates PCC offsets into the corresponding KVA.
54 1.3 chuck */
55 1.3 chuck #define PCC_VADDR(off) ((void *)IIOV(PCC_BASE + (off)))
56 1.3 chuck
57 1.1 chuck struct pcc {
58 1.1 chuck volatile u_long dma_taddr; /* dma table address */
59 1.1 chuck volatile u_long dma_daddr; /* dma data address */
60 1.1 chuck volatile u_long dma_bcnt; /* dma byte count */
61 1.1 chuck volatile u_long dma_hold; /* dma data hold register */
62 1.1 chuck volatile u_short t1_pload; /* timer1 preload */
63 1.1 chuck volatile u_short t1_count; /* timer1 count */
64 1.1 chuck volatile u_short t2_pload; /* timer2 preload */
65 1.1 chuck volatile u_short t2_count; /* timer2 count */
66 1.1 chuck volatile u_char t1_int; /* timer1 interrupt ctrl */
67 1.1 chuck volatile u_char t1_cr; /* timer1 ctrl reg */
68 1.1 chuck volatile u_char t2_int; /* timer2 interrupt ctrl */
69 1.1 chuck volatile u_char t2_cr; /* timer2 ctrl reg */
70 1.1 chuck volatile u_char acf_int; /* acfail intr reg */
71 1.1 chuck volatile u_char dog_int; /* watchdog intr reg */
72 1.1 chuck volatile u_char pr_int; /* printer intr reg */
73 1.1 chuck volatile u_char pr_cr; /* printer ctrl */
74 1.1 chuck volatile u_char dma_int; /* dma interrupt control */
75 1.1 chuck volatile u_char dma_csr; /* dma csr */
76 1.1 chuck volatile u_char bus_int; /* bus error interrupt */
77 1.1 chuck volatile u_char dma_sr; /* dma status register */
78 1.1 chuck volatile u_char abrt_int; /* abort interrupt control reg */
79 1.1 chuck volatile u_char ta_fcr; /* table address function code reg */
80 1.1 chuck volatile u_char zs_int; /* serial interrupt reg */
81 1.1 chuck volatile u_char gen_cr; /* general control register */
82 1.1 chuck volatile u_char le_int; /* ethernet interrupt */
83 1.1 chuck volatile u_char gen_sr; /* general status */
84 1.1 chuck volatile u_char scsi_int; /* scsi interrupt reg */
85 1.1 chuck volatile u_char slave_ba; /* slave base addr reg */
86 1.1 chuck volatile u_char sw1_int; /* software interrupt #1 cr */
87 1.1 chuck volatile u_char int_vectr; /* interrupt base vector register */
88 1.1 chuck volatile u_char sw2_int; /* software interrupt #2 cr */
89 1.1 chuck volatile u_char pcc_rev; /* revision level */
90 1.1 chuck };
91 1.1 chuck
92 1.1 chuck
93 1.1 chuck /*
94 1.1 chuck * points to system's PCC
95 1.1 chuck */
96 1.1 chuck
97 1.1 chuck extern struct pcc *sys_pcc;
98 1.1 chuck
99 1.1 chuck /*
100 1.5 thorpej * we lock off our interrupt vector at 0x40.
101 1.1 chuck */
102 1.1 chuck
103 1.1 chuck #define PCC_VECBASE 0x40
104 1.1 chuck #define PCC_NVEC 12
105 1.1 chuck
106 1.1 chuck /*
107 1.1 chuck * vectors we use
108 1.1 chuck */
109 1.1 chuck
110 1.1 chuck #define PCCV_ACFAIL 0
111 1.1 chuck #define PCCV_BERR 1
112 1.1 chuck #define PCCV_ABORT 2
113 1.1 chuck #define PCCV_ZS 3
114 1.1 chuck #define PCCV_LE 4
115 1.1 chuck #define PCCV_SCSIP 5
116 1.1 chuck #define PCCV_SCSID 6
117 1.1 chuck #define PCCV_PRINTER 7
118 1.1 chuck #define PCCV_TIMER1 8
119 1.1 chuck #define PCCV_TIMER2 9
120 1.1 chuck #define PCCV_SOFT1 10
121 1.1 chuck #define PCCV_SOFT2 11
122 1.1 chuck
123 1.1 chuck /*
124 1.1 chuck * enable interrupt
125 1.1 chuck */
126 1.1 chuck
127 1.2 chuck #define PCC_ICLEAR 0x80
128 1.1 chuck #define PCC_IENABLE 0x08
129 1.1 chuck
130 1.1 chuck /*
131 1.1 chuck * interrupt mask
132 1.1 chuck */
133 1.1 chuck
134 1.1 chuck #define PCC_IMASK 0x7
135 1.1 chuck
136 1.1 chuck /*
137 1.1 chuck * clock/timer
138 1.1 chuck */
139 1.1 chuck
140 1.1 chuck #define PCC_TIMERACK 0x80 /* ack intr */
141 1.1 chuck #define PCC_TIMER100HZ 63936 /* load value for 100Hz */
142 1.1 chuck #define PCC_TIMERCLEAR 0x0 /* reset and clear timer */
143 1.3 chuck #define PCC_TIMERSTOP 0x1 /* stop clock, but don't clear it */
144 1.1 chuck #define PCC_TIMERSTART 0x3 /* start timer */
145 1.5 thorpej
146 1.5 thorpej #define pcc_timer_hz2lim(hz) (65536 - (160000/(hz)))
147 1.5 thorpej #define pcc_timer_us2lim(us) (65536 - (160000/(1000000/(us))))
148 1.1 chuck
149 1.1 chuck /*
150 1.1 chuck * serial control
151 1.1 chuck */
152 1.1 chuck
153 1.1 chuck #define PCC_ZSEXTERN 0x10 /* let PCC supply vector */
154 1.3 chuck
155 1.3 chuck /*
156 1.3 chuck * abort switch
157 1.3 chuck */
158 1.3 chuck
159 1.3 chuck #define PCC_ABORT_IEN 0x08 /* enable interrupt */
160 1.3 chuck #define PCC_ABORT_ABS 0x40 /* current state of switch */
161 1.3 chuck #define PCC_ABORT_ACK 0x80 /* interrupt active; write to ack */
162 1.3 chuck
163 1.3 chuck /*
164 1.3 chuck * general control register
165 1.3 chuck */
166 1.3 chuck
167 1.3 chuck #define PCC_GENCR_IEN 0x10 /* global interrupt enable */
168