11.15Sdyoung/*	$NetBSD: mca_machdep.h,v 1.15 2011/07/01 18:15:11 dyoung Exp $	*/
21.1Sjdolecek
31.1Sjdolecek/*
41.8Sjdolecek * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
51.1Sjdolecek * Copyright (c) 1999 Scott D. Telford.  All rights reserved.
61.1Sjdolecek *
71.1Sjdolecek * Redistribution and use in source and binary forms, with or without
81.1Sjdolecek * modification, are permitted provided that the following conditions
91.1Sjdolecek * are met:
101.1Sjdolecek * 1. Redistributions of source code must retain the above copyright
111.1Sjdolecek *    notice, this list of conditions and the following disclaimer.
121.1Sjdolecek * 2. Redistributions in binary form must reproduce the above copyright
131.1Sjdolecek *    notice, this list of conditions and the following disclaimer in the
141.1Sjdolecek *    documentation and/or other materials provided with the distribution.
151.1Sjdolecek * 3. The name of the author may not be used to endorse or promote products
161.1Sjdolecek *    derived from this software without specific prior written permission.
171.1Sjdolecek *
181.1Sjdolecek * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
191.1Sjdolecek * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
201.1Sjdolecek * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
211.1Sjdolecek * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
221.1Sjdolecek * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
231.1Sjdolecek * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
241.1Sjdolecek * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
251.1Sjdolecek * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
261.1Sjdolecek * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
271.1Sjdolecek * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
281.1Sjdolecek */
291.1Sjdolecek
301.1Sjdolecek#ifndef _I386_MCA_MACHDEP_H_
311.1Sjdolecek#define _I386_MCA_MACHDEP_H_
321.1Sjdolecek
331.13Scegger#include <sys/device.h>	/* for device_t */
341.15Sdyoung#include <sys/bus.h>
351.7Sjdolecek
361.1Sjdolecek/*
371.1Sjdolecek * i386-specific definitions for MCA autoconfiguration.
381.1Sjdolecek */
391.1Sjdolecek
401.9Sfvdlextern struct x86_bus_dma_tag mca_bus_dma_tag;
411.1Sjdolecek
421.1Sjdolecek/* set to 1 if MCA bus is detected */
431.1Sjdolecekextern int MCA_system;
441.1Sjdolecek
451.14Sdyoungvoid	mca_nmi(void);
461.1Sjdolecek
471.1Sjdolecek/*
481.1Sjdolecek * Types provided to machine-independent MCA code.
491.1Sjdolecek */
501.9Sfvdlstruct x86_mca_chipset {
511.11Schristos        void */*struct mca_dma_state*/ ic_dmastate;
521.1Sjdolecek};
531.1Sjdolecek
541.9Sfvdltypedef struct x86_mca_chipset *mca_chipset_tag_t;
551.1Sjdolecektypedef int mca_intr_handle_t;
561.1Sjdolecek
571.1Sjdolecek/*
581.1Sjdolecek * Functions provided to machine-independent MCA code.
591.1Sjdolecek */
601.1Sjdolecekstruct mcabus_attach_args;
611.1Sjdolecek
621.13Sceggervoid	mca_attach_hook(device_t, device_t,
631.2Scgd		struct mcabus_attach_args *);
641.7Sjdolecekint	mca_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_dmamap_t *, int);
651.10Sperryvoid	mca_dma_set_ioport(int dma, uint16_t port);
661.3Scgdconst struct evcnt *mca_intr_evcnt(mca_chipset_tag_t, mca_intr_handle_t);
671.2Scgdvoid	*mca_intr_establish(mca_chipset_tag_t, mca_intr_handle_t,
681.2Scgd		int, int (*)(void *), void *);
691.2Scgdvoid	mca_intr_disestablish(mca_chipset_tag_t, void *);
701.2Scgdint	mca_conf_read(mca_chipset_tag_t, int, int);
711.2Scgdvoid	mca_conf_write(mca_chipset_tag_t, int, int, int);
721.2Scgdvoid	mca_busprobe(void);
731.8Sjdolecek
741.8Sjdolecek/*
751.8Sjdolecek * Flags for DMA. Avoid BUS_DMA_BUS1, we share dmamap routines with ISA and
761.8Sjdolecek * that flag is used for different purpose within _isa_dmamap_*().
771.8Sjdolecek */
781.8Sjdolecek#define MCABUS_DMA_IOPORT		BUS_DMA_BUS2	/* io-port based DMA */
791.8Sjdolecek#define	MCABUS_DMA_16BIT		BUS_DMA_BUS3	/* 16bit DMA */
801.8Sjdolecek#define	_MCABUS_DMA_USEDMACTRL		BUS_DMA_BUS4	/* internal flag */
811.5Sjdolecek
821.5Sjdolecek/*
831.5Sjdolecek * These two are used to light disk busy LED on PS/2 during disk operations.
841.5Sjdolecek */
851.5Sjdolecekvoid	mca_disk_busy(void);
861.5Sjdolecekvoid	mca_disk_unbusy(void);
871.1Sjdolecek
881.1Sjdolecek/* MCA register addresses for IBM PS/2 */
891.1Sjdolecek
901.1Sjdolecek#define PS2_SYS_CTL_A		0x92	/* PS/2 System Control Port A */
911.1Sjdolecek#define MCA_MB_SETUP_REG	0x94	/* Motherboard setup register */
921.1Sjdolecek#define MCA_ADAP_SETUP_REG	0x96	/* Adapter setup register */
931.1Sjdolecek#define MCA_POS_REG_BASE	0x100	/* POS registers base address */
941.1Sjdolecek#define MCA_POS_REG_SIZE	8	/* POS registers window size */
951.1Sjdolecek
961.1Sjdolecek#define MCA_POS_REG(n)		(0x100+(n))	/* POS registers 0-7 */
971.1Sjdolecek
981.1Sjdolecek/* Adapter setup register bits */
991.1Sjdolecek
1001.1Sjdolecek#define MCA_ADAP_SET		0x08	/* Adapter setup mode */
1011.1Sjdolecek#define MCA_ADAP_CHR		0x80	/* Adapter channel reset */
1021.1Sjdolecek
1031.12Sgarbled#define MCA_MAX_SLOTS		8	/* max number of slots per bus */
1041.12Sgarbled
1051.1Sjdolecek#endif /* _I386_MCA_MACHDEP_H_ */
106