xref: /onnv-gate/usr/src/uts/common/sys/ecppreg.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 1992-2002 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_ECPPREG_H
28*0Sstevel@tonic-gate #define	_SYS_ECPPREG_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * Register definitions for the National Semiconductor PC87332VLJ
38*0Sstevel@tonic-gate  * SuperI/O chip.
39*0Sstevel@tonic-gate  */
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate /*
42*0Sstevel@tonic-gate  * configuration registers
43*0Sstevel@tonic-gate  */
44*0Sstevel@tonic-gate struct config_reg {
45*0Sstevel@tonic-gate 	uint8_t index;
46*0Sstevel@tonic-gate 	uint8_t data;
47*0Sstevel@tonic-gate };
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate /* index values for the configuration registers */
50*0Sstevel@tonic-gate #define	FER	0x0	/* Function Enable Register */
51*0Sstevel@tonic-gate #define	FAR	0x1	/* Function Address Register */
52*0Sstevel@tonic-gate #define	PTR	0x2	/* Power and Test Register */
53*0Sstevel@tonic-gate #define	FCR	0x3	/* Function Control Register */
54*0Sstevel@tonic-gate #define	PCR	0x4	/* Printer Control Register */
55*0Sstevel@tonic-gate #define	KRR	0x5	/* Keyboard and RTC control Register */
56*0Sstevel@tonic-gate #define	PMC	0x6	/* Power Management Control register */
57*0Sstevel@tonic-gate #define	TUP	0x7	/* Tape, UART, and Parallel port register */
58*0Sstevel@tonic-gate #define	SID	0x8	/* Super I/O Identification register */
59*0Sstevel@tonic-gate 
60*0Sstevel@tonic-gate #define	SIO_LITE	0x40
61*0Sstevel@tonic-gate #define	SIO_LITE_B	0x90
62*0Sstevel@tonic-gate #define	SIO_REVA	0x1a
63*0Sstevel@tonic-gate #define	SIO_REVB	0x1b
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate /* bit definitions for the FCR register */
66*0Sstevel@tonic-gate #define	PC87332_FCR_MSD_SEL		0x01
67*0Sstevel@tonic-gate #define	PC87332_FCR_RESERVED		0x02
68*0Sstevel@tonic-gate #define	PC87332_FCR_PPM_EN		0x04
69*0Sstevel@tonic-gate #define	PC87332_FCR_PPM_FLOAT_CTL	0x08
70*0Sstevel@tonic-gate #define	PC87332_FCR_LDX			0x10
71*0Sstevel@tonic-gate #define	PC87332_FCR_ZWS_EN		0x20
72*0Sstevel@tonic-gate #define	PC87332_FCR_ZWS_SEL		0x40
73*0Sstevel@tonic-gate #define	PC87332_FCR_IOCHRDY_SEL		0x80
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate /* bit definitions for the PCR register */
76*0Sstevel@tonic-gate #define	PC87332_PCR_EPP_EN		0x01
77*0Sstevel@tonic-gate #define	PC87332_PCR_EPP_VER		0x02
78*0Sstevel@tonic-gate #define	PC87332_PCR_ECP_EN		0x04
79*0Sstevel@tonic-gate #define	PC87332_PCR_ECP_CLK_FZ		0x08
80*0Sstevel@tonic-gate #define	PC87332_PCR_INTR_LEVL		0x10
81*0Sstevel@tonic-gate #define	PC87332_PCR_INTR_POL		0x20
82*0Sstevel@tonic-gate #define	PC87332_PCR_INTR_DRAIN		0x40
83*0Sstevel@tonic-gate #define	PC87332_PCR_RESERVED		0x80
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate /* bit definitions for the PMC register */
86*0Sstevel@tonic-gate #define	PC87332_PMC_IDE_TRISTATE	0x01
87*0Sstevel@tonic-gate #define	PC87332_PMC_FDC_TRISTATE	0x02
88*0Sstevel@tonic-gate #define	PC87332_PMC_UART_TRISTATE	0x04
89*0Sstevel@tonic-gate #define	PC87332_PMC_ECP_DMA_CONFIG	0x08
90*0Sstevel@tonic-gate #define	PC87332_PMC_FDC_PD		0x10
91*0Sstevel@tonic-gate #define	PC87332_PMC_SLB			0x20
92*0Sstevel@tonic-gate #define	PC87332_PMC_PP_TRISTATE		0x40
93*0Sstevel@tonic-gate #define	PC87332_PMC_RESERVED		0x80
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate /*
96*0Sstevel@tonic-gate  * National 97317 superio registers
97*0Sstevel@tonic-gate  */
98*0Sstevel@tonic-gate #define	PC97317_CONFIG_DEV_NO		0x07
99*0Sstevel@tonic-gate #define	PC97317_CONFIG_ACTIVATE		0x30
100*0Sstevel@tonic-gate #define	PC97317_CONFIG_IO_RANGE		0x31
101*0Sstevel@tonic-gate #define	PC97317_CONFIG_BASE_ADDR_MSB	0x60
102*0Sstevel@tonic-gate #define	PC97317_CONFIG_BASE_ADDR_LSB	0x61
103*0Sstevel@tonic-gate #define	PC97317_CONFIG_INTR_SEL		0x70
104*0Sstevel@tonic-gate #define	PC97317_CONFIG_INTR_TYPE	0x71
105*0Sstevel@tonic-gate #define	PC97317_CONFIG_DMA0_CHAN	0x74
106*0Sstevel@tonic-gate #define	PC97317_CONFIG_DMA1_CHAN	0x75
107*0Sstevel@tonic-gate #define	PC97317_CONFIG_PP_CONFIG	0xF0
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate /*
110*0Sstevel@tonic-gate  * Plug N Play configuration superio registers
111*0Sstevel@tonic-gate  * used in PC97317 & M1553
112*0Sstevel@tonic-gate  */
113*0Sstevel@tonic-gate #define	PnP_CONFIG_DEV_NO		0x07
114*0Sstevel@tonic-gate #define	PnP_CONFIG_ACTIVATE		0x30
115*0Sstevel@tonic-gate #define	PnP_CONFIG_IO_RANGE		0x31
116*0Sstevel@tonic-gate #define	PnP_CONFIG_BASE_ADDR_MSB	0x60
117*0Sstevel@tonic-gate #define	PnP_CONFIG_BASE_ADDR_LSB	0x61
118*0Sstevel@tonic-gate #define	PnP_CONFIG_INTR_SEL		0x70
119*0Sstevel@tonic-gate #define	PnP_CONFIG_INTR_TYPE		0x71
120*0Sstevel@tonic-gate #define	PnP_CONFIG_DMA0_CHAN		0x74
121*0Sstevel@tonic-gate #define	PnP_CONFIG_DMA1_CHAN		0x75
122*0Sstevel@tonic-gate #define	PnP_CONFIG_PP_CONFIG0		0xF0
123*0Sstevel@tonic-gate #define	PnP_CONFIG_PP_CONFIG1		0xF1
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate 
126*0Sstevel@tonic-gate /*
127*0Sstevel@tonic-gate  * parallel port interface registers - same for all 1284 modes.
128*0Sstevel@tonic-gate  */
129*0Sstevel@tonic-gate struct info_reg {
130*0Sstevel@tonic-gate 	union {
131*0Sstevel@tonic-gate 		uint8_t	datar;
132*0Sstevel@tonic-gate 		uint8_t	afifo;
133*0Sstevel@tonic-gate 	} ir;
134*0Sstevel@tonic-gate 	uint8_t dsr;
135*0Sstevel@tonic-gate 	uint8_t dcr;
136*0Sstevel@tonic-gate 	uint8_t epp_addr;
137*0Sstevel@tonic-gate 	uint8_t epp_data;
138*0Sstevel@tonic-gate 	uint8_t epp_data32[3];
139*0Sstevel@tonic-gate };
140*0Sstevel@tonic-gate 
141*0Sstevel@tonic-gate /*
142*0Sstevel@tonic-gate  * additional ECP mode registers.
143*0Sstevel@tonic-gate  */
144*0Sstevel@tonic-gate struct fifo_reg {
145*0Sstevel@tonic-gate 	union {
146*0Sstevel@tonic-gate 		uint8_t cfifo;
147*0Sstevel@tonic-gate 		uint8_t dfifo;
148*0Sstevel@tonic-gate 		uint8_t tfifo;
149*0Sstevel@tonic-gate 		uint8_t config_a;
150*0Sstevel@tonic-gate 	} fr;
151*0Sstevel@tonic-gate 	uint8_t config_b;
152*0Sstevel@tonic-gate 	uint8_t ecr;
153*0Sstevel@tonic-gate };
154*0Sstevel@tonic-gate 
155*0Sstevel@tonic-gate /*
156*0Sstevel@tonic-gate  * Values for the ECR field
157*0Sstevel@tonic-gate  *
158*0Sstevel@tonic-gate  * The ECR has 3 read-only bits - bits 0,1,2.  Bits 3,4,5,6,7 are read/write.
159*0Sstevel@tonic-gate  * While writing to this register (ECPPIOC_SETREGS), bits 0,1,2 must be 0.
160*0Sstevel@tonic-gate  * If not, ECPPIOC_SETREGS will return EINVAL.
161*0Sstevel@tonic-gate  */
162*0Sstevel@tonic-gate 
163*0Sstevel@tonic-gate #define	ECPP_FIFO_EMPTY		0x01	/* 1 when FIFO empty */
164*0Sstevel@tonic-gate #define	ECPP_FIFO_FULL		0x02	/* 1 when FIFO full  */
165*0Sstevel@tonic-gate #define	ECPP_INTR_SRV		0x04
166*0Sstevel@tonic-gate 
167*0Sstevel@tonic-gate /*
168*0Sstevel@tonic-gate  * When bit is 0, bit will be set to 1
169*0Sstevel@tonic-gate  * and interrupt will be generated if
170*0Sstevel@tonic-gate  * any of the three events occur:
171*0Sstevel@tonic-gate  * (a) TC is reached while DMA enabled
172*0Sstevel@tonic-gate  * (b) If DMA disabled & DCR5 = 0, 8 or more bytes free in FIFO,
173*0Sstevel@tonic-gate  * (c) IF DMA disable & DCR5 = 1, 8 or more bytes to be read in FIFO.
174*0Sstevel@tonic-gate  *
175*0Sstevel@tonic-gate  * When this bit is 1, DMA & (a), (b), (c)
176*0Sstevel@tonic-gate  * interrupts are disabled.
177*0Sstevel@tonic-gate  */
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate #define	ECPP_DMA_ENABLE		0x08  /* DMA enable =1 */
180*0Sstevel@tonic-gate #define	ECPP_INTR_MASK		0x10  /* intr-enable nErr mask=1 */
181*0Sstevel@tonic-gate #define	ECR_mode_000		0x00  /* PIO CENTRONICS */
182*0Sstevel@tonic-gate #define	ECR_mode_001		0x20  /* PIO NIBBLE */
183*0Sstevel@tonic-gate #define	ECR_mode_010		0x40  /* DMA CENTRONICS */
184*0Sstevel@tonic-gate #define	ECR_mode_011		0x60  /* DMA ECP */
185*0Sstevel@tonic-gate #define	ECR_mode_100		0x80  /* PIO EPP */
186*0Sstevel@tonic-gate #define	ECR_mode_110		0xc0  /* TDMA (TFIFO) */
187*0Sstevel@tonic-gate #define	ECR_mode_111		0xe0  /* Config Mode */
188*0Sstevel@tonic-gate 
189*0Sstevel@tonic-gate /*
190*0Sstevel@tonic-gate  * 97317 second level configuration registers
191*0Sstevel@tonic-gate  */
192*0Sstevel@tonic-gate struct config2_reg {
193*0Sstevel@tonic-gate 	uint8_t		eir;	/* Extended Index Register */
194*0Sstevel@tonic-gate 	uint8_t		edr;	/* Extended Data Register */
195*0Sstevel@tonic-gate };
196*0Sstevel@tonic-gate 
197*0Sstevel@tonic-gate /*
198*0Sstevel@tonic-gate  * Second level offset
199*0Sstevel@tonic-gate  */
200*0Sstevel@tonic-gate #define	PC97317_CONFIG2_CONTROL0	0x00
201*0Sstevel@tonic-gate #define	PC97317_CONFIG2_CONTROL2	0x02
202*0Sstevel@tonic-gate #define	PC97317_CONFIG2_CONTROL4	0x04
203*0Sstevel@tonic-gate #define	PC97317_CONFIG2_PPCONFG0	0x05
204*0Sstevel@tonic-gate 
205*0Sstevel@tonic-gate /* Cheerio Ebus DMAC */
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate struct cheerio_dma_reg {
208*0Sstevel@tonic-gate 	uint32_t csr;	/* Data Control Status Register */
209*0Sstevel@tonic-gate 	uint32_t acr;	/* DMA Address Count Registers */
210*0Sstevel@tonic-gate 	uint32_t bcr;	/* DMA Byte Count Register */
211*0Sstevel@tonic-gate };
212*0Sstevel@tonic-gate 
213*0Sstevel@tonic-gate /*
214*0Sstevel@tonic-gate  * DMA Control and Status Register(DCSR) definitions.  See Cheerio spec
215*0Sstevel@tonic-gate  * for more details
216*0Sstevel@tonic-gate  */
217*0Sstevel@tonic-gate #define	DCSR_INT_PEND 	0x00000001	/* 1= pport or dma interrupts */
218*0Sstevel@tonic-gate #define	DCSR_ERR_PEND 	0x00000002	/* 1= host bus error detected */
219*0Sstevel@tonic-gate #define	DCSR_INT_EN 	0x00000010	/* 1= enable sidewinder/ebus intr */
220*0Sstevel@tonic-gate #define	DCSR_RESET  	0x00000080	/* 1= resets the DCSR */
221*0Sstevel@tonic-gate #define	DCSR_WRITE  	0x00000100  	/* DMA direction; 1 = memory */
222*0Sstevel@tonic-gate #define	DCSR_EN_DMA  	0x00000200  	/* 1= enable DMA */
223*0Sstevel@tonic-gate #define	DCSR_CYC_PEND	0x00000400	/* 1 = DMA pending */
224*0Sstevel@tonic-gate #define	DCSR_EN_CNT 	0x00002000	/* 1= enables byte counter */
225*0Sstevel@tonic-gate #define	DCSR_TC		0x00004000  	/* 1= Terminal Count occurred */
226*0Sstevel@tonic-gate #define	DCSR_CSR_DRAIN 	0x00000000 	/* 1= disable draining */
227*0Sstevel@tonic-gate #define	DCSR_BURST_0    0x00040000 	/* Burst Size bit 0 */
228*0Sstevel@tonic-gate #define	DCSR_BURST_1    0x00080000 	/* Burst Size bit 1 */
229*0Sstevel@tonic-gate #define	DCSR_DIAG	0x00000000 	/* 1= diag enable */
230*0Sstevel@tonic-gate #define	DCSR_TCI_DIS 	0x00800000	/* 1= TC won't cause interrupt */
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate 
233*0Sstevel@tonic-gate /* Southbridge support */
234*0Sstevel@tonic-gate struct isaspace {
235*0Sstevel@tonic-gate 	uchar_t	isa_reg[0x500];	/* 0x500 regs from isa config space */
236*0Sstevel@tonic-gate };
237*0Sstevel@tonic-gate 
238*0Sstevel@tonic-gate 
239*0Sstevel@tonic-gate #ifdef	__cplusplus
240*0Sstevel@tonic-gate }
241*0Sstevel@tonic-gate #endif
242*0Sstevel@tonic-gate 
243*0Sstevel@tonic-gate #endif	/* _SYS_ECPPREG_H */
244