Home | History | Annotate | Line # | Download | only in include
isa_machdep.h revision 1.9
      1 /*	$NetBSD: isa_machdep.h,v 1.9 2012/09/21 14:21:57 matt Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  * NASA Ames Research Center.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30  * POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 #ifndef _ARM32_ISA_MACHDEP_H_
     34 #define _ARM32_ISA_MACHDEP_H_
     35 
     36 #include <sys/bus.h>
     37 #include <dev/isa/isadmavar.h>
     38 
     39 /*
     40  * Types provided to machine-independent ISA code.
     41  */
     42 struct arm32_isa_chipset {
     43 	struct isa_dma_state ic_dmastate;
     44 };
     45 
     46 typedef struct arm32_isa_chipset *isa_chipset_tag_t;
     47 
     48 struct device;			/* XXX */
     49 struct isabus_attach_args;	/* XXX */
     50 
     51 /*
     52  * Functions provided to machine-independent ISA code.
     53  */
     54 void	isa_attach_hook(struct device *, struct device *,
     55 	    struct isabus_attach_args *);
     56 void	isa_detach_hook(isa_chipset_tag_t, device_t);
     57 const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq);
     58 void	*isa_intr_establish(isa_chipset_tag_t ic, int irq, int type,
     59 	    int level, int (*ih_fun)(void *), void *ih_arg);
     60 void	isa_intr_disestablish(isa_chipset_tag_t ic, void *handler);
     61 
     62 #define	isa_dmainit(ic, bst, dmat, d)					\
     63 	_isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
     64 #define	isa_dmadestroy(ic)						\
     65 	_isa_dmadestroy(&(ic)->ic_dmastate)
     66 #define	isa_dmacascade(ic, c)						\
     67 	_isa_dmacascade(&(ic)->ic_dmastate, (c))
     68 #define	isa_dmamaxsize(ic, c)						\
     69 	_isa_dmamaxsize(&(ic)->ic_dmastate, (c))
     70 #define	isa_dmamap_create(ic, c, s, f)					\
     71 	_isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
     72 #define	isa_dmamap_destroy(ic, c)					\
     73 	_isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
     74 #define	isa_dmastart(ic, c, a, n, p, f, bf)				\
     75 	_isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
     76 #define	isa_dmaabort(ic, c)						\
     77 	_isa_dmaabort(&(ic)->ic_dmastate, (c))
     78 #define	isa_dmacount(ic, c)						\
     79 	_isa_dmacount(&(ic)->ic_dmastate, (c))
     80 #define	isa_dmafinished(ic, c)						\
     81 	_isa_dmafinished(&(ic)->ic_dmastate, (c))
     82 #define	isa_dmadone(ic, c)						\
     83 	_isa_dmadone(&(ic)->ic_dmastate, (c))
     84 #define	isa_dmafreeze(ic)						\
     85 	_isa_dmafreeze(&(ic)->ic_dmastate)
     86 #define	isa_dmathaw(ic)							\
     87 	_isa_dmathaw(&(ic)->ic_dmastate)
     88 #define	isa_dmamem_alloc(ic, c, s, ap, f)				\
     89 	_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
     90 #define	isa_dmamem_free(ic, c, a, s)					\
     91 	_isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
     92 #define	isa_dmamem_map(ic, c, a, s, kp, f)				\
     93 	_isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
     94 #define	isa_dmamem_unmap(ic, c, k, s)					\
     95 	_isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
     96 #define	isa_dmamem_mmap(ic, c, a, s, o, p, f)				\
     97 	_isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
     98 #define isa_drq_alloc(ic, c)						\
     99 	_isa_drq_alloc(&(ic)->ic_dmastate, c)
    100 #define isa_drq_free(ic, c)						\
    101 	_isa_drq_free(&(ic)->ic_dmastate, c)
    102 #define	isa_drq_isfree(ic, c)						\
    103 	_isa_drq_isfree(&(ic)->ic_dmastate, (c))
    104 #define	isa_malloc(ic, c, s, p, f)					\
    105 	_isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
    106 #define	isa_free(a, p)							\
    107 	_isa_free((a), (p))
    108 #define	isa_mappage(m, o, p)						\
    109 	_isa_mappage((m), (o), (p))
    110 
    111 /*
    112  * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
    113  * BY PORTABLE CODE.
    114  */
    115 
    116 extern struct arm32_bus_dma_tag isa_bus_dma_tag;
    117 
    118 /* bus space tags */
    119 extern struct bus_space isa_io_bs_tag;
    120 extern struct bus_space isa_mem_bs_tag;
    121 
    122 /* ISA chipset */
    123 extern struct arm32_isa_chipset isa_chipset_tag;
    124 
    125 /* for pccons.c */
    126 #define MONO_BASE           0x3B4
    127 #define MONO_BUF            0x000B0000
    128 #define CGA_BASE            0x3D4
    129 #define CGA_BUF             0x000B8000
    130 #define VGA_BUF             0xA0000
    131 #define VGA_BUF_LEN         (0xBFFFF - 0xA0000)
    132 
    133 void	isa_init(vaddr_t, vaddr_t);
    134 void	isa_io_init(vaddr_t, vaddr_t);
    135 void	isa_dma_init(void);
    136 vaddr_t	isa_io_data_vaddr(void);
    137 vaddr_t	isa_mem_data_vaddr(void);
    138 int isa_intr_alloc(isa_chipset_tag_t ic, int mask, int type, int *irq);
    139 void	isa_intr_init(void);
    140 
    141 /*
    142  * Miscellanous functions.
    143  */
    144 void sysbeep(int, int);		/* beep with the system speaker */
    145 void isa_fillw(u_int val, void *addr, size_t len);
    146 
    147 #endif	/* _ARM32_ISA_MACHDEP_H_ XXX */
    148