Home | History | Annotate | Line # | Download | only in include
isa_machdep.h revision 1.4.80.1
      1  1.4.80.1    chris /*	$NetBSD: isa_machdep.h,v 1.4.80.1 2007/08/11 21:14:51 chris Exp $	*/
      2       1.1  reinoud 
      3       1.1  reinoud /*-
      4       1.1  reinoud  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
      5       1.1  reinoud  * All rights reserved.
      6       1.1  reinoud  *
      7       1.1  reinoud  * This code is derived from software contributed to The NetBSD Foundation
      8       1.1  reinoud  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9       1.1  reinoud  * NASA Ames Research Center.
     10       1.1  reinoud  *
     11       1.1  reinoud  * Redistribution and use in source and binary forms, with or without
     12       1.1  reinoud  * modification, are permitted provided that the following conditions
     13       1.1  reinoud  * are met:
     14       1.1  reinoud  * 1. Redistributions of source code must retain the above copyright
     15       1.1  reinoud  *    notice, this list of conditions and the following disclaimer.
     16       1.1  reinoud  * 2. Redistributions in binary form must reproduce the above copyright
     17       1.1  reinoud  *    notice, this list of conditions and the following disclaimer in the
     18       1.1  reinoud  *    documentation and/or other materials provided with the distribution.
     19       1.1  reinoud  * 3. All advertising materials mentioning features or use of this software
     20       1.1  reinoud  *    must display the following acknowledgement:
     21       1.1  reinoud  *	This product includes software developed by the NetBSD
     22       1.1  reinoud  *	Foundation, Inc. and its contributors.
     23       1.1  reinoud  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24       1.1  reinoud  *    contributors may be used to endorse or promote products derived
     25       1.1  reinoud  *    from this software without specific prior written permission.
     26       1.1  reinoud  *
     27       1.1  reinoud  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28       1.1  reinoud  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29       1.1  reinoud  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30       1.1  reinoud  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31       1.1  reinoud  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32       1.1  reinoud  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33       1.1  reinoud  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34       1.1  reinoud  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35       1.1  reinoud  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36       1.1  reinoud  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37       1.1  reinoud  * POSSIBILITY OF SUCH DAMAGE.
     38       1.1  reinoud  */
     39       1.1  reinoud 
     40       1.1  reinoud #ifndef _ARM32_ISA_MACHDEP_H_
     41       1.1  reinoud #define _ARM32_ISA_MACHDEP_H_
     42       1.1  reinoud 
     43       1.1  reinoud #include <machine/bus.h>
     44       1.1  reinoud #include <dev/isa/isadmavar.h>
     45       1.1  reinoud 
     46       1.1  reinoud /*
     47       1.1  reinoud  * Types provided to machine-independent ISA code.
     48       1.1  reinoud  */
     49       1.1  reinoud struct arm32_isa_chipset {
     50       1.1  reinoud 	struct isa_dma_state ic_dmastate;
     51  1.4.80.1    chris #ifdef __HAVE_GENERIC_ARM_INTERRUPTS
     52  1.4.80.1    chris 	irqgroup_t	ic_irqgroup;
     53  1.4.80.1    chris #endif
     54       1.1  reinoud };
     55       1.1  reinoud 
     56       1.1  reinoud typedef struct arm32_isa_chipset *isa_chipset_tag_t;
     57       1.1  reinoud 
     58       1.1  reinoud struct device;			/* XXX */
     59       1.1  reinoud struct isabus_attach_args;	/* XXX */
     60       1.1  reinoud 
     61       1.1  reinoud /*
     62       1.1  reinoud  * Functions provided to machine-independent ISA code.
     63       1.1  reinoud  */
     64       1.1  reinoud void	isa_attach_hook(struct device *, struct device *,
     65       1.1  reinoud 	    struct isabus_attach_args *);
     66       1.1  reinoud const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq);
     67       1.1  reinoud void	*isa_intr_establish(isa_chipset_tag_t ic, int irq, int type,
     68       1.1  reinoud 	    int level, int (*ih_fun)(void *), void *ih_arg);
     69       1.1  reinoud void	isa_intr_disestablish(isa_chipset_tag_t ic, void *handler);
     70       1.1  reinoud 
     71       1.1  reinoud #define	isa_dmainit(ic, bst, dmat, d)					\
     72       1.1  reinoud 	_isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
     73       1.1  reinoud #define	isa_dmacascade(ic, c)						\
     74       1.1  reinoud 	_isa_dmacascade(&(ic)->ic_dmastate, (c))
     75       1.1  reinoud #define	isa_dmamaxsize(ic, c)						\
     76       1.1  reinoud 	_isa_dmamaxsize(&(ic)->ic_dmastate, (c))
     77       1.1  reinoud #define	isa_dmamap_create(ic, c, s, f)					\
     78       1.1  reinoud 	_isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
     79       1.1  reinoud #define	isa_dmamap_destroy(ic, c)					\
     80       1.1  reinoud 	_isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
     81       1.1  reinoud #define	isa_dmastart(ic, c, a, n, p, f, bf)				\
     82       1.1  reinoud 	_isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
     83       1.1  reinoud #define	isa_dmaabort(ic, c)						\
     84       1.1  reinoud 	_isa_dmaabort(&(ic)->ic_dmastate, (c))
     85       1.1  reinoud #define	isa_dmacount(ic, c)						\
     86       1.1  reinoud 	_isa_dmacount(&(ic)->ic_dmastate, (c))
     87       1.1  reinoud #define	isa_dmafinished(ic, c)						\
     88       1.1  reinoud 	_isa_dmafinished(&(ic)->ic_dmastate, (c))
     89       1.1  reinoud #define	isa_dmadone(ic, c)						\
     90       1.1  reinoud 	_isa_dmadone(&(ic)->ic_dmastate, (c))
     91       1.1  reinoud #define	isa_dmafreeze(ic)						\
     92       1.1  reinoud 	_isa_dmafreeze(&(ic)->ic_dmastate)
     93       1.1  reinoud #define	isa_dmathaw(ic)							\
     94       1.1  reinoud 	_isa_dmathaw(&(ic)->ic_dmastate)
     95       1.1  reinoud #define	isa_dmamem_alloc(ic, c, s, ap, f)				\
     96       1.1  reinoud 	_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
     97       1.1  reinoud #define	isa_dmamem_free(ic, c, a, s)					\
     98       1.1  reinoud 	_isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
     99       1.1  reinoud #define	isa_dmamem_map(ic, c, a, s, kp, f)				\
    100       1.1  reinoud 	_isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
    101       1.1  reinoud #define	isa_dmamem_unmap(ic, c, k, s)					\
    102       1.1  reinoud 	_isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
    103       1.1  reinoud #define	isa_dmamem_mmap(ic, c, a, s, o, p, f)				\
    104       1.1  reinoud 	_isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
    105       1.4     fvdl #define isa_drq_alloc(ic, c)						\
    106       1.4     fvdl 	_isa_drq_alloc(&(ic)->ic_dmastate, c)
    107       1.4     fvdl #define isa_drq_free(ic, c)						\
    108       1.4     fvdl 	_isa_drq_free(&(ic)->ic_dmastate, c)
    109       1.1  reinoud #define	isa_drq_isfree(ic, c)						\
    110       1.1  reinoud 	_isa_drq_isfree(&(ic)->ic_dmastate, (c))
    111       1.1  reinoud #define	isa_malloc(ic, c, s, p, f)					\
    112       1.1  reinoud 	_isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
    113       1.1  reinoud #define	isa_free(a, p)							\
    114       1.1  reinoud 	_isa_free((a), (p))
    115       1.1  reinoud #define	isa_mappage(m, o, p)						\
    116       1.1  reinoud 	_isa_mappage((m), (o), (p))
    117       1.1  reinoud 
    118       1.1  reinoud /*
    119       1.1  reinoud  * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
    120       1.1  reinoud  * BY PORTABLE CODE.
    121       1.1  reinoud  */
    122       1.1  reinoud 
    123       1.1  reinoud extern struct arm32_bus_dma_tag isa_bus_dma_tag;
    124       1.1  reinoud 
    125       1.1  reinoud /*
    126       1.1  reinoud  * Cookie used by ISA DMA.  A pointer to one of these is stashed in
    127       1.1  reinoud  * the DMA map.
    128       1.1  reinoud  */
    129       1.1  reinoud struct arm32_isa_dma_cookie {
    130       1.1  reinoud 	int	id_flags;		/* flags; see below */
    131       1.1  reinoud 
    132       1.1  reinoud 	/*
    133       1.1  reinoud 	 * Information about the original buffer used during
    134       1.1  reinoud 	 * DMA map syncs.  Note that origbuflen is only used
    135       1.1  reinoud 	 * for ID_BUFTYPE_LINEAR.
    136       1.1  reinoud 	 */
    137       1.1  reinoud 	void	*id_origbuf;		/* pointer to orig buffer if
    138       1.1  reinoud 					   bouncing */
    139       1.1  reinoud 	bus_size_t id_origbuflen;	/* ...and size */
    140       1.1  reinoud 	int	id_buftype;		/* type of buffer */
    141       1.1  reinoud 
    142       1.1  reinoud 	void	*id_bouncebuf;		/* pointer to the bounce buffer */
    143       1.1  reinoud 	bus_size_t id_bouncebuflen;	/* ...and size */
    144       1.1  reinoud 	int	id_nbouncesegs;		/* number of valid bounce segs */
    145       1.1  reinoud 	bus_dma_segment_t id_bouncesegs[0]; /* array of bounce buffer
    146       1.1  reinoud 					       physical memory segments */
    147       1.1  reinoud };
    148       1.1  reinoud 
    149       1.1  reinoud /* id_flags */
    150       1.1  reinoud #define	ID_MIGHT_NEED_BOUNCE	0x01	/* map could need bounce buffers */
    151       1.1  reinoud #define	ID_HAS_BOUNCE		0x02	/* map currently has bounce buffers */
    152       1.1  reinoud #define	ID_IS_BOUNCING		0x04	/* map is bouncing current xfer */
    153       1.1  reinoud 
    154       1.1  reinoud /* id_buftype */
    155       1.1  reinoud #define	ID_BUFTYPE_INVALID	0
    156       1.1  reinoud #define	ID_BUFTYPE_LINEAR	1
    157       1.1  reinoud #define	ID_BUFTYPE_MBUF		2
    158       1.1  reinoud #define	ID_BUFTYPE_UIO		3
    159       1.1  reinoud #define	ID_BUFTYPE_RAW		4
    160       1.1  reinoud 
    161       1.1  reinoud /* bus space tags */
    162       1.1  reinoud extern struct bus_space isa_io_bs_tag;
    163       1.1  reinoud extern struct bus_space isa_mem_bs_tag;
    164       1.1  reinoud 
    165       1.1  reinoud /* ISA chipset */
    166       1.1  reinoud extern struct arm32_isa_chipset isa_chipset_tag;
    167       1.1  reinoud 
    168       1.1  reinoud /* for pccons.c */
    169       1.1  reinoud #define MONO_BASE           0x3B4
    170       1.1  reinoud #define MONO_BUF            0x000B0000
    171       1.1  reinoud #define CGA_BASE            0x3D4
    172       1.1  reinoud #define CGA_BUF             0x000B8000
    173       1.1  reinoud #define VGA_BUF             0xA0000
    174       1.1  reinoud #define VGA_BUF_LEN         (0xBFFFF - 0xA0000)
    175       1.1  reinoud 
    176       1.2     matt void	isa_init(vaddr_t, vaddr_t);
    177       1.2     matt void	isa_io_init(vaddr_t, vaddr_t);
    178       1.2     matt void	isa_dma_init(void);
    179       1.2     matt vaddr_t	isa_io_data_vaddr(void);
    180       1.2     matt vaddr_t	isa_mem_data_vaddr(void);
    181       1.1  reinoud int isa_intr_alloc(isa_chipset_tag_t ic, int mask, int type, int *irq);
    182       1.3    chris void	isa_intr_init(void);
    183       1.1  reinoud 
    184       1.1  reinoud /*
    185       1.1  reinoud  * Miscellanous functions.
    186       1.1  reinoud  */
    187       1.1  reinoud void sysbeep(int, int);		/* beep with the system speaker */
    188       1.2     matt void isa_fillw(u_int val, void *addr, size_t len);
    189       1.1  reinoud 
    190       1.1  reinoud #endif	/* _ARM32_ISA_MACHDEP_H_ XXX */
    191