mca_machdep.h revision 1.3
11.3Sdyoung/*	$NetBSD: mca_machdep.h,v 1.3 2011/07/18 17:26:55 dyoung Exp $	*/
21.1Sgarbled
31.1Sgarbled/*
41.1Sgarbled * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
51.1Sgarbled * Copyright (c) 1999 Scott D. Telford.  All rights reserved.
61.1Sgarbled *
71.1Sgarbled * Redistribution and use in source and binary forms, with or without
81.1Sgarbled * modification, are permitted provided that the following conditions
91.1Sgarbled * are met:
101.1Sgarbled * 1. Redistributions of source code must retain the above copyright
111.1Sgarbled *    notice, this list of conditions and the following disclaimer.
121.1Sgarbled * 2. Redistributions in binary form must reproduce the above copyright
131.1Sgarbled *    notice, this list of conditions and the following disclaimer in the
141.1Sgarbled *    documentation and/or other materials provided with the distribution.
151.1Sgarbled * 3. The name of the author may not be used to endorse or promote products
161.1Sgarbled *    derived from this software without specific prior written permission.
171.1Sgarbled *
181.1Sgarbled * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
191.1Sgarbled * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
201.1Sgarbled * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
211.1Sgarbled * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
221.1Sgarbled * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
231.1Sgarbled * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
241.1Sgarbled * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
251.1Sgarbled * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
261.1Sgarbled * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
271.1Sgarbled * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
281.1Sgarbled */
291.1Sgarbled
301.1Sgarbled#ifndef _RS6000_MCA_MACHDEP_H_
311.1Sgarbled#define _RS6000_MCA_MACHDEP_H_
321.1Sgarbled
331.1Sgarbled#define _POWERPC_BUS_DMA_PRIVATE
341.3Sdyoung#include <sys/bus.h>
351.1Sgarbled#include <machine/iocc.h>
361.1Sgarbled
371.1Sgarbled/*
381.1Sgarbled * rs6000-specific definitions for MCA autoconfiguration.
391.1Sgarbled */
401.1Sgarbled
411.1Sgarbledextern struct powerpc_bus_dma_tag mca_bus_dma_tag;
421.1Sgarbled
431.1Sgarbled/* set to 1 if MCA bus is detected */
441.1Sgarbledextern int MCA_system;
451.1Sgarbled
461.1Sgarbledint	mca_nmi(void);
471.1Sgarbled
481.1Sgarbled/*
491.1Sgarbled * Types provided to machine-independent MCA code.
501.1Sgarbled */
511.1Sgarbledstruct x86_mca_chipset {
521.1Sgarbled        void * /*struct mca_dma_state*/ ic_dmastate;
531.1Sgarbled};
541.1Sgarbled
551.1Sgarbledtypedef struct x86_mca_chipset *mca_chipset_tag_t;
561.1Sgarbledtypedef int mca_intr_handle_t;
571.1Sgarbled
581.1Sgarbled/*
591.1Sgarbled * Functions provided to machine-independent MCA code.
601.1Sgarbled */
611.1Sgarbledstruct mcabus_attach_args;
621.1Sgarbled
631.2Smattvoid	mca_attach_hook(device_t, device_t, struct mcabus_attach_args *);
641.1Sgarbledint	mca_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_dmamap_t *, int);
651.1Sgarbledvoid	mca_dma_set_ioport(int dma, uint16_t port);
661.1Sgarbledconst struct evcnt *mca_intr_evcnt(mca_chipset_tag_t, mca_intr_handle_t);
671.1Sgarbledvoid	*mca_intr_establish(mca_chipset_tag_t, mca_intr_handle_t,
681.1Sgarbled		int, int (*)(void *), void *);
691.1Sgarbledvoid	mca_intr_disestablish(mca_chipset_tag_t, void *);
701.1Sgarbledint	mca_conf_read(mca_chipset_tag_t, int, int);
711.1Sgarbledvoid	mca_conf_write(mca_chipset_tag_t, int, int, int);
721.1Sgarbledvoid	mca_busprobe(void);
731.1Sgarbled
741.1Sgarbled/*
751.1Sgarbled * Flags for DMA. Avoid BUS_DMA_BUS1, we share dmamap routines with ISA and
761.1Sgarbled * that flag is used for different purpose within _isa_dmamap_*().
771.1Sgarbled */
781.1Sgarbled#define MCABUS_DMA_IOPORT		BUS_DMA_BUS2	/* io-port based DMA */
791.1Sgarbled#define	MCABUS_DMA_16BIT		BUS_DMA_BUS3	/* 16bit DMA */
801.1Sgarbled#define	_MCABUS_DMA_USEDMACTRL		BUS_DMA_BUS4	/* internal flag */
811.1Sgarbled
821.1Sgarbled/*
831.1Sgarbled * These two are used to light disk busy LED on PS/2 during disk operations.
841.1Sgarbled */
851.1Sgarbledvoid	mca_disk_busy(void);
861.1Sgarbledvoid	mca_disk_unbusy(void);
871.1Sgarbled
881.1Sgarbled/* MCA register addresses for PPC */
891.1Sgarbled
901.1Sgarbled#define PS2_SYS_CTL_A		0x92	/* PS/2 System Control Port A */
911.1Sgarbled#define MCA_MB_SETUP_REG	0x94	/* Motherboard setup register */
921.1Sgarbled#define MCA_ADAP_SETUP_REG	0x96	/* Adapter setup register */
931.1Sgarbled#define MCA_POS_REG_BASE	(IOCC_POSBASE + 0x100)
941.1Sgarbled					/* POS registers base address */
951.1Sgarbled#define MCA_POS_REG_SIZE	8	/* POS registers window size */
961.1Sgarbled
971.1Sgarbled#define MCA_POS_REG(n)		(IOCC_POSBASE + 0x100+(n))
981.1Sgarbled					/* POS registers 0-7 */
991.1Sgarbled
1001.1Sgarbled/* Adapter setup register bits */
1011.1Sgarbled
1021.1Sgarbled#define MCA_ADAP_SET		0x08	/* Adapter setup mode */
1031.1Sgarbled#define MCA_ADAP_CHR		0x80	/* Adapter channel reset */
1041.1Sgarbled
1051.1Sgarbled#define MCA_MAX_SLOTS		16	/* max number of slots per bus */
1061.1Sgarbled#endif /* _RS6000_MCA_MACHDEP_H_ */
107