1*d6c3db71Sdyoung /* $NetBSD: mca_machdep.h,v 1.3 2011/07/18 17:26:55 dyoung Exp $ */ 268fe5b6fSgarbled 368fe5b6fSgarbled /* 468fe5b6fSgarbled * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. 568fe5b6fSgarbled * Copyright (c) 1999 Scott D. Telford. All rights reserved. 668fe5b6fSgarbled * 768fe5b6fSgarbled * Redistribution and use in source and binary forms, with or without 868fe5b6fSgarbled * modification, are permitted provided that the following conditions 968fe5b6fSgarbled * are met: 1068fe5b6fSgarbled * 1. Redistributions of source code must retain the above copyright 1168fe5b6fSgarbled * notice, this list of conditions and the following disclaimer. 1268fe5b6fSgarbled * 2. Redistributions in binary form must reproduce the above copyright 1368fe5b6fSgarbled * notice, this list of conditions and the following disclaimer in the 1468fe5b6fSgarbled * documentation and/or other materials provided with the distribution. 1568fe5b6fSgarbled * 3. The name of the author may not be used to endorse or promote products 1668fe5b6fSgarbled * derived from this software without specific prior written permission. 1768fe5b6fSgarbled * 1868fe5b6fSgarbled * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1968fe5b6fSgarbled * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2068fe5b6fSgarbled * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2168fe5b6fSgarbled * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2268fe5b6fSgarbled * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2368fe5b6fSgarbled * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2468fe5b6fSgarbled * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2568fe5b6fSgarbled * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2668fe5b6fSgarbled * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2768fe5b6fSgarbled * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2868fe5b6fSgarbled */ 2968fe5b6fSgarbled 3068fe5b6fSgarbled #ifndef _RS6000_MCA_MACHDEP_H_ 3168fe5b6fSgarbled #define _RS6000_MCA_MACHDEP_H_ 3268fe5b6fSgarbled 3368fe5b6fSgarbled #define _POWERPC_BUS_DMA_PRIVATE 34*d6c3db71Sdyoung #include <sys/bus.h> 3568fe5b6fSgarbled #include <machine/iocc.h> 3668fe5b6fSgarbled 3768fe5b6fSgarbled /* 3868fe5b6fSgarbled * rs6000-specific definitions for MCA autoconfiguration. 3968fe5b6fSgarbled */ 4068fe5b6fSgarbled 4168fe5b6fSgarbled extern struct powerpc_bus_dma_tag mca_bus_dma_tag; 4268fe5b6fSgarbled 4368fe5b6fSgarbled /* set to 1 if MCA bus is detected */ 4468fe5b6fSgarbled extern int MCA_system; 4568fe5b6fSgarbled 4668fe5b6fSgarbled int mca_nmi(void); 4768fe5b6fSgarbled 4868fe5b6fSgarbled /* 4968fe5b6fSgarbled * Types provided to machine-independent MCA code. 5068fe5b6fSgarbled */ 5168fe5b6fSgarbled struct x86_mca_chipset { 5268fe5b6fSgarbled void * /*struct mca_dma_state*/ ic_dmastate; 5368fe5b6fSgarbled }; 5468fe5b6fSgarbled 5568fe5b6fSgarbled typedef struct x86_mca_chipset *mca_chipset_tag_t; 5668fe5b6fSgarbled typedef int mca_intr_handle_t; 5768fe5b6fSgarbled 5868fe5b6fSgarbled /* 5968fe5b6fSgarbled * Functions provided to machine-independent MCA code. 6068fe5b6fSgarbled */ 6168fe5b6fSgarbled struct mcabus_attach_args; 6268fe5b6fSgarbled 6305b09539Smatt void mca_attach_hook(device_t, device_t, struct mcabus_attach_args *); 6468fe5b6fSgarbled int mca_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_dmamap_t *, int); 6568fe5b6fSgarbled void mca_dma_set_ioport(int dma, uint16_t port); 6668fe5b6fSgarbled const struct evcnt *mca_intr_evcnt(mca_chipset_tag_t, mca_intr_handle_t); 6768fe5b6fSgarbled void *mca_intr_establish(mca_chipset_tag_t, mca_intr_handle_t, 6868fe5b6fSgarbled int, int (*)(void *), void *); 6968fe5b6fSgarbled void mca_intr_disestablish(mca_chipset_tag_t, void *); 7068fe5b6fSgarbled int mca_conf_read(mca_chipset_tag_t, int, int); 7168fe5b6fSgarbled void mca_conf_write(mca_chipset_tag_t, int, int, int); 7268fe5b6fSgarbled void mca_busprobe(void); 7368fe5b6fSgarbled 7468fe5b6fSgarbled /* 7568fe5b6fSgarbled * Flags for DMA. Avoid BUS_DMA_BUS1, we share dmamap routines with ISA and 7668fe5b6fSgarbled * that flag is used for different purpose within _isa_dmamap_*(). 7768fe5b6fSgarbled */ 7868fe5b6fSgarbled #define MCABUS_DMA_IOPORT BUS_DMA_BUS2 /* io-port based DMA */ 7968fe5b6fSgarbled #define MCABUS_DMA_16BIT BUS_DMA_BUS3 /* 16bit DMA */ 8068fe5b6fSgarbled #define _MCABUS_DMA_USEDMACTRL BUS_DMA_BUS4 /* internal flag */ 8168fe5b6fSgarbled 8268fe5b6fSgarbled /* 8368fe5b6fSgarbled * These two are used to light disk busy LED on PS/2 during disk operations. 8468fe5b6fSgarbled */ 8568fe5b6fSgarbled void mca_disk_busy(void); 8668fe5b6fSgarbled void mca_disk_unbusy(void); 8768fe5b6fSgarbled 8868fe5b6fSgarbled /* MCA register addresses for PPC */ 8968fe5b6fSgarbled 9068fe5b6fSgarbled #define PS2_SYS_CTL_A 0x92 /* PS/2 System Control Port A */ 9168fe5b6fSgarbled #define MCA_MB_SETUP_REG 0x94 /* Motherboard setup register */ 9268fe5b6fSgarbled #define MCA_ADAP_SETUP_REG 0x96 /* Adapter setup register */ 9368fe5b6fSgarbled #define MCA_POS_REG_BASE (IOCC_POSBASE + 0x100) 9468fe5b6fSgarbled /* POS registers base address */ 9568fe5b6fSgarbled #define MCA_POS_REG_SIZE 8 /* POS registers window size */ 9668fe5b6fSgarbled 9768fe5b6fSgarbled #define MCA_POS_REG(n) (IOCC_POSBASE + 0x100+(n)) 9868fe5b6fSgarbled /* POS registers 0-7 */ 9968fe5b6fSgarbled 10068fe5b6fSgarbled /* Adapter setup register bits */ 10168fe5b6fSgarbled 10268fe5b6fSgarbled #define MCA_ADAP_SET 0x08 /* Adapter setup mode */ 10368fe5b6fSgarbled #define MCA_ADAP_CHR 0x80 /* Adapter channel reset */ 10468fe5b6fSgarbled 10568fe5b6fSgarbled #define MCA_MAX_SLOTS 16 /* max number of slots per bus */ 10668fe5b6fSgarbled #endif /* _RS6000_MCA_MACHDEP_H_ */ 107