xref: /netbsd-src/sys/arch/rs6000/include/mca_machdep.h (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: mca_machdep.h,v 1.1 2007/12/17 19:09:26 garbled Exp $	*/
2 
3 /*
4  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
5  * Copyright (c) 1999 Scott D. Telford.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef _RS6000_MCA_MACHDEP_H_
31 #define _RS6000_MCA_MACHDEP_H_
32 
33 #define _POWERPC_BUS_DMA_PRIVATE
34 #include <machine/bus.h>
35 #include <machine/iocc.h>
36 
37 /*
38  * rs6000-specific definitions for MCA autoconfiguration.
39  */
40 
41 extern struct powerpc_bus_dma_tag mca_bus_dma_tag;
42 
43 /* set to 1 if MCA bus is detected */
44 extern int MCA_system;
45 
46 int	mca_nmi(void);
47 
48 /*
49  * Types provided to machine-independent MCA code.
50  */
51 struct x86_mca_chipset {
52         void * /*struct mca_dma_state*/ ic_dmastate;
53 };
54 
55 typedef struct x86_mca_chipset *mca_chipset_tag_t;
56 typedef int mca_intr_handle_t;
57 
58 /*
59  * Functions provided to machine-independent MCA code.
60  */
61 struct mcabus_attach_args;
62 
63 void	mca_attach_hook(struct device *, struct device *,
64 		struct mcabus_attach_args *);
65 int	mca_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_dmamap_t *, int);
66 void	mca_dma_set_ioport(int dma, uint16_t port);
67 const struct evcnt *mca_intr_evcnt(mca_chipset_tag_t, mca_intr_handle_t);
68 void	*mca_intr_establish(mca_chipset_tag_t, mca_intr_handle_t,
69 		int, int (*)(void *), void *);
70 void	mca_intr_disestablish(mca_chipset_tag_t, void *);
71 int	mca_conf_read(mca_chipset_tag_t, int, int);
72 void	mca_conf_write(mca_chipset_tag_t, int, int, int);
73 void	mca_busprobe(void);
74 
75 /*
76  * Flags for DMA. Avoid BUS_DMA_BUS1, we share dmamap routines with ISA and
77  * that flag is used for different purpose within _isa_dmamap_*().
78  */
79 #define MCABUS_DMA_IOPORT		BUS_DMA_BUS2	/* io-port based DMA */
80 #define	MCABUS_DMA_16BIT		BUS_DMA_BUS3	/* 16bit DMA */
81 #define	_MCABUS_DMA_USEDMACTRL		BUS_DMA_BUS4	/* internal flag */
82 
83 /*
84  * These two are used to light disk busy LED on PS/2 during disk operations.
85  */
86 void	mca_disk_busy(void);
87 void	mca_disk_unbusy(void);
88 
89 /* MCA register addresses for PPC */
90 
91 #define PS2_SYS_CTL_A		0x92	/* PS/2 System Control Port A */
92 #define MCA_MB_SETUP_REG	0x94	/* Motherboard setup register */
93 #define MCA_ADAP_SETUP_REG	0x96	/* Adapter setup register */
94 #define MCA_POS_REG_BASE	(IOCC_POSBASE + 0x100)
95 					/* POS registers base address */
96 #define MCA_POS_REG_SIZE	8	/* POS registers window size */
97 
98 #define MCA_POS_REG(n)		(IOCC_POSBASE + 0x100+(n))
99 					/* POS registers 0-7 */
100 
101 /* Adapter setup register bits */
102 
103 #define MCA_ADAP_SET		0x08	/* Adapter setup mode */
104 #define MCA_ADAP_CHR		0x80	/* Adapter channel reset */
105 
106 #define MCA_MAX_SLOTS		16	/* max number of slots per bus */
107 #endif /* _RS6000_MCA_MACHDEP_H_ */
108