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